repo_name
stringclasses
6 values
pr_number
int64
512
78.9k
pr_title
stringlengths
3
144
pr_description
stringlengths
0
30.3k
author
stringlengths
2
21
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
17
30.4k
filepath
stringlengths
9
210
before_content
stringlengths
0
112M
after_content
stringlengths
0
112M
label
int64
-1
1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/VisualStudio/Core/Test/CodeModel/VisualBasic/ExternalCodeFunctionTests.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Test.Utilities Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasic Public Class ExternalCodeFunctionTests Inherits AbstractCodeFunctionTests #Region "FullName tests" <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModel)> Public Sub TestFullName1() Dim code = <Code> Class C Sub $$Goo(string s) End Sub End Class </Code> TestFullName(code, "C.Goo") End Sub #End Region #Region "Name tests" <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModel)> Public Sub TestName1() Dim code = <Code> Class C Sub $$Goo(string s) End Sub End Class </Code> TestName(code, "Goo") End Sub #End Region Protected Overrides ReadOnly Property LanguageName As String = LanguageNames.VisualBasic Protected Overrides ReadOnly Property TargetExternalCodeElements As Boolean = True End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Test.Utilities Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasic Public Class ExternalCodeFunctionTests Inherits AbstractCodeFunctionTests #Region "FullName tests" <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModel)> Public Sub TestFullName1() Dim code = <Code> Class C Sub $$Goo(string s) End Sub End Class </Code> TestFullName(code, "C.Goo") End Sub #End Region #Region "Name tests" <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModel)> Public Sub TestName1() Dim code = <Code> Class C Sub $$Goo(string s) End Sub End Class </Code> TestName(code, "Goo") End Sub #End Region Protected Overrides ReadOnly Property LanguageName As String = LanguageNames.VisualBasic Protected Overrides ReadOnly Property TargetExternalCodeElements As Boolean = True End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/Core/Portable/FindSymbols/SearchKind.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.FindSymbols { internal enum SearchKind { /// <summary> /// Use an case-sensitive comparison when searching for matching items. /// </summary> Exact, /// <summary> /// Use a case-insensitive comparison when searching for matching items. /// </summary> ExactIgnoreCase, /// <summary> /// Use a fuzzy comparison when searching for matching items. Fuzzy matching allows for /// a certain amount of misspellings, missing words, etc. See <see cref="SpellChecker"/> for /// more details. /// </summary> Fuzzy, /// <summary> /// Search term is matched in a custom manner (i.e. with a user provided predicate). /// </summary> Custom } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.FindSymbols { internal enum SearchKind { /// <summary> /// Use an case-sensitive comparison when searching for matching items. /// </summary> Exact, /// <summary> /// Use a case-insensitive comparison when searching for matching items. /// </summary> ExactIgnoreCase, /// <summary> /// Use a fuzzy comparison when searching for matching items. Fuzzy matching allows for /// a certain amount of misspellings, missing words, etc. See <see cref="SpellChecker"/> for /// more details. /// </summary> Fuzzy, /// <summary> /// Search term is matched in a custom manner (i.e. with a user provided predicate). /// </summary> Custom } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService_IntroduceQueryLocal.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.IntroduceVariable { internal partial class CSharpIntroduceVariableService { private static bool IsAnyQueryClause(SyntaxNode node) => node is QueryClauseSyntax || node is SelectOrGroupClauseSyntax; protected override Task<Document> IntroduceQueryLocalAsync( SemanticDocument document, ExpressionSyntax expression, bool allOccurrences, CancellationToken cancellationToken) { var oldOutermostQuery = expression.GetAncestorsOrThis<QueryExpressionSyntax>().LastOrDefault(); var newLocalNameToken = GenerateUniqueLocalName( document, expression, isConstant: false, containerOpt: oldOutermostQuery, cancellationToken: cancellationToken); var newLocalName = SyntaxFactory.IdentifierName(newLocalNameToken); var letClause = SyntaxFactory.LetClause( newLocalNameToken.WithAdditionalAnnotations(RenameAnnotation.Create()), expression).WithAdditionalAnnotations(Formatter.Annotation); var matches = FindMatches(document, expression, document, oldOutermostQuery, allOccurrences, cancellationToken); var innermostClauses = new HashSet<SyntaxNode>( matches.Select(expr => expr.GetAncestorsOrThis<SyntaxNode>().First(IsAnyQueryClause))); if (innermostClauses.Count == 1) { // If there was only one match, or all the matches came from the same // statement, then we want to place the declaration right above that // statement. Note: we special case this because the statement we are going // to go above might not be in a block and we may have to generate it return Task.FromResult(IntroduceQueryLocalForSingleOccurrence( document, expression, newLocalName, letClause, allOccurrences, cancellationToken)); } var oldInnerMostCommonQuery = matches.FindInnermostCommonNode<QueryExpressionSyntax>(); var newInnerMostQuery = Rewrite( document, expression, newLocalName, document, oldInnerMostCommonQuery, allOccurrences, cancellationToken); var allAffectedClauses = new HashSet<SyntaxNode>(matches.SelectMany(expr => expr.GetAncestorsOrThis<SyntaxNode>().Where(IsAnyQueryClause))); var oldClauses = oldInnerMostCommonQuery.GetAllClauses(); var newClauses = newInnerMostQuery.GetAllClauses(); var firstClauseAffectedInQuery = oldClauses.First(allAffectedClauses.Contains); var firstClauseAffectedIndex = oldClauses.IndexOf(firstClauseAffectedInQuery); var finalClauses = newClauses.Take(firstClauseAffectedIndex) .Concat(letClause) .Concat(newClauses.Skip(firstClauseAffectedIndex)).ToList(); var finalQuery = newInnerMostQuery.WithAllClauses(finalClauses); var newRoot = document.Root.ReplaceNode(oldInnerMostCommonQuery, finalQuery); return Task.FromResult(document.Document.WithSyntaxRoot(newRoot)); } private Document IntroduceQueryLocalForSingleOccurrence( SemanticDocument document, ExpressionSyntax expression, NameSyntax newLocalName, LetClauseSyntax letClause, bool allOccurrences, CancellationToken cancellationToken) { var oldClause = expression.GetAncestors<SyntaxNode>().First(IsAnyQueryClause); var newClause = Rewrite( document, expression, newLocalName, document, oldClause, allOccurrences, cancellationToken); var oldQuery = (QueryBodySyntax)oldClause.Parent; var newQuery = GetNewQuery(oldQuery, oldClause, newClause, letClause); var newRoot = document.Root.ReplaceNode(oldQuery, newQuery); return document.Document.WithSyntaxRoot(newRoot); } private static QueryBodySyntax GetNewQuery( QueryBodySyntax oldQuery, SyntaxNode oldClause, SyntaxNode newClause, LetClauseSyntax letClause) { var oldClauses = oldQuery.GetAllClauses(); var oldClauseIndex = oldClauses.IndexOf(oldClause); var newClauses = oldClauses.Take(oldClauseIndex) .Concat(letClause) .Concat(newClause) .Concat(oldClauses.Skip(oldClauseIndex + 1)).ToList(); return oldQuery.WithAllClauses(newClauses); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.IntroduceVariable { internal partial class CSharpIntroduceVariableService { private static bool IsAnyQueryClause(SyntaxNode node) => node is QueryClauseSyntax || node is SelectOrGroupClauseSyntax; protected override Task<Document> IntroduceQueryLocalAsync( SemanticDocument document, ExpressionSyntax expression, bool allOccurrences, CancellationToken cancellationToken) { var oldOutermostQuery = expression.GetAncestorsOrThis<QueryExpressionSyntax>().LastOrDefault(); var newLocalNameToken = GenerateUniqueLocalName( document, expression, isConstant: false, containerOpt: oldOutermostQuery, cancellationToken: cancellationToken); var newLocalName = SyntaxFactory.IdentifierName(newLocalNameToken); var letClause = SyntaxFactory.LetClause( newLocalNameToken.WithAdditionalAnnotations(RenameAnnotation.Create()), expression).WithAdditionalAnnotations(Formatter.Annotation); var matches = FindMatches(document, expression, document, oldOutermostQuery, allOccurrences, cancellationToken); var innermostClauses = new HashSet<SyntaxNode>( matches.Select(expr => expr.GetAncestorsOrThis<SyntaxNode>().First(IsAnyQueryClause))); if (innermostClauses.Count == 1) { // If there was only one match, or all the matches came from the same // statement, then we want to place the declaration right above that // statement. Note: we special case this because the statement we are going // to go above might not be in a block and we may have to generate it return Task.FromResult(IntroduceQueryLocalForSingleOccurrence( document, expression, newLocalName, letClause, allOccurrences, cancellationToken)); } var oldInnerMostCommonQuery = matches.FindInnermostCommonNode<QueryExpressionSyntax>(); var newInnerMostQuery = Rewrite( document, expression, newLocalName, document, oldInnerMostCommonQuery, allOccurrences, cancellationToken); var allAffectedClauses = new HashSet<SyntaxNode>(matches.SelectMany(expr => expr.GetAncestorsOrThis<SyntaxNode>().Where(IsAnyQueryClause))); var oldClauses = oldInnerMostCommonQuery.GetAllClauses(); var newClauses = newInnerMostQuery.GetAllClauses(); var firstClauseAffectedInQuery = oldClauses.First(allAffectedClauses.Contains); var firstClauseAffectedIndex = oldClauses.IndexOf(firstClauseAffectedInQuery); var finalClauses = newClauses.Take(firstClauseAffectedIndex) .Concat(letClause) .Concat(newClauses.Skip(firstClauseAffectedIndex)).ToList(); var finalQuery = newInnerMostQuery.WithAllClauses(finalClauses); var newRoot = document.Root.ReplaceNode(oldInnerMostCommonQuery, finalQuery); return Task.FromResult(document.Document.WithSyntaxRoot(newRoot)); } private Document IntroduceQueryLocalForSingleOccurrence( SemanticDocument document, ExpressionSyntax expression, NameSyntax newLocalName, LetClauseSyntax letClause, bool allOccurrences, CancellationToken cancellationToken) { var oldClause = expression.GetAncestors<SyntaxNode>().First(IsAnyQueryClause); var newClause = Rewrite( document, expression, newLocalName, document, oldClause, allOccurrences, cancellationToken); var oldQuery = (QueryBodySyntax)oldClause.Parent; var newQuery = GetNewQuery(oldQuery, oldClause, newClause, letClause); var newRoot = document.Root.ReplaceNode(oldQuery, newQuery); return document.Document.WithSyntaxRoot(newRoot); } private static QueryBodySyntax GetNewQuery( QueryBodySyntax oldQuery, SyntaxNode oldClause, SyntaxNode newClause, LetClauseSyntax letClause) { var oldClauses = oldQuery.GetAllClauses(); var oldClauseIndex = oldClauses.IndexOf(oldClause); var newClauses = oldClauses.Take(oldClauseIndex) .Concat(letClause) .Concat(newClause) .Concat(oldClauses.Skip(oldClauseIndex + 1)).ToList(); return oldQuery.WithAllClauses(newClauses); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/CSharpTest/ChangeSignature/AddParameterTests.OptionalParameter.Infer.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.ChangeSignature; using Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities.ChangeSignature; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ChangeSignature { public partial class ChangeSignatureTests : AbstractChangeSignatureTests { [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_NoOptions() { var markup = @" class C { void M$$() { M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { M(TODO); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleLocal() { var markup = @" class C { void M$$() { int x = 7; M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { int x = 7; M(x); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_NotOnInaccessibleLocal() { var markup = @" class C { void M$$() { M(); int x = 7; } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { M(TODO); int x = 7; } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_MultipleLocals() { var markup = @" class C { void M$$() { int x = 7; int y = 8; M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { int x = 7; int y = 8; M(y); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleParameter() { var markup = @" class C { void M$$(int x) { M(1); } }"; var updatedSignature = new[] { new AddedParameterOrExistingIndex(0), AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int x, int a) { M(1, x); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleField() { var markup = @" class C { int x = 8; void M$$() { M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { int x = 8; void M(int a) { M(x); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleProperty() { var markup = @" class C { int X { get; set; } void M$$() { M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { int X { get; set; } void M(int a) { M(X); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_ImplicitlyConvertable() { var markup = @" class B { } class D : B { } class C { void M$$() { D d = null; M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("B", "b", CallSiteKind.Inferred) }; var updatedCode = @" class B { } class D : B { } class C { void M(B b) { D d = null; M(d); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.ChangeSignature; using Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities.ChangeSignature; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ChangeSignature { public partial class ChangeSignatureTests : AbstractChangeSignatureTests { [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_NoOptions() { var markup = @" class C { void M$$() { M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { M(TODO); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleLocal() { var markup = @" class C { void M$$() { int x = 7; M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { int x = 7; M(x); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_NotOnInaccessibleLocal() { var markup = @" class C { void M$$() { M(); int x = 7; } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { M(TODO); int x = 7; } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_MultipleLocals() { var markup = @" class C { void M$$() { int x = 7; int y = 8; M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int a) { int x = 7; int y = 8; M(y); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleParameter() { var markup = @" class C { void M$$(int x) { M(1); } }"; var updatedSignature = new[] { new AddedParameterOrExistingIndex(0), AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { void M(int x, int a) { M(1, x); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleField() { var markup = @" class C { int x = 8; void M$$() { M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { int x = 8; void M(int a) { M(x); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_SingleProperty() { var markup = @" class C { int X { get; set; } void M$$() { M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("System.Int32", "a", CallSiteKind.Inferred) }; var updatedCode = @" class C { int X { get; set; } void M(int a) { M(X); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] public async Task AddOptionalParameter_CallsiteInferred_ImplicitlyConvertable() { var markup = @" class B { } class D : B { } class C { void M$$() { D d = null; M(); } }"; var updatedSignature = new[] { AddedParameterOrExistingIndex.CreateAdded("B", "b", CallSiteKind.Inferred) }; var updatedCode = @" class B { } class D : B { } class C { void M(B b) { D d = null; M(d); } }"; await TestChangeSignatureViaCommandAsync(LanguageNames.CSharp, markup, updatedSignature: updatedSignature, expectedUpdatedInvocationDocumentCode: updatedCode); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/CSharpTest/SignatureHelp/GenericNamePartiallyWrittenSignatureHelpProviderTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.SignatureHelp; using Microsoft.CodeAnalysis.Editor.UnitTests.SignatureHelp; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SignatureHelp { public class GenericNamePartiallyWrittenSignatureHelpProviderTests : AbstractCSharpSignatureHelpProviderTests { internal override Type GetSignatureHelpProviderType() => typeof(GenericNamePartiallyWrittenSignatureHelpProvider); [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task NestedGenericUnterminated() { var markup = @" class G<T> { }; class C { void Goo() { G<G<int>$$ } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<T>", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [WorkItem(544088, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544088")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task DeclaringGenericTypeWith1ParameterUnterminated() { var markup = @" class G<T> { }; class C { void Goo() { [|G<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<T>", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task CallingGenericAsyncMethod() { var markup = @" using System.Threading.Tasks; class Program { void Main(string[] args) { Goo<$$ } Task<int> Goo<T>() { return Goo<T>(); } } "; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem($"({CSharpFeaturesResources.awaitable}) Task<int> Program.Goo<T>()", methodDocumentation: string.Empty, string.Empty, currentParameterIndex: 0)); // TODO: Enable the script case when we have support for extension methods in scripts await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: false, sourceCodeKind: Microsoft.CodeAnalysis.SourceCodeKind.Regular); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableAlways() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)] public void Goo<T>(T x) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableNever() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void Goo<T>(T x) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableAdvanced() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] public void Goo<T>(T x) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp, hideAdvancedMembers: false); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp, hideAdvancedMembers: true); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableMixed() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)] public void Goo<T>(T x) { } [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void Goo<T, U>(T x, U y) { } }"; var expectedOrderedItemsMetadataReference = new List<SignatureHelpTestItem>(); expectedOrderedItemsMetadataReference.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); var expectedOrderedItemsSameSolution = new List<SignatureHelpTestItem>(); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C.Goo<T, U>(T x, U y)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItemsMetadataReference, expectedOrderedItemsSameSolution: expectedOrderedItemsSameSolution, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task GenericExtensionMethod() { var markup = @" interface IGoo { void Bar<T>(); } static class GooExtensions { public static void Bar<T1, T2>(this IGoo goo) { } } class Program { static void Main() { IGoo f = null; f.[|Bar<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void IGoo.Bar<T>()", currentParameterIndex: 0), new SignatureHelpTestItem($"({CSharpFeaturesResources.extension}) void IGoo.Bar<T1, T2>()", currentParameterIndex: 0), }; // Extension methods are supported in Interactive/Script (yet). await TestAsync(markup, expectedOrderedItems, sourceCodeKind: SourceCodeKind.Regular); } [WorkItem(544088, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544088")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InvokingGenericMethodWith1ParameterUnterminated() { var markup = @" class C { /// <summary> /// Method Goo /// </summary> /// <typeparam name=""T"">Method type parameter</typeparam> void Goo<T>() { } void Bar() { [|Goo<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>()", "Method Goo", "Method type parameter", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnTriggerBracket() { var markup = @" class G<S, T> { }; class C { void Goo() { [|G<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<S, T>", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnTriggerComma() { var markup = @" class G<S, T> { }; class C { void Goo() { [|G<int,$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<S, T>", string.Empty, string.Empty, currentParameterIndex: 1)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [WorkItem(1067933, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1067933")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InvokedWithNoToken() { var markup = @" // goo<$$"; await TestAsync(markup); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.SignatureHelp; using Microsoft.CodeAnalysis.Editor.UnitTests.SignatureHelp; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SignatureHelp { public class GenericNamePartiallyWrittenSignatureHelpProviderTests : AbstractCSharpSignatureHelpProviderTests { internal override Type GetSignatureHelpProviderType() => typeof(GenericNamePartiallyWrittenSignatureHelpProvider); [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task NestedGenericUnterminated() { var markup = @" class G<T> { }; class C { void Goo() { G<G<int>$$ } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<T>", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [WorkItem(544088, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544088")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task DeclaringGenericTypeWith1ParameterUnterminated() { var markup = @" class G<T> { }; class C { void Goo() { [|G<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<T>", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task CallingGenericAsyncMethod() { var markup = @" using System.Threading.Tasks; class Program { void Main(string[] args) { Goo<$$ } Task<int> Goo<T>() { return Goo<T>(); } } "; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem($"({CSharpFeaturesResources.awaitable}) Task<int> Program.Goo<T>()", methodDocumentation: string.Empty, string.Empty, currentParameterIndex: 0)); // TODO: Enable the script case when we have support for extension methods in scripts await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: false, sourceCodeKind: Microsoft.CodeAnalysis.SourceCodeKind.Regular); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableAlways() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)] public void Goo<T>(T x) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableNever() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void Goo<T>(T x) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableAdvanced() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] public void Goo<T>(T x) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp, hideAdvancedMembers: false); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp, hideAdvancedMembers: true); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericMethod_BrowsableMixed() { var markup = @" class Program { void M() { new C().Goo<$$ } } "; var referencedCode = @" public class C { [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)] public void Goo<T>(T x) { } [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public void Goo<T, U>(T x, U y) { } }"; var expectedOrderedItemsMetadataReference = new List<SignatureHelpTestItem>(); expectedOrderedItemsMetadataReference.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); var expectedOrderedItemsSameSolution = new List<SignatureHelpTestItem>(); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C.Goo<T>(T x)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C.Goo<T, U>(T x, U y)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItemsMetadataReference, expectedOrderedItemsSameSolution: expectedOrderedItemsSameSolution, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task GenericExtensionMethod() { var markup = @" interface IGoo { void Bar<T>(); } static class GooExtensions { public static void Bar<T1, T2>(this IGoo goo) { } } class Program { static void Main() { IGoo f = null; f.[|Bar<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void IGoo.Bar<T>()", currentParameterIndex: 0), new SignatureHelpTestItem($"({CSharpFeaturesResources.extension}) void IGoo.Bar<T1, T2>()", currentParameterIndex: 0), }; // Extension methods are supported in Interactive/Script (yet). await TestAsync(markup, expectedOrderedItems, sourceCodeKind: SourceCodeKind.Regular); } [WorkItem(544088, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544088")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InvokingGenericMethodWith1ParameterUnterminated() { var markup = @" class C { /// <summary> /// Method Goo /// </summary> /// <typeparam name=""T"">Method type parameter</typeparam> void Goo<T>() { } void Bar() { [|Goo<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo<T>()", "Method Goo", "Method type parameter", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnTriggerBracket() { var markup = @" class G<S, T> { }; class C { void Goo() { [|G<$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<S, T>", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnTriggerComma() { var markup = @" class G<S, T> { }; class C { void Goo() { [|G<int,$$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("G<S, T>", string.Empty, string.Empty, currentParameterIndex: 1)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [WorkItem(1067933, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1067933")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InvokedWithNoToken() { var markup = @" // goo<$$"; await TestAsync(markup); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Server/VBCSCompilerTests/TestableClientConnection.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CommandLine; namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests { internal sealed class TestableClientConnection : IClientConnection { public string LoggingIdentifier { get; set; } = "TestableClient"; public Task DisconnectTask { get; set; } = new TaskCompletionSource<object>().Task; public Action DisposeFunc { get; set; } = delegate { }; public Func<CancellationToken, Task<BuildRequest>> ReadBuildRequestFunc = delegate { throw new Exception(); }; public Func<BuildResponse, CancellationToken, Task> WriteBuildResponseFunc = delegate { throw new Exception(); }; public void Dispose() => DisposeFunc(); public Task<BuildRequest> ReadBuildRequestAsync(CancellationToken cancellationToken) => ReadBuildRequestFunc(cancellationToken); public Task WriteBuildResponseAsync(BuildResponse response, CancellationToken cancellationToken) => WriteBuildResponseFunc(response, cancellationToken); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CommandLine; namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests { internal sealed class TestableClientConnection : IClientConnection { public string LoggingIdentifier { get; set; } = "TestableClient"; public Task DisconnectTask { get; set; } = new TaskCompletionSource<object>().Task; public Action DisposeFunc { get; set; } = delegate { }; public Func<CancellationToken, Task<BuildRequest>> ReadBuildRequestFunc = delegate { throw new Exception(); }; public Func<BuildResponse, CancellationToken, Task> WriteBuildResponseFunc = delegate { throw new Exception(); }; public void Dispose() => DisposeFunc(); public Task<BuildRequest> ReadBuildRequestAsync(CancellationToken cancellationToken) => ReadBuildRequestFunc(cancellationToken); public Task WriteBuildResponseAsync(BuildResponse response, CancellationToken cancellationToken) => WriteBuildResponseFunc(response, cancellationToken); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Portable/Symbols/TypeSubstitution.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Generic Imports System.Collections.Immutable Imports System.Runtime.InteropServices Imports System.Text Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' <summary> ''' Immutable. Thread-safe. ''' ''' Represents a type substitution, with substitutions of types for a set of type parameters. ''' Each TypeSubstitution object has three pieces of information: ''' - OriginalDefinition of generic symbol the substitution is targeting. ''' - An array of pairs that provide a mapping from symbol's type parameters to type arguments. ''' identity substitutions are omitted. ''' - TypeSubstitution object for containing type to provide mapping for its type ''' parameters, if any. ''' ''' The identity substitution (for the whole type hierarchy) is represented by Nothing. That said, ''' top level parent of non-Nothing instance of TypeSubstitution is guaranteed to be non-identity ''' substitution. The instance may still be an identity substitution just for target generic definition, ''' which will be represented by an empty mapping array. ''' ''' The chain of TypeSubstitution objects is guaranteed to not skip any type in the containership hierarchy, ''' even types with zero arity contained in generic type will have corresponding TypeSubstitution object with ''' empty mapping array. ''' ''' Example: ''' Class A(Of T,S) ''' Class B ''' Class C(Of U) ''' End Class ''' End Class ''' End Class ''' ''' TypeSubstitution for A(Of Integer, S).B.C(Of Byte) is C{U->Byte}=>B{}=>A{T->Integer} ''' TypeSubstitution for A(Of T, S).B.C(Of Byte) is C{U->Byte} ''' TypeSubstitution for A(Of Integer, S).B is B{}=>A{T->Integer} ''' TypeSubstitution for A(Of Integer, S).B.C(Of U) is C{}=>B{}=>A{T->Integer} ''' ''' CONSIDER: ''' An array of KeyValuePair(Of TypeParameterSymbol, TypeSymbol)objects is used to represent type ''' parameter substitution mostly due to historical reasons. It might be more convenient and more ''' efficient to use ordinal based array of TypeSymbol objects instead. ''' ''' There is a Construct method that can be called on original definition with TypeSubstitution object as ''' an argument. The advantage of that method is the ability to substitute type parameters of several types ''' in the containership hierarchy in one call. What type the TypeSubstitution parameter targets makes a ''' difference. ''' ''' For example: ''' C.Construct(C{}=>B{}=>A{T->Integer}) == A(Of Integer, S).B.C(Of U) ''' C.Construct(B{}=>A{T->Integer}) == A(Of Integer, S).B.C(Of ) ''' B.Construct(B{}=>A{T->Integer}) == A(Of Integer, S).B ''' ''' See comment for IsValidToApplyTo method as well. ''' </summary> Friend Class TypeSubstitution ''' <summary> ''' A map between type parameters of _targetGenericDefinition and corresponding type arguments. ''' Represented by an array of Key-Value pairs. Keys are type parameters of _targetGenericDefinition ''' in no particular order. Identity substitutions are omitted. ''' </summary> Private ReadOnly _pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) ''' <summary> ''' Definition of a symbol which this instance of TypeSubstitution primarily targets. ''' </summary> Private ReadOnly _targetGenericDefinition As Symbol ''' <summary> ''' An instance of TypeSubstitution describing substitution for containing type. ''' </summary> Private ReadOnly _parent As TypeSubstitution Public ReadOnly Property Pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) Get Return _pairs End Get End Property ''' <summary> ''' Get all the pairs of substitutions, including from the parent substitutions. The substitutions ''' are in order from outside-in (parent substitutions before child substitutions). ''' </summary> Public ReadOnly Property PairsIncludingParent As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) Get If _parent Is Nothing Then Return Pairs Else Dim pairBuilder = ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).GetInstance() AddPairsIncludingParentToBuilder(pairBuilder) Return pairBuilder.ToImmutableAndFree() End If End Get End Property 'Add pairs (including parent pairs) to the given array builder. Private Sub AddPairsIncludingParentToBuilder(pairBuilder As ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers))) If _parent IsNot Nothing Then _parent.AddPairsIncludingParentToBuilder(pairBuilder) End If pairBuilder.AddRange(_pairs) End Sub Public ReadOnly Property Parent As TypeSubstitution Get Return _parent End Get End Property Public ReadOnly Property TargetGenericDefinition As Symbol Get Return _targetGenericDefinition End Get End Property ' If this substitution contains the given type parameter, return the substituted type. ' Otherwise, returns the type parameter itself. Public Function GetSubstitutionFor(tp As TypeParameterSymbol) As TypeWithModifiers Debug.Assert(tp IsNot Nothing) Debug.Assert(tp.IsDefinition OrElse TargetGenericDefinition Is tp.ContainingSymbol) Dim containingSymbol As Symbol = tp.ContainingSymbol Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is containingSymbol Then For Each p In current.Pairs If p.Key.Equals(tp) Then Return p.Value Next ' not found, return the passed in type parameters Return New TypeWithModifiers(tp, ImmutableArray(Of CustomModifier).Empty) End If current = current.Parent Loop While current IsNot Nothing ' not found, return the passed in type parameters Return New TypeWithModifiers(tp, ImmutableArray(Of CustomModifier).Empty) End Function Public Function GetTypeArgumentsFor(originalDefinition As NamedTypeSymbol, <Out> ByRef hasTypeArgumentsCustomModifiers As Boolean) As ImmutableArray(Of TypeSymbol) Debug.Assert(originalDefinition IsNot Nothing) Debug.Assert(originalDefinition.IsDefinition) Debug.Assert(originalDefinition.Arity > 0) Dim current As TypeSubstitution = Me Dim result = ArrayBuilder(Of TypeSymbol).GetInstance(originalDefinition.Arity, fillWithValue:=Nothing) hasTypeArgumentsCustomModifiers = False Do If current.TargetGenericDefinition Is originalDefinition Then For Each p In current.Pairs result(p.Key.Ordinal) = p.Value.Type If Not p.Value.CustomModifiers.IsDefaultOrEmpty Then hasTypeArgumentsCustomModifiers = True End If Next Exit Do End If current = current.Parent Loop While current IsNot Nothing For i As Integer = 0 To result.Count - 1 If result(i) Is Nothing Then result(i) = originalDefinition.TypeParameters(i) End If Next Return result.ToImmutableAndFree() End Function Public Function GetTypeArgumentsCustomModifiersFor(originalDefinition As TypeParameterSymbol) As ImmutableArray(Of CustomModifier) Debug.Assert(originalDefinition IsNot Nothing) Debug.Assert(originalDefinition.IsDefinition) Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is originalDefinition.ContainingSymbol Then For Each p In current.Pairs If p.Key.Ordinal = originalDefinition.Ordinal Then Return p.Value.CustomModifiers End If Next Exit Do End If current = current.Parent Loop While current IsNot Nothing Return ImmutableArray(Of CustomModifier).Empty End Function Public Function HasTypeArgumentsCustomModifiersFor(originalDefinition As NamedTypeSymbol) As Boolean Debug.Assert(originalDefinition IsNot Nothing) Debug.Assert(originalDefinition.IsDefinition) Debug.Assert(originalDefinition.Arity > 0) Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is originalDefinition Then For Each p In current.Pairs If Not p.Value.CustomModifiers.IsDefaultOrEmpty Then Return True End If Next Exit Do End If current = current.Parent Loop While current IsNot Nothing Return False End Function ''' <summary> ''' Verify TypeSubstitution to make sure it doesn't map any ''' type parameter to an alpha-renamed type parameter. ''' </summary> ''' <remarks></remarks> Public Sub ThrowIfSubstitutingToAlphaRenamedTypeParameter() Dim toCheck As TypeSubstitution = Me Do For Each pair In toCheck.Pairs Dim value As TypeSymbol = pair.Value.Type If value.IsTypeParameter() AndAlso Not value.IsDefinition Then Throw New ArgumentException() End If Next toCheck = toCheck.Parent Loop While toCheck IsNot Nothing End Sub ''' <summary> ''' Return TypeSubstitution instance that targets particular generic definition. ''' </summary> Public Function GetSubstitutionForGenericDefinition( targetGenericDefinition As Symbol ) As TypeSubstitution Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is targetGenericDefinition Then Return current End If current = current.Parent Loop While current IsNot Nothing Return Nothing End Function ''' <summary> ''' Return TypeSubstitution instance that targets particular ''' generic definition or one of its containers. ''' </summary> Public Function GetSubstitutionForGenericDefinitionOrContainers( targetGenericDefinition As Symbol ) As TypeSubstitution Dim current As TypeSubstitution = Me Do If current.IsValidToApplyTo(targetGenericDefinition) Then Return current End If current = current.Parent Loop While current IsNot Nothing Return Nothing End Function ''' <summary> ''' Does substitution target either genericDefinition or ''' one of its containers? ''' </summary> Public Function IsValidToApplyTo(genericDefinition As Symbol) As Boolean Debug.Assert(genericDefinition.IsDefinition) Dim current As Symbol = genericDefinition Do If current Is Me.TargetGenericDefinition Then Return True End If current = current.ContainingType Loop While current IsNot Nothing Return False End Function ''' <summary> ''' Combine two substitutions into one by concatenating. ''' ''' They may not directly or indirectly (through Parent) target the same generic definition. ''' sub2 is expected to target types lower in the containership hierarchy. ''' Either or both can be Nothing. ''' ''' targetGenericDefinition specifies target generic definition for the result. ''' If sub2 is not Nothing, it must target targetGenericDefinition. ''' If sub2 is Nothing, sub1 will be "extended" with identity substitutions to target ''' targetGenericDefinition. ''' </summary> Public Shared Function Concat(targetGenericDefinition As Symbol, sub1 As TypeSubstitution, sub2 As TypeSubstitution) As TypeSubstitution Debug.Assert(targetGenericDefinition.IsDefinition) Debug.Assert(sub2 Is Nothing OrElse sub2.TargetGenericDefinition Is targetGenericDefinition) If sub1 Is Nothing Then Return sub2 Else Debug.Assert(sub1.TargetGenericDefinition.IsDefinition) If sub2 Is Nothing Then If targetGenericDefinition Is sub1.TargetGenericDefinition Then Return sub1 End If Return Concat(sub1, targetGenericDefinition, ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).Empty) Else Return ConcatNotNulls(sub1, sub2) End If End If End Function Private Shared Function ConcatNotNulls(sub1 As TypeSubstitution, sub2 As TypeSubstitution) As TypeSubstitution If sub2.Parent Is Nothing Then Return Concat(sub1, sub2.TargetGenericDefinition, sub2.Pairs) Else Return Concat(ConcatNotNulls(sub1, sub2.Parent), sub2.TargetGenericDefinition, sub2.Pairs) End If End Function ''' <summary> ''' Create a substitution. If the substitution is the identity substitution, Nothing is returned. ''' </summary> ''' <param name="targetGenericDefinition">Generic definition the result should target.</param> ''' <param name="params"> ''' Type parameter definitions. Duplicates aren't allowed. Type parameters of containing type ''' must precede type parameters of a nested type. ''' </param> ''' <param name="args">Corresponding type arguments.</param> ''' <returns></returns> Public Shared Function Create( targetGenericDefinition As Symbol, params() As TypeParameterSymbol, args() As TypeWithModifiers, Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(targetGenericDefinition, params.AsImmutableOrNull, args.AsImmutableOrNull, allowAlphaRenamedTypeParametersAsArguments) End Function Public Shared Function Create( targetGenericDefinition As Symbol, params() As TypeParameterSymbol, args() As TypeSymbol, Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(targetGenericDefinition, params.AsImmutableOrNull, args.AsImmutableOrNull, allowAlphaRenamedTypeParametersAsArguments) End Function ''' <summary> ''' Create a substitution. If the substitution is the identity substitution, Nothing is returned. ''' </summary> ''' <param name="targetGenericDefinition">Generic definition the result should target.</param> ''' <param name="params"> ''' Type parameter definitions. Duplicates aren't allowed. Type parameters of containing type ''' must precede type parameters of a nested type. ''' </param> ''' <param name="args">Corresponding type arguments.</param> ''' <returns></returns> Public Shared Function Create( targetGenericDefinition As Symbol, params As ImmutableArray(Of TypeParameterSymbol), args As ImmutableArray(Of TypeWithModifiers), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Debug.Assert(targetGenericDefinition.IsDefinition) If params.Length <> args.Length Then Throw New ArgumentException(VBResources.NumberOfTypeParametersAndArgumentsMustMatch) End If Dim currentParent As TypeSubstitution = Nothing Dim currentContainer As Symbol = Nothing #If DEBUG Then Dim haveSubstitutionForOrdinal = BitVector.Create(params.Length) #End If Dim pairs = ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).GetInstance() Try For i = 0 To params.Length - 1 Dim param As TypeParameterSymbol = params(i) Dim arg As TypeWithModifiers = args(i) Debug.Assert(param.IsDefinition) If currentContainer IsNot param.ContainingSymbol Then ' starting new segment, finish the current one If pairs.Count > 0 Then currentParent = Concat(currentParent, currentContainer, pairs.ToImmutable()) pairs.Clear() End If currentContainer = param.ContainingSymbol #If DEBUG Then haveSubstitutionForOrdinal.Clear() #End If End If #If DEBUG Then Debug.Assert(Not haveSubstitutionForOrdinal(param.Ordinal)) haveSubstitutionForOrdinal(param.Ordinal) = True #End If If arg.Is(param) Then Continue For End If If Not allowAlphaRenamedTypeParametersAsArguments Then ' Can't use alpha-renamed type parameters as arguments If arg.Type.IsTypeParameter() AndAlso Not arg.Type.IsDefinition Then Throw New ArgumentException() End If End If pairs.Add(New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(param, arg)) Next ' finish the current segment If pairs.Count > 0 Then currentParent = Concat(currentParent, currentContainer, pairs.ToImmutable()) End If Finally pairs.Free() End Try If currentParent IsNot Nothing AndAlso currentParent.TargetGenericDefinition IsNot targetGenericDefinition Then currentParent = Concat(currentParent, targetGenericDefinition, ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).Empty) #If DEBUG Then ElseIf currentContainer IsNot Nothing AndAlso currentContainer IsNot targetGenericDefinition Then ' currentContainer must be either targetGenericDefinition or a container of targetGenericDefinition Dim container As NamedTypeSymbol = targetGenericDefinition.ContainingType While container IsNot Nothing AndAlso container IsNot currentContainer container = container.ContainingType End While Debug.Assert(container Is currentContainer) #End If End If Return currentParent End Function Private Shared ReadOnly s_withoutModifiers As Func(Of TypeSymbol, TypeWithModifiers) = Function(arg) New TypeWithModifiers(arg) Public Shared Function Create( targetGenericDefinition As Symbol, params As ImmutableArray(Of TypeParameterSymbol), args As ImmutableArray(Of TypeSymbol), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(targetGenericDefinition, params, args.SelectAsArray(s_withoutModifiers), allowAlphaRenamedTypeParametersAsArguments) End Function Public Shared Function Create( parent As TypeSubstitution, targetGenericDefinition As Symbol, args As ImmutableArray(Of TypeSymbol), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(parent, targetGenericDefinition, args.SelectAsArray(s_withoutModifiers), allowAlphaRenamedTypeParametersAsArguments) End Function ''' <summary> ''' Private helper to make sure identity substitutions are injected for types between ''' targetGenericDefinition and parent.TargetGenericDefinition. ''' </summary> Private Shared Function Concat( parent As TypeSubstitution, targetGenericDefinition As Symbol, pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) ) As TypeSubstitution If parent Is Nothing OrElse parent.TargetGenericDefinition Is targetGenericDefinition.ContainingType Then Return New TypeSubstitution(targetGenericDefinition, pairs, parent) End If Dim containingType As NamedTypeSymbol = targetGenericDefinition.ContainingType Debug.Assert(containingType IsNot Nothing) Return New TypeSubstitution( targetGenericDefinition, pairs, Concat(parent, containingType, ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).Empty)) End Function Public Overrides Function ToString() As String Dim builder As New StringBuilder() builder.AppendFormat("{0} : ", TargetGenericDefinition) ToString(builder) Return builder.ToString() End Function Private Overloads Sub ToString(builder As StringBuilder) If _parent IsNot Nothing Then _parent.ToString(builder) builder.Append(", ") End If builder.Append("{"c) For i = 0 To _pairs.Length - 1 If i <> 0 Then builder.Append(", ") End If builder.AppendFormat("{0}->{1}", _pairs(i).Key.ToString(), _pairs(i).Value.Type.ToString()) Next builder.Append("}"c) End Sub Private Sub New(targetGenericDefinition As Symbol, pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)), parent As TypeSubstitution) Debug.Assert(Not pairs.IsDefault) Debug.Assert(pairs.All(Function(p) p.Key IsNot Nothing)) Debug.Assert(pairs.All(Function(p) p.Value.Type IsNot Nothing)) Debug.Assert(pairs.All(Function(p) Not p.Value.CustomModifiers.IsDefault)) Debug.Assert(targetGenericDefinition IsNot Nothing AndAlso (targetGenericDefinition.IsDefinition OrElse (targetGenericDefinition.Kind = SymbolKind.Method AndAlso DirectCast(targetGenericDefinition, MethodSymbol).ConstructedFrom Is targetGenericDefinition AndAlso parent Is Nothing))) Debug.Assert((targetGenericDefinition.Kind = SymbolKind.Method AndAlso (DirectCast(targetGenericDefinition, MethodSymbol).IsGenericMethod OrElse (targetGenericDefinition.ContainingType.IsOrInGenericType() AndAlso parent IsNot Nothing))) OrElse ((targetGenericDefinition.Kind = SymbolKind.NamedType OrElse targetGenericDefinition.Kind = SymbolKind.ErrorType) AndAlso DirectCast(targetGenericDefinition, NamedTypeSymbol).IsOrInGenericType())) Debug.Assert(parent Is Nothing OrElse targetGenericDefinition.ContainingSymbol Is parent.TargetGenericDefinition) _pairs = pairs _parent = parent _targetGenericDefinition = targetGenericDefinition End Sub ''' <summary> ''' Create substitution to handle alpha-renaming of type parameters. ''' It maps type parameter definition to corresponding alpha-renamed type parameter. ''' </summary> ''' <param name="alphaRenamedTypeParameters">Alpha-renamed type parameters.</param> Public Shared Function CreateForAlphaRename( parent As TypeSubstitution, alphaRenamedTypeParameters As ImmutableArray(Of SubstitutedTypeParameterSymbol) ) As TypeSubstitution Debug.Assert(parent IsNot Nothing) Debug.Assert(Not alphaRenamedTypeParameters.IsEmpty) Dim memberDefinition As Symbol = alphaRenamedTypeParameters(0).OriginalDefinition.ContainingSymbol Debug.Assert(parent.TargetGenericDefinition Is memberDefinition.ContainingSymbol) Dim typeParametersDefinitions As ImmutableArray(Of TypeParameterSymbol) If memberDefinition.Kind = SymbolKind.Method Then typeParametersDefinitions = DirectCast(memberDefinition, MethodSymbol).TypeParameters Else typeParametersDefinitions = DirectCast(memberDefinition, NamedTypeSymbol).TypeParameters End If Debug.Assert(Not typeParametersDefinitions.IsEmpty AndAlso alphaRenamedTypeParameters.Length = typeParametersDefinitions.Length) ' Build complete map for memberDefinition's type parameters Dim pairs(typeParametersDefinitions.Length - 1) As KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers) For i As Integer = 0 To typeParametersDefinitions.Length - 1 Step 1 Debug.Assert(Not TypeOf typeParametersDefinitions(i) Is SubstitutedTypeParameterSymbol) Debug.Assert(alphaRenamedTypeParameters(i).OriginalDefinition Is typeParametersDefinitions(i)) pairs(i) = New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(typeParametersDefinitions(i), New TypeWithModifiers(alphaRenamedTypeParameters(i))) Next Return Concat(parent, memberDefinition, pairs.AsImmutableOrNull()) End Function ''' <summary> ''' Create TypeSubstitution that can be used to substitute method's type parameters ''' in types involved in method's signature. ''' ''' Unlike for other construction methods in this class, targetMethod doesn't have to be ''' original definition, it is allowed to be specialized unconstructed generic method. ''' ''' An item in typeArguments can be an alpha-renamed type parameter, but it must belong ''' to the targetMethod and can only appear at its ordinal position to represent the lack ''' of substitution for it. ''' </summary> Public Shared Function CreateAdditionalMethodTypeParameterSubstitution( targetMethod As MethodSymbol, typeArguments As ImmutableArray(Of TypeWithModifiers) ) As TypeSubstitution Debug.Assert(targetMethod.Arity > 0 AndAlso typeArguments.Length = targetMethod.Arity AndAlso targetMethod.ConstructedFrom Is targetMethod) Dim typeParametersDefinitions As ImmutableArray(Of TypeParameterSymbol) = targetMethod.TypeParameters Dim argument As TypeWithModifiers Dim countOfMeaningfulPairs As Integer = 0 For i As Integer = 0 To typeArguments.Length - 1 Step 1 argument = typeArguments(i) If argument.Type.IsTypeParameter() Then Dim typeParameter = DirectCast(argument.Type, TypeParameterSymbol) If typeParameter.Ordinal = i AndAlso typeParameter.ContainingSymbol Is targetMethod Then Debug.Assert(typeParameter Is typeParametersDefinitions(i)) If argument.CustomModifiers.IsDefaultOrEmpty Then Continue For End If End If Debug.Assert(typeParameter.IsDefinition) ' Can't be an alpha renamed type parameter. End If countOfMeaningfulPairs += 1 Next If countOfMeaningfulPairs = 0 Then 'Identity substitution Return Nothing End If ' Build the map Dim pairs(countOfMeaningfulPairs - 1) As KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers) countOfMeaningfulPairs = 0 For i As Integer = 0 To typeArguments.Length - 1 Step 1 argument = typeArguments(i) If argument.Type.IsTypeParameter() Then Dim typeParameter = DirectCast(argument.Type, TypeParameterSymbol) If typeParameter.Ordinal = i AndAlso typeParameter.ContainingSymbol Is targetMethod AndAlso argument.CustomModifiers.IsDefaultOrEmpty Then Continue For End If End If pairs(countOfMeaningfulPairs) = New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(typeParametersDefinitions(i), argument) countOfMeaningfulPairs += 1 Next Debug.Assert(countOfMeaningfulPairs = pairs.Length) Return New TypeSubstitution(targetMethod, pairs.AsImmutableOrNull(), Nothing) End Function ''' <summary> ''' Adjust substitution for construction. ''' This has the following effects: ''' 1) The passed in additionalSubstitution is used on each type argument. ''' 2) If any parameters in the given additionalSubstitution are not present in oldConstructSubstitution, they are added. ''' 3) Parent substitution in oldConstructSubstitution is replaced with adjustedParent. ''' ''' oldConstructSubstitution can be cancelled out by additionalSubstitution. In this case, ''' if the adjustedParent is Nothing, Nothing is returned. ''' </summary> Public Shared Function AdjustForConstruct( adjustedParent As TypeSubstitution, oldConstructSubstitution As TypeSubstitution, additionalSubstitution As TypeSubstitution ) As TypeSubstitution Debug.Assert(oldConstructSubstitution IsNot Nothing AndAlso oldConstructSubstitution.TargetGenericDefinition.IsDefinition) Debug.Assert(additionalSubstitution IsNot Nothing) Debug.Assert(adjustedParent Is Nothing OrElse (adjustedParent.TargetGenericDefinition.IsDefinition AndAlso (oldConstructSubstitution.Parent Is Nothing OrElse adjustedParent.TargetGenericDefinition Is oldConstructSubstitution.Parent.TargetGenericDefinition))) Dim pairs = ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).GetInstance() Dim pairsHaveChanged As Boolean = PrivateAdjustForConstruct(pairs, oldConstructSubstitution, additionalSubstitution) Dim result As TypeSubstitution ' glue new parts together If pairsHaveChanged OrElse oldConstructSubstitution.Parent IsNot adjustedParent Then If pairs.Count = 0 AndAlso adjustedParent Is Nothing Then result = Nothing Else result = Concat(adjustedParent, oldConstructSubstitution.TargetGenericDefinition, If(pairsHaveChanged, pairs.ToImmutable(), oldConstructSubstitution.Pairs)) End If Else result = oldConstructSubstitution End If pairs.Free() Return result End Function ''' <summary> ''' This has the following effects: ''' 1) The passed in additionalSubstitution is used on each type argument. ''' 2) If any parameters in the given additionalSubstitution are not present in oldConstructSubstitution, they are added. ''' ''' Result is placed into pairs. Identity substitutions are omitted. ''' ''' Returns True if the set of pairs have changed, False otherwise. ''' </summary> Private Shared Function PrivateAdjustForConstruct( pairs As ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)), oldConstructSubstitution As TypeSubstitution, additionalSubstitution As TypeSubstitution ) As Boolean ' Substitute into target of each existing substitution. Dim pairsHaveChanged As Boolean = False Dim oldPairs = oldConstructSubstitution.Pairs Dim haveSubstitutionForOrdinal As BitVector = Nothing Dim targetGenericDefinition As Symbol = oldConstructSubstitution.TargetGenericDefinition If oldPairs.Length > 0 Then Dim arity As Integer If targetGenericDefinition.Kind = SymbolKind.Method Then arity = DirectCast(targetGenericDefinition, MethodSymbol).Arity Else arity = DirectCast(targetGenericDefinition, NamedTypeSymbol).Arity End If haveSubstitutionForOrdinal = BitVector.Create(arity) End If For i = 0 To oldPairs.Length - 1 Step 1 Dim newValue As TypeWithModifiers = oldPairs(i).Value.InternalSubstituteTypeParameters(additionalSubstitution) ' Mark that we had this substitution even if it is going to disappear. ' We still don't want to append substitution for this guy from additionalSubstitution. haveSubstitutionForOrdinal(oldPairs(i).Key.Ordinal) = True If Not newValue.Equals(oldPairs(i).Value) Then pairsHaveChanged = True End If ' Do not add identity mapping. If Not newValue.Is(oldPairs(i).Key) Then pairs.Add(New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(oldPairs(i).Key, newValue)) End If Next Dim append As TypeSubstitution = additionalSubstitution.GetSubstitutionForGenericDefinition(targetGenericDefinition) ' append new pairs If append IsNot Nothing Then For Each additionalPair In append.Pairs If haveSubstitutionForOrdinal.IsNull OrElse Not haveSubstitutionForOrdinal(additionalPair.Key.Ordinal) Then pairsHaveChanged = True pairs.Add(additionalPair) End If Next End If Return pairsHaveChanged End Function ''' <summary> ''' Create substitution for targetGenericDefinition based on its type ''' arguments (matched to type parameters by position) and TypeSubstitution ''' for direct or indirect container. ''' </summary> Public Shared Function Create( parent As TypeSubstitution, targetGenericDefinition As Symbol, args As ImmutableArray(Of TypeWithModifiers), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Debug.Assert(parent IsNot Nothing) Debug.Assert(targetGenericDefinition.IsDefinition) Dim typeParametersDefinitions As ImmutableArray(Of TypeParameterSymbol) If targetGenericDefinition.Kind = SymbolKind.Method Then typeParametersDefinitions = DirectCast(targetGenericDefinition, MethodSymbol).TypeParameters Else typeParametersDefinitions = DirectCast(targetGenericDefinition, NamedTypeSymbol).TypeParameters End If Dim n = typeParametersDefinitions.Length Debug.Assert(n > 0) If args.Length <> n Then Throw New ArgumentException(VBResources.NumberOfTypeParametersAndArgumentsMustMatch) End If Dim significantMaps As Integer = 0 For i As Integer = 0 To n - 1 Step 1 Dim arg = args(i) If Not arg.Is(typeParametersDefinitions(i)) Then significantMaps += 1 End If If Not allowAlphaRenamedTypeParametersAsArguments Then ' Can't use alpha-renamed type parameters as arguments If arg.Type.IsTypeParameter() AndAlso Not arg.Type.IsDefinition Then Throw New ArgumentException() End If End If Next If significantMaps = 0 Then Return Concat(targetGenericDefinition, parent, Nothing) End If Dim pairIndex = 0 Dim pairs(significantMaps - 1) As KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers) For i As Integer = 0 To n - 1 Step 1 If Not args(i).Is(typeParametersDefinitions(i)) Then pairs(pairIndex) = New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(typeParametersDefinitions(i), args(i)) pairIndex += 1 End If Next Debug.Assert(pairIndex = significantMaps) Return Concat(parent, targetGenericDefinition, pairs.AsImmutableOrNull()) End Function Public Function SubstituteCustomModifiers(type As TypeSymbol, customModifiers As ImmutableArray(Of CustomModifier)) As ImmutableArray(Of CustomModifier) If type.IsTypeParameter() Then Return New TypeWithModifiers(type, customModifiers).InternalSubstituteTypeParameters(Me).CustomModifiers End If Return SubstituteCustomModifiers(customModifiers) End Function Public Function SubstituteCustomModifiers(customModifiers As ImmutableArray(Of CustomModifier)) As ImmutableArray(Of CustomModifier) If customModifiers.IsDefaultOrEmpty Then Return customModifiers End If For i As Integer = 0 To customModifiers.Length - 1 Dim modifier = DirectCast(customModifiers(i).Modifier, NamedTypeSymbol) Dim substituted = DirectCast(modifier.InternalSubstituteTypeParameters(Me).AsTypeSymbolOnly(), NamedTypeSymbol) If Not TypeSymbol.Equals(modifier, substituted, TypeCompareKind.ConsiderEverything) Then Dim builder = ArrayBuilder(Of CustomModifier).GetInstance(customModifiers.Length) builder.AddRange(customModifiers, i) builder.Add(If(customModifiers(i).IsOptional, VisualBasicCustomModifier.CreateOptional(substituted), VisualBasicCustomModifier.CreateRequired(substituted))) For j As Integer = i + 1 To customModifiers.Length - 1 modifier = DirectCast(customModifiers(j).Modifier, NamedTypeSymbol) substituted = DirectCast(modifier.InternalSubstituteTypeParameters(Me).AsTypeSymbolOnly(), NamedTypeSymbol) If Not TypeSymbol.Equals(modifier, substituted, TypeCompareKind.ConsiderEverything) Then builder.Add(If(customModifiers(j).IsOptional, VisualBasicCustomModifier.CreateOptional(substituted), VisualBasicCustomModifier.CreateRequired(substituted))) Else builder.Add(customModifiers(j)) End If Next Debug.Assert(builder.Count = customModifiers.Length) Return builder.ToImmutableAndFree() End If Next Return customModifiers End Function Public Function WasConstructedForModifiers() As Boolean For Each pair In _pairs If Not pair.Key.Equals(pair.Value.Type.OriginalDefinition) Then Return False End If Next Return If(_parent Is Nothing, True, _parent.WasConstructedForModifiers()) End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Generic Imports System.Collections.Immutable Imports System.Runtime.InteropServices Imports System.Text Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' <summary> ''' Immutable. Thread-safe. ''' ''' Represents a type substitution, with substitutions of types for a set of type parameters. ''' Each TypeSubstitution object has three pieces of information: ''' - OriginalDefinition of generic symbol the substitution is targeting. ''' - An array of pairs that provide a mapping from symbol's type parameters to type arguments. ''' identity substitutions are omitted. ''' - TypeSubstitution object for containing type to provide mapping for its type ''' parameters, if any. ''' ''' The identity substitution (for the whole type hierarchy) is represented by Nothing. That said, ''' top level parent of non-Nothing instance of TypeSubstitution is guaranteed to be non-identity ''' substitution. The instance may still be an identity substitution just for target generic definition, ''' which will be represented by an empty mapping array. ''' ''' The chain of TypeSubstitution objects is guaranteed to not skip any type in the containership hierarchy, ''' even types with zero arity contained in generic type will have corresponding TypeSubstitution object with ''' empty mapping array. ''' ''' Example: ''' Class A(Of T,S) ''' Class B ''' Class C(Of U) ''' End Class ''' End Class ''' End Class ''' ''' TypeSubstitution for A(Of Integer, S).B.C(Of Byte) is C{U->Byte}=>B{}=>A{T->Integer} ''' TypeSubstitution for A(Of T, S).B.C(Of Byte) is C{U->Byte} ''' TypeSubstitution for A(Of Integer, S).B is B{}=>A{T->Integer} ''' TypeSubstitution for A(Of Integer, S).B.C(Of U) is C{}=>B{}=>A{T->Integer} ''' ''' CONSIDER: ''' An array of KeyValuePair(Of TypeParameterSymbol, TypeSymbol)objects is used to represent type ''' parameter substitution mostly due to historical reasons. It might be more convenient and more ''' efficient to use ordinal based array of TypeSymbol objects instead. ''' ''' There is a Construct method that can be called on original definition with TypeSubstitution object as ''' an argument. The advantage of that method is the ability to substitute type parameters of several types ''' in the containership hierarchy in one call. What type the TypeSubstitution parameter targets makes a ''' difference. ''' ''' For example: ''' C.Construct(C{}=>B{}=>A{T->Integer}) == A(Of Integer, S).B.C(Of U) ''' C.Construct(B{}=>A{T->Integer}) == A(Of Integer, S).B.C(Of ) ''' B.Construct(B{}=>A{T->Integer}) == A(Of Integer, S).B ''' ''' See comment for IsValidToApplyTo method as well. ''' </summary> Friend Class TypeSubstitution ''' <summary> ''' A map between type parameters of _targetGenericDefinition and corresponding type arguments. ''' Represented by an array of Key-Value pairs. Keys are type parameters of _targetGenericDefinition ''' in no particular order. Identity substitutions are omitted. ''' </summary> Private ReadOnly _pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) ''' <summary> ''' Definition of a symbol which this instance of TypeSubstitution primarily targets. ''' </summary> Private ReadOnly _targetGenericDefinition As Symbol ''' <summary> ''' An instance of TypeSubstitution describing substitution for containing type. ''' </summary> Private ReadOnly _parent As TypeSubstitution Public ReadOnly Property Pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) Get Return _pairs End Get End Property ''' <summary> ''' Get all the pairs of substitutions, including from the parent substitutions. The substitutions ''' are in order from outside-in (parent substitutions before child substitutions). ''' </summary> Public ReadOnly Property PairsIncludingParent As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) Get If _parent Is Nothing Then Return Pairs Else Dim pairBuilder = ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).GetInstance() AddPairsIncludingParentToBuilder(pairBuilder) Return pairBuilder.ToImmutableAndFree() End If End Get End Property 'Add pairs (including parent pairs) to the given array builder. Private Sub AddPairsIncludingParentToBuilder(pairBuilder As ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers))) If _parent IsNot Nothing Then _parent.AddPairsIncludingParentToBuilder(pairBuilder) End If pairBuilder.AddRange(_pairs) End Sub Public ReadOnly Property Parent As TypeSubstitution Get Return _parent End Get End Property Public ReadOnly Property TargetGenericDefinition As Symbol Get Return _targetGenericDefinition End Get End Property ' If this substitution contains the given type parameter, return the substituted type. ' Otherwise, returns the type parameter itself. Public Function GetSubstitutionFor(tp As TypeParameterSymbol) As TypeWithModifiers Debug.Assert(tp IsNot Nothing) Debug.Assert(tp.IsDefinition OrElse TargetGenericDefinition Is tp.ContainingSymbol) Dim containingSymbol As Symbol = tp.ContainingSymbol Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is containingSymbol Then For Each p In current.Pairs If p.Key.Equals(tp) Then Return p.Value Next ' not found, return the passed in type parameters Return New TypeWithModifiers(tp, ImmutableArray(Of CustomModifier).Empty) End If current = current.Parent Loop While current IsNot Nothing ' not found, return the passed in type parameters Return New TypeWithModifiers(tp, ImmutableArray(Of CustomModifier).Empty) End Function Public Function GetTypeArgumentsFor(originalDefinition As NamedTypeSymbol, <Out> ByRef hasTypeArgumentsCustomModifiers As Boolean) As ImmutableArray(Of TypeSymbol) Debug.Assert(originalDefinition IsNot Nothing) Debug.Assert(originalDefinition.IsDefinition) Debug.Assert(originalDefinition.Arity > 0) Dim current As TypeSubstitution = Me Dim result = ArrayBuilder(Of TypeSymbol).GetInstance(originalDefinition.Arity, fillWithValue:=Nothing) hasTypeArgumentsCustomModifiers = False Do If current.TargetGenericDefinition Is originalDefinition Then For Each p In current.Pairs result(p.Key.Ordinal) = p.Value.Type If Not p.Value.CustomModifiers.IsDefaultOrEmpty Then hasTypeArgumentsCustomModifiers = True End If Next Exit Do End If current = current.Parent Loop While current IsNot Nothing For i As Integer = 0 To result.Count - 1 If result(i) Is Nothing Then result(i) = originalDefinition.TypeParameters(i) End If Next Return result.ToImmutableAndFree() End Function Public Function GetTypeArgumentsCustomModifiersFor(originalDefinition As TypeParameterSymbol) As ImmutableArray(Of CustomModifier) Debug.Assert(originalDefinition IsNot Nothing) Debug.Assert(originalDefinition.IsDefinition) Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is originalDefinition.ContainingSymbol Then For Each p In current.Pairs If p.Key.Ordinal = originalDefinition.Ordinal Then Return p.Value.CustomModifiers End If Next Exit Do End If current = current.Parent Loop While current IsNot Nothing Return ImmutableArray(Of CustomModifier).Empty End Function Public Function HasTypeArgumentsCustomModifiersFor(originalDefinition As NamedTypeSymbol) As Boolean Debug.Assert(originalDefinition IsNot Nothing) Debug.Assert(originalDefinition.IsDefinition) Debug.Assert(originalDefinition.Arity > 0) Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is originalDefinition Then For Each p In current.Pairs If Not p.Value.CustomModifiers.IsDefaultOrEmpty Then Return True End If Next Exit Do End If current = current.Parent Loop While current IsNot Nothing Return False End Function ''' <summary> ''' Verify TypeSubstitution to make sure it doesn't map any ''' type parameter to an alpha-renamed type parameter. ''' </summary> ''' <remarks></remarks> Public Sub ThrowIfSubstitutingToAlphaRenamedTypeParameter() Dim toCheck As TypeSubstitution = Me Do For Each pair In toCheck.Pairs Dim value As TypeSymbol = pair.Value.Type If value.IsTypeParameter() AndAlso Not value.IsDefinition Then Throw New ArgumentException() End If Next toCheck = toCheck.Parent Loop While toCheck IsNot Nothing End Sub ''' <summary> ''' Return TypeSubstitution instance that targets particular generic definition. ''' </summary> Public Function GetSubstitutionForGenericDefinition( targetGenericDefinition As Symbol ) As TypeSubstitution Dim current As TypeSubstitution = Me Do If current.TargetGenericDefinition Is targetGenericDefinition Then Return current End If current = current.Parent Loop While current IsNot Nothing Return Nothing End Function ''' <summary> ''' Return TypeSubstitution instance that targets particular ''' generic definition or one of its containers. ''' </summary> Public Function GetSubstitutionForGenericDefinitionOrContainers( targetGenericDefinition As Symbol ) As TypeSubstitution Dim current As TypeSubstitution = Me Do If current.IsValidToApplyTo(targetGenericDefinition) Then Return current End If current = current.Parent Loop While current IsNot Nothing Return Nothing End Function ''' <summary> ''' Does substitution target either genericDefinition or ''' one of its containers? ''' </summary> Public Function IsValidToApplyTo(genericDefinition As Symbol) As Boolean Debug.Assert(genericDefinition.IsDefinition) Dim current As Symbol = genericDefinition Do If current Is Me.TargetGenericDefinition Then Return True End If current = current.ContainingType Loop While current IsNot Nothing Return False End Function ''' <summary> ''' Combine two substitutions into one by concatenating. ''' ''' They may not directly or indirectly (through Parent) target the same generic definition. ''' sub2 is expected to target types lower in the containership hierarchy. ''' Either or both can be Nothing. ''' ''' targetGenericDefinition specifies target generic definition for the result. ''' If sub2 is not Nothing, it must target targetGenericDefinition. ''' If sub2 is Nothing, sub1 will be "extended" with identity substitutions to target ''' targetGenericDefinition. ''' </summary> Public Shared Function Concat(targetGenericDefinition As Symbol, sub1 As TypeSubstitution, sub2 As TypeSubstitution) As TypeSubstitution Debug.Assert(targetGenericDefinition.IsDefinition) Debug.Assert(sub2 Is Nothing OrElse sub2.TargetGenericDefinition Is targetGenericDefinition) If sub1 Is Nothing Then Return sub2 Else Debug.Assert(sub1.TargetGenericDefinition.IsDefinition) If sub2 Is Nothing Then If targetGenericDefinition Is sub1.TargetGenericDefinition Then Return sub1 End If Return Concat(sub1, targetGenericDefinition, ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).Empty) Else Return ConcatNotNulls(sub1, sub2) End If End If End Function Private Shared Function ConcatNotNulls(sub1 As TypeSubstitution, sub2 As TypeSubstitution) As TypeSubstitution If sub2.Parent Is Nothing Then Return Concat(sub1, sub2.TargetGenericDefinition, sub2.Pairs) Else Return Concat(ConcatNotNulls(sub1, sub2.Parent), sub2.TargetGenericDefinition, sub2.Pairs) End If End Function ''' <summary> ''' Create a substitution. If the substitution is the identity substitution, Nothing is returned. ''' </summary> ''' <param name="targetGenericDefinition">Generic definition the result should target.</param> ''' <param name="params"> ''' Type parameter definitions. Duplicates aren't allowed. Type parameters of containing type ''' must precede type parameters of a nested type. ''' </param> ''' <param name="args">Corresponding type arguments.</param> ''' <returns></returns> Public Shared Function Create( targetGenericDefinition As Symbol, params() As TypeParameterSymbol, args() As TypeWithModifiers, Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(targetGenericDefinition, params.AsImmutableOrNull, args.AsImmutableOrNull, allowAlphaRenamedTypeParametersAsArguments) End Function Public Shared Function Create( targetGenericDefinition As Symbol, params() As TypeParameterSymbol, args() As TypeSymbol, Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(targetGenericDefinition, params.AsImmutableOrNull, args.AsImmutableOrNull, allowAlphaRenamedTypeParametersAsArguments) End Function ''' <summary> ''' Create a substitution. If the substitution is the identity substitution, Nothing is returned. ''' </summary> ''' <param name="targetGenericDefinition">Generic definition the result should target.</param> ''' <param name="params"> ''' Type parameter definitions. Duplicates aren't allowed. Type parameters of containing type ''' must precede type parameters of a nested type. ''' </param> ''' <param name="args">Corresponding type arguments.</param> ''' <returns></returns> Public Shared Function Create( targetGenericDefinition As Symbol, params As ImmutableArray(Of TypeParameterSymbol), args As ImmutableArray(Of TypeWithModifiers), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Debug.Assert(targetGenericDefinition.IsDefinition) If params.Length <> args.Length Then Throw New ArgumentException(VBResources.NumberOfTypeParametersAndArgumentsMustMatch) End If Dim currentParent As TypeSubstitution = Nothing Dim currentContainer As Symbol = Nothing #If DEBUG Then Dim haveSubstitutionForOrdinal = BitVector.Create(params.Length) #End If Dim pairs = ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).GetInstance() Try For i = 0 To params.Length - 1 Dim param As TypeParameterSymbol = params(i) Dim arg As TypeWithModifiers = args(i) Debug.Assert(param.IsDefinition) If currentContainer IsNot param.ContainingSymbol Then ' starting new segment, finish the current one If pairs.Count > 0 Then currentParent = Concat(currentParent, currentContainer, pairs.ToImmutable()) pairs.Clear() End If currentContainer = param.ContainingSymbol #If DEBUG Then haveSubstitutionForOrdinal.Clear() #End If End If #If DEBUG Then Debug.Assert(Not haveSubstitutionForOrdinal(param.Ordinal)) haveSubstitutionForOrdinal(param.Ordinal) = True #End If If arg.Is(param) Then Continue For End If If Not allowAlphaRenamedTypeParametersAsArguments Then ' Can't use alpha-renamed type parameters as arguments If arg.Type.IsTypeParameter() AndAlso Not arg.Type.IsDefinition Then Throw New ArgumentException() End If End If pairs.Add(New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(param, arg)) Next ' finish the current segment If pairs.Count > 0 Then currentParent = Concat(currentParent, currentContainer, pairs.ToImmutable()) End If Finally pairs.Free() End Try If currentParent IsNot Nothing AndAlso currentParent.TargetGenericDefinition IsNot targetGenericDefinition Then currentParent = Concat(currentParent, targetGenericDefinition, ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).Empty) #If DEBUG Then ElseIf currentContainer IsNot Nothing AndAlso currentContainer IsNot targetGenericDefinition Then ' currentContainer must be either targetGenericDefinition or a container of targetGenericDefinition Dim container As NamedTypeSymbol = targetGenericDefinition.ContainingType While container IsNot Nothing AndAlso container IsNot currentContainer container = container.ContainingType End While Debug.Assert(container Is currentContainer) #End If End If Return currentParent End Function Private Shared ReadOnly s_withoutModifiers As Func(Of TypeSymbol, TypeWithModifiers) = Function(arg) New TypeWithModifiers(arg) Public Shared Function Create( targetGenericDefinition As Symbol, params As ImmutableArray(Of TypeParameterSymbol), args As ImmutableArray(Of TypeSymbol), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(targetGenericDefinition, params, args.SelectAsArray(s_withoutModifiers), allowAlphaRenamedTypeParametersAsArguments) End Function Public Shared Function Create( parent As TypeSubstitution, targetGenericDefinition As Symbol, args As ImmutableArray(Of TypeSymbol), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Return Create(parent, targetGenericDefinition, args.SelectAsArray(s_withoutModifiers), allowAlphaRenamedTypeParametersAsArguments) End Function ''' <summary> ''' Private helper to make sure identity substitutions are injected for types between ''' targetGenericDefinition and parent.TargetGenericDefinition. ''' </summary> Private Shared Function Concat( parent As TypeSubstitution, targetGenericDefinition As Symbol, pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)) ) As TypeSubstitution If parent Is Nothing OrElse parent.TargetGenericDefinition Is targetGenericDefinition.ContainingType Then Return New TypeSubstitution(targetGenericDefinition, pairs, parent) End If Dim containingType As NamedTypeSymbol = targetGenericDefinition.ContainingType Debug.Assert(containingType IsNot Nothing) Return New TypeSubstitution( targetGenericDefinition, pairs, Concat(parent, containingType, ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).Empty)) End Function Public Overrides Function ToString() As String Dim builder As New StringBuilder() builder.AppendFormat("{0} : ", TargetGenericDefinition) ToString(builder) Return builder.ToString() End Function Private Overloads Sub ToString(builder As StringBuilder) If _parent IsNot Nothing Then _parent.ToString(builder) builder.Append(", ") End If builder.Append("{"c) For i = 0 To _pairs.Length - 1 If i <> 0 Then builder.Append(", ") End If builder.AppendFormat("{0}->{1}", _pairs(i).Key.ToString(), _pairs(i).Value.Type.ToString()) Next builder.Append("}"c) End Sub Private Sub New(targetGenericDefinition As Symbol, pairs As ImmutableArray(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)), parent As TypeSubstitution) Debug.Assert(Not pairs.IsDefault) Debug.Assert(pairs.All(Function(p) p.Key IsNot Nothing)) Debug.Assert(pairs.All(Function(p) p.Value.Type IsNot Nothing)) Debug.Assert(pairs.All(Function(p) Not p.Value.CustomModifiers.IsDefault)) Debug.Assert(targetGenericDefinition IsNot Nothing AndAlso (targetGenericDefinition.IsDefinition OrElse (targetGenericDefinition.Kind = SymbolKind.Method AndAlso DirectCast(targetGenericDefinition, MethodSymbol).ConstructedFrom Is targetGenericDefinition AndAlso parent Is Nothing))) Debug.Assert((targetGenericDefinition.Kind = SymbolKind.Method AndAlso (DirectCast(targetGenericDefinition, MethodSymbol).IsGenericMethod OrElse (targetGenericDefinition.ContainingType.IsOrInGenericType() AndAlso parent IsNot Nothing))) OrElse ((targetGenericDefinition.Kind = SymbolKind.NamedType OrElse targetGenericDefinition.Kind = SymbolKind.ErrorType) AndAlso DirectCast(targetGenericDefinition, NamedTypeSymbol).IsOrInGenericType())) Debug.Assert(parent Is Nothing OrElse targetGenericDefinition.ContainingSymbol Is parent.TargetGenericDefinition) _pairs = pairs _parent = parent _targetGenericDefinition = targetGenericDefinition End Sub ''' <summary> ''' Create substitution to handle alpha-renaming of type parameters. ''' It maps type parameter definition to corresponding alpha-renamed type parameter. ''' </summary> ''' <param name="alphaRenamedTypeParameters">Alpha-renamed type parameters.</param> Public Shared Function CreateForAlphaRename( parent As TypeSubstitution, alphaRenamedTypeParameters As ImmutableArray(Of SubstitutedTypeParameterSymbol) ) As TypeSubstitution Debug.Assert(parent IsNot Nothing) Debug.Assert(Not alphaRenamedTypeParameters.IsEmpty) Dim memberDefinition As Symbol = alphaRenamedTypeParameters(0).OriginalDefinition.ContainingSymbol Debug.Assert(parent.TargetGenericDefinition Is memberDefinition.ContainingSymbol) Dim typeParametersDefinitions As ImmutableArray(Of TypeParameterSymbol) If memberDefinition.Kind = SymbolKind.Method Then typeParametersDefinitions = DirectCast(memberDefinition, MethodSymbol).TypeParameters Else typeParametersDefinitions = DirectCast(memberDefinition, NamedTypeSymbol).TypeParameters End If Debug.Assert(Not typeParametersDefinitions.IsEmpty AndAlso alphaRenamedTypeParameters.Length = typeParametersDefinitions.Length) ' Build complete map for memberDefinition's type parameters Dim pairs(typeParametersDefinitions.Length - 1) As KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers) For i As Integer = 0 To typeParametersDefinitions.Length - 1 Step 1 Debug.Assert(Not TypeOf typeParametersDefinitions(i) Is SubstitutedTypeParameterSymbol) Debug.Assert(alphaRenamedTypeParameters(i).OriginalDefinition Is typeParametersDefinitions(i)) pairs(i) = New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(typeParametersDefinitions(i), New TypeWithModifiers(alphaRenamedTypeParameters(i))) Next Return Concat(parent, memberDefinition, pairs.AsImmutableOrNull()) End Function ''' <summary> ''' Create TypeSubstitution that can be used to substitute method's type parameters ''' in types involved in method's signature. ''' ''' Unlike for other construction methods in this class, targetMethod doesn't have to be ''' original definition, it is allowed to be specialized unconstructed generic method. ''' ''' An item in typeArguments can be an alpha-renamed type parameter, but it must belong ''' to the targetMethod and can only appear at its ordinal position to represent the lack ''' of substitution for it. ''' </summary> Public Shared Function CreateAdditionalMethodTypeParameterSubstitution( targetMethod As MethodSymbol, typeArguments As ImmutableArray(Of TypeWithModifiers) ) As TypeSubstitution Debug.Assert(targetMethod.Arity > 0 AndAlso typeArguments.Length = targetMethod.Arity AndAlso targetMethod.ConstructedFrom Is targetMethod) Dim typeParametersDefinitions As ImmutableArray(Of TypeParameterSymbol) = targetMethod.TypeParameters Dim argument As TypeWithModifiers Dim countOfMeaningfulPairs As Integer = 0 For i As Integer = 0 To typeArguments.Length - 1 Step 1 argument = typeArguments(i) If argument.Type.IsTypeParameter() Then Dim typeParameter = DirectCast(argument.Type, TypeParameterSymbol) If typeParameter.Ordinal = i AndAlso typeParameter.ContainingSymbol Is targetMethod Then Debug.Assert(typeParameter Is typeParametersDefinitions(i)) If argument.CustomModifiers.IsDefaultOrEmpty Then Continue For End If End If Debug.Assert(typeParameter.IsDefinition) ' Can't be an alpha renamed type parameter. End If countOfMeaningfulPairs += 1 Next If countOfMeaningfulPairs = 0 Then 'Identity substitution Return Nothing End If ' Build the map Dim pairs(countOfMeaningfulPairs - 1) As KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers) countOfMeaningfulPairs = 0 For i As Integer = 0 To typeArguments.Length - 1 Step 1 argument = typeArguments(i) If argument.Type.IsTypeParameter() Then Dim typeParameter = DirectCast(argument.Type, TypeParameterSymbol) If typeParameter.Ordinal = i AndAlso typeParameter.ContainingSymbol Is targetMethod AndAlso argument.CustomModifiers.IsDefaultOrEmpty Then Continue For End If End If pairs(countOfMeaningfulPairs) = New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(typeParametersDefinitions(i), argument) countOfMeaningfulPairs += 1 Next Debug.Assert(countOfMeaningfulPairs = pairs.Length) Return New TypeSubstitution(targetMethod, pairs.AsImmutableOrNull(), Nothing) End Function ''' <summary> ''' Adjust substitution for construction. ''' This has the following effects: ''' 1) The passed in additionalSubstitution is used on each type argument. ''' 2) If any parameters in the given additionalSubstitution are not present in oldConstructSubstitution, they are added. ''' 3) Parent substitution in oldConstructSubstitution is replaced with adjustedParent. ''' ''' oldConstructSubstitution can be cancelled out by additionalSubstitution. In this case, ''' if the adjustedParent is Nothing, Nothing is returned. ''' </summary> Public Shared Function AdjustForConstruct( adjustedParent As TypeSubstitution, oldConstructSubstitution As TypeSubstitution, additionalSubstitution As TypeSubstitution ) As TypeSubstitution Debug.Assert(oldConstructSubstitution IsNot Nothing AndAlso oldConstructSubstitution.TargetGenericDefinition.IsDefinition) Debug.Assert(additionalSubstitution IsNot Nothing) Debug.Assert(adjustedParent Is Nothing OrElse (adjustedParent.TargetGenericDefinition.IsDefinition AndAlso (oldConstructSubstitution.Parent Is Nothing OrElse adjustedParent.TargetGenericDefinition Is oldConstructSubstitution.Parent.TargetGenericDefinition))) Dim pairs = ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)).GetInstance() Dim pairsHaveChanged As Boolean = PrivateAdjustForConstruct(pairs, oldConstructSubstitution, additionalSubstitution) Dim result As TypeSubstitution ' glue new parts together If pairsHaveChanged OrElse oldConstructSubstitution.Parent IsNot adjustedParent Then If pairs.Count = 0 AndAlso adjustedParent Is Nothing Then result = Nothing Else result = Concat(adjustedParent, oldConstructSubstitution.TargetGenericDefinition, If(pairsHaveChanged, pairs.ToImmutable(), oldConstructSubstitution.Pairs)) End If Else result = oldConstructSubstitution End If pairs.Free() Return result End Function ''' <summary> ''' This has the following effects: ''' 1) The passed in additionalSubstitution is used on each type argument. ''' 2) If any parameters in the given additionalSubstitution are not present in oldConstructSubstitution, they are added. ''' ''' Result is placed into pairs. Identity substitutions are omitted. ''' ''' Returns True if the set of pairs have changed, False otherwise. ''' </summary> Private Shared Function PrivateAdjustForConstruct( pairs As ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)), oldConstructSubstitution As TypeSubstitution, additionalSubstitution As TypeSubstitution ) As Boolean ' Substitute into target of each existing substitution. Dim pairsHaveChanged As Boolean = False Dim oldPairs = oldConstructSubstitution.Pairs Dim haveSubstitutionForOrdinal As BitVector = Nothing Dim targetGenericDefinition As Symbol = oldConstructSubstitution.TargetGenericDefinition If oldPairs.Length > 0 Then Dim arity As Integer If targetGenericDefinition.Kind = SymbolKind.Method Then arity = DirectCast(targetGenericDefinition, MethodSymbol).Arity Else arity = DirectCast(targetGenericDefinition, NamedTypeSymbol).Arity End If haveSubstitutionForOrdinal = BitVector.Create(arity) End If For i = 0 To oldPairs.Length - 1 Step 1 Dim newValue As TypeWithModifiers = oldPairs(i).Value.InternalSubstituteTypeParameters(additionalSubstitution) ' Mark that we had this substitution even if it is going to disappear. ' We still don't want to append substitution for this guy from additionalSubstitution. haveSubstitutionForOrdinal(oldPairs(i).Key.Ordinal) = True If Not newValue.Equals(oldPairs(i).Value) Then pairsHaveChanged = True End If ' Do not add identity mapping. If Not newValue.Is(oldPairs(i).Key) Then pairs.Add(New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(oldPairs(i).Key, newValue)) End If Next Dim append As TypeSubstitution = additionalSubstitution.GetSubstitutionForGenericDefinition(targetGenericDefinition) ' append new pairs If append IsNot Nothing Then For Each additionalPair In append.Pairs If haveSubstitutionForOrdinal.IsNull OrElse Not haveSubstitutionForOrdinal(additionalPair.Key.Ordinal) Then pairsHaveChanged = True pairs.Add(additionalPair) End If Next End If Return pairsHaveChanged End Function ''' <summary> ''' Create substitution for targetGenericDefinition based on its type ''' arguments (matched to type parameters by position) and TypeSubstitution ''' for direct or indirect container. ''' </summary> Public Shared Function Create( parent As TypeSubstitution, targetGenericDefinition As Symbol, args As ImmutableArray(Of TypeWithModifiers), Optional allowAlphaRenamedTypeParametersAsArguments As Boolean = False ) As TypeSubstitution Debug.Assert(parent IsNot Nothing) Debug.Assert(targetGenericDefinition.IsDefinition) Dim typeParametersDefinitions As ImmutableArray(Of TypeParameterSymbol) If targetGenericDefinition.Kind = SymbolKind.Method Then typeParametersDefinitions = DirectCast(targetGenericDefinition, MethodSymbol).TypeParameters Else typeParametersDefinitions = DirectCast(targetGenericDefinition, NamedTypeSymbol).TypeParameters End If Dim n = typeParametersDefinitions.Length Debug.Assert(n > 0) If args.Length <> n Then Throw New ArgumentException(VBResources.NumberOfTypeParametersAndArgumentsMustMatch) End If Dim significantMaps As Integer = 0 For i As Integer = 0 To n - 1 Step 1 Dim arg = args(i) If Not arg.Is(typeParametersDefinitions(i)) Then significantMaps += 1 End If If Not allowAlphaRenamedTypeParametersAsArguments Then ' Can't use alpha-renamed type parameters as arguments If arg.Type.IsTypeParameter() AndAlso Not arg.Type.IsDefinition Then Throw New ArgumentException() End If End If Next If significantMaps = 0 Then Return Concat(targetGenericDefinition, parent, Nothing) End If Dim pairIndex = 0 Dim pairs(significantMaps - 1) As KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers) For i As Integer = 0 To n - 1 Step 1 If Not args(i).Is(typeParametersDefinitions(i)) Then pairs(pairIndex) = New KeyValuePair(Of TypeParameterSymbol, TypeWithModifiers)(typeParametersDefinitions(i), args(i)) pairIndex += 1 End If Next Debug.Assert(pairIndex = significantMaps) Return Concat(parent, targetGenericDefinition, pairs.AsImmutableOrNull()) End Function Public Function SubstituteCustomModifiers(type As TypeSymbol, customModifiers As ImmutableArray(Of CustomModifier)) As ImmutableArray(Of CustomModifier) If type.IsTypeParameter() Then Return New TypeWithModifiers(type, customModifiers).InternalSubstituteTypeParameters(Me).CustomModifiers End If Return SubstituteCustomModifiers(customModifiers) End Function Public Function SubstituteCustomModifiers(customModifiers As ImmutableArray(Of CustomModifier)) As ImmutableArray(Of CustomModifier) If customModifiers.IsDefaultOrEmpty Then Return customModifiers End If For i As Integer = 0 To customModifiers.Length - 1 Dim modifier = DirectCast(customModifiers(i).Modifier, NamedTypeSymbol) Dim substituted = DirectCast(modifier.InternalSubstituteTypeParameters(Me).AsTypeSymbolOnly(), NamedTypeSymbol) If Not TypeSymbol.Equals(modifier, substituted, TypeCompareKind.ConsiderEverything) Then Dim builder = ArrayBuilder(Of CustomModifier).GetInstance(customModifiers.Length) builder.AddRange(customModifiers, i) builder.Add(If(customModifiers(i).IsOptional, VisualBasicCustomModifier.CreateOptional(substituted), VisualBasicCustomModifier.CreateRequired(substituted))) For j As Integer = i + 1 To customModifiers.Length - 1 modifier = DirectCast(customModifiers(j).Modifier, NamedTypeSymbol) substituted = DirectCast(modifier.InternalSubstituteTypeParameters(Me).AsTypeSymbolOnly(), NamedTypeSymbol) If Not TypeSymbol.Equals(modifier, substituted, TypeCompareKind.ConsiderEverything) Then builder.Add(If(customModifiers(j).IsOptional, VisualBasicCustomModifier.CreateOptional(substituted), VisualBasicCustomModifier.CreateRequired(substituted))) Else builder.Add(customModifiers(j)) End If Next Debug.Assert(builder.Count = customModifiers.Length) Return builder.ToImmutableAndFree() End If Next Return customModifiers End Function Public Function WasConstructedForModifiers() As Boolean For Each pair In _pairs If Not pair.Key.Equals(pair.Value.Type.OriginalDefinition) Then Return False End If Next Return If(_parent Is Nothing, True, _parent.WasConstructedForModifiers()) End Function End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Portable/Parser/BlockContexts/CompilationUnitContext.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Syntax.InternalSyntax Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax '----------------------------------------------------------------------------- ' Contains the definition of the DeclarationContext '----------------------------------------------------------------------------- Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax Friend NotInheritable Class CompilationUnitContext Inherits NamespaceBlockContext Private _optionStmts As CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of OptionStatementSyntax) Private _importsStmts As CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of ImportsStatementSyntax) Private _attributeStmts As CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of AttributesStatementSyntax) Private _state As SyntaxKind Friend Sub New(parser As Parser) MyBase.New(SyntaxKind.CompilationUnit, Nothing, Nothing) Me.Parser = parser _statements = _parser._pool.Allocate(Of StatementSyntax)() _state = SyntaxKind.OptionStatement End Sub Friend Overrides ReadOnly Property IsWithinAsyncMethodOrLambda As Boolean Get Return Parser.IsScript End Get End Property Friend Overrides Function ProcessSyntax(node As VisualBasicSyntaxNode) As BlockContext Do Select Case _state Case SyntaxKind.OptionStatement If node.Kind = SyntaxKind.OptionStatement Then Add(node) Return Me End If _optionStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of OptionStatementSyntax)(Body.Node) _state = SyntaxKind.ImportsStatement Case SyntaxKind.ImportsStatement If node.Kind = SyntaxKind.ImportsStatement Then Add(node) Return Me End If _importsStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of ImportsStatementSyntax)(Body.Node) _state = SyntaxKind.AttributesStatement Case SyntaxKind.AttributesStatement If node.Kind = SyntaxKind.AttributesStatement Then Add(node) Return Me End If _attributeStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of AttributesStatementSyntax)(Body.Node) _state = SyntaxKind.None Case Else ' only allow executable statements in top-level script code If _parser.IsScript Then Dim newContext = TryProcessExecutableStatement(node) If newContext IsNot Nothing Then Return newContext End If End If Return MyBase.ProcessSyntax(node) End Select Loop End Function Friend Overrides Function TryLinkSyntax(node As VisualBasicSyntaxNode, ByRef newContext As BlockContext) As LinkResult If _parser.IsScript Then Return TryLinkStatement(node, newContext) Else Return MyBase.TryLinkSyntax(node, newContext) End If End Function Friend Overrides Function CreateBlockSyntax(endStmt As StatementSyntax) As VisualBasicSyntaxNode Throw ExceptionUtilities.Unreachable End Function Friend Function CreateCompilationUnit(optionalTerminator As PunctuationSyntax, notClosedIfDirectives As ArrayBuilder(Of IfDirectiveTriviaSyntax), notClosedRegionDirectives As ArrayBuilder(Of RegionDirectiveTriviaSyntax), haveRegionDirectives As Boolean, notClosedExternalSourceDirective As ExternalSourceDirectiveTriviaSyntax) As CompilationUnitSyntax Debug.Assert(optionalTerminator Is Nothing OrElse optionalTerminator.Kind = SyntaxKind.EndOfFileToken) If _state <> SyntaxKind.None Then Select Case _state Case SyntaxKind.OptionStatement _optionStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of OptionStatementSyntax)(Body.Node) Case SyntaxKind.ImportsStatement _importsStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of ImportsStatementSyntax)(Body.Node) Case SyntaxKind.AttributesStatement _attributeStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of AttributesStatementSyntax)(Body.Node) End Select _state = SyntaxKind.None End If Dim declarations = Body() Dim result = SyntaxFactory.CompilationUnit(_optionStmts, _importsStmts, _attributeStmts, declarations, optionalTerminator) Dim regionsAreAllowedEverywhere = Not haveRegionDirectives OrElse Parser.CheckFeatureAvailability(Feature.RegionsEverywhere) If notClosedIfDirectives IsNot Nothing OrElse notClosedRegionDirectives IsNot Nothing OrElse notClosedExternalSourceDirective IsNot Nothing OrElse Not regionsAreAllowedEverywhere Then result = DiagnosticRewriter.Rewrite(result, notClosedIfDirectives, notClosedRegionDirectives, regionsAreAllowedEverywhere, notClosedExternalSourceDirective, Parser) If notClosedIfDirectives IsNot Nothing Then notClosedIfDirectives.Free() End If If notClosedRegionDirectives IsNot Nothing Then notClosedRegionDirectives.Free() End If End If FreeStatements() Return result End Function Private Class DiagnosticRewriter Inherits VisualBasicSyntaxRewriter Private _notClosedIfDirectives As HashSet(Of IfDirectiveTriviaSyntax) = Nothing Private _notClosedRegionDirectives As HashSet(Of RegionDirectiveTriviaSyntax) = Nothing Private _notClosedExternalSourceDirective As ExternalSourceDirectiveTriviaSyntax = Nothing Private _regionsAreAllowedEverywhere As Boolean Private _parser As Parser Private _declarationBlocksBeingVisited As ArrayBuilder(Of VisualBasicSyntaxNode) ' CompilationUnitSyntax is treated as a declaration block for our purposes Private _parentsOfRegionDirectivesAwaitingClosure As ArrayBuilder(Of VisualBasicSyntaxNode) ' Nodes are coming from _declarationBlocksBeingVisited Private _tokenWithDirectivesBeingVisited As SyntaxToken Private Sub New() MyBase.New() End Sub Public Shared Function Rewrite(compilationUnit As CompilationUnitSyntax, notClosedIfDirectives As ArrayBuilder(Of IfDirectiveTriviaSyntax), notClosedRegionDirectives As ArrayBuilder(Of RegionDirectiveTriviaSyntax), regionsAreAllowedEverywhere As Boolean, notClosedExternalSourceDirective As ExternalSourceDirectiveTriviaSyntax, parser As Parser) As CompilationUnitSyntax Dim rewriter As New DiagnosticRewriter() If notClosedIfDirectives IsNot Nothing Then rewriter._notClosedIfDirectives = New HashSet(Of IfDirectiveTriviaSyntax)(ReferenceEqualityComparer.Instance) For Each node In notClosedIfDirectives rewriter._notClosedIfDirectives.Add(node) Next End If If notClosedRegionDirectives IsNot Nothing Then rewriter._notClosedRegionDirectives = New HashSet(Of RegionDirectiveTriviaSyntax)(ReferenceEqualityComparer.Instance) For Each node In notClosedRegionDirectives rewriter._notClosedRegionDirectives.Add(node) Next End If rewriter._parser = parser rewriter._regionsAreAllowedEverywhere = regionsAreAllowedEverywhere If Not regionsAreAllowedEverywhere Then rewriter._declarationBlocksBeingVisited = ArrayBuilder(Of VisualBasicSyntaxNode).GetInstance() rewriter._parentsOfRegionDirectivesAwaitingClosure = ArrayBuilder(Of VisualBasicSyntaxNode).GetInstance() End If rewriter._notClosedExternalSourceDirective = notClosedExternalSourceDirective Dim result = DirectCast(rewriter.Visit(compilationUnit), CompilationUnitSyntax) If Not regionsAreAllowedEverywhere Then Debug.Assert(rewriter._declarationBlocksBeingVisited.Count = 0) Debug.Assert(rewriter._parentsOfRegionDirectivesAwaitingClosure.Count = 0) ' We never add parents of not closed #Region directives into this stack. rewriter._declarationBlocksBeingVisited.Free() rewriter._parentsOfRegionDirectivesAwaitingClosure.Free() End If Return result End Function #If DEBUG Then ' NOTE: the logic is heavily relying on the fact that green nodes in ' NOTE: one single tree are not reused, the following code assert this Private ReadOnly _processedNodesWithoutDuplication As HashSet(Of VisualBasicSyntaxNode) = New HashSet(Of VisualBasicSyntaxNode)(ReferenceEqualityComparer.Instance) #End If Public Overrides Function VisitCompilationUnit(node As CompilationUnitSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitCompilationUnit(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitMethodBlock(node As MethodBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitMethodBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitConstructorBlock(node As ConstructorBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitConstructorBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitOperatorBlock(node As OperatorBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitOperatorBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitAccessorBlock(node As AccessorBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitAccessorBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitNamespaceBlock(node As NamespaceBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitNamespaceBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitClassBlock(node As ClassBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitClassBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitStructureBlock(node As StructureBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitStructureBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitModuleBlock(node As ModuleBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitModuleBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitInterfaceBlock(node As InterfaceBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitInterfaceBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitEnumBlock(node As EnumBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitEnumBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitPropertyBlock(node As PropertyBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitPropertyBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitEventBlock(node As EventBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitEventBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitIfDirectiveTrivia(node As IfDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitIfDirectiveTrivia(node) If Me._notClosedIfDirectives IsNot Nothing AndAlso Me._notClosedIfDirectives.Contains(node) Then rewritten = Parser.ReportSyntaxError(rewritten, ERRID.ERR_LbExpectedEndIf) End If Return rewritten End Function Public Overrides Function VisitRegionDirectiveTrivia(node As RegionDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitRegionDirectiveTrivia(node) If Me._notClosedRegionDirectives IsNot Nothing AndAlso Me._notClosedRegionDirectives.Contains(node) Then rewritten = Parser.ReportSyntaxError(rewritten, ERRID.ERR_ExpectedEndRegion) ElseIf Not _regionsAreAllowedEverywhere rewritten = VerifyRegionPlacement(node, rewritten) End If Return rewritten End Function Private Function VerifyRegionPlacement(original As VisualBasicSyntaxNode, rewritten As VisualBasicSyntaxNode) As VisualBasicSyntaxNode Dim containingBlock = _declarationBlocksBeingVisited.Peek() ' Ensure that the directive is inside the block, rather than is attached to it as a leading/trailing trivia Debug.Assert(_declarationBlocksBeingVisited.Count > 1 OrElse containingBlock.Kind = SyntaxKind.CompilationUnit) If _declarationBlocksBeingVisited.Count > 1 Then If _tokenWithDirectivesBeingVisited Is containingBlock.GetFirstToken() Then Dim leadingTrivia = _tokenWithDirectivesBeingVisited.GetLeadingTrivia() If leadingTrivia IsNot Nothing AndAlso New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(leadingTrivia).Nodes.Contains(original) Then containingBlock = _declarationBlocksBeingVisited(_declarationBlocksBeingVisited.Count - 2) End If ElseIf _tokenWithDirectivesBeingVisited Is containingBlock.GetLastToken() Then Dim trailingTrivia = _tokenWithDirectivesBeingVisited.GetTrailingTrivia() If trailingTrivia IsNot Nothing AndAlso New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(trailingTrivia).Nodes.Contains(original) Then containingBlock = _declarationBlocksBeingVisited(_declarationBlocksBeingVisited.Count - 2) End If End If End If Dim reportAnError = Not IsValidContainingBlockForRegionInVB12(containingBlock) If original.Kind = SyntaxKind.RegionDirectiveTrivia Then _parentsOfRegionDirectivesAwaitingClosure.Push(containingBlock) Else Debug.Assert(original.Kind = SyntaxKind.EndRegionDirectiveTrivia) If _parentsOfRegionDirectivesAwaitingClosure.Count > 0 Then Dim regionBeginContainingBlock = _parentsOfRegionDirectivesAwaitingClosure.Pop() If regionBeginContainingBlock IsNot containingBlock AndAlso IsValidContainingBlockForRegionInVB12(regionBeginContainingBlock) Then reportAnError = True End If End If End If If reportAnError Then rewritten = _parser.ReportFeatureUnavailable(Feature.RegionsEverywhere, rewritten) End If Return rewritten End Function Private Shared Function IsValidContainingBlockForRegionInVB12(containingBlock As VisualBasicSyntaxNode) As Boolean Select Case containingBlock.Kind Case SyntaxKind.FunctionBlock, SyntaxKind.SubBlock, SyntaxKind.ConstructorBlock, SyntaxKind.OperatorBlock, SyntaxKind.SetAccessorBlock, SyntaxKind.GetAccessorBlock, SyntaxKind.AddHandlerAccessorBlock, SyntaxKind.RemoveHandlerAccessorBlock, SyntaxKind.RaiseEventAccessorBlock Return False End Select Return True End Function Public Overrides Function VisitEndRegionDirectiveTrivia(node As EndRegionDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitEndRegionDirectiveTrivia(node) If Not _regionsAreAllowedEverywhere Then rewritten = VerifyRegionPlacement(node, rewritten) End If Return rewritten End Function Public Overrides Function VisitExternalSourceDirectiveTrivia(node As ExternalSourceDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitExternalSourceDirectiveTrivia(node) If Me._notClosedExternalSourceDirective Is node Then rewritten = Parser.ReportSyntaxError(rewritten, ERRID.ERR_ExpectedEndExternalSource) End If Return rewritten End Function Public Overrides Function Visit(node As VisualBasicSyntaxNode) As VisualBasicSyntaxNode If node Is Nothing OrElse Not node.ContainsDirectives Then Return node End If Return node.Accept(Me) End Function Public Overrides Function VisitSyntaxToken(token As SyntaxToken) As SyntaxToken If token Is Nothing OrElse Not token.ContainsDirectives Then Return token End If Debug.Assert(_tokenWithDirectivesBeingVisited Is Nothing) _tokenWithDirectivesBeingVisited = token Dim leadingTrivia = token.GetLeadingTrivia() Dim trailingTrivia = token.GetTrailingTrivia() If leadingTrivia IsNot Nothing Then Dim rewritten = VisitList(New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(leadingTrivia)).Node If leadingTrivia IsNot rewritten Then token = DirectCast(token.WithLeadingTrivia(rewritten), SyntaxToken) End If End If If trailingTrivia IsNot Nothing Then Dim rewritten = VisitList(New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(trailingTrivia)).Node If trailingTrivia IsNot rewritten Then token = DirectCast(token.WithTrailingTrivia(rewritten), SyntaxToken) End If End If _tokenWithDirectivesBeingVisited = Nothing Return token End Function End Class End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Syntax.InternalSyntax Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax '----------------------------------------------------------------------------- ' Contains the definition of the DeclarationContext '----------------------------------------------------------------------------- Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax Friend NotInheritable Class CompilationUnitContext Inherits NamespaceBlockContext Private _optionStmts As CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of OptionStatementSyntax) Private _importsStmts As CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of ImportsStatementSyntax) Private _attributeStmts As CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of AttributesStatementSyntax) Private _state As SyntaxKind Friend Sub New(parser As Parser) MyBase.New(SyntaxKind.CompilationUnit, Nothing, Nothing) Me.Parser = parser _statements = _parser._pool.Allocate(Of StatementSyntax)() _state = SyntaxKind.OptionStatement End Sub Friend Overrides ReadOnly Property IsWithinAsyncMethodOrLambda As Boolean Get Return Parser.IsScript End Get End Property Friend Overrides Function ProcessSyntax(node As VisualBasicSyntaxNode) As BlockContext Do Select Case _state Case SyntaxKind.OptionStatement If node.Kind = SyntaxKind.OptionStatement Then Add(node) Return Me End If _optionStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of OptionStatementSyntax)(Body.Node) _state = SyntaxKind.ImportsStatement Case SyntaxKind.ImportsStatement If node.Kind = SyntaxKind.ImportsStatement Then Add(node) Return Me End If _importsStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of ImportsStatementSyntax)(Body.Node) _state = SyntaxKind.AttributesStatement Case SyntaxKind.AttributesStatement If node.Kind = SyntaxKind.AttributesStatement Then Add(node) Return Me End If _attributeStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of AttributesStatementSyntax)(Body.Node) _state = SyntaxKind.None Case Else ' only allow executable statements in top-level script code If _parser.IsScript Then Dim newContext = TryProcessExecutableStatement(node) If newContext IsNot Nothing Then Return newContext End If End If Return MyBase.ProcessSyntax(node) End Select Loop End Function Friend Overrides Function TryLinkSyntax(node As VisualBasicSyntaxNode, ByRef newContext As BlockContext) As LinkResult If _parser.IsScript Then Return TryLinkStatement(node, newContext) Else Return MyBase.TryLinkSyntax(node, newContext) End If End Function Friend Overrides Function CreateBlockSyntax(endStmt As StatementSyntax) As VisualBasicSyntaxNode Throw ExceptionUtilities.Unreachable End Function Friend Function CreateCompilationUnit(optionalTerminator As PunctuationSyntax, notClosedIfDirectives As ArrayBuilder(Of IfDirectiveTriviaSyntax), notClosedRegionDirectives As ArrayBuilder(Of RegionDirectiveTriviaSyntax), haveRegionDirectives As Boolean, notClosedExternalSourceDirective As ExternalSourceDirectiveTriviaSyntax) As CompilationUnitSyntax Debug.Assert(optionalTerminator Is Nothing OrElse optionalTerminator.Kind = SyntaxKind.EndOfFileToken) If _state <> SyntaxKind.None Then Select Case _state Case SyntaxKind.OptionStatement _optionStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of OptionStatementSyntax)(Body.Node) Case SyntaxKind.ImportsStatement _importsStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of ImportsStatementSyntax)(Body.Node) Case SyntaxKind.AttributesStatement _attributeStmts = New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of AttributesStatementSyntax)(Body.Node) End Select _state = SyntaxKind.None End If Dim declarations = Body() Dim result = SyntaxFactory.CompilationUnit(_optionStmts, _importsStmts, _attributeStmts, declarations, optionalTerminator) Dim regionsAreAllowedEverywhere = Not haveRegionDirectives OrElse Parser.CheckFeatureAvailability(Feature.RegionsEverywhere) If notClosedIfDirectives IsNot Nothing OrElse notClosedRegionDirectives IsNot Nothing OrElse notClosedExternalSourceDirective IsNot Nothing OrElse Not regionsAreAllowedEverywhere Then result = DiagnosticRewriter.Rewrite(result, notClosedIfDirectives, notClosedRegionDirectives, regionsAreAllowedEverywhere, notClosedExternalSourceDirective, Parser) If notClosedIfDirectives IsNot Nothing Then notClosedIfDirectives.Free() End If If notClosedRegionDirectives IsNot Nothing Then notClosedRegionDirectives.Free() End If End If FreeStatements() Return result End Function Private Class DiagnosticRewriter Inherits VisualBasicSyntaxRewriter Private _notClosedIfDirectives As HashSet(Of IfDirectiveTriviaSyntax) = Nothing Private _notClosedRegionDirectives As HashSet(Of RegionDirectiveTriviaSyntax) = Nothing Private _notClosedExternalSourceDirective As ExternalSourceDirectiveTriviaSyntax = Nothing Private _regionsAreAllowedEverywhere As Boolean Private _parser As Parser Private _declarationBlocksBeingVisited As ArrayBuilder(Of VisualBasicSyntaxNode) ' CompilationUnitSyntax is treated as a declaration block for our purposes Private _parentsOfRegionDirectivesAwaitingClosure As ArrayBuilder(Of VisualBasicSyntaxNode) ' Nodes are coming from _declarationBlocksBeingVisited Private _tokenWithDirectivesBeingVisited As SyntaxToken Private Sub New() MyBase.New() End Sub Public Shared Function Rewrite(compilationUnit As CompilationUnitSyntax, notClosedIfDirectives As ArrayBuilder(Of IfDirectiveTriviaSyntax), notClosedRegionDirectives As ArrayBuilder(Of RegionDirectiveTriviaSyntax), regionsAreAllowedEverywhere As Boolean, notClosedExternalSourceDirective As ExternalSourceDirectiveTriviaSyntax, parser As Parser) As CompilationUnitSyntax Dim rewriter As New DiagnosticRewriter() If notClosedIfDirectives IsNot Nothing Then rewriter._notClosedIfDirectives = New HashSet(Of IfDirectiveTriviaSyntax)(ReferenceEqualityComparer.Instance) For Each node In notClosedIfDirectives rewriter._notClosedIfDirectives.Add(node) Next End If If notClosedRegionDirectives IsNot Nothing Then rewriter._notClosedRegionDirectives = New HashSet(Of RegionDirectiveTriviaSyntax)(ReferenceEqualityComparer.Instance) For Each node In notClosedRegionDirectives rewriter._notClosedRegionDirectives.Add(node) Next End If rewriter._parser = parser rewriter._regionsAreAllowedEverywhere = regionsAreAllowedEverywhere If Not regionsAreAllowedEverywhere Then rewriter._declarationBlocksBeingVisited = ArrayBuilder(Of VisualBasicSyntaxNode).GetInstance() rewriter._parentsOfRegionDirectivesAwaitingClosure = ArrayBuilder(Of VisualBasicSyntaxNode).GetInstance() End If rewriter._notClosedExternalSourceDirective = notClosedExternalSourceDirective Dim result = DirectCast(rewriter.Visit(compilationUnit), CompilationUnitSyntax) If Not regionsAreAllowedEverywhere Then Debug.Assert(rewriter._declarationBlocksBeingVisited.Count = 0) Debug.Assert(rewriter._parentsOfRegionDirectivesAwaitingClosure.Count = 0) ' We never add parents of not closed #Region directives into this stack. rewriter._declarationBlocksBeingVisited.Free() rewriter._parentsOfRegionDirectivesAwaitingClosure.Free() End If Return result End Function #If DEBUG Then ' NOTE: the logic is heavily relying on the fact that green nodes in ' NOTE: one single tree are not reused, the following code assert this Private ReadOnly _processedNodesWithoutDuplication As HashSet(Of VisualBasicSyntaxNode) = New HashSet(Of VisualBasicSyntaxNode)(ReferenceEqualityComparer.Instance) #End If Public Overrides Function VisitCompilationUnit(node As CompilationUnitSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitCompilationUnit(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitMethodBlock(node As MethodBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitMethodBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitConstructorBlock(node As ConstructorBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitConstructorBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitOperatorBlock(node As OperatorBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitOperatorBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitAccessorBlock(node As AccessorBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitAccessorBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitNamespaceBlock(node As NamespaceBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitNamespaceBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitClassBlock(node As ClassBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitClassBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitStructureBlock(node As StructureBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitStructureBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitModuleBlock(node As ModuleBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitModuleBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitInterfaceBlock(node As InterfaceBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitInterfaceBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitEnumBlock(node As EnumBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitEnumBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitPropertyBlock(node As PropertyBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitPropertyBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitEventBlock(node As EventBlockSyntax) As VisualBasicSyntaxNode If _declarationBlocksBeingVisited IsNot Nothing Then _declarationBlocksBeingVisited.Push(node) End If Dim result = MyBase.VisitEventBlock(node) If _declarationBlocksBeingVisited IsNot Nothing Then Dim n = _declarationBlocksBeingVisited.Pop() Debug.Assert(n Is node) End If Return result End Function Public Overrides Function VisitIfDirectiveTrivia(node As IfDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitIfDirectiveTrivia(node) If Me._notClosedIfDirectives IsNot Nothing AndAlso Me._notClosedIfDirectives.Contains(node) Then rewritten = Parser.ReportSyntaxError(rewritten, ERRID.ERR_LbExpectedEndIf) End If Return rewritten End Function Public Overrides Function VisitRegionDirectiveTrivia(node As RegionDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitRegionDirectiveTrivia(node) If Me._notClosedRegionDirectives IsNot Nothing AndAlso Me._notClosedRegionDirectives.Contains(node) Then rewritten = Parser.ReportSyntaxError(rewritten, ERRID.ERR_ExpectedEndRegion) ElseIf Not _regionsAreAllowedEverywhere rewritten = VerifyRegionPlacement(node, rewritten) End If Return rewritten End Function Private Function VerifyRegionPlacement(original As VisualBasicSyntaxNode, rewritten As VisualBasicSyntaxNode) As VisualBasicSyntaxNode Dim containingBlock = _declarationBlocksBeingVisited.Peek() ' Ensure that the directive is inside the block, rather than is attached to it as a leading/trailing trivia Debug.Assert(_declarationBlocksBeingVisited.Count > 1 OrElse containingBlock.Kind = SyntaxKind.CompilationUnit) If _declarationBlocksBeingVisited.Count > 1 Then If _tokenWithDirectivesBeingVisited Is containingBlock.GetFirstToken() Then Dim leadingTrivia = _tokenWithDirectivesBeingVisited.GetLeadingTrivia() If leadingTrivia IsNot Nothing AndAlso New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(leadingTrivia).Nodes.Contains(original) Then containingBlock = _declarationBlocksBeingVisited(_declarationBlocksBeingVisited.Count - 2) End If ElseIf _tokenWithDirectivesBeingVisited Is containingBlock.GetLastToken() Then Dim trailingTrivia = _tokenWithDirectivesBeingVisited.GetTrailingTrivia() If trailingTrivia IsNot Nothing AndAlso New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(trailingTrivia).Nodes.Contains(original) Then containingBlock = _declarationBlocksBeingVisited(_declarationBlocksBeingVisited.Count - 2) End If End If End If Dim reportAnError = Not IsValidContainingBlockForRegionInVB12(containingBlock) If original.Kind = SyntaxKind.RegionDirectiveTrivia Then _parentsOfRegionDirectivesAwaitingClosure.Push(containingBlock) Else Debug.Assert(original.Kind = SyntaxKind.EndRegionDirectiveTrivia) If _parentsOfRegionDirectivesAwaitingClosure.Count > 0 Then Dim regionBeginContainingBlock = _parentsOfRegionDirectivesAwaitingClosure.Pop() If regionBeginContainingBlock IsNot containingBlock AndAlso IsValidContainingBlockForRegionInVB12(regionBeginContainingBlock) Then reportAnError = True End If End If End If If reportAnError Then rewritten = _parser.ReportFeatureUnavailable(Feature.RegionsEverywhere, rewritten) End If Return rewritten End Function Private Shared Function IsValidContainingBlockForRegionInVB12(containingBlock As VisualBasicSyntaxNode) As Boolean Select Case containingBlock.Kind Case SyntaxKind.FunctionBlock, SyntaxKind.SubBlock, SyntaxKind.ConstructorBlock, SyntaxKind.OperatorBlock, SyntaxKind.SetAccessorBlock, SyntaxKind.GetAccessorBlock, SyntaxKind.AddHandlerAccessorBlock, SyntaxKind.RemoveHandlerAccessorBlock, SyntaxKind.RaiseEventAccessorBlock Return False End Select Return True End Function Public Overrides Function VisitEndRegionDirectiveTrivia(node As EndRegionDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitEndRegionDirectiveTrivia(node) If Not _regionsAreAllowedEverywhere Then rewritten = VerifyRegionPlacement(node, rewritten) End If Return rewritten End Function Public Overrides Function VisitExternalSourceDirectiveTrivia(node As ExternalSourceDirectiveTriviaSyntax) As VisualBasicSyntaxNode #If DEBUG Then Debug.Assert(_processedNodesWithoutDuplication.Add(node)) #End If Dim rewritten = MyBase.VisitExternalSourceDirectiveTrivia(node) If Me._notClosedExternalSourceDirective Is node Then rewritten = Parser.ReportSyntaxError(rewritten, ERRID.ERR_ExpectedEndExternalSource) End If Return rewritten End Function Public Overrides Function Visit(node As VisualBasicSyntaxNode) As VisualBasicSyntaxNode If node Is Nothing OrElse Not node.ContainsDirectives Then Return node End If Return node.Accept(Me) End Function Public Overrides Function VisitSyntaxToken(token As SyntaxToken) As SyntaxToken If token Is Nothing OrElse Not token.ContainsDirectives Then Return token End If Debug.Assert(_tokenWithDirectivesBeingVisited Is Nothing) _tokenWithDirectivesBeingVisited = token Dim leadingTrivia = token.GetLeadingTrivia() Dim trailingTrivia = token.GetTrailingTrivia() If leadingTrivia IsNot Nothing Then Dim rewritten = VisitList(New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(leadingTrivia)).Node If leadingTrivia IsNot rewritten Then token = DirectCast(token.WithLeadingTrivia(rewritten), SyntaxToken) End If End If If trailingTrivia IsNot Nothing Then Dim rewritten = VisitList(New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(trailingTrivia)).Node If trailingTrivia IsNot rewritten Then token = DirectCast(token.WithTrailingTrivia(rewritten), SyntaxToken) End If End If _tokenWithDirectivesBeingVisited = Nothing Return token End Function End Class End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Core/Portable/InternalUtilities/CommandLineUtilities.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Text; namespace Roslyn.Utilities { internal static class CommandLineUtilities { /// <summary> /// Split a command line by the same rules as Main would get the commands except the original /// state of backslashes and quotes are preserved. For example in normal Windows command line /// parsing the following command lines would produce equivalent Main arguments: /// /// - /r:a,b /// - /r:"a,b" /// /// This method will differ as the latter will have the quotes preserved. The only case where /// quotes are removed is when the entire argument is surrounded by quotes without any inner /// quotes. /// </summary> /// <remarks> /// Rules for command line parsing, according to MSDN: /// /// Arguments are delimited by white space, which is either a space or a tab. /// /// A string surrounded by double quotation marks ("string") is interpreted /// as a single argument, regardless of white space contained within. /// A quoted string can be embedded in an argument. /// /// A double quotation mark preceded by a backslash (\") is interpreted as a /// literal double quotation mark character ("). /// /// Backslashes are interpreted literally, unless they immediately precede a /// double quotation mark. /// /// If an even number of backslashes is followed by a double quotation mark, /// one backslash is placed in the argv array for every pair of backslashes, /// and the double quotation mark is interpreted as a string delimiter. /// /// If an odd number of backslashes is followed by a double quotation mark, /// one backslash is placed in the argv array for every pair of backslashes, /// and the double quotation mark is "escaped" by the remaining backslash, /// causing a literal double quotation mark (") to be placed in argv. /// </remarks> public static List<string> SplitCommandLineIntoArguments(string commandLine, bool removeHashComments) { return SplitCommandLineIntoArguments(commandLine, removeHashComments, out _); } public static List<string> SplitCommandLineIntoArguments(string commandLine, bool removeHashComments, out char? illegalChar) { var list = new List<string>(); SplitCommandLineIntoArguments(commandLine.AsSpan(), removeHashComments, new StringBuilder(), list, out illegalChar); return list; } public static void SplitCommandLineIntoArguments(ReadOnlySpan<char> commandLine, bool removeHashComments, StringBuilder builder, List<string> list, out char? illegalChar) { var i = 0; builder.Length = 0; illegalChar = null; while (i < commandLine.Length) { while (i < commandLine.Length && char.IsWhiteSpace(commandLine[i])) { i++; } if (i == commandLine.Length) { break; } if (commandLine[i] == '#' && removeHashComments) { break; } var quoteCount = 0; builder.Length = 0; while (i < commandLine.Length && (!char.IsWhiteSpace(commandLine[i]) || (quoteCount % 2 != 0))) { var current = commandLine[i]; switch (current) { case '\\': { var slashCount = 0; do { builder.Append(commandLine[i]); i++; slashCount++; } while (i < commandLine.Length && commandLine[i] == '\\'); // Slashes not followed by a quote character can be ignored for now if (i >= commandLine.Length || commandLine[i] != '"') { break; } // If there is an odd number of slashes then it is escaping the quote // otherwise it is just a quote. if (slashCount % 2 == 0) { quoteCount++; } builder.Append('"'); i++; break; } case '"': builder.Append(current); quoteCount++; i++; break; default: if ((current >= 0x1 && current <= 0x1f) || current == '|') { if (illegalChar == null) { illegalChar = current; } } else { builder.Append(current); } i++; break; } } // If the quote string is surrounded by quotes with no interior quotes then // remove the quotes here. if (quoteCount == 2 && builder[0] == '"' && builder[builder.Length - 1] == '"') { builder.Remove(0, length: 1); builder.Remove(builder.Length - 1, length: 1); } if (builder.Length > 0) { list.Add(builder.ToString()); } } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Text; namespace Roslyn.Utilities { internal static class CommandLineUtilities { /// <summary> /// Split a command line by the same rules as Main would get the commands except the original /// state of backslashes and quotes are preserved. For example in normal Windows command line /// parsing the following command lines would produce equivalent Main arguments: /// /// - /r:a,b /// - /r:"a,b" /// /// This method will differ as the latter will have the quotes preserved. The only case where /// quotes are removed is when the entire argument is surrounded by quotes without any inner /// quotes. /// </summary> /// <remarks> /// Rules for command line parsing, according to MSDN: /// /// Arguments are delimited by white space, which is either a space or a tab. /// /// A string surrounded by double quotation marks ("string") is interpreted /// as a single argument, regardless of white space contained within. /// A quoted string can be embedded in an argument. /// /// A double quotation mark preceded by a backslash (\") is interpreted as a /// literal double quotation mark character ("). /// /// Backslashes are interpreted literally, unless they immediately precede a /// double quotation mark. /// /// If an even number of backslashes is followed by a double quotation mark, /// one backslash is placed in the argv array for every pair of backslashes, /// and the double quotation mark is interpreted as a string delimiter. /// /// If an odd number of backslashes is followed by a double quotation mark, /// one backslash is placed in the argv array for every pair of backslashes, /// and the double quotation mark is "escaped" by the remaining backslash, /// causing a literal double quotation mark (") to be placed in argv. /// </remarks> public static List<string> SplitCommandLineIntoArguments(string commandLine, bool removeHashComments) { return SplitCommandLineIntoArguments(commandLine, removeHashComments, out _); } public static List<string> SplitCommandLineIntoArguments(string commandLine, bool removeHashComments, out char? illegalChar) { var list = new List<string>(); SplitCommandLineIntoArguments(commandLine.AsSpan(), removeHashComments, new StringBuilder(), list, out illegalChar); return list; } public static void SplitCommandLineIntoArguments(ReadOnlySpan<char> commandLine, bool removeHashComments, StringBuilder builder, List<string> list, out char? illegalChar) { var i = 0; builder.Length = 0; illegalChar = null; while (i < commandLine.Length) { while (i < commandLine.Length && char.IsWhiteSpace(commandLine[i])) { i++; } if (i == commandLine.Length) { break; } if (commandLine[i] == '#' && removeHashComments) { break; } var quoteCount = 0; builder.Length = 0; while (i < commandLine.Length && (!char.IsWhiteSpace(commandLine[i]) || (quoteCount % 2 != 0))) { var current = commandLine[i]; switch (current) { case '\\': { var slashCount = 0; do { builder.Append(commandLine[i]); i++; slashCount++; } while (i < commandLine.Length && commandLine[i] == '\\'); // Slashes not followed by a quote character can be ignored for now if (i >= commandLine.Length || commandLine[i] != '"') { break; } // If there is an odd number of slashes then it is escaping the quote // otherwise it is just a quote. if (slashCount % 2 == 0) { quoteCount++; } builder.Append('"'); i++; break; } case '"': builder.Append(current); quoteCount++; i++; break; default: if ((current >= 0x1 && current <= 0x1f) || current == '|') { if (illegalChar == null) { illegalChar = current; } } else { builder.Append(current); } i++; break; } } // If the quote string is surrounded by quotes with no interior quotes then // remove the quotes here. if (quoteCount == 2 && builder[0] == '"' && builder[builder.Length - 1] == '"') { builder.Remove(0, length: 1); builder.Remove(builder.Length - 1, length: 1); } if (builder.Length > 0) { list.Add(builder.ToString()); } } } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Analyzers/CSharp/CodeFixes/PopulateSwitch/CSharpPopulateSwitchExpressionCodeFixProvider.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Composition; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.PopulateSwitch; namespace Microsoft.CodeAnalysis.CSharp.PopulateSwitch { using static SyntaxFactory; [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.PopulateSwitchExpression), Shared] [ExtensionOrder(After = PredefinedCodeFixProviderNames.ImplementInterface)] internal class CSharpPopulateSwitchExpressionCodeFixProvider : AbstractPopulateSwitchExpressionCodeFixProvider< ExpressionSyntax, SwitchExpressionSyntax, SwitchExpressionArmSyntax, MemberAccessExpressionSyntax> { [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public CSharpPopulateSwitchExpressionCodeFixProvider() { } protected override SwitchExpressionArmSyntax CreateDefaultSwitchArm(SyntaxGenerator generator, Compilation compilation) => SwitchExpressionArm(DiscardPattern(), Exception(generator, compilation)); protected override SwitchExpressionArmSyntax CreateSwitchArm(SyntaxGenerator generator, Compilation compilation, MemberAccessExpressionSyntax caseLabel) => SwitchExpressionArm(ConstantPattern(caseLabel), Exception(generator, compilation)); protected override SwitchExpressionSyntax InsertSwitchArms(SyntaxGenerator generator, SwitchExpressionSyntax switchNode, int insertLocation, List<SwitchExpressionArmSyntax> newArms) { // If the existing switch expression ends with a comma, then ensure that we preserve // that. Also do this for an empty switch statement. if (switchNode.Arms.Count == 0 || !switchNode.Arms.GetWithSeparators().LastOrDefault().IsNode) { return switchNode.WithArms(switchNode.Arms.InsertRangeWithTrailingSeparator( insertLocation, newArms, SyntaxKind.CommaToken)); } return switchNode.WithArms(switchNode.Arms.InsertRange(insertLocation, newArms)); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Composition; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.PopulateSwitch; namespace Microsoft.CodeAnalysis.CSharp.PopulateSwitch { using static SyntaxFactory; [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.PopulateSwitchExpression), Shared] [ExtensionOrder(After = PredefinedCodeFixProviderNames.ImplementInterface)] internal class CSharpPopulateSwitchExpressionCodeFixProvider : AbstractPopulateSwitchExpressionCodeFixProvider< ExpressionSyntax, SwitchExpressionSyntax, SwitchExpressionArmSyntax, MemberAccessExpressionSyntax> { [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public CSharpPopulateSwitchExpressionCodeFixProvider() { } protected override SwitchExpressionArmSyntax CreateDefaultSwitchArm(SyntaxGenerator generator, Compilation compilation) => SwitchExpressionArm(DiscardPattern(), Exception(generator, compilation)); protected override SwitchExpressionArmSyntax CreateSwitchArm(SyntaxGenerator generator, Compilation compilation, MemberAccessExpressionSyntax caseLabel) => SwitchExpressionArm(ConstantPattern(caseLabel), Exception(generator, compilation)); protected override SwitchExpressionSyntax InsertSwitchArms(SyntaxGenerator generator, SwitchExpressionSyntax switchNode, int insertLocation, List<SwitchExpressionArmSyntax> newArms) { // If the existing switch expression ends with a comma, then ensure that we preserve // that. Also do this for an empty switch statement. if (switchNode.Arms.Count == 0 || !switchNode.Arms.GetWithSeparators().LastOrDefault().IsNode) { return switchNode.WithArms(switchNode.Arms.InsertRangeWithTrailingSeparator( insertLocation, newArms, SyntaxKind.CommaToken)); } return switchNode.WithArms(switchNode.Arms.InsertRange(insertLocation, newArms)); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Features/VisualBasic/Portable/ExtractMethod/VisualBasicMethodExtractor.VisualBasicCodeGenerator.CallSiteContainerRewriter.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.VisualBasic Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.ExtractMethod Partial Friend Class VisualBasicMethodExtractor Partial Private MustInherit Class VisualBasicCodeGenerator Private Class CallSiteContainerRewriter Inherits VisualBasicSyntaxRewriter Private ReadOnly _outmostCallSiteContainer As SyntaxNode Private ReadOnly _statementsOrFieldToInsert As IEnumerable(Of StatementSyntax) Private ReadOnly _variableToRemoveMap As HashSet(Of SyntaxAnnotation) Private ReadOnly _firstStatementOrFieldToReplace As StatementSyntax Private ReadOnly _lastStatementOrFieldToReplace As StatementSyntax Private Shared ReadOnly s_removeAnnotation As SyntaxAnnotation = New SyntaxAnnotation() Public Sub New(outmostCallSiteContainer As SyntaxNode, variableToRemoveMap As HashSet(Of SyntaxAnnotation), firstStatementOrFieldToReplace As StatementSyntax, lastStatementOrFieldToReplace As StatementSyntax, statementsOrFieldToInsert As IEnumerable(Of StatementSyntax)) Contract.ThrowIfNull(outmostCallSiteContainer) Contract.ThrowIfNull(variableToRemoveMap) Contract.ThrowIfNull(firstStatementOrFieldToReplace) Contract.ThrowIfNull(lastStatementOrFieldToReplace) Contract.ThrowIfTrue(statementsOrFieldToInsert.IsEmpty()) Me._outmostCallSiteContainer = outmostCallSiteContainer Me._variableToRemoveMap = variableToRemoveMap Me._statementsOrFieldToInsert = statementsOrFieldToInsert Me._firstStatementOrFieldToReplace = firstStatementOrFieldToReplace Me._lastStatementOrFieldToReplace = lastStatementOrFieldToReplace Contract.ThrowIfFalse(Me._firstStatementOrFieldToReplace.Parent Is Me._lastStatementOrFieldToReplace.Parent) End Sub Public Function Generate() As SyntaxNode Dim result = Visit(Me._outmostCallSiteContainer) ' remove any nodes annotated for removal If result.ContainsAnnotations Then Dim nodesToRemove = result.DescendantNodes(Function(n) n.ContainsAnnotations).Where(Function(n) n.HasAnnotation(s_removeAnnotation)) result = result.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia) End If Return result End Function Private ReadOnly Property ContainerOfStatementsOrFieldToReplace() As SyntaxNode Get Return Me._firstStatementOrFieldToReplace.Parent End Get End Property Public Overrides Function VisitLocalDeclarationStatement(node As LocalDeclarationStatementSyntax) As SyntaxNode node = CType(MyBase.VisitLocalDeclarationStatement(node), LocalDeclarationStatementSyntax) Dim expressionStatements = New List(Of StatementSyntax)() Dim variableDeclarators = New List(Of VariableDeclaratorSyntax)() Dim triviaList = New List(Of SyntaxTrivia)() If Not Me._variableToRemoveMap.ProcessLocalDeclarationStatement(node, expressionStatements, variableDeclarators, triviaList) Then Contract.ThrowIfFalse(expressionStatements.Count = 0) Return node End If Contract.ThrowIfFalse(expressionStatements.Count = 0) If variableDeclarators.Count = 0 AndAlso triviaList.Any(Function(t) t.Kind <> SyntaxKind.WhitespaceTrivia AndAlso t.Kind <> SyntaxKind.EndOfLineTrivia) Then ' well, there are trivia associated with the node. ' we can't just delete the node since then, we will lose ' the trivia. unfortunately, it is not easy to attach the trivia ' to next token. for now, create an empty statement and associate the ' trivia to the statement ' TODO : think about a way to trivia attached to next token Return SyntaxFactory.EmptyStatement(SyntaxFactory.Token(SyntaxKind.EmptyToken).WithLeadingTrivia(SyntaxFactory.TriviaList(triviaList))) End If ' return survived var decls If variableDeclarators.Count > 0 Then Return SyntaxFactory.LocalDeclarationStatement( node.Modifiers, SyntaxFactory.SeparatedList(variableDeclarators)).WithPrependedLeadingTrivia(triviaList) End If Return node.WithAdditionalAnnotations(s_removeAnnotation) End Function Public Overrides Function VisitMethodBlock(node As MethodBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitMethodBlock(node) End If Return node.WithSubOrFunctionStatement(ReplaceStatementIfNeeded(node.SubOrFunctionStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitConstructorBlock(node As ConstructorBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitConstructorBlock(node) End If Return node.WithSubNewStatement(ReplaceStatementIfNeeded(node.SubNewStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitOperatorBlock(node As OperatorBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitOperatorBlock(node) End If Return node.WithOperatorStatement(ReplaceStatementIfNeeded(node.OperatorStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitAccessorBlock(node As AccessorBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitAccessorBlock(node) End If Return node.WithAccessorStatement(ReplaceStatementIfNeeded(node.AccessorStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitWhileBlock(node As WhileBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the switch section Return MyBase.VisitWhileBlock(node) End If Return node.WithWhileStatement(ReplaceStatementIfNeeded(node.WhileStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitUsingBlock(node As UsingBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitUsingBlock(node) End If Return node.WithUsingStatement(ReplaceStatementIfNeeded(node.UsingStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitSyncLockBlock(node As SyncLockBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSyncLockBlock(node) End If Return node.WithSyncLockStatement(ReplaceStatementIfNeeded(node.SyncLockStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitWithBlock(node As WithBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitWithBlock(node) End If Return node.WithWithStatement(ReplaceStatementIfNeeded(node.WithStatement)). WithStatements(ReplaceStatementsIfNeeded(node.Statements)) End Function Public Overrides Function VisitSingleLineIfStatement(node As SingleLineIfStatementSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSingleLineIfStatement(node) End If Return SyntaxFactory.SingleLineIfStatement(node.IfKeyword, node.Condition, node.ThenKeyword, VisitList(ReplaceStatementsIfNeeded(node.Statements, colon:=True)), node.ElseClause) End Function Public Overrides Function VisitSingleLineElseClause(node As SingleLineElseClauseSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSingleLineElseClause(node) End If Return SyntaxFactory.SingleLineElseClause(node.ElseKeyword, VisitList(ReplaceStatementsIfNeeded(node.Statements, colon:=True))) End Function Public Overrides Function VisitMultiLineIfBlock(node As MultiLineIfBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitMultiLineIfBlock(node) End If Return node.WithIfStatement(ReplaceStatementIfNeeded(node.IfStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitElseBlock(node As ElseBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitElseBlock(node) End If Return node.WithElseStatement(ReplaceStatementIfNeeded(node.ElseStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitTryBlock(node As TryBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitTryBlock(node) End If Return node.WithTryStatement(ReplaceStatementIfNeeded(node.TryStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitCatchBlock(node As CatchBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitCatchBlock(node) End If Return node.WithCatchStatement(ReplaceStatementIfNeeded(node.CatchStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitFinallyBlock(node As FinallyBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitFinallyBlock(node) End If Return node.WithFinallyStatement(ReplaceStatementIfNeeded(node.FinallyStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitSelectBlock(node As SelectBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSelectBlock(node) End If Return node.WithSelectStatement(ReplaceStatementIfNeeded(node.SelectStatement)). WithCaseBlocks(VisitList(node.CaseBlocks)). WithEndSelectStatement(ReplaceStatementIfNeeded(node.EndSelectStatement)) End Function Public Overrides Function VisitCaseBlock(node As CaseBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitCaseBlock(node) End If Return node.WithCaseStatement(ReplaceStatementIfNeeded(node.CaseStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitDoLoopBlock(node As DoLoopBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitDoLoopBlock(node) End If Return node.WithDoStatement(ReplaceStatementIfNeeded(node.DoStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithLoopStatement(ReplaceStatementIfNeeded(node.LoopStatement)) End Function Public Overrides Function VisitForBlock(node As ForBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitForBlock(node) End If Return node.WithForStatement(ReplaceStatementIfNeeded(node.ForStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithNextStatement(ReplaceStatementIfNeeded(node.NextStatement)) End Function Public Overrides Function VisitForEachBlock(node As ForEachBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitForEachBlock(node) End If Return node.WithForEachStatement(ReplaceStatementIfNeeded(node.ForEachStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithNextStatement(ReplaceStatementIfNeeded(node.NextStatement)) End Function Public Overrides Function VisitSingleLineLambdaExpression(node As SingleLineLambdaExpressionSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSingleLineLambdaExpression(node) End If Dim body = SyntaxFactory.SingletonList(DirectCast(node.Body, StatementSyntax)) Return node.WithBody(VisitList(ReplaceStatementsIfNeeded(body, colon:=True)).First()). WithSubOrFunctionHeader(ReplaceStatementIfNeeded(node.SubOrFunctionHeader)) End Function Public Overrides Function VisitMultiLineLambdaExpression(node As MultiLineLambdaExpressionSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitMultiLineLambdaExpression(node) End If Return node.WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithSubOrFunctionHeader(ReplaceStatementIfNeeded(node.SubOrFunctionHeader)) End Function Private Function ReplaceStatementIfNeeded(Of T As StatementSyntax)(statement As T) As T Contract.ThrowIfNull(statement) ' if all three same If (statement IsNot _firstStatementOrFieldToReplace) OrElse (Me._firstStatementOrFieldToReplace IsNot Me._lastStatementOrFieldToReplace) Then Return statement End If Contract.ThrowIfFalse(Me._statementsOrFieldToInsert.Count() = 1) Return CType(Me._statementsOrFieldToInsert.Single(), T) End Function Private Function ReplaceStatementsIfNeeded(statements As SyntaxList(Of StatementSyntax), Optional colon As Boolean = False) As SyntaxList(Of StatementSyntax) Dim newStatements = New List(Of StatementSyntax)(statements) Dim firstStatementIndex = newStatements.FindIndex(Function(s) s Is Me._firstStatementOrFieldToReplace) ' looks like statements belong to parent's Begin statement. there is nothing we need to do here. If firstStatementIndex < 0 Then Contract.ThrowIfFalse(Me._firstStatementOrFieldToReplace Is Me._lastStatementOrFieldToReplace) Return statements End If Dim lastStatementIndex = newStatements.FindIndex(Function(s) s Is Me._lastStatementOrFieldToReplace) Contract.ThrowIfFalse(lastStatementIndex >= 0) Contract.ThrowIfFalse(firstStatementIndex <= lastStatementIndex) ' okay, this visit contains the statement ' remove statement that must be removed statements = statements.RemoveRange(firstStatementIndex, lastStatementIndex - firstStatementIndex + 1) ' insert new statements Return statements.InsertRange(firstStatementIndex, Join(Me._statementsOrFieldToInsert, colon).ToArray()) End Function Private Shared Function Join(statements As IEnumerable(Of StatementSyntax), colon As Boolean) As IEnumerable(Of StatementSyntax) If Not colon Then Return statements End If Dim removeEndOfLine = Function(t As SyntaxTrivia) Not t.IsElastic() AndAlso t.Kind <> SyntaxKind.EndOfLineTrivia Dim i = 0 Dim count = statements.Count() Dim trivia = SyntaxFactory.ColonTrivia(SyntaxFacts.GetText(SyntaxKind.ColonTrivia)) Dim newStatements = New List(Of StatementSyntax) For Each statement In statements statement = statement.WithLeadingTrivia(statement.GetLeadingTrivia().Where(removeEndOfLine)) If i < count - 1 Then statement = statement.WithTrailingTrivia(statement.GetTrailingTrivia().Where(removeEndOfLine).Concat(trivia)) End If newStatements.Add(statement) i += 1 Next Return newStatements End Function Public Overrides Function VisitModuleBlock(ByVal node As ModuleBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitModuleBlock(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function Public Overrides Function VisitClassBlock(ByVal node As ClassBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitClassBlock(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function Public Overrides Function VisitStructureBlock(ByVal node As StructureBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitStructureBlock(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function Public Overrides Function VisitCompilationUnit(node As CompilationUnitSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitCompilationUnit(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function End Class End Class End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.VisualBasic Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.ExtractMethod Partial Friend Class VisualBasicMethodExtractor Partial Private MustInherit Class VisualBasicCodeGenerator Private Class CallSiteContainerRewriter Inherits VisualBasicSyntaxRewriter Private ReadOnly _outmostCallSiteContainer As SyntaxNode Private ReadOnly _statementsOrFieldToInsert As IEnumerable(Of StatementSyntax) Private ReadOnly _variableToRemoveMap As HashSet(Of SyntaxAnnotation) Private ReadOnly _firstStatementOrFieldToReplace As StatementSyntax Private ReadOnly _lastStatementOrFieldToReplace As StatementSyntax Private Shared ReadOnly s_removeAnnotation As SyntaxAnnotation = New SyntaxAnnotation() Public Sub New(outmostCallSiteContainer As SyntaxNode, variableToRemoveMap As HashSet(Of SyntaxAnnotation), firstStatementOrFieldToReplace As StatementSyntax, lastStatementOrFieldToReplace As StatementSyntax, statementsOrFieldToInsert As IEnumerable(Of StatementSyntax)) Contract.ThrowIfNull(outmostCallSiteContainer) Contract.ThrowIfNull(variableToRemoveMap) Contract.ThrowIfNull(firstStatementOrFieldToReplace) Contract.ThrowIfNull(lastStatementOrFieldToReplace) Contract.ThrowIfTrue(statementsOrFieldToInsert.IsEmpty()) Me._outmostCallSiteContainer = outmostCallSiteContainer Me._variableToRemoveMap = variableToRemoveMap Me._statementsOrFieldToInsert = statementsOrFieldToInsert Me._firstStatementOrFieldToReplace = firstStatementOrFieldToReplace Me._lastStatementOrFieldToReplace = lastStatementOrFieldToReplace Contract.ThrowIfFalse(Me._firstStatementOrFieldToReplace.Parent Is Me._lastStatementOrFieldToReplace.Parent) End Sub Public Function Generate() As SyntaxNode Dim result = Visit(Me._outmostCallSiteContainer) ' remove any nodes annotated for removal If result.ContainsAnnotations Then Dim nodesToRemove = result.DescendantNodes(Function(n) n.ContainsAnnotations).Where(Function(n) n.HasAnnotation(s_removeAnnotation)) result = result.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia) End If Return result End Function Private ReadOnly Property ContainerOfStatementsOrFieldToReplace() As SyntaxNode Get Return Me._firstStatementOrFieldToReplace.Parent End Get End Property Public Overrides Function VisitLocalDeclarationStatement(node As LocalDeclarationStatementSyntax) As SyntaxNode node = CType(MyBase.VisitLocalDeclarationStatement(node), LocalDeclarationStatementSyntax) Dim expressionStatements = New List(Of StatementSyntax)() Dim variableDeclarators = New List(Of VariableDeclaratorSyntax)() Dim triviaList = New List(Of SyntaxTrivia)() If Not Me._variableToRemoveMap.ProcessLocalDeclarationStatement(node, expressionStatements, variableDeclarators, triviaList) Then Contract.ThrowIfFalse(expressionStatements.Count = 0) Return node End If Contract.ThrowIfFalse(expressionStatements.Count = 0) If variableDeclarators.Count = 0 AndAlso triviaList.Any(Function(t) t.Kind <> SyntaxKind.WhitespaceTrivia AndAlso t.Kind <> SyntaxKind.EndOfLineTrivia) Then ' well, there are trivia associated with the node. ' we can't just delete the node since then, we will lose ' the trivia. unfortunately, it is not easy to attach the trivia ' to next token. for now, create an empty statement and associate the ' trivia to the statement ' TODO : think about a way to trivia attached to next token Return SyntaxFactory.EmptyStatement(SyntaxFactory.Token(SyntaxKind.EmptyToken).WithLeadingTrivia(SyntaxFactory.TriviaList(triviaList))) End If ' return survived var decls If variableDeclarators.Count > 0 Then Return SyntaxFactory.LocalDeclarationStatement( node.Modifiers, SyntaxFactory.SeparatedList(variableDeclarators)).WithPrependedLeadingTrivia(triviaList) End If Return node.WithAdditionalAnnotations(s_removeAnnotation) End Function Public Overrides Function VisitMethodBlock(node As MethodBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitMethodBlock(node) End If Return node.WithSubOrFunctionStatement(ReplaceStatementIfNeeded(node.SubOrFunctionStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitConstructorBlock(node As ConstructorBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitConstructorBlock(node) End If Return node.WithSubNewStatement(ReplaceStatementIfNeeded(node.SubNewStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitOperatorBlock(node As OperatorBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitOperatorBlock(node) End If Return node.WithOperatorStatement(ReplaceStatementIfNeeded(node.OperatorStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitAccessorBlock(node As AccessorBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitAccessorBlock(node) End If Return node.WithAccessorStatement(ReplaceStatementIfNeeded(node.AccessorStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitWhileBlock(node As WhileBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the switch section Return MyBase.VisitWhileBlock(node) End If Return node.WithWhileStatement(ReplaceStatementIfNeeded(node.WhileStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitUsingBlock(node As UsingBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitUsingBlock(node) End If Return node.WithUsingStatement(ReplaceStatementIfNeeded(node.UsingStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitSyncLockBlock(node As SyncLockBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSyncLockBlock(node) End If Return node.WithSyncLockStatement(ReplaceStatementIfNeeded(node.SyncLockStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitWithBlock(node As WithBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitWithBlock(node) End If Return node.WithWithStatement(ReplaceStatementIfNeeded(node.WithStatement)). WithStatements(ReplaceStatementsIfNeeded(node.Statements)) End Function Public Overrides Function VisitSingleLineIfStatement(node As SingleLineIfStatementSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSingleLineIfStatement(node) End If Return SyntaxFactory.SingleLineIfStatement(node.IfKeyword, node.Condition, node.ThenKeyword, VisitList(ReplaceStatementsIfNeeded(node.Statements, colon:=True)), node.ElseClause) End Function Public Overrides Function VisitSingleLineElseClause(node As SingleLineElseClauseSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSingleLineElseClause(node) End If Return SyntaxFactory.SingleLineElseClause(node.ElseKeyword, VisitList(ReplaceStatementsIfNeeded(node.Statements, colon:=True))) End Function Public Overrides Function VisitMultiLineIfBlock(node As MultiLineIfBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitMultiLineIfBlock(node) End If Return node.WithIfStatement(ReplaceStatementIfNeeded(node.IfStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitElseBlock(node As ElseBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitElseBlock(node) End If Return node.WithElseStatement(ReplaceStatementIfNeeded(node.ElseStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitTryBlock(node As TryBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitTryBlock(node) End If Return node.WithTryStatement(ReplaceStatementIfNeeded(node.TryStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitCatchBlock(node As CatchBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitCatchBlock(node) End If Return node.WithCatchStatement(ReplaceStatementIfNeeded(node.CatchStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitFinallyBlock(node As FinallyBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitFinallyBlock(node) End If Return node.WithFinallyStatement(ReplaceStatementIfNeeded(node.FinallyStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitSelectBlock(node As SelectBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSelectBlock(node) End If Return node.WithSelectStatement(ReplaceStatementIfNeeded(node.SelectStatement)). WithCaseBlocks(VisitList(node.CaseBlocks)). WithEndSelectStatement(ReplaceStatementIfNeeded(node.EndSelectStatement)) End Function Public Overrides Function VisitCaseBlock(node As CaseBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitCaseBlock(node) End If Return node.WithCaseStatement(ReplaceStatementIfNeeded(node.CaseStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))) End Function Public Overrides Function VisitDoLoopBlock(node As DoLoopBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitDoLoopBlock(node) End If Return node.WithDoStatement(ReplaceStatementIfNeeded(node.DoStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithLoopStatement(ReplaceStatementIfNeeded(node.LoopStatement)) End Function Public Overrides Function VisitForBlock(node As ForBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitForBlock(node) End If Return node.WithForStatement(ReplaceStatementIfNeeded(node.ForStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithNextStatement(ReplaceStatementIfNeeded(node.NextStatement)) End Function Public Overrides Function VisitForEachBlock(node As ForEachBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitForEachBlock(node) End If Return node.WithForEachStatement(ReplaceStatementIfNeeded(node.ForEachStatement)). WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithNextStatement(ReplaceStatementIfNeeded(node.NextStatement)) End Function Public Overrides Function VisitSingleLineLambdaExpression(node As SingleLineLambdaExpressionSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitSingleLineLambdaExpression(node) End If Dim body = SyntaxFactory.SingletonList(DirectCast(node.Body, StatementSyntax)) Return node.WithBody(VisitList(ReplaceStatementsIfNeeded(body, colon:=True)).First()). WithSubOrFunctionHeader(ReplaceStatementIfNeeded(node.SubOrFunctionHeader)) End Function Public Overrides Function VisitMultiLineLambdaExpression(node As MultiLineLambdaExpressionSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then Return MyBase.VisitMultiLineLambdaExpression(node) End If Return node.WithStatements(VisitList(ReplaceStatementsIfNeeded(node.Statements))). WithSubOrFunctionHeader(ReplaceStatementIfNeeded(node.SubOrFunctionHeader)) End Function Private Function ReplaceStatementIfNeeded(Of T As StatementSyntax)(statement As T) As T Contract.ThrowIfNull(statement) ' if all three same If (statement IsNot _firstStatementOrFieldToReplace) OrElse (Me._firstStatementOrFieldToReplace IsNot Me._lastStatementOrFieldToReplace) Then Return statement End If Contract.ThrowIfFalse(Me._statementsOrFieldToInsert.Count() = 1) Return CType(Me._statementsOrFieldToInsert.Single(), T) End Function Private Function ReplaceStatementsIfNeeded(statements As SyntaxList(Of StatementSyntax), Optional colon As Boolean = False) As SyntaxList(Of StatementSyntax) Dim newStatements = New List(Of StatementSyntax)(statements) Dim firstStatementIndex = newStatements.FindIndex(Function(s) s Is Me._firstStatementOrFieldToReplace) ' looks like statements belong to parent's Begin statement. there is nothing we need to do here. If firstStatementIndex < 0 Then Contract.ThrowIfFalse(Me._firstStatementOrFieldToReplace Is Me._lastStatementOrFieldToReplace) Return statements End If Dim lastStatementIndex = newStatements.FindIndex(Function(s) s Is Me._lastStatementOrFieldToReplace) Contract.ThrowIfFalse(lastStatementIndex >= 0) Contract.ThrowIfFalse(firstStatementIndex <= lastStatementIndex) ' okay, this visit contains the statement ' remove statement that must be removed statements = statements.RemoveRange(firstStatementIndex, lastStatementIndex - firstStatementIndex + 1) ' insert new statements Return statements.InsertRange(firstStatementIndex, Join(Me._statementsOrFieldToInsert, colon).ToArray()) End Function Private Shared Function Join(statements As IEnumerable(Of StatementSyntax), colon As Boolean) As IEnumerable(Of StatementSyntax) If Not colon Then Return statements End If Dim removeEndOfLine = Function(t As SyntaxTrivia) Not t.IsElastic() AndAlso t.Kind <> SyntaxKind.EndOfLineTrivia Dim i = 0 Dim count = statements.Count() Dim trivia = SyntaxFactory.ColonTrivia(SyntaxFacts.GetText(SyntaxKind.ColonTrivia)) Dim newStatements = New List(Of StatementSyntax) For Each statement In statements statement = statement.WithLeadingTrivia(statement.GetLeadingTrivia().Where(removeEndOfLine)) If i < count - 1 Then statement = statement.WithTrailingTrivia(statement.GetTrailingTrivia().Where(removeEndOfLine).Concat(trivia)) End If newStatements.Add(statement) i += 1 Next Return newStatements End Function Public Overrides Function VisitModuleBlock(ByVal node As ModuleBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitModuleBlock(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function Public Overrides Function VisitClassBlock(ByVal node As ClassBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitClassBlock(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function Public Overrides Function VisitStructureBlock(ByVal node As StructureBlockSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitStructureBlock(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function Public Overrides Function VisitCompilationUnit(node As CompilationUnitSyntax) As SyntaxNode If node IsNot Me.ContainerOfStatementsOrFieldToReplace Then ' make sure we visit nodes under the block Return MyBase.VisitCompilationUnit(node) End If Return node.WithMembers(VisitList(ReplaceStatementsIfNeeded(node.Members))) End Function End Class End Class End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/Core/Portable/ProjectTelemetry/IRemoteProjectTelemetryService.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Remote; namespace Microsoft.CodeAnalysis.ProjectTelemetry { /// <summary> /// Interface to allow host (VS) to inform the OOP service to start incrementally analyzing and /// reporting results back to the host. /// </summary> internal interface IRemoteProjectTelemetryService { internal interface ICallback { ValueTask ReportProjectTelemetryDataAsync(RemoteServiceCallbackId callbackId, ProjectTelemetryData data, CancellationToken cancellationToken); } ValueTask ComputeProjectTelemetryAsync(RemoteServiceCallbackId callbackId, CancellationToken cancellation); } [ExportRemoteServiceCallbackDispatcher(typeof(IRemoteProjectTelemetryService)), Shared] internal sealed class RemoteProjectTelemetryServiceCallbackDispatcher : RemoteServiceCallbackDispatcher, IRemoteProjectTelemetryService.ICallback { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public RemoteProjectTelemetryServiceCallbackDispatcher() { } private IProjectTelemetryListener GetLogService(RemoteServiceCallbackId callbackId) => (IProjectTelemetryListener)GetCallback(callbackId); public ValueTask ReportProjectTelemetryDataAsync(RemoteServiceCallbackId callbackId, ProjectTelemetryData data, CancellationToken cancellationToken) => GetLogService(callbackId).ReportProjectTelemetryDataAsync(data, cancellationToken); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Remote; namespace Microsoft.CodeAnalysis.ProjectTelemetry { /// <summary> /// Interface to allow host (VS) to inform the OOP service to start incrementally analyzing and /// reporting results back to the host. /// </summary> internal interface IRemoteProjectTelemetryService { internal interface ICallback { ValueTask ReportProjectTelemetryDataAsync(RemoteServiceCallbackId callbackId, ProjectTelemetryData data, CancellationToken cancellationToken); } ValueTask ComputeProjectTelemetryAsync(RemoteServiceCallbackId callbackId, CancellationToken cancellation); } [ExportRemoteServiceCallbackDispatcher(typeof(IRemoteProjectTelemetryService)), Shared] internal sealed class RemoteProjectTelemetryServiceCallbackDispatcher : RemoteServiceCallbackDispatcher, IRemoteProjectTelemetryService.ICallback { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public RemoteProjectTelemetryServiceCallbackDispatcher() { } private IProjectTelemetryListener GetLogService(RemoteServiceCallbackId callbackId) => (IProjectTelemetryListener)GetCallback(callbackId); public ValueTask ReportProjectTelemetryDataAsync(RemoteServiceCallbackId callbackId, ProjectTelemetryData data, CancellationToken cancellationToken) => GetLogService(callbackId).ReportProjectTelemetryDataAsync(data, cancellationToken); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Members.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Metadata; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Symbols; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp { internal partial class SymbolDisplayVisitor { private const string IL_KEYWORD_MODOPT = "modopt"; private const string IL_KEYWORD_MODREQ = "modreq"; private void VisitFieldType(IFieldSymbol symbol) { symbol.Type.Accept(this.NotFirstVisitor); } public override void VisitField(IFieldSymbol symbol) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); AddFieldModifiersIfRequired(symbol); if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType) && this.isFirstSymbolVisited && !IsEnumMember(symbol)) { VisitFieldType(symbol); AddSpace(); AddCustomModifiersIfRequired(symbol.CustomModifiers); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) && IncludeNamedType(symbol.ContainingType)) { symbol.ContainingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } if (symbol.ContainingType.TypeKind == TypeKind.Enum) { builder.Add(CreatePart(SymbolDisplayPartKind.EnumMemberName, symbol, symbol.Name)); } else if (symbol.IsConst) { builder.Add(CreatePart(SymbolDisplayPartKind.ConstantName, symbol, symbol.Name)); } else { builder.Add(CreatePart(SymbolDisplayPartKind.FieldName, symbol, symbol.Name)); } if (this.isFirstSymbolVisited && format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeConstantValue) && symbol.IsConst && symbol.HasConstantValue && CanAddConstant(symbol.Type, symbol.ConstantValue)) { AddSpace(); AddPunctuation(SyntaxKind.EqualsToken); AddSpace(); AddConstantValue(symbol.Type, symbol.ConstantValue, preferNumericValueOrExpandedFlagsForEnum: IsEnumMember(symbol)); } } private static bool ShouldPropertyDisplayReadOnly(IPropertySymbol property) { if (property.ContainingType?.IsReadOnly == true) { return false; } // If at least one accessor is present and all present accessors are readonly, the property should be marked readonly. var getMethod = property.GetMethod; if (getMethod is object && !ShouldMethodDisplayReadOnly(getMethod, property)) { return false; } var setMethod = property.SetMethod; if (setMethod is object && !ShouldMethodDisplayReadOnly(setMethod, property)) { return false; } return getMethod is object || setMethod is object; } private static bool ShouldMethodDisplayReadOnly(IMethodSymbol method, IPropertySymbol propertyOpt = null) { if (method.ContainingType?.IsReadOnly == true) { return false; } if ((method as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol is SourcePropertyAccessorSymbol sourceAccessor && (propertyOpt as Symbols.PublicModel.PropertySymbol)?.UnderlyingSymbol is SourcePropertySymbolBase sourceProperty) { // only display if the accessor is explicitly readonly return sourceAccessor.LocalDeclaredReadOnly || sourceProperty.HasReadOnlyModifier; } else if (method is Symbols.PublicModel.MethodSymbol m) { return m.UnderlyingMethodSymbol.IsDeclaredReadOnly; } return false; } public override void VisitProperty(IPropertySymbol symbol) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); if (ShouldPropertyDisplayReadOnly(symbol)) { AddReadOnlyIfRequired(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType)) { if (symbol.ReturnsByRef) { AddRefIfRequired(); } else if (symbol.ReturnsByRefReadonly) { AddRefReadonlyIfRequired(); } AddCustomModifiersIfRequired(symbol.RefCustomModifiers); symbol.Type.Accept(this.NotFirstVisitor); AddSpace(); AddCustomModifiersIfRequired(symbol.TypeCustomModifiers); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) && IncludeNamedType(symbol.ContainingType)) { symbol.ContainingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } AddPropertyNameAndParameters(symbol); if (format.PropertyStyle == SymbolDisplayPropertyStyle.ShowReadWriteDescriptor) { AddSpace(); AddPunctuation(SyntaxKind.OpenBraceToken); AddAccessor(symbol, symbol.GetMethod, SyntaxKind.GetKeyword); var keywordForSetAccessor = IsInitOnly(symbol.SetMethod) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword; AddAccessor(symbol, symbol.SetMethod, keywordForSetAccessor); AddSpace(); AddPunctuation(SyntaxKind.CloseBraceToken); } } private static bool IsInitOnly(IMethodSymbol symbol) { return symbol?.IsInitOnly == true; } private void AddPropertyNameAndParameters(IPropertySymbol symbol) { bool getMemberNameWithoutInterfaceName = symbol.Name.LastIndexOf('.') > 0; if (getMemberNameWithoutInterfaceName) { AddExplicitInterfaceIfRequired(symbol.ExplicitInterfaceImplementations); } if (symbol.IsIndexer) { AddKeyword(SyntaxKind.ThisKeyword); } else if (getMemberNameWithoutInterfaceName) { this.builder.Add(CreatePart(SymbolDisplayPartKind.PropertyName, symbol, ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(symbol.Name))); } else { this.builder.Add(CreatePart(SymbolDisplayPartKind.PropertyName, symbol, symbol.Name)); } if (this.format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeParameters) && symbol.Parameters.Any()) { AddPunctuation(SyntaxKind.OpenBracketToken); AddParametersIfRequired(hasThisParameter: false, isVarargs: false, parameters: symbol.Parameters); AddPunctuation(SyntaxKind.CloseBracketToken); } } public override void VisitEvent(IEventSymbol symbol) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); var accessor = symbol.AddMethod ?? symbol.RemoveMethod; if (accessor is object && ShouldMethodDisplayReadOnly(accessor)) { AddReadOnlyIfRequired(); } if (format.KindOptions.IncludesOption(SymbolDisplayKindOptions.IncludeMemberKeyword)) { AddKeyword(SyntaxKind.EventKeyword); AddSpace(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType)) { symbol.Type.Accept(this.NotFirstVisitor); AddSpace(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) && IncludeNamedType(symbol.ContainingType)) { symbol.ContainingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } AddEventName(symbol); } private void AddEventName(IEventSymbol symbol) { if (symbol.Name.LastIndexOf('.') > 0) { AddExplicitInterfaceIfRequired(symbol.ExplicitInterfaceImplementations); this.builder.Add(CreatePart(SymbolDisplayPartKind.EventName, symbol, ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(symbol.Name))); } else { this.builder.Add(CreatePart(SymbolDisplayPartKind.EventName, symbol, symbol.Name)); } } public override void VisitMethod(IMethodSymbol symbol) { if (symbol.MethodKind == MethodKind.AnonymousFunction) { // TODO(cyrusn): Why is this a literal? Why don't we give the appropriate signature // of the method as asked? builder.Add(CreatePart(SymbolDisplayPartKind.NumericLiteral, symbol, "lambda expression")); return; } else if ((symbol as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol is SynthesizedGlobalMethodSymbol) // It would be nice to handle VB symbols too, but it's not worth the effort. { // Represents a compiler generated synthesized method symbol with a null containing // type. // TODO(cyrusn); Why is this a literal? builder.Add(CreatePart(SymbolDisplayPartKind.NumericLiteral, symbol, symbol.Name)); return; } else if (symbol.MethodKind == MethodKind.FunctionPointerSignature) { visitFunctionPointerSignature(symbol); return; } if (symbol.IsExtensionMethod && format.ExtensionMethodStyle != SymbolDisplayExtensionMethodStyle.Default) { if (symbol.MethodKind == MethodKind.ReducedExtension && format.ExtensionMethodStyle == SymbolDisplayExtensionMethodStyle.StaticMethod) { symbol = symbol.GetConstructedReducedFrom(); } else if (symbol.MethodKind != MethodKind.ReducedExtension && format.ExtensionMethodStyle == SymbolDisplayExtensionMethodStyle.InstanceMethod) { // If we cannot reduce this to an instance form then display in the static form symbol = symbol.ReduceExtensionMethod(symbol.Parameters.First().Type) ?? symbol; } } // Method members always have a type unless (1) this is a lambda method symbol, which we // have dealt with already, or (2) this is an error method symbol. If we have an error method // symbol then we do not know its accessibility, modifiers, etc, all of which require knowing // the containing type, so we'll skip them. if ((object)symbol.ContainingType != null || (symbol.ContainingSymbol is ITypeSymbol)) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); if (ShouldMethodDisplayReadOnly(symbol)) { AddReadOnlyIfRequired(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType)) { switch (symbol.MethodKind) { case MethodKind.Constructor: case MethodKind.StaticConstructor: break; case MethodKind.Destructor: case MethodKind.Conversion: // If we're using the metadata format, then include the return type. // Otherwise we eschew it since it is redundant in a conversion // signature. if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames)) { goto default; } break; default: // The display code is called by the debugger; if a developer is debugging Roslyn and attempts // to visualize a symbol *during its construction*, the parameters and return type might // still be null. if (symbol.ReturnsByRef) { AddRefIfRequired(); } else if (symbol.ReturnsByRefReadonly) { AddRefReadonlyIfRequired(); } AddCustomModifiersIfRequired(symbol.RefCustomModifiers); if (symbol.ReturnsVoid) { AddKeyword(SyntaxKind.VoidKeyword); } else if (symbol.ReturnType != null) { AddReturnType(symbol); } AddSpace(); AddCustomModifiersIfRequired(symbol.ReturnTypeCustomModifiers); break; } } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType)) { ITypeSymbol containingType; bool includeType; if (symbol.MethodKind == MethodKind.LocalFunction) { includeType = false; containingType = null; } else if (symbol.MethodKind == MethodKind.ReducedExtension) { containingType = symbol.ReceiverType; includeType = true; Debug.Assert(containingType != null); } else { containingType = symbol.ContainingType; if ((object)containingType != null) { includeType = IncludeNamedType(symbol.ContainingType); } else { containingType = (ITypeSymbol)symbol.ContainingSymbol; includeType = true; } } if (includeType) { containingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } } } bool isAccessor = false; switch (symbol.MethodKind) { case MethodKind.Ordinary: case MethodKind.DelegateInvoke: case MethodKind.LocalFunction: { //containing type will be the delegate type, name will be Invoke builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, symbol.Name)); break; } case MethodKind.ReducedExtension: { // Note: Extension methods invoked off of their static class will be tagged as methods. // This behavior matches the semantic classification done in NameSyntaxClassifier. builder.Add(CreatePart(SymbolDisplayPartKind.ExtensionMethodName, symbol, symbol.Name)); break; } case MethodKind.PropertyGet: case MethodKind.PropertySet: { isAccessor = true; var associatedProperty = (IPropertySymbol)symbol.AssociatedSymbol; if (associatedProperty == null) { goto case MethodKind.Ordinary; } AddPropertyNameAndParameters(associatedProperty); AddPunctuation(SyntaxKind.DotToken); AddKeyword(symbol.MethodKind == MethodKind.PropertyGet ? SyntaxKind.GetKeyword : IsInitOnly(symbol) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword); break; } case MethodKind.EventAdd: case MethodKind.EventRemove: { isAccessor = true; var associatedEvent = (IEventSymbol)symbol.AssociatedSymbol; if (associatedEvent == null) { goto case MethodKind.Ordinary; } AddEventName(associatedEvent); AddPunctuation(SyntaxKind.DotToken); AddKeyword(symbol.MethodKind == MethodKind.EventAdd ? SyntaxKind.AddKeyword : SyntaxKind.RemoveKeyword); break; } case MethodKind.Constructor: case MethodKind.StaticConstructor: { // Note: we are using the metadata name also in the case that // symbol.containingType is null (which should never be the case here) or is an // anonymous type (which 'does not have a name'). var name = format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames) || symbol.ContainingType == null || symbol.ContainingType.IsAnonymousType ? symbol.Name : symbol.ContainingType.Name; var partKind = GetPartKindForConstructorOrDestructor(symbol); builder.Add(CreatePart(partKind, symbol, name)); break; } case MethodKind.Destructor: { var partKind = GetPartKindForConstructorOrDestructor(symbol); // Note: we are using the metadata name also in the case that symbol.containingType is null, which should never be the case here. if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames) || symbol.ContainingType == null) { builder.Add(CreatePart(partKind, symbol, symbol.Name)); } else { AddPunctuation(SyntaxKind.TildeToken); builder.Add(CreatePart(partKind, symbol, symbol.ContainingType.Name)); } break; } case MethodKind.ExplicitInterfaceImplementation: { AddExplicitInterfaceIfRequired(symbol.ExplicitInterfaceImplementations); if (!format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames) && symbol.GetSymbol()?.OriginalDefinition is SourceUserDefinedOperatorSymbolBase sourceUserDefinedOperatorSymbolBase) { var operatorName = symbol.MetadataName; var lastDotPosition = operatorName.LastIndexOf('.'); if (lastDotPosition >= 0) { operatorName = operatorName.Substring(lastDotPosition + 1); } if (sourceUserDefinedOperatorSymbolBase is SourceUserDefinedConversionSymbol) { addUserDefinedConversionName(symbol, operatorName); } else { addUserDefinedOperatorName(symbol, operatorName); } break; } builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(symbol.Name))); break; } case MethodKind.UserDefinedOperator: case MethodKind.BuiltinOperator: { if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames)) { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, symbol.MetadataName)); } else { addUserDefinedOperatorName(symbol, symbol.MetadataName); } break; } case MethodKind.Conversion: { if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames)) { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, symbol.MetadataName)); } else { addUserDefinedConversionName(symbol, symbol.MetadataName); } break; } default: throw ExceptionUtilities.UnexpectedValue(symbol.MethodKind); } if (!isAccessor) { AddTypeArguments(symbol, default(ImmutableArray<ImmutableArray<CustomModifier>>)); AddParameters(symbol); AddTypeParameterConstraints(symbol); } void visitFunctionPointerSignature(IMethodSymbol symbol) { AddKeyword(SyntaxKind.DelegateKeyword); AddPunctuation(SyntaxKind.AsteriskToken); if (symbol.CallingConvention != SignatureCallingConvention.Default) { AddSpace(); AddKeyword(SyntaxKind.UnmanagedKeyword); var conventionTypes = symbol.UnmanagedCallingConventionTypes; if (symbol.CallingConvention != SignatureCallingConvention.Unmanaged || !conventionTypes.IsEmpty) { AddPunctuation(SyntaxKind.OpenBracketToken); switch (symbol.CallingConvention) { case SignatureCallingConvention.CDecl: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Cdecl")); break; case SignatureCallingConvention.StdCall: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Stdcall")); break; case SignatureCallingConvention.ThisCall: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Thiscall")); break; case SignatureCallingConvention.FastCall: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Fastcall")); break; case SignatureCallingConvention.Unmanaged: Debug.Assert(!conventionTypes.IsDefaultOrEmpty); bool isFirst = true; foreach (var conventionType in conventionTypes) { if (!isFirst) { AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } isFirst = false; Debug.Assert(conventionType.Name.StartsWith("CallConv")); const int CallConvLength = 8; builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, conventionType, conventionType.Name[CallConvLength..])); } break; } AddPunctuation(SyntaxKind.CloseBracketToken); } } AddPunctuation(SyntaxKind.LessThanToken); foreach (var param in symbol.Parameters) { AddParameterRefKind(param.RefKind); AddCustomModifiersIfRequired(param.RefCustomModifiers); param.Type.Accept(this.NotFirstVisitor); AddCustomModifiersIfRequired(param.CustomModifiers, leadingSpace: true, trailingSpace: false); AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } if (symbol.ReturnsByRef) { AddRef(); } else if (symbol.ReturnsByRefReadonly) { AddRefReadonly(); } AddCustomModifiersIfRequired(symbol.RefCustomModifiers); symbol.ReturnType.Accept(this.NotFirstVisitor); AddCustomModifiersIfRequired(symbol.ReturnTypeCustomModifiers, leadingSpace: true, trailingSpace: false); AddPunctuation(SyntaxKind.GreaterThanToken); } void addUserDefinedOperatorName(IMethodSymbol symbol, string operatorName) { AddKeyword(SyntaxKind.OperatorKeyword); AddSpace(); if (operatorName == WellKnownMemberNames.TrueOperatorName) { AddKeyword(SyntaxKind.TrueKeyword); } else if (operatorName == WellKnownMemberNames.FalseOperatorName) { AddKeyword(SyntaxKind.FalseKeyword); } else { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, SyntaxFacts.GetText(SyntaxFacts.GetOperatorKind(operatorName)))); } } void addUserDefinedConversionName(IMethodSymbol symbol, string operatorName) { // "System.IntPtr.explicit operator System.IntPtr(int)" if (operatorName == WellKnownMemberNames.ExplicitConversionName) { AddKeyword(SyntaxKind.ExplicitKeyword); } else if (operatorName == WellKnownMemberNames.ImplicitConversionName) { AddKeyword(SyntaxKind.ImplicitKeyword); } else { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, SyntaxFacts.GetText(SyntaxFacts.GetOperatorKind(operatorName)))); } AddSpace(); AddKeyword(SyntaxKind.OperatorKeyword); AddSpace(); AddReturnType(symbol); } } private static SymbolDisplayPartKind GetPartKindForConstructorOrDestructor(IMethodSymbol symbol) { // In the case that symbol.containingType is null (which should never be the case here) we will fallback to the MethodName symbol part if (symbol.ContainingType is null) { return SymbolDisplayPartKind.MethodName; } return GetPartKind(symbol.ContainingType); } private void AddReturnType(IMethodSymbol symbol) { symbol.ReturnType.Accept(this.NotFirstVisitor); } private void AddTypeParameterConstraints(IMethodSymbol symbol) { if (format.GenericsOptions.IncludesOption(SymbolDisplayGenericsOptions.IncludeTypeConstraints)) { AddTypeParameterConstraints(symbol.TypeArguments); } } private void AddParameters(IMethodSymbol symbol) { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeParameters)) { AddPunctuation(SyntaxKind.OpenParenToken); AddParametersIfRequired( hasThisParameter: symbol.IsExtensionMethod && symbol.MethodKind != MethodKind.ReducedExtension, isVarargs: symbol.IsVararg, parameters: symbol.Parameters); AddPunctuation(SyntaxKind.CloseParenToken); } } public override void VisitParameter(IParameterSymbol symbol) { // Note the asymmetry between VisitParameter and VisitTypeParameter: VisitParameter // decorates the parameter, whereas VisitTypeParameter leaves that to the corresponding // type or method. This is because type parameters are frequently used in other contexts // (e.g. field types, param types, etc), which just want the name whereas parameters are // used on their own or in the context of methods. var includeType = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeType); var includeName = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeName) && symbol.Name.Length != 0; var includeBrackets = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeOptionalBrackets); var includeDefaultValue = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeDefaultValue) && format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeName) && symbol.HasExplicitDefaultValue && CanAddConstant(symbol.Type, symbol.ExplicitDefaultValue); if (includeBrackets && symbol.IsOptional) { AddPunctuation(SyntaxKind.OpenBracketToken); } if (includeType) { AddParameterRefKindIfRequired(symbol.RefKind); AddCustomModifiersIfRequired(symbol.RefCustomModifiers, leadingSpace: false, trailingSpace: true); if (symbol.IsParams && format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeParamsRefOut)) { AddKeyword(SyntaxKind.ParamsKeyword); AddSpace(); } symbol.Type.Accept(this.NotFirstVisitor); AddCustomModifiersIfRequired(symbol.CustomModifiers, leadingSpace: true, trailingSpace: false); } if (includeName) { if (includeType) { AddSpace(); } var kind = symbol.IsThis ? SymbolDisplayPartKind.Keyword : SymbolDisplayPartKind.ParameterName; builder.Add(CreatePart(kind, symbol, symbol.Name)); } if (includeDefaultValue) { if (includeName || includeType) { AddSpace(); } AddPunctuation(SyntaxKind.EqualsToken); AddSpace(); AddConstantValue(symbol.Type, symbol.ExplicitDefaultValue); } if (includeBrackets && symbol.IsOptional) { AddPunctuation(SyntaxKind.CloseBracketToken); } } private static bool CanAddConstant(ITypeSymbol type, object value) { if (type.TypeKind == TypeKind.Enum) { return true; } if (value == null) { return true; } return value.GetType().GetTypeInfo().IsPrimitive || value is string || value is decimal; } private void AddFieldModifiersIfRequired(IFieldSymbol symbol) { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeModifiers) && !IsEnumMember(symbol)) { if (symbol.IsConst) { AddKeyword(SyntaxKind.ConstKeyword); AddSpace(); } if (symbol.IsReadOnly) { AddKeyword(SyntaxKind.ReadOnlyKeyword); AddSpace(); } if (symbol.IsVolatile) { AddKeyword(SyntaxKind.VolatileKeyword); AddSpace(); } //TODO: event } } private void AddMemberModifiersIfRequired(ISymbol symbol) { INamedTypeSymbol containingType = symbol.ContainingType; // all members (that end up here) must have a containing type or a containing symbol should be a TypeSymbol. Debug.Assert(containingType != null || (symbol.ContainingSymbol is ITypeSymbol)); if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeModifiers) && (containingType == null || (containingType.TypeKind != TypeKind.Interface && !IsEnumMember(symbol) && !IsLocalFunction(symbol)))) { var isConst = symbol is IFieldSymbol && ((IFieldSymbol)symbol).IsConst; if (symbol.IsStatic && !isConst) { AddKeyword(SyntaxKind.StaticKeyword); AddSpace(); } if (symbol.IsOverride) { AddKeyword(SyntaxKind.OverrideKeyword); AddSpace(); } if (symbol.IsAbstract) { AddKeyword(SyntaxKind.AbstractKeyword); AddSpace(); } if (symbol.IsSealed) { AddKeyword(SyntaxKind.SealedKeyword); AddSpace(); } if (symbol.IsExtern) { AddKeyword(SyntaxKind.ExternKeyword); AddSpace(); } if (symbol.IsVirtual) { AddKeyword(SyntaxKind.VirtualKeyword); AddSpace(); } } } private void AddParametersIfRequired(bool hasThisParameter, bool isVarargs, ImmutableArray<IParameterSymbol> parameters) { if (format.ParameterOptions == SymbolDisplayParameterOptions.None) { return; } var first = true; // The display code is called by the debugger; if a developer is debugging Roslyn and attempts // to visualize a symbol *during its construction*, the parameters and return type might // still be null. if (!parameters.IsDefault) { foreach (var param in parameters) { if (!first) { AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } else if (hasThisParameter) { if (format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeExtensionThis)) { AddKeyword(SyntaxKind.ThisKeyword); AddSpace(); } } first = false; param.Accept(this.NotFirstVisitor); } } if (isVarargs) { if (!first) { AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } AddKeyword(SyntaxKind.ArgListKeyword); } } private void AddAccessor(IPropertySymbol property, IMethodSymbol method, SyntaxKind keyword) { if (method != null) { AddSpace(); if (method.DeclaredAccessibility != property.DeclaredAccessibility) { AddAccessibility(method); } if (!ShouldPropertyDisplayReadOnly(property) && ShouldMethodDisplayReadOnly(method, property)) { AddReadOnlyIfRequired(); } AddKeyword(keyword); AddPunctuation(SyntaxKind.SemicolonToken); } } private void AddExplicitInterfaceIfRequired<T>(ImmutableArray<T> implementedMembers) where T : ISymbol { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeExplicitInterface) && !implementedMembers.IsEmpty) { var implementedMember = implementedMembers[0]; Debug.Assert(implementedMember.ContainingType != null); INamedTypeSymbol containingType = implementedMember.ContainingType; if (containingType != null) { containingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } } } private void AddCustomModifiersIfRequired(ImmutableArray<CustomModifier> customModifiers, bool leadingSpace = false, bool trailingSpace = true) { if (this.format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.IncludeCustomModifiers) && !customModifiers.IsEmpty) { bool first = true; foreach (CustomModifier customModifier in customModifiers) { if (!first || leadingSpace) { AddSpace(); } first = false; this.builder.Add(CreatePart(InternalSymbolDisplayPartKind.Other, null, customModifier.IsOptional ? IL_KEYWORD_MODOPT : IL_KEYWORD_MODREQ)); AddPunctuation(SyntaxKind.OpenParenToken); customModifier.Modifier.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.CloseParenToken); } if (trailingSpace) { AddSpace(); } } } private void AddRefIfRequired() { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeRef)) { AddRef(); } } private void AddRef() { AddKeyword(SyntaxKind.RefKeyword); AddSpace(); } private void AddRefReadonlyIfRequired() { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeRef)) { AddRefReadonly(); } } private void AddRefReadonly() { AddKeyword(SyntaxKind.RefKeyword); AddSpace(); AddKeyword(SyntaxKind.ReadOnlyKeyword); AddSpace(); } private void AddReadOnlyIfRequired() { // 'readonly' in this context is effectively a 'ref' modifier // because it affects whether the 'this' parameter is 'ref' or 'in'. if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeRef)) { AddKeyword(SyntaxKind.ReadOnlyKeyword); AddSpace(); } } private void AddParameterRefKindIfRequired(RefKind refKind) { if (format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeParamsRefOut)) { AddParameterRefKind(refKind); } } private void AddParameterRefKind(RefKind refKind) { switch (refKind) { case RefKind.Out: AddKeyword(SyntaxKind.OutKeyword); AddSpace(); break; case RefKind.Ref: AddKeyword(SyntaxKind.RefKeyword); AddSpace(); break; case RefKind.In: AddKeyword(SyntaxKind.InKeyword); AddSpace(); break; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Metadata; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Symbols; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp { internal partial class SymbolDisplayVisitor { private const string IL_KEYWORD_MODOPT = "modopt"; private const string IL_KEYWORD_MODREQ = "modreq"; private void VisitFieldType(IFieldSymbol symbol) { symbol.Type.Accept(this.NotFirstVisitor); } public override void VisitField(IFieldSymbol symbol) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); AddFieldModifiersIfRequired(symbol); if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType) && this.isFirstSymbolVisited && !IsEnumMember(symbol)) { VisitFieldType(symbol); AddSpace(); AddCustomModifiersIfRequired(symbol.CustomModifiers); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) && IncludeNamedType(symbol.ContainingType)) { symbol.ContainingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } if (symbol.ContainingType.TypeKind == TypeKind.Enum) { builder.Add(CreatePart(SymbolDisplayPartKind.EnumMemberName, symbol, symbol.Name)); } else if (symbol.IsConst) { builder.Add(CreatePart(SymbolDisplayPartKind.ConstantName, symbol, symbol.Name)); } else { builder.Add(CreatePart(SymbolDisplayPartKind.FieldName, symbol, symbol.Name)); } if (this.isFirstSymbolVisited && format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeConstantValue) && symbol.IsConst && symbol.HasConstantValue && CanAddConstant(symbol.Type, symbol.ConstantValue)) { AddSpace(); AddPunctuation(SyntaxKind.EqualsToken); AddSpace(); AddConstantValue(symbol.Type, symbol.ConstantValue, preferNumericValueOrExpandedFlagsForEnum: IsEnumMember(symbol)); } } private static bool ShouldPropertyDisplayReadOnly(IPropertySymbol property) { if (property.ContainingType?.IsReadOnly == true) { return false; } // If at least one accessor is present and all present accessors are readonly, the property should be marked readonly. var getMethod = property.GetMethod; if (getMethod is object && !ShouldMethodDisplayReadOnly(getMethod, property)) { return false; } var setMethod = property.SetMethod; if (setMethod is object && !ShouldMethodDisplayReadOnly(setMethod, property)) { return false; } return getMethod is object || setMethod is object; } private static bool ShouldMethodDisplayReadOnly(IMethodSymbol method, IPropertySymbol propertyOpt = null) { if (method.ContainingType?.IsReadOnly == true) { return false; } if ((method as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol is SourcePropertyAccessorSymbol sourceAccessor && (propertyOpt as Symbols.PublicModel.PropertySymbol)?.UnderlyingSymbol is SourcePropertySymbolBase sourceProperty) { // only display if the accessor is explicitly readonly return sourceAccessor.LocalDeclaredReadOnly || sourceProperty.HasReadOnlyModifier; } else if (method is Symbols.PublicModel.MethodSymbol m) { return m.UnderlyingMethodSymbol.IsDeclaredReadOnly; } return false; } public override void VisitProperty(IPropertySymbol symbol) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); if (ShouldPropertyDisplayReadOnly(symbol)) { AddReadOnlyIfRequired(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType)) { if (symbol.ReturnsByRef) { AddRefIfRequired(); } else if (symbol.ReturnsByRefReadonly) { AddRefReadonlyIfRequired(); } AddCustomModifiersIfRequired(symbol.RefCustomModifiers); symbol.Type.Accept(this.NotFirstVisitor); AddSpace(); AddCustomModifiersIfRequired(symbol.TypeCustomModifiers); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) && IncludeNamedType(symbol.ContainingType)) { symbol.ContainingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } AddPropertyNameAndParameters(symbol); if (format.PropertyStyle == SymbolDisplayPropertyStyle.ShowReadWriteDescriptor) { AddSpace(); AddPunctuation(SyntaxKind.OpenBraceToken); AddAccessor(symbol, symbol.GetMethod, SyntaxKind.GetKeyword); var keywordForSetAccessor = IsInitOnly(symbol.SetMethod) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword; AddAccessor(symbol, symbol.SetMethod, keywordForSetAccessor); AddSpace(); AddPunctuation(SyntaxKind.CloseBraceToken); } } private static bool IsInitOnly(IMethodSymbol symbol) { return symbol?.IsInitOnly == true; } private void AddPropertyNameAndParameters(IPropertySymbol symbol) { bool getMemberNameWithoutInterfaceName = symbol.Name.LastIndexOf('.') > 0; if (getMemberNameWithoutInterfaceName) { AddExplicitInterfaceIfRequired(symbol.ExplicitInterfaceImplementations); } if (symbol.IsIndexer) { AddKeyword(SyntaxKind.ThisKeyword); } else if (getMemberNameWithoutInterfaceName) { this.builder.Add(CreatePart(SymbolDisplayPartKind.PropertyName, symbol, ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(symbol.Name))); } else { this.builder.Add(CreatePart(SymbolDisplayPartKind.PropertyName, symbol, symbol.Name)); } if (this.format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeParameters) && symbol.Parameters.Any()) { AddPunctuation(SyntaxKind.OpenBracketToken); AddParametersIfRequired(hasThisParameter: false, isVarargs: false, parameters: symbol.Parameters); AddPunctuation(SyntaxKind.CloseBracketToken); } } public override void VisitEvent(IEventSymbol symbol) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); var accessor = symbol.AddMethod ?? symbol.RemoveMethod; if (accessor is object && ShouldMethodDisplayReadOnly(accessor)) { AddReadOnlyIfRequired(); } if (format.KindOptions.IncludesOption(SymbolDisplayKindOptions.IncludeMemberKeyword)) { AddKeyword(SyntaxKind.EventKeyword); AddSpace(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType)) { symbol.Type.Accept(this.NotFirstVisitor); AddSpace(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) && IncludeNamedType(symbol.ContainingType)) { symbol.ContainingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } AddEventName(symbol); } private void AddEventName(IEventSymbol symbol) { if (symbol.Name.LastIndexOf('.') > 0) { AddExplicitInterfaceIfRequired(symbol.ExplicitInterfaceImplementations); this.builder.Add(CreatePart(SymbolDisplayPartKind.EventName, symbol, ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(symbol.Name))); } else { this.builder.Add(CreatePart(SymbolDisplayPartKind.EventName, symbol, symbol.Name)); } } public override void VisitMethod(IMethodSymbol symbol) { if (symbol.MethodKind == MethodKind.AnonymousFunction) { // TODO(cyrusn): Why is this a literal? Why don't we give the appropriate signature // of the method as asked? builder.Add(CreatePart(SymbolDisplayPartKind.NumericLiteral, symbol, "lambda expression")); return; } else if ((symbol as Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol is SynthesizedGlobalMethodSymbol) // It would be nice to handle VB symbols too, but it's not worth the effort. { // Represents a compiler generated synthesized method symbol with a null containing // type. // TODO(cyrusn); Why is this a literal? builder.Add(CreatePart(SymbolDisplayPartKind.NumericLiteral, symbol, symbol.Name)); return; } else if (symbol.MethodKind == MethodKind.FunctionPointerSignature) { visitFunctionPointerSignature(symbol); return; } if (symbol.IsExtensionMethod && format.ExtensionMethodStyle != SymbolDisplayExtensionMethodStyle.Default) { if (symbol.MethodKind == MethodKind.ReducedExtension && format.ExtensionMethodStyle == SymbolDisplayExtensionMethodStyle.StaticMethod) { symbol = symbol.GetConstructedReducedFrom(); } else if (symbol.MethodKind != MethodKind.ReducedExtension && format.ExtensionMethodStyle == SymbolDisplayExtensionMethodStyle.InstanceMethod) { // If we cannot reduce this to an instance form then display in the static form symbol = symbol.ReduceExtensionMethod(symbol.Parameters.First().Type) ?? symbol; } } // Method members always have a type unless (1) this is a lambda method symbol, which we // have dealt with already, or (2) this is an error method symbol. If we have an error method // symbol then we do not know its accessibility, modifiers, etc, all of which require knowing // the containing type, so we'll skip them. if ((object)symbol.ContainingType != null || (symbol.ContainingSymbol is ITypeSymbol)) { AddAccessibilityIfRequired(symbol); AddMemberModifiersIfRequired(symbol); if (ShouldMethodDisplayReadOnly(symbol)) { AddReadOnlyIfRequired(); } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeType)) { switch (symbol.MethodKind) { case MethodKind.Constructor: case MethodKind.StaticConstructor: break; case MethodKind.Destructor: case MethodKind.Conversion: // If we're using the metadata format, then include the return type. // Otherwise we eschew it since it is redundant in a conversion // signature. if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames)) { goto default; } break; default: // The display code is called by the debugger; if a developer is debugging Roslyn and attempts // to visualize a symbol *during its construction*, the parameters and return type might // still be null. if (symbol.ReturnsByRef) { AddRefIfRequired(); } else if (symbol.ReturnsByRefReadonly) { AddRefReadonlyIfRequired(); } AddCustomModifiersIfRequired(symbol.RefCustomModifiers); if (symbol.ReturnsVoid) { AddKeyword(SyntaxKind.VoidKeyword); } else if (symbol.ReturnType != null) { AddReturnType(symbol); } AddSpace(); AddCustomModifiersIfRequired(symbol.ReturnTypeCustomModifiers); break; } } if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType)) { ITypeSymbol containingType; bool includeType; if (symbol.MethodKind == MethodKind.LocalFunction) { includeType = false; containingType = null; } else if (symbol.MethodKind == MethodKind.ReducedExtension) { containingType = symbol.ReceiverType; includeType = true; Debug.Assert(containingType != null); } else { containingType = symbol.ContainingType; if ((object)containingType != null) { includeType = IncludeNamedType(symbol.ContainingType); } else { containingType = (ITypeSymbol)symbol.ContainingSymbol; includeType = true; } } if (includeType) { containingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } } } bool isAccessor = false; switch (symbol.MethodKind) { case MethodKind.Ordinary: case MethodKind.DelegateInvoke: case MethodKind.LocalFunction: { //containing type will be the delegate type, name will be Invoke builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, symbol.Name)); break; } case MethodKind.ReducedExtension: { // Note: Extension methods invoked off of their static class will be tagged as methods. // This behavior matches the semantic classification done in NameSyntaxClassifier. builder.Add(CreatePart(SymbolDisplayPartKind.ExtensionMethodName, symbol, symbol.Name)); break; } case MethodKind.PropertyGet: case MethodKind.PropertySet: { isAccessor = true; var associatedProperty = (IPropertySymbol)symbol.AssociatedSymbol; if (associatedProperty == null) { goto case MethodKind.Ordinary; } AddPropertyNameAndParameters(associatedProperty); AddPunctuation(SyntaxKind.DotToken); AddKeyword(symbol.MethodKind == MethodKind.PropertyGet ? SyntaxKind.GetKeyword : IsInitOnly(symbol) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword); break; } case MethodKind.EventAdd: case MethodKind.EventRemove: { isAccessor = true; var associatedEvent = (IEventSymbol)symbol.AssociatedSymbol; if (associatedEvent == null) { goto case MethodKind.Ordinary; } AddEventName(associatedEvent); AddPunctuation(SyntaxKind.DotToken); AddKeyword(symbol.MethodKind == MethodKind.EventAdd ? SyntaxKind.AddKeyword : SyntaxKind.RemoveKeyword); break; } case MethodKind.Constructor: case MethodKind.StaticConstructor: { // Note: we are using the metadata name also in the case that // symbol.containingType is null (which should never be the case here) or is an // anonymous type (which 'does not have a name'). var name = format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames) || symbol.ContainingType == null || symbol.ContainingType.IsAnonymousType ? symbol.Name : symbol.ContainingType.Name; var partKind = GetPartKindForConstructorOrDestructor(symbol); builder.Add(CreatePart(partKind, symbol, name)); break; } case MethodKind.Destructor: { var partKind = GetPartKindForConstructorOrDestructor(symbol); // Note: we are using the metadata name also in the case that symbol.containingType is null, which should never be the case here. if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames) || symbol.ContainingType == null) { builder.Add(CreatePart(partKind, symbol, symbol.Name)); } else { AddPunctuation(SyntaxKind.TildeToken); builder.Add(CreatePart(partKind, symbol, symbol.ContainingType.Name)); } break; } case MethodKind.ExplicitInterfaceImplementation: { AddExplicitInterfaceIfRequired(symbol.ExplicitInterfaceImplementations); if (!format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames) && symbol.GetSymbol()?.OriginalDefinition is SourceUserDefinedOperatorSymbolBase sourceUserDefinedOperatorSymbolBase) { var operatorName = symbol.MetadataName; var lastDotPosition = operatorName.LastIndexOf('.'); if (lastDotPosition >= 0) { operatorName = operatorName.Substring(lastDotPosition + 1); } if (sourceUserDefinedOperatorSymbolBase is SourceUserDefinedConversionSymbol) { addUserDefinedConversionName(symbol, operatorName); } else { addUserDefinedOperatorName(symbol, operatorName); } break; } builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(symbol.Name))); break; } case MethodKind.UserDefinedOperator: case MethodKind.BuiltinOperator: { if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames)) { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, symbol.MetadataName)); } else { addUserDefinedOperatorName(symbol, symbol.MetadataName); } break; } case MethodKind.Conversion: { if (format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames)) { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, symbol.MetadataName)); } else { addUserDefinedConversionName(symbol, symbol.MetadataName); } break; } default: throw ExceptionUtilities.UnexpectedValue(symbol.MethodKind); } if (!isAccessor) { AddTypeArguments(symbol, default(ImmutableArray<ImmutableArray<CustomModifier>>)); AddParameters(symbol); AddTypeParameterConstraints(symbol); } void visitFunctionPointerSignature(IMethodSymbol symbol) { AddKeyword(SyntaxKind.DelegateKeyword); AddPunctuation(SyntaxKind.AsteriskToken); if (symbol.CallingConvention != SignatureCallingConvention.Default) { AddSpace(); AddKeyword(SyntaxKind.UnmanagedKeyword); var conventionTypes = symbol.UnmanagedCallingConventionTypes; if (symbol.CallingConvention != SignatureCallingConvention.Unmanaged || !conventionTypes.IsEmpty) { AddPunctuation(SyntaxKind.OpenBracketToken); switch (symbol.CallingConvention) { case SignatureCallingConvention.CDecl: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Cdecl")); break; case SignatureCallingConvention.StdCall: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Stdcall")); break; case SignatureCallingConvention.ThisCall: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Thiscall")); break; case SignatureCallingConvention.FastCall: builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, "Fastcall")); break; case SignatureCallingConvention.Unmanaged: Debug.Assert(!conventionTypes.IsDefaultOrEmpty); bool isFirst = true; foreach (var conventionType in conventionTypes) { if (!isFirst) { AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } isFirst = false; Debug.Assert(conventionType.Name.StartsWith("CallConv")); const int CallConvLength = 8; builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, conventionType, conventionType.Name[CallConvLength..])); } break; } AddPunctuation(SyntaxKind.CloseBracketToken); } } AddPunctuation(SyntaxKind.LessThanToken); foreach (var param in symbol.Parameters) { AddParameterRefKind(param.RefKind); AddCustomModifiersIfRequired(param.RefCustomModifiers); param.Type.Accept(this.NotFirstVisitor); AddCustomModifiersIfRequired(param.CustomModifiers, leadingSpace: true, trailingSpace: false); AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } if (symbol.ReturnsByRef) { AddRef(); } else if (symbol.ReturnsByRefReadonly) { AddRefReadonly(); } AddCustomModifiersIfRequired(symbol.RefCustomModifiers); symbol.ReturnType.Accept(this.NotFirstVisitor); AddCustomModifiersIfRequired(symbol.ReturnTypeCustomModifiers, leadingSpace: true, trailingSpace: false); AddPunctuation(SyntaxKind.GreaterThanToken); } void addUserDefinedOperatorName(IMethodSymbol symbol, string operatorName) { AddKeyword(SyntaxKind.OperatorKeyword); AddSpace(); if (operatorName == WellKnownMemberNames.TrueOperatorName) { AddKeyword(SyntaxKind.TrueKeyword); } else if (operatorName == WellKnownMemberNames.FalseOperatorName) { AddKeyword(SyntaxKind.FalseKeyword); } else { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, SyntaxFacts.GetText(SyntaxFacts.GetOperatorKind(operatorName)))); } } void addUserDefinedConversionName(IMethodSymbol symbol, string operatorName) { // "System.IntPtr.explicit operator System.IntPtr(int)" if (operatorName == WellKnownMemberNames.ExplicitConversionName) { AddKeyword(SyntaxKind.ExplicitKeyword); } else if (operatorName == WellKnownMemberNames.ImplicitConversionName) { AddKeyword(SyntaxKind.ImplicitKeyword); } else { builder.Add(CreatePart(SymbolDisplayPartKind.MethodName, symbol, SyntaxFacts.GetText(SyntaxFacts.GetOperatorKind(operatorName)))); } AddSpace(); AddKeyword(SyntaxKind.OperatorKeyword); AddSpace(); AddReturnType(symbol); } } private static SymbolDisplayPartKind GetPartKindForConstructorOrDestructor(IMethodSymbol symbol) { // In the case that symbol.containingType is null (which should never be the case here) we will fallback to the MethodName symbol part if (symbol.ContainingType is null) { return SymbolDisplayPartKind.MethodName; } return GetPartKind(symbol.ContainingType); } private void AddReturnType(IMethodSymbol symbol) { symbol.ReturnType.Accept(this.NotFirstVisitor); } private void AddTypeParameterConstraints(IMethodSymbol symbol) { if (format.GenericsOptions.IncludesOption(SymbolDisplayGenericsOptions.IncludeTypeConstraints)) { AddTypeParameterConstraints(symbol.TypeArguments); } } private void AddParameters(IMethodSymbol symbol) { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeParameters)) { AddPunctuation(SyntaxKind.OpenParenToken); AddParametersIfRequired( hasThisParameter: symbol.IsExtensionMethod && symbol.MethodKind != MethodKind.ReducedExtension, isVarargs: symbol.IsVararg, parameters: symbol.Parameters); AddPunctuation(SyntaxKind.CloseParenToken); } } public override void VisitParameter(IParameterSymbol symbol) { // Note the asymmetry between VisitParameter and VisitTypeParameter: VisitParameter // decorates the parameter, whereas VisitTypeParameter leaves that to the corresponding // type or method. This is because type parameters are frequently used in other contexts // (e.g. field types, param types, etc), which just want the name whereas parameters are // used on their own or in the context of methods. var includeType = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeType); var includeName = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeName) && symbol.Name.Length != 0; var includeBrackets = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeOptionalBrackets); var includeDefaultValue = format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeDefaultValue) && format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeName) && symbol.HasExplicitDefaultValue && CanAddConstant(symbol.Type, symbol.ExplicitDefaultValue); if (includeBrackets && symbol.IsOptional) { AddPunctuation(SyntaxKind.OpenBracketToken); } if (includeType) { AddParameterRefKindIfRequired(symbol.RefKind); AddCustomModifiersIfRequired(symbol.RefCustomModifiers, leadingSpace: false, trailingSpace: true); if (symbol.IsParams && format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeParamsRefOut)) { AddKeyword(SyntaxKind.ParamsKeyword); AddSpace(); } symbol.Type.Accept(this.NotFirstVisitor); AddCustomModifiersIfRequired(symbol.CustomModifiers, leadingSpace: true, trailingSpace: false); } if (includeName) { if (includeType) { AddSpace(); } var kind = symbol.IsThis ? SymbolDisplayPartKind.Keyword : SymbolDisplayPartKind.ParameterName; builder.Add(CreatePart(kind, symbol, symbol.Name)); } if (includeDefaultValue) { if (includeName || includeType) { AddSpace(); } AddPunctuation(SyntaxKind.EqualsToken); AddSpace(); AddConstantValue(symbol.Type, symbol.ExplicitDefaultValue); } if (includeBrackets && symbol.IsOptional) { AddPunctuation(SyntaxKind.CloseBracketToken); } } private static bool CanAddConstant(ITypeSymbol type, object value) { if (type.TypeKind == TypeKind.Enum) { return true; } if (value == null) { return true; } return value.GetType().GetTypeInfo().IsPrimitive || value is string || value is decimal; } private void AddFieldModifiersIfRequired(IFieldSymbol symbol) { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeModifiers) && !IsEnumMember(symbol)) { if (symbol.IsConst) { AddKeyword(SyntaxKind.ConstKeyword); AddSpace(); } if (symbol.IsReadOnly) { AddKeyword(SyntaxKind.ReadOnlyKeyword); AddSpace(); } if (symbol.IsVolatile) { AddKeyword(SyntaxKind.VolatileKeyword); AddSpace(); } //TODO: event } } private void AddMemberModifiersIfRequired(ISymbol symbol) { INamedTypeSymbol containingType = symbol.ContainingType; // all members (that end up here) must have a containing type or a containing symbol should be a TypeSymbol. Debug.Assert(containingType != null || (symbol.ContainingSymbol is ITypeSymbol)); if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeModifiers) && (containingType == null || (containingType.TypeKind != TypeKind.Interface && !IsEnumMember(symbol) && !IsLocalFunction(symbol)))) { var isConst = symbol is IFieldSymbol && ((IFieldSymbol)symbol).IsConst; if (symbol.IsStatic && !isConst) { AddKeyword(SyntaxKind.StaticKeyword); AddSpace(); } if (symbol.IsOverride) { AddKeyword(SyntaxKind.OverrideKeyword); AddSpace(); } if (symbol.IsAbstract) { AddKeyword(SyntaxKind.AbstractKeyword); AddSpace(); } if (symbol.IsSealed) { AddKeyword(SyntaxKind.SealedKeyword); AddSpace(); } if (symbol.IsExtern) { AddKeyword(SyntaxKind.ExternKeyword); AddSpace(); } if (symbol.IsVirtual) { AddKeyword(SyntaxKind.VirtualKeyword); AddSpace(); } } } private void AddParametersIfRequired(bool hasThisParameter, bool isVarargs, ImmutableArray<IParameterSymbol> parameters) { if (format.ParameterOptions == SymbolDisplayParameterOptions.None) { return; } var first = true; // The display code is called by the debugger; if a developer is debugging Roslyn and attempts // to visualize a symbol *during its construction*, the parameters and return type might // still be null. if (!parameters.IsDefault) { foreach (var param in parameters) { if (!first) { AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } else if (hasThisParameter) { if (format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeExtensionThis)) { AddKeyword(SyntaxKind.ThisKeyword); AddSpace(); } } first = false; param.Accept(this.NotFirstVisitor); } } if (isVarargs) { if (!first) { AddPunctuation(SyntaxKind.CommaToken); AddSpace(); } AddKeyword(SyntaxKind.ArgListKeyword); } } private void AddAccessor(IPropertySymbol property, IMethodSymbol method, SyntaxKind keyword) { if (method != null) { AddSpace(); if (method.DeclaredAccessibility != property.DeclaredAccessibility) { AddAccessibility(method); } if (!ShouldPropertyDisplayReadOnly(property) && ShouldMethodDisplayReadOnly(method, property)) { AddReadOnlyIfRequired(); } AddKeyword(keyword); AddPunctuation(SyntaxKind.SemicolonToken); } } private void AddExplicitInterfaceIfRequired<T>(ImmutableArray<T> implementedMembers) where T : ISymbol { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeExplicitInterface) && !implementedMembers.IsEmpty) { var implementedMember = implementedMembers[0]; Debug.Assert(implementedMember.ContainingType != null); INamedTypeSymbol containingType = implementedMember.ContainingType; if (containingType != null) { containingType.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.DotToken); } } } private void AddCustomModifiersIfRequired(ImmutableArray<CustomModifier> customModifiers, bool leadingSpace = false, bool trailingSpace = true) { if (this.format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.IncludeCustomModifiers) && !customModifiers.IsEmpty) { bool first = true; foreach (CustomModifier customModifier in customModifiers) { if (!first || leadingSpace) { AddSpace(); } first = false; this.builder.Add(CreatePart(InternalSymbolDisplayPartKind.Other, null, customModifier.IsOptional ? IL_KEYWORD_MODOPT : IL_KEYWORD_MODREQ)); AddPunctuation(SyntaxKind.OpenParenToken); customModifier.Modifier.Accept(this.NotFirstVisitor); AddPunctuation(SyntaxKind.CloseParenToken); } if (trailingSpace) { AddSpace(); } } } private void AddRefIfRequired() { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeRef)) { AddRef(); } } private void AddRef() { AddKeyword(SyntaxKind.RefKeyword); AddSpace(); } private void AddRefReadonlyIfRequired() { if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeRef)) { AddRefReadonly(); } } private void AddRefReadonly() { AddKeyword(SyntaxKind.RefKeyword); AddSpace(); AddKeyword(SyntaxKind.ReadOnlyKeyword); AddSpace(); } private void AddReadOnlyIfRequired() { // 'readonly' in this context is effectively a 'ref' modifier // because it affects whether the 'this' parameter is 'ref' or 'in'. if (format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeRef)) { AddKeyword(SyntaxKind.ReadOnlyKeyword); AddSpace(); } } private void AddParameterRefKindIfRequired(RefKind refKind) { if (format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeParamsRefOut)) { AddParameterRefKind(refKind); } } private void AddParameterRefKind(RefKind refKind) { switch (refKind) { case RefKind.Out: AddKeyword(SyntaxKind.OutKeyword); AddSpace(); break; case RefKind.Ref: AddKeyword(SyntaxKind.RefKeyword); AddSpace(); break; case RefKind.In: AddKeyword(SyntaxKind.InKeyword); AddSpace(); break; } } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Scripting/Core/Hosting/CommandLine/ConsoleIO.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Diagnostics; using System.IO; namespace Microsoft.CodeAnalysis.Scripting.Hosting { internal class ConsoleIO { public static readonly ConsoleIO Default = new ConsoleIO(Console.Out, Console.Error, Console.In); public TextWriter Error { get; } public TextWriter Out { get; } public TextReader In { get; } public ConsoleIO(TextWriter output, TextWriter error, TextReader input) { Debug.Assert(output != null); Debug.Assert(input != null); Out = output; Error = error; In = input; } public virtual void SetForegroundColor(ConsoleColor consoleColor) => Console.ForegroundColor = consoleColor; public virtual void ResetColor() => Console.ResetColor(); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Diagnostics; using System.IO; namespace Microsoft.CodeAnalysis.Scripting.Hosting { internal class ConsoleIO { public static readonly ConsoleIO Default = new ConsoleIO(Console.Out, Console.Error, Console.In); public TextWriter Error { get; } public TextWriter Out { get; } public TextReader In { get; } public ConsoleIO(TextWriter output, TextWriter error, TextReader input) { Debug.Assert(output != null); Debug.Assert(input != null); Out = output; Error = error; In = input; } public virtual void SetForegroundColor(ConsoleColor consoleColor) => Console.ForegroundColor = consoleColor; public virtual void ResetColor() => Console.ResetColor(); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Analyzers/Core/CodeFixes/AddAccessibilityModifiers/AddAccessibilityModifiersHelpers.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Threading; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.AddAccessibilityModifiers { internal static class AddAccessibilityModifiersHelpers { public static void UpdateDeclaration( SyntaxEditor editor, ISymbol symbol, SyntaxNode declaration) { Contract.ThrowIfNull(symbol); var preferredAccessibility = GetPreferredAccessibility(symbol); // Check to see if we need to add or remove // If there's a modifier, then we need to remove it, otherwise no modifier, add it. editor.ReplaceNode( declaration, (currentDeclaration, _) => UpdateAccessibility(currentDeclaration, preferredAccessibility)); return; SyntaxNode UpdateAccessibility(SyntaxNode declaration, Accessibility preferredAccessibility) { var generator = editor.Generator; // If there was accessibility on the member, then remove it. If there was no accessibility, then add // the preferred accessibility for this member. return generator.GetAccessibility(declaration) == Accessibility.NotApplicable ? generator.WithAccessibility(declaration, preferredAccessibility) : generator.WithAccessibility(declaration, Accessibility.NotApplicable); } } private static Accessibility GetPreferredAccessibility(ISymbol symbol) { // If we have an overridden member, then if we're adding an accessibility modifier, use the // accessibility of the member we're overriding as both should be consistent here. if (symbol.GetOverriddenMember() is { DeclaredAccessibility: var accessibility }) return accessibility; // Default abstract members to be protected, and virtual members to be public. They can't be private as // that's not legal. And these are reasonable default values for them. if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol) { if (symbol.IsAbstract) return Accessibility.Protected; if (symbol.IsVirtual) return Accessibility.Public; } // Otherwise, default to whatever accessibility no-accessibility means for this member; return symbol.DeclaredAccessibility; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Threading; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.AddAccessibilityModifiers { internal static class AddAccessibilityModifiersHelpers { public static void UpdateDeclaration( SyntaxEditor editor, ISymbol symbol, SyntaxNode declaration) { Contract.ThrowIfNull(symbol); var preferredAccessibility = GetPreferredAccessibility(symbol); // Check to see if we need to add or remove // If there's a modifier, then we need to remove it, otherwise no modifier, add it. editor.ReplaceNode( declaration, (currentDeclaration, _) => UpdateAccessibility(currentDeclaration, preferredAccessibility)); return; SyntaxNode UpdateAccessibility(SyntaxNode declaration, Accessibility preferredAccessibility) { var generator = editor.Generator; // If there was accessibility on the member, then remove it. If there was no accessibility, then add // the preferred accessibility for this member. return generator.GetAccessibility(declaration) == Accessibility.NotApplicable ? generator.WithAccessibility(declaration, preferredAccessibility) : generator.WithAccessibility(declaration, Accessibility.NotApplicable); } } private static Accessibility GetPreferredAccessibility(ISymbol symbol) { // If we have an overridden member, then if we're adding an accessibility modifier, use the // accessibility of the member we're overriding as both should be consistent here. if (symbol.GetOverriddenMember() is { DeclaredAccessibility: var accessibility }) return accessibility; // Default abstract members to be protected, and virtual members to be public. They can't be private as // that's not legal. And these are reasonable default values for them. if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol) { if (symbol.IsAbstract) return Accessibility.Protected; if (symbol.IsVirtual) return Accessibility.Public; } // Otherwise, default to whatever accessibility no-accessibility means for this member; return symbol.DeclaredAccessibility; } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/Core/Portable/Workspace/Host/DocumentService/Extensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics.CodeAnalysis; namespace Microsoft.CodeAnalysis.Host { internal static class Extensions { public static bool CanApplyChange([NotNullWhen(returnValue: true)] this TextDocument? document) => document?.State.CanApplyChange() ?? false; public static bool CanApplyChange([NotNullWhen(returnValue: true)] this TextDocumentState? document) => document?.Services.GetService<IDocumentOperationService>()?.CanApplyChange ?? false; public static bool SupportsDiagnostics([NotNullWhen(returnValue: true)] this TextDocument? document) => document?.State.SupportsDiagnostics() ?? false; public static bool SupportsDiagnostics([NotNullWhen(returnValue: true)] this TextDocumentState? document) => document?.Services.GetService<IDocumentOperationService>()?.SupportDiagnostics ?? false; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics.CodeAnalysis; namespace Microsoft.CodeAnalysis.Host { internal static class Extensions { public static bool CanApplyChange([NotNullWhen(returnValue: true)] this TextDocument? document) => document?.State.CanApplyChange() ?? false; public static bool CanApplyChange([NotNullWhen(returnValue: true)] this TextDocumentState? document) => document?.Services.GetService<IDocumentOperationService>()?.CanApplyChange ?? false; public static bool SupportsDiagnostics([NotNullWhen(returnValue: true)] this TextDocument? document) => document?.State.SupportsDiagnostics() ?? false; public static bool SupportsDiagnostics([NotNullWhen(returnValue: true)] this TextDocumentState? document) => document?.Services.GetService<IDocumentOperationService>()?.SupportDiagnostics ?? false; } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Linq; using System.Security; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.QuickInfo; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using static Microsoft.CodeAnalysis.Editor.UnitTests.Classification.FormattedClassifications; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QuickInfo { public class SemanticQuickInfoSourceTests : AbstractSemanticQuickInfoSourceTests { private static async Task TestWithOptionsAsync(CSharpParseOptions options, string markup, params Action<QuickInfoItem>[] expectedResults) { using var workspace = TestWorkspace.CreateCSharp(markup, options); await TestWithOptionsAsync(workspace, expectedResults); } private static async Task TestWithOptionsAsync(CSharpCompilationOptions options, string markup, params Action<QuickInfoItem>[] expectedResults) { using var workspace = TestWorkspace.CreateCSharp(markup, compilationOptions: options); await TestWithOptionsAsync(workspace, expectedResults); } private static async Task TestWithOptionsAsync(TestWorkspace workspace, params Action<QuickInfoItem>[] expectedResults) { var testDocument = workspace.DocumentWithCursor; var position = testDocument.CursorPosition.GetValueOrDefault(); var documentId = workspace.GetDocumentId(testDocument); var document = workspace.CurrentSolution.GetDocument(documentId); var service = QuickInfoService.GetService(document); await TestWithOptionsAsync(document, service, position, expectedResults); // speculative semantic model if (await CanUseSpeculativeSemanticModelAsync(document, position)) { var buffer = testDocument.GetTextBuffer(); using (var edit = buffer.CreateEdit()) { var currentSnapshot = buffer.CurrentSnapshot; edit.Replace(0, currentSnapshot.Length, currentSnapshot.GetText()); edit.Apply(); } await TestWithOptionsAsync(document, service, position, expectedResults); } } private static async Task TestWithOptionsAsync(Document document, QuickInfoService service, int position, Action<QuickInfoItem>[] expectedResults) { var info = await service.GetQuickInfoAsync(document, position, cancellationToken: CancellationToken.None); if (expectedResults.Length == 0) { Assert.Null(info); } else { Assert.NotNull(info); foreach (var expected in expectedResults) { expected(info); } } } private static async Task VerifyWithMscorlib45Async(string markup, Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""C#"" CommonReferencesNet45=""true""> <Document FilePath=""SourceDocument""> {0} </Document> </Project> </Workspace>", SecurityElement.Escape(markup)); using var workspace = TestWorkspace.Create(xmlString); var position = workspace.Documents.Single(d => d.Name == "SourceDocument").CursorPosition.Value; var documentId = workspace.Documents.Where(d => d.Name == "SourceDocument").Single().Id; var document = workspace.CurrentSolution.GetDocument(documentId); var service = QuickInfoService.GetService(document); var info = await service.GetQuickInfoAsync(document, position, cancellationToken: CancellationToken.None); if (expectedResults.Length == 0) { Assert.Null(info); } else { Assert.NotNull(info); foreach (var expected in expectedResults) { expected(info); } } } protected override async Task TestAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { await TestWithOptionsAsync(Options.Regular, markup, expectedResults); await TestWithOptionsAsync(Options.Script, markup, expectedResults); } private async Task TestWithUsingsAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { var markupWithUsings = @"using System; using System.Collections.Generic; using System.Linq; " + markup; await TestAsync(markupWithUsings, expectedResults); } private Task TestInClassAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { var markupInClass = "class C { " + markup + " }"; return TestWithUsingsAsync(markupInClass, expectedResults); } private Task TestInMethodAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { var markupInMethod = "class C { void M() { " + markup + " } }"; return TestWithUsingsAsync(markupInMethod, expectedResults); } private static async Task TestWithReferenceAsync(string sourceCode, string referencedCode, string sourceLanguage, string referencedLanguage, params Action<QuickInfoItem>[] expectedResults) { await TestWithMetadataReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults); await TestWithProjectReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults); // Multi-language projects are not supported. if (sourceLanguage == referencedLanguage) { await TestInSameProjectHelperAsync(sourceCode, referencedCode, sourceLanguage, expectedResults); } } private static async Task TestWithMetadataReferenceHelperAsync( string sourceCode, string referencedCode, string sourceLanguage, string referencedLanguage, params Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""{0}"" CommonReferences=""true""> <Document FilePath=""SourceDocument""> {1} </Document> <MetadataReferenceFromSource Language=""{2}"" CommonReferences=""true"" IncludeXmlDocComments=""true""> <Document FilePath=""ReferencedDocument""> {3} </Document> </MetadataReferenceFromSource> </Project> </Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), referencedLanguage, SecurityElement.Escape(referencedCode)); await VerifyWithReferenceWorkerAsync(xmlString, expectedResults); } private static async Task TestWithProjectReferenceHelperAsync( string sourceCode, string referencedCode, string sourceLanguage, string referencedLanguage, params Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""{0}"" CommonReferences=""true""> <ProjectReference>ReferencedProject</ProjectReference> <Document FilePath=""SourceDocument""> {1} </Document> </Project> <Project Language=""{2}"" CommonReferences=""true"" AssemblyName=""ReferencedProject""> <Document FilePath=""ReferencedDocument""> {3} </Document> </Project> </Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), referencedLanguage, SecurityElement.Escape(referencedCode)); await VerifyWithReferenceWorkerAsync(xmlString, expectedResults); } private static async Task TestInSameProjectHelperAsync( string sourceCode, string referencedCode, string sourceLanguage, params Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""{0}"" CommonReferences=""true""> <Document FilePath=""SourceDocument""> {1} </Document> <Document FilePath=""ReferencedDocument""> {2} </Document> </Project> </Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), SecurityElement.Escape(referencedCode)); await VerifyWithReferenceWorkerAsync(xmlString, expectedResults); } private static async Task VerifyWithReferenceWorkerAsync(string xmlString, params Action<QuickInfoItem>[] expectedResults) { using var workspace = TestWorkspace.Create(xmlString); var position = workspace.Documents.First(d => d.Name == "SourceDocument").CursorPosition.Value; var documentId = workspace.Documents.First(d => d.Name == "SourceDocument").Id; var document = workspace.CurrentSolution.GetDocument(documentId); var service = QuickInfoService.GetService(document); var info = await service.GetQuickInfoAsync(document, position, cancellationToken: CancellationToken.None); if (expectedResults.Length == 0) { Assert.Null(info); } else { Assert.NotNull(info); foreach (var expected in expectedResults) { expected(info); } } } protected async Task TestInvalidTypeInClassAsync(string code) { var codeInClass = "class C { " + code + " }"; await TestAsync(codeInClass); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirective() { await TestAsync( @"using $$System;", MainDescription("namespace System")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirective2() { await TestAsync( @"using System.Coll$$ections.Generic;", MainDescription("namespace System.Collections")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirective3() { await TestAsync( @"using System.L$$inq;", MainDescription("namespace System.Linq")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirectiveWithAlias() { await TestAsync( @"using Goo = Sys$$tem.Console;", MainDescription("namespace System")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeInUsingDirectiveWithAlias() { await TestAsync( @"using Goo = System.Con$$sole;", MainDescription("class System.Console")); } [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationInUsingDirectiveWithAlias() { var markup = @"using I$$ = IGoo; ///<summary>summary for interface IGoo</summary> interface IGoo { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation("summary for interface IGoo")); } [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationInUsingDirectiveWithAlias2() { var markup = @"using I = IGoo; ///<summary>summary for interface IGoo</summary> interface IGoo { } class C : I$$ { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation("summary for interface IGoo")); } [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationInUsingDirectiveWithAlias3() { var markup = @"using I = IGoo; ///<summary>summary for interface IGoo</summary> interface IGoo { void Goo(); } class C : I$$ { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation("summary for interface IGoo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestThis() { var markup = @" ///<summary>summary for Class C</summary> class C { string M() { return thi$$s.ToString(); } }"; await TestWithUsingsAsync(markup, MainDescription("class C"), Documentation("summary for Class C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestClassWithDocComment() { var markup = @" ///<summary>Hello!</summary> class C { void M() { $$C obj; } }"; await TestAsync(markup, MainDescription("class C"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestSingleLineDocComments() { // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedSingleLineComment // SingleLine doc comment with leading whitespace await TestAsync( @"///<summary>Hello!</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with space before opening tag await TestAsync( @"/// <summary>Hello!</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with space before opening tag and leading whitespace await TestAsync( @"/// <summary>Hello!</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with leading whitespace and blank line await TestAsync( @"///<summary>Hello! ///</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with '\r' line separators await TestAsync("///<summary>Hello!\r///</summary>\rclass C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMultiLineDocComments() { // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedMultiLineComment // Multiline doc comment with leading whitespace await TestAsync( @"/**<summary>Hello!</summary>*/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with space before opening tag await TestAsync( @"/** <summary>Hello!</summary> **/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with space before opening tag and leading whitespace await TestAsync( @"/** ** <summary>Hello!</summary> **/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with no per-line prefix await TestAsync( @"/** <summary> Hello! </summary> */ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with inconsistent per-line prefix await TestAsync( @"/** ** <summary> Hello!</summary> ** **/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with closing comment on final line await TestAsync( @"/** <summary>Hello! </summary>*/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with '\r' line separators await TestAsync("/**\r* <summary>\r* Hello!\r* </summary>\r*/\rclass C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMethodWithDocComment() { var markup = @" ///<summary>Hello!</summary> void M() { M$$() }"; await TestInClassAsync(markup, MainDescription("void C.M()"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInt32() { await TestInClassAsync( @"$$Int32 i;", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInInt() { await TestInClassAsync( @"$$int i;", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestString() { await TestInClassAsync( @"$$String s;", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInString() { await TestInClassAsync( @"$$string s;", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInStringAtEndOfToken() { await TestInClassAsync( @"string$$ s;", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBoolean() { await TestInClassAsync( @"$$Boolean b;", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInBool() { await TestInClassAsync( @"$$bool b;", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestSingle() { await TestInClassAsync( @"$$Single s;", MainDescription("struct System.Single")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInFloat() { await TestInClassAsync( @"$$float f;", MainDescription("struct System.Single")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVoidIsInvalid() { await TestInvalidTypeInClassAsync( @"$$void M() { }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidPointer1_931958() { await TestInvalidTypeInClassAsync( @"$$T* i;"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidPointer2_931958() { await TestInvalidTypeInClassAsync( @"T$$* i;"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidPointer3_931958() { await TestInvalidTypeInClassAsync( @"T*$$ i;"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestListOfString() { await TestInClassAsync( @"$$List<string> l;", MainDescription("class System.Collections.Generic.List<T>"), TypeParameterMap($"\r\nT {FeaturesResources.is_} string")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestListOfSomethingFromSource() { var markup = @" ///<summary>Generic List</summary> public class GenericList<T> { Generic$$List<int> t; }"; await TestAsync(markup, MainDescription("class GenericList<T>"), Documentation("Generic List"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestListOfT() { await TestInMethodAsync( @"class C<T> { $$List<T> l; }", MainDescription("class System.Collections.Generic.List<T>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDictionaryOfIntAndString() { await TestInClassAsync( @"$$Dictionary<int, string> d;", MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"), TypeParameterMap( Lines($"\r\nTKey {FeaturesResources.is_} int", $"TValue {FeaturesResources.is_} string"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDictionaryOfTAndU() { await TestInMethodAsync( @"class C<T, U> { $$Dictionary<T, U> d; }", MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"), TypeParameterMap( Lines($"\r\nTKey {FeaturesResources.is_} T", $"TValue {FeaturesResources.is_} U"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIEnumerableOfInt() { await TestInClassAsync( @"$$IEnumerable<int> M() { yield break; }", MainDescription("interface System.Collections.Generic.IEnumerable<out T>"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventHandler() { await TestInClassAsync( @"event $$EventHandler e;", MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter() { await TestAsync( @"class C<T> { $$T t; }", MainDescription($"T {FeaturesResources.in_} C<T>")); } [WorkItem(538636, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538636")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameterWithDocComment() { var markup = @" ///<summary>Hello!</summary> ///<typeparam name=""T"">T is Type Parameter</typeparam> class C<T> { $$T t; }"; await TestAsync(markup, MainDescription($"T {FeaturesResources.in_} C<T>"), Documentation("T is Type Parameter")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter1_Bug931949() { await TestAsync( @"class T1<T11> { $$T11 t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter2_Bug931949() { await TestAsync( @"class T1<T11> { T$$11 t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter3_Bug931949() { await TestAsync( @"class T1<T11> { T1$$1 t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter4_Bug931949() { await TestAsync( @"class T1<T11> { T11$$ t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullableOfInt() { await TestInClassAsync(@"$$Nullable<int> i; }", MainDescription("struct System.Nullable<T> where T : struct"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeDeclaredOnMethod1_Bug1946() { await TestAsync( @"class C { static void Meth1<T1>($$T1 i) where T1 : struct { T1 i; } }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeDeclaredOnMethod2_Bug1946() { await TestAsync( @"class C { static void Meth1<T1>(T1 i) where $$T1 : struct { T1 i; } }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeDeclaredOnMethod3_Bug1946() { await TestAsync( @"class C { static void Meth1<T1>(T1 i) where T1 : struct { $$T1 i; } }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Class() { await TestAsync( @"class C<T> where $$T : class { }", MainDescription($"T {FeaturesResources.in_} C<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Struct() { await TestAsync( @"struct S<T> where $$T : class { }", MainDescription($"T {FeaturesResources.in_} S<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Interface() { await TestAsync( @"interface I<T> where $$T : class { }", MainDescription($"T {FeaturesResources.in_} I<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Delegate() { await TestAsync( @"delegate void D<T>() where $$T : class;", MainDescription($"T {FeaturesResources.in_} D<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMinimallyQualifiedConstraint() { await TestAsync(@"class C<T> where $$T : IEnumerable<int>", MainDescription($"T {FeaturesResources.in_} C<T> where T : IEnumerable<int>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FullyQualifiedConstraint() { await TestAsync(@"class C<T> where $$T : System.Collections.Generic.IEnumerable<int>", MainDescription($"T {FeaturesResources.in_} C<T> where T : System.Collections.Generic.IEnumerable<int>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMethodReferenceInSameMethod() { await TestAsync( @"class C { void M() { M$$(); } }", MainDescription("void C.M()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMethodReferenceInSameMethodWithDocComment() { var markup = @" ///<summary>Hello World</summary> void M() { M$$(); }"; await TestInClassAsync(markup, MainDescription("void C.M()"), Documentation("Hello World")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodBuiltIn() { var markup = @"int field; void M() { field$$ }"; await TestInClassAsync(markup, MainDescription($"({FeaturesResources.field}) int C.field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodBuiltIn2() { await TestInClassAsync( @"int field; void M() { int f = field$$; }", MainDescription($"({FeaturesResources.field}) int C.field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodBuiltInWithFieldInitializer() { await TestInClassAsync( @"int field = 1; void M() { int f = field $$; }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn() { await TestInMethodAsync( @"int x; x = x$$+1;", MainDescription("int int.operator +(int left, int right)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn1() { await TestInMethodAsync( @"int x; x = x$$ + 1;", MainDescription($"({FeaturesResources.local_variable}) int x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn2() { await TestInMethodAsync( @"int x; x = x+$$x;", MainDescription($"({FeaturesResources.local_variable}) int x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn3() { await TestInMethodAsync( @"int x; x = x +$$ x;", MainDescription("int int.operator +(int left, int right)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn4() { await TestInMethodAsync( @"int x; x = x + $$x;", MainDescription($"({FeaturesResources.local_variable}) int x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorCustomTypeBuiltIn() { var markup = @"class C { static void M() { C c; c = c +$$ c; } }"; await TestAsync(markup); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorCustomTypeOverload() { var markup = @"class C { static void M() { C c; c = c +$$ c; } static C operator+(C a, C b) { return a; } }"; await TestAsync(markup, MainDescription("C C.operator +(C a, C b)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodMinimal() { var markup = @"DateTime field; void M() { field$$ }"; await TestInClassAsync(markup, MainDescription($"({FeaturesResources.field}) DateTime C.field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodQualified() { var markup = @"System.IO.FileInfo file; void M() { file$$ }"; await TestInClassAsync(markup, MainDescription($"({FeaturesResources.field}) System.IO.FileInfo C.file")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructFromSource() { var markup = @"struct MyStruct { public static int SomeField; } static class Test { int a = MyStruct.Some$$Field; }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField")); } [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructFromSourceWithDocComment() { var markup = @"struct MyStruct { ///<summary>My Field</summary> public static int SomeField; } static class Test { int a = MyStruct.Some$$Field; }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField"), Documentation("My Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructInsideMethodFromSource() { var markup = @"struct MyStruct { public static int SomeField; } static class Test { static void Method() { int a = MyStruct.Some$$Field; } }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField")); } [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructInsideMethodFromSourceWithDocComment() { var markup = @"struct MyStruct { ///<summary>My Field</summary> public static int SomeField; } static class Test { static void Method() { int a = MyStruct.Some$$Field; } }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField"), Documentation("My Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldMinimal() { await TestInMethodAsync(@"DateTime dt = DateTime.MaxValue$$", MainDescription($"({FeaturesResources.field}) static readonly DateTime DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldQualified1() { // NOTE: we qualify the field type, but not the type that contains the field in Dev10 var markup = @"class C { void M() { DateTime dt = System.DateTime.MaxValue$$ } }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static readonly System.DateTime System.DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldQualified2() { await TestAsync( @"class C { void M() { DateTime dt = System.DateTime.MaxValue$$ } }", MainDescription($"({FeaturesResources.field}) static readonly System.DateTime System.DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldQualified3() { await TestAsync( @"using System; class C { void M() { DateTime dt = System.DateTime.MaxValue$$ } }", MainDescription($"({FeaturesResources.field}) static readonly DateTime DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ConstructedGenericField() { await TestAsync( @"class C<T> { public T Field; } class D { void M() { new C<int>().Fi$$eld.ToString(); } }", MainDescription($"({FeaturesResources.field}) int C<int>.Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnconstructedGenericField() { await TestAsync( @"class C<T> { public T Field; void M() { Fi$$eld.ToString(); } }", MainDescription($"({FeaturesResources.field}) T C<T>.Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIntegerLiteral() { await TestInMethodAsync(@"int f = 37$$", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTrueKeyword() { await TestInMethodAsync(@"bool f = true$$", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFalseKeyword() { await TestInMethodAsync(@"bool f = false$$", MainDescription("struct System.Boolean")); } [WorkItem(26027, "https://github.com/dotnet/roslyn/issues/26027")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullLiteral() { await TestInMethodAsync(@"string f = null$$", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullLiteralWithVar() => await TestInMethodAsync(@"var f = null$$"); [WorkItem(26027, "https://github.com/dotnet/roslyn/issues/26027")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDefaultLiteral() { await TestInMethodAsync(@"string f = default$$", MainDescription("class System.String")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitKeywordOnGenericTaskReturningAsync() { var markup = @"using System.Threading.Tasks; class C { public async Task<int> Calc() { aw$$ait Calc(); return 5; } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "struct System.Int32"))); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitKeywordInDeclarationStatement() { var markup = @"using System.Threading.Tasks; class C { public async Task<int> Calc() { var x = $$await Calc(); return 5; } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "struct System.Int32"))); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitKeywordOnTaskReturningAsync() { var markup = @"using System.Threading.Tasks; class C { public async void Calc() { aw$$ait Task.Delay(100); } }"; await TestAsync(markup, MainDescription(FeaturesResources.Awaited_task_returns_no_value)); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNestedAwaitKeywords1() { var markup = @"using System; using System.Threading.Tasks; class AsyncExample2 { async Task<Task<int>> AsyncMethod() { return NewMethod(); } private static Task<int> NewMethod() { int hours = 24; return hours; } async Task UseAsync() { Func<Task<int>> lambda = async () => { return await await AsyncMethod(); }; int result = await await AsyncMethod(); Task<Task<int>> resultTask = AsyncMethod(); result = await awa$$it resultTask; result = await lambda(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, $"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task<TResult>")), TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNestedAwaitKeywords2() { var markup = @"using System; using System.Threading.Tasks; class AsyncExample2 { async Task<Task<int>> AsyncMethod() { return NewMethod(); } private static Task<int> NewMethod() { int hours = 24; return hours; } async Task UseAsync() { Func<Task<int>> lambda = async () => { return await await AsyncMethod(); }; int result = await await AsyncMethod(); Task<Task<int>> resultTask = AsyncMethod(); result = awa$$it await resultTask; result = await lambda(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "struct System.Int32"))); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitablePrefixOnCustomAwaiter() { var markup = @"using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Z = $$C; class C { public MyAwaiter GetAwaiter() { throw new NotImplementedException(); } } class MyAwaiter : INotifyCompletion { public void OnCompleted(Action continuation) { throw new NotImplementedException(); } public bool IsCompleted { get { throw new NotImplementedException(); } } public void GetResult() { } }"; await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class C")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTaskType() { var markup = @"using System.Threading.Tasks; class C { public void Calc() { Task$$ v1; } }"; await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTaskOfTType() { var markup = @"using System; using System.Threading.Tasks; class C { public void Calc() { Task$$<int> v1; } }"; await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task<TResult>"), TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int")); } [WorkItem(7100, "https://github.com/dotnet/roslyn/issues/7100")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDynamicIsntAwaitable() { var markup = @" class C { dynamic D() { return null; } void M() { D$$(); } } "; await TestAsync(markup, MainDescription("dynamic C.D()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStringLiteral() { await TestInMethodAsync(@"string f = ""Goo""$$", MainDescription("class System.String")); } [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVerbatimStringLiteral() { await TestInMethodAsync(@"string f = @""cat""$$", MainDescription("class System.String")); } [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInterpolatedStringLiteral() { await TestInMethodAsync(@"string f = $""cat""$$", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $""c$$at""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $""$$cat""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $""cat {1$$ + 2} dog""", MainDescription("struct System.Int32")); } [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVerbatimInterpolatedStringLiteral() { await TestInMethodAsync(@"string f = $@""cat""$$", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $@""c$$at""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $@""$$cat""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $@""cat {1$$ + 2} dog""", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCharLiteral() { await TestInMethodAsync(@"string f = 'x'$$", MainDescription("struct System.Char")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DynamicKeyword() { await TestInMethodAsync( @"dyn$$amic dyn;", MainDescription("dynamic"), Documentation(FeaturesResources.Represents_an_object_whose_operations_will_be_resolved_at_runtime)); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DynamicField() { await TestInClassAsync( @"dynamic dyn; void M() { d$$yn.Goo(); }", MainDescription($"({FeaturesResources.field}) dynamic C.dyn")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Minimal() { await TestInClassAsync( @"DateTime Prop { get; set; } void M() { P$$rop.ToString(); }", MainDescription("DateTime C.Prop { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Minimal_PrivateSet() { await TestInClassAsync( @"public DateTime Prop { get; private set; } void M() { P$$rop.ToString(); }", MainDescription("DateTime C.Prop { get; private set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Minimal_PrivateSet1() { await TestInClassAsync( @"protected internal int Prop { get; private set; } void M() { P$$rop.ToString(); }", MainDescription("int C.Prop { get; private set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Qualified() { await TestInClassAsync( @"System.IO.FileInfo Prop { get; set; } void M() { P$$rop.ToString(); }", MainDescription("System.IO.FileInfo C.Prop { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NonLocalProperty_Minimal() { await TestInMethodAsync(@"DateTime.No$$w.ToString();", MainDescription("DateTime DateTime.Now { get; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NonLocalProperty_Qualified() { await TestInMethodAsync( @"System.IO.FileInfo f; f.Att$$ributes.ToString();", MainDescription("System.IO.FileAttributes System.IO.FileSystemInfo.Attributes { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ConstructedGenericProperty() { await TestAsync( @"class C<T> { public T Property { get; set } } class D { void M() { new C<int>().Pro$$perty.ToString(); } }", MainDescription("int C<int>.Property { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnconstructedGenericProperty() { await TestAsync( @"class C<T> { public T Property { get; set} void M() { Pro$$perty.ToString(); } }", MainDescription("T C<T>.Property { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueInProperty() { await TestInClassAsync( @"public DateTime Property { set { goo = val$$ue; } }", MainDescription($"({FeaturesResources.parameter}) DateTime value")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumTypeName() { await TestInMethodAsync(@"Consol$$eColor c", MainDescription("enum System.ConsoleColor")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_Definition() { await TestInClassAsync(@"enum E$$ : byte { A, B }", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsField() { await TestInClassAsync(@" enum E : byte { A, B } private E$$ _E; ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsProperty() { await TestInClassAsync(@" enum E : byte { A, B } private E$$ E{ get; set; }; ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsParameter() { await TestInClassAsync(@" enum E : byte { A, B } private void M(E$$ e) { } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsReturnType() { await TestInClassAsync(@" enum E : byte { A, B } private E$$ M() { } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsLocal() { await TestInClassAsync(@" enum E : byte { A, B } private void M() { E$$ e = default; } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_OnMemberAccessOnType() { await TestInClassAsync(@" enum E : byte { A, B } private void M() { var ea = E$$.A; } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_NotOnMemberAccessOnMember() { await TestInClassAsync(@" enum E : byte { A, B } private void M() { var ea = E.A$$; } ", MainDescription("E.A = 0")); } [Theory, WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] [InlineData("byte", "byte")] [InlineData("byte", "System.Byte")] [InlineData("sbyte", "sbyte")] [InlineData("sbyte", "System.SByte")] [InlineData("short", "short")] [InlineData("short", "System.Int16")] [InlineData("ushort", "ushort")] [InlineData("ushort", "System.UInt16")] // int is the default type and is not shown [InlineData("uint", "uint")] [InlineData("uint", "System.UInt32")] [InlineData("long", "long")] [InlineData("long", "System.Int64")] [InlineData("ulong", "ulong")] [InlineData("ulong", "System.UInt64")] public async Task EnumNonDefaultUnderlyingType_ShowForNonDefaultTypes(string displayTypeName, string underlyingTypeName) { await TestInClassAsync(@$" enum E$$ : {underlyingTypeName} {{ A, B }}", MainDescription($"enum C.E : {displayTypeName}")); } [Theory, WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] [InlineData("")] [InlineData(": int")] [InlineData(": System.Int32")] public async Task EnumNonDefaultUnderlyingType_DontShowForDefaultType(string defaultType) { await TestInClassAsync(@$" enum E$$ {defaultType} {{ A, B }}", MainDescription("enum C.E")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumMemberNameFromMetadata() { await TestInMethodAsync(@"ConsoleColor c = ConsoleColor.Bla$$ck", MainDescription("ConsoleColor.Black = 0")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FlagsEnumMemberNameFromMetadata1() { await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.Cl$$ass", MainDescription("AttributeTargets.Class = 4")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FlagsEnumMemberNameFromMetadata2() { await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.A$$ll", MainDescription("AttributeTargets.All = AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumMemberNameFromSource1() { await TestAsync( @"enum E { A = 1 << 0, B = 1 << 1, C = 1 << 2 } class C { void M() { var e = E.B$$; } }", MainDescription("E.B = 1 << 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumMemberNameFromSource2() { await TestAsync( @"enum E { A, B, C } class C { void M() { var e = E.B$$; } }", MainDescription("E.B = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_InMethod_Minimal() { await TestInClassAsync( @"void M(DateTime dt) { d$$t.ToString();", MainDescription($"({FeaturesResources.parameter}) DateTime dt")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_InMethod_Qualified() { await TestInClassAsync( @"void M(System.IO.FileInfo fileInfo) { file$$Info.ToString();", MainDescription($"({FeaturesResources.parameter}) System.IO.FileInfo fileInfo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_FromReferenceToNamedParameter() { await TestInMethodAsync(@"Console.WriteLine(va$$lue: ""Hi"");", MainDescription($"({FeaturesResources.parameter}) string value")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_DefaultValue() { // NOTE: Dev10 doesn't show the default value, but it would be nice if we did. // NOTE: The "DefaultValue" property isn't implemented yet. await TestInClassAsync( @"void M(int param = 42) { para$$m.ToString(); }", MainDescription($"({FeaturesResources.parameter}) int param = 42")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_Params() { await TestInClassAsync( @"void M(params DateTime[] arg) { ar$$g.ToString(); }", MainDescription($"({FeaturesResources.parameter}) params DateTime[] arg")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_Ref() { await TestInClassAsync( @"void M(ref DateTime arg) { ar$$g.ToString(); }", MainDescription($"({FeaturesResources.parameter}) ref DateTime arg")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_Out() { await TestInClassAsync( @"void M(out DateTime arg) { ar$$g.ToString(); }", MainDescription($"({FeaturesResources.parameter}) out DateTime arg")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Local_Minimal() { await TestInMethodAsync( @"DateTime dt; d$$t.ToString();", MainDescription($"({FeaturesResources.local_variable}) DateTime dt")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Local_Qualified() { await TestInMethodAsync( @"System.IO.FileInfo fileInfo; file$$Info.ToString();", MainDescription($"({FeaturesResources.local_variable}) System.IO.FileInfo fileInfo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_MetadataOverload() { await TestInMethodAsync("Console.Write$$Line();", MainDescription($"void Console.WriteLine() (+ 18 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_SimpleWithOverload() { await TestInClassAsync( @"void Method() { Met$$hod(); } void Method(int i) { }", MainDescription($"void C.Method() (+ 1 {FeaturesResources.overload})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_MoreOverloads() { await TestInClassAsync( @"void Method() { Met$$hod(null); } void Method(int i) { } void Method(DateTime dt) { } void Method(System.IO.FileInfo fileInfo) { }", MainDescription($"void C.Method(System.IO.FileInfo fileInfo) (+ 3 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_SimpleInSameClass() { await TestInClassAsync( @"DateTime GetDate(System.IO.FileInfo ft) { Get$$Date(null); }", MainDescription("DateTime C.GetDate(System.IO.FileInfo ft)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_OptionalParameter() { await TestInClassAsync( @"void M() { Met$$hod(); } void Method(int i = 0) { }", MainDescription("void C.Method([int i = 0])")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_OptionalDecimalParameter() { await TestInClassAsync( @"void Goo(decimal x$$yz = 10) { }", MainDescription($"({FeaturesResources.parameter}) decimal xyz = 10")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_Generic() { // Generic method don't get the instantiation info yet. NOTE: We don't display // constraint info in Dev10. Should we? await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn> { Go$$o<int, DateTime>(37); }", MainDescription("DateTime C.Goo<int, DateTime>(int arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_UnconstructedGeneric() { await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) { Go$$o<TIn, TOut>(default(TIn); }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_Inferred() { await TestInClassAsync( @"void Goo<TIn>(TIn arg) { Go$$o(42); }", MainDescription("void C.Goo<int>(int arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_MultipleParams() { await TestInClassAsync( @"void Goo(DateTime dt, System.IO.FileInfo fi, int number) { Go$$o(DateTime.Now, null, 32); }", MainDescription("void C.Goo(DateTime dt, System.IO.FileInfo fi, int number)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_OptionalParam() { // NOTE - Default values aren't actually returned by symbols yet. await TestInClassAsync( @"void Goo(int num = 42) { Go$$o(); }", MainDescription("void C.Goo([int num = 42])")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_ParameterModifiers() { // NOTE - Default values aren't actually returned by symbols yet. await TestInClassAsync( @"void Goo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers) { Go$$o(DateTime.Now, null, 32); }", MainDescription("void C.Goo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor() { await TestInClassAsync( @"public C() { } void M() { new C$$().ToString(); }", MainDescription("C.C()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_Overloads() { await TestInClassAsync( @"public C() { } public C(DateTime dt) { } public C(int i) { } void M() { new C$$(DateTime.MaxValue).ToString(); }", MainDescription($"C.C(DateTime dt) (+ 2 {FeaturesResources.overloads_})")); } /// <summary> /// Regression for 3923 /// </summary> [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_OverloadFromStringLiteral() { await TestInMethodAsync( @"new InvalidOperatio$$nException("""");", MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})")); } /// <summary> /// Regression for 3923 /// </summary> [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_UnknownType() { await TestInvalidTypeInClassAsync( @"void M() { new G$$oo(); }"); } /// <summary> /// Regression for 3923 /// </summary> [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_OverloadFromProperty() { await TestInMethodAsync( @"new InvalidOperatio$$nException(this.GetType().Name);", MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_Metadata() { await TestInMethodAsync( @"new Argument$$NullException();", MainDescription($"ArgumentNullException.ArgumentNullException() (+ 3 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_MetadataQualified() { await TestInMethodAsync(@"new System.IO.File$$Info(null);", MainDescription("System.IO.FileInfo.FileInfo(string fileName)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task InterfaceProperty() { await TestInMethodAsync( @"interface I { string Name$$ { get; set; } }", MainDescription("string I.Name { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExplicitInterfacePropertyImplementation() { await TestInMethodAsync( @"interface I { string Name { get; set; } } class C : I { string IEmployee.Name$$ { get { return """"; } set { } } }", MainDescription("string C.Name { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Operator() { await TestInClassAsync( @"public static C operator +(C left, C right) { return null; } void M(C left, C right) { return left +$$ right; }", MainDescription("C C.operator +(C left, C right)")); } #pragma warning disable CA2243 // Attribute string literals should parse correctly [WorkItem(792629, "generic type parameter constraints for methods in quick info")] #pragma warning restore CA2243 // Attribute string literals should parse correctly [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericMethodWithConstraintsAtDeclaration() { await TestInClassAsync( @"TOut G$$oo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn> { }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>")); } #pragma warning disable CA2243 // Attribute string literals should parse correctly [WorkItem(792629, "generic type parameter constraints for methods in quick info")] #pragma warning restore CA2243 // Attribute string literals should parse correctly [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericMethodWithMultipleConstraintsAtDeclaration() { await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) where TIn : Employee, new() { Go$$o<TIn, TOut>(default(TIn); }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : Employee, new()")); } #pragma warning disable CA2243 // Attribute string literals should parse correctly [WorkItem(792629, "generic type parameter constraints for methods in quick info")] #pragma warning restore CA2243 // Attribute string literals should parse correctly [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnConstructedGenericMethodWithConstraintsAtInvocation() { await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) where TIn : Employee { Go$$o<TIn, TOut>(default(TIn); }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : Employee")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericTypeWithConstraintsAtDeclaration() { await TestAsync( @"public class Employee : IComparable<Employee> { public int CompareTo(Employee other) { throw new NotImplementedException(); } } class Emplo$$yeeList<T> : IEnumerable<T> where T : Employee, System.IComparable<T>, new() { }", MainDescription("class EmployeeList<T> where T : Employee, System.IComparable<T>, new()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericType() { await TestAsync( @"class T1<T11> { $$T11 i; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericMethod() { await TestInClassAsync( @"static void Meth1<T1>(T1 i) where T1 : struct { $$T1 i; }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Var() { await TestInMethodAsync( @"var x = new Exception(); var y = $$x;", MainDescription($"({FeaturesResources.local_variable}) Exception x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableReference() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp8), @"class A<T> { } class B { static void M() { A<B?>? x = null!; var y = x; $$y.ToString(); } }", // https://github.com/dotnet/roslyn/issues/26198 public API should show inferred nullability MainDescription($"({FeaturesResources.local_variable}) A<B?> y")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26648, "https://github.com/dotnet/roslyn/issues/26648")] public async Task NullableReference_InMethod() { var code = @" class G { void M() { C c; c.Go$$o(); } } public class C { public string? Goo(IEnumerable<object?> arg) { } }"; await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp8), code, MainDescription("string? C.Goo(IEnumerable<object?> arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NestedInGeneric() { await TestInMethodAsync( @"List<int>.Enu$$merator e;", MainDescription("struct System.Collections.Generic.List<T>.Enumerator"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NestedGenericInGeneric() { await TestAsync( @"class Outer<T> { class Inner<U> { } static void M() { Outer<int>.I$$nner<string> e; } }", MainDescription("class Outer<T>.Inner<U>"), TypeParameterMap( Lines($"\r\nT {FeaturesResources.is_} int", $"U {FeaturesResources.is_} string"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ObjectInitializer1() { await TestInClassAsync( @"void M() { var x = new test() { $$z = 5 }; } class test { public int z; }", MainDescription($"({FeaturesResources.field}) int test.z")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ObjectInitializer2() { await TestInMethodAsync( @"class C { void M() { var x = new test() { z = $$5 }; } class test { public int z; } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(537880, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537880")] public async Task TypeArgument() { await TestAsync( @"class C<T, Y> { void M() { C<int, DateTime> variable; $$variable = new C<int, DateTime>(); } }", MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ForEachLoop_1() { await TestInMethodAsync( @"int bb = 555; bb = bb + 1; foreach (int cc in new int[]{ 1,2,3}){ c$$c = 1; bb = bb + 21; }", MainDescription($"({FeaturesResources.local_variable}) int cc")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_1() { await TestInMethodAsync( @"try { int aa = 555; a$$a = aa + 1; } catch (Exception ex) { } finally { }", MainDescription($"({FeaturesResources.local_variable}) int aa")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_2() { await TestInMethodAsync( @"try { } catch (Exception ex) { var y = e$$x; var z = y; } finally { }", MainDescription($"({FeaturesResources.local_variable}) Exception ex")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_3() { await TestInMethodAsync( @"try { } catch (Exception ex) { var aa = 555; aa = a$$a + 1; } finally { }", MainDescription($"({FeaturesResources.local_variable}) int aa")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_4() { await TestInMethodAsync( @"try { } catch (Exception ex) { } finally { int aa = 555; aa = a$$a + 1; }", MainDescription($"({FeaturesResources.local_variable}) int aa")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericVariable() { await TestAsync( @"class C<T, Y> { void M() { C<int, DateTime> variable; var$$iable = new C<int, DateTime>(); } }", MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInstantiation() { await TestAsync( @"using System.Collections.Generic; class Program<T> { static void Main(string[] args) { var p = new Dictio$$nary<int, string>(); } }", MainDescription($"Dictionary<int, string>.Dictionary() (+ 5 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUsingAlias_Bug4141() { await TestAsync( @"using X = A.C; class A { public class C { } } class D : X$$ { }", MainDescription(@"class A.C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldOnDeclaration() { await TestInClassAsync( @"DateTime fie$$ld;", MainDescription($"({FeaturesResources.field}) DateTime C.field")); } [WorkItem(538767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538767")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericErrorFieldOnDeclaration() { await TestInClassAsync( @"NonExistentType<int> fi$$eld;", MainDescription($"({FeaturesResources.field}) NonExistentType<int> C.field")); } [WorkItem(538822, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538822")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDelegateType() { await TestInClassAsync( @"Fun$$c<int, string> field;", MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"), TypeParameterMap( Lines($"\r\nT {FeaturesResources.is_} int", $"TResult {FeaturesResources.is_} string"))); } [WorkItem(538824, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538824")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOnDelegateInvocation() { await TestAsync( @"class Program { delegate void D1(); static void Main() { D1 d = Main; $$d(); } }", MainDescription($"({FeaturesResources.local_variable}) D1 d")); } [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOnArrayCreation1() { await TestAsync( @"class Program { static void Main() { int[] a = n$$ew int[0]; } }", MainDescription("int[]")); } [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOnArrayCreation2() { await TestAsync( @"class Program { static void Main() { int[] a = new i$$nt[0]; } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_ImplicitObjectCreation() { await TestAsync( @"class C { static void Main() { C c = ne$$w(); } } ", MainDescription("C.C()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_ImplicitObjectCreation_WithParameters() { await TestAsync( @"class C { C(int i) { } C(string s) { } static void Main() { C c = ne$$w(1); } } ", MainDescription($"C.C(int i) (+ 1 {FeaturesResources.overload})")); } [WorkItem(539841, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539841")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIsNamedTypeAccessibleForErrorTypes() { await TestAsync( @"sealed class B<T1, T2> : A<B<T1, T2>> { protected sealed override B<A<T>, A$$<T>> N() { } } internal class A<T> { }", MainDescription("class A<T>")); } [WorkItem(540075, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540075")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType() { await TestAsync( @"using Goo = Goo; class C { void Main() { $$Goo } }", MainDescription("Goo")); } [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestShortDiscardInAssignment() { await TestAsync( @"class C { int M() { $$_ = M(); } }", MainDescription($"({FeaturesResources.discard}) int _")); } [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnderscoreLocalInAssignment() { await TestAsync( @"class C { int M() { var $$_ = M(); } }", MainDescription($"({FeaturesResources.local_variable}) int _")); } [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestShortDiscardInOutVar() { await TestAsync( @"class C { void M(out int i) { M(out $$_); i = 0; } }", MainDescription($"({FeaturesResources.discard}) int _")); } [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDiscardInOutVar() { await TestAsync( @"class C { void M(out int i) { M(out var $$_); i = 0; } }"); // No quick info (see issue #16667) } [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDiscardInIsPattern() { await TestAsync( @"class C { void M() { if (3 is int $$_) { } } }"); // No quick info (see issue #16667) } [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDiscardInSwitchPattern() { await TestAsync( @"class C { void M() { switch (3) { case int $$_: return; } } }"); // No quick info (see issue #16667) } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLambdaDiscardParameter_FirstDiscard() { await TestAsync( @"class C { void M() { System.Func<string, int, int> f = ($$_, _) => 1; } }", MainDescription($"({FeaturesResources.discard}) string _")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLambdaDiscardParameter_SecondDiscard() { await TestAsync( @"class C { void M() { System.Func<string, int, int> f = (_, $$_) => 1; } }", MainDescription($"({FeaturesResources.discard}) int _")); } [WorkItem(540871, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540871")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLiterals() { await TestAsync( @"class MyClass { MyClass() : this($$10) { intI = 2; } public MyClass(int i) { } static int intI = 1; public static int Main() { return 1; } }", MainDescription("struct System.Int32")); } [WorkItem(541444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541444")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorInForeach() { await TestAsync( @"class C { void Main() { foreach (int cc in null) { $$cc = 1; } } }", MainDescription($"({FeaturesResources.local_variable}) int cc")); } [WorkItem(541678, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541678")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnEvent() { await TestAsync( @"using System; public class SampleEventArgs { public SampleEventArgs(string s) { Text = s; } public String Text { get; private set; } } public class Publisher { public delegate void SampleEventHandler(object sender, SampleEventArgs e); public event SampleEventHandler SampleEvent; protected virtual void RaiseSampleEvent() { if (Sam$$pleEvent != null) SampleEvent(this, new SampleEventArgs(""Hello"")); } }", MainDescription("SampleEventHandler Publisher.SampleEvent")); } [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEvent() { await TestInMethodAsync(@"System.Console.CancelKeyPres$$s += null;", MainDescription("ConsoleCancelEventHandler Console.CancelKeyPress")); } [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventPlusEqualsOperator() { await TestInMethodAsync(@"System.Console.CancelKeyPress +$$= null;", MainDescription("void Console.CancelKeyPress.add")); } [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventMinusEqualsOperator() { await TestInMethodAsync(@"System.Console.CancelKeyPress -$$= null;", MainDescription("void Console.CancelKeyPress.remove")); } [WorkItem(541885, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541885")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnExtensionMethod() { await TestWithOptionsAsync(Options.Regular, @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { int[] values = { 1 }; bool isArray = 7.I$$n(values); } } public static class MyExtensions { public static bool In<T>(this T o, IEnumerable<T> items) { return true; } }", MainDescription($"({CSharpFeaturesResources.extension}) bool int.In<int>(IEnumerable<int> items)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnExtensionMethodOverloads() { await TestWithOptionsAsync(Options.Regular, @"using System; using System.Linq; class Program { static void Main(string[] args) { ""1"".Test$$Ext(); } } public static class Ex { public static void TestExt<T>(this T ex) { } public static void TestExt<T>(this T ex, T arg) { } public static void TestExt(this string ex, int arg) { } }", MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 2 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnExtensionMethodOverloads2() { await TestWithOptionsAsync(Options.Regular, @"using System; using System.Linq; class Program { static void Main(string[] args) { ""1"".Test$$Ext(); } } public static class Ex { public static void TestExt<T>(this T ex) { } public static void TestExt<T>(this T ex, T arg) { } public static void TestExt(this int ex, int arg) { } }", MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 1 {FeaturesResources.overload})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query1() { await TestAsync( @"using System.Linq; class C { void M() { var q = from n in new int[] { 1, 2, 3, 4, 5 } select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query2() { await TestAsync( @"using System.Linq; class C { void M() { var q = from n$$ in new int[] { 1, 2, 3, 4, 5 } select n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query3() { await TestAsync( @"class C { void M() { var q = from n in new int[] { 1, 2, 3, 4, 5 } select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) ? n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query4() { await TestAsync( @"class C { void M() { var q = from n$$ in new int[] { 1, 2, 3, 4, 5 } select n; } }", MainDescription($"({FeaturesResources.range_variable}) ? n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query5() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from n in new List<object>() select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) object n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query6() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from n$$ in new List<object>() select n; } }", MainDescription($"({FeaturesResources.range_variable}) object n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query7() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from int n in new List<object>() select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query8() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from int n$$ in new List<object>() select n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query9() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x$$ in new List<List<int>>() from y in x select y; } }", MainDescription($"({FeaturesResources.range_variable}) List<int> x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query10() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x in new List<List<int>>() from y in $$x select y; } }", MainDescription($"({FeaturesResources.range_variable}) List<int> x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query11() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x in new List<List<int>>() from y$$ in x select y; } }", MainDescription($"({FeaturesResources.range_variable}) int y")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query12() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x in new List<List<int>>() from y in x select $$y; } }", MainDescription($"({FeaturesResources.range_variable}) int y")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMappedEnumerable() { await TestInMethodAsync( @" var q = from i in new int[0] $$select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Select<int, int>(Func<int, int> selector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMappedQueryable() { await TestInMethodAsync( @" var q = from i in new int[0].AsQueryable() $$select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IQueryable<int> IQueryable<int>.Select<int, int>(System.Linq.Expressions.Expression<Func<int, int>> selector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMappedCustom() { await TestAsync( @" using System; using System.Linq; namespace N { public static class LazyExt { public static Lazy<U> Select<T, U>(this Lazy<T> source, Func<T, U> selector) => new Lazy<U>(() => selector(source.Value)); } public class C { public void M() { var lazy = new Lazy<object>(); var q = from i in lazy $$select i; } } } ", MainDescription($"({CSharpFeaturesResources.extension}) Lazy<object> Lazy<object>.Select<object, object>(Func<object, object> selector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectNotMapped() { await TestInMethodAsync( @" var q = from i in new int[0] where true $$select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoLet() { await TestInMethodAsync( @" var q = from i in new int[0] $$let j = true select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<'a> IEnumerable<int>.Select<int, 'a>(Func<int, 'a> selector)"), AnonymousTypes($@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ int i, bool j }}")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoWhere() { await TestInMethodAsync( @" var q = from i in new int[0] $$where true select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Where<int>(Func<int, bool> predicate)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByOneProperty() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByOnePropertyWithOrdering1() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i $$ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByOnePropertyWithOrdering2() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithComma1() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i$$, i select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IOrderedEnumerable<int>.ThenBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithComma2() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i, i select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrdering1() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i, i ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrdering2() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i,$$ i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrdering3() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i, i $$ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IOrderedEnumerable<int>.ThenBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach1() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i ascending, i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach2() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i $$ascending, i ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach3() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i ascending ,$$ i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach4() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i ascending, i $$ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IOrderedEnumerable<int>.ThenBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByIncomplete() { await TestInMethodAsync( @" var q = from i in new int[0] where i > 0 orderby$$ ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, ?>(Func<int, ?> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMany1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$from i2 in new int[0] select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.SelectMany<int, int, int>(Func<int, IEnumerable<int>> collectionSelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMany2() { await TestInMethodAsync( @" var q = from i1 in new int[0] from i2 $$in new int[0] select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.SelectMany<int, int, int>(Func<int, IEnumerable<int>> collectionSelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoGroupBy1() { await TestInMethodAsync( @" var q = from i in new int[0] $$group i by i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IGrouping<int, int>> IEnumerable<int>.GroupBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoGroupBy2() { await TestInMethodAsync( @" var q = from i in new int[0] group i $$by i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IGrouping<int, int>> IEnumerable<int>.GroupBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoGroupByInto() { await TestInMethodAsync( @" var q = from i in new int[0] $$group i by i into g select g; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IGrouping<int, int>> IEnumerable<int>.GroupBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$join i2 in new int[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin2() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 $$in new int[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin3() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 in new int[0] $$on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin4() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 in new int[0] on i1 $$equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoinInto1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$join i2 in new int[0] on i1 equals i2 into g select g; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IEnumerable<int>> IEnumerable<int>.GroupJoin<int, int, int, IEnumerable<int>>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, IEnumerable<int>, IEnumerable<int>> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoinInto2() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 in new int[0] on i1 equals i2 $$into g select g; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoFromMissing() { await TestInMethodAsync( @" var q = $$from i in new int[0] select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSimple1() { await TestInMethodAsync( @" var q = $$from double i in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<double> System.Collections.IEnumerable.Cast<double>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSimple2() { await TestInMethodAsync( @" var q = from double i $$in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<double> System.Collections.IEnumerable.Cast<double>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSelectMany1() { await TestInMethodAsync( @" var q = from i in new int[0] $$from double d in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.SelectMany<int, double, int>(Func<int, IEnumerable<double>> collectionSelector, Func<int, double, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSelectMany2() { await TestInMethodAsync( @" var q = from i in new int[0] from double d $$in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<double> System.Collections.IEnumerable.Cast<double>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$join int i2 in new double[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin2() { await TestInMethodAsync( @" var q = from i1 in new int[0] join int i2 $$in new double[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> System.Collections.IEnumerable.Cast<int>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin3() { await TestInMethodAsync( @" var q = from i1 in new int[0] join int i2 in new double[0] $$on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin4() { await TestInMethodAsync( @" var q = from i1 in new int[0] join int i2 in new double[0] on i1 $$equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [WorkItem(543205, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543205")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorGlobal() { await TestAsync( @"extern alias global; class myClass { static int Main() { $$global::otherClass oc = new global::otherClass(); return 0; } }", MainDescription("<global namespace>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DontRemoveAttributeSuffixAndProduceInvalidIdentifier1() { await TestAsync( @"using System; class classAttribute : Attribute { private classAttribute x$$; }", MainDescription($"({FeaturesResources.field}) classAttribute classAttribute.x")); } [WorkItem(544026, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544026")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DontRemoveAttributeSuffix2() { await TestAsync( @"using System; class class1Attribute : Attribute { private class1Attribute x$$; }", MainDescription($"({FeaturesResources.field}) class1Attribute class1Attribute.x")); } [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AttributeQuickInfoBindsToClassTest() { await TestAsync( @"using System; /// <summary> /// class comment /// </summary> [Some$$] class SomeAttribute : Attribute { /// <summary> /// ctor comment /// </summary> public SomeAttribute() { } }", Documentation("class comment")); } [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AttributeConstructorQuickInfo() { await TestAsync( @"using System; /// <summary> /// class comment /// </summary> class SomeAttribute : Attribute { /// <summary> /// ctor comment /// </summary> public SomeAttribute() { var s = new Some$$Attribute(); } }", Documentation("ctor comment")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLabel() { await TestInClassAsync( @"void M() { Goo: int Goo; goto Goo$$; }", MainDescription($"({FeaturesResources.label}) Goo")); } [WorkItem(542613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542613")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnboundGeneric() { await TestAsync( @"using System; using System.Collections.Generic; class C { void M() { Type t = typeof(L$$ist<>); } }", MainDescription("class System.Collections.Generic.List<T>"), NoTypeParameterMap); } [WorkItem(543113, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543113")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAnonymousTypeNew1() { await TestAsync( @"class C { void M() { var v = $$new { }; } }", MainDescription(@"AnonymousType 'a"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ }}")); } [WorkItem(543873, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543873")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNestedAnonymousType() { // verify nested anonymous types are listed in the same order for different properties // verify first property await TestInMethodAsync( @"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } }; x[0].$$Address", MainDescription(@"'b 'a.Address { get; }"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ string Name, 'b Address }} 'b {FeaturesResources.is_} new {{ string Street, string Zip }}")); // verify second property await TestInMethodAsync( @"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } }; x[0].$$Name", MainDescription(@"string 'a.Name { get; }"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ string Name, 'b Address }} 'b {FeaturesResources.is_} new {{ string Street, string Zip }}")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(543183, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543183")] public async Task TestAssignmentOperatorInAnonymousType() { await TestAsync( @"class C { void M() { var a = new { A $$= 0 }; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(10731, "DevDiv_Projects/Roslyn")] public async Task TestErrorAnonymousTypeDoesntShow() { await TestInMethodAsync( @"var a = new { new { N = 0 }.N, new { } }.$$N;", MainDescription(@"int 'a.N { get; }"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ int N }}")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(543553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543553")] public async Task TestArrayAssignedToVar() { await TestAsync( @"class C { static void M(string[] args) { v$$ar a = args; } }", MainDescription("string[]")); } [WorkItem(529139, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529139")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ColorColorRangeVariable() { await TestAsync( @"using System.Collections.Generic; using System.Linq; namespace N1 { class yield { public static IEnumerable<yield> Bar() { foreach (yield yield in from yield in new yield[0] select y$$ield) { yield return yield; } } } }", MainDescription($"({FeaturesResources.range_variable}) N1.yield yield")); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoOnOperator() { await TestAsync( @"using System.Collections.Generic; class Program { static void Main(string[] args) { var v = new Program() $$+ string.Empty; } public static implicit operator Program(string s) { return null; } public static IEnumerable<Program> operator +(Program p1, Program p2) { yield return p1; yield return p2; } }", MainDescription("IEnumerable<Program> Program.operator +(Program p1, Program p2)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantField() { await TestAsync( @"class C { const int $$F = 1;", MainDescription($"({FeaturesResources.constant}) int C.F = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMultipleConstantFields() { await TestAsync( @"class C { public const double X = 1.0, Y = 2.0, $$Z = 3.5;", MainDescription($"({FeaturesResources.constant}) double C.Z = 3.5")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantDependencies() { await TestAsync( @"class A { public const int $$X = B.Z + 1; public const int Y = 10; } class B { public const int Z = A.Y + 1; }", MainDescription($"({FeaturesResources.constant}) int A.X = B.Z + 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantCircularDependencies() { await TestAsync( @"class A { public const int X = B.Z + 1; } class B { public const int Z$$ = A.X + 1; }", MainDescription($"({FeaturesResources.constant}) int B.Z = A.X + 1")); } [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantOverflow() { await TestAsync( @"class B { public const int Z$$ = int.MaxValue + 1; }", MainDescription($"({FeaturesResources.constant}) int B.Z = int.MaxValue + 1")); } [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantOverflowInUncheckedContext() { await TestAsync( @"class B { public const int Z$$ = unchecked(int.MaxValue + 1); }", MainDescription($"({FeaturesResources.constant}) int B.Z = unchecked(int.MaxValue + 1)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEnumInConstantField() { await TestAsync( @"public class EnumTest { enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat }; static void Main() { const int $$x = (int)Days.Sun; } }", MainDescription($"({FeaturesResources.local_constant}) int x = (int)Days.Sun")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantInDefaultExpression() { await TestAsync( @"public class EnumTest { enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat }; static void Main() { const Days $$x = default(Days); } }", MainDescription($"({FeaturesResources.local_constant}) Days x = default(Days)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantParameter() { await TestAsync( @"class C { void Bar(int $$b = 1); }", MainDescription($"({FeaturesResources.parameter}) int b = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantLocal() { await TestAsync( @"class C { void Bar() { const int $$loc = 1; }", MainDescription($"({FeaturesResources.local_constant}) int loc = 1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType1() { await TestInMethodAsync( @"var $$v1 = new Goo();", MainDescription($"({FeaturesResources.local_variable}) Goo v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType2() { await TestInMethodAsync( @"var $$v1 = v1;", MainDescription($"({FeaturesResources.local_variable}) var v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType3() { await TestInMethodAsync( @"var $$v1 = new Goo<Bar>();", MainDescription($"({FeaturesResources.local_variable}) Goo<Bar> v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType4() { await TestInMethodAsync( @"var $$v1 = &(x => x);", MainDescription($"({FeaturesResources.local_variable}) ?* v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType5() { await TestInMethodAsync("var $$v1 = &v1", MainDescription($"({FeaturesResources.local_variable}) var* v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType6() { await TestInMethodAsync("var $$v1 = new Goo[1]", MainDescription($"({FeaturesResources.local_variable}) Goo[] v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType7() { await TestInClassAsync( @"class C { void Method() { } void Goo() { var $$v1 = MethodGroup; } }", MainDescription($"({FeaturesResources.local_variable}) ? v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType8() { await TestInMethodAsync("var $$v1 = Unknown", MainDescription($"({FeaturesResources.local_variable}) ? v1")); } [WorkItem(545072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545072")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDelegateSpecialTypes() { await TestAsync( @"delegate void $$F(int x);", MainDescription("delegate void F(int x)")); } [WorkItem(545108, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545108")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullPointerParameter() { await TestAsync( @"class C { unsafe void $$Goo(int* x = null) { } }", MainDescription("void C.Goo([int* x = null])")); } [WorkItem(545098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545098")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLetIdentifier1() { await TestInMethodAsync("var q = from e in \"\" let $$y = 1 let a = new { y } select a;", MainDescription($"({FeaturesResources.range_variable}) int y")); } [WorkItem(545295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545295")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullableDefaultValue() { await TestAsync( @"class Test { void $$Method(int? t1 = null) { } }", MainDescription("void Test.Method([int? t1 = null])")); } [WorkItem(529586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529586")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidParameterInitializer() { await TestAsync( @"class Program { void M1(float $$j1 = ""Hello"" + ""World"") { } }", MainDescription($@"({FeaturesResources.parameter}) float j1 = ""Hello"" + ""World""")); } [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestComplexConstLocal() { await TestAsync( @"class Program { void Main() { const int MEGABYTE = 1024 * 1024 + true; Blah($$MEGABYTE); } }", MainDescription($@"({FeaturesResources.local_constant}) int MEGABYTE = 1024 * 1024 + true")); } [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestComplexConstField() { await TestAsync( @"class Program { const int a = true - false; void Main() { Goo($$a); } }", MainDescription($"({FeaturesResources.constant}) int Program.a = true - false")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameterCrefDoesNotHaveQuickInfo() { await TestAsync( @"class C<T> { /// <see cref=""C{X$$}""/> static void Main(string[] args) { } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref1() { await TestAsync( @"class Program { /// <see cref=""Mai$$n""/> static void Main(string[] args) { } }", MainDescription(@"void Program.Main(string[] args)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref2() { await TestAsync( @"class Program { /// <see cref=""$$Main""/> static void Main(string[] args) { } }", MainDescription(@"void Program.Main(string[] args)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref3() { await TestAsync( @"class Program { /// <see cref=""Main""$$/> static void Main(string[] args) { } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref4() { await TestAsync( @"class Program { /// <see cref=""Main$$""/> static void Main(string[] args) { } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref5() { await TestAsync( @"class Program { /// <see cref=""Main""$$/> static void Main(string[] args) { } }"); } [WorkItem(546849, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546849")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIndexedProperty() { var markup = @"class Program { void M() { CCC c = new CCC(); c.Index$$Prop[0] = ""s""; } }"; // Note that <COMImport> is required by compiler. Bug 17013 tracks enabling indexed property for non-COM types. var referencedCode = @"Imports System.Runtime.InteropServices <ComImport()> <GuidAttribute(CCC.ClassId)> Public Class CCC #Region ""COM GUIDs"" Public Const ClassId As String = ""9d965fd2-1514-44f6-accd-257ce77c46b0"" Public Const InterfaceId As String = ""a9415060-fdf0-47e3-bc80-9c18f7f39cf6"" Public Const EventsId As String = ""c6a866a5-5f97-4b53-a5df-3739dc8ff1bb"" # End Region ''' <summary> ''' An index property from VB ''' </summary> ''' <param name=""p1"">p1 is an integer index</param> ''' <returns>A string</returns> Public Property IndexProp(ByVal p1 As Integer, Optional ByVal p2 As Integer = 0) As String Get Return Nothing End Get Set(ByVal value As String) End Set End Property End Class"; await TestWithReferenceAsync(sourceCode: markup, referencedCode: referencedCode, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.VisualBasic, expectedResults: MainDescription("string CCC.IndexProp[int p1, [int p2 = 0]] { get; set; }")); } [WorkItem(546918, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546918")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnconstructedGeneric() { await TestAsync( @"class A<T> { enum SortOrder { Ascending, Descending, None } void Goo() { var b = $$SortOrder.Ascending; } }", MainDescription(@"enum A<T>.SortOrder")); } [WorkItem(546970, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546970")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnconstructedGenericInCRef() { await TestAsync( @"/// <see cref=""$$C{T}"" /> class C<T> { }", MainDescription(@"class C<T>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitableMethod() { var markup = @"using System.Threading.Tasks; class C { async Task Goo() { Go$$o(); } }"; var description = $"({CSharpFeaturesResources.awaitable}) Task C.Goo()"; await VerifyWithMscorlib45Async(markup, new[] { MainDescription(description) }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ObsoleteItem() { var markup = @" using System; class Program { [Obsolete] public void goo() { go$$o(); } }"; await TestAsync(markup, MainDescription($"[{CSharpFeaturesResources.deprecated}] void Program.goo()")); } [WorkItem(751070, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751070")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DynamicOperator() { var markup = @" public class Test { public delegate void NoParam(); static int Main() { dynamic x = new object(); if (((System.Func<dynamic>)(() => (x =$$= null)))()) return 0; return 1; } }"; await TestAsync(markup, MainDescription("dynamic dynamic.operator ==(dynamic left, dynamic right)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TextOnlyDocComment() { await TestAsync( @"/// <summary> ///goo /// </summary> class C$$ { }", Documentation("goo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTrimConcatMultiLine() { await TestAsync( @"/// <summary> /// goo /// bar /// </summary> class C$$ { }", Documentation("goo bar")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref() { await TestAsync( @"/// <summary> /// <see cref=""C""/> /// <seealso cref=""C""/> /// </summary> class C$$ { }", Documentation("C C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExcludeTextOutsideSummaryBlock() { await TestAsync( @"/// red /// <summary> /// green /// </summary> /// yellow class C$$ { }", Documentation("green")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NewlineAfterPara() { await TestAsync( @"/// <summary> /// <para>goo</para> /// </summary> class C$$ { }", Documentation("goo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TextOnlyDocComment_Metadata() { var referenced = @" /// <summary> ///goo /// </summary> public class C { }"; var code = @" class G { void goo() { C$$ c; } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("goo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTrimConcatMultiLine_Metadata() { var referenced = @" /// <summary> /// goo /// bar /// </summary> public class C { }"; var code = @" class G { void goo() { C$$ c; } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("goo bar")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref_Metadata() { var code = @" class G { void goo() { C$$ c; } }"; var referenced = @"/// <summary> /// <see cref=""C""/> /// <seealso cref=""C""/> /// </summary> public class C { }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("C C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExcludeTextOutsideSummaryBlock_Metadata() { var code = @" class G { void goo() { C$$ c; } }"; var referenced = @" /// red /// <summary> /// green /// </summary> /// yellow public class C { }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("green")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] arg$$s, T otherParam) { } }", Documentation("First parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param_Metadata() { var code = @" class G { void goo() { C c; c.Goo<int>(arg$$s: new string[] { }, 1); } }"; var referenced = @" /// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] args, T otherParam) { } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("First parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param2() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] args, T oth$$erParam) { } }", Documentation("Another parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param2_Metadata() { var code = @" class G { void goo() { C c; c.Goo<int>(args: new string[] { }, other$$Param: 1); } }"; var referenced = @" /// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] args, T otherParam) { } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("Another parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TypeParam() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""Goo{T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T$$>(string[] args, T otherParam) { } }", Documentation("A type parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnboundCref() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{T}(string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T$$>(string[] args, T otherParam) { } }", Documentation("A type parameter of goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInConstructor() { await TestAsync( @"public class TestClass { /// <summary> /// This sample shows how to specify the <see cref=""TestClass""/> constructor as a cref attribute. /// </summary> public TestClass$$() { } }", Documentation("This sample shows how to specify the TestClass constructor as a cref attribute.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInConstructorOverloaded() { await TestAsync( @"public class TestClass { /// <summary> /// This sample shows how to specify the <see cref=""TestClass""/> constructor as a cref attribute. /// </summary> public TestClass() { } /// <summary> /// This sample shows how to specify the <see cref=""TestClass(int)""/> constructor as a cref attribute. /// </summary> public TestC$$lass(int value) { } }", Documentation("This sample shows how to specify the TestClass(int) constructor as a cref attribute.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInGenericMethod1() { await TestAsync( @"public class TestClass { /// <summary> /// The GetGenericValue method. /// <para>This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute.</para> /// </summary> public static T GetGenericVa$$lue<T>(T para) { return para; } }", Documentation("The GetGenericValue method.\r\n\r\nThis sample shows how to specify the TestClass.GetGenericValue<T>(T) method as a cref attribute.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInGenericMethod2() { await TestAsync( @"public class TestClass { /// <summary> /// The GetGenericValue method. /// <para>This sample shows how to specify the <see cref=""GetGenericValue{T}(T)""/> method as a cref attribute.</para> /// </summary> public static T GetGenericVa$$lue<T>(T para) { return para; } }", Documentation("The GetGenericValue method.\r\n\r\nThis sample shows how to specify the TestClass.GetGenericValue<T>(T) method as a cref attribute.")); } [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInMethodOverloading1() { await TestAsync( @"public class TestClass { public static int GetZero() { GetGenericValu$$e(); GetGenericValue(5); } /// <summary> /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method /// </summary> public static T GetGenericValue<T>(T para) { return para; } /// <summary> /// This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute. /// </summary> public static void GetGenericValue() { } }", Documentation("This sample shows how to specify the TestClass.GetGenericValue() method as a cref attribute.")); } [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInMethodOverloading2() { await TestAsync( @"public class TestClass { public static int GetZero() { GetGenericValue(); GetGenericVal$$ue(5); } /// <summary> /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method /// </summary> public static T GetGenericValue<T>(T para) { return para; } /// <summary> /// This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute. /// </summary> public static void GetGenericValue() { } }", Documentation("This sample shows how to call the TestClass.GetGenericValue<T>(T) method")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInGenericType() { await TestAsync( @"/// <summary> /// <remarks>This example shows how to specify the <see cref=""GenericClass{T}""/> cref.</remarks> /// </summary> class Generic$$Class<T> { }", Documentation("This example shows how to specify the GenericClass<T> cref.", ExpectedClassifications( Text("This example shows how to specify the"), WhiteSpace(" "), Class("GenericClass"), Punctuation.OpenAngle, TypeParameter("T"), Punctuation.CloseAngle, WhiteSpace(" "), Text("cref.")))); } [WorkItem(812720, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/812720")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ClassificationOfCrefsFromMetadata() { var code = @" class G { void goo() { C c; c.Go$$o(); } }"; var referenced = @" /// <summary></summary> public class C { /// <summary> /// See <see cref=""Goo""/> method /// </summary> public void Goo() { } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("See C.Goo() method", ExpectedClassifications( Text("See"), WhiteSpace(" "), Class("C"), Punctuation.Text("."), Identifier("Goo"), Punctuation.OpenParen, Punctuation.CloseParen, WhiteSpace(" "), Text("method")))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FieldAvailableInBothLinkedFiles() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { int x; void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.field}) int C.x"), Usage("") }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FieldUnavailableInOneLinkedFile() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(37097, "https://github.com/dotnet/roslyn/issues/37097")] public async Task BindSymbolInOtherFile() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""GOO""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Not_Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FieldUnavailableInTwoLinkedFiles() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage( $"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj3", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExcludeFilesWithInactiveRegions() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO,BAR""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif #if BAR void goo() { x$$ } #endif } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument"" /> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3"" PreprocessorSymbols=""BAR""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj3", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [WorkItem(962353, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/962353")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NoValidSymbolsInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void goo() { B$$ar(); } #if B void Bar() { } #endif } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalsValidInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void M() { int x$$; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage("") }); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalWarningInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""PROJ1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void M() { #if PROJ1 int x; #endif int y = x$$; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true) }); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LabelsValidInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void M() { $$LABEL: goto LABEL; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.label}) LABEL"), Usage("") }); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task RangeVariablesValidInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ using System.Linq; class C { void M() { var x = from y in new[] {1, 2, 3} select $$y; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.range_variable}) int y"), Usage("") }); } [WorkItem(1019766, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1019766")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task PointerAccessibility() { var markup = @"class C { unsafe static void Main() { void* p = null; void* q = null; dynamic d = true; var x = p =$$= q == d; } }"; await TestAsync(markup, MainDescription("bool void*.operator ==(void* left, void* right)")); } [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AwaitingTaskOfArrayType() { var markup = @" using System.Threading.Tasks; class Program { async Task<int[]> M() { awa$$it M(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "int[]"))); } [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AwaitingTaskOfDynamic() { var markup = @" using System.Threading.Tasks; class Program { async Task<dynamic> M() { awa$$it M(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "dynamic"))); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task MethodOverloadDifferencesIgnored() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if ONE void Do(int x){} #endif #if TWO void Do(string x){} #endif void Shared() { this.Do$$ } }]]></Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = $"void C.Do(int x)"; await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription)); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task MethodOverloadDifferencesIgnored_ContainingType() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void Shared() { var x = GetThing().Do$$(); } #if ONE private Methods1 GetThing() { return new Methods1(); } #endif #if TWO private Methods2 GetThing() { return new Methods2(); } #endif } #if ONE public class Methods1 { public void Do(string x) { } } #endif #if TWO public class Methods2 { public void Do(string x) { } } #endif ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = $"void Methods1.Do(string x)"; await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription)); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(4868, "https://github.com/dotnet/roslyn/issues/4868")] public async Task QuickInfoExceptions() { await TestAsync( @"using System; namespace MyNs { class MyException1 : Exception { } class MyException2 : Exception { } class TestClass { /// <exception cref=""MyException1""></exception> /// <exception cref=""T:MyNs.MyException2""></exception> /// <exception cref=""System.Int32""></exception> /// <exception cref=""double""></exception> /// <exception cref=""Not_A_Class_But_Still_Displayed""></exception> void M() { M$$(); } } }", Exceptions($"\r\n{WorkspacesResources.Exceptions_colon}\r\n MyException1\r\n MyException2\r\n int\r\n double\r\n Not_A_Class_But_Still_Displayed")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLocalFunction() { await TestAsync(@" class C { void M() { int i; local$$(); void local() { i++; this.M(); } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLocalFunction2() { await TestAsync(@" class C { void M() { int i; local$$(i); void local(int j) { j++; M(); } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLocalFunction3() { await TestAsync(@" class C { public void M(int @this) { int i = 0; local$$(); void local() { M(1); i++; @this++; } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, @this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction4() { await TestAsync(@" class C { int field; void M() { void OuterLocalFunction$$() { int local = 0; int InnerLocalFunction() { field++; return local; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction5() { await TestAsync(@" class C { int field; void M() { void OuterLocalFunction() { int local = 0; int InnerLocalFunction$$() { field++; return local; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, local")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction6() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; void OuterLocalFunction$$() { _ = local1; void InnerLocalFunction() { _ = local2; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local1, local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction7() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; void OuterLocalFunction() { _ = local1; void InnerLocalFunction$$() { _ = local2; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda() { await TestAsync(@" class C { void M() { int i; System.Action a = () =$$> { i++; M(); }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda2() { await TestAsync(@" class C { void M() { int i; System.Action<int> a = j =$$> { i++; j++; M(); }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda2_DifferentOrder() { await TestAsync(@" class C { void M(int j) { int i; System.Action a = () =$$> { M(); i++; j++; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, j, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda3() { await TestAsync(@" class C { void M() { int i; int @this; N(() =$$> { M(); @this++; }, () => { i++; }); } void N(System.Action x, System.Action y) { } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, @this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda4() { await TestAsync(@" class C { void M() { int i; N(() => { M(); }, () =$$> { i++; }); } void N(System.Action x, System.Action y) { } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda5() { await TestAsync(@" class C { int field; void M() { System.Action a = () =$$> { int local = 0; System.Func<int> b = () => { field++; return local; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda6() { await TestAsync(@" class C { int field; void M() { System.Action a = () => { int local = 0; System.Func<int> b = () =$$> { field++; return local; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, local")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda7() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; System.Action a = () =$$> { _ = local1; System.Action b = () => { _ = local2; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local1, local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda8() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; System.Action a = () => { _ = local1; System.Action b = () =$$> { _ = local2; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnDelegate() { await TestAsync(@" class C { void M() { int i; System.Func<bool, int> f = dele$$gate(bool b) { i++; return 1; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(1516, "https://github.com/dotnet/roslyn/issues/1516")] public async Task QuickInfoWithNonStandardSeeAttributesAppear() { await TestAsync( @"class C { /// <summary> /// <see cref=""System.String"" /> /// <see href=""http://microsoft.com"" /> /// <see langword=""null"" /> /// <see unsupported-attribute=""cat"" /> /// </summary> void M() { M$$(); } }", Documentation(@"string http://microsoft.com null cat")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(6657, "https://github.com/dotnet/roslyn/issues/6657")] public async Task OptionalParameterFromPreviousSubmission() { const string workspaceDefinition = @" <Workspace> <Submission Language=""C#"" CommonReferences=""true""> void M(int x = 1) { } </Submission> <Submission Language=""C#"" CommonReferences=""true""> M(x$$: 2) </Submission> </Workspace> "; using var workspace = TestWorkspace.Create(XElement.Parse(workspaceDefinition), workspaceKind: WorkspaceKind.Interactive); await TestWithOptionsAsync(workspace, MainDescription($"({ FeaturesResources.parameter }) int x = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TupleProperty() { await TestInMethodAsync( @"interface I { (int, int) Name { get; set; } } class C : I { (int, int) I.Name$$ { get { throw new System.Exception(); } set { } } }", MainDescription("(int, int) C.Name { get; set; }")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity0VariableName() { await TestAsync( @" using System; public class C { void M() { var y$$ = ValueTuple.Create(); } } ", MainDescription($"({ FeaturesResources.local_variable }) ValueTuple y")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity0ImplicitVar() { await TestAsync( @" using System; public class C { void M() { var$$ y = ValueTuple.Create(); } } ", MainDescription("struct System.ValueTuple")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity1VariableName() { await TestAsync( @" using System; public class C { void M() { var y$$ = ValueTuple.Create(1); } } ", MainDescription($"({ FeaturesResources.local_variable }) ValueTuple<int> y")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity1ImplicitVar() { await TestAsync( @" using System; public class C { void M() { var$$ y = ValueTuple.Create(1); } } ", MainDescription("struct System.ValueTuple<System.Int32>")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity2VariableName() { await TestAsync( @" using System; public class C { void M() { var y$$ = ValueTuple.Create(1, 1); } } ", MainDescription($"({ FeaturesResources.local_variable }) (int, int) y")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity2ImplicitVar() { await TestAsync( @" using System; public class C { void M() { var$$ y = ValueTuple.Create(1, 1); } } ", MainDescription("(System.Int32, System.Int32)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefMethod() { await TestInMethodAsync( @"using System; class Program { static void Main(string[] args) { ref int i = ref $$goo(); } private static ref int goo() { throw new NotImplementedException(); } }", MainDescription("ref int Program.goo()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefLocal() { await TestInMethodAsync( @"using System; class Program { static void Main(string[] args) { ref int $$i = ref goo(); } private static ref int goo() { throw new NotImplementedException(); } }", MainDescription($"({FeaturesResources.local_variable}) ref int i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(410932, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=410932")] public async Task TestGenericMethodInDocComment() { await TestAsync( @" class Test { T F<T>() { F<T>(); } /// <summary> /// <see cref=""F$${T}()""/> /// </summary> void S() { } } ", MainDescription("T Test.F<T>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(403665, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=403665&_a=edit")] public async Task TestExceptionWithCrefToConstructorDoesNotCrash() { await TestAsync( @" class Test { /// <summary> /// </summary> /// <exception cref=""Test.Test""/> public Test$$() {} } ", MainDescription("Test.Test()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefStruct() { var markup = "ref struct X$$ {}"; await TestAsync(markup, MainDescription("ref struct X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefStruct_Nested() { var markup = @" namespace Nested { ref struct X$$ {} }"; await TestAsync(markup, MainDescription("ref struct Nested.X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyStruct() { var markup = "readonly struct X$$ {}"; await TestAsync(markup, MainDescription("readonly struct X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyStruct_Nested() { var markup = @" namespace Nested { readonly struct X$$ {} }"; await TestAsync(markup, MainDescription("readonly struct Nested.X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyRefStruct() { var markup = "readonly ref struct X$$ {}"; await TestAsync(markup, MainDescription("readonly ref struct X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyRefStruct_Nested() { var markup = @" namespace Nested { readonly ref struct X$$ {} }"; await TestAsync(markup, MainDescription("readonly ref struct Nested.X")); } [WorkItem(22450, "https://github.com/dotnet/roslyn/issues/22450")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefLikeTypesNoDeprecated() { var xmlString = @" <Workspace> <Project Language=""C#"" LanguageVersion=""7.2"" CommonReferences=""true""> <MetadataReferenceFromSource Language=""C#"" LanguageVersion=""7.2"" CommonReferences=""true""> <Document FilePath=""ReferencedDocument""> public ref struct TestRef { } </Document> </MetadataReferenceFromSource> <Document FilePath=""SourceDocument""> ref struct Test { private $$TestRef _field; } </Document> </Project> </Workspace>"; // There should be no [deprecated] attribute displayed. await VerifyWithReferenceWorkerAsync(xmlString, MainDescription($"ref struct TestRef")); } [WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task PropertyWithSameNameAsOtherType() { await TestAsync( @"namespace ConsoleApplication1 { class Program { static A B { get; set; } static B A { get; set; } static void Main(string[] args) { B = ConsoleApplication1.B$$.F(); } } class A { } class B { public static A F() => null; } }", MainDescription($"ConsoleApplication1.A ConsoleApplication1.B.F()")); } [WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task PropertyWithSameNameAsOtherType2() { await TestAsync( @"using System.Collections.Generic; namespace ConsoleApplication1 { class Program { public static List<Bar> Bar { get; set; } static void Main(string[] args) { Tes$$t<Bar>(); } static void Test<T>() { } } class Bar { } }", MainDescription($"void Program.Test<Bar>()")); } [WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task InMalformedEmbeddedStatement_01() { await TestAsync( @" class Program { void method1() { if (method2()) .Any(b => b.Content$$Type, out var chars) { } } } "); } [WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task InMalformedEmbeddedStatement_02() { await TestAsync( @" class Program { void method1() { if (method2()) .Any(b => b$$.ContentType, out var chars) { } } } ", MainDescription($"({ FeaturesResources.parameter }) ? b")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumConstraint() { await TestInMethodAsync( @" class X<T> where T : System.Enum { private $$T x; }", MainDescription($"T {FeaturesResources.in_} X<T> where T : Enum")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DelegateConstraint() { await TestInMethodAsync( @" class X<T> where T : System.Delegate { private $$T x; }", MainDescription($"T {FeaturesResources.in_} X<T> where T : Delegate")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task MulticastDelegateConstraint() { await TestInMethodAsync( @" class X<T> where T : System.MulticastDelegate { private $$T x; }", MainDescription($"T {FeaturesResources.in_} X<T> where T : MulticastDelegate")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_Type() { await TestAsync( @" class $$X<T> where T : unmanaged { }", MainDescription("class X<T> where T : unmanaged")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_Method() { await TestAsync( @" class X { void $$M<T>() where T : unmanaged { } }", MainDescription("void X.M<T>() where T : unmanaged")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_Delegate() { await TestAsync( "delegate void $$D<T>() where T : unmanaged;", MainDescription("delegate void D<T>() where T : unmanaged")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_LocalFunction() { await TestAsync( @" class X { void N() { void $$M<T>() where T : unmanaged { } } }", MainDescription("void M<T>() where T : unmanaged")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGetAccessorDocumentation() { await TestAsync( @" class X { /// <summary>Summary for property Goo</summary> int Goo { g$$et; set; } }", Documentation("Summary for property Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestSetAccessorDocumentation() { await TestAsync( @" class X { /// <summary>Summary for property Goo</summary> int Goo { get; s$$et; } }", Documentation("Summary for property Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventAddDocumentation1() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo { a$$dd => throw null; remove => throw null; } }", Documentation("Summary for event Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventAddDocumentation2() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo; void M() => Goo +$$= null; }", Documentation("Summary for event Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventRemoveDocumentation1() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo { add => throw null; r$$emove => throw null; } }", Documentation("Summary for event Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventRemoveDocumentation2() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo; void M() => Goo -$$= null; }", Documentation("Summary for event Goo")); } [WorkItem(30642, "https://github.com/dotnet/roslyn/issues/30642")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task BuiltInOperatorWithUserDefinedEquivalent() { await TestAsync( @" class X { void N(string a, string b) { var v = a $$== b; } }", MainDescription("bool string.operator ==(string a, string b)"), SymbolGlyph(Glyph.Operator)); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_Type() { await TestAsync( @" class $$X<T> where T : notnull { }", MainDescription("class X<T> where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_Method() { await TestAsync( @" class X { void $$M<T>() where T : notnull { } }", MainDescription("void X.M<T>() where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_Delegate() { await TestAsync( "delegate void $$D<T>() where T : notnull;", MainDescription("delegate void D<T>() where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_LocalFunction() { await TestAsync( @" class X { void N() { void $$M<T>() where T : notnull { } } }", MainDescription("void M<T>() where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableParameterThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { void N(string? s) { string s2 = $$s; } }", MainDescription($"({FeaturesResources.parameter}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableParameterThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { void N(string? s) { s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.parameter}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableFieldThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? s = null; void N() { string s2 = $$s; } }", MainDescription($"({FeaturesResources.field}) string? X.s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableFieldThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? s = null; void N() { s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.field}) string? X.s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullablePropertyThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? S { get; set; } void N() { string s2 = $$S; } }", MainDescription("string? X.S { get; set; }"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "S"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullablePropertyThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? S { get; set; } void N() { S = """"; string s2 = $$S; } }", MainDescription("string? X.S { get; set; }"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "S"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableRangeVariableThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { IEnumerable<string?> enumerable; foreach (var s in enumerable) { string s2 = $$s; } } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableRangeVariableThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { IEnumerable<string> enumerable; foreach (var s in enumerable) { string s2 = $$s; } } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableLocalThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { string? s = null; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableLocalThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { string? s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownPriorToLanguageVersion8() { await TestWithOptionsAsync(TestOptions.Regular7_3, @"#nullable enable using System.Collections.Generic; class X { void N() { string s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string s"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownInNullableDisable() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable disable using System.Collections.Generic; class X { void N() { string s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string s"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableShownWhenEnabledGlobally() { await TestWithOptionsAsync(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, nullableContextOptions: NullableContextOptions.Enable), @"using System.Collections.Generic; class X { void N() { string s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownForValueType() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { int a = 0; int b = $$a; } }", MainDescription($"({FeaturesResources.local_variable}) int a"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownForConst() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { const string? s = null; string? s2 = $$s; } }", MainDescription($"({FeaturesResources.local_constant}) string? s = null"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocInlineSummary() { var markup = @" /// <summary>Summary documentation</summary> /// <remarks>Remarks documentation</remarks> void M(int x) { } /// <summary><inheritdoc cref=""M(int)""/></summary> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("Summary documentation")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocTwoLevels1() { var markup = @" /// <summary>Summary documentation</summary> /// <remarks>Remarks documentation</remarks> void M() { } /// <inheritdoc cref=""M()""/> void M(int x) { } /// <inheritdoc cref=""M(int)""/> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("Summary documentation")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocTwoLevels2() { var markup = @" /// <summary>Summary documentation</summary> /// <remarks>Remarks documentation</remarks> void M() { } /// <summary><inheritdoc cref=""M()""/></summary> void M(int x) { } /// <summary><inheritdoc cref=""M(int)""/></summary> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("Summary documentation")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocWithTypeParamRef() { var markup = @" public class Program { public static void Main() => _ = new Test<int>().$$Clone(); } public class Test<T> : ICloneable<Test<T>> { /// <inheritdoc/> public Test<T> Clone() => new(); } /// <summary>A type that has clonable instances.</summary> /// <typeparam name=""T"">The type of instances that can be cloned.</typeparam> public interface ICloneable<T> { /// <summary>Clones a <typeparamref name=""T""/>.</summary> /// <returns>A clone of the <typeparamref name=""T""/>.</returns> public T Clone(); }"; await TestInClassAsync(markup, MainDescription("Test<int> Test<int>.Clone()"), Documentation("Clones a Test<T>.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocCycle1() { var markup = @" /// <inheritdoc cref=""M(int, int)""/> void M(int x) { } /// <inheritdoc cref=""M(int)""/> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocCycle2() { var markup = @" /// <inheritdoc cref=""M(int)""/> void $$M(int x) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x)"), Documentation("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocCycle3() { var markup = @" /// <inheritdoc cref=""M""/> void $$M(int x) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x)"), Documentation("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38794, "https://github.com/dotnet/roslyn/issues/38794")] public async Task TestLinqGroupVariableDeclaration() { var code = @" void M(string[] a) { var v = from x in a group x by x.Length into $$g select g; }"; await TestInClassAsync(code, MainDescription($"({FeaturesResources.range_variable}) IGrouping<int, string> g")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38283, "https://github.com/dotnet/roslyn/issues/38283")] public async Task QuickInfoOnIndexerCloseBracket() { await TestAsync(@" class C { public int this[int x] { get { return 1; } } void M() { var x = new C()[5$$]; } }", MainDescription("int C.this[int x] { get; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38283, "https://github.com/dotnet/roslyn/issues/38283")] public async Task QuickInfoOnIndexerOpenBracket() { await TestAsync(@" class C { public int this[int x] { get { return 1; } } void M() { var x = new C()$$[5]; } }", MainDescription("int C.this[int x] { get; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38283, "https://github.com/dotnet/roslyn/issues/38283")] public async Task QuickInfoOnIndexer_NotOnArrayAccess() { await TestAsync(@" class Program { void M() { int[] x = new int[4]; int y = x[3$$]; } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithRemarksOnMethod() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <remarks> /// Remarks text /// </remarks> int M() { return $$M(); } }", MainDescription("int Program.M()"), Documentation("Summary text"), Remarks("\r\nRemarks text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithRemarksOnPropertyAccessor() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <remarks> /// Remarks text /// </remarks> int M { $$get; } }", MainDescription("int Program.M.get"), Documentation("Summary text"), Remarks("\r\nRemarks text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithReturnsOnMethod() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <returns> /// Returns text /// </returns> int M() { return $$M(); } }", MainDescription("int Program.M()"), Documentation("Summary text"), Returns($"\r\n{FeaturesResources.Returns_colon}\r\n Returns text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithReturnsOnPropertyAccessor() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <returns> /// Returns text /// </returns> int M { $$get; } }", MainDescription("int Program.M.get"), Documentation("Summary text"), Returns($"\r\n{FeaturesResources.Returns_colon}\r\n Returns text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithValueOnMethod() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <value> /// Value text /// </value> int M() { return $$M(); } }", MainDescription("int Program.M()"), Documentation("Summary text"), Value($"\r\n{FeaturesResources.Value_colon}\r\n Value text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithValueOnPropertyAccessor() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <value> /// Value text /// </value> int M { $$get; } }", MainDescription("int Program.M.get"), Documentation("Summary text"), Value($"\r\n{FeaturesResources.Value_colon}\r\n Value text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoNotPattern1() { await TestAsync(@" class Person { void Goo(object o) { if (o is not $$Person p) { } } }", MainDescription("class Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoNotPattern2() { await TestAsync(@" class Person { void Goo(object o) { if (o is $$not Person p) { } } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoOrPattern1() { await TestAsync(@" class Person { void Goo(object o) { if (o is $$Person or int) { } } }", MainDescription("class Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoOrPattern2() { await TestAsync(@" class Person { void Goo(object o) { if (o is Person or $$int) { } } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoOrPattern3() { await TestAsync(@" class Person { void Goo(object o) { if (o is Person $$or int) { } } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoRecord() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record Person(string First, string Last) { void M($$Person p) { } }", MainDescription("record Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoDerivedRecord() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record Person(string First, string Last) { } record Student(string Id) { void M($$Student p) { } } ", MainDescription("record Student")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(44904, "https://github.com/dotnet/roslyn/issues/44904")] public async Task QuickInfoRecord_BaseTypeList() { await TestAsync(@" record Person(string First, string Last); record Student(int Id) : $$Person(null, null); ", MainDescription("Person.Person(string First, string Last)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfo_BaseConstructorInitializer() { await TestAsync(@" public class Person { public Person(int id) { } } public class Student : Person { public Student() : $$base(0) { } } ", MainDescription("Person.Person(int id)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoRecordClass() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record class Person(string First, string Last) { void M($$Person p) { } }", MainDescription("record Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoRecordStruct() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record struct Person(string First, string Last) { void M($$Person p) { } }", MainDescription("record struct Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoReadOnlyRecordStruct() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"readonly record struct Person(string First, string Last) { void M($$Person p) { } }", MainDescription("readonly record struct Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(51615, "https://github.com/dotnet/roslyn/issues/51615")] public async Task TestVarPatternOnVarKeyword() { await TestAsync( @"class C { string M() { } void M2() { if (M() is va$$r x && x.Length > 0) { } } }", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVarPatternOnVariableItself() { await TestAsync( @"class C { string M() { } void M2() { if (M() is var x$$ && x.Length > 0) { } } }", MainDescription($"({FeaturesResources.local_variable}) string? x")); } [WorkItem(53135, "https://github.com/dotnet/roslyn/issues/53135")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationCData() { var markup = @"using I$$ = IGoo; /// <summary> /// summary for interface IGoo /// <code><![CDATA[ /// List<string> y = null; /// ]]></code> /// </summary> interface IGoo { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation(@"summary for interface IGoo List<string> y = null;")); } [WorkItem(37503, "https://github.com/dotnet/roslyn/issues/37503")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DoNotNormalizeWhitespaceForCode() { var markup = @"using I$$ = IGoo; /// <summary> /// Normalize this, and <c>Also this</c> /// <code> /// line 1 /// line 2 /// </code> /// </summary> interface IGoo { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation(@"Normalize this, and Also this line 1 line 2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ImplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { public static void $$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ImplicitImplementation_FromReference() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { public static void M1() { } } class R { public static void M() { C1_1.$$M1(); } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_FromTypeParameterReference() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class R { public static void M<T>() where T : I1 { T.$$M1(); } } "; await TestAsync( code, MainDescription("void I1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ExplicitInheritdoc_ImplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { /// <inheritdoc/> public static void $$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ExplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { static void I1.$$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ExplicitInheritdoc_ExplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { /// <inheritdoc/> static void I1.$$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoLambdaReturnType_01() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"class Program { System.Delegate D = bo$$ol () => true; }", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoLambdaReturnType_02() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"class A { struct B { } System.Delegate D = A.B$$ () => null; }", MainDescription("struct A.B")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoLambdaReturnType_03() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"class A<T> { } struct B { System.Delegate D = A<B$$> () => null; }", MainDescription("struct B")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNormalFuncSynthesizedLambdaType() { await TestAsync( @"class C { void M() { $$var v = (int i) => i.ToString(); } }", MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"), TypeParameterMap($@" T {FeaturesResources.is_} int TResult {FeaturesResources.is_} string")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAnonymousSynthesizedLambdaType() { await TestAsync( @"class C { void M() { $$var v = (ref int i) => i.ToString(); } }", MainDescription("delegate string <anonymous delegate>(ref int)")); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Linq; using System.Security; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.QuickInfo; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using static Microsoft.CodeAnalysis.Editor.UnitTests.Classification.FormattedClassifications; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QuickInfo { public class SemanticQuickInfoSourceTests : AbstractSemanticQuickInfoSourceTests { private static async Task TestWithOptionsAsync(CSharpParseOptions options, string markup, params Action<QuickInfoItem>[] expectedResults) { using var workspace = TestWorkspace.CreateCSharp(markup, options); await TestWithOptionsAsync(workspace, expectedResults); } private static async Task TestWithOptionsAsync(CSharpCompilationOptions options, string markup, params Action<QuickInfoItem>[] expectedResults) { using var workspace = TestWorkspace.CreateCSharp(markup, compilationOptions: options); await TestWithOptionsAsync(workspace, expectedResults); } private static async Task TestWithOptionsAsync(TestWorkspace workspace, params Action<QuickInfoItem>[] expectedResults) { var testDocument = workspace.DocumentWithCursor; var position = testDocument.CursorPosition.GetValueOrDefault(); var documentId = workspace.GetDocumentId(testDocument); var document = workspace.CurrentSolution.GetDocument(documentId); var service = QuickInfoService.GetService(document); await TestWithOptionsAsync(document, service, position, expectedResults); // speculative semantic model if (await CanUseSpeculativeSemanticModelAsync(document, position)) { var buffer = testDocument.GetTextBuffer(); using (var edit = buffer.CreateEdit()) { var currentSnapshot = buffer.CurrentSnapshot; edit.Replace(0, currentSnapshot.Length, currentSnapshot.GetText()); edit.Apply(); } await TestWithOptionsAsync(document, service, position, expectedResults); } } private static async Task TestWithOptionsAsync(Document document, QuickInfoService service, int position, Action<QuickInfoItem>[] expectedResults) { var info = await service.GetQuickInfoAsync(document, position, cancellationToken: CancellationToken.None); if (expectedResults.Length == 0) { Assert.Null(info); } else { Assert.NotNull(info); foreach (var expected in expectedResults) { expected(info); } } } private static async Task VerifyWithMscorlib45Async(string markup, Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""C#"" CommonReferencesNet45=""true""> <Document FilePath=""SourceDocument""> {0} </Document> </Project> </Workspace>", SecurityElement.Escape(markup)); using var workspace = TestWorkspace.Create(xmlString); var position = workspace.Documents.Single(d => d.Name == "SourceDocument").CursorPosition.Value; var documentId = workspace.Documents.Where(d => d.Name == "SourceDocument").Single().Id; var document = workspace.CurrentSolution.GetDocument(documentId); var service = QuickInfoService.GetService(document); var info = await service.GetQuickInfoAsync(document, position, cancellationToken: CancellationToken.None); if (expectedResults.Length == 0) { Assert.Null(info); } else { Assert.NotNull(info); foreach (var expected in expectedResults) { expected(info); } } } protected override async Task TestAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { await TestWithOptionsAsync(Options.Regular, markup, expectedResults); await TestWithOptionsAsync(Options.Script, markup, expectedResults); } private async Task TestWithUsingsAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { var markupWithUsings = @"using System; using System.Collections.Generic; using System.Linq; " + markup; await TestAsync(markupWithUsings, expectedResults); } private Task TestInClassAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { var markupInClass = "class C { " + markup + " }"; return TestWithUsingsAsync(markupInClass, expectedResults); } private Task TestInMethodAsync(string markup, params Action<QuickInfoItem>[] expectedResults) { var markupInMethod = "class C { void M() { " + markup + " } }"; return TestWithUsingsAsync(markupInMethod, expectedResults); } private static async Task TestWithReferenceAsync(string sourceCode, string referencedCode, string sourceLanguage, string referencedLanguage, params Action<QuickInfoItem>[] expectedResults) { await TestWithMetadataReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults); await TestWithProjectReferenceHelperAsync(sourceCode, referencedCode, sourceLanguage, referencedLanguage, expectedResults); // Multi-language projects are not supported. if (sourceLanguage == referencedLanguage) { await TestInSameProjectHelperAsync(sourceCode, referencedCode, sourceLanguage, expectedResults); } } private static async Task TestWithMetadataReferenceHelperAsync( string sourceCode, string referencedCode, string sourceLanguage, string referencedLanguage, params Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""{0}"" CommonReferences=""true""> <Document FilePath=""SourceDocument""> {1} </Document> <MetadataReferenceFromSource Language=""{2}"" CommonReferences=""true"" IncludeXmlDocComments=""true""> <Document FilePath=""ReferencedDocument""> {3} </Document> </MetadataReferenceFromSource> </Project> </Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), referencedLanguage, SecurityElement.Escape(referencedCode)); await VerifyWithReferenceWorkerAsync(xmlString, expectedResults); } private static async Task TestWithProjectReferenceHelperAsync( string sourceCode, string referencedCode, string sourceLanguage, string referencedLanguage, params Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""{0}"" CommonReferences=""true""> <ProjectReference>ReferencedProject</ProjectReference> <Document FilePath=""SourceDocument""> {1} </Document> </Project> <Project Language=""{2}"" CommonReferences=""true"" AssemblyName=""ReferencedProject""> <Document FilePath=""ReferencedDocument""> {3} </Document> </Project> </Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), referencedLanguage, SecurityElement.Escape(referencedCode)); await VerifyWithReferenceWorkerAsync(xmlString, expectedResults); } private static async Task TestInSameProjectHelperAsync( string sourceCode, string referencedCode, string sourceLanguage, params Action<QuickInfoItem>[] expectedResults) { var xmlString = string.Format(@" <Workspace> <Project Language=""{0}"" CommonReferences=""true""> <Document FilePath=""SourceDocument""> {1} </Document> <Document FilePath=""ReferencedDocument""> {2} </Document> </Project> </Workspace>", sourceLanguage, SecurityElement.Escape(sourceCode), SecurityElement.Escape(referencedCode)); await VerifyWithReferenceWorkerAsync(xmlString, expectedResults); } private static async Task VerifyWithReferenceWorkerAsync(string xmlString, params Action<QuickInfoItem>[] expectedResults) { using var workspace = TestWorkspace.Create(xmlString); var position = workspace.Documents.First(d => d.Name == "SourceDocument").CursorPosition.Value; var documentId = workspace.Documents.First(d => d.Name == "SourceDocument").Id; var document = workspace.CurrentSolution.GetDocument(documentId); var service = QuickInfoService.GetService(document); var info = await service.GetQuickInfoAsync(document, position, cancellationToken: CancellationToken.None); if (expectedResults.Length == 0) { Assert.Null(info); } else { Assert.NotNull(info); foreach (var expected in expectedResults) { expected(info); } } } protected async Task TestInvalidTypeInClassAsync(string code) { var codeInClass = "class C { " + code + " }"; await TestAsync(codeInClass); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirective() { await TestAsync( @"using $$System;", MainDescription("namespace System")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirective2() { await TestAsync( @"using System.Coll$$ections.Generic;", MainDescription("namespace System.Collections")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirective3() { await TestAsync( @"using System.L$$inq;", MainDescription("namespace System.Linq")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNamespaceInUsingDirectiveWithAlias() { await TestAsync( @"using Goo = Sys$$tem.Console;", MainDescription("namespace System")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeInUsingDirectiveWithAlias() { await TestAsync( @"using Goo = System.Con$$sole;", MainDescription("class System.Console")); } [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationInUsingDirectiveWithAlias() { var markup = @"using I$$ = IGoo; ///<summary>summary for interface IGoo</summary> interface IGoo { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation("summary for interface IGoo")); } [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationInUsingDirectiveWithAlias2() { var markup = @"using I = IGoo; ///<summary>summary for interface IGoo</summary> interface IGoo { } class C : I$$ { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation("summary for interface IGoo")); } [WorkItem(991466, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/991466")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationInUsingDirectiveWithAlias3() { var markup = @"using I = IGoo; ///<summary>summary for interface IGoo</summary> interface IGoo { void Goo(); } class C : I$$ { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation("summary for interface IGoo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestThis() { var markup = @" ///<summary>summary for Class C</summary> class C { string M() { return thi$$s.ToString(); } }"; await TestWithUsingsAsync(markup, MainDescription("class C"), Documentation("summary for Class C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestClassWithDocComment() { var markup = @" ///<summary>Hello!</summary> class C { void M() { $$C obj; } }"; await TestAsync(markup, MainDescription("class C"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestSingleLineDocComments() { // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedSingleLineComment // SingleLine doc comment with leading whitespace await TestAsync( @"///<summary>Hello!</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with space before opening tag await TestAsync( @"/// <summary>Hello!</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with space before opening tag and leading whitespace await TestAsync( @"/// <summary>Hello!</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with leading whitespace and blank line await TestAsync( @"///<summary>Hello! ///</summary> class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // SingleLine doc comment with '\r' line separators await TestAsync("///<summary>Hello!\r///</summary>\rclass C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMultiLineDocComments() { // Tests chosen to maximize code coverage in DocumentationCommentCompiler.WriteFormattedMultiLineComment // Multiline doc comment with leading whitespace await TestAsync( @"/**<summary>Hello!</summary>*/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with space before opening tag await TestAsync( @"/** <summary>Hello!</summary> **/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with space before opening tag and leading whitespace await TestAsync( @"/** ** <summary>Hello!</summary> **/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with no per-line prefix await TestAsync( @"/** <summary> Hello! </summary> */ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with inconsistent per-line prefix await TestAsync( @"/** ** <summary> Hello!</summary> ** **/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with closing comment on final line await TestAsync( @"/** <summary>Hello! </summary>*/ class C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); // Multiline doc comment with '\r' line separators await TestAsync("/**\r* <summary>\r* Hello!\r* </summary>\r*/\rclass C { void M() { $$C obj; } }", MainDescription("class C"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMethodWithDocComment() { var markup = @" ///<summary>Hello!</summary> void M() { M$$() }"; await TestInClassAsync(markup, MainDescription("void C.M()"), Documentation("Hello!")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInt32() { await TestInClassAsync( @"$$Int32 i;", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInInt() { await TestInClassAsync( @"$$int i;", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestString() { await TestInClassAsync( @"$$String s;", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInString() { await TestInClassAsync( @"$$string s;", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInStringAtEndOfToken() { await TestInClassAsync( @"string$$ s;", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBoolean() { await TestInClassAsync( @"$$Boolean b;", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInBool() { await TestInClassAsync( @"$$bool b;", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestSingle() { await TestInClassAsync( @"$$Single s;", MainDescription("struct System.Single")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestBuiltInFloat() { await TestInClassAsync( @"$$float f;", MainDescription("struct System.Single")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVoidIsInvalid() { await TestInvalidTypeInClassAsync( @"$$void M() { }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidPointer1_931958() { await TestInvalidTypeInClassAsync( @"$$T* i;"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidPointer2_931958() { await TestInvalidTypeInClassAsync( @"T$$* i;"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidPointer3_931958() { await TestInvalidTypeInClassAsync( @"T*$$ i;"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestListOfString() { await TestInClassAsync( @"$$List<string> l;", MainDescription("class System.Collections.Generic.List<T>"), TypeParameterMap($"\r\nT {FeaturesResources.is_} string")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestListOfSomethingFromSource() { var markup = @" ///<summary>Generic List</summary> public class GenericList<T> { Generic$$List<int> t; }"; await TestAsync(markup, MainDescription("class GenericList<T>"), Documentation("Generic List"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestListOfT() { await TestInMethodAsync( @"class C<T> { $$List<T> l; }", MainDescription("class System.Collections.Generic.List<T>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDictionaryOfIntAndString() { await TestInClassAsync( @"$$Dictionary<int, string> d;", MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"), TypeParameterMap( Lines($"\r\nTKey {FeaturesResources.is_} int", $"TValue {FeaturesResources.is_} string"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDictionaryOfTAndU() { await TestInMethodAsync( @"class C<T, U> { $$Dictionary<T, U> d; }", MainDescription("class System.Collections.Generic.Dictionary<TKey, TValue>"), TypeParameterMap( Lines($"\r\nTKey {FeaturesResources.is_} T", $"TValue {FeaturesResources.is_} U"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIEnumerableOfInt() { await TestInClassAsync( @"$$IEnumerable<int> M() { yield break; }", MainDescription("interface System.Collections.Generic.IEnumerable<out T>"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventHandler() { await TestInClassAsync( @"event $$EventHandler e;", MainDescription("delegate void System.EventHandler(object sender, System.EventArgs e)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter() { await TestAsync( @"class C<T> { $$T t; }", MainDescription($"T {FeaturesResources.in_} C<T>")); } [WorkItem(538636, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538636")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameterWithDocComment() { var markup = @" ///<summary>Hello!</summary> ///<typeparam name=""T"">T is Type Parameter</typeparam> class C<T> { $$T t; }"; await TestAsync(markup, MainDescription($"T {FeaturesResources.in_} C<T>"), Documentation("T is Type Parameter")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter1_Bug931949() { await TestAsync( @"class T1<T11> { $$T11 t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter2_Bug931949() { await TestAsync( @"class T1<T11> { T$$11 t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter3_Bug931949() { await TestAsync( @"class T1<T11> { T1$$1 t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameter4_Bug931949() { await TestAsync( @"class T1<T11> { T11$$ t; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullableOfInt() { await TestInClassAsync(@"$$Nullable<int> i; }", MainDescription("struct System.Nullable<T> where T : struct"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeDeclaredOnMethod1_Bug1946() { await TestAsync( @"class C { static void Meth1<T1>($$T1 i) where T1 : struct { T1 i; } }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeDeclaredOnMethod2_Bug1946() { await TestAsync( @"class C { static void Meth1<T1>(T1 i) where $$T1 : struct { T1 i; } }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeDeclaredOnMethod3_Bug1946() { await TestAsync( @"class C { static void Meth1<T1>(T1 i) where T1 : struct { $$T1 i; } }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Class() { await TestAsync( @"class C<T> where $$T : class { }", MainDescription($"T {FeaturesResources.in_} C<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Struct() { await TestAsync( @"struct S<T> where $$T : class { }", MainDescription($"T {FeaturesResources.in_} S<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Interface() { await TestAsync( @"interface I<T> where $$T : class { }", MainDescription($"T {FeaturesResources.in_} I<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericTypeParameterConstraint_Delegate() { await TestAsync( @"delegate void D<T>() where $$T : class;", MainDescription($"T {FeaturesResources.in_} D<T> where T : class")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMinimallyQualifiedConstraint() { await TestAsync(@"class C<T> where $$T : IEnumerable<int>", MainDescription($"T {FeaturesResources.in_} C<T> where T : IEnumerable<int>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FullyQualifiedConstraint() { await TestAsync(@"class C<T> where $$T : System.Collections.Generic.IEnumerable<int>", MainDescription($"T {FeaturesResources.in_} C<T> where T : System.Collections.Generic.IEnumerable<int>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMethodReferenceInSameMethod() { await TestAsync( @"class C { void M() { M$$(); } }", MainDescription("void C.M()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMethodReferenceInSameMethodWithDocComment() { var markup = @" ///<summary>Hello World</summary> void M() { M$$(); }"; await TestInClassAsync(markup, MainDescription("void C.M()"), Documentation("Hello World")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodBuiltIn() { var markup = @"int field; void M() { field$$ }"; await TestInClassAsync(markup, MainDescription($"({FeaturesResources.field}) int C.field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodBuiltIn2() { await TestInClassAsync( @"int field; void M() { int f = field$$; }", MainDescription($"({FeaturesResources.field}) int C.field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodBuiltInWithFieldInitializer() { await TestInClassAsync( @"int field = 1; void M() { int f = field $$; }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn() { await TestInMethodAsync( @"int x; x = x$$+1;", MainDescription("int int.operator +(int left, int right)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn1() { await TestInMethodAsync( @"int x; x = x$$ + 1;", MainDescription($"({FeaturesResources.local_variable}) int x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn2() { await TestInMethodAsync( @"int x; x = x+$$x;", MainDescription($"({FeaturesResources.local_variable}) int x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn3() { await TestInMethodAsync( @"int x; x = x +$$ x;", MainDescription("int int.operator +(int left, int right)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorBuiltIn4() { await TestInMethodAsync( @"int x; x = x + $$x;", MainDescription($"({FeaturesResources.local_variable}) int x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorCustomTypeBuiltIn() { var markup = @"class C { static void M() { C c; c = c +$$ c; } }"; await TestAsync(markup); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOperatorCustomTypeOverload() { var markup = @"class C { static void M() { C c; c = c +$$ c; } static C operator+(C a, C b) { return a; } }"; await TestAsync(markup, MainDescription("C C.operator +(C a, C b)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodMinimal() { var markup = @"DateTime field; void M() { field$$ }"; await TestInClassAsync(markup, MainDescription($"({FeaturesResources.field}) DateTime C.field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldInMethodQualified() { var markup = @"System.IO.FileInfo file; void M() { file$$ }"; await TestInClassAsync(markup, MainDescription($"({FeaturesResources.field}) System.IO.FileInfo C.file")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructFromSource() { var markup = @"struct MyStruct { public static int SomeField; } static class Test { int a = MyStruct.Some$$Field; }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField")); } [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructFromSourceWithDocComment() { var markup = @"struct MyStruct { ///<summary>My Field</summary> public static int SomeField; } static class Test { int a = MyStruct.Some$$Field; }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField"), Documentation("My Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructInsideMethodFromSource() { var markup = @"struct MyStruct { public static int SomeField; } static class Test { static void Method() { int a = MyStruct.Some$$Field; } }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField")); } [WorkItem(538638, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538638")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMemberOfStructInsideMethodFromSourceWithDocComment() { var markup = @"struct MyStruct { ///<summary>My Field</summary> public static int SomeField; } static class Test { static void Method() { int a = MyStruct.Some$$Field; } }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static int MyStruct.SomeField"), Documentation("My Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldMinimal() { await TestInMethodAsync(@"DateTime dt = DateTime.MaxValue$$", MainDescription($"({FeaturesResources.field}) static readonly DateTime DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldQualified1() { // NOTE: we qualify the field type, but not the type that contains the field in Dev10 var markup = @"class C { void M() { DateTime dt = System.DateTime.MaxValue$$ } }"; await TestAsync(markup, MainDescription($"({FeaturesResources.field}) static readonly System.DateTime System.DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldQualified2() { await TestAsync( @"class C { void M() { DateTime dt = System.DateTime.MaxValue$$ } }", MainDescription($"({FeaturesResources.field}) static readonly System.DateTime System.DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMetadataFieldQualified3() { await TestAsync( @"using System; class C { void M() { DateTime dt = System.DateTime.MaxValue$$ } }", MainDescription($"({FeaturesResources.field}) static readonly DateTime DateTime.MaxValue")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ConstructedGenericField() { await TestAsync( @"class C<T> { public T Field; } class D { void M() { new C<int>().Fi$$eld.ToString(); } }", MainDescription($"({FeaturesResources.field}) int C<int>.Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnconstructedGenericField() { await TestAsync( @"class C<T> { public T Field; void M() { Fi$$eld.ToString(); } }", MainDescription($"({FeaturesResources.field}) T C<T>.Field")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIntegerLiteral() { await TestInMethodAsync(@"int f = 37$$", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTrueKeyword() { await TestInMethodAsync(@"bool f = true$$", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFalseKeyword() { await TestInMethodAsync(@"bool f = false$$", MainDescription("struct System.Boolean")); } [WorkItem(26027, "https://github.com/dotnet/roslyn/issues/26027")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullLiteral() { await TestInMethodAsync(@"string f = null$$", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullLiteralWithVar() => await TestInMethodAsync(@"var f = null$$"); [WorkItem(26027, "https://github.com/dotnet/roslyn/issues/26027")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDefaultLiteral() { await TestInMethodAsync(@"string f = default$$", MainDescription("class System.String")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitKeywordOnGenericTaskReturningAsync() { var markup = @"using System.Threading.Tasks; class C { public async Task<int> Calc() { aw$$ait Calc(); return 5; } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "struct System.Int32"))); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitKeywordInDeclarationStatement() { var markup = @"using System.Threading.Tasks; class C { public async Task<int> Calc() { var x = $$await Calc(); return 5; } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "struct System.Int32"))); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitKeywordOnTaskReturningAsync() { var markup = @"using System.Threading.Tasks; class C { public async void Calc() { aw$$ait Task.Delay(100); } }"; await TestAsync(markup, MainDescription(FeaturesResources.Awaited_task_returns_no_value)); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNestedAwaitKeywords1() { var markup = @"using System; using System.Threading.Tasks; class AsyncExample2 { async Task<Task<int>> AsyncMethod() { return NewMethod(); } private static Task<int> NewMethod() { int hours = 24; return hours; } async Task UseAsync() { Func<Task<int>> lambda = async () => { return await await AsyncMethod(); }; int result = await await AsyncMethod(); Task<Task<int>> resultTask = AsyncMethod(); result = await awa$$it resultTask; result = await lambda(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, $"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task<TResult>")), TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNestedAwaitKeywords2() { var markup = @"using System; using System.Threading.Tasks; class AsyncExample2 { async Task<Task<int>> AsyncMethod() { return NewMethod(); } private static Task<int> NewMethod() { int hours = 24; return hours; } async Task UseAsync() { Func<Task<int>> lambda = async () => { return await await AsyncMethod(); }; int result = await await AsyncMethod(); Task<Task<int>> resultTask = AsyncMethod(); result = awa$$it await resultTask; result = await lambda(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "struct System.Int32"))); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitablePrefixOnCustomAwaiter() { var markup = @"using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Z = $$C; class C { public MyAwaiter GetAwaiter() { throw new NotImplementedException(); } } class MyAwaiter : INotifyCompletion { public void OnCompleted(Action continuation) { throw new NotImplementedException(); } public bool IsCompleted { get { throw new NotImplementedException(); } } public void GetResult() { } }"; await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class C")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTaskType() { var markup = @"using System.Threading.Tasks; class C { public void Calc() { Task$$ v1; } }"; await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task")); } [WorkItem(756226, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756226"), WorkItem(756337, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756337")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTaskOfTType() { var markup = @"using System; using System.Threading.Tasks; class C { public void Calc() { Task$$<int> v1; } }"; await TestAsync(markup, MainDescription($"({CSharpFeaturesResources.awaitable}) class System.Threading.Tasks.Task<TResult>"), TypeParameterMap($"\r\nTResult {FeaturesResources.is_} int")); } [WorkItem(7100, "https://github.com/dotnet/roslyn/issues/7100")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDynamicIsntAwaitable() { var markup = @" class C { dynamic D() { return null; } void M() { D$$(); } } "; await TestAsync(markup, MainDescription("dynamic C.D()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStringLiteral() { await TestInMethodAsync(@"string f = ""Goo""$$", MainDescription("class System.String")); } [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVerbatimStringLiteral() { await TestInMethodAsync(@"string f = @""cat""$$", MainDescription("class System.String")); } [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInterpolatedStringLiteral() { await TestInMethodAsync(@"string f = $""cat""$$", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $""c$$at""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $""$$cat""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $""cat {1$$ + 2} dog""", MainDescription("struct System.Int32")); } [WorkItem(1280, "https://github.com/dotnet/roslyn/issues/1280")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVerbatimInterpolatedStringLiteral() { await TestInMethodAsync(@"string f = $@""cat""$$", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $@""c$$at""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $@""$$cat""", MainDescription("class System.String")); await TestInMethodAsync(@"string f = $@""cat {1$$ + 2} dog""", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCharLiteral() { await TestInMethodAsync(@"string f = 'x'$$", MainDescription("struct System.Char")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DynamicKeyword() { await TestInMethodAsync( @"dyn$$amic dyn;", MainDescription("dynamic"), Documentation(FeaturesResources.Represents_an_object_whose_operations_will_be_resolved_at_runtime)); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DynamicField() { await TestInClassAsync( @"dynamic dyn; void M() { d$$yn.Goo(); }", MainDescription($"({FeaturesResources.field}) dynamic C.dyn")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Minimal() { await TestInClassAsync( @"DateTime Prop { get; set; } void M() { P$$rop.ToString(); }", MainDescription("DateTime C.Prop { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Minimal_PrivateSet() { await TestInClassAsync( @"public DateTime Prop { get; private set; } void M() { P$$rop.ToString(); }", MainDescription("DateTime C.Prop { get; private set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Minimal_PrivateSet1() { await TestInClassAsync( @"protected internal int Prop { get; private set; } void M() { P$$rop.ToString(); }", MainDescription("int C.Prop { get; private set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalProperty_Qualified() { await TestInClassAsync( @"System.IO.FileInfo Prop { get; set; } void M() { P$$rop.ToString(); }", MainDescription("System.IO.FileInfo C.Prop { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NonLocalProperty_Minimal() { await TestInMethodAsync(@"DateTime.No$$w.ToString();", MainDescription("DateTime DateTime.Now { get; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NonLocalProperty_Qualified() { await TestInMethodAsync( @"System.IO.FileInfo f; f.Att$$ributes.ToString();", MainDescription("System.IO.FileAttributes System.IO.FileSystemInfo.Attributes { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ConstructedGenericProperty() { await TestAsync( @"class C<T> { public T Property { get; set } } class D { void M() { new C<int>().Pro$$perty.ToString(); } }", MainDescription("int C<int>.Property { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnconstructedGenericProperty() { await TestAsync( @"class C<T> { public T Property { get; set} void M() { Pro$$perty.ToString(); } }", MainDescription("T C<T>.Property { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueInProperty() { await TestInClassAsync( @"public DateTime Property { set { goo = val$$ue; } }", MainDescription($"({FeaturesResources.parameter}) DateTime value")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumTypeName() { await TestInMethodAsync(@"Consol$$eColor c", MainDescription("enum System.ConsoleColor")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_Definition() { await TestInClassAsync(@"enum E$$ : byte { A, B }", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsField() { await TestInClassAsync(@" enum E : byte { A, B } private E$$ _E; ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsProperty() { await TestInClassAsync(@" enum E : byte { A, B } private E$$ E{ get; set; }; ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsParameter() { await TestInClassAsync(@" enum E : byte { A, B } private void M(E$$ e) { } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsReturnType() { await TestInClassAsync(@" enum E : byte { A, B } private E$$ M() { } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_AsLocal() { await TestInClassAsync(@" enum E : byte { A, B } private void M() { E$$ e = default; } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_OnMemberAccessOnType() { await TestInClassAsync(@" enum E : byte { A, B } private void M() { var ea = E$$.A; } ", MainDescription("enum C.E : byte")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] public async Task EnumNonDefaultUnderlyingType_NotOnMemberAccessOnMember() { await TestInClassAsync(@" enum E : byte { A, B } private void M() { var ea = E.A$$; } ", MainDescription("E.A = 0")); } [Theory, WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] [InlineData("byte", "byte")] [InlineData("byte", "System.Byte")] [InlineData("sbyte", "sbyte")] [InlineData("sbyte", "System.SByte")] [InlineData("short", "short")] [InlineData("short", "System.Int16")] [InlineData("ushort", "ushort")] [InlineData("ushort", "System.UInt16")] // int is the default type and is not shown [InlineData("uint", "uint")] [InlineData("uint", "System.UInt32")] [InlineData("long", "long")] [InlineData("long", "System.Int64")] [InlineData("ulong", "ulong")] [InlineData("ulong", "System.UInt64")] public async Task EnumNonDefaultUnderlyingType_ShowForNonDefaultTypes(string displayTypeName, string underlyingTypeName) { await TestInClassAsync(@$" enum E$$ : {underlyingTypeName} {{ A, B }}", MainDescription($"enum C.E : {displayTypeName}")); } [Theory, WorkItem(52490, "https://github.com/dotnet/roslyn/issues/52490")] [InlineData("")] [InlineData(": int")] [InlineData(": System.Int32")] public async Task EnumNonDefaultUnderlyingType_DontShowForDefaultType(string defaultType) { await TestInClassAsync(@$" enum E$$ {defaultType} {{ A, B }}", MainDescription("enum C.E")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumMemberNameFromMetadata() { await TestInMethodAsync(@"ConsoleColor c = ConsoleColor.Bla$$ck", MainDescription("ConsoleColor.Black = 0")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FlagsEnumMemberNameFromMetadata1() { await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.Cl$$ass", MainDescription("AttributeTargets.Class = 4")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FlagsEnumMemberNameFromMetadata2() { await TestInMethodAsync(@"AttributeTargets a = AttributeTargets.A$$ll", MainDescription("AttributeTargets.All = AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumMemberNameFromSource1() { await TestAsync( @"enum E { A = 1 << 0, B = 1 << 1, C = 1 << 2 } class C { void M() { var e = E.B$$; } }", MainDescription("E.B = 1 << 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumMemberNameFromSource2() { await TestAsync( @"enum E { A, B, C } class C { void M() { var e = E.B$$; } }", MainDescription("E.B = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_InMethod_Minimal() { await TestInClassAsync( @"void M(DateTime dt) { d$$t.ToString();", MainDescription($"({FeaturesResources.parameter}) DateTime dt")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_InMethod_Qualified() { await TestInClassAsync( @"void M(System.IO.FileInfo fileInfo) { file$$Info.ToString();", MainDescription($"({FeaturesResources.parameter}) System.IO.FileInfo fileInfo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_FromReferenceToNamedParameter() { await TestInMethodAsync(@"Console.WriteLine(va$$lue: ""Hi"");", MainDescription($"({FeaturesResources.parameter}) string value")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_DefaultValue() { // NOTE: Dev10 doesn't show the default value, but it would be nice if we did. // NOTE: The "DefaultValue" property isn't implemented yet. await TestInClassAsync( @"void M(int param = 42) { para$$m.ToString(); }", MainDescription($"({FeaturesResources.parameter}) int param = 42")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_Params() { await TestInClassAsync( @"void M(params DateTime[] arg) { ar$$g.ToString(); }", MainDescription($"({FeaturesResources.parameter}) params DateTime[] arg")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_Ref() { await TestInClassAsync( @"void M(ref DateTime arg) { ar$$g.ToString(); }", MainDescription($"({FeaturesResources.parameter}) ref DateTime arg")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Parameter_Out() { await TestInClassAsync( @"void M(out DateTime arg) { ar$$g.ToString(); }", MainDescription($"({FeaturesResources.parameter}) out DateTime arg")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Local_Minimal() { await TestInMethodAsync( @"DateTime dt; d$$t.ToString();", MainDescription($"({FeaturesResources.local_variable}) DateTime dt")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Local_Qualified() { await TestInMethodAsync( @"System.IO.FileInfo fileInfo; file$$Info.ToString();", MainDescription($"({FeaturesResources.local_variable}) System.IO.FileInfo fileInfo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_MetadataOverload() { await TestInMethodAsync("Console.Write$$Line();", MainDescription($"void Console.WriteLine() (+ 18 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_SimpleWithOverload() { await TestInClassAsync( @"void Method() { Met$$hod(); } void Method(int i) { }", MainDescription($"void C.Method() (+ 1 {FeaturesResources.overload})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_MoreOverloads() { await TestInClassAsync( @"void Method() { Met$$hod(null); } void Method(int i) { } void Method(DateTime dt) { } void Method(System.IO.FileInfo fileInfo) { }", MainDescription($"void C.Method(System.IO.FileInfo fileInfo) (+ 3 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_SimpleInSameClass() { await TestInClassAsync( @"DateTime GetDate(System.IO.FileInfo ft) { Get$$Date(null); }", MainDescription("DateTime C.GetDate(System.IO.FileInfo ft)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_OptionalParameter() { await TestInClassAsync( @"void M() { Met$$hod(); } void Method(int i = 0) { }", MainDescription("void C.Method([int i = 0])")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_OptionalDecimalParameter() { await TestInClassAsync( @"void Goo(decimal x$$yz = 10) { }", MainDescription($"({FeaturesResources.parameter}) decimal xyz = 10")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_Generic() { // Generic method don't get the instantiation info yet. NOTE: We don't display // constraint info in Dev10. Should we? await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn> { Go$$o<int, DateTime>(37); }", MainDescription("DateTime C.Goo<int, DateTime>(int arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_UnconstructedGeneric() { await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) { Go$$o<TIn, TOut>(default(TIn); }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_Inferred() { await TestInClassAsync( @"void Goo<TIn>(TIn arg) { Go$$o(42); }", MainDescription("void C.Goo<int>(int arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_MultipleParams() { await TestInClassAsync( @"void Goo(DateTime dt, System.IO.FileInfo fi, int number) { Go$$o(DateTime.Now, null, 32); }", MainDescription("void C.Goo(DateTime dt, System.IO.FileInfo fi, int number)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_OptionalParam() { // NOTE - Default values aren't actually returned by symbols yet. await TestInClassAsync( @"void Goo(int num = 42) { Go$$o(); }", MainDescription("void C.Goo([int num = 42])")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Method_ParameterModifiers() { // NOTE - Default values aren't actually returned by symbols yet. await TestInClassAsync( @"void Goo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers) { Go$$o(DateTime.Now, null, 32); }", MainDescription("void C.Goo(ref DateTime dt, out System.IO.FileInfo fi, params int[] numbers)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor() { await TestInClassAsync( @"public C() { } void M() { new C$$().ToString(); }", MainDescription("C.C()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_Overloads() { await TestInClassAsync( @"public C() { } public C(DateTime dt) { } public C(int i) { } void M() { new C$$(DateTime.MaxValue).ToString(); }", MainDescription($"C.C(DateTime dt) (+ 2 {FeaturesResources.overloads_})")); } /// <summary> /// Regression for 3923 /// </summary> [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_OverloadFromStringLiteral() { await TestInMethodAsync( @"new InvalidOperatio$$nException("""");", MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})")); } /// <summary> /// Regression for 3923 /// </summary> [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_UnknownType() { await TestInvalidTypeInClassAsync( @"void M() { new G$$oo(); }"); } /// <summary> /// Regression for 3923 /// </summary> [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_OverloadFromProperty() { await TestInMethodAsync( @"new InvalidOperatio$$nException(this.GetType().Name);", MainDescription($"InvalidOperationException.InvalidOperationException(string message) (+ 2 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_Metadata() { await TestInMethodAsync( @"new Argument$$NullException();", MainDescription($"ArgumentNullException.ArgumentNullException() (+ 3 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_MetadataQualified() { await TestInMethodAsync(@"new System.IO.File$$Info(null);", MainDescription("System.IO.FileInfo.FileInfo(string fileName)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task InterfaceProperty() { await TestInMethodAsync( @"interface I { string Name$$ { get; set; } }", MainDescription("string I.Name { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExplicitInterfacePropertyImplementation() { await TestInMethodAsync( @"interface I { string Name { get; set; } } class C : I { string IEmployee.Name$$ { get { return """"; } set { } } }", MainDescription("string C.Name { get; set; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Operator() { await TestInClassAsync( @"public static C operator +(C left, C right) { return null; } void M(C left, C right) { return left +$$ right; }", MainDescription("C C.operator +(C left, C right)")); } #pragma warning disable CA2243 // Attribute string literals should parse correctly [WorkItem(792629, "generic type parameter constraints for methods in quick info")] #pragma warning restore CA2243 // Attribute string literals should parse correctly [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericMethodWithConstraintsAtDeclaration() { await TestInClassAsync( @"TOut G$$oo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn> { }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : IEquatable<TIn>")); } #pragma warning disable CA2243 // Attribute string literals should parse correctly [WorkItem(792629, "generic type parameter constraints for methods in quick info")] #pragma warning restore CA2243 // Attribute string literals should parse correctly [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericMethodWithMultipleConstraintsAtDeclaration() { await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) where TIn : Employee, new() { Go$$o<TIn, TOut>(default(TIn); }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : Employee, new()")); } #pragma warning disable CA2243 // Attribute string literals should parse correctly [WorkItem(792629, "generic type parameter constraints for methods in quick info")] #pragma warning restore CA2243 // Attribute string literals should parse correctly [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnConstructedGenericMethodWithConstraintsAtInvocation() { await TestInClassAsync( @"TOut Goo<TIn, TOut>(TIn arg) where TIn : Employee { Go$$o<TIn, TOut>(default(TIn); }", MainDescription("TOut C.Goo<TIn, TOut>(TIn arg) where TIn : Employee")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericTypeWithConstraintsAtDeclaration() { await TestAsync( @"public class Employee : IComparable<Employee> { public int CompareTo(Employee other) { throw new NotImplementedException(); } } class Emplo$$yeeList<T> : IEnumerable<T> where T : Employee, System.IComparable<T>, new() { }", MainDescription("class EmployeeList<T> where T : Employee, System.IComparable<T>, new()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericType() { await TestAsync( @"class T1<T11> { $$T11 i; }", MainDescription($"T11 {FeaturesResources.in_} T1<T11>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericMethod() { await TestInClassAsync( @"static void Meth1<T1>(T1 i) where T1 : struct { $$T1 i; }", MainDescription($"T1 {FeaturesResources.in_} C.Meth1<T1> where T1 : struct")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Var() { await TestInMethodAsync( @"var x = new Exception(); var y = $$x;", MainDescription($"({FeaturesResources.local_variable}) Exception x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableReference() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp8), @"class A<T> { } class B { static void M() { A<B?>? x = null!; var y = x; $$y.ToString(); } }", // https://github.com/dotnet/roslyn/issues/26198 public API should show inferred nullability MainDescription($"({FeaturesResources.local_variable}) A<B?> y")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26648, "https://github.com/dotnet/roslyn/issues/26648")] public async Task NullableReference_InMethod() { var code = @" class G { void M() { C c; c.Go$$o(); } } public class C { public string? Goo(IEnumerable<object?> arg) { } }"; await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp8), code, MainDescription("string? C.Goo(IEnumerable<object?> arg)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NestedInGeneric() { await TestInMethodAsync( @"List<int>.Enu$$merator e;", MainDescription("struct System.Collections.Generic.List<T>.Enumerator"), TypeParameterMap($"\r\nT {FeaturesResources.is_} int")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NestedGenericInGeneric() { await TestAsync( @"class Outer<T> { class Inner<U> { } static void M() { Outer<int>.I$$nner<string> e; } }", MainDescription("class Outer<T>.Inner<U>"), TypeParameterMap( Lines($"\r\nT {FeaturesResources.is_} int", $"U {FeaturesResources.is_} string"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ObjectInitializer1() { await TestInClassAsync( @"void M() { var x = new test() { $$z = 5 }; } class test { public int z; }", MainDescription($"({FeaturesResources.field}) int test.z")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ObjectInitializer2() { await TestInMethodAsync( @"class C { void M() { var x = new test() { z = $$5 }; } class test { public int z; } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(537880, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537880")] public async Task TypeArgument() { await TestAsync( @"class C<T, Y> { void M() { C<int, DateTime> variable; $$variable = new C<int, DateTime>(); } }", MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ForEachLoop_1() { await TestInMethodAsync( @"int bb = 555; bb = bb + 1; foreach (int cc in new int[]{ 1,2,3}){ c$$c = 1; bb = bb + 21; }", MainDescription($"({FeaturesResources.local_variable}) int cc")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_1() { await TestInMethodAsync( @"try { int aa = 555; a$$a = aa + 1; } catch (Exception ex) { } finally { }", MainDescription($"({FeaturesResources.local_variable}) int aa")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_2() { await TestInMethodAsync( @"try { } catch (Exception ex) { var y = e$$x; var z = y; } finally { }", MainDescription($"({FeaturesResources.local_variable}) Exception ex")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_3() { await TestInMethodAsync( @"try { } catch (Exception ex) { var aa = 555; aa = a$$a + 1; } finally { }", MainDescription($"({FeaturesResources.local_variable}) int aa")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TryCatchFinally_4() { await TestInMethodAsync( @"try { } catch (Exception ex) { } finally { int aa = 555; aa = a$$a + 1; }", MainDescription($"({FeaturesResources.local_variable}) int aa")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task GenericVariable() { await TestAsync( @"class C<T, Y> { void M() { C<int, DateTime> variable; var$$iable = new C<int, DateTime>(); } }", MainDescription($"({FeaturesResources.local_variable}) C<int, DateTime> variable")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInstantiation() { await TestAsync( @"using System.Collections.Generic; class Program<T> { static void Main(string[] args) { var p = new Dictio$$nary<int, string>(); } }", MainDescription($"Dictionary<int, string>.Dictionary() (+ 5 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUsingAlias_Bug4141() { await TestAsync( @"using X = A.C; class A { public class C { } } class D : X$$ { }", MainDescription(@"class A.C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestFieldOnDeclaration() { await TestInClassAsync( @"DateTime fie$$ld;", MainDescription($"({FeaturesResources.field}) DateTime C.field")); } [WorkItem(538767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538767")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGenericErrorFieldOnDeclaration() { await TestInClassAsync( @"NonExistentType<int> fi$$eld;", MainDescription($"({FeaturesResources.field}) NonExistentType<int> C.field")); } [WorkItem(538822, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538822")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDelegateType() { await TestInClassAsync( @"Fun$$c<int, string> field;", MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"), TypeParameterMap( Lines($"\r\nT {FeaturesResources.is_} int", $"TResult {FeaturesResources.is_} string"))); } [WorkItem(538824, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538824")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOnDelegateInvocation() { await TestAsync( @"class Program { delegate void D1(); static void Main() { D1 d = Main; $$d(); } }", MainDescription($"({FeaturesResources.local_variable}) D1 d")); } [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOnArrayCreation1() { await TestAsync( @"class Program { static void Main() { int[] a = n$$ew int[0]; } }", MainDescription("int[]")); } [WorkItem(539240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539240")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestOnArrayCreation2() { await TestAsync( @"class Program { static void Main() { int[] a = new i$$nt[0]; } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_ImplicitObjectCreation() { await TestAsync( @"class C { static void Main() { C c = ne$$w(); } } ", MainDescription("C.C()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Constructor_ImplicitObjectCreation_WithParameters() { await TestAsync( @"class C { C(int i) { } C(string s) { } static void Main() { C c = ne$$w(1); } } ", MainDescription($"C.C(int i) (+ 1 {FeaturesResources.overload})")); } [WorkItem(539841, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539841")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIsNamedTypeAccessibleForErrorTypes() { await TestAsync( @"sealed class B<T1, T2> : A<B<T1, T2>> { protected sealed override B<A<T>, A$$<T>> N() { } } internal class A<T> { }", MainDescription("class A<T>")); } [WorkItem(540075, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540075")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType() { await TestAsync( @"using Goo = Goo; class C { void Main() { $$Goo } }", MainDescription("Goo")); } [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestShortDiscardInAssignment() { await TestAsync( @"class C { int M() { $$_ = M(); } }", MainDescription($"({FeaturesResources.discard}) int _")); } [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnderscoreLocalInAssignment() { await TestAsync( @"class C { int M() { var $$_ = M(); } }", MainDescription($"({FeaturesResources.local_variable}) int _")); } [WorkItem(16662, "https://github.com/dotnet/roslyn/issues/16662")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestShortDiscardInOutVar() { await TestAsync( @"class C { void M(out int i) { M(out $$_); i = 0; } }", MainDescription($"({FeaturesResources.discard}) int _")); } [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDiscardInOutVar() { await TestAsync( @"class C { void M(out int i) { M(out var $$_); i = 0; } }"); // No quick info (see issue #16667) } [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDiscardInIsPattern() { await TestAsync( @"class C { void M() { if (3 is int $$_) { } } }"); // No quick info (see issue #16667) } [WorkItem(16667, "https://github.com/dotnet/roslyn/issues/16667")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDiscardInSwitchPattern() { await TestAsync( @"class C { void M() { switch (3) { case int $$_: return; } } }"); // No quick info (see issue #16667) } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLambdaDiscardParameter_FirstDiscard() { await TestAsync( @"class C { void M() { System.Func<string, int, int> f = ($$_, _) => 1; } }", MainDescription($"({FeaturesResources.discard}) string _")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLambdaDiscardParameter_SecondDiscard() { await TestAsync( @"class C { void M() { System.Func<string, int, int> f = (_, $$_) => 1; } }", MainDescription($"({FeaturesResources.discard}) int _")); } [WorkItem(540871, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540871")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLiterals() { await TestAsync( @"class MyClass { MyClass() : this($$10) { intI = 2; } public MyClass(int i) { } static int intI = 1; public static int Main() { return 1; } }", MainDescription("struct System.Int32")); } [WorkItem(541444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541444")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorInForeach() { await TestAsync( @"class C { void Main() { foreach (int cc in null) { $$cc = 1; } } }", MainDescription($"({FeaturesResources.local_variable}) int cc")); } [WorkItem(541678, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541678")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnEvent() { await TestAsync( @"using System; public class SampleEventArgs { public SampleEventArgs(string s) { Text = s; } public String Text { get; private set; } } public class Publisher { public delegate void SampleEventHandler(object sender, SampleEventArgs e); public event SampleEventHandler SampleEvent; protected virtual void RaiseSampleEvent() { if (Sam$$pleEvent != null) SampleEvent(this, new SampleEventArgs(""Hello"")); } }", MainDescription("SampleEventHandler Publisher.SampleEvent")); } [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEvent() { await TestInMethodAsync(@"System.Console.CancelKeyPres$$s += null;", MainDescription("ConsoleCancelEventHandler Console.CancelKeyPress")); } [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventPlusEqualsOperator() { await TestInMethodAsync(@"System.Console.CancelKeyPress +$$= null;", MainDescription("void Console.CancelKeyPress.add")); } [WorkItem(542157, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542157")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventMinusEqualsOperator() { await TestInMethodAsync(@"System.Console.CancelKeyPress -$$= null;", MainDescription("void Console.CancelKeyPress.remove")); } [WorkItem(541885, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541885")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnExtensionMethod() { await TestWithOptionsAsync(Options.Regular, @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { int[] values = { 1 }; bool isArray = 7.I$$n(values); } } public static class MyExtensions { public static bool In<T>(this T o, IEnumerable<T> items) { return true; } }", MainDescription($"({CSharpFeaturesResources.extension}) bool int.In<int>(IEnumerable<int> items)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnExtensionMethodOverloads() { await TestWithOptionsAsync(Options.Regular, @"using System; using System.Linq; class Program { static void Main(string[] args) { ""1"".Test$$Ext(); } } public static class Ex { public static void TestExt<T>(this T ex) { } public static void TestExt<T>(this T ex, T arg) { } public static void TestExt(this string ex, int arg) { } }", MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 2 {FeaturesResources.overloads_})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestQuickInfoOnExtensionMethodOverloads2() { await TestWithOptionsAsync(Options.Regular, @"using System; using System.Linq; class Program { static void Main(string[] args) { ""1"".Test$$Ext(); } } public static class Ex { public static void TestExt<T>(this T ex) { } public static void TestExt<T>(this T ex, T arg) { } public static void TestExt(this int ex, int arg) { } }", MainDescription($"({CSharpFeaturesResources.extension}) void string.TestExt<string>() (+ 1 {FeaturesResources.overload})")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query1() { await TestAsync( @"using System.Linq; class C { void M() { var q = from n in new int[] { 1, 2, 3, 4, 5 } select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query2() { await TestAsync( @"using System.Linq; class C { void M() { var q = from n$$ in new int[] { 1, 2, 3, 4, 5 } select n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query3() { await TestAsync( @"class C { void M() { var q = from n in new int[] { 1, 2, 3, 4, 5 } select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) ? n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query4() { await TestAsync( @"class C { void M() { var q = from n$$ in new int[] { 1, 2, 3, 4, 5 } select n; } }", MainDescription($"({FeaturesResources.range_variable}) ? n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query5() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from n in new List<object>() select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) object n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query6() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from n$$ in new List<object>() select n; } }", MainDescription($"({FeaturesResources.range_variable}) object n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query7() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from int n in new List<object>() select $$n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query8() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from int n$$ in new List<object>() select n; } }", MainDescription($"({FeaturesResources.range_variable}) int n")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query9() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x$$ in new List<List<int>>() from y in x select y; } }", MainDescription($"({FeaturesResources.range_variable}) List<int> x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query10() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x in new List<List<int>>() from y in $$x select y; } }", MainDescription($"({FeaturesResources.range_variable}) List<int> x")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query11() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x in new List<List<int>>() from y$$ in x select y; } }", MainDescription($"({FeaturesResources.range_variable}) int y")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Query12() { await TestAsync( @"using System.Collections.Generic; using System.Linq; class C { void M() { var q = from x in new List<List<int>>() from y in x select $$y; } }", MainDescription($"({FeaturesResources.range_variable}) int y")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMappedEnumerable() { await TestInMethodAsync( @" var q = from i in new int[0] $$select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Select<int, int>(Func<int, int> selector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMappedQueryable() { await TestInMethodAsync( @" var q = from i in new int[0].AsQueryable() $$select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IQueryable<int> IQueryable<int>.Select<int, int>(System.Linq.Expressions.Expression<Func<int, int>> selector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMappedCustom() { await TestAsync( @" using System; using System.Linq; namespace N { public static class LazyExt { public static Lazy<U> Select<T, U>(this Lazy<T> source, Func<T, U> selector) => new Lazy<U>(() => selector(source.Value)); } public class C { public void M() { var lazy = new Lazy<object>(); var q = from i in lazy $$select i; } } } ", MainDescription($"({CSharpFeaturesResources.extension}) Lazy<object> Lazy<object>.Select<object, object>(Func<object, object> selector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectNotMapped() { await TestInMethodAsync( @" var q = from i in new int[0] where true $$select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoLet() { await TestInMethodAsync( @" var q = from i in new int[0] $$let j = true select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<'a> IEnumerable<int>.Select<int, 'a>(Func<int, 'a> selector)"), AnonymousTypes($@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ int i, bool j }}")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoWhere() { await TestInMethodAsync( @" var q = from i in new int[0] $$where true select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Where<int>(Func<int, bool> predicate)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByOneProperty() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByOnePropertyWithOrdering1() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i $$ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByOnePropertyWithOrdering2() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithComma1() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i$$, i select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IOrderedEnumerable<int>.ThenBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithComma2() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i, i select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrdering1() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i, i ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrdering2() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i,$$ i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrdering3() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i, i $$ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IOrderedEnumerable<int>.ThenBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach1() { await TestInMethodAsync( @" var q = from i in new int[0] $$orderby i ascending, i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach2() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i $$ascending, i ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach3() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i ascending ,$$ i ascending select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByTwoPropertiesWithOrderingOnEach4() { await TestInMethodAsync( @" var q = from i in new int[0] orderby i ascending, i $$ascending select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IOrderedEnumerable<int>.ThenBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoOrderByIncomplete() { await TestInMethodAsync( @" var q = from i in new int[0] where i > 0 orderby$$ ", MainDescription($"({CSharpFeaturesResources.extension}) IOrderedEnumerable<int> IEnumerable<int>.OrderBy<int, ?>(Func<int, ?> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMany1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$from i2 in new int[0] select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.SelectMany<int, int, int>(Func<int, IEnumerable<int>> collectionSelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoSelectMany2() { await TestInMethodAsync( @" var q = from i1 in new int[0] from i2 $$in new int[0] select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.SelectMany<int, int, int>(Func<int, IEnumerable<int>> collectionSelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoGroupBy1() { await TestInMethodAsync( @" var q = from i in new int[0] $$group i by i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IGrouping<int, int>> IEnumerable<int>.GroupBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoGroupBy2() { await TestInMethodAsync( @" var q = from i in new int[0] group i $$by i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IGrouping<int, int>> IEnumerable<int>.GroupBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoGroupByInto() { await TestInMethodAsync( @" var q = from i in new int[0] $$group i by i into g select g; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IGrouping<int, int>> IEnumerable<int>.GroupBy<int, int>(Func<int, int> keySelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$join i2 in new int[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin2() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 $$in new int[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin3() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 in new int[0] $$on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoin4() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 in new int[0] on i1 $$equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoinInto1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$join i2 in new int[0] on i1 equals i2 into g select g; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<IEnumerable<int>> IEnumerable<int>.GroupJoin<int, int, int, IEnumerable<int>>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, IEnumerable<int>, IEnumerable<int>> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoJoinInto2() { await TestInMethodAsync( @" var q = from i1 in new int[0] join i2 in new int[0] on i1 equals i2 $$into g select g; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoFromMissing() { await TestInMethodAsync( @" var q = $$from i in new int[0] select i; "); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSimple1() { await TestInMethodAsync( @" var q = $$from double i in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<double> System.Collections.IEnumerable.Cast<double>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSimple2() { await TestInMethodAsync( @" var q = from double i $$in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<double> System.Collections.IEnumerable.Cast<double>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSelectMany1() { await TestInMethodAsync( @" var q = from i in new int[0] $$from double d in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.SelectMany<int, double, int>(Func<int, IEnumerable<double>> collectionSelector, Func<int, double, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableSelectMany2() { await TestInMethodAsync( @" var q = from i in new int[0] from double d $$in new int[0] select i; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<double> System.Collections.IEnumerable.Cast<double>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin1() { await TestInMethodAsync( @" var q = from i1 in new int[0] $$join int i2 in new double[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin2() { await TestInMethodAsync( @" var q = from i1 in new int[0] join int i2 $$in new double[0] on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> System.Collections.IEnumerable.Cast<int>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin3() { await TestInMethodAsync( @" var q = from i1 in new int[0] join int i2 in new double[0] $$on i1 equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23394, "https://github.com/dotnet/roslyn/issues/23394")] public async Task QueryMethodinfoRangeVariableJoin4() { await TestInMethodAsync( @" var q = from i1 in new int[0] join int i2 in new double[0] on i1 $$equals i2 select i1; ", MainDescription($"({CSharpFeaturesResources.extension}) IEnumerable<int> IEnumerable<int>.Join<int, int, int, int>(IEnumerable<int> inner, Func<int, int> outerKeySelector, Func<int, int> innerKeySelector, Func<int, int, int> resultSelector)")); } [WorkItem(543205, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543205")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorGlobal() { await TestAsync( @"extern alias global; class myClass { static int Main() { $$global::otherClass oc = new global::otherClass(); return 0; } }", MainDescription("<global namespace>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DontRemoveAttributeSuffixAndProduceInvalidIdentifier1() { await TestAsync( @"using System; class classAttribute : Attribute { private classAttribute x$$; }", MainDescription($"({FeaturesResources.field}) classAttribute classAttribute.x")); } [WorkItem(544026, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544026")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DontRemoveAttributeSuffix2() { await TestAsync( @"using System; class class1Attribute : Attribute { private class1Attribute x$$; }", MainDescription($"({FeaturesResources.field}) class1Attribute class1Attribute.x")); } [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AttributeQuickInfoBindsToClassTest() { await TestAsync( @"using System; /// <summary> /// class comment /// </summary> [Some$$] class SomeAttribute : Attribute { /// <summary> /// ctor comment /// </summary> public SomeAttribute() { } }", Documentation("class comment")); } [WorkItem(1696, "https://github.com/dotnet/roslyn/issues/1696")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AttributeConstructorQuickInfo() { await TestAsync( @"using System; /// <summary> /// class comment /// </summary> class SomeAttribute : Attribute { /// <summary> /// ctor comment /// </summary> public SomeAttribute() { var s = new Some$$Attribute(); } }", Documentation("ctor comment")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLabel() { await TestInClassAsync( @"void M() { Goo: int Goo; goto Goo$$; }", MainDescription($"({FeaturesResources.label}) Goo")); } [WorkItem(542613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542613")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnboundGeneric() { await TestAsync( @"using System; using System.Collections.Generic; class C { void M() { Type t = typeof(L$$ist<>); } }", MainDescription("class System.Collections.Generic.List<T>"), NoTypeParameterMap); } [WorkItem(543113, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543113")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAnonymousTypeNew1() { await TestAsync( @"class C { void M() { var v = $$new { }; } }", MainDescription(@"AnonymousType 'a"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ }}")); } [WorkItem(543873, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543873")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNestedAnonymousType() { // verify nested anonymous types are listed in the same order for different properties // verify first property await TestInMethodAsync( @"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } }; x[0].$$Address", MainDescription(@"'b 'a.Address { get; }"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ string Name, 'b Address }} 'b {FeaturesResources.is_} new {{ string Street, string Zip }}")); // verify second property await TestInMethodAsync( @"var x = new[] { new { Name = ""BillG"", Address = new { Street = ""1 Microsoft Way"", Zip = ""98052"" } } }; x[0].$$Name", MainDescription(@"string 'a.Name { get; }"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ string Name, 'b Address }} 'b {FeaturesResources.is_} new {{ string Street, string Zip }}")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(543183, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543183")] public async Task TestAssignmentOperatorInAnonymousType() { await TestAsync( @"class C { void M() { var a = new { A $$= 0 }; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(10731, "DevDiv_Projects/Roslyn")] public async Task TestErrorAnonymousTypeDoesntShow() { await TestInMethodAsync( @"var a = new { new { N = 0 }.N, new { } }.$$N;", MainDescription(@"int 'a.N { get; }"), NoTypeParameterMap, AnonymousTypes( $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ int N }}")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(543553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543553")] public async Task TestArrayAssignedToVar() { await TestAsync( @"class C { static void M(string[] args) { v$$ar a = args; } }", MainDescription("string[]")); } [WorkItem(529139, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529139")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ColorColorRangeVariable() { await TestAsync( @"using System.Collections.Generic; using System.Linq; namespace N1 { class yield { public static IEnumerable<yield> Bar() { foreach (yield yield in from yield in new yield[0] select y$$ield) { yield return yield; } } } }", MainDescription($"({FeaturesResources.range_variable}) N1.yield yield")); } [WorkItem(543550, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543550")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoOnOperator() { await TestAsync( @"using System.Collections.Generic; class Program { static void Main(string[] args) { var v = new Program() $$+ string.Empty; } public static implicit operator Program(string s) { return null; } public static IEnumerable<Program> operator +(Program p1, Program p2) { yield return p1; yield return p2; } }", MainDescription("IEnumerable<Program> Program.operator +(Program p1, Program p2)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantField() { await TestAsync( @"class C { const int $$F = 1;", MainDescription($"({FeaturesResources.constant}) int C.F = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestMultipleConstantFields() { await TestAsync( @"class C { public const double X = 1.0, Y = 2.0, $$Z = 3.5;", MainDescription($"({FeaturesResources.constant}) double C.Z = 3.5")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantDependencies() { await TestAsync( @"class A { public const int $$X = B.Z + 1; public const int Y = 10; } class B { public const int Z = A.Y + 1; }", MainDescription($"({FeaturesResources.constant}) int A.X = B.Z + 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantCircularDependencies() { await TestAsync( @"class A { public const int X = B.Z + 1; } class B { public const int Z$$ = A.X + 1; }", MainDescription($"({FeaturesResources.constant}) int B.Z = A.X + 1")); } [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantOverflow() { await TestAsync( @"class B { public const int Z$$ = int.MaxValue + 1; }", MainDescription($"({FeaturesResources.constant}) int B.Z = int.MaxValue + 1")); } [WorkItem(544620, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544620")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantOverflowInUncheckedContext() { await TestAsync( @"class B { public const int Z$$ = unchecked(int.MaxValue + 1); }", MainDescription($"({FeaturesResources.constant}) int B.Z = unchecked(int.MaxValue + 1)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEnumInConstantField() { await TestAsync( @"public class EnumTest { enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat }; static void Main() { const int $$x = (int)Days.Sun; } }", MainDescription($"({FeaturesResources.local_constant}) int x = (int)Days.Sun")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantInDefaultExpression() { await TestAsync( @"public class EnumTest { enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat }; static void Main() { const Days $$x = default(Days); } }", MainDescription($"({FeaturesResources.local_constant}) Days x = default(Days)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantParameter() { await TestAsync( @"class C { void Bar(int $$b = 1); }", MainDescription($"({FeaturesResources.parameter}) int b = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestConstantLocal() { await TestAsync( @"class C { void Bar() { const int $$loc = 1; }", MainDescription($"({FeaturesResources.local_constant}) int loc = 1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType1() { await TestInMethodAsync( @"var $$v1 = new Goo();", MainDescription($"({FeaturesResources.local_variable}) Goo v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType2() { await TestInMethodAsync( @"var $$v1 = v1;", MainDescription($"({FeaturesResources.local_variable}) var v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType3() { await TestInMethodAsync( @"var $$v1 = new Goo<Bar>();", MainDescription($"({FeaturesResources.local_variable}) Goo<Bar> v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType4() { await TestInMethodAsync( @"var $$v1 = &(x => x);", MainDescription($"({FeaturesResources.local_variable}) ?* v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType5() { await TestInMethodAsync("var $$v1 = &v1", MainDescription($"({FeaturesResources.local_variable}) var* v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType6() { await TestInMethodAsync("var $$v1 = new Goo[1]", MainDescription($"({FeaturesResources.local_variable}) Goo[] v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType7() { await TestInClassAsync( @"class C { void Method() { } void Goo() { var $$v1 = MethodGroup; } }", MainDescription($"({FeaturesResources.local_variable}) ? v1")); } [WorkItem(544416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544416")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestErrorType8() { await TestInMethodAsync("var $$v1 = Unknown", MainDescription($"({FeaturesResources.local_variable}) ? v1")); } [WorkItem(545072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545072")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDelegateSpecialTypes() { await TestAsync( @"delegate void $$F(int x);", MainDescription("delegate void F(int x)")); } [WorkItem(545108, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545108")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullPointerParameter() { await TestAsync( @"class C { unsafe void $$Goo(int* x = null) { } }", MainDescription("void C.Goo([int* x = null])")); } [WorkItem(545098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545098")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestLetIdentifier1() { await TestInMethodAsync("var q = from e in \"\" let $$y = 1 let a = new { y } select a;", MainDescription($"({FeaturesResources.range_variable}) int y")); } [WorkItem(545295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545295")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNullableDefaultValue() { await TestAsync( @"class Test { void $$Method(int? t1 = null) { } }", MainDescription("void Test.Method([int? t1 = null])")); } [WorkItem(529586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529586")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInvalidParameterInitializer() { await TestAsync( @"class Program { void M1(float $$j1 = ""Hello"" + ""World"") { } }", MainDescription($@"({FeaturesResources.parameter}) float j1 = ""Hello"" + ""World""")); } [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestComplexConstLocal() { await TestAsync( @"class Program { void Main() { const int MEGABYTE = 1024 * 1024 + true; Blah($$MEGABYTE); } }", MainDescription($@"({FeaturesResources.local_constant}) int MEGABYTE = 1024 * 1024 + true")); } [WorkItem(545230, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545230")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestComplexConstField() { await TestAsync( @"class Program { const int a = true - false; void Main() { Goo($$a); } }", MainDescription($"({FeaturesResources.constant}) int Program.a = true - false")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTypeParameterCrefDoesNotHaveQuickInfo() { await TestAsync( @"class C<T> { /// <see cref=""C{X$$}""/> static void Main(string[] args) { } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref1() { await TestAsync( @"class Program { /// <see cref=""Mai$$n""/> static void Main(string[] args) { } }", MainDescription(@"void Program.Main(string[] args)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref2() { await TestAsync( @"class Program { /// <see cref=""$$Main""/> static void Main(string[] args) { } }", MainDescription(@"void Program.Main(string[] args)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref3() { await TestAsync( @"class Program { /// <see cref=""Main""$$/> static void Main(string[] args) { } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref4() { await TestAsync( @"class Program { /// <see cref=""Main$$""/> static void Main(string[] args) { } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref5() { await TestAsync( @"class Program { /// <see cref=""Main""$$/> static void Main(string[] args) { } }"); } [WorkItem(546849, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546849")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestIndexedProperty() { var markup = @"class Program { void M() { CCC c = new CCC(); c.Index$$Prop[0] = ""s""; } }"; // Note that <COMImport> is required by compiler. Bug 17013 tracks enabling indexed property for non-COM types. var referencedCode = @"Imports System.Runtime.InteropServices <ComImport()> <GuidAttribute(CCC.ClassId)> Public Class CCC #Region ""COM GUIDs"" Public Const ClassId As String = ""9d965fd2-1514-44f6-accd-257ce77c46b0"" Public Const InterfaceId As String = ""a9415060-fdf0-47e3-bc80-9c18f7f39cf6"" Public Const EventsId As String = ""c6a866a5-5f97-4b53-a5df-3739dc8ff1bb"" # End Region ''' <summary> ''' An index property from VB ''' </summary> ''' <param name=""p1"">p1 is an integer index</param> ''' <returns>A string</returns> Public Property IndexProp(ByVal p1 As Integer, Optional ByVal p2 As Integer = 0) As String Get Return Nothing End Get Set(ByVal value As String) End Set End Property End Class"; await TestWithReferenceAsync(sourceCode: markup, referencedCode: referencedCode, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.VisualBasic, expectedResults: MainDescription("string CCC.IndexProp[int p1, [int p2 = 0]] { get; set; }")); } [WorkItem(546918, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546918")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnconstructedGeneric() { await TestAsync( @"class A<T> { enum SortOrder { Ascending, Descending, None } void Goo() { var b = $$SortOrder.Ascending; } }", MainDescription(@"enum A<T>.SortOrder")); } [WorkItem(546970, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546970")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestUnconstructedGenericInCRef() { await TestAsync( @"/// <see cref=""$$C{T}"" /> class C<T> { }", MainDescription(@"class C<T>")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAwaitableMethod() { var markup = @"using System.Threading.Tasks; class C { async Task Goo() { Go$$o(); } }"; var description = $"({CSharpFeaturesResources.awaitable}) Task C.Goo()"; await VerifyWithMscorlib45Async(markup, new[] { MainDescription(description) }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ObsoleteItem() { var markup = @" using System; class Program { [Obsolete] public void goo() { go$$o(); } }"; await TestAsync(markup, MainDescription($"[{CSharpFeaturesResources.deprecated}] void Program.goo()")); } [WorkItem(751070, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751070")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DynamicOperator() { var markup = @" public class Test { public delegate void NoParam(); static int Main() { dynamic x = new object(); if (((System.Func<dynamic>)(() => (x =$$= null)))()) return 0; return 1; } }"; await TestAsync(markup, MainDescription("dynamic dynamic.operator ==(dynamic left, dynamic right)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TextOnlyDocComment() { await TestAsync( @"/// <summary> ///goo /// </summary> class C$$ { }", Documentation("goo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTrimConcatMultiLine() { await TestAsync( @"/// <summary> /// goo /// bar /// </summary> class C$$ { }", Documentation("goo bar")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref() { await TestAsync( @"/// <summary> /// <see cref=""C""/> /// <seealso cref=""C""/> /// </summary> class C$$ { }", Documentation("C C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExcludeTextOutsideSummaryBlock() { await TestAsync( @"/// red /// <summary> /// green /// </summary> /// yellow class C$$ { }", Documentation("green")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NewlineAfterPara() { await TestAsync( @"/// <summary> /// <para>goo</para> /// </summary> class C$$ { }", Documentation("goo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TextOnlyDocComment_Metadata() { var referenced = @" /// <summary> ///goo /// </summary> public class C { }"; var code = @" class G { void goo() { C$$ c; } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("goo")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestTrimConcatMultiLine_Metadata() { var referenced = @" /// <summary> /// goo /// bar /// </summary> public class C { }"; var code = @" class G { void goo() { C$$ c; } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("goo bar")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestCref_Metadata() { var code = @" class G { void goo() { C$$ c; } }"; var referenced = @"/// <summary> /// <see cref=""C""/> /// <seealso cref=""C""/> /// </summary> public class C { }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("C C")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExcludeTextOutsideSummaryBlock_Metadata() { var code = @" class G { void goo() { C$$ c; } }"; var referenced = @" /// red /// <summary> /// green /// </summary> /// yellow public class C { }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("green")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] arg$$s, T otherParam) { } }", Documentation("First parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param_Metadata() { var code = @" class G { void goo() { C c; c.Goo<int>(arg$$s: new string[] { }, 1); } }"; var referenced = @" /// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] args, T otherParam) { } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("First parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param2() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] args, T oth$$erParam) { } }", Documentation("Another parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Param2_Metadata() { var code = @" class G { void goo() { C c; c.Goo<int>(args: new string[] { }, other$$Param: 1); } }"; var referenced = @" /// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{ T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T>(string[] args, T otherParam) { } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("Another parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TypeParam() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""Goo{T} (string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T$$>(string[] args, T otherParam) { } }", Documentation("A type parameter of C.Goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnboundCref() { await TestAsync( @"/// <summary></summary> public class C { /// <typeparam name=""T"">A type parameter of <see cref=""goo{T}(string[], T)""/></typeparam> /// <param name=""args"">First parameter of <see cref=""Goo{T} (string[], T)""/></param> /// <param name=""otherParam"">Another parameter of <see cref=""Goo{T}(string[], T)""/></param> public void Goo<T$$>(string[] args, T otherParam) { } }", Documentation("A type parameter of goo<T>(string[], T)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInConstructor() { await TestAsync( @"public class TestClass { /// <summary> /// This sample shows how to specify the <see cref=""TestClass""/> constructor as a cref attribute. /// </summary> public TestClass$$() { } }", Documentation("This sample shows how to specify the TestClass constructor as a cref attribute.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInConstructorOverloaded() { await TestAsync( @"public class TestClass { /// <summary> /// This sample shows how to specify the <see cref=""TestClass""/> constructor as a cref attribute. /// </summary> public TestClass() { } /// <summary> /// This sample shows how to specify the <see cref=""TestClass(int)""/> constructor as a cref attribute. /// </summary> public TestC$$lass(int value) { } }", Documentation("This sample shows how to specify the TestClass(int) constructor as a cref attribute.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInGenericMethod1() { await TestAsync( @"public class TestClass { /// <summary> /// The GetGenericValue method. /// <para>This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute.</para> /// </summary> public static T GetGenericVa$$lue<T>(T para) { return para; } }", Documentation("The GetGenericValue method.\r\n\r\nThis sample shows how to specify the TestClass.GetGenericValue<T>(T) method as a cref attribute.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInGenericMethod2() { await TestAsync( @"public class TestClass { /// <summary> /// The GetGenericValue method. /// <para>This sample shows how to specify the <see cref=""GetGenericValue{T}(T)""/> method as a cref attribute.</para> /// </summary> public static T GetGenericVa$$lue<T>(T para) { return para; } }", Documentation("The GetGenericValue method.\r\n\r\nThis sample shows how to specify the TestClass.GetGenericValue<T>(T) method as a cref attribute.")); } [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInMethodOverloading1() { await TestAsync( @"public class TestClass { public static int GetZero() { GetGenericValu$$e(); GetGenericValue(5); } /// <summary> /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method /// </summary> public static T GetGenericValue<T>(T para) { return para; } /// <summary> /// This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute. /// </summary> public static void GetGenericValue() { } }", Documentation("This sample shows how to specify the TestClass.GetGenericValue() method as a cref attribute.")); } [WorkItem(813350, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813350")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInMethodOverloading2() { await TestAsync( @"public class TestClass { public static int GetZero() { GetGenericValue(); GetGenericVal$$ue(5); } /// <summary> /// This sample shows how to call the <see cref=""GetGenericValue{T}(T)""/> method /// </summary> public static T GetGenericValue<T>(T para) { return para; } /// <summary> /// This sample shows how to specify the <see cref=""GetGenericValue""/> method as a cref attribute. /// </summary> public static void GetGenericValue() { } }", Documentation("This sample shows how to call the TestClass.GetGenericValue<T>(T) method")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task CrefInGenericType() { await TestAsync( @"/// <summary> /// <remarks>This example shows how to specify the <see cref=""GenericClass{T}""/> cref.</remarks> /// </summary> class Generic$$Class<T> { }", Documentation("This example shows how to specify the GenericClass<T> cref.", ExpectedClassifications( Text("This example shows how to specify the"), WhiteSpace(" "), Class("GenericClass"), Punctuation.OpenAngle, TypeParameter("T"), Punctuation.CloseAngle, WhiteSpace(" "), Text("cref.")))); } [WorkItem(812720, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/812720")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ClassificationOfCrefsFromMetadata() { var code = @" class G { void goo() { C c; c.Go$$o(); } }"; var referenced = @" /// <summary></summary> public class C { /// <summary> /// See <see cref=""Goo""/> method /// </summary> public void Goo() { } }"; await TestWithMetadataReferenceHelperAsync(code, referenced, "C#", "C#", Documentation("See C.Goo() method", ExpectedClassifications( Text("See"), WhiteSpace(" "), Class("C"), Punctuation.Text("."), Identifier("Goo"), Punctuation.OpenParen, Punctuation.CloseParen, WhiteSpace(" "), Text("method")))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FieldAvailableInBothLinkedFiles() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { int x; void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.field}) int C.x"), Usage("") }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FieldUnavailableInOneLinkedFile() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(37097, "https://github.com/dotnet/roslyn/issues/37097")] public async Task BindSymbolInOtherFile() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""GOO""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Not_Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task FieldUnavailableInTwoLinkedFiles() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif void goo() { x$$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage( $"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj3", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ExcludeFilesWithInactiveRegions() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO,BAR""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO int x; #endif #if BAR void goo() { x$$ } #endif } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument"" /> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3"" PreprocessorSymbols=""BAR""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj3", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true); await VerifyWithReferenceWorkerAsync(markup, new[] { expectedDescription }); } [WorkItem(962353, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/962353")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NoValidSymbolsInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void goo() { B$$ar(); } #if B void Bar() { } #endif } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalsValidInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void M() { int x$$; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage("") }); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LocalWarningInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""PROJ1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void M() { #if PROJ1 int x; #endif int y = x$$; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.local_variable}) int x"), Usage($"\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_contexts}", expectsWarningGlyph: true) }); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task LabelsValidInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void M() { $$LABEL: goto LABEL; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.label}) LABEL"), Usage("") }); } [WorkItem(1020944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1020944")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task RangeVariablesValidInLinkedDocuments() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1""> <Document FilePath=""SourceDocument""><![CDATA[ using System.Linq; class C { void M() { var x = from y in new[] {1, 2, 3} select $$y; } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; await VerifyWithReferenceWorkerAsync(markup, new[] { MainDescription($"({FeaturesResources.range_variable}) int y"), Usage("") }); } [WorkItem(1019766, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1019766")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task PointerAccessibility() { var markup = @"class C { unsafe static void Main() { void* p = null; void* q = null; dynamic d = true; var x = p =$$= q == d; } }"; await TestAsync(markup, MainDescription("bool void*.operator ==(void* left, void* right)")); } [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AwaitingTaskOfArrayType() { var markup = @" using System.Threading.Tasks; class Program { async Task<int[]> M() { awa$$it M(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "int[]"))); } [WorkItem(1114300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1114300")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task AwaitingTaskOfDynamic() { var markup = @" using System.Threading.Tasks; class Program { async Task<dynamic> M() { awa$$it M(); } }"; await TestAsync(markup, MainDescription(string.Format(FeaturesResources.Awaited_task_returns_0, "dynamic"))); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task MethodOverloadDifferencesIgnored() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if ONE void Do(int x){} #endif #if TWO void Do(string x){} #endif void Shared() { this.Do$$ } }]]></Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = $"void C.Do(int x)"; await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription)); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task MethodOverloadDifferencesIgnored_ContainingType() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE""> <Document FilePath=""SourceDocument""><![CDATA[ class C { void Shared() { var x = GetThing().Do$$(); } #if ONE private Methods1 GetThing() { return new Methods1(); } #endif #if TWO private Methods2 GetThing() { return new Methods2(); } #endif } #if ONE public class Methods1 { public void Do(string x) { } } #endif #if TWO public class Methods2 { public void Do(string x) { } } #endif ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = $"void Methods1.Do(string x)"; await VerifyWithReferenceWorkerAsync(markup, MainDescription(expectedDescription)); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(4868, "https://github.com/dotnet/roslyn/issues/4868")] public async Task QuickInfoExceptions() { await TestAsync( @"using System; namespace MyNs { class MyException1 : Exception { } class MyException2 : Exception { } class TestClass { /// <exception cref=""MyException1""></exception> /// <exception cref=""T:MyNs.MyException2""></exception> /// <exception cref=""System.Int32""></exception> /// <exception cref=""double""></exception> /// <exception cref=""Not_A_Class_But_Still_Displayed""></exception> void M() { M$$(); } } }", Exceptions($"\r\n{WorkspacesResources.Exceptions_colon}\r\n MyException1\r\n MyException2\r\n int\r\n double\r\n Not_A_Class_But_Still_Displayed")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLocalFunction() { await TestAsync(@" class C { void M() { int i; local$$(); void local() { i++; this.M(); } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLocalFunction2() { await TestAsync(@" class C { void M() { int i; local$$(i); void local(int j) { j++; M(); } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLocalFunction3() { await TestAsync(@" class C { public void M(int @this) { int i = 0; local$$(); void local() { M(1); i++; @this++; } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, @this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction4() { await TestAsync(@" class C { int field; void M() { void OuterLocalFunction$$() { int local = 0; int InnerLocalFunction() { field++; return local; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction5() { await TestAsync(@" class C { int field; void M() { void OuterLocalFunction() { int local = 0; int InnerLocalFunction$$() { field++; return local; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, local")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction6() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; void OuterLocalFunction$$() { _ = local1; void InnerLocalFunction() { _ = local2; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local1, local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLocalFunction7() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; void OuterLocalFunction() { _ = local1; void InnerLocalFunction$$() { _ = local2; } } } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda() { await TestAsync(@" class C { void M() { int i; System.Action a = () =$$> { i++; M(); }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda2() { await TestAsync(@" class C { void M() { int i; System.Action<int> a = j =$$> { i++; j++; M(); }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda2_DifferentOrder() { await TestAsync(@" class C { void M(int j) { int i; System.Action a = () =$$> { M(); i++; j++; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, j, i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda3() { await TestAsync(@" class C { void M() { int i; int @this; N(() =$$> { M(); @this++; }, () => { i++; }); } void N(System.Action x, System.Action y) { } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, @this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnLambda4() { await TestAsync(@" class C { void M() { int i; N(() => { M(); }, () =$$> { i++; }); } void N(System.Action x, System.Action y) { } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda5() { await TestAsync(@" class C { int field; void M() { System.Action a = () =$$> { int local = 0; System.Func<int> b = () => { field++; return local; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda6() { await TestAsync(@" class C { int field; void M() { System.Action a = () => { int local = 0; System.Func<int> b = () =$$> { field++; return local; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} this, local")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda7() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; System.Action a = () =$$> { _ = local1; System.Action b = () => { _ = local2; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local1, local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(26101, "https://github.com/dotnet/roslyn/issues/26101")] public async Task QuickInfoCapturesOnLambda8() { await TestAsync(@" class C { int field; void M() { int local1 = 0; int local2 = 0; System.Action a = () => { _ = local1; System.Action b = () =$$> { _ = local2; }; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} local2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(23307, "https://github.com/dotnet/roslyn/issues/23307")] public async Task QuickInfoCapturesOnDelegate() { await TestAsync(@" class C { void M() { int i; System.Func<bool, int> f = dele$$gate(bool b) { i++; return 1; }; } }", Captures($"\r\n{WorkspacesResources.Variables_captured_colon} i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(1516, "https://github.com/dotnet/roslyn/issues/1516")] public async Task QuickInfoWithNonStandardSeeAttributesAppear() { await TestAsync( @"class C { /// <summary> /// <see cref=""System.String"" /> /// <see href=""http://microsoft.com"" /> /// <see langword=""null"" /> /// <see unsupported-attribute=""cat"" /> /// </summary> void M() { M$$(); } }", Documentation(@"string http://microsoft.com null cat")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(6657, "https://github.com/dotnet/roslyn/issues/6657")] public async Task OptionalParameterFromPreviousSubmission() { const string workspaceDefinition = @" <Workspace> <Submission Language=""C#"" CommonReferences=""true""> void M(int x = 1) { } </Submission> <Submission Language=""C#"" CommonReferences=""true""> M(x$$: 2) </Submission> </Workspace> "; using var workspace = TestWorkspace.Create(XElement.Parse(workspaceDefinition), workspaceKind: WorkspaceKind.Interactive); await TestWithOptionsAsync(workspace, MainDescription($"({ FeaturesResources.parameter }) int x = 1")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TupleProperty() { await TestInMethodAsync( @"interface I { (int, int) Name { get; set; } } class C : I { (int, int) I.Name$$ { get { throw new System.Exception(); } set { } } }", MainDescription("(int, int) C.Name { get; set; }")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity0VariableName() { await TestAsync( @" using System; public class C { void M() { var y$$ = ValueTuple.Create(); } } ", MainDescription($"({ FeaturesResources.local_variable }) ValueTuple y")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity0ImplicitVar() { await TestAsync( @" using System; public class C { void M() { var$$ y = ValueTuple.Create(); } } ", MainDescription("struct System.ValueTuple")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity1VariableName() { await TestAsync( @" using System; public class C { void M() { var y$$ = ValueTuple.Create(1); } } ", MainDescription($"({ FeaturesResources.local_variable }) ValueTuple<int> y")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity1ImplicitVar() { await TestAsync( @" using System; public class C { void M() { var$$ y = ValueTuple.Create(1); } } ", MainDescription("struct System.ValueTuple<System.Int32>")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity2VariableName() { await TestAsync( @" using System; public class C { void M() { var y$$ = ValueTuple.Create(1, 1); } } ", MainDescription($"({ FeaturesResources.local_variable }) (int, int) y")); } [WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ValueTupleWithArity2ImplicitVar() { await TestAsync( @" using System; public class C { void M() { var$$ y = ValueTuple.Create(1, 1); } } ", MainDescription("(System.Int32, System.Int32)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefMethod() { await TestInMethodAsync( @"using System; class Program { static void Main(string[] args) { ref int i = ref $$goo(); } private static ref int goo() { throw new NotImplementedException(); } }", MainDescription("ref int Program.goo()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefLocal() { await TestInMethodAsync( @"using System; class Program { static void Main(string[] args) { ref int $$i = ref goo(); } private static ref int goo() { throw new NotImplementedException(); } }", MainDescription($"({FeaturesResources.local_variable}) ref int i")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(410932, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=410932")] public async Task TestGenericMethodInDocComment() { await TestAsync( @" class Test { T F<T>() { F<T>(); } /// <summary> /// <see cref=""F$${T}()""/> /// </summary> void S() { } } ", MainDescription("T Test.F<T>()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(403665, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=403665&_a=edit")] public async Task TestExceptionWithCrefToConstructorDoesNotCrash() { await TestAsync( @" class Test { /// <summary> /// </summary> /// <exception cref=""Test.Test""/> public Test$$() {} } ", MainDescription("Test.Test()")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefStruct() { var markup = "ref struct X$$ {}"; await TestAsync(markup, MainDescription("ref struct X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefStruct_Nested() { var markup = @" namespace Nested { ref struct X$$ {} }"; await TestAsync(markup, MainDescription("ref struct Nested.X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyStruct() { var markup = "readonly struct X$$ {}"; await TestAsync(markup, MainDescription("readonly struct X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyStruct_Nested() { var markup = @" namespace Nested { readonly struct X$$ {} }"; await TestAsync(markup, MainDescription("readonly struct Nested.X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyRefStruct() { var markup = "readonly ref struct X$$ {}"; await TestAsync(markup, MainDescription("readonly ref struct X")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestReadOnlyRefStruct_Nested() { var markup = @" namespace Nested { readonly ref struct X$$ {} }"; await TestAsync(markup, MainDescription("readonly ref struct Nested.X")); } [WorkItem(22450, "https://github.com/dotnet/roslyn/issues/22450")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestRefLikeTypesNoDeprecated() { var xmlString = @" <Workspace> <Project Language=""C#"" LanguageVersion=""7.2"" CommonReferences=""true""> <MetadataReferenceFromSource Language=""C#"" LanguageVersion=""7.2"" CommonReferences=""true""> <Document FilePath=""ReferencedDocument""> public ref struct TestRef { } </Document> </MetadataReferenceFromSource> <Document FilePath=""SourceDocument""> ref struct Test { private $$TestRef _field; } </Document> </Project> </Workspace>"; // There should be no [deprecated] attribute displayed. await VerifyWithReferenceWorkerAsync(xmlString, MainDescription($"ref struct TestRef")); } [WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task PropertyWithSameNameAsOtherType() { await TestAsync( @"namespace ConsoleApplication1 { class Program { static A B { get; set; } static B A { get; set; } static void Main(string[] args) { B = ConsoleApplication1.B$$.F(); } } class A { } class B { public static A F() => null; } }", MainDescription($"ConsoleApplication1.A ConsoleApplication1.B.F()")); } [WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task PropertyWithSameNameAsOtherType2() { await TestAsync( @"using System.Collections.Generic; namespace ConsoleApplication1 { class Program { public static List<Bar> Bar { get; set; } static void Main(string[] args) { Tes$$t<Bar>(); } static void Test<T>() { } } class Bar { } }", MainDescription($"void Program.Test<Bar>()")); } [WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task InMalformedEmbeddedStatement_01() { await TestAsync( @" class Program { void method1() { if (method2()) .Any(b => b.Content$$Type, out var chars) { } } } "); } [WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task InMalformedEmbeddedStatement_02() { await TestAsync( @" class Program { void method1() { if (method2()) .Any(b => b$$.ContentType, out var chars) { } } } ", MainDescription($"({ FeaturesResources.parameter }) ? b")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task EnumConstraint() { await TestInMethodAsync( @" class X<T> where T : System.Enum { private $$T x; }", MainDescription($"T {FeaturesResources.in_} X<T> where T : Enum")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DelegateConstraint() { await TestInMethodAsync( @" class X<T> where T : System.Delegate { private $$T x; }", MainDescription($"T {FeaturesResources.in_} X<T> where T : Delegate")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task MulticastDelegateConstraint() { await TestInMethodAsync( @" class X<T> where T : System.MulticastDelegate { private $$T x; }", MainDescription($"T {FeaturesResources.in_} X<T> where T : MulticastDelegate")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_Type() { await TestAsync( @" class $$X<T> where T : unmanaged { }", MainDescription("class X<T> where T : unmanaged")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_Method() { await TestAsync( @" class X { void $$M<T>() where T : unmanaged { } }", MainDescription("void X.M<T>() where T : unmanaged")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_Delegate() { await TestAsync( "delegate void $$D<T>() where T : unmanaged;", MainDescription("delegate void D<T>() where T : unmanaged")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task UnmanagedConstraint_LocalFunction() { await TestAsync( @" class X { void N() { void $$M<T>() where T : unmanaged { } } }", MainDescription("void M<T>() where T : unmanaged")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestGetAccessorDocumentation() { await TestAsync( @" class X { /// <summary>Summary for property Goo</summary> int Goo { g$$et; set; } }", Documentation("Summary for property Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestSetAccessorDocumentation() { await TestAsync( @" class X { /// <summary>Summary for property Goo</summary> int Goo { get; s$$et; } }", Documentation("Summary for property Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventAddDocumentation1() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo { a$$dd => throw null; remove => throw null; } }", Documentation("Summary for event Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventAddDocumentation2() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo; void M() => Goo +$$= null; }", Documentation("Summary for event Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventRemoveDocumentation1() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo { add => throw null; r$$emove => throw null; } }", Documentation("Summary for event Goo")); } [WorkItem(29703, "https://github.com/dotnet/roslyn/issues/29703")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestEventRemoveDocumentation2() { await TestAsync( @" using System; class X { /// <summary>Summary for event Goo</summary> event EventHandler<EventArgs> Goo; void M() => Goo -$$= null; }", Documentation("Summary for event Goo")); } [WorkItem(30642, "https://github.com/dotnet/roslyn/issues/30642")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task BuiltInOperatorWithUserDefinedEquivalent() { await TestAsync( @" class X { void N(string a, string b) { var v = a $$== b; } }", MainDescription("bool string.operator ==(string a, string b)"), SymbolGlyph(Glyph.Operator)); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_Type() { await TestAsync( @" class $$X<T> where T : notnull { }", MainDescription("class X<T> where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_Method() { await TestAsync( @" class X { void $$M<T>() where T : notnull { } }", MainDescription("void X.M<T>() where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_Delegate() { await TestAsync( "delegate void $$D<T>() where T : notnull;", MainDescription("delegate void D<T>() where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NotNullConstraint_LocalFunction() { await TestAsync( @" class X { void N() { void $$M<T>() where T : notnull { } } }", MainDescription("void M<T>() where T : notnull")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableParameterThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { void N(string? s) { string s2 = $$s; } }", MainDescription($"({FeaturesResources.parameter}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableParameterThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { void N(string? s) { s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.parameter}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableFieldThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? s = null; void N() { string s2 = $$s; } }", MainDescription($"({FeaturesResources.field}) string? X.s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableFieldThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? s = null; void N() { s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.field}) string? X.s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullablePropertyThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? S { get; set; } void N() { string s2 = $$S; } }", MainDescription("string? X.S { get; set; }"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "S"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullablePropertyThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable class X { string? S { get; set; } void N() { S = """"; string s2 = $$S; } }", MainDescription("string? X.S { get; set; }"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "S"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableRangeVariableThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { IEnumerable<string?> enumerable; foreach (var s in enumerable) { string s2 = $$s; } } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableRangeVariableThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { IEnumerable<string> enumerable; foreach (var s in enumerable) { string s2 = $$s; } } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableLocalThatIsMaybeNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { string? s = null; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_may_be_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableLocalThatIsNotNull() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { string? s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string? s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownPriorToLanguageVersion8() { await TestWithOptionsAsync(TestOptions.Regular7_3, @"#nullable enable using System.Collections.Generic; class X { void N() { string s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string s"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownInNullableDisable() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable disable using System.Collections.Generic; class X { void N() { string s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string s"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableShownWhenEnabledGlobally() { await TestWithOptionsAsync(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, nullableContextOptions: NullableContextOptions.Enable), @"using System.Collections.Generic; class X { void N() { string s = """"; string s2 = $$s; } }", MainDescription($"({FeaturesResources.local_variable}) string s"), NullabilityAnalysis(string.Format(FeaturesResources._0_is_not_null_here, "s"))); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownForValueType() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { int a = 0; int b = $$a; } }", MainDescription($"({FeaturesResources.local_variable}) int a"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task NullableNotShownForConst() { await TestWithOptionsAsync(TestOptions.Regular8, @"#nullable enable using System.Collections.Generic; class X { void N() { const string? s = null; string? s2 = $$s; } }", MainDescription($"({FeaturesResources.local_constant}) string? s = null"), NullabilityAnalysis("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocInlineSummary() { var markup = @" /// <summary>Summary documentation</summary> /// <remarks>Remarks documentation</remarks> void M(int x) { } /// <summary><inheritdoc cref=""M(int)""/></summary> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("Summary documentation")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocTwoLevels1() { var markup = @" /// <summary>Summary documentation</summary> /// <remarks>Remarks documentation</remarks> void M() { } /// <inheritdoc cref=""M()""/> void M(int x) { } /// <inheritdoc cref=""M(int)""/> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("Summary documentation")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocTwoLevels2() { var markup = @" /// <summary>Summary documentation</summary> /// <remarks>Remarks documentation</remarks> void M() { } /// <summary><inheritdoc cref=""M()""/></summary> void M(int x) { } /// <summary><inheritdoc cref=""M(int)""/></summary> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("Summary documentation")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocWithTypeParamRef() { var markup = @" public class Program { public static void Main() => _ = new Test<int>().$$Clone(); } public class Test<T> : ICloneable<Test<T>> { /// <inheritdoc/> public Test<T> Clone() => new(); } /// <summary>A type that has clonable instances.</summary> /// <typeparam name=""T"">The type of instances that can be cloned.</typeparam> public interface ICloneable<T> { /// <summary>Clones a <typeparamref name=""T""/>.</summary> /// <returns>A clone of the <typeparamref name=""T""/>.</returns> public T Clone(); }"; await TestInClassAsync(markup, MainDescription("Test<int> Test<int>.Clone()"), Documentation("Clones a Test<T>.")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocCycle1() { var markup = @" /// <inheritdoc cref=""M(int, int)""/> void M(int x) { } /// <inheritdoc cref=""M(int)""/> void $$M(int x, int y) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x, int y)"), Documentation("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocCycle2() { var markup = @" /// <inheritdoc cref=""M(int)""/> void $$M(int x) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x)"), Documentation("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestInheritdocCycle3() { var markup = @" /// <inheritdoc cref=""M""/> void $$M(int x) { }"; await TestInClassAsync(markup, MainDescription("void C.M(int x)"), Documentation("")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38794, "https://github.com/dotnet/roslyn/issues/38794")] public async Task TestLinqGroupVariableDeclaration() { var code = @" void M(string[] a) { var v = from x in a group x by x.Length into $$g select g; }"; await TestInClassAsync(code, MainDescription($"({FeaturesResources.range_variable}) IGrouping<int, string> g")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38283, "https://github.com/dotnet/roslyn/issues/38283")] public async Task QuickInfoOnIndexerCloseBracket() { await TestAsync(@" class C { public int this[int x] { get { return 1; } } void M() { var x = new C()[5$$]; } }", MainDescription("int C.this[int x] { get; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38283, "https://github.com/dotnet/roslyn/issues/38283")] public async Task QuickInfoOnIndexerOpenBracket() { await TestAsync(@" class C { public int this[int x] { get { return 1; } } void M() { var x = new C()$$[5]; } }", MainDescription("int C.this[int x] { get; }")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(38283, "https://github.com/dotnet/roslyn/issues/38283")] public async Task QuickInfoOnIndexer_NotOnArrayAccess() { await TestAsync(@" class Program { void M() { int[] x = new int[4]; int y = x[3$$]; } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithRemarksOnMethod() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <remarks> /// Remarks text /// </remarks> int M() { return $$M(); } }", MainDescription("int Program.M()"), Documentation("Summary text"), Remarks("\r\nRemarks text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithRemarksOnPropertyAccessor() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <remarks> /// Remarks text /// </remarks> int M { $$get; } }", MainDescription("int Program.M.get"), Documentation("Summary text"), Remarks("\r\nRemarks text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithReturnsOnMethod() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <returns> /// Returns text /// </returns> int M() { return $$M(); } }", MainDescription("int Program.M()"), Documentation("Summary text"), Returns($"\r\n{FeaturesResources.Returns_colon}\r\n Returns text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithReturnsOnPropertyAccessor() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <returns> /// Returns text /// </returns> int M { $$get; } }", MainDescription("int Program.M.get"), Documentation("Summary text"), Returns($"\r\n{FeaturesResources.Returns_colon}\r\n Returns text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithValueOnMethod() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <value> /// Value text /// </value> int M() { return $$M(); } }", MainDescription("int Program.M()"), Documentation("Summary text"), Value($"\r\n{FeaturesResources.Value_colon}\r\n Value text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(31618, "https://github.com/dotnet/roslyn/issues/31618")] public async Task QuickInfoWithValueOnPropertyAccessor() { await TestAsync(@" class Program { /// <summary> /// Summary text /// </summary> /// <value> /// Value text /// </value> int M { $$get; } }", MainDescription("int Program.M.get"), Documentation("Summary text"), Value($"\r\n{FeaturesResources.Value_colon}\r\n Value text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoNotPattern1() { await TestAsync(@" class Person { void Goo(object o) { if (o is not $$Person p) { } } }", MainDescription("class Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoNotPattern2() { await TestAsync(@" class Person { void Goo(object o) { if (o is $$not Person p) { } } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoOrPattern1() { await TestAsync(@" class Person { void Goo(object o) { if (o is $$Person or int) { } } }", MainDescription("class Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoOrPattern2() { await TestAsync(@" class Person { void Goo(object o) { if (o is Person or $$int) { } } }", MainDescription("struct System.Int32")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] public async Task QuickInfoOrPattern3() { await TestAsync(@" class Person { void Goo(object o) { if (o is Person $$or int) { } } }"); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoRecord() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record Person(string First, string Last) { void M($$Person p) { } }", MainDescription("record Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoDerivedRecord() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record Person(string First, string Last) { } record Student(string Id) { void M($$Student p) { } } ", MainDescription("record Student")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(44904, "https://github.com/dotnet/roslyn/issues/44904")] public async Task QuickInfoRecord_BaseTypeList() { await TestAsync(@" record Person(string First, string Last); record Student(int Id) : $$Person(null, null); ", MainDescription("Person.Person(string First, string Last)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfo_BaseConstructorInitializer() { await TestAsync(@" public class Person { public Person(int id) { } } public class Student : Person { public Student() : $$base(0) { } } ", MainDescription("Person.Person(int id)")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoRecordClass() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record class Person(string First, string Last) { void M($$Person p) { } }", MainDescription("record Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoRecordStruct() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"record struct Person(string First, string Last) { void M($$Person p) { } }", MainDescription("record struct Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoReadOnlyRecordStruct() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"readonly record struct Person(string First, string Last) { void M($$Person p) { } }", MainDescription("readonly record struct Person")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] [WorkItem(51615, "https://github.com/dotnet/roslyn/issues/51615")] public async Task TestVarPatternOnVarKeyword() { await TestAsync( @"class C { string M() { } void M2() { if (M() is va$$r x && x.Length > 0) { } } }", MainDescription("class System.String")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestVarPatternOnVariableItself() { await TestAsync( @"class C { string M() { } void M2() { if (M() is var x$$ && x.Length > 0) { } } }", MainDescription($"({FeaturesResources.local_variable}) string? x")); } [WorkItem(53135, "https://github.com/dotnet/roslyn/issues/53135")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestDocumentationCData() { var markup = @"using I$$ = IGoo; /// <summary> /// summary for interface IGoo /// <code><![CDATA[ /// List<string> y = null; /// ]]></code> /// </summary> interface IGoo { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation(@"summary for interface IGoo List<string> y = null;")); } [WorkItem(37503, "https://github.com/dotnet/roslyn/issues/37503")] [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task DoNotNormalizeWhitespaceForCode() { var markup = @"using I$$ = IGoo; /// <summary> /// Normalize this, and <c>Also this</c> /// <code> /// line 1 /// line 2 /// </code> /// </summary> interface IGoo { }"; await TestAsync(markup, MainDescription("interface IGoo"), Documentation(@"Normalize this, and Also this line 1 line 2")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ImplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { public static void $$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ImplicitImplementation_FromReference() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { public static void M1() { } } class R { public static void M() { C1_1.$$M1(); } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_FromTypeParameterReference() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class R { public static void M<T>() where T : I1 { T.$$M1(); } } "; await TestAsync( code, MainDescription("void I1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ExplicitInheritdoc_ImplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { /// <inheritdoc/> public static void $$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ExplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { static void I1.$$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestStaticAbstract_ExplicitInheritdoc_ExplicitImplementation() { var code = @" interface I1 { /// <summary>Summary text</summary> static abstract void M1(); } class C1_1 : I1 { /// <inheritdoc/> static void I1.$$M1() { } } "; await TestAsync( code, MainDescription("void C1_1.M1()"), Documentation("Summary text")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoLambdaReturnType_01() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"class Program { System.Delegate D = bo$$ol () => true; }", MainDescription("struct System.Boolean")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoLambdaReturnType_02() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"class A { struct B { } System.Delegate D = A.B$$ () => null; }", MainDescription("struct A.B")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task QuickInfoLambdaReturnType_03() { await TestWithOptionsAsync( Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), @"class A<T> { } struct B { System.Delegate D = A<B$$> () => null; }", MainDescription("struct B")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestNormalFuncSynthesizedLambdaType() { await TestAsync( @"class C { void M() { $$var v = (int i) => i.ToString(); } }", MainDescription("delegate TResult System.Func<in T, out TResult>(T arg)"), TypeParameterMap($@" T {FeaturesResources.is_} int TResult {FeaturesResources.is_} string")); } [Fact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task TestAnonymousSynthesizedLambdaType() { await TestAsync( @"class C { void M() { $$var v = (ref int i) => i.ToString(); } }", MainDescription("delegate string <anonymous delegate>(ref int)")); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Features/CSharp/Portable/Completion/CompletionProviders/Scripting/ReferenceDirectiveCompletionProvider.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using System.Threading; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Completion.Providers; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.CSharp.Completion.Providers { [ExportCompletionProvider(nameof(ReferenceDirectiveCompletionProvider), LanguageNames.CSharp)] [ExtensionOrder(After = nameof(LoadDirectiveCompletionProvider))] [Shared] internal sealed class ReferenceDirectiveCompletionProvider : AbstractReferenceDirectiveCompletionProvider { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public ReferenceDirectiveCompletionProvider() { } protected override string DirectiveName => "r"; protected override bool TryGetStringLiteralToken(SyntaxTree tree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken) => DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.ReferenceDirectiveTrivia, out stringLiteral, cancellationToken); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Composition; using System.Threading; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Completion.Providers; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.CSharp.Completion.Providers { [ExportCompletionProvider(nameof(ReferenceDirectiveCompletionProvider), LanguageNames.CSharp)] [ExtensionOrder(After = nameof(LoadDirectiveCompletionProvider))] [Shared] internal sealed class ReferenceDirectiveCompletionProvider : AbstractReferenceDirectiveCompletionProvider { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public ReferenceDirectiveCompletionProvider() { } protected override string DirectiveName => "r"; protected override bool TryGetStringLiteralToken(SyntaxTree tree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken) => DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.ReferenceDirectiveTrivia, out stringLiteral, cancellationToken); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/VisualBasic/RenameTracking/BasicRenameTrackingLanguageHeuristicsService.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Composition Imports Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking Imports Microsoft.CodeAnalysis.Host.Mef Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.RenameTracking <ExportLanguageService(GetType(IRenameTrackingLanguageHeuristicsService), LanguageNames.VisualBasic), [Shared]> Friend NotInheritable Class BasicRenameTrackingLanguageHeuristicsService Implements IRenameTrackingLanguageHeuristicsService <ImportingConstructor> <Obsolete(MefConstruction.ImportingConstructorMessage, True)> Public Sub New() End Sub Public Function IsIdentifierValidForRenameTracking(name As String) As Boolean Implements IRenameTrackingLanguageHeuristicsService.IsIdentifierValidForRenameTracking Return True End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Composition Imports Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking Imports Microsoft.CodeAnalysis.Host.Mef Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.RenameTracking <ExportLanguageService(GetType(IRenameTrackingLanguageHeuristicsService), LanguageNames.VisualBasic), [Shared]> Friend NotInheritable Class BasicRenameTrackingLanguageHeuristicsService Implements IRenameTrackingLanguageHeuristicsService <ImportingConstructor> <Obsolete(MefConstruction.ImportingConstructorMessage, True)> Public Sub New() End Sub Public Function IsIdentifierValidForRenameTracking(name As String) As Boolean Implements IRenameTrackingLanguageHeuristicsService.IsIdentifierValidForRenameTracking Return True End Function End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Linq; using System.Text; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests { public class LambdaTests : CSharpTestBase { [Fact, WorkItem(37456, "https://github.com/dotnet/roslyn/issues/37456")] public void Verify37456() { var comp = CreateCompilation(@" using System; using System.Collections.Generic; using System.Linq; public static partial class EnumerableEx { public static void Join1<TA, TKey, T>(this IEnumerable<TA> a, Func<TA, TKey> aKey, Func<TA, T> aSel, Func<TA, TA, T> sel) { KeyValuePair<TK, TV> Pair<TK, TV>(TK k, TV v) => new KeyValuePair<TK, TV>(k, v); _ = a.GroupJoin(a, aKey, aKey, (f, ss) => Pair(f, ss.Select(s => Pair(true, s)))); // simplified repro } public static IEnumerable<T> Join2<TA, TB, TKey, T>(this IEnumerable<TA> a, IEnumerable<TB> b, Func<TA, TKey> aKey, Func<TB, TKey> bKey, Func<TA, T> aSel, Func<TA, TB, T> sel, IEqualityComparer<TKey> comp) { KeyValuePair<TK, TV> Pair<TK, TV>(TK k, TV v) => new KeyValuePair<TK, TV>(k, v); return from j in a.GroupJoin(b, aKey, bKey, (f, ss) => Pair(f, from s in ss select Pair(true, s)), comp) from s in j.Value.DefaultIfEmpty() select s.Key ? sel(j.Key, s.Value) : aSel(j.Key); } }"); comp.VerifyDiagnostics(); CompileAndVerify(comp); // emitting should not hang } [Fact, WorkItem(608181, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/608181")] public void BadInvocationInLambda() { var src = @" using System; using System.Linq.Expressions; class C { Expression<Action<dynamic>> e = x => new object[](x); }"; var comp = CreateCompilationWithMscorlib40AndSystemCore(src); comp.VerifyDiagnostics( // (7,52): error CS1586: Array creation must have array size or array initializer // Expression<Action<dynamic>> e = x => new object[](x); Diagnostic(ErrorCode.ERR_MissingArraySize, "[]").WithLocation(7, 52) ); } [Fact] public void TestLambdaErrors01() { var comp = CreateCompilationWithMscorlib40AndSystemCore(@" using System; using System.Linq.Expressions; namespace System.Linq.Expressions { public class Expression<T> {} } class C { delegate void D1(ref int x, out int y, int z); delegate void D2(out int x); void M() { int q1 = ()=>1; int q2 = delegate { return 1; }; Func<int> q3 = x3=>1; Func<int, int> q4 = (System.Itn23 x4)=>1; // type mismatch error should be suppressed on error type Func<double> q5 = (System.Duobel x5)=>1; // but arity error should not be suppressed on error type D1 q6 = (double x6, ref int y6, ref int z6)=>1; // COMPATIBILITY: The C# 4 compiler produces two errors: // // error CS1676: Parameter 2 must be declared with the 'out' keyword // error CS1688: Cannot convert anonymous method block without a parameter list // to delegate type 'D1' because it has one or more out parameters // // This seems redundant (because there is no 'parameter 2' in the source code) // I propose that we eliminate the first error. D1 q7 = delegate {}; Frob q8 = ()=>{}; D2 q9 = x9=>{}; D1 q10 = (x10,y10,z10)=>{}; // COMPATIBILITY: The C# 4 compiler produces two errors: // // error CS0127: Since 'System.Action' returns void, a return keyword must // not be followed by an object expression // // error CS1662: Cannot convert lambda expression to delegate type 'System.Action' // because some of the return types in the block are not implicitly convertible to // the delegate return type // // The problem is adequately characterized by the first message; I propose we // eliminate the second, which seems both redundant and wrong. Action q11 = ()=>{ return 1; }; Action q12 = ()=>1; Func<int> q13 = ()=>{ if (false) return 1; }; Func<int> q14 = ()=>123.456; // Note that the type error is still an error even if the offending // return is unreachable. Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; // In the native compiler these errors were caught at parse time. In Roslyn, these are now semantic // analysis errors. See changeset 1674 for details. Action<int[]> q16 = delegate (params int[] p) { }; Action<string[]> q17 = (params string[] s)=>{}; Action<int, double[]> q18 = (int x, params double[] s)=>{}; object q19 = new Action( (int x)=>{} ); Expression<int> ex1 = ()=>1; } }"); comp.VerifyDiagnostics( // (16,18): error CS1660: Cannot convert lambda expression to type 'int' because it is not a delegate type // int q1 = ()=>1; Diagnostic(ErrorCode.ERR_AnonMethToNonDel, "()=>1").WithArguments("lambda expression", "int").WithLocation(16, 18), // (17,18): error CS1660: Cannot convert anonymous method to type 'int' because it is not a delegate type // int q2 = delegate { return 1; }; Diagnostic(ErrorCode.ERR_AnonMethToNonDel, "delegate { return 1; }").WithArguments("anonymous method", "int").WithLocation(17, 18), // (18,24): error CS1593: Delegate 'Func<int>' does not take 1 arguments // Func<int> q3 = x3=>1; Diagnostic(ErrorCode.ERR_BadDelArgCount, "x3=>1").WithArguments("System.Func<int>", "1").WithLocation(18, 24), // (19,37): error CS0234: The type or namespace name 'Itn23' does not exist in the namespace 'System' (are you missing an assembly reference?) // Func<int, int> q4 = (System.Itn23 x4)=>1; // type mismatch error should be suppressed on error type Diagnostic(ErrorCode.ERR_DottedTypeNameNotFoundInNS, "Itn23").WithArguments("Itn23", "System").WithLocation(19, 37), // (20,35): error CS0234: The type or namespace name 'Duobel' does not exist in the namespace 'System' (are you missing an assembly reference?) // Func<double> q5 = (System.Duobel x5)=>1; // but arity error should not be suppressed on error type Diagnostic(ErrorCode.ERR_DottedTypeNameNotFoundInNS, "Duobel").WithArguments("Duobel", "System").WithLocation(20, 35), // (20,27): error CS1593: Delegate 'Func<double>' does not take 1 arguments // Func<double> q5 = (System.Duobel x5)=>1; // but arity error should not be suppressed on error type Diagnostic(ErrorCode.ERR_BadDelArgCount, "(System.Duobel x5)=>1").WithArguments("System.Func<double>", "1").WithLocation(20, 27), // (21,17): error CS1661: Cannot convert lambda expression to delegate type 'C.D1' because the parameter types do not match the delegate parameter types // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, "(double x6, ref int y6, ref int z6)=>1").WithArguments("lambda expression", "C.D1").WithLocation(21, 17), // (21,25): error CS1678: Parameter 1 is declared as type 'double' but should be 'ref int' // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_BadParamType, "x6").WithArguments("1", "", "double", "ref ", "int").WithLocation(21, 25), // (21,37): error CS1676: Parameter 2 must be declared with the 'out' keyword // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_BadParamRef, "y6").WithArguments("2", "out").WithLocation(21, 37), // (21,49): error CS1677: Parameter 3 should not be declared with the 'ref' keyword // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_BadParamExtraRef, "z6").WithArguments("3", "ref").WithLocation(21, 49), // (32,17): error CS1688: Cannot convert anonymous method block without a parameter list to delegate type 'C.D1' because it has one or more out parameters // D1 q7 = delegate {}; Diagnostic(ErrorCode.ERR_CantConvAnonMethNoParams, "delegate {}").WithArguments("C.D1").WithLocation(32, 17), // (34,9): error CS0246: The type or namespace name 'Frob' could not be found (are you missing a using directive or an assembly reference?) // Frob q8 = ()=>{}; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "Frob").WithArguments("Frob").WithLocation(34, 9), // (36,17): error CS1676: Parameter 1 must be declared with the 'out' keyword // D2 q9 = x9=>{}; Diagnostic(ErrorCode.ERR_BadParamRef, "x9").WithArguments("1", "out").WithLocation(36, 17), // (38,19): error CS1676: Parameter 1 must be declared with the 'ref' keyword // D1 q10 = (x10,y10,z10)=>{}; Diagnostic(ErrorCode.ERR_BadParamRef, "x10").WithArguments("1", "ref").WithLocation(38, 19), // (38,23): error CS1676: Parameter 2 must be declared with the 'out' keyword // D1 q10 = (x10,y10,z10)=>{}; Diagnostic(ErrorCode.ERR_BadParamRef, "y10").WithArguments("2", "out").WithLocation(38, 23), // (52,28): error CS8030: Anonymous function converted to a void returning delegate cannot return a value // Action q11 = ()=>{ return 1; }; Diagnostic(ErrorCode.ERR_RetNoObjectRequiredLambda, "return").WithLocation(52, 28), // (54,26): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // Action q12 = ()=>1; Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(54, 26), // (56,42): warning CS0162: Unreachable code detected // Func<int> q13 = ()=>{ if (false) return 1; }; Diagnostic(ErrorCode.WRN_UnreachableCode, "return").WithLocation(56, 42), // (56,27): error CS1643: Not all code paths return a value in lambda expression of type 'Func<int>' // Func<int> q13 = ()=>{ if (false) return 1; }; Diagnostic(ErrorCode.ERR_AnonymousReturnExpected, "=>").WithArguments("lambda expression", "System.Func<int>").WithLocation(56, 27), // (58,29): error CS0266: Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?) // Func<int> q14 = ()=>123.456; Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "123.456").WithArguments("double", "int").WithLocation(58, 29), // (58,29): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // Func<int> q14 = ()=>123.456; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "123.456").WithArguments("lambda expression").WithLocation(58, 29), // (62,51): error CS0266: Cannot implicitly convert type 'decimal' to 'double'. An explicit conversion exists (are you missing a cast?) // Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "1m").WithArguments("decimal", "double").WithLocation(62, 51), // (62,51): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "1m").WithArguments("lambda expression").WithLocation(62, 51), // (62,44): warning CS0162: Unreachable code detected // Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; Diagnostic(ErrorCode.WRN_UnreachableCode, "return").WithLocation(62, 44), // (66,39): error CS1670: params is not valid in this context // Action<int[]> q16 = delegate (params int[] p) { }; Diagnostic(ErrorCode.ERR_IllegalParams, "params int[] p").WithLocation(66, 39), // (67,33): error CS1670: params is not valid in this context // Action<string[]> q17 = (params string[] s)=>{}; Diagnostic(ErrorCode.ERR_IllegalParams, "params string[] s").WithLocation(67, 33), // (68,45): error CS1670: params is not valid in this context // Action<int, double[]> q18 = (int x, params double[] s)=>{}; Diagnostic(ErrorCode.ERR_IllegalParams, "params double[] s").WithLocation(68, 45), // (70,34): error CS1593: Delegate 'Action' does not take 1 arguments // object q19 = new Action( (int x)=>{} ); Diagnostic(ErrorCode.ERR_BadDelArgCount, "(int x)=>{}").WithArguments("System.Action", "1").WithLocation(70, 34), // (72,9): warning CS0436: The type 'Expression<T>' in '' conflicts with the imported type 'Expression<TDelegate>' in 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using the type defined in ''. // Expression<int> ex1 = ()=>1; Diagnostic(ErrorCode.WRN_SameFullNameThisAggAgg, "Expression<int>").WithArguments("", "System.Linq.Expressions.Expression<T>", "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "System.Linq.Expressions.Expression<TDelegate>").WithLocation(72, 9), // (72,31): error CS0835: Cannot convert lambda to an expression tree whose type argument 'int' is not a delegate type // Expression<int> ex1 = ()=>1; Diagnostic(ErrorCode.ERR_ExpressionTreeMustHaveDelegate, "()=>1").WithArguments("int").WithLocation(72, 31) ); } [Fact] // 5368 public void TestLambdaErrors02() { string code = @" class C { void M() { System.Func<int, int> del = x => x + 1; } }"; var compilation = CreateCompilation(code); compilation.VerifyDiagnostics(); // no errors expected } [WorkItem(539538, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539538")] [Fact] public void TestLambdaErrors03() { string source = @" using System; interface I : IComparable<IComparable<I>> { } class C { static void Goo(Func<IComparable<I>> x) { } static void Goo(Func<I> x) {} static void M() { Goo(() => null); } } "; CreateCompilation(source).VerifyDiagnostics( // (12,9): error CS0121: The call is ambiguous between the following methods or properties: 'C.Goo(Func<IComparable<I>>)' and 'C.Goo(Func<I>)' // Goo(() => null); Diagnostic(ErrorCode.ERR_AmbigCall, "Goo").WithArguments("C.Goo(System.Func<System.IComparable<I>>)", "C.Goo(System.Func<I>)").WithLocation(12, 9)); } [WorkItem(18645, "https://github.com/dotnet/roslyn/issues/18645")] [Fact] public void LambdaExpressionTreesErrors() { string source = @" using System; using System.Linq.Expressions; class C { void M() { Expression<Func<int,int>> ex1 = () => 1; Expression<Func<int,int>> ex2 = (double d) => 1; } } "; CreateCompilation(source).VerifyDiagnostics( // (9,41): error CS1593: Delegate 'Func<int, int>' does not take 0 arguments // Expression<Func<int,int>> ex1 = () => 1; Diagnostic(ErrorCode.ERR_BadDelArgCount, "() => 1").WithArguments("System.Func<int, int>", "0").WithLocation(9, 41), // (10,41): error CS1661: Cannot convert lambda expression to type 'Expression<Func<int, int>>' because the parameter types do not match the delegate parameter types // Expression<Func<int,int>> ex2 = (double d) => 1; Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, "(double d) => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression<System.Func<int, int>>").WithLocation(10, 41), // (10,49): error CS1678: Parameter 1 is declared as type 'double' but should be 'int' // Expression<Func<int,int>> ex2 = (double d) => 1; Diagnostic(ErrorCode.ERR_BadParamType, "d").WithArguments("1", "", "double", "", "int").WithLocation(10, 49)); } [WorkItem(539976, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539976")] [Fact] public void LambdaArgumentToOverloadedDelegate() { var text = @"class W { delegate T Func<A0, T>(A0 a0); static int F(Func<short, int> f) { return 0; } static int F(Func<short, double> f) { return 1; } static int Main() { return F(c => c); } } "; var comp = CreateCompilation(Parse(text)); comp.VerifyDiagnostics(); } [WorkItem(528044, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528044")] [Fact] public void MissingReferenceInOverloadResolution() { var text1 = @" using System; public static class A { public static void Goo(Func<B, object> func) { } public static void Goo(Func<C, object> func) { } } public class B { public Uri GetUrl() { return null; } } public class C { public string GetUrl() { return null; } }"; var comp1 = CreateCompilationWithMscorlib40( new[] { Parse(text1) }, new[] { TestMetadata.Net451.System }); var text2 = @" class Program { static void Main() { A.Goo(x => x.GetUrl()); } } "; var comp2 = CreateCompilationWithMscorlib40( new[] { Parse(text2) }, new[] { new CSharpCompilationReference(comp1) }); Assert.Equal(0, comp2.GetDiagnostics().Count()); } [WorkItem(528047, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528047")] [Fact()] public void OverloadResolutionWithEmbeddedInteropType() { var text1 = @" using System; using System.Collections.Generic; using stdole; public static class A { public static void Goo(Func<X> func) { System.Console.WriteLine(""X""); } public static void Goo(Func<Y> func) { System.Console.WriteLine(""Y""); } } public delegate void X(List<IDispatch> addin); public delegate void Y(List<string> addin); "; var comp1 = CreateCompilation( Parse(text1), new[] { TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(true) }, options: TestOptions.ReleaseDll); var text2 = @" public class Program { public static void Main() { A.Goo(() => delegate { }); } } "; var comp2 = CreateCompilation( Parse(text2), new MetadataReference[] { new CSharpCompilationReference(comp1), TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(true) }, options: TestOptions.ReleaseExe); CompileAndVerify(comp2, expectedOutput: "Y").Diagnostics.Verify(); var comp3 = CreateCompilation( Parse(text2), new MetadataReference[] { comp1.EmitToImageReference(), TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(true) }, options: TestOptions.ReleaseExe); CompileAndVerify(comp3, expectedOutput: "Y").Diagnostics.Verify(); } [WorkItem(6358, "DevDiv_Projects/Roslyn")] [Fact] public void InvalidExpressionInvolveLambdaOperator() { var text1 = @" class C { static void X() { int x=0; int y=0; if(x-=>*y) // CS1525 return; return; } } "; var comp = CreateCompilation(Parse(text1)); var errs = comp.GetDiagnostics(); Assert.True(0 < errs.Count(), "Diagnostics not empty"); Assert.True(0 < errs.Where(e => e.Code == 1525).Select(e => e).Count(), "Diagnostics contains CS1525"); } [WorkItem(540219, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540219")] [Fact] public void OverloadResolutionWithStaticType() { var vbSource = @" Imports System Namespace Microsoft.VisualBasic.CompilerServices <System.AttributeUsage(System.AttributeTargets.Class, Inherited:=False, AllowMultiple:=False)> Public NotInheritable Class StandardModuleAttribute Inherits System.Attribute Public Sub New() MyBase.New() End Sub End Class End Namespace Public Module M Sub Goo(x as Action(Of String)) End Sub Sub Goo(x as Action(Of GC)) End Sub End Module "; var vbProject = VisualBasic.VisualBasicCompilation.Create( "VBProject", references: new[] { MscorlibRef }, syntaxTrees: new[] { VisualBasic.VisualBasicSyntaxTree.ParseText(vbSource) }); var csSource = @" class Program { static void Main() { M.Goo(x => { }); } } "; var metadataStream = new MemoryStream(); var emitResult = vbProject.Emit(metadataStream, options: new EmitOptions(metadataOnly: true)); Assert.True(emitResult.Success); var csProject = CreateCompilation( Parse(csSource), new[] { MetadataReference.CreateFromImage(metadataStream.ToImmutable()) }); Assert.Equal(0, csProject.GetDiagnostics().Count()); } [Fact] public void OverloadResolutionWithStaticTypeError() { var vbSource = @" Imports System Namespace Microsoft.VisualBasic.CompilerServices <System.AttributeUsage(System.AttributeTargets.Class, Inherited:=False, AllowMultiple:=False)> Public NotInheritable Class StandardModuleAttribute Inherits System.Attribute Public Sub New() MyBase.New() End Sub End Class End Namespace Public Module M Public Dim F As Action(Of GC) End Module "; var vbProject = VisualBasic.VisualBasicCompilation.Create( "VBProject", references: new[] { MscorlibRef }, syntaxTrees: new[] { VisualBasic.VisualBasicSyntaxTree.ParseText(vbSource) }); var csSource = @" class Program { static void Main() { M.F = x=>{}; } } "; var vbMetadata = vbProject.EmitToArray(options: new EmitOptions(metadataOnly: true)); var csProject = CreateCompilation(Parse(csSource), new[] { MetadataReference.CreateFromImage(vbMetadata) }); csProject.VerifyDiagnostics( // (6,15): error CS0721: 'GC': static types cannot be used as parameters // M.F = x=>{}; Diagnostic(ErrorCode.ERR_ParameterIsStaticClass, "x").WithArguments("System.GC").WithLocation(6, 15)); } [WorkItem(540251, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540251")] [Fact] public void AttributesCannotBeUsedInAnonymousMethods() { var csSource = @" using System; class Program { static void Main() { const string message = ""The parameter is obsolete""; Action<int> a = delegate ([ObsoleteAttribute(message)] int x) { }; } } "; var csProject = CreateCompilation(csSource); csProject.VerifyEmitDiagnostics( // (8,22): warning CS0219: The variable 'message' is assigned but its value is never used // const string message = "The parameter is obsolete"; Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "message").WithArguments("message").WithLocation(8, 22), // (9,35): error CS7014: Attributes are not valid in this context. // Action<int> a = delegate ([ObsoleteAttribute(message)] int x) { }; Diagnostic(ErrorCode.ERR_AttributesNotAllowed, "[ObsoleteAttribute(message)]").WithLocation(9, 35)); } [WorkItem(540263, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540263")] [Fact] public void ErrorsInUnboundLambdas() { var csSource = @"using System; class Program { static void Main() { ((Func<int>)delegate { return """"; })(); ((Func<int>)delegate { })(); ((Func<int>)delegate { 1 / 0; })(); } } "; CreateCompilation(csSource).VerifyDiagnostics( // (7,39): error CS0029: Cannot implicitly convert type 'string' to 'int' // ((Func<int>)delegate { return ""; })(); Diagnostic(ErrorCode.ERR_NoImplicitConv, @"""""").WithArguments("string", "int").WithLocation(7, 39), // (7,39): error CS1662: Cannot convert anonymous method to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // ((Func<int>)delegate { return ""; })(); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, @"""""").WithArguments("anonymous method").WithLocation(7, 39), // (8,21): error CS1643: Not all code paths return a value in anonymous method of type 'Func<int>' // ((Func<int>)delegate { })(); Diagnostic(ErrorCode.ERR_AnonymousReturnExpected, "delegate").WithArguments("anonymous method", "System.Func<int>").WithLocation(8, 21), // (9,32): error CS0020: Division by constant zero // ((Func<int>)delegate { 1 / 0; })(); Diagnostic(ErrorCode.ERR_IntDivByZero, "1 / 0").WithLocation(9, 32), // (9,32): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // ((Func<int>)delegate { 1 / 0; })(); Diagnostic(ErrorCode.ERR_IllegalStatement, "1 / 0").WithLocation(9, 32), // (9,21): error CS1643: Not all code paths return a value in anonymous method of type 'Func<int>' // ((Func<int>)delegate { 1 / 0; })(); Diagnostic(ErrorCode.ERR_AnonymousReturnExpected, "delegate").WithArguments("anonymous method", "System.Func<int>").WithLocation(9, 21) ); } [WorkItem(540181, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540181")] [Fact] public void ErrorInLambdaArgumentList() { var csSource = @"using System; class Program { public Program(string x) : this(() => x) { } static void Main(string[] args) { ((Action<string>)(f => Console.WriteLine(f)))(nulF); } }"; CreateCompilation(csSource).VerifyDiagnostics( // (5,37): error CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type // public Program(string x) : this(() => x) { } Diagnostic(ErrorCode.ERR_AnonMethToNonDel, "() => x").WithArguments("lambda expression", "string").WithLocation(5, 37), // (8,55): error CS0103: The name 'nulF' does not exist in the current context // ((Action<string>)(f => Console.WriteLine(f)))(nulF); Diagnostic(ErrorCode.ERR_NameNotInContext, "nulF").WithArguments("nulF").WithLocation(8, 55)); } [WorkItem(541725, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541725")] [Fact] public void DelegateCreationIsNotStatement() { var csSource = @" delegate void D(); class Program { public static void Main(string[] args) { D d = () => new D(() => { }); new D(()=>{}); } }"; // Though it is legal to have an object-creation-expression, because it might be useful // for its side effects, a delegate-creation-expression is not allowed as a // statement expression. CreateCompilation(csSource).VerifyDiagnostics( // (7,21): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // D d = () => new D(() => { }); Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(() => { })"), // (8,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // new D(()=>{}); Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(()=>{})")); } [WorkItem(542336, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542336")] [Fact] public void ThisInStaticContext() { var csSource = @" delegate void D(); class Program { public static void Main(string[] args) { D d = () => { object o = this; }; } }"; CreateCompilation(csSource).VerifyDiagnostics( // (8,24): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer // object o = this; Diagnostic(ErrorCode.ERR_ThisInStaticMeth, "this") ); } [WorkItem(542431, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542431")] [Fact] public void LambdaHasMoreParametersThanDelegate() { var csSource = @" class C { static void Main() { System.Func<int> f = new System.Func<int>(r => 0); } }"; CreateCompilation(csSource).VerifyDiagnostics( // (6,51): error CS1593: Delegate 'System.Func<int>' does not take 1 arguments Diagnostic(ErrorCode.ERR_BadDelArgCount, "r => 0").WithArguments("System.Func<int>", "1")); } [Fact, WorkItem(529054, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529054")] public void LambdaInDynamicCall() { var source = @" public class Program { static void Main() { dynamic b = new string[] { ""AA"" }; bool exists = System.Array.Exists(b, o => o != ""BB""); } }"; CreateCompilation(source).VerifyDiagnostics( // (7,46): error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type. // bool exists = System.Array.Exists(b, o => o != "BB"); Diagnostic(ErrorCode.ERR_BadDynamicMethodArgLambda, @"o => o != ""BB""") ); } [Fact, WorkItem(529389, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529389")] public void ParenthesizedLambdaInCastExpression() { var source = @" using System; using System.Collections.Generic; class Program { static void Main() { int x = 1; byte y = (byte) (x + x); Func<int> f1 = (() => { return 1; }); Func<int> f2 = (Func<int>) (() => { return 2; }); } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(). Where(e => e.Kind() == SyntaxKind.AddExpression).Single(); var tinfo = model.GetTypeInfo(expr); var conv = model.GetConversion(expr); // Not byte Assert.Equal("int", tinfo.Type.ToDisplayString()); var exprs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); expr = exprs.First(); tinfo = model.GetTypeInfo(expr); conv = model.GetConversion(expr); Assert.True(conv.IsAnonymousFunction, "LambdaConversion"); Assert.Null(tinfo.Type); var sym = model.GetSymbolInfo(expr).Symbol; Assert.NotNull(sym); Assert.Equal(SymbolKind.Method, sym.Kind); Assert.Equal(MethodKind.AnonymousFunction, (sym as IMethodSymbol).MethodKind); expr = exprs.Last(); tinfo = model.GetTypeInfo(expr); conv = model.GetConversion(expr); Assert.True(conv.IsAnonymousFunction, "LambdaConversion"); Assert.Null(tinfo.Type); sym = model.GetSymbolInfo(expr).Symbol; Assert.NotNull(sym); Assert.Equal(SymbolKind.Method, sym.Kind); Assert.Equal(MethodKind.AnonymousFunction, (sym as IMethodSymbol).MethodKind); } [WorkItem(544594, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544594")] [Fact] public void LambdaInEnumMemberDecl() { var csSource = @" public class TestClass { public enum Test { aa = ((System.Func<int>)(() => 1))() } Test MyTest = Test.aa; public static void Main() { } } "; CreateCompilation(csSource).VerifyDiagnostics( // (4,29): error CS0133: The expression being assigned to 'TestClass.Test.aa' must be constant Diagnostic(ErrorCode.ERR_NotConstantExpression, "((System.Func<int>)(() => 1))()").WithArguments("TestClass.Test.aa"), // (5,10): warning CS0414: The field 'TestClass.MyTest' is assigned but its value is never used Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, "MyTest").WithArguments("TestClass.MyTest")); } [WorkItem(544932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544932")] [Fact] public void AnonymousLambdaInEnumSubtraction() { string source = @" class Test { enum E1 : byte { A = byte.MinValue, C = 1 } static void Main() { int j = ((System.Func<Test.E1>)(() => E1.A))() - E1.C; System.Console.WriteLine(j); } } "; string expectedOutput = @"255"; CompileAndVerify(new[] { source }, expectedOutput: expectedOutput); } [WorkItem(545156, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545156")] [Fact] public void SpeculativelyBindOverloadResolution() { string source = @" using System; using System.Collections; using System.Collections.Generic; class Program { static void Main() { Goo(() => () => { var x = (IEnumerable<int>)null; return x; }); } static void Goo(Func<Func<IEnumerable>> x) { } static void Goo(Func<Func<IFormattable>> x) { } } "; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); // Used to throw a NRE because of the ExpressionSyntax's null SyntaxTree. model.GetSpeculativeSymbolInfo( invocation.SpanStart, SyntaxFactory.ParseExpression("Goo(() => () => { var x = null; return x; })"), // cast removed SpeculativeBindingOption.BindAsExpression); } [WorkItem(545343, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545343")] [Fact] public void LambdaUsingFieldInConstructor() { string source = @" using System; public class Derived { int field = 1; Derived() { int local = 2; // A lambda that captures a local and refers to an instance field. Action a = () => Console.WriteLine(""Local = {0}, Field = {1}"", local, field); // NullReferenceException if the ""this"" field of the display class hasn't been set. a(); } public static void Main() { Derived d = new Derived(); } }"; CompileAndVerify(source, expectedOutput: "Local = 2, Field = 1"); } [WorkItem(642222, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/642222")] [Fact] public void SpeculativelyBindOverloadResolutionAndInferenceWithError() { string source = @" using System;using System.Linq.Expressions; namespace IntellisenseBug { public class Program { void M(Mapper<FromData, ToData> mapper) { // Intellisense is broken here when you type . after the x: mapper.Map(x => x/* */. } } public class Mapper<TTypeFrom, TTypeTo> { public void Map<TPropertyFrom, TPropertyTo>( Expression<Func<TTypeFrom, TPropertyFrom>> from, Expression<Func<TTypeTo, TPropertyTo>> to) { } } public class FromData { public int Int { get; set; } public string String { get; set; } } public class ToData { public int Id { get; set; } public string Name { get; set; } } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); // We don't actually require any particular diagnostics, but these are what we get. compilation.VerifyDiagnostics( // (10,36): error CS1001: Identifier expected // mapper.Map(x => x/* */. Diagnostic(ErrorCode.ERR_IdentifierExpected, ""), // (10,36): error CS1026: ) expected // mapper.Map(x => x/* */. Diagnostic(ErrorCode.ERR_CloseParenExpected, ""), // (10,36): error CS1002: ; expected // mapper.Map(x => x/* */. Diagnostic(ErrorCode.ERR_SemicolonExpected, "") ); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var xReference = tree .GetCompilationUnitRoot() .DescendantNodes() .OfType<ExpressionSyntax>() .Where(e => e.ToFullString() == "x/* */") .Last(); var typeInfo = model.GetTypeInfo(xReference); Assert.NotNull(((ITypeSymbol)typeInfo.Type).GetMember("String")); } [WorkItem(722288, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/722288")] [Fact] public void CompletionInLambdaInIncompleteInvocation() { string source = @" using System; using System.Linq.Expressions; public class SomeType { public string SomeProperty { get; set; } } public class IntelliSenseError { public static void Test1<T>(Expression<Func<T, object>> expr) { Console.WriteLine(((MemberExpression)expr.Body).Member.Name); } public static void Test2<T>(Expression<Func<T, object>> expr, bool additionalParameter) { Test1(expr); } public static void Main() { Test2<SomeType>(o => o/* */. } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); // We don't actually require any particular diagnostics, but these are what we get. compilation.VerifyDiagnostics( // (21,37): error CS1001: Identifier expected // Test2<SomeType>(o => o/* */. Diagnostic(ErrorCode.ERR_IdentifierExpected, ""), // (21,37): error CS1026: ) expected // Test2<SomeType>(o => o/* */. Diagnostic(ErrorCode.ERR_CloseParenExpected, ""), // (21,37): error CS1002: ; expected // Test2<SomeType>(o => o/* */. Diagnostic(ErrorCode.ERR_SemicolonExpected, "") ); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var oReference = tree .GetCompilationUnitRoot() .DescendantNodes() .OfType<NameSyntax>() .Where(e => e.ToFullString() == "o/* */") .Last(); var typeInfo = model.GetTypeInfo(oReference); Assert.NotNull(((ITypeSymbol)typeInfo.Type).GetMember("SomeProperty")); } [WorkItem(871896, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/871896")] [Fact] public void Bug871896() { string source = @" using System.Threading; using System.Threading.Tasks; class TestDataPointBase { private readonly IVisualStudioIntegrationService integrationService; protected void TryGetDocumentId(CancellationToken token) { DocumentId documentId = null; if (!await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)) { } } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var oReference = tree .GetCompilationUnitRoot() .DescendantNodes() .OfType<ExpressionSyntax>() .OrderByDescending(s => s.SpanStart); foreach (var name in oReference) { CSharpExtensions.GetSymbolInfo(model, name); } // We should get a bunch of errors, but no asserts. compilation.VerifyDiagnostics( // (6,22): error CS0246: The type or namespace name 'IVisualStudioIntegrationService' could not be found (are you missing a using directive or an assembly reference?) // private readonly IVisualStudioIntegrationService integrationService; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "IVisualStudioIntegrationService").WithArguments("IVisualStudioIntegrationService").WithLocation(6, 22), // (9,9): error CS0246: The type or namespace name 'DocumentId' could not be found (are you missing a using directive or an assembly reference?) // DocumentId documentId = null; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "DocumentId").WithArguments("DocumentId").WithLocation(9, 9), // (10,25): error CS0117: 'System.Threading.Tasks.Task' does not contain a definition for 'Run' // if (!await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)) Diagnostic(ErrorCode.ERR_NoSuchMember, "Run").WithArguments("System.Threading.Tasks.Task", "Run").WithLocation(10, 25), // (10,14): error CS4033: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. // if (!await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)) Diagnostic(ErrorCode.ERR_BadAwaitWithoutVoidAsyncMethod, "await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)").WithLocation(10, 14), // (6,54): warning CS0649: Field 'TestDataPointBase.integrationService' is never assigned to, and will always have its default value null // private readonly IVisualStudioIntegrationService integrationService; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "integrationService").WithArguments("TestDataPointBase.integrationService", "null").WithLocation(6, 54) ); } [Fact, WorkItem(960755, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/960755")] public void Bug960755_01() { var source = @" using System.Collections.Generic; class C { static void M(IList<C> c) { var tmp = new C(); tmp.M((a, b) => c.Add); } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal("void System.Collections.Generic.ICollection<C>.Add(C item)", symbolInfo.CandidateSymbols.Single().ToTestDisplayString()); Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason); } [Fact, WorkItem(960755, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/960755")] public void Bug960755_02() { var source = @" using System.Collections.Generic; class C { static void M(IList<C> c) { int tmp = c.Add; } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal("void System.Collections.Generic.ICollection<C>.Add(C item)", symbolInfo.CandidateSymbols.Single().ToTestDisplayString()); Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason); } [Fact, WorkItem(960755, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/960755")] public void Bug960755_03() { var source = @" using System.Collections.Generic; class C { static void M(IList<C> c) { var tmp = new C(); tmp.M((a, b) => c.Add); } static void M(System.Func<int, int, System.Action<C>> x) {} } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("void System.Collections.Generic.ICollection<C>.Add(C item)", symbolInfo.Symbol.ToTestDisplayString()); Assert.Equal(0, symbolInfo.CandidateSymbols.Length); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); } [Fact] public void RefLambdaInferenceMethodArgument() { var text = @" delegate ref int D(); class C { static void MD(D d) { } static int i = 0; static void M() { MD(() => ref i); MD(() => { return ref i; }); MD(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics(); } [Fact] public void RefLambdaInferenceDelegateCreation() { var text = @" delegate ref int D(); class C { static int i = 0; static void M() { var d = new D(() => ref i); d = new D(() => { return ref i; }); d = new D(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics(); } [Fact] public void RefLambdaInferenceOverloadedDelegateType() { var text = @" delegate ref int D(); delegate int E(); class C { static void M(D d) { } static void M(E e) { } static int i = 0; static void M() { M(() => ref i); M(() => { return ref i; }); M(delegate { return ref i; }); M(() => i); M(() => { return i; }); M(delegate { return i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics(); } [Fact] public void RefLambdaInferenceArgumentBadRefReturn() { var text = @" delegate int E(); class C { static void ME(E e) { } static int i = 0; static void M() { ME(() => ref i); ME(() => { return ref i; }); ME(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (11,22): error CS8149: By-reference returns may only be used in by-reference returning methods. // ME(() => ref i); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "i").WithLocation(11, 22), // (12,20): error CS8149: By-reference returns may only be used in by-reference returning methods. // ME(() => { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(12, 20), // (13,23): error CS8149: By-reference returns may only be used in by-reference returning methods. // ME(delegate { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(13, 23)); } [Fact] public void RefLambdaInferenceDelegateCreationBadRefReturn() { var text = @" delegate int E(); class C { static int i = 0; static void M() { var e = new E(() => ref i); e = new E(() => { return ref i; }); e = new E(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (9,33): error CS8149: By-reference returns may only be used in by-reference returning methods. // var e = new E(() => ref i); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "i").WithLocation(9, 33), // (10,27): error CS8149: By-reference returns may only be used in by-reference returning methods. // e = new E(() => { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(10, 27), // (11,30): error CS8149: By-reference returns may only be used in by-reference returning methods. // e = new E(delegate { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(11, 30)); } [Fact] public void RefLambdaInferenceMixedByValueAndByRefReturns() { var text = @" delegate ref int D(); delegate int E(); class C { static void MD(D e) { } static void ME(E e) { } static int i = 0; static void M() { MD(() => { if (i == 0) { return ref i; } return i; }); ME(() => { if (i == 0) { return ref i; } return i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (18,13): error CS8150: By-value returns may only be used in by-value returning methods. // return i; Diagnostic(ErrorCode.ERR_MustHaveRefReturn, "return").WithLocation(18, 13), // (23,17): error CS8149: By-reference returns may only be used in by-reference returning methods. // return ref i; Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(23, 17)); } [WorkItem(1112875, "DevDiv")] [WorkItem(1112875, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1112875")] [Fact] public void Bug1112875_1() { var comp = CreateCompilation(@" using System; class Program { static void Main() { ICloneable c = """"; Goo(() => (c.Clone()), null); } static void Goo(Action x, string y) { } static void Goo(Func<object> x, object y) { Console.WriteLine(42); } }", options: TestOptions.ReleaseExe); comp.VerifyDiagnostics(); CompileAndVerify(comp, expectedOutput: "42"); } [WorkItem(1112875, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1112875")] [Fact] public void Bug1112875_2() { var comp = CreateCompilation(@" class Program { void M() { var d = new System.Action(() => (new object())); } } "); comp.VerifyDiagnostics( // (6,41): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // var d = new System.Action(() => (new object())); Diagnostic(ErrorCode.ERR_IllegalStatement, "(new object())").WithLocation(6, 41)); } [WorkItem(1830, "https://github.com/dotnet/roslyn/issues/1830")] [Fact] public void FuncOfVoid() { var comp = CreateCompilation(@" using System; class Program { void M1<T>(Func<T> f) {} void Main(string[] args) { M1(() => { return System.Console.Beep(); }); } } "); comp.VerifyDiagnostics( // (8,27): error CS4029: Cannot return an expression of type 'void' // M1(() => { return System.Console.Beep(); }); Diagnostic(ErrorCode.ERR_CantReturnVoid, "System.Console.Beep()").WithLocation(8, 27) ); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_01() { var src = @" using System; class Program { static Func<Program, string> stuff() { return a => a. } } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,23): error CS1001: Identifier expected // return a => a. Diagnostic(ErrorCode.ERR_IdentifierExpected, "").WithLocation(8, 23), // (8,23): error CS1002: ; expected // return a => a. Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(8, 23) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_02() { var src = @" using System; class Program { static void stuff() { Func<Program, string> l = a => a. } } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,42): error CS1001: Identifier expected // Func<Program, string> l = a => a. Diagnostic(ErrorCode.ERR_IdentifierExpected, "").WithLocation(8, 42), // (8,42): error CS1002: ; expected // Func<Program, string> l = a => a. Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(8, 42) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_03() { var src = @" using System; class Program { static void stuff() { M1(a => a.); } static void M1(Func<Program, string> l){} } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,20): error CS1001: Identifier expected // M1(a => a.); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 20) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_04() { var src = @" using System; class Program { static void stuff() { var l = (Func<Program, string>) (a => a.); } } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,49): error CS1001: Identifier expected // var l = (Func<Program, string>) (a => a.); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 49) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact] [WorkItem(3826, "https://github.com/dotnet/roslyn/issues/3826")] public void ExpressionTreeSelfAssignmentShouldError() { var source = @" using System; using System.Linq.Expressions; class Program { static void Main() { Expression<Func<int, int>> x = y => y = y; } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); compilation.VerifyDiagnostics( // (9,45): warning CS1717: Assignment made to same variable; did you mean to assign something else? // Expression<Func<int, int>> x = y => y = y; Diagnostic(ErrorCode.WRN_AssignmentToSelf, "y = y").WithLocation(9, 45), // (9,45): error CS0832: An expression tree may not contain an assignment operator // Expression<Func<int, int>> x = y => y = y; Diagnostic(ErrorCode.ERR_ExpressionTreeContainsAssignment, "y = y").WithLocation(9, 45)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2(default(Struct1))); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,40): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2(default(Struct1))); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default(Struct1)").WithArguments("Struct1").WithLocation(8, 40)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructDefaultExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2(default)); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,40): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2(default)); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default").WithArguments("Struct1").WithLocation(8, 40)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructDefaultCastExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2((Struct1) default)); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,50): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2((Struct1) default)); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default").WithArguments("Struct1").WithLocation(8, 50)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructNewExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2(new Struct1())); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,40): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2(new Struct1())); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "new Struct1()").WithArguments("Struct1").WithLocation(8, 40)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructParamExpressionTree() { var text = @" using System.Linq.Expressions; public delegate void Delegate1(Struct1 s); public class Class1 { public void Method1() { Method((Struct1 s) => Method2()); } public void Method2() { } public static void Method(Expression<Delegate1> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (9,25): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Struct1 s) => Method2()); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "s").WithArguments("Struct1").WithLocation(9, 25)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructParamLambda() { var text = @" public delegate void Delegate1(Struct1 s); public class Class1 { public void Method1() { Method((Struct1 s) => Method2()); } public void Method2() { } public static void Method(Delegate1 expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics(); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void TypedReferenceExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method(() => Method2(default)); } public void Method2(TypedReference tr) { } public static void Method(Expression<Action> expression) { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,30): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'TypedReference'. // Method(() => Method2(default)); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default").WithArguments("TypedReference").WithLocation(8, 30)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void TypedReferenceParamExpressionTree() { var text = @" using System; using System.Linq.Expressions; public delegate void Delegate1(TypedReference tr); public class Class1 { public void Method1() { Method((TypedReference tr) => Method2()); } public void Method2() { } public static void Method(Expression<Delegate1> expression) { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (9,32): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'TypedReference'. // Method((TypedReference tr) => Method2()); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "tr").WithArguments("TypedReference").WithLocation(9, 32)); } [Fact, WorkItem(5363, "https://github.com/dotnet/roslyn/issues/5363")] public void ReturnInferenceCache_Dynamic_vs_Object_01() { var source = @" using System; using System.Collections; using System.Collections.Generic; public static class Program { public static void Main(string[] args) { IEnumerable<dynamic> dynX = null; // CS1061 'object' does not contain a definition for 'Text'... // tooltip on 'var' shows IColumn instead of IEnumerable<dynamic> var result = dynX.Select(_ => _.Text); } public static IColumn Select<TResult>(this IColumn source, Func<object, TResult> selector) { throw new NotImplementedException(); } public static IEnumerable<S> Select<T, S>(this IEnumerable<T> source, Func<T, S> selector) { System.Console.WriteLine(""Select<T, S>""); return null; } } public interface IColumn { } "; var compilation = CreateCompilation(source, new[] { CSharpRef }, options: TestOptions.ReleaseExe); CompileAndVerify(compilation, expectedOutput: "Select<T, S>"); } [Fact, WorkItem(5363, "https://github.com/dotnet/roslyn/issues/5363")] public void ReturnInferenceCache_Dynamic_vs_Object_02() { var source = @" using System; using System.Collections; using System.Collections.Generic; public static class Program { public static void Main(string[] args) { IEnumerable<dynamic> dynX = null; // CS1061 'object' does not contain a definition for 'Text'... // tooltip on 'var' shows IColumn instead of IEnumerable<dynamic> var result = dynX.Select(_ => _.Text); } public static IEnumerable<S> Select<T, S>(this IEnumerable<T> source, Func<T, S> selector) { System.Console.WriteLine(""Select<T, S>""); return null; } public static IColumn Select<TResult>(this IColumn source, Func<object, TResult> selector) { throw new NotImplementedException(); } } public interface IColumn { } "; var compilation = CreateCompilation(source, new[] { CSharpRef }, options: TestOptions.ReleaseExe); CompileAndVerify(compilation, expectedOutput: "Select<T, S>"); } [Fact, WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void SyntaxAndSemanticErrorInLambda() { var source = @" using System; class C { public static void Main(string[] args) { Action a = () => { new X().ToString() }; a(); } } "; CreateCompilation(source).VerifyDiagnostics( // (7,47): error CS1002: ; expected // Action a = () => { new X().ToString() }; Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(7, 47), // (7,32): error CS0246: The type or namespace name 'X' could not be found (are you missing a using directive or an assembly reference?) // Action a = () => { new X().ToString() }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "X").WithArguments("X").WithLocation(7, 32) ); } [Fact, WorkItem(4527, "https://github.com/dotnet/roslyn/issues/4527")] public void AnonymousMethodExpressionWithoutParameterList() { var source = @" using System; using System.Threading.Tasks; namespace RoslynAsyncDelegate { class Program { static EventHandler MyEvent; static void Main(string[] args) { MyEvent += async delegate { await Task.Delay(0); }; } } } "; var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe); var tree = compilation.SyntaxTrees[0]; var model = compilation.GetSemanticModel(tree); var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AnonymousMethodExpression)).Single(); Assert.Equal("async delegate { await Task.Delay(0); }", node1.ToString()); Assert.Equal("void System.EventHandler.Invoke(System.Object sender, System.EventArgs e)", model.GetTypeInfo(node1).ConvertedType.GetMembers("Invoke").Single().ToTestDisplayString()); var lambdaParameters = ((IMethodSymbol)(model.GetSymbolInfo(node1)).Symbol).Parameters; Assert.Equal("System.Object <p0>", lambdaParameters[0].ToTestDisplayString()); Assert.Equal("System.EventArgs <p1>", lambdaParameters[1].ToTestDisplayString()); CompileAndVerify(compilation); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError01() { var source = @"using System.Linq; class C { C() { string.Empty.Select(() => { new Unbound1 }); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,58): error CS1526: A new expression requires (), [], or {} after type // class C { C() { string.Empty.Select(() => { new Unbound1 }); } } Diagnostic(ErrorCode.ERR_BadNewExpr, "}").WithLocation(2, 58), // (2,58): error CS1002: ; expected // class C { C() { string.Empty.Select(() => { new Unbound1 }); } } Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(2, 58), // (2,49): error CS0246: The type or namespace name 'Unbound1' could not be found (are you missing a using directive or an assembly reference?) // class C { C() { string.Empty.Select(() => { new Unbound1 }); } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "Unbound1").WithArguments("Unbound1").WithLocation(2, 49) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError02() { var source = @"using System.Linq; class C { C() { string.Empty.Select(() => { new Unbound1 ( ) }); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,62): error CS1002: ; expected // class C { C() { string.Empty.Select(() => { new Unbound1 ( ) }); } } Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(2, 62), // (2,49): error CS0246: The type or namespace name 'Unbound1' could not be found (are you missing a using directive or an assembly reference?) // class C { C() { string.Empty.Select(() => { new Unbound1 ( ) }); } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "Unbound1").WithArguments("Unbound1").WithLocation(2, 49) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError03() { var source = @"using System.Linq; class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,61): error CS1003: Syntax error, ',' expected // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_SyntaxError, "Unbound2").WithArguments(",", "").WithLocation(2, 61), // (2,52): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 52), // (2,61): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 61), // (2,42): error CS0103: The name 'Unbound1' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound1").WithArguments("Unbound1").WithLocation(2, 42) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError04() { var source = @"using System.Linq; class C { C() { string.Empty.Select(x => Unbound1, Unbound2); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,52): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 52), // (2,42): error CS0103: The name 'Unbound1' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound1").WithArguments("Unbound1").WithLocation(2, 42) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError05() { var source = @"using System.Linq; class C { C() { Unbound2.Select(x => Unbound1); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,17): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { Unbound2.Select(x => Unbound1); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 17), // (2,38): error CS0103: The name 'Unbound1' does not exist in the current context // class C { C() { Unbound2.Select(x => Unbound1); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound1").WithArguments("Unbound1").WithLocation(2, 38) ); } [Fact] [WorkItem(4480, "https://github.com/dotnet/roslyn/issues/4480")] public void TestLambdaWithError06() { var source = @"class Program { static void Main(string[] args) { // completion should work even in a syntactically invalid lambda var handler = new MyDelegateType((s, e) => { e. }); } } public delegate void MyDelegateType( object sender, MyArgumentType e ); public class MyArgumentType { public int SomePublicMember; }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source) .VerifyDiagnostics( // var handler = new MyDelegateType((s, e) => { e. }); Diagnostic(ErrorCode.ERR_IdentifierExpected, "}").WithLocation(6, 57), // (6,57): error CS1002: ; expected // var handler = new MyDelegateType((s, e) => { e. }); Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(6, 57) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("e", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal("MyArgumentType", typeInfo.Type.Name); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.NotEmpty(typeInfo.Type.GetMembers("SomePublicMember")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError07() { var source = @"using System; using System.Collections.Generic; public static class Program { public static void Main() { var parameter = new List<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public static class Enumerable { public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, TSource defaultValue) { return default(TSource); } public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, TSource defaultValue) { return default(TSource); } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (9,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(9, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError08() { var source = @"using System; using System.Collections.Generic; public static class Program { public static void Main() { var parameter = new List<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public static class Enumerable { public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, params TSource[] defaultValue) { return default(TSource); } public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, params TSource[] defaultValue) { return default(TSource); } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (9,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(9, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError09() { var source = @"using System; public static class Program { public static void Main() { var parameter = new MyList<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public class MyList<TSource> { public TSource FirstOrDefault(TSource defaultValue) { return default(TSource); } public TSource FirstOrDefault(Func<TSource, bool> predicate, TSource defaultValue) { return default(TSource); } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (8,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError10() { var source = @"using System; public static class Program { public static void Main() { var parameter = new MyList<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public class MyList<TSource> { public TSource FirstOrDefault(params TSource[] defaultValue) { return default(TSource); } public TSource FirstOrDefault(Func<TSource, bool> predicate, params TSource[] defaultValue) { return default(TSource); } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (8,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(557, "https://github.com/dotnet/roslyn/issues/557")] public void TestLambdaWithError11() { var source = @"using System.Linq; public static class Program { public static void Main() { var x = new { X = """".Select(c => c. Y = 0, }; } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("c", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Struct, typeInfo.Type.TypeKind); Assert.Equal("Char", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("IsHighSurrogate")); // check it is the char we know and love } [Fact] [WorkItem(5498, "https://github.com/dotnet/roslyn/issues/5498")] public void TestLambdaWithError12() { var source = @"using System.Linq; class Program { static void Main(string[] args) { var z = args.Select(a => a. var goo = } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("a", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [WorkItem(5498, "https://github.com/dotnet/roslyn/issues/5498")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] [Fact] public void TestLambdaWithError13() { // These tests ensure we attempt to perform type inference and bind a lambda expression // argument even when there are too many or too few arguments to an invocation, in the // case when there is more than one method in the method group. // See https://github.com/dotnet/roslyn/issues/11901 for the case of one method in the group var source = @"using System; class Program { static void Main(string[] args) { Thing<string> t = null; t.X1(x => x, 1); // too many args t.X2(x => x); // too few args t.M2(string.Empty, x => x, 1); // too many args t.M3(string.Empty, x => x); // too few args } } public class Thing<T> { public void M2<T>(T x, Func<T, T> func) {} public void M3<T>(T x, Func<T, T> func, T y) {} // Ensure we have more than one method in the method group public void M2() {} public void M3() {} } public static class XThing { public static Thing<T> X1<T>(this Thing<T> self, Func<T, T> func) => null; public static Thing<T> X2<T>(this Thing<T> self, Func<T, T> func, int i) => null; // Ensure we have more than one method in the method group public static void X1(this object self) {} public static void X2(this object self) {} } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(11901, "https://github.com/dotnet/roslyn/issues/11901")] public void TestLambdaWithError15() { // These tests ensure we attempt to perform type inference and bind a lambda expression // argument even when there are too many or too few arguments to an invocation, in the // case when there is exactly one method in the method group. var source = @"using System; class Program { static void Main(string[] args) { Thing<string> t = null; t.X1(x => x, 1); // too many args t.X2(x => x); // too few args t.M2(string.Empty, x => x, 1); // too many args t.M3(string.Empty, x => x); // too few args } } public class Thing<T> { public void M2<T>(T x, Func<T, T> func) {} public void M3<T>(T x, Func<T, T> func, T y) {} } public static class XThing { public static Thing<T> X1<T>(this Thing<T> self, Func<T, T> func) => null; public static Thing<T> X2<T>(this Thing<T> self, Func<T, T> func, int i) => null; } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(11901, "https://github.com/dotnet/roslyn/issues/11901")] public void TestLambdaWithError16() { // These tests ensure we use the substituted method to bind a lambda expression // argument even when there are too many or too few arguments to an invocation, in the // case when there is exactly one method in the method group. var source = @"using System; class Program { static void Main(string[] args) { Thing<string> t = null; t.X1<string>(x => x, 1); // too many args t.X2<string>(x => x); // too few args t.M2<string>(string.Empty, x => x, 1); // too many args t.M3<string>(string.Empty, x => x); // too few args } } public class Thing<T> { public void M2<T>(T x, Func<T, T> func) {} public void M3<T>(T x, Func<T, T> func, T y) {} } public static class XThing { public static Thing<T> X1<T>(this Thing<T> self, Func<T, T> func) => null; public static Thing<T> X2<T>(this Thing<T> self, Func<T, T> func, int i) => null; } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(12063, "https://github.com/dotnet/roslyn/issues/12063")] public void TestLambdaWithError17() { var source = @"using System; class Program { static void Main(string[] args) { Ma(action: (x, y) => x.ToString(), t: string.Empty); Mb(action: (x, y) => x.ToString(), t: string.Empty); } static void Ma<T>(T t, Action<T, T, int> action) { } static void Mb<T>(T t, Action<T, T, int> action) { } static void Mb() { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(12063, "https://github.com/dotnet/roslyn/issues/12063")] public void TestLambdaWithError18() { var source = @"using System; class Program { static void Main(string[] args) { Ma(string.Empty, (x, y) => x.ToString()); Mb(string.Empty, (x, y) => x.ToString()); } static void Ma<T>(T t, Action<T, T, int> action) { } static void Mb<T>(T t, Action<T, T, int> action) { } static void Mb() { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(12063, "https://github.com/dotnet/roslyn/issues/12063")] public void TestLambdaWithError19() { var source = @"using System; using System.Linq.Expressions; class Program { static void Main(string[] args) { Ma(string.Empty, (x, y) => x.ToString()); Mb(string.Empty, (x, y) => x.ToString()); Mc(string.Empty, (x, y) => x.ToString()); } static void Ma<T>(T t, Expression<Action<T, T, int>> action) { } static void Mb<T>(T t, Expression<Action<T, T, int>> action) { } static void Mb<T>(T t, Action<T, T, int> action) { } static void Mc<T>(T t, Expression<Action<T, T, int>> action) { } static void Mc() { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } // See MaxParameterListsForErrorRecovery. [Fact] public void BuildArgumentsForErrorRecovery_ManyOverloads() { BuildArgumentsForErrorRecovery_ManyOverloads_Internal(Binder.MaxParameterListsForErrorRecovery - 1, tooMany: false); BuildArgumentsForErrorRecovery_ManyOverloads_Internal(Binder.MaxParameterListsForErrorRecovery, tooMany: true); } private void BuildArgumentsForErrorRecovery_ManyOverloads_Internal(int n, bool tooMany) { var builder = new StringBuilder(); builder.AppendLine("using System;"); for (int i = 0; i < n; i++) { builder.AppendLine($"class C{i} {{ }}"); } builder.Append( @"class A { } class B { } class C { void M() { F(1, (t, a, b, c) => { }); var o = this[(a, b, c) => { }]; } "); // Too few parameters. AppendLines(builder, n, i => $" void F<T>(T t, Action<T, A, C{i}> a) {{ }}"); AppendLines(builder, n, i => $" object this[Action<A, C{i}> a] => {i}"); // Type inference failure. AppendLines(builder, n, i => $" void F<T, U>(T t, Action<T, U, C{i}> a) where U : T {{ }}"); // Too many parameters. AppendLines(builder, n, i => $" void F<T>(T t, Action<T, A, B, C, C{i}> a) {{ }}"); AppendLines(builder, n, i => $" object this[Action<A, B, C, C{i}> a] => {i}"); builder.AppendLine("}"); var source = builder.ToString(); var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); // F(1, (t, a, b, c) => { }); var lambda = lambdas[0]; var parameters = lambda.ParameterList.Parameters; var parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[0]); Assert.False(parameter.Type.IsErrorType()); Assert.Equal("System.Int32 t", parameter.ToTestDisplayString()); parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[1]); Assert.False(parameter.Type.IsErrorType()); Assert.Equal("A a", parameter.ToTestDisplayString()); parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[3]); Assert.Equal(tooMany, parameter.Type.IsErrorType()); Assert.Equal(tooMany ? "? c" : "C c", parameter.ToTestDisplayString()); // var o = this[(a, b, c) => { }]; lambda = lambdas[1]; parameters = lambda.ParameterList.Parameters; parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[0]); Assert.False(parameter.Type.IsErrorType()); Assert.Equal("A a", parameter.ToTestDisplayString()); parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[2]); Assert.Equal(tooMany, parameter.Type.IsErrorType()); Assert.Equal(tooMany ? "? c" : "C c", parameter.ToTestDisplayString()); } private static void AppendLines(StringBuilder builder, int n, Func<int, string> getLine) { for (int i = 0; i < n; i++) { builder.AppendLine(getLine(i)); } } [Fact] [WorkItem(13797, "https://github.com/dotnet/roslyn/issues/13797")] public void DelegateAsAction() { var source = @" using System; public static class C { public static void M() => Dispatch(delegate { }); public static T Dispatch<T>(Func<T> func) => default(T); public static void Dispatch(Action func) { } }"; var comp = CreateCompilation(source); CompileAndVerify(comp); } [Fact, WorkItem(278481, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=278481")] public void LambdaReturningNull_1() { var src = @" public static class ExtensionMethods { public static System.Linq.IQueryable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Linq.IQueryable<TOuter> outerValues, System.Linq.IQueryable<TInner> innerValues, System.Linq.Expressions.Expression<System.Func<TOuter, TKey>> outerKeySelector, System.Linq.Expressions.Expression<System.Func<TInner, TKey>> innerKeySelector, System.Linq.Expressions.Expression<System.Func<TOuter, TInner, TResult>> fullResultSelector, System.Linq.Expressions.Expression<System.Func<TOuter, TResult>> partialResultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { return null; } public static System.Linq.IQueryable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Linq.IQueryable<TOuter> outerValues, System.Linq.IQueryable<TInner> innerValues, System.Linq.Expressions.Expression<System.Func<TOuter, TKey>> outerKeySelector, System.Linq.Expressions.Expression<System.Func<TInner, TKey>> innerKeySelector, System.Linq.Expressions.Expression<System.Func<TOuter, TInner, TResult>> fullResultSelector, System.Linq.Expressions.Expression<System.Func<TOuter, TResult>> partialResultSelector) { System.Console.WriteLine(""1""); return null; } public static System.Collections.Generic.IEnumerable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Collections.Generic.IEnumerable<TOuter> outerValues, System.Linq.IQueryable<TInner> innerValues, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> fullResultSelector, System.Func<TOuter, TResult> partialResultSelector) { System.Console.WriteLine(""2""); return null; } public static System.Collections.Generic.IEnumerable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Collections.Generic.IEnumerable<TOuter> outerQueryable, System.Collections.Generic.IEnumerable<TInner> innerQueryable, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> resultSelector) { return null; } } partial class C { public static void Main() { System.Linq.IQueryable<A> outerValue = null; System.Linq.IQueryable<B> innerValues = null; outerValue.LeftOuterJoin(innerValues, co => co.id, coa => coa.id, (co, coa) => null, co => co); } } class A { public int id=2; } class B { public int id = 2; }"; var comp = CreateCompilationWithMscorlib40AndSystemCore(src, options: TestOptions.DebugExe); CompileAndVerify(comp, expectedOutput: "1"); } [Fact, WorkItem(296550, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=296550")] public void LambdaReturningNull_2() { var src = @" class Test1<T> { public void M1(System.Func<T> x) {} public void M1<S>(System.Func<S> x) {} public void M2<S>(System.Func<S> x) {} public void M2(System.Func<T> x) {} } class Test2 : Test1<System.> { void Main() { M1(()=> null); M2(()=> null); } } "; var comp = CreateCompilation(src, options: TestOptions.DebugDll); comp.VerifyDiagnostics( // (10,32): error CS1001: Identifier expected // class Test2 : Test1<System.> Diagnostic(ErrorCode.ERR_IdentifierExpected, ">").WithLocation(10, 32) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void LambdaSquigglesArea() { var src = @" class C { void M() { System.Func<bool, System.Action<bool>> x = x1 => x2 => { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,58): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // System.Func<bool, System.Action<bool>> x = x1 => x2 => Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "x2 =>").WithArguments("lambda expression").WithLocation(6, 58) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void LambdaSquigglesAreaInAsync() { var src = @" class C { void M() { System.Func<bool, System.Threading.Tasks.Task<System.Action<bool>>> x = async x1 => x2 => { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,93): error CS4010: Cannot convert async lambda expression to delegate type 'Task<Action<bool>>'. An async lambda expression may return void, Task or Task<T>, none of which are convertible to 'Task<Action<bool>>'. // System.Func<bool, System.Threading.Tasks.Task<System.Action<bool>>> x = async x1 => x2 => Diagnostic(ErrorCode.ERR_CantConvAsyncAnonFuncReturns, "x2 =>").WithArguments("lambda expression", "System.Threading.Tasks.Task<System.Action<bool>>").WithLocation(6, 93), // (6,90): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. // System.Func<bool, System.Threading.Tasks.Task<System.Action<bool>>> x = async x1 => x2 => Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(6, 90) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void DelegateSquigglesArea() { var src = @" class C { void M() { System.Func<bool, System.Action<bool>> x = x1 => delegate(bool x2) { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,58): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // System.Func<bool, System.Action<bool>> x = x1 => delegate(bool x2) Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "delegate(bool x2)").WithArguments("lambda expression").WithLocation(6, 58) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void DelegateWithoutArgumentsSquigglesArea() { var src = @" class C { void M() { System.Func<bool, System.Action> x = x1 => delegate { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,52): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // System.Func<bool, System.Action> x = x1 => delegate Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "delegate").WithArguments("lambda expression").WithLocation(6, 52) ); } [Fact] public void ThrowExpression_Lambda() { var src = @"using System; class C { public static void Main() { Action a = () => throw new Exception(""1""); try { a(); } catch (Exception ex) { Console.Write(ex.Message); } Func<int, int> b = x => throw new Exception(""2""); try { b(0); } catch (Exception ex) { Console.Write(ex.Message); } b = (int x) => throw new Exception(""3""); try { b(0); } catch (Exception ex) { Console.Write(ex.Message); } b = (x) => throw new Exception(""4""); try { b(0); } catch (Exception ex) { Console.Write(ex.Message); } } }"; var comp = CreateCompilationWithMscorlib40AndSystemCore(src, options: TestOptions.DebugExe); CompileAndVerify(comp, expectedOutput: "1234"); } [Fact, WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] public void InMalformedEmbeddedStatement_01() { var source = @" class Program { void method1() { if (method2()) .Any(b => b.ContentType, out var chars) { } } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); var model = comp.GetSemanticModel(tree); Assert.Equal("ContentType", contentType.ToString()); Assert.Null(model.GetSymbolInfo(contentType).Symbol); Assert.Equal(TypeKind.Error, model.GetTypeInfo(contentType).Type.TypeKind); ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); model = comp.GetSemanticModel(tree); Assert.Equal("b", b.ToString()); ISymbol symbol = model.GetSymbolInfo(b).Symbol; Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal("? b", symbol.ToTestDisplayString()); Assert.Equal(TypeKind.Error, model.GetTypeInfo(b).Type.TypeKind); ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); model = comp.GetSemanticModel(tree); symbol = model.GetDeclaredSymbol(parameterSyntax); Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal("? b", symbol.ToTestDisplayString()); } [Fact, WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] public void InMalformedEmbeddedStatement_02() { var source = @" class Program { void method1() { if (method2()) .Any(b => b.ContentType, out var chars) { } } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); var model = comp.GetSemanticModel(tree); Assert.Equal("ContentType", contentType.ToString()); var lambda = (IMethodSymbol)model.GetEnclosingSymbol(contentType.SpanStart); Assert.Equal(MethodKind.AnonymousFunction, lambda.MethodKind); ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); model = comp.GetSemanticModel(tree); Assert.Equal("b", b.ToString()); lambda = (IMethodSymbol)model.GetEnclosingSymbol(b.SpanStart); Assert.Equal(MethodKind.AnonymousFunction, lambda.MethodKind); model = comp.GetSemanticModel(tree); ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); Assert.Equal("void Program.method1()", model.GetEnclosingSymbol(parameterSyntax.SpanStart).ToTestDisplayString()); } [Fact] public void ShadowNames_Local() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M() { Action a1 = () => { object x = 0; }; // local Action<string> a2 = x => { }; // parameter Action<string> a3 = (string x) => { }; // parameter object x = null; Action a4 = () => { void x() { } }; // method Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,36): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = () => { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 36), // (10,29): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = x => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 29), // (11,37): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a3 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 37), // (13,34): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a4 = () => { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(13, 34), // (14,38): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(14, 38)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular8); comp.VerifyDiagnostics(); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Parameter() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static Action<object> F = (object x) => { Action a1 = () => { object x = 0; }; // local Action<string> a2 = x => { }; // parameter Action<string> a3 = (string x) => { }; // parameter Action a4 = () => { void x() { } }; // method Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable }; }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,36): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = () => { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 36), // (10,29): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = x => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 29), // (11,37): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a3 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 37), // (13,38): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(13, 38)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_TypeParameter() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M<x>() { Action a1 = () => { object x = 0; }; // local Action<string> a2 = x => { }; // parameter Action<string> a3 = (string x) => { }; // parameter Action a4 = () => { void x() { } }; // method Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,36): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a1 = () => { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(9, 36), // (10,29): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> a2 = x => { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(10, 29), // (11,37): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> a3 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(11, 37), // (12,34): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a4 = () => { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(12, 34), // (13,38): error CS1948: The range variable 'x' cannot have the same name as a method type parameter // Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableSameAsTypeParam, "x").WithArguments("x").WithLocation(13, 38)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_QueryParameter() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void Main(string[] args) { _ = from x in args select (Action)(() => { object x = 0; }); // local _ = from x in args select (Action<string>)(x => { }); // parameter _ = from x in args select (Action<string>)((string x) => { }); // parameter _ = from x in args select (Action)(() => { void x() { } }); // method _ = from x in args select (Action)(() => { _ = from x in new[] { 1, 2, 3 } select x; }); // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,59): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // _ = from x in args select (Action)(() => { object x = 0; }); // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 59), // (10,52): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // _ = from x in args select (Action<string>)(x => { }); // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 52), // (11,60): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // _ = from x in args select (Action<string>)((string x) => { }); // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 60), // (13,61): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // _ = from x in args select (Action)(() => { _ = from x in new[] { 1, 2, 3 } select x; }); // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(13, 61)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Local_Delegate() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M() { object x = null; Action a1 = delegate() { object x = 0; }; // local Action<string> a2 = delegate(string x) { }; // parameter Action a3 = delegate() { void x() { } }; // method Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (10,41): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = delegate() { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 41), // (11,45): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = delegate(string x) { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 45), // (12,39): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a3 = delegate() { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(12, 39), // (13,43): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(13, 43)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular8); comp.VerifyDiagnostics(); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Parameter_Delegate() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static Action<object> F = (object x) => { Action a1 = delegate() { object x = 0; }; // local Action<string> a2 = delegate(string x) { }; // parameter Action a3 = delegate() { void x() { } }; // method Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable }; }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,41): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = delegate() { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 41), // (10,45): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = delegate(string x) { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 45), // (12,43): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(12, 43)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_TypeParameter_Delegate() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M<x>() { Action a1 = delegate() { object x = 0; }; // local Action<string> a2 = delegate(string x) { }; // parameter Action a3 = delegate() { void x() { } }; // method Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,41): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a1 = delegate() { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(9, 41), // (10,45): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> a2 = delegate(string x) { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(10, 45), // (11,39): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a3 = delegate() { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(11, 39), // (12,43): error CS1948: The range variable 'x' cannot have the same name as a method type parameter // Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableSameAsTypeParam, "x").WithArguments("x").WithLocation(12, 43)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_LambdaInsideLambda() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M<T>(object x) { Action a1 = () => { Action b1 = () => { object x = 1; }; // local Action<string> b2 = (string x) => { }; // parameter }; Action a2 = () => { Action b3 = () => { object T = 3; }; // local Action<string> b4 = T => { }; // parameter }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (10,40): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action b1 = () => { object x = 1; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 40), // (11,41): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> b2 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 41), // (15,40): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action b3 = () => { object T = 3; }; // local Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(15, 40), // (16,33): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> b4 = T => { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(16, 33)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Underscore_01() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, Func<int, int>> f = _ => _ => _; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,44): error CS0136: A local or parameter named '_' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, Func<int, int>> f = _ => _ => _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "_").WithArguments("_").WithLocation(8, 44)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Underscore_02() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, int, int> f = (_, _) => 0; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,37): error CS8370: Feature 'lambda discard parameters' is not available in C# 7.3. Please use language version 9.0 or greater. // Func<int, int, int> f = (_, _) => 0; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7_3, "_").WithArguments("lambda discard parameters", "9.0").WithLocation(8, 37)); comp = CreateCompilation(source); comp.VerifyEmitDiagnostics(); } [Fact] public void ShadowNames_Nested_01() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, Func<int, Func<int, int>>> f = x => x => x => x; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,55): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, Func<int, Func<int, int>>> f = x => x => x => x; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(8, 55), // (8,60): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, Func<int, Func<int, int>>> f = x => x => x => x; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(8, 60)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Nested_02() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,87): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(8, 87), // (8,94): error CS0136: A local or parameter named 'y' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "y").WithArguments("y").WithLocation(8, 94), // (8,97): error CS0136: A local or parameter named '_' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "_").WithArguments("_").WithLocation(8, 97)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_LambdaInsideLocalFunction_01() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { void F1() { object x = null; Action a1 = () => { int x = 0; }; } void F2<T>() { Action a2 = () => { int T = 0; }; } } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (11,37): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = () => { int x = 0; }; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 37), // (15,37): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a2 = () => { int T = 0; }; Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(15, 37)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_LambdaInsideLocalFunction_02() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M<T>() { object x = null; void F() { Action<int> a1 = (int x) => { Action b1 = () => { int T = 0; }; }; Action a2 = () => { int x = 0; Action<int> b2 = (int T) => { }; }; } } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (11,35): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<int> a1 = (int x) => Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 35), // (13,41): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action b1 = () => { int T = 0; }; Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(13, 41), // (17,21): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // int x = 0; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(17, 21), // (18,39): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<int> b2 = (int T) => { }; Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(18, 39)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void LambdaAttributes_01() { var sourceA = @"using System; class A : Attribute { } class B : Attribute { } partial class Program { static Delegate D1() => (Action)([A] () => { }); static Delegate D2(int x) => (Func<int, int, int>)((int y, [A][B] int z) => x); static Delegate D3() => (Action<int, object>)(([A]_, y) => { }); Delegate D4() => (Func<int>)([return: A][B] () => GetHashCode()); }"; var sourceB = @"using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; partial class Program { static string GetAttributeString(object a) { return a.GetType().FullName; } static void Report(Delegate d) { var m = d.Method; var forMethod = ToString(""method"", m.GetCustomAttributes(inherit: false)); var forReturn = ToString(""return"", m.ReturnTypeCustomAttributes.GetCustomAttributes(inherit: false)); var forParameters = ToString(""parameter"", m.GetParameters().SelectMany(p => p.GetCustomAttributes(inherit: false))); Console.WriteLine(""{0}:{1}{2}{3}"", m.Name, forMethod, forReturn, forParameters); } static string ToString(string target, IEnumerable<object> attributes) { var builder = new StringBuilder(); foreach (var attribute in attributes) builder.Append($"" [{target}: {attribute}]""); return builder.ToString(); } static void Main() { Report(D1()); Report(D2(0)); Report(D3()); Report(new Program().D4()); } }"; var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular10, options: TestOptions.ReleaseExe); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); var pairs = exprs.Select(e => (e, model.GetSymbolInfo(e).Symbol)).ToArray(); var expectedAttributes = new[] { "[A] () => { }: [method: A]", "(int y, [A][B] int z) => x: [parameter: A] [parameter: B]", "([A]_, y) => { }: [parameter: A]", "[return: A][B] () => GetHashCode(): [method: B] [return: A]", }; AssertEx.Equal(expectedAttributes, pairs.Select(p => getAttributesInternal(p.Item1, p.Item2))); AssertEx.Equal(expectedAttributes, pairs.Select(p => getAttributesPublic(p.Item1, p.Item2))); CompileAndVerify(comp, expectedOutput: @"<D1>b__0_0: [method: A] <D2>b__0: [parameter: A] [parameter: B] <D3>b__2_0: [parameter: A] <D4>b__3_0: [method: System.Runtime.CompilerServices.CompilerGeneratedAttribute] [method: B] [return: A]"); static string getAttributesInternal(LambdaExpressionSyntax expr, ISymbol symbol) { var method = symbol.GetSymbol<MethodSymbol>(); return format(expr, method.GetAttributes(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.GetAttributes())); } static string getAttributesPublic(LambdaExpressionSyntax expr, ISymbol symbol) { var method = (IMethodSymbol)symbol; return format(expr, method.GetAttributes(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.GetAttributes())); } static string format(LambdaExpressionSyntax expr, IEnumerable<object> methodAttributes, IEnumerable<object> returnAttributes, IEnumerable<object> parameterAttributes) { var forMethod = toString("method", methodAttributes); var forReturn = toString("return", returnAttributes); var forParameters = toString("parameter", parameterAttributes); return $"{expr}:{forMethod}{forReturn}{forParameters}"; } static string toString(string target, IEnumerable<object> attributes) { var builder = new StringBuilder(); foreach (var attribute in attributes) builder.Append($" [{target}: {attribute}]"); return builder.ToString(); } } [Fact] public void LambdaAttributes_02() { var source = @"using System; class AAttribute : Attribute { } class BAttribute : Attribute { } class C { static void Main() { Action<object, object> a; a = [A, B] (x, y) => { }; a = ([A] x, [B] y) => { }; a = (object x, [A][B] object y) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9); comp.VerifyDiagnostics( // (9,13): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = [A, B] (x, y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[A, B]").WithArguments("lambda attributes", "10.0").WithLocation(9, 13), // (10,14): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = ([A] x, [B] y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[A]").WithArguments("lambda attributes", "10.0").WithLocation(10, 14), // (10,21): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = ([A] x, [B] y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[B]").WithArguments("lambda attributes", "10.0").WithLocation(10, 21), // (11,24): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = (object x, [A][B] object y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[A]").WithArguments("lambda attributes", "10.0").WithLocation(11, 24), // (11,27): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = (object x, [A][B] object y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[B]").WithArguments("lambda attributes", "10.0").WithLocation(11, 27)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular10); comp.VerifyDiagnostics(); } [Fact] public void LambdaAttributes_03() { var source = @"using System; class AAttribute : Attribute { } class BAttribute : Attribute { } class C { static void Main() { Action<object, object> a = delegate (object x, [A][B] object y) { }; Func<object, object> f = [A][B] x => x; } }"; var expectedDiagnostics = new[] { // (8,56): error CS7014: Attributes are not valid in this context. // Action<object, object> a = delegate (object x, [A][B] object y) { }; Diagnostic(ErrorCode.ERR_AttributesNotAllowed, "[A]").WithLocation(8, 56), // (8,59): error CS7014: Attributes are not valid in this context. // Action<object, object> a = delegate (object x, [A][B] object y) { }; Diagnostic(ErrorCode.ERR_AttributesNotAllowed, "[B]").WithLocation(8, 59), // (9,34): error CS8916: Attributes on lambda expressions require a parenthesized parameter list. // Func<object, object> f = [A][B] x => x; Diagnostic(ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression, "[A]").WithLocation(9, 34), // (9,37): error CS8916: Attributes on lambda expressions require a parenthesized parameter list. // Func<object, object> f = [A][B] x => x; Diagnostic(ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression, "[B]").WithLocation(9, 37) }; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9); comp.VerifyDiagnostics(expectedDiagnostics); comp = CreateCompilation(source, parseOptions: TestOptions.Regular10); comp.VerifyDiagnostics(expectedDiagnostics); } [Fact] public void LambdaAttributes_04() { var sourceA = @"namespace N1 { class A1Attribute : System.Attribute { } } namespace N2 { class A2Attribute : System.Attribute { } }"; var sourceB = @"using N1; using N2; class Program { static void Main() { System.Action a1 = [A1] () => { }; System.Action<object> a2 = ([A2] object obj) => { }; } }"; var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); } [Fact] public void LambdaAttributes_05() { var source = @"class Program { static void Main() { System.Action a1 = [A1] () => { }; System.Func<object> a2 = [return: A2] () => null; System.Action<object> a3 = ([A3] object obj) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (5,29): error CS0246: The type or namespace name 'A1Attribute' could not be found (are you missing a using directive or an assembly reference?) // System.Action a1 = [A1] () => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A1").WithArguments("A1Attribute").WithLocation(5, 29), // (5,29): error CS0246: The type or namespace name 'A1' could not be found (are you missing a using directive or an assembly reference?) // System.Action a1 = [A1] () => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A1").WithArguments("A1").WithLocation(5, 29), // (6,43): error CS0246: The type or namespace name 'A2Attribute' could not be found (are you missing a using directive or an assembly reference?) // System.Func<object> a2 = [return: A2] () => null; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A2").WithArguments("A2Attribute").WithLocation(6, 43), // (6,43): error CS0246: The type or namespace name 'A2' could not be found (are you missing a using directive or an assembly reference?) // System.Func<object> a2 = [return: A2] () => null; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A2").WithArguments("A2").WithLocation(6, 43), // (7,38): error CS0246: The type or namespace name 'A3Attribute' could not be found (are you missing a using directive or an assembly reference?) // System.Action<object> a3 = ([A3] object obj) => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A3").WithArguments("A3Attribute").WithLocation(7, 38), // (7,38): error CS0246: The type or namespace name 'A3' could not be found (are you missing a using directive or an assembly reference?) // System.Action<object> a3 = ([A3] object obj) => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A3").WithArguments("A3").WithLocation(7, 38)); } [Fact] public void LambdaAttributes_06() { var source = @"using System; class AAttribute : Attribute { public AAttribute(Action a) { } } [A([B] () => { })] class BAttribute : Attribute { }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (6,2): error CS0181: Attribute constructor parameter 'a' has type 'Action', which is not a valid attribute parameter type // [A([B] () => { })] Diagnostic(ErrorCode.ERR_BadAttributeParamType, "A").WithArguments("a", "System.Action").WithLocation(6, 2)); } [Fact] public void LambdaAttributes_BadAttributeLocation() { var source = @"using System; [AttributeUsage(AttributeTargets.Property)] class PropAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] class MethodAttribute : Attribute { } [AttributeUsage(AttributeTargets.ReturnValue)] class ReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter)] class ParamAttribute : Attribute { } [AttributeUsage(AttributeTargets.GenericParameter)] class TypeParamAttribute : Attribute { } class Program { static void Main() { Action<object> a = [Prop] // 1 [Return] // 2 [Method] [return: Prop] // 3 [return: Return] [return: Method] // 4 ( [Param] [TypeParam] // 5 object o) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (23,14): error CS0592: Attribute 'Prop' is not valid on this declaration type. It is only valid on 'property, indexer' declarations. // [Prop] // 1 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Prop").WithArguments("Prop", "property, indexer").WithLocation(23, 14), // (24,14): error CS0592: Attribute 'Return' is not valid on this declaration type. It is only valid on 'return' declarations. // [Return] // 2 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Return").WithArguments("Return", "return").WithLocation(24, 14), // (26,22): error CS0592: Attribute 'Prop' is not valid on this declaration type. It is only valid on 'property, indexer' declarations. // [return: Prop] // 3 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Prop").WithArguments("Prop", "property, indexer").WithLocation(26, 22), // (28,22): error CS0592: Attribute 'Method' is not valid on this declaration type. It is only valid on 'method' declarations. // [return: Method] // 4 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Method").WithArguments("Method", "method").WithLocation(28, 22), // (31,14): error CS0592: Attribute 'TypeParam' is not valid on this declaration type. It is only valid on 'type parameter' declarations. // [TypeParam] // 5 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "TypeParam").WithArguments("TypeParam", "type parameter").WithLocation(31, 14)); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var symbol = (IMethodSymbol)model.GetSymbolInfo(lambda).Symbol; Assert.NotNull(symbol); verifyAttributes(symbol.GetAttributes(), "PropAttribute", "ReturnAttribute", "MethodAttribute"); verifyAttributes(symbol.GetReturnTypeAttributes(), "PropAttribute", "ReturnAttribute", "MethodAttribute"); verifyAttributes(symbol.Parameters[0].GetAttributes(), "ParamAttribute", "TypeParamAttribute"); void verifyAttributes(ImmutableArray<AttributeData> attributes, params string[] expectedAttributeNames) { var actualAttributes = attributes.SelectAsArray(a => a.AttributeClass.GetSymbol()); var expectedAttributes = expectedAttributeNames.Select(n => comp.GetTypeByMetadataName(n)); AssertEx.Equal(expectedAttributes, actualAttributes); } } [Fact] public void LambdaAttributes_AttributeSemanticModel() { var source = @"using System; class AAttribute : Attribute { } class BAttribute : Attribute { } class CAttribute : Attribute { } class DAttribute : Attribute { } class Program { static void Main() { Action a = [A] () => { }; Func<object> b = [return: B] () => null; Action<object> c = ([C] object obj) => { }; Func<object, object> d = [D] x => x; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (13,34): error CS8916: Attributes on lambda expressions require a parenthesized parameter list. // Func<object, object> d = [D] x => x; Diagnostic(ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression, "[D]").WithLocation(13, 34)); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>(); var actualAttributes = attributeSyntaxes.Select(a => model.GetSymbolInfo(a).Symbol.GetSymbol<MethodSymbol>()).ToImmutableArray(); var expectedAttributes = new[] { "AAttribute", "BAttribute", "CAttribute", "DAttribute" }.Select(a => comp.GetTypeByMetadataName(a).InstanceConstructors.Single()).ToImmutableArray(); AssertEx.Equal(expectedAttributes, actualAttributes); } [Theory] [InlineData("Action a = [A] () => { };")] [InlineData("Func<object> f = [return: A] () => null;")] [InlineData("Action<int> a = ([A] int i) => { };")] public void LambdaAttributes_SpeculativeSemanticModel(string statement) { string source = $@"using System; class AAttribute : Attribute {{ }} class Program {{ static void Main() {{ {statement} }} }}"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var a = (IdentifierNameSyntax)tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; Assert.Equal("A", a.Identifier.Text); var attrInfo = model.GetSymbolInfo(a); var attrType = comp.GetMember<NamedTypeSymbol>("AAttribute").GetPublicSymbol(); var attrCtor = attrType.GetMember(".ctor"); Assert.Equal(attrCtor, attrInfo.Symbol); // Assert that this is also true for the speculative semantic model var newTree = SyntaxFactory.ParseSyntaxTree(source + " "); var m = newTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); Assert.True(model.TryGetSpeculativeSemanticModelForMethodBody(m.Body.SpanStart, m, out model)); a = (IdentifierNameSyntax)newTree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; Assert.Equal("A", a.Identifier.Text); // If we aren't using the right binder here, the compiler crashes going through the binder factory var info = model.GetSymbolInfo(a); // This behavior is wrong. See https://github.com/dotnet/roslyn/issues/24135 Assert.Equal(attrType, info.Symbol); } [Fact] public void LambdaAttributes_DisallowedAttributes() { var source = @"using System; using System.Runtime.CompilerServices; namespace System.Runtime.CompilerServices { public class IsReadOnlyAttribute : Attribute { } public class IsUnmanagedAttribute : Attribute { } public class IsByRefLikeAttribute : Attribute { } public class NullableContextAttribute : Attribute { public NullableContextAttribute(byte b) { } } } class Program { static void Main() { Action a = [IsReadOnly] // 1 [IsUnmanaged] // 2 [IsByRefLike] // 3 [Extension] // 4 [NullableContext(0)] // 5 () => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (15,14): error CS8335: Do not use 'System.Runtime.CompilerServices.IsReadOnlyAttribute'. This is reserved for compiler usage. // [IsReadOnly] // 1 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "IsReadOnly").WithArguments("System.Runtime.CompilerServices.IsReadOnlyAttribute").WithLocation(15, 14), // (16,14): error CS8335: Do not use 'System.Runtime.CompilerServices.IsUnmanagedAttribute'. This is reserved for compiler usage. // [IsUnmanaged] // 2 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "IsUnmanaged").WithArguments("System.Runtime.CompilerServices.IsUnmanagedAttribute").WithLocation(16, 14), // (17,14): error CS8335: Do not use 'System.Runtime.CompilerServices.IsByRefLikeAttribute'. This is reserved for compiler usage. // [IsByRefLike] // 3 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "IsByRefLike").WithArguments("System.Runtime.CompilerServices.IsByRefLikeAttribute").WithLocation(17, 14), // (18,14): error CS1112: Do not use 'System.Runtime.CompilerServices.ExtensionAttribute'. Use the 'this' keyword instead. // [Extension] // 4 Diagnostic(ErrorCode.ERR_ExplicitExtension, "Extension").WithLocation(18, 14), // (19,14): error CS8335: Do not use 'System.Runtime.CompilerServices.NullableContextAttribute'. This is reserved for compiler usage. // [NullableContext(0)] // 5 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "NullableContext(0)").WithArguments("System.Runtime.CompilerServices.NullableContextAttribute").WithLocation(19, 14)); } [Fact] public void LambdaAttributes_DisallowedSecurityAttributes() { var source = @"using System; using System.Security; class Program { static void Main() { Action a = [SecurityCritical] // 1 [SecuritySafeCriticalAttribute] // 2 async () => { }; // 3 } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,14): error CS4030: Security attribute 'SecurityCritical' cannot be applied to an Async method. // [SecurityCritical] // 1 Diagnostic(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync, "SecurityCritical").WithArguments("SecurityCritical").WithLocation(8, 14), // (9,14): error CS4030: Security attribute 'SecuritySafeCriticalAttribute' cannot be applied to an Async method. // [SecuritySafeCriticalAttribute] // 2 Diagnostic(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync, "SecuritySafeCriticalAttribute").WithArguments("SecuritySafeCriticalAttribute").WithLocation(9, 14), // (10,22): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. // async () => { }; // 3 Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(10, 22)); } [Fact] public void LambdaAttributes_ObsoleteAttribute() { var source = @"using System; class Program { static void Report(Action a) { foreach (var attribute in a.Method.GetCustomAttributes(inherit: false)) Console.Write(attribute); } static void Main() { Report([Obsolete] () => { }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview, options: TestOptions.ReleaseExe); CompileAndVerify(comp, expectedOutput: "System.ObsoleteAttribute"); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var symbol = model.GetSymbolInfo(expr).Symbol; Assert.Equal("System.ObsoleteAttribute", symbol.GetAttributes().Single().ToString()); } [Fact] public void LambdaParameterAttributes_Conditional() { var source = @"using System; using System.Diagnostics; class Program { static void Report(Action a) { } static void Main() { Report([Conditional(""DEBUG"")] static () => { }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview, options: TestOptions.ReleaseExe); comp.VerifyDiagnostics( // (10,17): error CS0577: The Conditional attribute is not valid on 'lambda expression' because it is a constructor, destructor, operator, lambda expression, or explicit interface implementation // Report([Conditional("DEBUG")] static () => { }); Diagnostic(ErrorCode.ERR_ConditionalOnSpecialMethod, @"Conditional(""DEBUG"")").WithArguments("lambda expression").WithLocation(10, 17)); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); var lambda = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)).Single(); Assert.Equal(new[] { "DEBUG" }, lambda.GetAppliedConditionalSymbols()); } [Fact] public void LambdaAttributes_WellKnownAttributes() { var sourceA = @"using System; using System.Runtime.InteropServices; using System.Security; class Program { static void Main() { Action a1 = [DllImport(""MyModule.dll"")] static () => { }; Action a2 = [DynamicSecurityMethod] () => { }; Action a3 = [SuppressUnmanagedCodeSecurity] () => { }; Func<object> a4 = [return: MarshalAs((short)0)] () => null; } }"; var sourceB = @"namespace System.Security { internal class DynamicSecurityMethodAttribute : Attribute { } }"; var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,22): error CS0601: The DllImport attribute must be specified on a method marked 'static' and 'extern' // Action a1 = [DllImport("MyModule.dll")] static () => { }; Diagnostic(ErrorCode.ERR_DllImportOnInvalidMethod, "DllImport").WithLocation(8, 22)); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(4, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Null(lambdas[0].GetDllImportData()); // [DllImport] is ignored if there are errors. Assert.True(lambdas[1].RequiresSecurityObject); Assert.True(lambdas[2].HasDeclarativeSecurity); Assert.Equal(default, lambdas[3].ReturnValueMarshallingInformation.UnmanagedType); } [Fact] public void LambdaAttributes_Permissions() { var source = @"#pragma warning disable 618 using System; using System.Security.Permissions; class Program { static void Main() { Action a1 = [PermissionSet(SecurityAction.Deny)] () => { }; } }"; var comp = CreateCompilationWithMscorlib40(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); var lambda = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)).Single(); Assert.NotEmpty(lambda.GetSecurityInformation()); } [Fact] public void LambdaAttributes_NullableAttributes_01() { var source = @"using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Func<object> a1 = [return: MaybeNull][return: NotNull] () => null; Func<object, object> a2 = [return: NotNullIfNotNull(""obj"")] (object obj) => obj; Func<bool> a4 = [MemberNotNull(""x"")][MemberNotNullWhen(false, ""y"")][MemberNotNullWhen(true, ""z"")] () => true; } }"; var comp = CreateCompilation( new[] { source, MaybeNullAttributeDefinition, NotNullAttributeDefinition, NotNullIfNotNullAttributeDefinition, MemberNotNullAttributeDefinition, MemberNotNullWhenAttributeDefinition }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(3, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Equal(FlowAnalysisAnnotations.MaybeNull | FlowAnalysisAnnotations.NotNull, lambdas[0].ReturnTypeFlowAnalysisAnnotations); Assert.Equal(new[] { "obj" }, lambdas[1].ReturnNotNullIfParameterNotNull); Assert.Equal(new[] { "x" }, lambdas[2].NotNullMembers); Assert.Equal(new[] { "y" }, lambdas[2].NotNullWhenFalseMembers); Assert.Equal(new[] { "z" }, lambdas[2].NotNullWhenTrueMembers); } [Fact] public void LambdaAttributes_NullableAttributes_02() { var source = @"#nullable enable using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Func<object> a1 = [return: MaybeNull] () => null; Func<object?> a2 = [return: NotNull] () => null; } }"; var comp = CreateCompilation(new[] { source, MaybeNullAttributeDefinition, NotNullAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Report WRN_NullReferenceReturn for a2, not for a1. comp.VerifyDiagnostics( // (8,53): warning CS8603: Possible null reference return. // Func<object> a1 = [return: MaybeNull] () => null; Diagnostic(ErrorCode.WRN_NullReferenceReturn, "null").WithLocation(8, 53)); } [Fact] public void LambdaAttributes_NullableAttributes_03() { var source = @"#nullable enable using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Action<object> a1 = ([AllowNull] x) => { x.ToString(); }; Action<object?> a2 = ([DisallowNull] x) => { x.ToString(); }; } }"; var comp = CreateCompilation(new[] { source, AllowNullAttributeDefinition, DisallowNullAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Report nullability mismatch warning assigning lambda to a2. comp.VerifyDiagnostics( // (8,50): warning CS8602: Dereference of a possibly null reference. // Action<object> a1 = ([AllowNull] x) => { x.ToString(); }; Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(8, 50)); } [WorkItem(55013, "https://github.com/dotnet/roslyn/issues/55013")] [Fact] public void NullableTypeArraySwitchPattern() { var source = @"#nullable enable class C { object? field; string Prop => field switch { string?[] a => ""a"" }; }"; var comp = CreateCompilation(source); comp.VerifyDiagnostics( // (4,13): warning CS0649: Field 'C.field' is never assigned to, and will always have its default value null // object? field; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "field").WithArguments("C.field", "null").WithLocation(4, 13), // (5,26): warning CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '_' is not covered. // string Prop => field switch Diagnostic(ErrorCode.WRN_SwitchExpressionNotExhaustive, "switch").WithArguments("_").WithLocation(5, 26)); } [Fact] public void LambdaAttributes_DoesNotReturn() { var source = @"using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Action a1 = [DoesNotReturn] () => { }; Action a2 = [DoesNotReturn] () => throw new Exception(); } }"; var comp = CreateCompilation(new[] { source, DoesNotReturnAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Report warning that lambda expression in a1 initializer returns. comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(2, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Equal(FlowAnalysisAnnotations.DoesNotReturn, lambdas[0].FlowAnalysisAnnotations); Assert.Equal(FlowAnalysisAnnotations.DoesNotReturn, lambdas[1].FlowAnalysisAnnotations); } [Fact] public void LambdaAttributes_UnmanagedCallersOnly() { var source = @"using System; using System.Runtime.InteropServices; class Program { static void Main() { Action a = [UnmanagedCallersOnly] static () => { }; } }"; var comp = CreateCompilation(new[] { source, UnmanagedCallersOnlyAttributeDefinition }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,21): error CS8896: 'UnmanagedCallersOnly' can only be applied to ordinary static non-abstract methods or static local functions. // Action a = [UnmanagedCallersOnly] static () => { }; Diagnostic(ErrorCode.ERR_UnmanagedCallersOnlyRequiresStatic, "UnmanagedCallersOnly").WithLocation(7, 21)); } [Fact] public void LambdaParameterAttributes_OptionalAndDefaultValueAttributes() { var source = @"using System; using System.Runtime.InteropServices; class Program { static void Main() { Action<int> a1 = ([Optional, DefaultParameterValue(2)] int i) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); var lambda = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)).Single(); var parameter = (SourceParameterSymbol)lambda.Parameters[0]; Assert.True(parameter.HasOptionalAttribute); Assert.False(parameter.HasExplicitDefaultValue); Assert.Equal(2, parameter.DefaultValueFromAttributes.Value); } [ConditionalFact(typeof(DesktopOnly))] public void LambdaParameterAttributes_WellKnownAttributes() { var source = @"using System; using System.Runtime.CompilerServices; class Program { static void Main() { Action<object> a1 = ([IDispatchConstant] object obj) => { }; Action<object> a2 = ([IUnknownConstant] object obj) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(2, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.True(lambdas[0].Parameters[0].IsIDispatchConstant); Assert.True(lambdas[1].Parameters[0].IsIUnknownConstant); } [Fact] public void LambdaParameterAttributes_NullableAttributes_01() { var source = @"using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Action<object> a1 = ([AllowNull][MaybeNullWhen(false)] object obj) => { }; Action<object, object> a2 = (object x, [NotNullIfNotNull(""x"")] object y) => { }; } }"; var comp = CreateCompilation( new[] { source, AllowNullAttributeDefinition, MaybeNullWhenAttributeDefinition, NotNullIfNotNullAttributeDefinition }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(2, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Equal(FlowAnalysisAnnotations.AllowNull | FlowAnalysisAnnotations.MaybeNullWhenFalse, lambdas[0].Parameters[0].FlowAnalysisAnnotations); Assert.Equal(new[] { "x" }, lambdas[1].Parameters[1].NotNullIfParameterNotNull); } [Fact] public void LambdaParameterAttributes_NullableAttributes_02() { var source = @"#nullable enable using System.Diagnostics.CodeAnalysis; delegate bool D(out object? obj); class Program { static void Main() { D d = ([NotNullWhen(true)] out object? obj) => { obj = null; return true; }; } }"; var comp = CreateCompilation(new[] { source, NotNullWhenAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Should report WRN_ParameterConditionallyDisallowsNull. comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var lambda = GetLambdaSymbol(model, expr); Assert.Equal(FlowAnalysisAnnotations.NotNullWhenTrue, lambda.Parameters[0].FlowAnalysisAnnotations); } [Fact] public void LambdaReturnType_01() { var source = @"using System; class Program { static void F<T>() { Func<T> f1 = T () => default; Func<T, T> f2 = T (x) => { return x; }; Func<T, T> f3 = T (T x) => x; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9); comp.VerifyDiagnostics( // (6,22): error CS8773: Feature 'lambda return type' is not available in C# 9.0. Please use language version 10.0 or greater. // Func<T> f1 = T () => default; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "T").WithArguments("lambda return type", "10.0").WithLocation(6, 22), // (7,25): error CS8773: Feature 'lambda return type' is not available in C# 9.0. Please use language version 10.0 or greater. // Func<T, T> f2 = T (x) => { return x; }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "T").WithArguments("lambda return type", "10.0").WithLocation(7, 25), // (8,25): error CS8773: Feature 'lambda return type' is not available in C# 9.0. Please use language version 10.0 or greater. // Func<T, T> f3 = T (T x) => x; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "T").WithArguments("lambda return type", "10.0").WithLocation(8, 25)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular10); comp.VerifyDiagnostics(); } [Fact] public void LambdaReturnType_02() { var source = @"using System; class Program { static void F<T, U>() { Func<T> f1; Func<U> f2; f1 = T () => default; f2 = T () => default; f1 = U () => default; f2 = U () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,14): error CS8934: Cannot convert lambda expression to type 'Func<U>' because the return type does not match the delegate return type // f2 = T () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T () => default").WithArguments("lambda expression", "System.Func<U>").WithLocation(9, 14), // (10,14): error CS8934: Cannot convert lambda expression to type 'Func<T>' because the return type does not match the delegate return type // f1 = U () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "U () => default").WithArguments("lambda expression", "System.Func<T>").WithLocation(10, 14)); } [Fact] public void LambdaReturnType_03() { var source = @"using System; class Program { static void F<T, U>() where U : T { Func<T> f1; Func<U> f2; f1 = T () => default; f2 = T () => default; f1 = U () => default; f2 = U () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,14): error CS8934: Cannot convert lambda expression to type 'Func<U>' because the return type does not match the delegate return type // f2 = T () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T () => default").WithArguments("lambda expression", "System.Func<U>").WithLocation(9, 14), // (10,14): error CS8934: Cannot convert lambda expression to type 'Func<T>' because the return type does not match the delegate return type // f1 = U () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "U () => default").WithArguments("lambda expression", "System.Func<T>").WithLocation(10, 14)); } [Fact] public void LambdaReturnType_04() { var source = @"using System; using System.Linq.Expressions; class Program { static void F<T, U>() { Expression<Func<T>> e1; Expression<Func<U>> e2; e1 = T () => default; e2 = T () => default; e1 = U () => default; e2 = U () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,14): error CS8934: Cannot convert lambda expression to type 'Expression<Func<U>>' because the return type does not match the delegate return type // e2 = T () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T () => default").WithArguments("lambda expression", "System.Linq.Expressions.Expression<System.Func<U>>").WithLocation(10, 14), // (11,14): error CS8934: Cannot convert lambda expression to type 'Expression<Func<T>>' because the return type does not match the delegate return type // e1 = U () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "U () => default").WithArguments("lambda expression", "System.Linq.Expressions.Expression<System.Func<T>>").WithLocation(11, 14)); } [Fact] public void LambdaReturnType_05() { var source = @"#nullable enable using System; class Program { static void Main() { Func<dynamic> f1 = object () => default!; Func<(int, int)> f2 = (int X, int Y) () => default; Func<string?> f3 = string () => default!; Func<IntPtr> f4 = nint () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,28): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string?>' (possibly because of nullability attributes). // Func<string?> f3 = string () => default!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string () => default!").WithArguments("lambda expression", "System.Func<string?>").WithLocation(9, 28)); } [Fact] public void LambdaReturnType_06() { var source = @"#nullable enable using System; using System.Linq.Expressions; class Program { static void Main() { Expression<Func<object>> e1 = dynamic () => default!; Expression<Func<(int X, int Y)>> e2 = (int, int) () => default; Expression<Func<string>> e3 = string? () => default; Expression<Func<nint>> e4 = IntPtr () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,39): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string>' (possibly because of nullability attributes). // Expression<Func<string>> e3 = string? () => default; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string? () => default").WithArguments("lambda expression", "System.Func<string>").WithLocation(10, 39)); } [Fact] public void LambdaReturnType_07() { var source = @"#nullable enable using System; struct S<T> { } class Program { static void Main() { Delegate d1 = string? () => default; Delegate d2 = string () => default; Delegate d3 = S<object?> () => default(S<object?>); Delegate d4 = S<object?> () => default(S<object>); Delegate d5 = S<object> () => default(S<object?>); Delegate d6 = S<object> () => default(S<object>); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,36): warning CS8603: Possible null reference return. // Delegate d2 = string () => default; Diagnostic(ErrorCode.WRN_NullReferenceReturn, "default").WithLocation(9, 36), // (11,40): warning CS8619: Nullability of reference types in value of type 'S<object>' doesn't match target type 'S<object?>'. // Delegate d4 = S<object?> () => default(S<object>); Diagnostic(ErrorCode.WRN_NullabilityMismatchInAssignment, "default(S<object>)").WithArguments("S<object>", "S<object?>").WithLocation(11, 40), // (12,39): warning CS8619: Nullability of reference types in value of type 'S<object?>' doesn't match target type 'S<object>'. // Delegate d5 = S<object> () => default(S<object?>); Diagnostic(ErrorCode.WRN_NullabilityMismatchInAssignment, "default(S<object?>)").WithArguments("S<object?>", "S<object>").WithLocation(12, 39)); } [Fact] public void LambdaReturnType_08() { var source = @"#nullable enable using System; struct S<T> { } class Program { static void Main() { Func<string?> f1 = string? () => throw null!; Func<string?> f2 = string () => throw null!; Func<string> f3 = string? () => throw null!; Func<string> f4 = string () => throw null!; Func<S<object?>> f5 = S<object?> () => throw null!; Func<S<object?>> f6 = S<object> () => throw null!; Func<S<object>> f7 = S<object?> () => throw null!; Func<S<object>> f8 = S<object> () => throw null!; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,28): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string?>' (possibly because of nullability attributes). // Func<string?> f2 = string () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string () => throw null!").WithArguments("lambda expression", "System.Func<string?>").WithLocation(9, 28), // (10,27): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string>' (possibly because of nullability attributes). // Func<string> f3 = string? () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string? () => throw null!").WithArguments("lambda expression", "System.Func<string>").WithLocation(10, 27), // (13,31): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<S<object?>>' (possibly because of nullability attributes). // Func<S<object?>> f6 = S<object> () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "S<object> () => throw null!").WithArguments("lambda expression", "System.Func<S<object?>>").WithLocation(13, 31), // (14,30): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<S<object>>' (possibly because of nullability attributes). // Func<S<object>> f7 = S<object?> () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "S<object?> () => throw null!").WithArguments("lambda expression", "System.Func<S<object>>").WithLocation(14, 30)); } [Fact] public void LambdaReturnType_09() { var source = @"#nullable enable struct S<T> { } delegate ref T D1<T>(); delegate ref readonly T D2<T>(); class Program { static void Main() { D1<S<object?>> f1 = (ref S<object?> () => throw null!); D1<S<object?>> f2 = (ref S<object> () => throw null!); D1<S<object>> f3 = (ref S<object?> () => throw null!); D1<S<object>> f4 = (ref S<object> () => throw null!); D2<S<object?>> f5 = (ref readonly S<object?> () => throw null!); D2<S<object?>> f6 = (ref readonly S<object> () => throw null!); D2<S<object>> f7 = (ref readonly S<object?> () => throw null!); D2<S<object>> f8 = (ref readonly S<object> () => throw null!); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,30): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D1<S<object?>>' (possibly because of nullability attributes). // D1<S<object?>> f2 = (ref S<object> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref S<object> () => throw null!").WithArguments("lambda expression", "D1<S<object?>>").WithLocation(10, 30), // (11,29): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D1<S<object>>' (possibly because of nullability attributes). // D1<S<object>> f3 = (ref S<object?> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref S<object?> () => throw null!").WithArguments("lambda expression", "D1<S<object>>").WithLocation(11, 29), // (14,30): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D2<S<object?>>' (possibly because of nullability attributes). // D2<S<object?>> f6 = (ref readonly S<object> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref readonly S<object> () => throw null!").WithArguments("lambda expression", "D2<S<object?>>").WithLocation(14, 30), // (15,29): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D2<S<object>>' (possibly because of nullability attributes). // D2<S<object>> f7 = (ref readonly S<object?> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref readonly S<object?> () => throw null!").WithArguments("lambda expression", "D2<S<object>>").WithLocation(15, 29)); } [Fact] public void LambdaReturnType_10() { var source = @"delegate T D1<T>(ref T t); delegate ref T D2<T>(ref T t); delegate ref readonly T D3<T>(ref T t); class Program { static void F<T>() { D1<T> d1; D2<T> d2; D3<T> d3; d1 = T (ref T t) => t; d2 = T (ref T t) => t; d3 = T (ref T t) => t; d1 = (ref T (ref T t) => ref t); d2 = (ref T (ref T t) => ref t); d3 = (ref T (ref T t) => ref t); d1 = (ref readonly T (ref T t) => ref t); d2 = (ref readonly T (ref T t) => ref t); d3 = (ref readonly T (ref T t) => ref t); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (12,14): error CS8934: Cannot convert lambda expression to type 'D2<T>' because the return type does not match the delegate return type // d2 = T (ref T t) => t; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T (ref T t) => t").WithArguments("lambda expression", "D2<T>").WithLocation(12, 14), // (13,14): error CS8934: Cannot convert lambda expression to type 'D3<T>' because the return type does not match the delegate return type // d3 = T (ref T t) => t; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T (ref T t) => t").WithArguments("lambda expression", "D3<T>").WithLocation(13, 14), // (14,15): error CS8934: Cannot convert lambda expression to type 'D1<T>' because the return type does not match the delegate return type // d1 = (ref T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref T (ref T t) => ref t").WithArguments("lambda expression", "D1<T>").WithLocation(14, 15), // (16,15): error CS8934: Cannot convert lambda expression to type 'D3<T>' because the return type does not match the delegate return type // d3 = (ref T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref T (ref T t) => ref t").WithArguments("lambda expression", "D3<T>").WithLocation(16, 15), // (17,15): error CS8934: Cannot convert lambda expression to type 'D1<T>' because the return type does not match the delegate return type // d1 = (ref readonly T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref readonly T (ref T t) => ref t").WithArguments("lambda expression", "D1<T>").WithLocation(17, 15), // (18,15): error CS8934: Cannot convert lambda expression to type 'D2<T>' because the return type does not match the delegate return type // d2 = (ref readonly T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref readonly T (ref T t) => ref t").WithArguments("lambda expression", "D2<T>").WithLocation(18, 15)); } [Fact] public void LambdaReturnType_11() { var source = @"using System; class Program { static void Main() { Delegate d; d = (ref void () => { }); d = (ref readonly void () => { }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,14): error CS8917: The delegate type could not be inferred. // d = (ref void () => { }); Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "ref void () => { }").WithLocation(7, 14), // (7,18): error CS1547: Keyword 'void' cannot be used in this context // d = (ref void () => { }); Diagnostic(ErrorCode.ERR_NoVoidHere, "void").WithLocation(7, 18), // (8,14): error CS8917: The delegate type could not be inferred. // d = (ref readonly void () => { }); Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "ref readonly void () => { }").WithLocation(8, 14), // (8,27): error CS1547: Keyword 'void' cannot be used in this context // d = (ref readonly void () => { }); Diagnostic(ErrorCode.ERR_NoVoidHere, "void").WithLocation(8, 27)); } [WorkItem(55217, "https://github.com/dotnet/roslyn/issues/55217")] [ConditionalFact(typeof(DesktopOnly))] public void LambdaReturnType_12() { var source = @"using System; class Program { static void Main() { Delegate d; d = TypedReference () => throw null; d = RuntimeArgumentHandle () => throw null; d = ArgIterator () => throw null; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,13): error CS1599: The return type of a method, delegate, or function pointer cannot be 'TypedReference' // d = TypedReference () => throw null; Diagnostic(ErrorCode.ERR_MethodReturnCantBeRefAny, "TypedReference").WithArguments("System.TypedReference").WithLocation(7, 13), // (7,13): error CS8917: The delegate type could not be inferred. // d = TypedReference () => throw null; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "TypedReference () => throw null").WithLocation(7, 13), // (8,13): error CS1599: The return type of a method, delegate, or function pointer cannot be 'RuntimeArgumentHandle' // d = RuntimeArgumentHandle () => throw null; Diagnostic(ErrorCode.ERR_MethodReturnCantBeRefAny, "RuntimeArgumentHandle").WithArguments("System.RuntimeArgumentHandle").WithLocation(8, 13), // (8,13): error CS8917: The delegate type could not be inferred. // d = RuntimeArgumentHandle () => throw null; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "RuntimeArgumentHandle () => throw null").WithLocation(8, 13), // (9,13): error CS1599: The return type of a method, delegate, or function pointer cannot be 'ArgIterator' // d = ArgIterator () => throw null; Diagnostic(ErrorCode.ERR_MethodReturnCantBeRefAny, "ArgIterator").WithArguments("System.ArgIterator").WithLocation(9, 13), // (9,13): error CS8917: The delegate type could not be inferred. // d = ArgIterator () => throw null; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "ArgIterator () => throw null").WithLocation(9, 13)); } [Fact] public void LambdaReturnType_13() { var source = @"static class S { } delegate S D(); class Program { static void Main() { D d = S () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,15): error CS0722: 'S': static types cannot be used as return types // D d = S () => default; Diagnostic(ErrorCode.ERR_ReturnTypeIsStaticClass, "S").WithArguments("S").WithLocation(7, 15)); } [Fact] public void LambdaReturnType_14() { var source = @"using System; class Program { static void Main() { Delegate d = async int () => 0; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (6,35): error CS1983: The return type of an async method must be void, Task, Task<T>, a task-like type, IAsyncEnumerable<T>, or IAsyncEnumerator<T> // Delegate d = async int () => 0; Diagnostic(ErrorCode.ERR_BadAsyncReturn, "=>").WithLocation(6, 35), // (6,35): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. // Delegate d = async int () => 0; Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(6, 35)); } [Fact] public void LambdaReturnType_15() { var source = @"using System; using System.Threading.Tasks; delegate ref Task D(string s); class Program { static void Main() { Delegate d1 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; D d2 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,23): error CS8917: The delegate type could not be inferred. // Delegate d1 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "async ref Task (s) => { _ = s.Length; await Task.Yield(); }").WithLocation(8, 23), // (8,29): error CS1073: Unexpected token 'ref' // Delegate d1 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(8, 29), // (9,22): error CS1073: Unexpected token 'ref' // D d2 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(9, 22)); } [Fact] public void LambdaReturnType_16() { var source = @"using System; using System.Threading.Tasks; delegate ref Task D(string s); class Program { static void Main() { Delegate d1 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; D d2 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,29): error CS1073: Unexpected token 'ref' // Delegate d1 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(8, 29), // (9,22): error CS1073: Unexpected token 'ref' // D d2 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(9, 22)); } [Fact] public void LambdaReturnType_17() { var source = @"#nullable enable using System; class Program { static void F(string? x, string y) { Func<string?> f1 = string () => { if (x is null) return x; return y; }; Func<string> f2 = string? () => { if (x is not null) return x; return y; }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,28): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string?>' (possibly because of nullability attributes). // Func<string?> f1 = string () => { if (x is null) return x; return y; }; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string () => { if (x is null) return x; return y; }").WithArguments("lambda expression", "System.Func<string?>").WithLocation(7, 28), // (7,65): warning CS8603: Possible null reference return. // Func<string?> f1 = string () => { if (x is null) return x; return y; }; Diagnostic(ErrorCode.WRN_NullReferenceReturn, "x").WithLocation(7, 65), // (8,27): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string>' (possibly because of nullability attributes). // Func<string> f2 = string? () => { if (x is not null) return x; return y; }; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string? () => { if (x is not null) return x; return y; }").WithArguments("lambda expression", "System.Func<string>").WithLocation(8, 27)); } [Fact] public void LambdaReturnType_CustomModifiers_01() { var sourceA = @".class public auto ansi sealed D extends [mscorlib]System.MulticastDelegate { .method public hidebysig specialname rtspecialname instance void .ctor (object 'object', native int 'method') runtime managed { } .method public hidebysig newslot virtual instance int32 modopt([mscorlib]System.Int16) Invoke () runtime managed { } .method public hidebysig newslot virtual instance class [mscorlib]System.IAsyncResult BeginInvoke (class [mscorlib]System.AsyncCallback callback, object 'object') runtime managed { } .method public hidebysig newslot virtual instance int32 modopt([mscorlib]System.Int16) EndInvoke (class [mscorlib]System.IAsyncResult result) runtime managed { } }"; var refA = CompileIL(sourceA); var sourceB = @"class Program { static void F(D d) { System.Console.WriteLine(d()); } static void Main() { F(() => 1); F(int () => 2); } }"; CompileAndVerify(sourceB, references: new[] { refA }, parseOptions: TestOptions.RegularPreview, expectedOutput: @"1 2"); } [Fact] public void LambdaReturnType_CustomModifiers_02() { var sourceA = @".class public auto ansi sealed D extends [mscorlib]System.MulticastDelegate { .method public hidebysig specialname rtspecialname instance void .ctor (object 'object', native int 'method') runtime managed { } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Int16) Invoke () runtime managed { } .method public hidebysig newslot virtual instance class [mscorlib]System.IAsyncResult BeginInvoke (class [mscorlib]System.AsyncCallback callback, object 'object') runtime managed { } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Int16) EndInvoke (class [mscorlib]System.IAsyncResult result) runtime managed { } }"; var refA = CompileIL(sourceA); var sourceB = @"class Program { static void F(D d) { System.Console.WriteLine(d()); } static void Main() { F(() => 1); F(int () => 2); } }"; var comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (5,34): error CS0570: 'D.Invoke()' is not supported by the language // System.Console.WriteLine(d()); Diagnostic(ErrorCode.ERR_BindToBogus, "d()").WithArguments("D.Invoke()").WithLocation(5, 34), // (9,11): error CS0570: 'D.Invoke()' is not supported by the language // F(() => 1); Diagnostic(ErrorCode.ERR_BindToBogus, "() => 1").WithArguments("D.Invoke()").WithLocation(9, 11), // (10,11): error CS0570: 'D.Invoke()' is not supported by the language // F(int () => 2); Diagnostic(ErrorCode.ERR_BindToBogus, "int () => 2").WithArguments("D.Invoke()").WithLocation(10, 11)); } [Fact] public void LambdaReturnType_UseSiteErrors() { var sourceA = @".class public sealed A extends [mscorlib]System.Object { .custom instance void [mscorlib]System.Runtime.CompilerServices.RequiredAttributeAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 FF 00 00 ) .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret } }"; var refA = CompileIL(sourceA); var sourceB = @"using System; class B { static void F<T>(Func<T> f) { } static void Main() { F(A () => default); } }"; var comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,11): error CS0648: 'A' is a type not supported by the language // F(A () => default); Diagnostic(ErrorCode.ERR_BogusType, "A").WithArguments("A").WithLocation(7, 11)); } [Fact] public void AsyncLambdaParameters_01() { var source = @"using System; using System.Threading.Tasks; delegate Task D(ref string s); class Program { static void Main() { Delegate d1 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; D d2 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,41): error CS1988: Async methods cannot have ref, in or out parameters // Delegate d1 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadAsyncArgType, "s").WithLocation(8, 41), // (9,34): error CS1988: Async methods cannot have ref, in or out parameters // D d2 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadAsyncArgType, "s").WithLocation(9, 34)); } [ConditionalFact(typeof(DesktopOnly))] public void AsyncLambdaParameters_02() { var source = @"using System; using System.Threading.Tasks; delegate void D1(TypedReference r); delegate void D2(RuntimeArgumentHandle h); delegate void D3(ArgIterator i); class Program { static void Main() { D1 d1 = async (TypedReference r) => { await Task.Yield(); }; D2 d2 = async (RuntimeArgumentHandle h) => { await Task.Yield(); }; D3 d3 = async (ArgIterator i) => { await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,39): error CS4012: Parameters or locals of type 'TypedReference' cannot be declared in async methods or async lambda expressions. // D1 d1 = async (TypedReference r) => { await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadSpecialByRefLocal, "r").WithArguments("System.TypedReference").WithLocation(10, 39), // (11,46): error CS4012: Parameters or locals of type 'RuntimeArgumentHandle' cannot be declared in async methods or async lambda expressions. // D2 d2 = async (RuntimeArgumentHandle h) => { await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadSpecialByRefLocal, "h").WithArguments("System.RuntimeArgumentHandle").WithLocation(11, 46), // (12,36): error CS4012: Parameters or locals of type 'ArgIterator' cannot be declared in async methods or async lambda expressions. // D3 d3 = async (ArgIterator i) => { await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadSpecialByRefLocal, "i").WithArguments("System.ArgIterator").WithLocation(12, 36)); } [Fact] public void BestType_01() { var source = @"using System; class A { } class B1 : A { } class B2 : A { } interface I { } class C1 : I { } class C2 : I { } class Program { static void F<T>(Func<bool, T> f) { } static void Main() { F((bool b) => { if (b) return new B1(); return new B2(); }); F((bool b) => { if (b) return new C1(); return new C2(); }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (13,9): error CS0411: The type arguments for method 'Program.F<T>(Func<bool, T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F((bool b) => { if (b) return new B1(); return new B2(); }); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<bool, T>)").WithLocation(13, 9), // (14,9): error CS0411: The type arguments for method 'Program.F<T>(Func<bool, T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F((bool b) => { if (b) return new C1(); return new C2(); }); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<bool, T>)").WithLocation(14, 9)); } // As above but with explicit return type. [Fact] public void BestType_02() { var source = @"using System; class A { } class B1 : A { } class B2 : A { } interface I { } class C1 : I { } class C2 : I { } class Program { static void F<T>(Func<bool, T> f) { Console.WriteLine(typeof(T)); } static void Main() { F(A (bool b) => { if (b) return new B1(); return new B2(); }); F(I (bool b) => { if (b) return new C1(); return new C2(); }); } }"; CompileAndVerify(source, parseOptions: TestOptions.RegularPreview, expectedOutput: @"A I"); } [Fact] public void BestType_03() { var source = @"using System; class A { } class B1 : A { } class B2 : A { } class Program { static void F<T>(Func<T> x, Func<T> y) { } static void Main() { F(B2 () => null, B2 () => null); F(A () => null, B2 () => null); F(B1 () => null, B2 () => null); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (11,25): error CS8934: Cannot convert lambda expression to type 'Func<A>' because the return type does not match the delegate return type // F(A () => null, B2 () => null); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "B2 () => null").WithArguments("lambda expression", "System.Func<A>").WithLocation(11, 25), // (12,9): error CS0411: The type arguments for method 'Program.F<T>(Func<T>, Func<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F(B1 () => null, B2 () => null); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<T>, System.Func<T>)").WithLocation(12, 9)); } [Fact] public void TypeInference_01() { var source = @"using System; class Program { static void F<T>(Func<object, T> f) { Console.WriteLine(typeof(T)); } static void Main() { F(long (o) => 1); } }"; CompileAndVerify(source, parseOptions: TestOptions.RegularPreview, expectedOutput: @"System.Int64"); } // Should method type inference make an explicit type inference // from the lambda expression return type? [Fact] public void TypeInference_02() { var source = @"using System; class Program { static void F<T>(Func<T, T> f) { Console.WriteLine(typeof(T)); } static void Main() { F(int (i) => i); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,9): error CS0411: The type arguments for method 'Program.F<T>(Func<T, T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F(int (i) => i); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<T, T>)").WithLocation(10, 9)); } // CS4031 is not reported for async lambda in [SecurityCritical] type. [Fact] [WorkItem(54074, "https://github.com/dotnet/roslyn/issues/54074")] public void SecurityCritical_AsyncLambda() { var source = @"using System; using System.Security; using System.Threading.Tasks; [SecurityCritical] class Program { static void Main() { Func<Task> f = async () => await Task.Yield(); } }"; var comp = CreateCompilation(source); comp.VerifyDiagnostics(); } // CS4031 is not reported for async lambda in [SecurityCritical] type. [Fact] [WorkItem(54074, "https://github.com/dotnet/roslyn/issues/54074")] public void SecurityCritical_AsyncLambda_AttributeArgument() { var source = @"using System; using System.Security; using System.Threading.Tasks; class A : Attribute { internal A(int i) { } } [SecurityCritical] [A(F(async () => await Task.Yield()))] class Program { internal static int F(Func<Task> f) => 0; }"; var comp = CreateCompilation(source); comp.VerifyDiagnostics( // (9,4): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type // [A(F(async () => await Task.Yield()))] Diagnostic(ErrorCode.ERR_BadAttributeArgument, "F(async () => await Task.Yield())").WithLocation(9, 4)); } private static LambdaSymbol GetLambdaSymbol(SemanticModel model, LambdaExpressionSyntax syntax) { return model.GetSymbolInfo(syntax).Symbol.GetSymbol<LambdaSymbol>(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Linq; using System.Text; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests { public class LambdaTests : CSharpTestBase { [Fact, WorkItem(37456, "https://github.com/dotnet/roslyn/issues/37456")] public void Verify37456() { var comp = CreateCompilation(@" using System; using System.Collections.Generic; using System.Linq; public static partial class EnumerableEx { public static void Join1<TA, TKey, T>(this IEnumerable<TA> a, Func<TA, TKey> aKey, Func<TA, T> aSel, Func<TA, TA, T> sel) { KeyValuePair<TK, TV> Pair<TK, TV>(TK k, TV v) => new KeyValuePair<TK, TV>(k, v); _ = a.GroupJoin(a, aKey, aKey, (f, ss) => Pair(f, ss.Select(s => Pair(true, s)))); // simplified repro } public static IEnumerable<T> Join2<TA, TB, TKey, T>(this IEnumerable<TA> a, IEnumerable<TB> b, Func<TA, TKey> aKey, Func<TB, TKey> bKey, Func<TA, T> aSel, Func<TA, TB, T> sel, IEqualityComparer<TKey> comp) { KeyValuePair<TK, TV> Pair<TK, TV>(TK k, TV v) => new KeyValuePair<TK, TV>(k, v); return from j in a.GroupJoin(b, aKey, bKey, (f, ss) => Pair(f, from s in ss select Pair(true, s)), comp) from s in j.Value.DefaultIfEmpty() select s.Key ? sel(j.Key, s.Value) : aSel(j.Key); } }"); comp.VerifyDiagnostics(); CompileAndVerify(comp); // emitting should not hang } [Fact, WorkItem(608181, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/608181")] public void BadInvocationInLambda() { var src = @" using System; using System.Linq.Expressions; class C { Expression<Action<dynamic>> e = x => new object[](x); }"; var comp = CreateCompilationWithMscorlib40AndSystemCore(src); comp.VerifyDiagnostics( // (7,52): error CS1586: Array creation must have array size or array initializer // Expression<Action<dynamic>> e = x => new object[](x); Diagnostic(ErrorCode.ERR_MissingArraySize, "[]").WithLocation(7, 52) ); } [Fact] public void TestLambdaErrors01() { var comp = CreateCompilationWithMscorlib40AndSystemCore(@" using System; using System.Linq.Expressions; namespace System.Linq.Expressions { public class Expression<T> {} } class C { delegate void D1(ref int x, out int y, int z); delegate void D2(out int x); void M() { int q1 = ()=>1; int q2 = delegate { return 1; }; Func<int> q3 = x3=>1; Func<int, int> q4 = (System.Itn23 x4)=>1; // type mismatch error should be suppressed on error type Func<double> q5 = (System.Duobel x5)=>1; // but arity error should not be suppressed on error type D1 q6 = (double x6, ref int y6, ref int z6)=>1; // COMPATIBILITY: The C# 4 compiler produces two errors: // // error CS1676: Parameter 2 must be declared with the 'out' keyword // error CS1688: Cannot convert anonymous method block without a parameter list // to delegate type 'D1' because it has one or more out parameters // // This seems redundant (because there is no 'parameter 2' in the source code) // I propose that we eliminate the first error. D1 q7 = delegate {}; Frob q8 = ()=>{}; D2 q9 = x9=>{}; D1 q10 = (x10,y10,z10)=>{}; // COMPATIBILITY: The C# 4 compiler produces two errors: // // error CS0127: Since 'System.Action' returns void, a return keyword must // not be followed by an object expression // // error CS1662: Cannot convert lambda expression to delegate type 'System.Action' // because some of the return types in the block are not implicitly convertible to // the delegate return type // // The problem is adequately characterized by the first message; I propose we // eliminate the second, which seems both redundant and wrong. Action q11 = ()=>{ return 1; }; Action q12 = ()=>1; Func<int> q13 = ()=>{ if (false) return 1; }; Func<int> q14 = ()=>123.456; // Note that the type error is still an error even if the offending // return is unreachable. Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; // In the native compiler these errors were caught at parse time. In Roslyn, these are now semantic // analysis errors. See changeset 1674 for details. Action<int[]> q16 = delegate (params int[] p) { }; Action<string[]> q17 = (params string[] s)=>{}; Action<int, double[]> q18 = (int x, params double[] s)=>{}; object q19 = new Action( (int x)=>{} ); Expression<int> ex1 = ()=>1; } }"); comp.VerifyDiagnostics( // (16,18): error CS1660: Cannot convert lambda expression to type 'int' because it is not a delegate type // int q1 = ()=>1; Diagnostic(ErrorCode.ERR_AnonMethToNonDel, "()=>1").WithArguments("lambda expression", "int").WithLocation(16, 18), // (17,18): error CS1660: Cannot convert anonymous method to type 'int' because it is not a delegate type // int q2 = delegate { return 1; }; Diagnostic(ErrorCode.ERR_AnonMethToNonDel, "delegate { return 1; }").WithArguments("anonymous method", "int").WithLocation(17, 18), // (18,24): error CS1593: Delegate 'Func<int>' does not take 1 arguments // Func<int> q3 = x3=>1; Diagnostic(ErrorCode.ERR_BadDelArgCount, "x3=>1").WithArguments("System.Func<int>", "1").WithLocation(18, 24), // (19,37): error CS0234: The type or namespace name 'Itn23' does not exist in the namespace 'System' (are you missing an assembly reference?) // Func<int, int> q4 = (System.Itn23 x4)=>1; // type mismatch error should be suppressed on error type Diagnostic(ErrorCode.ERR_DottedTypeNameNotFoundInNS, "Itn23").WithArguments("Itn23", "System").WithLocation(19, 37), // (20,35): error CS0234: The type or namespace name 'Duobel' does not exist in the namespace 'System' (are you missing an assembly reference?) // Func<double> q5 = (System.Duobel x5)=>1; // but arity error should not be suppressed on error type Diagnostic(ErrorCode.ERR_DottedTypeNameNotFoundInNS, "Duobel").WithArguments("Duobel", "System").WithLocation(20, 35), // (20,27): error CS1593: Delegate 'Func<double>' does not take 1 arguments // Func<double> q5 = (System.Duobel x5)=>1; // but arity error should not be suppressed on error type Diagnostic(ErrorCode.ERR_BadDelArgCount, "(System.Duobel x5)=>1").WithArguments("System.Func<double>", "1").WithLocation(20, 27), // (21,17): error CS1661: Cannot convert lambda expression to delegate type 'C.D1' because the parameter types do not match the delegate parameter types // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, "(double x6, ref int y6, ref int z6)=>1").WithArguments("lambda expression", "C.D1").WithLocation(21, 17), // (21,25): error CS1678: Parameter 1 is declared as type 'double' but should be 'ref int' // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_BadParamType, "x6").WithArguments("1", "", "double", "ref ", "int").WithLocation(21, 25), // (21,37): error CS1676: Parameter 2 must be declared with the 'out' keyword // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_BadParamRef, "y6").WithArguments("2", "out").WithLocation(21, 37), // (21,49): error CS1677: Parameter 3 should not be declared with the 'ref' keyword // D1 q6 = (double x6, ref int y6, ref int z6)=>1; Diagnostic(ErrorCode.ERR_BadParamExtraRef, "z6").WithArguments("3", "ref").WithLocation(21, 49), // (32,17): error CS1688: Cannot convert anonymous method block without a parameter list to delegate type 'C.D1' because it has one or more out parameters // D1 q7 = delegate {}; Diagnostic(ErrorCode.ERR_CantConvAnonMethNoParams, "delegate {}").WithArguments("C.D1").WithLocation(32, 17), // (34,9): error CS0246: The type or namespace name 'Frob' could not be found (are you missing a using directive or an assembly reference?) // Frob q8 = ()=>{}; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "Frob").WithArguments("Frob").WithLocation(34, 9), // (36,17): error CS1676: Parameter 1 must be declared with the 'out' keyword // D2 q9 = x9=>{}; Diagnostic(ErrorCode.ERR_BadParamRef, "x9").WithArguments("1", "out").WithLocation(36, 17), // (38,19): error CS1676: Parameter 1 must be declared with the 'ref' keyword // D1 q10 = (x10,y10,z10)=>{}; Diagnostic(ErrorCode.ERR_BadParamRef, "x10").WithArguments("1", "ref").WithLocation(38, 19), // (38,23): error CS1676: Parameter 2 must be declared with the 'out' keyword // D1 q10 = (x10,y10,z10)=>{}; Diagnostic(ErrorCode.ERR_BadParamRef, "y10").WithArguments("2", "out").WithLocation(38, 23), // (52,28): error CS8030: Anonymous function converted to a void returning delegate cannot return a value // Action q11 = ()=>{ return 1; }; Diagnostic(ErrorCode.ERR_RetNoObjectRequiredLambda, "return").WithLocation(52, 28), // (54,26): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // Action q12 = ()=>1; Diagnostic(ErrorCode.ERR_IllegalStatement, "1").WithLocation(54, 26), // (56,42): warning CS0162: Unreachable code detected // Func<int> q13 = ()=>{ if (false) return 1; }; Diagnostic(ErrorCode.WRN_UnreachableCode, "return").WithLocation(56, 42), // (56,27): error CS1643: Not all code paths return a value in lambda expression of type 'Func<int>' // Func<int> q13 = ()=>{ if (false) return 1; }; Diagnostic(ErrorCode.ERR_AnonymousReturnExpected, "=>").WithArguments("lambda expression", "System.Func<int>").WithLocation(56, 27), // (58,29): error CS0266: Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?) // Func<int> q14 = ()=>123.456; Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "123.456").WithArguments("double", "int").WithLocation(58, 29), // (58,29): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // Func<int> q14 = ()=>123.456; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "123.456").WithArguments("lambda expression").WithLocation(58, 29), // (62,51): error CS0266: Cannot implicitly convert type 'decimal' to 'double'. An explicit conversion exists (are you missing a cast?) // Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; Diagnostic(ErrorCode.ERR_NoImplicitConvCast, "1m").WithArguments("decimal", "double").WithLocation(62, 51), // (62,51): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "1m").WithArguments("lambda expression").WithLocation(62, 51), // (62,44): warning CS0162: Unreachable code detected // Func<double> q15 = ()=>{if (false) return 1m; else return 0; }; Diagnostic(ErrorCode.WRN_UnreachableCode, "return").WithLocation(62, 44), // (66,39): error CS1670: params is not valid in this context // Action<int[]> q16 = delegate (params int[] p) { }; Diagnostic(ErrorCode.ERR_IllegalParams, "params int[] p").WithLocation(66, 39), // (67,33): error CS1670: params is not valid in this context // Action<string[]> q17 = (params string[] s)=>{}; Diagnostic(ErrorCode.ERR_IllegalParams, "params string[] s").WithLocation(67, 33), // (68,45): error CS1670: params is not valid in this context // Action<int, double[]> q18 = (int x, params double[] s)=>{}; Diagnostic(ErrorCode.ERR_IllegalParams, "params double[] s").WithLocation(68, 45), // (70,34): error CS1593: Delegate 'Action' does not take 1 arguments // object q19 = new Action( (int x)=>{} ); Diagnostic(ErrorCode.ERR_BadDelArgCount, "(int x)=>{}").WithArguments("System.Action", "1").WithLocation(70, 34), // (72,9): warning CS0436: The type 'Expression<T>' in '' conflicts with the imported type 'Expression<TDelegate>' in 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using the type defined in ''. // Expression<int> ex1 = ()=>1; Diagnostic(ErrorCode.WRN_SameFullNameThisAggAgg, "Expression<int>").WithArguments("", "System.Linq.Expressions.Expression<T>", "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "System.Linq.Expressions.Expression<TDelegate>").WithLocation(72, 9), // (72,31): error CS0835: Cannot convert lambda to an expression tree whose type argument 'int' is not a delegate type // Expression<int> ex1 = ()=>1; Diagnostic(ErrorCode.ERR_ExpressionTreeMustHaveDelegate, "()=>1").WithArguments("int").WithLocation(72, 31) ); } [Fact] // 5368 public void TestLambdaErrors02() { string code = @" class C { void M() { System.Func<int, int> del = x => x + 1; } }"; var compilation = CreateCompilation(code); compilation.VerifyDiagnostics(); // no errors expected } [WorkItem(539538, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539538")] [Fact] public void TestLambdaErrors03() { string source = @" using System; interface I : IComparable<IComparable<I>> { } class C { static void Goo(Func<IComparable<I>> x) { } static void Goo(Func<I> x) {} static void M() { Goo(() => null); } } "; CreateCompilation(source).VerifyDiagnostics( // (12,9): error CS0121: The call is ambiguous between the following methods or properties: 'C.Goo(Func<IComparable<I>>)' and 'C.Goo(Func<I>)' // Goo(() => null); Diagnostic(ErrorCode.ERR_AmbigCall, "Goo").WithArguments("C.Goo(System.Func<System.IComparable<I>>)", "C.Goo(System.Func<I>)").WithLocation(12, 9)); } [WorkItem(18645, "https://github.com/dotnet/roslyn/issues/18645")] [Fact] public void LambdaExpressionTreesErrors() { string source = @" using System; using System.Linq.Expressions; class C { void M() { Expression<Func<int,int>> ex1 = () => 1; Expression<Func<int,int>> ex2 = (double d) => 1; } } "; CreateCompilation(source).VerifyDiagnostics( // (9,41): error CS1593: Delegate 'Func<int, int>' does not take 0 arguments // Expression<Func<int,int>> ex1 = () => 1; Diagnostic(ErrorCode.ERR_BadDelArgCount, "() => 1").WithArguments("System.Func<int, int>", "0").WithLocation(9, 41), // (10,41): error CS1661: Cannot convert lambda expression to type 'Expression<Func<int, int>>' because the parameter types do not match the delegate parameter types // Expression<Func<int,int>> ex2 = (double d) => 1; Diagnostic(ErrorCode.ERR_CantConvAnonMethParams, "(double d) => 1").WithArguments("lambda expression", "System.Linq.Expressions.Expression<System.Func<int, int>>").WithLocation(10, 41), // (10,49): error CS1678: Parameter 1 is declared as type 'double' but should be 'int' // Expression<Func<int,int>> ex2 = (double d) => 1; Diagnostic(ErrorCode.ERR_BadParamType, "d").WithArguments("1", "", "double", "", "int").WithLocation(10, 49)); } [WorkItem(539976, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539976")] [Fact] public void LambdaArgumentToOverloadedDelegate() { var text = @"class W { delegate T Func<A0, T>(A0 a0); static int F(Func<short, int> f) { return 0; } static int F(Func<short, double> f) { return 1; } static int Main() { return F(c => c); } } "; var comp = CreateCompilation(Parse(text)); comp.VerifyDiagnostics(); } [WorkItem(528044, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528044")] [Fact] public void MissingReferenceInOverloadResolution() { var text1 = @" using System; public static class A { public static void Goo(Func<B, object> func) { } public static void Goo(Func<C, object> func) { } } public class B { public Uri GetUrl() { return null; } } public class C { public string GetUrl() { return null; } }"; var comp1 = CreateCompilationWithMscorlib40( new[] { Parse(text1) }, new[] { TestMetadata.Net451.System }); var text2 = @" class Program { static void Main() { A.Goo(x => x.GetUrl()); } } "; var comp2 = CreateCompilationWithMscorlib40( new[] { Parse(text2) }, new[] { new CSharpCompilationReference(comp1) }); Assert.Equal(0, comp2.GetDiagnostics().Count()); } [WorkItem(528047, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528047")] [Fact()] public void OverloadResolutionWithEmbeddedInteropType() { var text1 = @" using System; using System.Collections.Generic; using stdole; public static class A { public static void Goo(Func<X> func) { System.Console.WriteLine(""X""); } public static void Goo(Func<Y> func) { System.Console.WriteLine(""Y""); } } public delegate void X(List<IDispatch> addin); public delegate void Y(List<string> addin); "; var comp1 = CreateCompilation( Parse(text1), new[] { TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(true) }, options: TestOptions.ReleaseDll); var text2 = @" public class Program { public static void Main() { A.Goo(() => delegate { }); } } "; var comp2 = CreateCompilation( Parse(text2), new MetadataReference[] { new CSharpCompilationReference(comp1), TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(true) }, options: TestOptions.ReleaseExe); CompileAndVerify(comp2, expectedOutput: "Y").Diagnostics.Verify(); var comp3 = CreateCompilation( Parse(text2), new MetadataReference[] { comp1.EmitToImageReference(), TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(true) }, options: TestOptions.ReleaseExe); CompileAndVerify(comp3, expectedOutput: "Y").Diagnostics.Verify(); } [WorkItem(6358, "DevDiv_Projects/Roslyn")] [Fact] public void InvalidExpressionInvolveLambdaOperator() { var text1 = @" class C { static void X() { int x=0; int y=0; if(x-=>*y) // CS1525 return; return; } } "; var comp = CreateCompilation(Parse(text1)); var errs = comp.GetDiagnostics(); Assert.True(0 < errs.Count(), "Diagnostics not empty"); Assert.True(0 < errs.Where(e => e.Code == 1525).Select(e => e).Count(), "Diagnostics contains CS1525"); } [WorkItem(540219, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540219")] [Fact] public void OverloadResolutionWithStaticType() { var vbSource = @" Imports System Namespace Microsoft.VisualBasic.CompilerServices <System.AttributeUsage(System.AttributeTargets.Class, Inherited:=False, AllowMultiple:=False)> Public NotInheritable Class StandardModuleAttribute Inherits System.Attribute Public Sub New() MyBase.New() End Sub End Class End Namespace Public Module M Sub Goo(x as Action(Of String)) End Sub Sub Goo(x as Action(Of GC)) End Sub End Module "; var vbProject = VisualBasic.VisualBasicCompilation.Create( "VBProject", references: new[] { MscorlibRef }, syntaxTrees: new[] { VisualBasic.VisualBasicSyntaxTree.ParseText(vbSource) }); var csSource = @" class Program { static void Main() { M.Goo(x => { }); } } "; var metadataStream = new MemoryStream(); var emitResult = vbProject.Emit(metadataStream, options: new EmitOptions(metadataOnly: true)); Assert.True(emitResult.Success); var csProject = CreateCompilation( Parse(csSource), new[] { MetadataReference.CreateFromImage(metadataStream.ToImmutable()) }); Assert.Equal(0, csProject.GetDiagnostics().Count()); } [Fact] public void OverloadResolutionWithStaticTypeError() { var vbSource = @" Imports System Namespace Microsoft.VisualBasic.CompilerServices <System.AttributeUsage(System.AttributeTargets.Class, Inherited:=False, AllowMultiple:=False)> Public NotInheritable Class StandardModuleAttribute Inherits System.Attribute Public Sub New() MyBase.New() End Sub End Class End Namespace Public Module M Public Dim F As Action(Of GC) End Module "; var vbProject = VisualBasic.VisualBasicCompilation.Create( "VBProject", references: new[] { MscorlibRef }, syntaxTrees: new[] { VisualBasic.VisualBasicSyntaxTree.ParseText(vbSource) }); var csSource = @" class Program { static void Main() { M.F = x=>{}; } } "; var vbMetadata = vbProject.EmitToArray(options: new EmitOptions(metadataOnly: true)); var csProject = CreateCompilation(Parse(csSource), new[] { MetadataReference.CreateFromImage(vbMetadata) }); csProject.VerifyDiagnostics( // (6,15): error CS0721: 'GC': static types cannot be used as parameters // M.F = x=>{}; Diagnostic(ErrorCode.ERR_ParameterIsStaticClass, "x").WithArguments("System.GC").WithLocation(6, 15)); } [WorkItem(540251, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540251")] [Fact] public void AttributesCannotBeUsedInAnonymousMethods() { var csSource = @" using System; class Program { static void Main() { const string message = ""The parameter is obsolete""; Action<int> a = delegate ([ObsoleteAttribute(message)] int x) { }; } } "; var csProject = CreateCompilation(csSource); csProject.VerifyEmitDiagnostics( // (8,22): warning CS0219: The variable 'message' is assigned but its value is never used // const string message = "The parameter is obsolete"; Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "message").WithArguments("message").WithLocation(8, 22), // (9,35): error CS7014: Attributes are not valid in this context. // Action<int> a = delegate ([ObsoleteAttribute(message)] int x) { }; Diagnostic(ErrorCode.ERR_AttributesNotAllowed, "[ObsoleteAttribute(message)]").WithLocation(9, 35)); } [WorkItem(540263, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540263")] [Fact] public void ErrorsInUnboundLambdas() { var csSource = @"using System; class Program { static void Main() { ((Func<int>)delegate { return """"; })(); ((Func<int>)delegate { })(); ((Func<int>)delegate { 1 / 0; })(); } } "; CreateCompilation(csSource).VerifyDiagnostics( // (7,39): error CS0029: Cannot implicitly convert type 'string' to 'int' // ((Func<int>)delegate { return ""; })(); Diagnostic(ErrorCode.ERR_NoImplicitConv, @"""""").WithArguments("string", "int").WithLocation(7, 39), // (7,39): error CS1662: Cannot convert anonymous method to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // ((Func<int>)delegate { return ""; })(); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, @"""""").WithArguments("anonymous method").WithLocation(7, 39), // (8,21): error CS1643: Not all code paths return a value in anonymous method of type 'Func<int>' // ((Func<int>)delegate { })(); Diagnostic(ErrorCode.ERR_AnonymousReturnExpected, "delegate").WithArguments("anonymous method", "System.Func<int>").WithLocation(8, 21), // (9,32): error CS0020: Division by constant zero // ((Func<int>)delegate { 1 / 0; })(); Diagnostic(ErrorCode.ERR_IntDivByZero, "1 / 0").WithLocation(9, 32), // (9,32): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // ((Func<int>)delegate { 1 / 0; })(); Diagnostic(ErrorCode.ERR_IllegalStatement, "1 / 0").WithLocation(9, 32), // (9,21): error CS1643: Not all code paths return a value in anonymous method of type 'Func<int>' // ((Func<int>)delegate { 1 / 0; })(); Diagnostic(ErrorCode.ERR_AnonymousReturnExpected, "delegate").WithArguments("anonymous method", "System.Func<int>").WithLocation(9, 21) ); } [WorkItem(540181, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540181")] [Fact] public void ErrorInLambdaArgumentList() { var csSource = @"using System; class Program { public Program(string x) : this(() => x) { } static void Main(string[] args) { ((Action<string>)(f => Console.WriteLine(f)))(nulF); } }"; CreateCompilation(csSource).VerifyDiagnostics( // (5,37): error CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type // public Program(string x) : this(() => x) { } Diagnostic(ErrorCode.ERR_AnonMethToNonDel, "() => x").WithArguments("lambda expression", "string").WithLocation(5, 37), // (8,55): error CS0103: The name 'nulF' does not exist in the current context // ((Action<string>)(f => Console.WriteLine(f)))(nulF); Diagnostic(ErrorCode.ERR_NameNotInContext, "nulF").WithArguments("nulF").WithLocation(8, 55)); } [WorkItem(541725, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541725")] [Fact] public void DelegateCreationIsNotStatement() { var csSource = @" delegate void D(); class Program { public static void Main(string[] args) { D d = () => new D(() => { }); new D(()=>{}); } }"; // Though it is legal to have an object-creation-expression, because it might be useful // for its side effects, a delegate-creation-expression is not allowed as a // statement expression. CreateCompilation(csSource).VerifyDiagnostics( // (7,21): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // D d = () => new D(() => { }); Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(() => { })"), // (8,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // new D(()=>{}); Diagnostic(ErrorCode.ERR_IllegalStatement, "new D(()=>{})")); } [WorkItem(542336, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542336")] [Fact] public void ThisInStaticContext() { var csSource = @" delegate void D(); class Program { public static void Main(string[] args) { D d = () => { object o = this; }; } }"; CreateCompilation(csSource).VerifyDiagnostics( // (8,24): error CS0026: Keyword 'this' is not valid in a static property, static method, or static field initializer // object o = this; Diagnostic(ErrorCode.ERR_ThisInStaticMeth, "this") ); } [WorkItem(542431, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542431")] [Fact] public void LambdaHasMoreParametersThanDelegate() { var csSource = @" class C { static void Main() { System.Func<int> f = new System.Func<int>(r => 0); } }"; CreateCompilation(csSource).VerifyDiagnostics( // (6,51): error CS1593: Delegate 'System.Func<int>' does not take 1 arguments Diagnostic(ErrorCode.ERR_BadDelArgCount, "r => 0").WithArguments("System.Func<int>", "1")); } [Fact, WorkItem(529054, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529054")] public void LambdaInDynamicCall() { var source = @" public class Program { static void Main() { dynamic b = new string[] { ""AA"" }; bool exists = System.Array.Exists(b, o => o != ""BB""); } }"; CreateCompilation(source).VerifyDiagnostics( // (7,46): error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type. // bool exists = System.Array.Exists(b, o => o != "BB"); Diagnostic(ErrorCode.ERR_BadDynamicMethodArgLambda, @"o => o != ""BB""") ); } [Fact, WorkItem(529389, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529389")] public void ParenthesizedLambdaInCastExpression() { var source = @" using System; using System.Collections.Generic; class Program { static void Main() { int x = 1; byte y = (byte) (x + x); Func<int> f1 = (() => { return 1; }); Func<int> f2 = (Func<int>) (() => { return 2; }); } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(). Where(e => e.Kind() == SyntaxKind.AddExpression).Single(); var tinfo = model.GetTypeInfo(expr); var conv = model.GetConversion(expr); // Not byte Assert.Equal("int", tinfo.Type.ToDisplayString()); var exprs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); expr = exprs.First(); tinfo = model.GetTypeInfo(expr); conv = model.GetConversion(expr); Assert.True(conv.IsAnonymousFunction, "LambdaConversion"); Assert.Null(tinfo.Type); var sym = model.GetSymbolInfo(expr).Symbol; Assert.NotNull(sym); Assert.Equal(SymbolKind.Method, sym.Kind); Assert.Equal(MethodKind.AnonymousFunction, (sym as IMethodSymbol).MethodKind); expr = exprs.Last(); tinfo = model.GetTypeInfo(expr); conv = model.GetConversion(expr); Assert.True(conv.IsAnonymousFunction, "LambdaConversion"); Assert.Null(tinfo.Type); sym = model.GetSymbolInfo(expr).Symbol; Assert.NotNull(sym); Assert.Equal(SymbolKind.Method, sym.Kind); Assert.Equal(MethodKind.AnonymousFunction, (sym as IMethodSymbol).MethodKind); } [WorkItem(544594, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544594")] [Fact] public void LambdaInEnumMemberDecl() { var csSource = @" public class TestClass { public enum Test { aa = ((System.Func<int>)(() => 1))() } Test MyTest = Test.aa; public static void Main() { } } "; CreateCompilation(csSource).VerifyDiagnostics( // (4,29): error CS0133: The expression being assigned to 'TestClass.Test.aa' must be constant Diagnostic(ErrorCode.ERR_NotConstantExpression, "((System.Func<int>)(() => 1))()").WithArguments("TestClass.Test.aa"), // (5,10): warning CS0414: The field 'TestClass.MyTest' is assigned but its value is never used Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, "MyTest").WithArguments("TestClass.MyTest")); } [WorkItem(544932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544932")] [Fact] public void AnonymousLambdaInEnumSubtraction() { string source = @" class Test { enum E1 : byte { A = byte.MinValue, C = 1 } static void Main() { int j = ((System.Func<Test.E1>)(() => E1.A))() - E1.C; System.Console.WriteLine(j); } } "; string expectedOutput = @"255"; CompileAndVerify(new[] { source }, expectedOutput: expectedOutput); } [WorkItem(545156, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545156")] [Fact] public void SpeculativelyBindOverloadResolution() { string source = @" using System; using System.Collections; using System.Collections.Generic; class Program { static void Main() { Goo(() => () => { var x = (IEnumerable<int>)null; return x; }); } static void Goo(Func<Func<IEnumerable>> x) { } static void Goo(Func<Func<IFormattable>> x) { } } "; var compilation = CreateCompilation(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); // Used to throw a NRE because of the ExpressionSyntax's null SyntaxTree. model.GetSpeculativeSymbolInfo( invocation.SpanStart, SyntaxFactory.ParseExpression("Goo(() => () => { var x = null; return x; })"), // cast removed SpeculativeBindingOption.BindAsExpression); } [WorkItem(545343, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545343")] [Fact] public void LambdaUsingFieldInConstructor() { string source = @" using System; public class Derived { int field = 1; Derived() { int local = 2; // A lambda that captures a local and refers to an instance field. Action a = () => Console.WriteLine(""Local = {0}, Field = {1}"", local, field); // NullReferenceException if the ""this"" field of the display class hasn't been set. a(); } public static void Main() { Derived d = new Derived(); } }"; CompileAndVerify(source, expectedOutput: "Local = 2, Field = 1"); } [WorkItem(642222, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/642222")] [Fact] public void SpeculativelyBindOverloadResolutionAndInferenceWithError() { string source = @" using System;using System.Linq.Expressions; namespace IntellisenseBug { public class Program { void M(Mapper<FromData, ToData> mapper) { // Intellisense is broken here when you type . after the x: mapper.Map(x => x/* */. } } public class Mapper<TTypeFrom, TTypeTo> { public void Map<TPropertyFrom, TPropertyTo>( Expression<Func<TTypeFrom, TPropertyFrom>> from, Expression<Func<TTypeTo, TPropertyTo>> to) { } } public class FromData { public int Int { get; set; } public string String { get; set; } } public class ToData { public int Id { get; set; } public string Name { get; set; } } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); // We don't actually require any particular diagnostics, but these are what we get. compilation.VerifyDiagnostics( // (10,36): error CS1001: Identifier expected // mapper.Map(x => x/* */. Diagnostic(ErrorCode.ERR_IdentifierExpected, ""), // (10,36): error CS1026: ) expected // mapper.Map(x => x/* */. Diagnostic(ErrorCode.ERR_CloseParenExpected, ""), // (10,36): error CS1002: ; expected // mapper.Map(x => x/* */. Diagnostic(ErrorCode.ERR_SemicolonExpected, "") ); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var xReference = tree .GetCompilationUnitRoot() .DescendantNodes() .OfType<ExpressionSyntax>() .Where(e => e.ToFullString() == "x/* */") .Last(); var typeInfo = model.GetTypeInfo(xReference); Assert.NotNull(((ITypeSymbol)typeInfo.Type).GetMember("String")); } [WorkItem(722288, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/722288")] [Fact] public void CompletionInLambdaInIncompleteInvocation() { string source = @" using System; using System.Linq.Expressions; public class SomeType { public string SomeProperty { get; set; } } public class IntelliSenseError { public static void Test1<T>(Expression<Func<T, object>> expr) { Console.WriteLine(((MemberExpression)expr.Body).Member.Name); } public static void Test2<T>(Expression<Func<T, object>> expr, bool additionalParameter) { Test1(expr); } public static void Main() { Test2<SomeType>(o => o/* */. } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); // We don't actually require any particular diagnostics, but these are what we get. compilation.VerifyDiagnostics( // (21,37): error CS1001: Identifier expected // Test2<SomeType>(o => o/* */. Diagnostic(ErrorCode.ERR_IdentifierExpected, ""), // (21,37): error CS1026: ) expected // Test2<SomeType>(o => o/* */. Diagnostic(ErrorCode.ERR_CloseParenExpected, ""), // (21,37): error CS1002: ; expected // Test2<SomeType>(o => o/* */. Diagnostic(ErrorCode.ERR_SemicolonExpected, "") ); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var oReference = tree .GetCompilationUnitRoot() .DescendantNodes() .OfType<NameSyntax>() .Where(e => e.ToFullString() == "o/* */") .Last(); var typeInfo = model.GetTypeInfo(oReference); Assert.NotNull(((ITypeSymbol)typeInfo.Type).GetMember("SomeProperty")); } [WorkItem(871896, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/871896")] [Fact] public void Bug871896() { string source = @" using System.Threading; using System.Threading.Tasks; class TestDataPointBase { private readonly IVisualStudioIntegrationService integrationService; protected void TryGetDocumentId(CancellationToken token) { DocumentId documentId = null; if (!await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)) { } } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var oReference = tree .GetCompilationUnitRoot() .DescendantNodes() .OfType<ExpressionSyntax>() .OrderByDescending(s => s.SpanStart); foreach (var name in oReference) { CSharpExtensions.GetSymbolInfo(model, name); } // We should get a bunch of errors, but no asserts. compilation.VerifyDiagnostics( // (6,22): error CS0246: The type or namespace name 'IVisualStudioIntegrationService' could not be found (are you missing a using directive or an assembly reference?) // private readonly IVisualStudioIntegrationService integrationService; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "IVisualStudioIntegrationService").WithArguments("IVisualStudioIntegrationService").WithLocation(6, 22), // (9,9): error CS0246: The type or namespace name 'DocumentId' could not be found (are you missing a using directive or an assembly reference?) // DocumentId documentId = null; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "DocumentId").WithArguments("DocumentId").WithLocation(9, 9), // (10,25): error CS0117: 'System.Threading.Tasks.Task' does not contain a definition for 'Run' // if (!await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)) Diagnostic(ErrorCode.ERR_NoSuchMember, "Run").WithArguments("System.Threading.Tasks.Task", "Run").WithLocation(10, 25), // (10,14): error CS4033: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. // if (!await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)) Diagnostic(ErrorCode.ERR_BadAwaitWithoutVoidAsyncMethod, "await Task.Run(() => this.integrationService.TryGetDocumentId(null, out documentId), token).ConfigureAwait(false)").WithLocation(10, 14), // (6,54): warning CS0649: Field 'TestDataPointBase.integrationService' is never assigned to, and will always have its default value null // private readonly IVisualStudioIntegrationService integrationService; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "integrationService").WithArguments("TestDataPointBase.integrationService", "null").WithLocation(6, 54) ); } [Fact, WorkItem(960755, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/960755")] public void Bug960755_01() { var source = @" using System.Collections.Generic; class C { static void M(IList<C> c) { var tmp = new C(); tmp.M((a, b) => c.Add); } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal("void System.Collections.Generic.ICollection<C>.Add(C item)", symbolInfo.CandidateSymbols.Single().ToTestDisplayString()); Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason); } [Fact, WorkItem(960755, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/960755")] public void Bug960755_02() { var source = @" using System.Collections.Generic; class C { static void M(IList<C> c) { int tmp = c.Add; } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; var symbolInfo = model.GetSymbolInfo(expr); Assert.Null(symbolInfo.Symbol); Assert.Equal("void System.Collections.Generic.ICollection<C>.Add(C item)", symbolInfo.CandidateSymbols.Single().ToTestDisplayString()); Assert.Equal(CandidateReason.OverloadResolutionFailure, symbolInfo.CandidateReason); } [Fact, WorkItem(960755, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/960755")] public void Bug960755_03() { var source = @" using System.Collections.Generic; class C { static void M(IList<C> c) { var tmp = new C(); tmp.M((a, b) => c.Add); } static void M(System.Func<int, int, System.Action<C>> x) {} } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); var model = comp.GetSemanticModel(tree); var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; var symbolInfo = model.GetSymbolInfo(expr); Assert.Equal("void System.Collections.Generic.ICollection<C>.Add(C item)", symbolInfo.Symbol.ToTestDisplayString()); Assert.Equal(0, symbolInfo.CandidateSymbols.Length); Assert.Equal(CandidateReason.None, symbolInfo.CandidateReason); } [Fact] public void RefLambdaInferenceMethodArgument() { var text = @" delegate ref int D(); class C { static void MD(D d) { } static int i = 0; static void M() { MD(() => ref i); MD(() => { return ref i; }); MD(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics(); } [Fact] public void RefLambdaInferenceDelegateCreation() { var text = @" delegate ref int D(); class C { static int i = 0; static void M() { var d = new D(() => ref i); d = new D(() => { return ref i; }); d = new D(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics(); } [Fact] public void RefLambdaInferenceOverloadedDelegateType() { var text = @" delegate ref int D(); delegate int E(); class C { static void M(D d) { } static void M(E e) { } static int i = 0; static void M() { M(() => ref i); M(() => { return ref i; }); M(delegate { return ref i; }); M(() => i); M(() => { return i; }); M(delegate { return i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics(); } [Fact] public void RefLambdaInferenceArgumentBadRefReturn() { var text = @" delegate int E(); class C { static void ME(E e) { } static int i = 0; static void M() { ME(() => ref i); ME(() => { return ref i; }); ME(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (11,22): error CS8149: By-reference returns may only be used in by-reference returning methods. // ME(() => ref i); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "i").WithLocation(11, 22), // (12,20): error CS8149: By-reference returns may only be used in by-reference returning methods. // ME(() => { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(12, 20), // (13,23): error CS8149: By-reference returns may only be used in by-reference returning methods. // ME(delegate { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(13, 23)); } [Fact] public void RefLambdaInferenceDelegateCreationBadRefReturn() { var text = @" delegate int E(); class C { static int i = 0; static void M() { var e = new E(() => ref i); e = new E(() => { return ref i; }); e = new E(delegate { return ref i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (9,33): error CS8149: By-reference returns may only be used in by-reference returning methods. // var e = new E(() => ref i); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "i").WithLocation(9, 33), // (10,27): error CS8149: By-reference returns may only be used in by-reference returning methods. // e = new E(() => { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(10, 27), // (11,30): error CS8149: By-reference returns may only be used in by-reference returning methods. // e = new E(delegate { return ref i; }); Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(11, 30)); } [Fact] public void RefLambdaInferenceMixedByValueAndByRefReturns() { var text = @" delegate ref int D(); delegate int E(); class C { static void MD(D e) { } static void ME(E e) { } static int i = 0; static void M() { MD(() => { if (i == 0) { return ref i; } return i; }); ME(() => { if (i == 0) { return ref i; } return i; }); } } "; CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (18,13): error CS8150: By-value returns may only be used in by-value returning methods. // return i; Diagnostic(ErrorCode.ERR_MustHaveRefReturn, "return").WithLocation(18, 13), // (23,17): error CS8149: By-reference returns may only be used in by-reference returning methods. // return ref i; Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(23, 17)); } [WorkItem(1112875, "DevDiv")] [WorkItem(1112875, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1112875")] [Fact] public void Bug1112875_1() { var comp = CreateCompilation(@" using System; class Program { static void Main() { ICloneable c = """"; Goo(() => (c.Clone()), null); } static void Goo(Action x, string y) { } static void Goo(Func<object> x, object y) { Console.WriteLine(42); } }", options: TestOptions.ReleaseExe); comp.VerifyDiagnostics(); CompileAndVerify(comp, expectedOutput: "42"); } [WorkItem(1112875, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1112875")] [Fact] public void Bug1112875_2() { var comp = CreateCompilation(@" class Program { void M() { var d = new System.Action(() => (new object())); } } "); comp.VerifyDiagnostics( // (6,41): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement // var d = new System.Action(() => (new object())); Diagnostic(ErrorCode.ERR_IllegalStatement, "(new object())").WithLocation(6, 41)); } [WorkItem(1830, "https://github.com/dotnet/roslyn/issues/1830")] [Fact] public void FuncOfVoid() { var comp = CreateCompilation(@" using System; class Program { void M1<T>(Func<T> f) {} void Main(string[] args) { M1(() => { return System.Console.Beep(); }); } } "); comp.VerifyDiagnostics( // (8,27): error CS4029: Cannot return an expression of type 'void' // M1(() => { return System.Console.Beep(); }); Diagnostic(ErrorCode.ERR_CantReturnVoid, "System.Console.Beep()").WithLocation(8, 27) ); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_01() { var src = @" using System; class Program { static Func<Program, string> stuff() { return a => a. } } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,23): error CS1001: Identifier expected // return a => a. Diagnostic(ErrorCode.ERR_IdentifierExpected, "").WithLocation(8, 23), // (8,23): error CS1002: ; expected // return a => a. Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(8, 23) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_02() { var src = @" using System; class Program { static void stuff() { Func<Program, string> l = a => a. } } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,42): error CS1001: Identifier expected // Func<Program, string> l = a => a. Diagnostic(ErrorCode.ERR_IdentifierExpected, "").WithLocation(8, 42), // (8,42): error CS1002: ; expected // Func<Program, string> l = a => a. Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(8, 42) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_03() { var src = @" using System; class Program { static void stuff() { M1(a => a.); } static void M1(Func<Program, string> l){} } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,20): error CS1001: Identifier expected // M1(a => a.); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 20) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact, WorkItem(1179899, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1179899")] public void ParameterReference_04() { var src = @" using System; class Program { static void stuff() { var l = (Func<Program, string>) (a => a.); } } "; var compilation = CreateCompilation(src); compilation.VerifyDiagnostics( // (8,49): error CS1001: Identifier expected // var l = (Func<Program, string>) (a => a.); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 49) ); var tree = compilation.SyntaxTrees.Single(); var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); Assert.Equal("a.", node.Parent.ToString().Trim()); var semanticModel = compilation.GetSemanticModel(tree); var symbolInfo = semanticModel.GetSymbolInfo(node); Assert.Equal("Program a", symbolInfo.Symbol.ToTestDisplayString()); } [Fact] [WorkItem(3826, "https://github.com/dotnet/roslyn/issues/3826")] public void ExpressionTreeSelfAssignmentShouldError() { var source = @" using System; using System.Linq.Expressions; class Program { static void Main() { Expression<Func<int, int>> x = y => y = y; } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); compilation.VerifyDiagnostics( // (9,45): warning CS1717: Assignment made to same variable; did you mean to assign something else? // Expression<Func<int, int>> x = y => y = y; Diagnostic(ErrorCode.WRN_AssignmentToSelf, "y = y").WithLocation(9, 45), // (9,45): error CS0832: An expression tree may not contain an assignment operator // Expression<Func<int, int>> x = y => y = y; Diagnostic(ErrorCode.ERR_ExpressionTreeContainsAssignment, "y = y").WithLocation(9, 45)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2(default(Struct1))); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,40): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2(default(Struct1))); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default(Struct1)").WithArguments("Struct1").WithLocation(8, 40)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructDefaultExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2(default)); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,40): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2(default)); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default").WithArguments("Struct1").WithLocation(8, 40)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructDefaultCastExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2((Struct1) default)); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,50): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2((Struct1) default)); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default").WithArguments("Struct1").WithLocation(8, 50)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructNewExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method((Class1 c) => c.Method2(new Struct1())); } public void Method2(Struct1 s1) { } public static void Method<T>(Expression<Action<T>> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,40): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Class1 c) => c.Method2(new Struct1())); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "new Struct1()").WithArguments("Struct1").WithLocation(8, 40)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructParamExpressionTree() { var text = @" using System.Linq.Expressions; public delegate void Delegate1(Struct1 s); public class Class1 { public void Method1() { Method((Struct1 s) => Method2()); } public void Method2() { } public static void Method(Expression<Delegate1> expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (9,25): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'Struct1'. // Method((Struct1 s) => Method2()); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "s").WithArguments("Struct1").WithLocation(9, 25)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void RefStructParamLambda() { var text = @" public delegate void Delegate1(Struct1 s); public class Class1 { public void Method1() { Method((Struct1 s) => Method2()); } public void Method2() { } public static void Method(Delegate1 expression) { } } public ref struct Struct1 { } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics(); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void TypedReferenceExpressionTree() { var text = @" using System; using System.Linq.Expressions; public class Class1 { public void Method1() { Method(() => Method2(default)); } public void Method2(TypedReference tr) { } public static void Method(Expression<Action> expression) { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (8,30): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'TypedReference'. // Method(() => Method2(default)); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "default").WithArguments("TypedReference").WithLocation(8, 30)); } [Fact, WorkItem(30776, "https://github.com/dotnet/roslyn/issues/30776")] public void TypedReferenceParamExpressionTree() { var text = @" using System; using System.Linq.Expressions; public delegate void Delegate1(TypedReference tr); public class Class1 { public void Method1() { Method((TypedReference tr) => Method2()); } public void Method2() { } public static void Method(Expression<Delegate1> expression) { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(text).VerifyDiagnostics( // (9,32): error CS8640: Expression tree cannot contain value of ref struct or restricted type 'TypedReference'. // Method((TypedReference tr) => Method2()); Diagnostic(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, "tr").WithArguments("TypedReference").WithLocation(9, 32)); } [Fact, WorkItem(5363, "https://github.com/dotnet/roslyn/issues/5363")] public void ReturnInferenceCache_Dynamic_vs_Object_01() { var source = @" using System; using System.Collections; using System.Collections.Generic; public static class Program { public static void Main(string[] args) { IEnumerable<dynamic> dynX = null; // CS1061 'object' does not contain a definition for 'Text'... // tooltip on 'var' shows IColumn instead of IEnumerable<dynamic> var result = dynX.Select(_ => _.Text); } public static IColumn Select<TResult>(this IColumn source, Func<object, TResult> selector) { throw new NotImplementedException(); } public static IEnumerable<S> Select<T, S>(this IEnumerable<T> source, Func<T, S> selector) { System.Console.WriteLine(""Select<T, S>""); return null; } } public interface IColumn { } "; var compilation = CreateCompilation(source, new[] { CSharpRef }, options: TestOptions.ReleaseExe); CompileAndVerify(compilation, expectedOutput: "Select<T, S>"); } [Fact, WorkItem(5363, "https://github.com/dotnet/roslyn/issues/5363")] public void ReturnInferenceCache_Dynamic_vs_Object_02() { var source = @" using System; using System.Collections; using System.Collections.Generic; public static class Program { public static void Main(string[] args) { IEnumerable<dynamic> dynX = null; // CS1061 'object' does not contain a definition for 'Text'... // tooltip on 'var' shows IColumn instead of IEnumerable<dynamic> var result = dynX.Select(_ => _.Text); } public static IEnumerable<S> Select<T, S>(this IEnumerable<T> source, Func<T, S> selector) { System.Console.WriteLine(""Select<T, S>""); return null; } public static IColumn Select<TResult>(this IColumn source, Func<object, TResult> selector) { throw new NotImplementedException(); } } public interface IColumn { } "; var compilation = CreateCompilation(source, new[] { CSharpRef }, options: TestOptions.ReleaseExe); CompileAndVerify(compilation, expectedOutput: "Select<T, S>"); } [Fact, WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void SyntaxAndSemanticErrorInLambda() { var source = @" using System; class C { public static void Main(string[] args) { Action a = () => { new X().ToString() }; a(); } } "; CreateCompilation(source).VerifyDiagnostics( // (7,47): error CS1002: ; expected // Action a = () => { new X().ToString() }; Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(7, 47), // (7,32): error CS0246: The type or namespace name 'X' could not be found (are you missing a using directive or an assembly reference?) // Action a = () => { new X().ToString() }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "X").WithArguments("X").WithLocation(7, 32) ); } [Fact, WorkItem(4527, "https://github.com/dotnet/roslyn/issues/4527")] public void AnonymousMethodExpressionWithoutParameterList() { var source = @" using System; using System.Threading.Tasks; namespace RoslynAsyncDelegate { class Program { static EventHandler MyEvent; static void Main(string[] args) { MyEvent += async delegate { await Task.Delay(0); }; } } } "; var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe); var tree = compilation.SyntaxTrees[0]; var model = compilation.GetSemanticModel(tree); var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AnonymousMethodExpression)).Single(); Assert.Equal("async delegate { await Task.Delay(0); }", node1.ToString()); Assert.Equal("void System.EventHandler.Invoke(System.Object sender, System.EventArgs e)", model.GetTypeInfo(node1).ConvertedType.GetMembers("Invoke").Single().ToTestDisplayString()); var lambdaParameters = ((IMethodSymbol)(model.GetSymbolInfo(node1)).Symbol).Parameters; Assert.Equal("System.Object <p0>", lambdaParameters[0].ToTestDisplayString()); Assert.Equal("System.EventArgs <p1>", lambdaParameters[1].ToTestDisplayString()); CompileAndVerify(compilation); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError01() { var source = @"using System.Linq; class C { C() { string.Empty.Select(() => { new Unbound1 }); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,58): error CS1526: A new expression requires (), [], or {} after type // class C { C() { string.Empty.Select(() => { new Unbound1 }); } } Diagnostic(ErrorCode.ERR_BadNewExpr, "}").WithLocation(2, 58), // (2,58): error CS1002: ; expected // class C { C() { string.Empty.Select(() => { new Unbound1 }); } } Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(2, 58), // (2,49): error CS0246: The type or namespace name 'Unbound1' could not be found (are you missing a using directive or an assembly reference?) // class C { C() { string.Empty.Select(() => { new Unbound1 }); } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "Unbound1").WithArguments("Unbound1").WithLocation(2, 49) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError02() { var source = @"using System.Linq; class C { C() { string.Empty.Select(() => { new Unbound1 ( ) }); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,62): error CS1002: ; expected // class C { C() { string.Empty.Select(() => { new Unbound1 ( ) }); } } Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(2, 62), // (2,49): error CS0246: The type or namespace name 'Unbound1' could not be found (are you missing a using directive or an assembly reference?) // class C { C() { string.Empty.Select(() => { new Unbound1 ( ) }); } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "Unbound1").WithArguments("Unbound1").WithLocation(2, 49) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError03() { var source = @"using System.Linq; class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,61): error CS1003: Syntax error, ',' expected // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_SyntaxError, "Unbound2").WithArguments(",", "").WithLocation(2, 61), // (2,52): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 52), // (2,61): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 61), // (2,42): error CS0103: The name 'Unbound1' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2 Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound1").WithArguments("Unbound1").WithLocation(2, 42) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError04() { var source = @"using System.Linq; class C { C() { string.Empty.Select(x => Unbound1, Unbound2); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,52): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 52), // (2,42): error CS0103: The name 'Unbound1' does not exist in the current context // class C { C() { string.Empty.Select(x => Unbound1, Unbound2); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound1").WithArguments("Unbound1").WithLocation(2, 42) ); } [Fact] [WorkItem(1867, "https://github.com/dotnet/roslyn/issues/1867")] public void TestLambdaWithError05() { var source = @"using System.Linq; class C { C() { Unbound2.Select(x => Unbound1); } }"; CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (2,17): error CS0103: The name 'Unbound2' does not exist in the current context // class C { C() { Unbound2.Select(x => Unbound1); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound2").WithArguments("Unbound2").WithLocation(2, 17), // (2,38): error CS0103: The name 'Unbound1' does not exist in the current context // class C { C() { Unbound2.Select(x => Unbound1); } } Diagnostic(ErrorCode.ERR_NameNotInContext, "Unbound1").WithArguments("Unbound1").WithLocation(2, 38) ); } [Fact] [WorkItem(4480, "https://github.com/dotnet/roslyn/issues/4480")] public void TestLambdaWithError06() { var source = @"class Program { static void Main(string[] args) { // completion should work even in a syntactically invalid lambda var handler = new MyDelegateType((s, e) => { e. }); } } public delegate void MyDelegateType( object sender, MyArgumentType e ); public class MyArgumentType { public int SomePublicMember; }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source) .VerifyDiagnostics( // var handler = new MyDelegateType((s, e) => { e. }); Diagnostic(ErrorCode.ERR_IdentifierExpected, "}").WithLocation(6, 57), // (6,57): error CS1002: ; expected // var handler = new MyDelegateType((s, e) => { e. }); Diagnostic(ErrorCode.ERR_SemicolonExpected, "}").WithLocation(6, 57) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("e", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal("MyArgumentType", typeInfo.Type.Name); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.NotEmpty(typeInfo.Type.GetMembers("SomePublicMember")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError07() { var source = @"using System; using System.Collections.Generic; public static class Program { public static void Main() { var parameter = new List<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public static class Enumerable { public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, TSource defaultValue) { return default(TSource); } public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, TSource defaultValue) { return default(TSource); } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (9,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(9, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError08() { var source = @"using System; using System.Collections.Generic; public static class Program { public static void Main() { var parameter = new List<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public static class Enumerable { public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, params TSource[] defaultValue) { return default(TSource); } public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, params TSource[] defaultValue) { return default(TSource); } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (9,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(9, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError09() { var source = @"using System; public static class Program { public static void Main() { var parameter = new MyList<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public class MyList<TSource> { public TSource FirstOrDefault(TSource defaultValue) { return default(TSource); } public TSource FirstOrDefault(Func<TSource, bool> predicate, TSource defaultValue) { return default(TSource); } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (8,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(11053, "https://github.com/dotnet/roslyn/issues/11053")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] public void TestLambdaWithError10() { var source = @"using System; public static class Program { public static void Main() { var parameter = new MyList<string>(); var result = parameter.FirstOrDefault(x => x. ); } } public class MyList<TSource> { public TSource FirstOrDefault(params TSource[] defaultValue) { return default(TSource); } public TSource FirstOrDefault(Func<TSource, bool> predicate, params TSource[] defaultValue) { return default(TSource); } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source).VerifyDiagnostics( // (8,55): error CS1001: Identifier expected // var result = parameter.FirstOrDefault(x => x. ); Diagnostic(ErrorCode.ERR_IdentifierExpected, ")").WithLocation(8, 55) ); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [Fact] [WorkItem(557, "https://github.com/dotnet/roslyn/issues/557")] public void TestLambdaWithError11() { var source = @"using System.Linq; public static class Program { public static void Main() { var x = new { X = """".Select(c => c. Y = 0, }; } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("c", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Struct, typeInfo.Type.TypeKind); Assert.Equal("Char", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("IsHighSurrogate")); // check it is the char we know and love } [Fact] [WorkItem(5498, "https://github.com/dotnet/roslyn/issues/5498")] public void TestLambdaWithError12() { var source = @"using System.Linq; class Program { static void Main(string[] args) { var z = args.Select(a => a. var goo = } }"; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); Assert.Equal("a", eReference.ToString()); var typeInfo = sm.GetTypeInfo(eReference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } [WorkItem(5498, "https://github.com/dotnet/roslyn/issues/5498")] [WorkItem(11358, "https://github.com/dotnet/roslyn/issues/11358")] [Fact] public void TestLambdaWithError13() { // These tests ensure we attempt to perform type inference and bind a lambda expression // argument even when there are too many or too few arguments to an invocation, in the // case when there is more than one method in the method group. // See https://github.com/dotnet/roslyn/issues/11901 for the case of one method in the group var source = @"using System; class Program { static void Main(string[] args) { Thing<string> t = null; t.X1(x => x, 1); // too many args t.X2(x => x); // too few args t.M2(string.Empty, x => x, 1); // too many args t.M3(string.Empty, x => x); // too few args } } public class Thing<T> { public void M2<T>(T x, Func<T, T> func) {} public void M3<T>(T x, Func<T, T> func, T y) {} // Ensure we have more than one method in the method group public void M2() {} public void M3() {} } public static class XThing { public static Thing<T> X1<T>(this Thing<T> self, Func<T, T> func) => null; public static Thing<T> X2<T>(this Thing<T> self, Func<T, T> func, int i) => null; // Ensure we have more than one method in the method group public static void X1(this object self) {} public static void X2(this object self) {} } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(11901, "https://github.com/dotnet/roslyn/issues/11901")] public void TestLambdaWithError15() { // These tests ensure we attempt to perform type inference and bind a lambda expression // argument even when there are too many or too few arguments to an invocation, in the // case when there is exactly one method in the method group. var source = @"using System; class Program { static void Main(string[] args) { Thing<string> t = null; t.X1(x => x, 1); // too many args t.X2(x => x); // too few args t.M2(string.Empty, x => x, 1); // too many args t.M3(string.Empty, x => x); // too few args } } public class Thing<T> { public void M2<T>(T x, Func<T, T> func) {} public void M3<T>(T x, Func<T, T> func, T y) {} } public static class XThing { public static Thing<T> X1<T>(this Thing<T> self, Func<T, T> func) => null; public static Thing<T> X2<T>(this Thing<T> self, Func<T, T> func, int i) => null; } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(11901, "https://github.com/dotnet/roslyn/issues/11901")] public void TestLambdaWithError16() { // These tests ensure we use the substituted method to bind a lambda expression // argument even when there are too many or too few arguments to an invocation, in the // case when there is exactly one method in the method group. var source = @"using System; class Program { static void Main(string[] args) { Thing<string> t = null; t.X1<string>(x => x, 1); // too many args t.X2<string>(x => x); // too few args t.M2<string>(string.Empty, x => x, 1); // too many args t.M3<string>(string.Empty, x => x); // too few args } } public class Thing<T> { public void M2<T>(T x, Func<T, T> func) {} public void M3<T>(T x, Func<T, T> func, T y) {} } public static class XThing { public static Thing<T> X1<T>(this Thing<T> self, Func<T, T> func) => null; public static Thing<T> X2<T>(this Thing<T> self, Func<T, T> func, int i) => null; } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(12063, "https://github.com/dotnet/roslyn/issues/12063")] public void TestLambdaWithError17() { var source = @"using System; class Program { static void Main(string[] args) { Ma(action: (x, y) => x.ToString(), t: string.Empty); Mb(action: (x, y) => x.ToString(), t: string.Empty); } static void Ma<T>(T t, Action<T, T, int> action) { } static void Mb<T>(T t, Action<T, T, int> action) { } static void Mb() { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(12063, "https://github.com/dotnet/roslyn/issues/12063")] public void TestLambdaWithError18() { var source = @"using System; class Program { static void Main(string[] args) { Ma(string.Empty, (x, y) => x.ToString()); Mb(string.Empty, (x, y) => x.ToString()); } static void Ma<T>(T t, Action<T, T, int> action) { } static void Mb<T>(T t, Action<T, T, int> action) { } static void Mb() { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } [Fact] [WorkItem(12063, "https://github.com/dotnet/roslyn/issues/12063")] public void TestLambdaWithError19() { var source = @"using System; using System.Linq.Expressions; class Program { static void Main(string[] args) { Ma(string.Empty, (x, y) => x.ToString()); Mb(string.Empty, (x, y) => x.ToString()); Mc(string.Empty, (x, y) => x.ToString()); } static void Ma<T>(T t, Expression<Action<T, T, int>> action) { } static void Mb<T>(T t, Expression<Action<T, T, int>> action) { } static void Mb<T>(T t, Action<T, T, int> action) { } static void Mc<T>(T t, Expression<Action<T, T, int>> action) { } static void Mc() { } } "; var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) { var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); Assert.Equal("x", reference.ToString()); var typeInfo = sm.GetTypeInfo(reference); Assert.Equal(TypeKind.Class, typeInfo.Type.TypeKind); Assert.Equal("String", typeInfo.Type.Name); Assert.NotEmpty(typeInfo.Type.GetMembers("Replace")); } } // See MaxParameterListsForErrorRecovery. [Fact] public void BuildArgumentsForErrorRecovery_ManyOverloads() { BuildArgumentsForErrorRecovery_ManyOverloads_Internal(Binder.MaxParameterListsForErrorRecovery - 1, tooMany: false); BuildArgumentsForErrorRecovery_ManyOverloads_Internal(Binder.MaxParameterListsForErrorRecovery, tooMany: true); } private void BuildArgumentsForErrorRecovery_ManyOverloads_Internal(int n, bool tooMany) { var builder = new StringBuilder(); builder.AppendLine("using System;"); for (int i = 0; i < n; i++) { builder.AppendLine($"class C{i} {{ }}"); } builder.Append( @"class A { } class B { } class C { void M() { F(1, (t, a, b, c) => { }); var o = this[(a, b, c) => { }]; } "); // Too few parameters. AppendLines(builder, n, i => $" void F<T>(T t, Action<T, A, C{i}> a) {{ }}"); AppendLines(builder, n, i => $" object this[Action<A, C{i}> a] => {i}"); // Type inference failure. AppendLines(builder, n, i => $" void F<T, U>(T t, Action<T, U, C{i}> a) where U : T {{ }}"); // Too many parameters. AppendLines(builder, n, i => $" void F<T>(T t, Action<T, A, B, C, C{i}> a) {{ }}"); AppendLines(builder, n, i => $" object this[Action<A, B, C, C{i}> a] => {i}"); builder.AppendLine("}"); var source = builder.ToString(); var compilation = CreateCompilationWithMscorlib40AndSystemCore(source); var tree = compilation.SyntaxTrees[0]; var sm = compilation.GetSemanticModel(tree); var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); // F(1, (t, a, b, c) => { }); var lambda = lambdas[0]; var parameters = lambda.ParameterList.Parameters; var parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[0]); Assert.False(parameter.Type.IsErrorType()); Assert.Equal("System.Int32 t", parameter.ToTestDisplayString()); parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[1]); Assert.False(parameter.Type.IsErrorType()); Assert.Equal("A a", parameter.ToTestDisplayString()); parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[3]); Assert.Equal(tooMany, parameter.Type.IsErrorType()); Assert.Equal(tooMany ? "? c" : "C c", parameter.ToTestDisplayString()); // var o = this[(a, b, c) => { }]; lambda = lambdas[1]; parameters = lambda.ParameterList.Parameters; parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[0]); Assert.False(parameter.Type.IsErrorType()); Assert.Equal("A a", parameter.ToTestDisplayString()); parameter = (IParameterSymbol)sm.GetDeclaredSymbol(parameters[2]); Assert.Equal(tooMany, parameter.Type.IsErrorType()); Assert.Equal(tooMany ? "? c" : "C c", parameter.ToTestDisplayString()); } private static void AppendLines(StringBuilder builder, int n, Func<int, string> getLine) { for (int i = 0; i < n; i++) { builder.AppendLine(getLine(i)); } } [Fact] [WorkItem(13797, "https://github.com/dotnet/roslyn/issues/13797")] public void DelegateAsAction() { var source = @" using System; public static class C { public static void M() => Dispatch(delegate { }); public static T Dispatch<T>(Func<T> func) => default(T); public static void Dispatch(Action func) { } }"; var comp = CreateCompilation(source); CompileAndVerify(comp); } [Fact, WorkItem(278481, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=278481")] public void LambdaReturningNull_1() { var src = @" public static class ExtensionMethods { public static System.Linq.IQueryable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Linq.IQueryable<TOuter> outerValues, System.Linq.IQueryable<TInner> innerValues, System.Linq.Expressions.Expression<System.Func<TOuter, TKey>> outerKeySelector, System.Linq.Expressions.Expression<System.Func<TInner, TKey>> innerKeySelector, System.Linq.Expressions.Expression<System.Func<TOuter, TInner, TResult>> fullResultSelector, System.Linq.Expressions.Expression<System.Func<TOuter, TResult>> partialResultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { return null; } public static System.Linq.IQueryable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Linq.IQueryable<TOuter> outerValues, System.Linq.IQueryable<TInner> innerValues, System.Linq.Expressions.Expression<System.Func<TOuter, TKey>> outerKeySelector, System.Linq.Expressions.Expression<System.Func<TInner, TKey>> innerKeySelector, System.Linq.Expressions.Expression<System.Func<TOuter, TInner, TResult>> fullResultSelector, System.Linq.Expressions.Expression<System.Func<TOuter, TResult>> partialResultSelector) { System.Console.WriteLine(""1""); return null; } public static System.Collections.Generic.IEnumerable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Collections.Generic.IEnumerable<TOuter> outerValues, System.Linq.IQueryable<TInner> innerValues, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> fullResultSelector, System.Func<TOuter, TResult> partialResultSelector) { System.Console.WriteLine(""2""); return null; } public static System.Collections.Generic.IEnumerable<TResult> LeftOuterJoin<TOuter, TInner, TKey, TResult>( this System.Collections.Generic.IEnumerable<TOuter> outerQueryable, System.Collections.Generic.IEnumerable<TInner> innerQueryable, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> resultSelector) { return null; } } partial class C { public static void Main() { System.Linq.IQueryable<A> outerValue = null; System.Linq.IQueryable<B> innerValues = null; outerValue.LeftOuterJoin(innerValues, co => co.id, coa => coa.id, (co, coa) => null, co => co); } } class A { public int id=2; } class B { public int id = 2; }"; var comp = CreateCompilationWithMscorlib40AndSystemCore(src, options: TestOptions.DebugExe); CompileAndVerify(comp, expectedOutput: "1"); } [Fact, WorkItem(296550, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=296550")] public void LambdaReturningNull_2() { var src = @" class Test1<T> { public void M1(System.Func<T> x) {} public void M1<S>(System.Func<S> x) {} public void M2<S>(System.Func<S> x) {} public void M2(System.Func<T> x) {} } class Test2 : Test1<System.> { void Main() { M1(()=> null); M2(()=> null); } } "; var comp = CreateCompilation(src, options: TestOptions.DebugDll); comp.VerifyDiagnostics( // (10,32): error CS1001: Identifier expected // class Test2 : Test1<System.> Diagnostic(ErrorCode.ERR_IdentifierExpected, ">").WithLocation(10, 32) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void LambdaSquigglesArea() { var src = @" class C { void M() { System.Func<bool, System.Action<bool>> x = x1 => x2 => { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,58): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // System.Func<bool, System.Action<bool>> x = x1 => x2 => Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "x2 =>").WithArguments("lambda expression").WithLocation(6, 58) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void LambdaSquigglesAreaInAsync() { var src = @" class C { void M() { System.Func<bool, System.Threading.Tasks.Task<System.Action<bool>>> x = async x1 => x2 => { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,93): error CS4010: Cannot convert async lambda expression to delegate type 'Task<Action<bool>>'. An async lambda expression may return void, Task or Task<T>, none of which are convertible to 'Task<Action<bool>>'. // System.Func<bool, System.Threading.Tasks.Task<System.Action<bool>>> x = async x1 => x2 => Diagnostic(ErrorCode.ERR_CantConvAsyncAnonFuncReturns, "x2 =>").WithArguments("lambda expression", "System.Threading.Tasks.Task<System.Action<bool>>").WithLocation(6, 93), // (6,90): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. // System.Func<bool, System.Threading.Tasks.Task<System.Action<bool>>> x = async x1 => x2 => Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(6, 90) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void DelegateSquigglesArea() { var src = @" class C { void M() { System.Func<bool, System.Action<bool>> x = x1 => delegate(bool x2) { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,58): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // System.Func<bool, System.Action<bool>> x = x1 => delegate(bool x2) Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "delegate(bool x2)").WithArguments("lambda expression").WithLocation(6, 58) ); } [Fact, WorkItem(22662, "https://github.com/dotnet/roslyn/issues/22662")] public void DelegateWithoutArgumentsSquigglesArea() { var src = @" class C { void M() { System.Func<bool, System.Action> x = x1 => delegate { error(); }; } } "; var comp = CreateCompilation(src); comp.VerifyDiagnostics( // (8,13): error CS0103: The name 'error' does not exist in the current context // error(); Diagnostic(ErrorCode.ERR_NameNotInContext, "error").WithArguments("error").WithLocation(8, 13), // (6,52): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type // System.Func<bool, System.Action> x = x1 => delegate Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "delegate").WithArguments("lambda expression").WithLocation(6, 52) ); } [Fact] public void ThrowExpression_Lambda() { var src = @"using System; class C { public static void Main() { Action a = () => throw new Exception(""1""); try { a(); } catch (Exception ex) { Console.Write(ex.Message); } Func<int, int> b = x => throw new Exception(""2""); try { b(0); } catch (Exception ex) { Console.Write(ex.Message); } b = (int x) => throw new Exception(""3""); try { b(0); } catch (Exception ex) { Console.Write(ex.Message); } b = (x) => throw new Exception(""4""); try { b(0); } catch (Exception ex) { Console.Write(ex.Message); } } }"; var comp = CreateCompilationWithMscorlib40AndSystemCore(src, options: TestOptions.DebugExe); CompileAndVerify(comp, expectedOutput: "1234"); } [Fact, WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] public void InMalformedEmbeddedStatement_01() { var source = @" class Program { void method1() { if (method2()) .Any(b => b.ContentType, out var chars) { } } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); var model = comp.GetSemanticModel(tree); Assert.Equal("ContentType", contentType.ToString()); Assert.Null(model.GetSymbolInfo(contentType).Symbol); Assert.Equal(TypeKind.Error, model.GetTypeInfo(contentType).Type.TypeKind); ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); model = comp.GetSemanticModel(tree); Assert.Equal("b", b.ToString()); ISymbol symbol = model.GetSymbolInfo(b).Symbol; Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal("? b", symbol.ToTestDisplayString()); Assert.Equal(TypeKind.Error, model.GetTypeInfo(b).Type.TypeKind); ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); model = comp.GetSemanticModel(tree); symbol = model.GetDeclaredSymbol(parameterSyntax); Assert.Equal(SymbolKind.Parameter, symbol.Kind); Assert.Equal("? b", symbol.ToTestDisplayString()); } [Fact, WorkItem(23883, "https://github.com/dotnet/roslyn/issues/23883")] public void InMalformedEmbeddedStatement_02() { var source = @" class Program { void method1() { if (method2()) .Any(b => b.ContentType, out var chars) { } } } "; var tree = SyntaxFactory.ParseSyntaxTree(source); var comp = CreateCompilation(tree); ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); var model = comp.GetSemanticModel(tree); Assert.Equal("ContentType", contentType.ToString()); var lambda = (IMethodSymbol)model.GetEnclosingSymbol(contentType.SpanStart); Assert.Equal(MethodKind.AnonymousFunction, lambda.MethodKind); ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); model = comp.GetSemanticModel(tree); Assert.Equal("b", b.ToString()); lambda = (IMethodSymbol)model.GetEnclosingSymbol(b.SpanStart); Assert.Equal(MethodKind.AnonymousFunction, lambda.MethodKind); model = comp.GetSemanticModel(tree); ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); Assert.Equal("void Program.method1()", model.GetEnclosingSymbol(parameterSyntax.SpanStart).ToTestDisplayString()); } [Fact] public void ShadowNames_Local() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M() { Action a1 = () => { object x = 0; }; // local Action<string> a2 = x => { }; // parameter Action<string> a3 = (string x) => { }; // parameter object x = null; Action a4 = () => { void x() { } }; // method Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,36): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = () => { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 36), // (10,29): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = x => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 29), // (11,37): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a3 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 37), // (13,34): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a4 = () => { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(13, 34), // (14,38): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(14, 38)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular8); comp.VerifyDiagnostics(); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Parameter() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static Action<object> F = (object x) => { Action a1 = () => { object x = 0; }; // local Action<string> a2 = x => { }; // parameter Action<string> a3 = (string x) => { }; // parameter Action a4 = () => { void x() { } }; // method Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable }; }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,36): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = () => { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 36), // (10,29): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = x => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 29), // (11,37): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a3 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 37), // (13,38): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(13, 38)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_TypeParameter() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M<x>() { Action a1 = () => { object x = 0; }; // local Action<string> a2 = x => { }; // parameter Action<string> a3 = (string x) => { }; // parameter Action a4 = () => { void x() { } }; // method Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,36): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a1 = () => { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(9, 36), // (10,29): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> a2 = x => { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(10, 29), // (11,37): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> a3 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(11, 37), // (12,34): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a4 = () => { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(12, 34), // (13,38): error CS1948: The range variable 'x' cannot have the same name as a method type parameter // Action a5 = () => { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableSameAsTypeParam, "x").WithArguments("x").WithLocation(13, 38)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_QueryParameter() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void Main(string[] args) { _ = from x in args select (Action)(() => { object x = 0; }); // local _ = from x in args select (Action<string>)(x => { }); // parameter _ = from x in args select (Action<string>)((string x) => { }); // parameter _ = from x in args select (Action)(() => { void x() { } }); // method _ = from x in args select (Action)(() => { _ = from x in new[] { 1, 2, 3 } select x; }); // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,59): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // _ = from x in args select (Action)(() => { object x = 0; }); // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 59), // (10,52): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // _ = from x in args select (Action<string>)(x => { }); // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 52), // (11,60): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // _ = from x in args select (Action<string>)((string x) => { }); // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 60), // (13,61): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // _ = from x in args select (Action)(() => { _ = from x in new[] { 1, 2, 3 } select x; }); // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(13, 61)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Local_Delegate() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M() { object x = null; Action a1 = delegate() { object x = 0; }; // local Action<string> a2 = delegate(string x) { }; // parameter Action a3 = delegate() { void x() { } }; // method Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (10,41): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = delegate() { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 41), // (11,45): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = delegate(string x) { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 45), // (12,39): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a3 = delegate() { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(12, 39), // (13,43): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(13, 43)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular8); comp.VerifyDiagnostics(); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Parameter_Delegate() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static Action<object> F = (object x) => { Action a1 = delegate() { object x = 0; }; // local Action<string> a2 = delegate(string x) { }; // parameter Action a3 = delegate() { void x() { } }; // method Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable }; }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,41): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = delegate() { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(9, 41), // (10,45): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> a2 = delegate(string x) { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 45), // (12,43): error CS1931: The range variable 'x' conflicts with a previous declaration of 'x' // Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableOverrides, "x").WithArguments("x").WithLocation(12, 43)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_TypeParameter_Delegate() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; using System.Linq; class Program { static void M<x>() { Action a1 = delegate() { object x = 0; }; // local Action<string> a2 = delegate(string x) { }; // parameter Action a3 = delegate() { void x() { } }; // method Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (9,41): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a1 = delegate() { object x = 0; }; // local Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(9, 41), // (10,45): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> a2 = delegate(string x) { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(10, 45), // (11,39): error CS0412: 'x': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a3 = delegate() { void x() { } }; // method Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "x").WithArguments("x").WithLocation(11, 39), // (12,43): error CS1948: The range variable 'x' cannot have the same name as a method type parameter // Action a4 = delegate() { _ = from x in new[] { 1, 2, 3 } select x; }; // range variable Diagnostic(ErrorCode.ERR_QueryRangeVariableSameAsTypeParam, "x").WithArguments("x").WithLocation(12, 43)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_LambdaInsideLambda() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M<T>(object x) { Action a1 = () => { Action b1 = () => { object x = 1; }; // local Action<string> b2 = (string x) => { }; // parameter }; Action a2 = () => { Action b3 = () => { object T = 3; }; // local Action<string> b4 = T => { }; // parameter }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (10,40): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action b1 = () => { object x = 1; }; // local Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(10, 40), // (11,41): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<string> b2 = (string x) => { }; // parameter Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 41), // (15,40): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action b3 = () => { object T = 3; }; // local Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(15, 40), // (16,33): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<string> b4 = T => { }; // parameter Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(16, 33)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Underscore_01() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, Func<int, int>> f = _ => _ => _; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,44): error CS0136: A local or parameter named '_' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, Func<int, int>> f = _ => _ => _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "_").WithArguments("_").WithLocation(8, 44)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Underscore_02() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, int, int> f = (_, _) => 0; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,37): error CS8370: Feature 'lambda discard parameters' is not available in C# 7.3. Please use language version 9.0 or greater. // Func<int, int, int> f = (_, _) => 0; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7_3, "_").WithArguments("lambda discard parameters", "9.0").WithLocation(8, 37)); comp = CreateCompilation(source); comp.VerifyEmitDiagnostics(); } [Fact] public void ShadowNames_Nested_01() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, Func<int, Func<int, int>>> f = x => x => x => x; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,55): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, Func<int, Func<int, int>>> f = x => x => x => x; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(8, 55), // (8,60): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, Func<int, Func<int, int>>> f = x => x => x => x; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(8, 60)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_Nested_02() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (8,87): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(8, 87), // (8,94): error CS0136: A local or parameter named 'y' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "y").WithArguments("y").WithLocation(8, 94), // (8,97): error CS0136: A local or parameter named '_' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Func<int, int, int, Func<int, int, Func<int, int, int>>> f = (x, y, z) => (_, x) => (y, _) => x + y + z + _; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "_").WithArguments("_").WithLocation(8, 97)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_LambdaInsideLocalFunction_01() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M() { void F1() { object x = null; Action a1 = () => { int x = 0; }; } void F2<T>() { Action a2 = () => { int T = 0; }; } } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (11,37): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action a1 = () => { int x = 0; }; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 37), // (15,37): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action a2 = () => { int T = 0; }; Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(15, 37)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void ShadowNames_LambdaInsideLocalFunction_02() { var source = @"#pragma warning disable 0219 #pragma warning disable 8321 using System; class Program { static void M<T>() { object x = null; void F() { Action<int> a1 = (int x) => { Action b1 = () => { int T = 0; }; }; Action a2 = () => { int x = 0; Action<int> b2 = (int T) => { }; }; } } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_3); comp.VerifyDiagnostics( // (11,35): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // Action<int> a1 = (int x) => Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(11, 35), // (13,41): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action b1 = () => { int T = 0; }; Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(13, 41), // (17,21): error CS0136: A local or parameter named 'x' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter // int x = 0; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x").WithArguments("x").WithLocation(17, 21), // (18,39): error CS0412: 'T': a parameter, local variable, or local function cannot have the same name as a method type parameter // Action<int> b2 = (int T) => { }; Diagnostic(ErrorCode.ERR_LocalSameNameAsTypeParam, "T").WithArguments("T").WithLocation(18, 39)); comp = CreateCompilation(source); comp.VerifyDiagnostics(); } [Fact] public void LambdaAttributes_01() { var sourceA = @"using System; class A : Attribute { } class B : Attribute { } partial class Program { static Delegate D1() => (Action)([A] () => { }); static Delegate D2(int x) => (Func<int, int, int>)((int y, [A][B] int z) => x); static Delegate D3() => (Action<int, object>)(([A]_, y) => { }); Delegate D4() => (Func<int>)([return: A][B] () => GetHashCode()); }"; var sourceB = @"using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; partial class Program { static string GetAttributeString(object a) { return a.GetType().FullName; } static void Report(Delegate d) { var m = d.Method; var forMethod = ToString(""method"", m.GetCustomAttributes(inherit: false)); var forReturn = ToString(""return"", m.ReturnTypeCustomAttributes.GetCustomAttributes(inherit: false)); var forParameters = ToString(""parameter"", m.GetParameters().SelectMany(p => p.GetCustomAttributes(inherit: false))); Console.WriteLine(""{0}:{1}{2}{3}"", m.Name, forMethod, forReturn, forParameters); } static string ToString(string target, IEnumerable<object> attributes) { var builder = new StringBuilder(); foreach (var attribute in attributes) builder.Append($"" [{target}: {attribute}]""); return builder.ToString(); } static void Main() { Report(D1()); Report(D2(0)); Report(D3()); Report(new Program().D4()); } }"; var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.Regular10, options: TestOptions.ReleaseExe); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); var pairs = exprs.Select(e => (e, model.GetSymbolInfo(e).Symbol)).ToArray(); var expectedAttributes = new[] { "[A] () => { }: [method: A]", "(int y, [A][B] int z) => x: [parameter: A] [parameter: B]", "([A]_, y) => { }: [parameter: A]", "[return: A][B] () => GetHashCode(): [method: B] [return: A]", }; AssertEx.Equal(expectedAttributes, pairs.Select(p => getAttributesInternal(p.Item1, p.Item2))); AssertEx.Equal(expectedAttributes, pairs.Select(p => getAttributesPublic(p.Item1, p.Item2))); CompileAndVerify(comp, expectedOutput: @"<D1>b__0_0: [method: A] <D2>b__0: [parameter: A] [parameter: B] <D3>b__2_0: [parameter: A] <D4>b__3_0: [method: System.Runtime.CompilerServices.CompilerGeneratedAttribute] [method: B] [return: A]"); static string getAttributesInternal(LambdaExpressionSyntax expr, ISymbol symbol) { var method = symbol.GetSymbol<MethodSymbol>(); return format(expr, method.GetAttributes(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.GetAttributes())); } static string getAttributesPublic(LambdaExpressionSyntax expr, ISymbol symbol) { var method = (IMethodSymbol)symbol; return format(expr, method.GetAttributes(), method.GetReturnTypeAttributes(), method.Parameters.SelectMany(p => p.GetAttributes())); } static string format(LambdaExpressionSyntax expr, IEnumerable<object> methodAttributes, IEnumerable<object> returnAttributes, IEnumerable<object> parameterAttributes) { var forMethod = toString("method", methodAttributes); var forReturn = toString("return", returnAttributes); var forParameters = toString("parameter", parameterAttributes); return $"{expr}:{forMethod}{forReturn}{forParameters}"; } static string toString(string target, IEnumerable<object> attributes) { var builder = new StringBuilder(); foreach (var attribute in attributes) builder.Append($" [{target}: {attribute}]"); return builder.ToString(); } } [Fact] public void LambdaAttributes_02() { var source = @"using System; class AAttribute : Attribute { } class BAttribute : Attribute { } class C { static void Main() { Action<object, object> a; a = [A, B] (x, y) => { }; a = ([A] x, [B] y) => { }; a = (object x, [A][B] object y) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9); comp.VerifyDiagnostics( // (9,13): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = [A, B] (x, y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[A, B]").WithArguments("lambda attributes", "10.0").WithLocation(9, 13), // (10,14): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = ([A] x, [B] y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[A]").WithArguments("lambda attributes", "10.0").WithLocation(10, 14), // (10,21): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = ([A] x, [B] y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[B]").WithArguments("lambda attributes", "10.0").WithLocation(10, 21), // (11,24): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = (object x, [A][B] object y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[A]").WithArguments("lambda attributes", "10.0").WithLocation(11, 24), // (11,27): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater. // a = (object x, [A][B] object y) => { }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "[B]").WithArguments("lambda attributes", "10.0").WithLocation(11, 27)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular10); comp.VerifyDiagnostics(); } [Fact] public void LambdaAttributes_03() { var source = @"using System; class AAttribute : Attribute { } class BAttribute : Attribute { } class C { static void Main() { Action<object, object> a = delegate (object x, [A][B] object y) { }; Func<object, object> f = [A][B] x => x; } }"; var expectedDiagnostics = new[] { // (8,56): error CS7014: Attributes are not valid in this context. // Action<object, object> a = delegate (object x, [A][B] object y) { }; Diagnostic(ErrorCode.ERR_AttributesNotAllowed, "[A]").WithLocation(8, 56), // (8,59): error CS7014: Attributes are not valid in this context. // Action<object, object> a = delegate (object x, [A][B] object y) { }; Diagnostic(ErrorCode.ERR_AttributesNotAllowed, "[B]").WithLocation(8, 59), // (9,34): error CS8916: Attributes on lambda expressions require a parenthesized parameter list. // Func<object, object> f = [A][B] x => x; Diagnostic(ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression, "[A]").WithLocation(9, 34), // (9,37): error CS8916: Attributes on lambda expressions require a parenthesized parameter list. // Func<object, object> f = [A][B] x => x; Diagnostic(ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression, "[B]").WithLocation(9, 37) }; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9); comp.VerifyDiagnostics(expectedDiagnostics); comp = CreateCompilation(source, parseOptions: TestOptions.Regular10); comp.VerifyDiagnostics(expectedDiagnostics); } [Fact] public void LambdaAttributes_04() { var sourceA = @"namespace N1 { class A1Attribute : System.Attribute { } } namespace N2 { class A2Attribute : System.Attribute { } }"; var sourceB = @"using N1; using N2; class Program { static void Main() { System.Action a1 = [A1] () => { }; System.Action<object> a2 = ([A2] object obj) => { }; } }"; var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); } [Fact] public void LambdaAttributes_05() { var source = @"class Program { static void Main() { System.Action a1 = [A1] () => { }; System.Func<object> a2 = [return: A2] () => null; System.Action<object> a3 = ([A3] object obj) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (5,29): error CS0246: The type or namespace name 'A1Attribute' could not be found (are you missing a using directive or an assembly reference?) // System.Action a1 = [A1] () => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A1").WithArguments("A1Attribute").WithLocation(5, 29), // (5,29): error CS0246: The type or namespace name 'A1' could not be found (are you missing a using directive or an assembly reference?) // System.Action a1 = [A1] () => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A1").WithArguments("A1").WithLocation(5, 29), // (6,43): error CS0246: The type or namespace name 'A2Attribute' could not be found (are you missing a using directive or an assembly reference?) // System.Func<object> a2 = [return: A2] () => null; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A2").WithArguments("A2Attribute").WithLocation(6, 43), // (6,43): error CS0246: The type or namespace name 'A2' could not be found (are you missing a using directive or an assembly reference?) // System.Func<object> a2 = [return: A2] () => null; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A2").WithArguments("A2").WithLocation(6, 43), // (7,38): error CS0246: The type or namespace name 'A3Attribute' could not be found (are you missing a using directive or an assembly reference?) // System.Action<object> a3 = ([A3] object obj) => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A3").WithArguments("A3Attribute").WithLocation(7, 38), // (7,38): error CS0246: The type or namespace name 'A3' could not be found (are you missing a using directive or an assembly reference?) // System.Action<object> a3 = ([A3] object obj) => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "A3").WithArguments("A3").WithLocation(7, 38)); } [Fact] public void LambdaAttributes_06() { var source = @"using System; class AAttribute : Attribute { public AAttribute(Action a) { } } [A([B] () => { })] class BAttribute : Attribute { }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (6,2): error CS0181: Attribute constructor parameter 'a' has type 'Action', which is not a valid attribute parameter type // [A([B] () => { })] Diagnostic(ErrorCode.ERR_BadAttributeParamType, "A").WithArguments("a", "System.Action").WithLocation(6, 2)); } [Fact] public void LambdaAttributes_BadAttributeLocation() { var source = @"using System; [AttributeUsage(AttributeTargets.Property)] class PropAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] class MethodAttribute : Attribute { } [AttributeUsage(AttributeTargets.ReturnValue)] class ReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter)] class ParamAttribute : Attribute { } [AttributeUsage(AttributeTargets.GenericParameter)] class TypeParamAttribute : Attribute { } class Program { static void Main() { Action<object> a = [Prop] // 1 [Return] // 2 [Method] [return: Prop] // 3 [return: Return] [return: Method] // 4 ( [Param] [TypeParam] // 5 object o) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (23,14): error CS0592: Attribute 'Prop' is not valid on this declaration type. It is only valid on 'property, indexer' declarations. // [Prop] // 1 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Prop").WithArguments("Prop", "property, indexer").WithLocation(23, 14), // (24,14): error CS0592: Attribute 'Return' is not valid on this declaration type. It is only valid on 'return' declarations. // [Return] // 2 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Return").WithArguments("Return", "return").WithLocation(24, 14), // (26,22): error CS0592: Attribute 'Prop' is not valid on this declaration type. It is only valid on 'property, indexer' declarations. // [return: Prop] // 3 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Prop").WithArguments("Prop", "property, indexer").WithLocation(26, 22), // (28,22): error CS0592: Attribute 'Method' is not valid on this declaration type. It is only valid on 'method' declarations. // [return: Method] // 4 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "Method").WithArguments("Method", "method").WithLocation(28, 22), // (31,14): error CS0592: Attribute 'TypeParam' is not valid on this declaration type. It is only valid on 'type parameter' declarations. // [TypeParam] // 5 Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "TypeParam").WithArguments("TypeParam", "type parameter").WithLocation(31, 14)); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var symbol = (IMethodSymbol)model.GetSymbolInfo(lambda).Symbol; Assert.NotNull(symbol); verifyAttributes(symbol.GetAttributes(), "PropAttribute", "ReturnAttribute", "MethodAttribute"); verifyAttributes(symbol.GetReturnTypeAttributes(), "PropAttribute", "ReturnAttribute", "MethodAttribute"); verifyAttributes(symbol.Parameters[0].GetAttributes(), "ParamAttribute", "TypeParamAttribute"); void verifyAttributes(ImmutableArray<AttributeData> attributes, params string[] expectedAttributeNames) { var actualAttributes = attributes.SelectAsArray(a => a.AttributeClass.GetSymbol()); var expectedAttributes = expectedAttributeNames.Select(n => comp.GetTypeByMetadataName(n)); AssertEx.Equal(expectedAttributes, actualAttributes); } } [Fact] public void LambdaAttributes_AttributeSemanticModel() { var source = @"using System; class AAttribute : Attribute { } class BAttribute : Attribute { } class CAttribute : Attribute { } class DAttribute : Attribute { } class Program { static void Main() { Action a = [A] () => { }; Func<object> b = [return: B] () => null; Action<object> c = ([C] object obj) => { }; Func<object, object> d = [D] x => x; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (13,34): error CS8916: Attributes on lambda expressions require a parenthesized parameter list. // Func<object, object> d = [D] x => x; Diagnostic(ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression, "[D]").WithLocation(13, 34)); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>(); var actualAttributes = attributeSyntaxes.Select(a => model.GetSymbolInfo(a).Symbol.GetSymbol<MethodSymbol>()).ToImmutableArray(); var expectedAttributes = new[] { "AAttribute", "BAttribute", "CAttribute", "DAttribute" }.Select(a => comp.GetTypeByMetadataName(a).InstanceConstructors.Single()).ToImmutableArray(); AssertEx.Equal(expectedAttributes, actualAttributes); } [Theory] [InlineData("Action a = [A] () => { };")] [InlineData("Func<object> f = [return: A] () => null;")] [InlineData("Action<int> a = ([A] int i) => { };")] public void LambdaAttributes_SpeculativeSemanticModel(string statement) { string source = $@"using System; class AAttribute : Attribute {{ }} class Program {{ static void Main() {{ {statement} }} }}"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var a = (IdentifierNameSyntax)tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; Assert.Equal("A", a.Identifier.Text); var attrInfo = model.GetSymbolInfo(a); var attrType = comp.GetMember<NamedTypeSymbol>("AAttribute").GetPublicSymbol(); var attrCtor = attrType.GetMember(".ctor"); Assert.Equal(attrCtor, attrInfo.Symbol); // Assert that this is also true for the speculative semantic model var newTree = SyntaxFactory.ParseSyntaxTree(source + " "); var m = newTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); Assert.True(model.TryGetSpeculativeSemanticModelForMethodBody(m.Body.SpanStart, m, out model)); a = (IdentifierNameSyntax)newTree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; Assert.Equal("A", a.Identifier.Text); // If we aren't using the right binder here, the compiler crashes going through the binder factory var info = model.GetSymbolInfo(a); // This behavior is wrong. See https://github.com/dotnet/roslyn/issues/24135 Assert.Equal(attrType, info.Symbol); } [Fact] public void LambdaAttributes_DisallowedAttributes() { var source = @"using System; using System.Runtime.CompilerServices; namespace System.Runtime.CompilerServices { public class IsReadOnlyAttribute : Attribute { } public class IsUnmanagedAttribute : Attribute { } public class IsByRefLikeAttribute : Attribute { } public class NullableContextAttribute : Attribute { public NullableContextAttribute(byte b) { } } } class Program { static void Main() { Action a = [IsReadOnly] // 1 [IsUnmanaged] // 2 [IsByRefLike] // 3 [Extension] // 4 [NullableContext(0)] // 5 () => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (15,14): error CS8335: Do not use 'System.Runtime.CompilerServices.IsReadOnlyAttribute'. This is reserved for compiler usage. // [IsReadOnly] // 1 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "IsReadOnly").WithArguments("System.Runtime.CompilerServices.IsReadOnlyAttribute").WithLocation(15, 14), // (16,14): error CS8335: Do not use 'System.Runtime.CompilerServices.IsUnmanagedAttribute'. This is reserved for compiler usage. // [IsUnmanaged] // 2 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "IsUnmanaged").WithArguments("System.Runtime.CompilerServices.IsUnmanagedAttribute").WithLocation(16, 14), // (17,14): error CS8335: Do not use 'System.Runtime.CompilerServices.IsByRefLikeAttribute'. This is reserved for compiler usage. // [IsByRefLike] // 3 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "IsByRefLike").WithArguments("System.Runtime.CompilerServices.IsByRefLikeAttribute").WithLocation(17, 14), // (18,14): error CS1112: Do not use 'System.Runtime.CompilerServices.ExtensionAttribute'. Use the 'this' keyword instead. // [Extension] // 4 Diagnostic(ErrorCode.ERR_ExplicitExtension, "Extension").WithLocation(18, 14), // (19,14): error CS8335: Do not use 'System.Runtime.CompilerServices.NullableContextAttribute'. This is reserved for compiler usage. // [NullableContext(0)] // 5 Diagnostic(ErrorCode.ERR_ExplicitReservedAttr, "NullableContext(0)").WithArguments("System.Runtime.CompilerServices.NullableContextAttribute").WithLocation(19, 14)); } [Fact] public void LambdaAttributes_DisallowedSecurityAttributes() { var source = @"using System; using System.Security; class Program { static void Main() { Action a = [SecurityCritical] // 1 [SecuritySafeCriticalAttribute] // 2 async () => { }; // 3 } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,14): error CS4030: Security attribute 'SecurityCritical' cannot be applied to an Async method. // [SecurityCritical] // 1 Diagnostic(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync, "SecurityCritical").WithArguments("SecurityCritical").WithLocation(8, 14), // (9,14): error CS4030: Security attribute 'SecuritySafeCriticalAttribute' cannot be applied to an Async method. // [SecuritySafeCriticalAttribute] // 2 Diagnostic(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync, "SecuritySafeCriticalAttribute").WithArguments("SecuritySafeCriticalAttribute").WithLocation(9, 14), // (10,22): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. // async () => { }; // 3 Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(10, 22)); } [Fact] public void LambdaAttributes_ObsoleteAttribute() { var source = @"using System; class Program { static void Report(Action a) { foreach (var attribute in a.Method.GetCustomAttributes(inherit: false)) Console.Write(attribute); } static void Main() { Report([Obsolete] () => { }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview, options: TestOptions.ReleaseExe); CompileAndVerify(comp, expectedOutput: "System.ObsoleteAttribute"); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var symbol = model.GetSymbolInfo(expr).Symbol; Assert.Equal("System.ObsoleteAttribute", symbol.GetAttributes().Single().ToString()); } [Fact] public void LambdaParameterAttributes_Conditional() { var source = @"using System; using System.Diagnostics; class Program { static void Report(Action a) { } static void Main() { Report([Conditional(""DEBUG"")] static () => { }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview, options: TestOptions.ReleaseExe); comp.VerifyDiagnostics( // (10,17): error CS0577: The Conditional attribute is not valid on 'lambda expression' because it is a constructor, destructor, operator, lambda expression, or explicit interface implementation // Report([Conditional("DEBUG")] static () => { }); Diagnostic(ErrorCode.ERR_ConditionalOnSpecialMethod, @"Conditional(""DEBUG"")").WithArguments("lambda expression").WithLocation(10, 17)); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); var lambda = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)).Single(); Assert.Equal(new[] { "DEBUG" }, lambda.GetAppliedConditionalSymbols()); } [Fact] public void LambdaAttributes_WellKnownAttributes() { var sourceA = @"using System; using System.Runtime.InteropServices; using System.Security; class Program { static void Main() { Action a1 = [DllImport(""MyModule.dll"")] static () => { }; Action a2 = [DynamicSecurityMethod] () => { }; Action a3 = [SuppressUnmanagedCodeSecurity] () => { }; Func<object> a4 = [return: MarshalAs((short)0)] () => null; } }"; var sourceB = @"namespace System.Security { internal class DynamicSecurityMethodAttribute : Attribute { } }"; var comp = CreateCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,22): error CS0601: The DllImport attribute must be specified on a method marked 'static' and 'extern' // Action a1 = [DllImport("MyModule.dll")] static () => { }; Diagnostic(ErrorCode.ERR_DllImportOnInvalidMethod, "DllImport").WithLocation(8, 22)); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(4, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Null(lambdas[0].GetDllImportData()); // [DllImport] is ignored if there are errors. Assert.True(lambdas[1].RequiresSecurityObject); Assert.True(lambdas[2].HasDeclarativeSecurity); Assert.Equal(default, lambdas[3].ReturnValueMarshallingInformation.UnmanagedType); } [Fact] public void LambdaAttributes_Permissions() { var source = @"#pragma warning disable 618 using System; using System.Security.Permissions; class Program { static void Main() { Action a1 = [PermissionSet(SecurityAction.Deny)] () => { }; } }"; var comp = CreateCompilationWithMscorlib40(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); var lambda = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)).Single(); Assert.NotEmpty(lambda.GetSecurityInformation()); } [Fact] public void LambdaAttributes_NullableAttributes_01() { var source = @"using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Func<object> a1 = [return: MaybeNull][return: NotNull] () => null; Func<object, object> a2 = [return: NotNullIfNotNull(""obj"")] (object obj) => obj; Func<bool> a4 = [MemberNotNull(""x"")][MemberNotNullWhen(false, ""y"")][MemberNotNullWhen(true, ""z"")] () => true; } }"; var comp = CreateCompilation( new[] { source, MaybeNullAttributeDefinition, NotNullAttributeDefinition, NotNullIfNotNullAttributeDefinition, MemberNotNullAttributeDefinition, MemberNotNullWhenAttributeDefinition }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(3, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Equal(FlowAnalysisAnnotations.MaybeNull | FlowAnalysisAnnotations.NotNull, lambdas[0].ReturnTypeFlowAnalysisAnnotations); Assert.Equal(new[] { "obj" }, lambdas[1].ReturnNotNullIfParameterNotNull); Assert.Equal(new[] { "x" }, lambdas[2].NotNullMembers); Assert.Equal(new[] { "y" }, lambdas[2].NotNullWhenFalseMembers); Assert.Equal(new[] { "z" }, lambdas[2].NotNullWhenTrueMembers); } [Fact] public void LambdaAttributes_NullableAttributes_02() { var source = @"#nullable enable using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Func<object> a1 = [return: MaybeNull] () => null; Func<object?> a2 = [return: NotNull] () => null; } }"; var comp = CreateCompilation(new[] { source, MaybeNullAttributeDefinition, NotNullAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Report WRN_NullReferenceReturn for a2, not for a1. comp.VerifyDiagnostics( // (8,53): warning CS8603: Possible null reference return. // Func<object> a1 = [return: MaybeNull] () => null; Diagnostic(ErrorCode.WRN_NullReferenceReturn, "null").WithLocation(8, 53)); } [Fact] public void LambdaAttributes_NullableAttributes_03() { var source = @"#nullable enable using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Action<object> a1 = ([AllowNull] x) => { x.ToString(); }; Action<object?> a2 = ([DisallowNull] x) => { x.ToString(); }; } }"; var comp = CreateCompilation(new[] { source, AllowNullAttributeDefinition, DisallowNullAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Report nullability mismatch warning assigning lambda to a2. comp.VerifyDiagnostics( // (8,50): warning CS8602: Dereference of a possibly null reference. // Action<object> a1 = ([AllowNull] x) => { x.ToString(); }; Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(8, 50)); } [WorkItem(55013, "https://github.com/dotnet/roslyn/issues/55013")] [Fact] public void NullableTypeArraySwitchPattern() { var source = @"#nullable enable class C { object? field; string Prop => field switch { string?[] a => ""a"" }; }"; var comp = CreateCompilation(source); comp.VerifyDiagnostics( // (4,13): warning CS0649: Field 'C.field' is never assigned to, and will always have its default value null // object? field; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "field").WithArguments("C.field", "null").WithLocation(4, 13), // (5,26): warning CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '_' is not covered. // string Prop => field switch Diagnostic(ErrorCode.WRN_SwitchExpressionNotExhaustive, "switch").WithArguments("_").WithLocation(5, 26)); } [Fact] public void LambdaAttributes_DoesNotReturn() { var source = @"using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Action a1 = [DoesNotReturn] () => { }; Action a2 = [DoesNotReturn] () => throw new Exception(); } }"; var comp = CreateCompilation(new[] { source, DoesNotReturnAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Report warning that lambda expression in a1 initializer returns. comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(2, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Equal(FlowAnalysisAnnotations.DoesNotReturn, lambdas[0].FlowAnalysisAnnotations); Assert.Equal(FlowAnalysisAnnotations.DoesNotReturn, lambdas[1].FlowAnalysisAnnotations); } [Fact] public void LambdaAttributes_UnmanagedCallersOnly() { var source = @"using System; using System.Runtime.InteropServices; class Program { static void Main() { Action a = [UnmanagedCallersOnly] static () => { }; } }"; var comp = CreateCompilation(new[] { source, UnmanagedCallersOnlyAttributeDefinition }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,21): error CS8896: 'UnmanagedCallersOnly' can only be applied to ordinary static non-abstract methods or static local functions. // Action a = [UnmanagedCallersOnly] static () => { }; Diagnostic(ErrorCode.ERR_UnmanagedCallersOnlyRequiresStatic, "UnmanagedCallersOnly").WithLocation(7, 21)); } [Fact] public void LambdaParameterAttributes_OptionalAndDefaultValueAttributes() { var source = @"using System; using System.Runtime.InteropServices; class Program { static void Main() { Action<int> a1 = ([Optional, DefaultParameterValue(2)] int i) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); var lambda = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)).Single(); var parameter = (SourceParameterSymbol)lambda.Parameters[0]; Assert.True(parameter.HasOptionalAttribute); Assert.False(parameter.HasExplicitDefaultValue); Assert.Equal(2, parameter.DefaultValueFromAttributes.Value); } [ConditionalFact(typeof(DesktopOnly))] public void LambdaParameterAttributes_WellKnownAttributes() { var source = @"using System; using System.Runtime.CompilerServices; class Program { static void Main() { Action<object> a1 = ([IDispatchConstant] object obj) => { }; Action<object> a2 = ([IUnknownConstant] object obj) => { }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(2, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.True(lambdas[0].Parameters[0].IsIDispatchConstant); Assert.True(lambdas[1].Parameters[0].IsIUnknownConstant); } [Fact] public void LambdaParameterAttributes_NullableAttributes_01() { var source = @"using System; using System.Diagnostics.CodeAnalysis; class Program { static void Main() { Action<object> a1 = ([AllowNull][MaybeNullWhen(false)] object obj) => { }; Action<object, object> a2 = (object x, [NotNullIfNotNull(""x"")] object y) => { }; } }"; var comp = CreateCompilation( new[] { source, AllowNullAttributeDefinition, MaybeNullWhenAttributeDefinition, NotNullIfNotNullAttributeDefinition }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); Assert.Equal(2, exprs.Length); var lambdas = exprs.SelectAsArray(e => GetLambdaSymbol(model, e)); Assert.Equal(FlowAnalysisAnnotations.AllowNull | FlowAnalysisAnnotations.MaybeNullWhenFalse, lambdas[0].Parameters[0].FlowAnalysisAnnotations); Assert.Equal(new[] { "x" }, lambdas[1].Parameters[1].NotNullIfParameterNotNull); } [Fact] public void LambdaParameterAttributes_NullableAttributes_02() { var source = @"#nullable enable using System.Diagnostics.CodeAnalysis; delegate bool D(out object? obj); class Program { static void Main() { D d = ([NotNullWhen(true)] out object? obj) => { obj = null; return true; }; } }"; var comp = CreateCompilation(new[] { source, NotNullWhenAttributeDefinition }, parseOptions: TestOptions.RegularPreview); // https://github.com/dotnet/roslyn/issues/52827: Should report WRN_ParameterConditionallyDisallowsNull. comp.VerifyDiagnostics(); var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); var lambda = GetLambdaSymbol(model, expr); Assert.Equal(FlowAnalysisAnnotations.NotNullWhenTrue, lambda.Parameters[0].FlowAnalysisAnnotations); } [Fact] public void LambdaReturnType_01() { var source = @"using System; class Program { static void F<T>() { Func<T> f1 = T () => default; Func<T, T> f2 = T (x) => { return x; }; Func<T, T> f3 = T (T x) => x; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9); comp.VerifyDiagnostics( // (6,22): error CS8773: Feature 'lambda return type' is not available in C# 9.0. Please use language version 10.0 or greater. // Func<T> f1 = T () => default; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "T").WithArguments("lambda return type", "10.0").WithLocation(6, 22), // (7,25): error CS8773: Feature 'lambda return type' is not available in C# 9.0. Please use language version 10.0 or greater. // Func<T, T> f2 = T (x) => { return x; }; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "T").WithArguments("lambda return type", "10.0").WithLocation(7, 25), // (8,25): error CS8773: Feature 'lambda return type' is not available in C# 9.0. Please use language version 10.0 or greater. // Func<T, T> f3 = T (T x) => x; Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "T").WithArguments("lambda return type", "10.0").WithLocation(8, 25)); comp = CreateCompilation(source, parseOptions: TestOptions.Regular10); comp.VerifyDiagnostics(); } [Fact] public void LambdaReturnType_02() { var source = @"using System; class Program { static void F<T, U>() { Func<T> f1; Func<U> f2; f1 = T () => default; f2 = T () => default; f1 = U () => default; f2 = U () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,14): error CS8934: Cannot convert lambda expression to type 'Func<U>' because the return type does not match the delegate return type // f2 = T () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T () => default").WithArguments("lambda expression", "System.Func<U>").WithLocation(9, 14), // (10,14): error CS8934: Cannot convert lambda expression to type 'Func<T>' because the return type does not match the delegate return type // f1 = U () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "U () => default").WithArguments("lambda expression", "System.Func<T>").WithLocation(10, 14)); } [Fact] public void LambdaReturnType_03() { var source = @"using System; class Program { static void F<T, U>() where U : T { Func<T> f1; Func<U> f2; f1 = T () => default; f2 = T () => default; f1 = U () => default; f2 = U () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,14): error CS8934: Cannot convert lambda expression to type 'Func<U>' because the return type does not match the delegate return type // f2 = T () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T () => default").WithArguments("lambda expression", "System.Func<U>").WithLocation(9, 14), // (10,14): error CS8934: Cannot convert lambda expression to type 'Func<T>' because the return type does not match the delegate return type // f1 = U () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "U () => default").WithArguments("lambda expression", "System.Func<T>").WithLocation(10, 14)); } [Fact] public void LambdaReturnType_04() { var source = @"using System; using System.Linq.Expressions; class Program { static void F<T, U>() { Expression<Func<T>> e1; Expression<Func<U>> e2; e1 = T () => default; e2 = T () => default; e1 = U () => default; e2 = U () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,14): error CS8934: Cannot convert lambda expression to type 'Expression<Func<U>>' because the return type does not match the delegate return type // e2 = T () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T () => default").WithArguments("lambda expression", "System.Linq.Expressions.Expression<System.Func<U>>").WithLocation(10, 14), // (11,14): error CS8934: Cannot convert lambda expression to type 'Expression<Func<T>>' because the return type does not match the delegate return type // e1 = U () => default; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "U () => default").WithArguments("lambda expression", "System.Linq.Expressions.Expression<System.Func<T>>").WithLocation(11, 14)); } [Fact] public void LambdaReturnType_05() { var source = @"#nullable enable using System; class Program { static void Main() { Func<dynamic> f1 = object () => default!; Func<(int, int)> f2 = (int X, int Y) () => default; Func<string?> f3 = string () => default!; Func<IntPtr> f4 = nint () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,28): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string?>' (possibly because of nullability attributes). // Func<string?> f3 = string () => default!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string () => default!").WithArguments("lambda expression", "System.Func<string?>").WithLocation(9, 28)); } [Fact] public void LambdaReturnType_06() { var source = @"#nullable enable using System; using System.Linq.Expressions; class Program { static void Main() { Expression<Func<object>> e1 = dynamic () => default!; Expression<Func<(int X, int Y)>> e2 = (int, int) () => default; Expression<Func<string>> e3 = string? () => default; Expression<Func<nint>> e4 = IntPtr () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,39): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string>' (possibly because of nullability attributes). // Expression<Func<string>> e3 = string? () => default; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string? () => default").WithArguments("lambda expression", "System.Func<string>").WithLocation(10, 39)); } [Fact] public void LambdaReturnType_07() { var source = @"#nullable enable using System; struct S<T> { } class Program { static void Main() { Delegate d1 = string? () => default; Delegate d2 = string () => default; Delegate d3 = S<object?> () => default(S<object?>); Delegate d4 = S<object?> () => default(S<object>); Delegate d5 = S<object> () => default(S<object?>); Delegate d6 = S<object> () => default(S<object>); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,36): warning CS8603: Possible null reference return. // Delegate d2 = string () => default; Diagnostic(ErrorCode.WRN_NullReferenceReturn, "default").WithLocation(9, 36), // (11,40): warning CS8619: Nullability of reference types in value of type 'S<object>' doesn't match target type 'S<object?>'. // Delegate d4 = S<object?> () => default(S<object>); Diagnostic(ErrorCode.WRN_NullabilityMismatchInAssignment, "default(S<object>)").WithArguments("S<object>", "S<object?>").WithLocation(11, 40), // (12,39): warning CS8619: Nullability of reference types in value of type 'S<object?>' doesn't match target type 'S<object>'. // Delegate d5 = S<object> () => default(S<object?>); Diagnostic(ErrorCode.WRN_NullabilityMismatchInAssignment, "default(S<object?>)").WithArguments("S<object?>", "S<object>").WithLocation(12, 39)); } [Fact] public void LambdaReturnType_08() { var source = @"#nullable enable using System; struct S<T> { } class Program { static void Main() { Func<string?> f1 = string? () => throw null!; Func<string?> f2 = string () => throw null!; Func<string> f3 = string? () => throw null!; Func<string> f4 = string () => throw null!; Func<S<object?>> f5 = S<object?> () => throw null!; Func<S<object?>> f6 = S<object> () => throw null!; Func<S<object>> f7 = S<object?> () => throw null!; Func<S<object>> f8 = S<object> () => throw null!; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (9,28): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string?>' (possibly because of nullability attributes). // Func<string?> f2 = string () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string () => throw null!").WithArguments("lambda expression", "System.Func<string?>").WithLocation(9, 28), // (10,27): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string>' (possibly because of nullability attributes). // Func<string> f3 = string? () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string? () => throw null!").WithArguments("lambda expression", "System.Func<string>").WithLocation(10, 27), // (13,31): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<S<object?>>' (possibly because of nullability attributes). // Func<S<object?>> f6 = S<object> () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "S<object> () => throw null!").WithArguments("lambda expression", "System.Func<S<object?>>").WithLocation(13, 31), // (14,30): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<S<object>>' (possibly because of nullability attributes). // Func<S<object>> f7 = S<object?> () => throw null!; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "S<object?> () => throw null!").WithArguments("lambda expression", "System.Func<S<object>>").WithLocation(14, 30)); } [Fact] public void LambdaReturnType_09() { var source = @"#nullable enable struct S<T> { } delegate ref T D1<T>(); delegate ref readonly T D2<T>(); class Program { static void Main() { D1<S<object?>> f1 = (ref S<object?> () => throw null!); D1<S<object?>> f2 = (ref S<object> () => throw null!); D1<S<object>> f3 = (ref S<object?> () => throw null!); D1<S<object>> f4 = (ref S<object> () => throw null!); D2<S<object?>> f5 = (ref readonly S<object?> () => throw null!); D2<S<object?>> f6 = (ref readonly S<object> () => throw null!); D2<S<object>> f7 = (ref readonly S<object?> () => throw null!); D2<S<object>> f8 = (ref readonly S<object> () => throw null!); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,30): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D1<S<object?>>' (possibly because of nullability attributes). // D1<S<object?>> f2 = (ref S<object> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref S<object> () => throw null!").WithArguments("lambda expression", "D1<S<object?>>").WithLocation(10, 30), // (11,29): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D1<S<object>>' (possibly because of nullability attributes). // D1<S<object>> f3 = (ref S<object?> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref S<object?> () => throw null!").WithArguments("lambda expression", "D1<S<object>>").WithLocation(11, 29), // (14,30): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D2<S<object?>>' (possibly because of nullability attributes). // D2<S<object?>> f6 = (ref readonly S<object> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref readonly S<object> () => throw null!").WithArguments("lambda expression", "D2<S<object?>>").WithLocation(14, 30), // (15,29): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'D2<S<object>>' (possibly because of nullability attributes). // D2<S<object>> f7 = (ref readonly S<object?> () => throw null!); Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "ref readonly S<object?> () => throw null!").WithArguments("lambda expression", "D2<S<object>>").WithLocation(15, 29)); } [Fact] public void LambdaReturnType_10() { var source = @"delegate T D1<T>(ref T t); delegate ref T D2<T>(ref T t); delegate ref readonly T D3<T>(ref T t); class Program { static void F<T>() { D1<T> d1; D2<T> d2; D3<T> d3; d1 = T (ref T t) => t; d2 = T (ref T t) => t; d3 = T (ref T t) => t; d1 = (ref T (ref T t) => ref t); d2 = (ref T (ref T t) => ref t); d3 = (ref T (ref T t) => ref t); d1 = (ref readonly T (ref T t) => ref t); d2 = (ref readonly T (ref T t) => ref t); d3 = (ref readonly T (ref T t) => ref t); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (12,14): error CS8934: Cannot convert lambda expression to type 'D2<T>' because the return type does not match the delegate return type // d2 = T (ref T t) => t; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T (ref T t) => t").WithArguments("lambda expression", "D2<T>").WithLocation(12, 14), // (13,14): error CS8934: Cannot convert lambda expression to type 'D3<T>' because the return type does not match the delegate return type // d3 = T (ref T t) => t; Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "T (ref T t) => t").WithArguments("lambda expression", "D3<T>").WithLocation(13, 14), // (14,15): error CS8934: Cannot convert lambda expression to type 'D1<T>' because the return type does not match the delegate return type // d1 = (ref T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref T (ref T t) => ref t").WithArguments("lambda expression", "D1<T>").WithLocation(14, 15), // (16,15): error CS8934: Cannot convert lambda expression to type 'D3<T>' because the return type does not match the delegate return type // d3 = (ref T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref T (ref T t) => ref t").WithArguments("lambda expression", "D3<T>").WithLocation(16, 15), // (17,15): error CS8934: Cannot convert lambda expression to type 'D1<T>' because the return type does not match the delegate return type // d1 = (ref readonly T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref readonly T (ref T t) => ref t").WithArguments("lambda expression", "D1<T>").WithLocation(17, 15), // (18,15): error CS8934: Cannot convert lambda expression to type 'D2<T>' because the return type does not match the delegate return type // d2 = (ref readonly T (ref T t) => ref t); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "ref readonly T (ref T t) => ref t").WithArguments("lambda expression", "D2<T>").WithLocation(18, 15)); } [Fact] public void LambdaReturnType_11() { var source = @"using System; class Program { static void Main() { Delegate d; d = (ref void () => { }); d = (ref readonly void () => { }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,14): error CS8917: The delegate type could not be inferred. // d = (ref void () => { }); Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "ref void () => { }").WithLocation(7, 14), // (7,18): error CS1547: Keyword 'void' cannot be used in this context // d = (ref void () => { }); Diagnostic(ErrorCode.ERR_NoVoidHere, "void").WithLocation(7, 18), // (8,14): error CS8917: The delegate type could not be inferred. // d = (ref readonly void () => { }); Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "ref readonly void () => { }").WithLocation(8, 14), // (8,27): error CS1547: Keyword 'void' cannot be used in this context // d = (ref readonly void () => { }); Diagnostic(ErrorCode.ERR_NoVoidHere, "void").WithLocation(8, 27)); } [WorkItem(55217, "https://github.com/dotnet/roslyn/issues/55217")] [ConditionalFact(typeof(DesktopOnly))] public void LambdaReturnType_12() { var source = @"using System; class Program { static void Main() { Delegate d; d = TypedReference () => throw null; d = RuntimeArgumentHandle () => throw null; d = ArgIterator () => throw null; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,13): error CS1599: The return type of a method, delegate, or function pointer cannot be 'TypedReference' // d = TypedReference () => throw null; Diagnostic(ErrorCode.ERR_MethodReturnCantBeRefAny, "TypedReference").WithArguments("System.TypedReference").WithLocation(7, 13), // (7,13): error CS8917: The delegate type could not be inferred. // d = TypedReference () => throw null; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "TypedReference () => throw null").WithLocation(7, 13), // (8,13): error CS1599: The return type of a method, delegate, or function pointer cannot be 'RuntimeArgumentHandle' // d = RuntimeArgumentHandle () => throw null; Diagnostic(ErrorCode.ERR_MethodReturnCantBeRefAny, "RuntimeArgumentHandle").WithArguments("System.RuntimeArgumentHandle").WithLocation(8, 13), // (8,13): error CS8917: The delegate type could not be inferred. // d = RuntimeArgumentHandle () => throw null; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "RuntimeArgumentHandle () => throw null").WithLocation(8, 13), // (9,13): error CS1599: The return type of a method, delegate, or function pointer cannot be 'ArgIterator' // d = ArgIterator () => throw null; Diagnostic(ErrorCode.ERR_MethodReturnCantBeRefAny, "ArgIterator").WithArguments("System.ArgIterator").WithLocation(9, 13), // (9,13): error CS8917: The delegate type could not be inferred. // d = ArgIterator () => throw null; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "ArgIterator () => throw null").WithLocation(9, 13)); } [Fact] public void LambdaReturnType_13() { var source = @"static class S { } delegate S D(); class Program { static void Main() { D d = S () => default; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,15): error CS0722: 'S': static types cannot be used as return types // D d = S () => default; Diagnostic(ErrorCode.ERR_ReturnTypeIsStaticClass, "S").WithArguments("S").WithLocation(7, 15)); } [Fact] public void LambdaReturnType_14() { var source = @"using System; class Program { static void Main() { Delegate d = async int () => 0; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (6,35): error CS1983: The return type of an async method must be void, Task, Task<T>, a task-like type, IAsyncEnumerable<T>, or IAsyncEnumerator<T> // Delegate d = async int () => 0; Diagnostic(ErrorCode.ERR_BadAsyncReturn, "=>").WithLocation(6, 35), // (6,35): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. // Delegate d = async int () => 0; Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(6, 35)); } [Fact] public void LambdaReturnType_15() { var source = @"using System; using System.Threading.Tasks; delegate ref Task D(string s); class Program { static void Main() { Delegate d1 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; D d2 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,23): error CS8917: The delegate type could not be inferred. // Delegate d1 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "async ref Task (s) => { _ = s.Length; await Task.Yield(); }").WithLocation(8, 23), // (8,29): error CS1073: Unexpected token 'ref' // Delegate d1 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(8, 29), // (9,22): error CS1073: Unexpected token 'ref' // D d2 = async ref Task (s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(9, 22)); } [Fact] public void LambdaReturnType_16() { var source = @"using System; using System.Threading.Tasks; delegate ref Task D(string s); class Program { static void Main() { Delegate d1 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; D d2 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,29): error CS1073: Unexpected token 'ref' // Delegate d1 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(8, 29), // (9,22): error CS1073: Unexpected token 'ref' // D d2 = async ref Task (string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_UnexpectedToken, "ref").WithArguments("ref").WithLocation(9, 22)); } [Fact] public void LambdaReturnType_17() { var source = @"#nullable enable using System; class Program { static void F(string? x, string y) { Func<string?> f1 = string () => { if (x is null) return x; return y; }; Func<string> f2 = string? () => { if (x is not null) return x; return y; }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,28): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string?>' (possibly because of nullability attributes). // Func<string?> f1 = string () => { if (x is null) return x; return y; }; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string () => { if (x is null) return x; return y; }").WithArguments("lambda expression", "System.Func<string?>").WithLocation(7, 28), // (7,65): warning CS8603: Possible null reference return. // Func<string?> f1 = string () => { if (x is null) return x; return y; }; Diagnostic(ErrorCode.WRN_NullReferenceReturn, "x").WithLocation(7, 65), // (8,27): warning CS8621: Nullability of reference types in return type of 'lambda expression' doesn't match the target delegate 'Func<string>' (possibly because of nullability attributes). // Func<string> f2 = string? () => { if (x is not null) return x; return y; }; Diagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, "string? () => { if (x is not null) return x; return y; }").WithArguments("lambda expression", "System.Func<string>").WithLocation(8, 27)); } [Fact] public void LambdaReturnType_CustomModifiers_01() { var sourceA = @".class public auto ansi sealed D extends [mscorlib]System.MulticastDelegate { .method public hidebysig specialname rtspecialname instance void .ctor (object 'object', native int 'method') runtime managed { } .method public hidebysig newslot virtual instance int32 modopt([mscorlib]System.Int16) Invoke () runtime managed { } .method public hidebysig newslot virtual instance class [mscorlib]System.IAsyncResult BeginInvoke (class [mscorlib]System.AsyncCallback callback, object 'object') runtime managed { } .method public hidebysig newslot virtual instance int32 modopt([mscorlib]System.Int16) EndInvoke (class [mscorlib]System.IAsyncResult result) runtime managed { } }"; var refA = CompileIL(sourceA); var sourceB = @"class Program { static void F(D d) { System.Console.WriteLine(d()); } static void Main() { F(() => 1); F(int () => 2); } }"; CompileAndVerify(sourceB, references: new[] { refA }, parseOptions: TestOptions.RegularPreview, expectedOutput: @"1 2"); } [Fact] public void LambdaReturnType_CustomModifiers_02() { var sourceA = @".class public auto ansi sealed D extends [mscorlib]System.MulticastDelegate { .method public hidebysig specialname rtspecialname instance void .ctor (object 'object', native int 'method') runtime managed { } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Int16) Invoke () runtime managed { } .method public hidebysig newslot virtual instance class [mscorlib]System.IAsyncResult BeginInvoke (class [mscorlib]System.AsyncCallback callback, object 'object') runtime managed { } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Int16) EndInvoke (class [mscorlib]System.IAsyncResult result) runtime managed { } }"; var refA = CompileIL(sourceA); var sourceB = @"class Program { static void F(D d) { System.Console.WriteLine(d()); } static void Main() { F(() => 1); F(int () => 2); } }"; var comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (5,34): error CS0570: 'D.Invoke()' is not supported by the language // System.Console.WriteLine(d()); Diagnostic(ErrorCode.ERR_BindToBogus, "d()").WithArguments("D.Invoke()").WithLocation(5, 34), // (9,11): error CS0570: 'D.Invoke()' is not supported by the language // F(() => 1); Diagnostic(ErrorCode.ERR_BindToBogus, "() => 1").WithArguments("D.Invoke()").WithLocation(9, 11), // (10,11): error CS0570: 'D.Invoke()' is not supported by the language // F(int () => 2); Diagnostic(ErrorCode.ERR_BindToBogus, "int () => 2").WithArguments("D.Invoke()").WithLocation(10, 11)); } [Fact] public void LambdaReturnType_UseSiteErrors() { var sourceA = @".class public sealed A extends [mscorlib]System.Object { .custom instance void [mscorlib]System.Runtime.CompilerServices.RequiredAttributeAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 FF 00 00 ) .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ret } }"; var refA = CompileIL(sourceA); var sourceB = @"using System; class B { static void F<T>(Func<T> f) { } static void Main() { F(A () => default); } }"; var comp = CreateCompilation(sourceB, references: new[] { refA }, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (7,11): error CS0648: 'A' is a type not supported by the language // F(A () => default); Diagnostic(ErrorCode.ERR_BogusType, "A").WithArguments("A").WithLocation(7, 11)); } [Fact] public void AsyncLambdaParameters_01() { var source = @"using System; using System.Threading.Tasks; delegate Task D(ref string s); class Program { static void Main() { Delegate d1 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; D d2 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (8,41): error CS1988: Async methods cannot have ref, in or out parameters // Delegate d1 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadAsyncArgType, "s").WithLocation(8, 41), // (9,34): error CS1988: Async methods cannot have ref, in or out parameters // D d2 = async (ref string s) => { _ = s.Length; await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadAsyncArgType, "s").WithLocation(9, 34)); } [ConditionalFact(typeof(DesktopOnly))] public void AsyncLambdaParameters_02() { var source = @"using System; using System.Threading.Tasks; delegate void D1(TypedReference r); delegate void D2(RuntimeArgumentHandle h); delegate void D3(ArgIterator i); class Program { static void Main() { D1 d1 = async (TypedReference r) => { await Task.Yield(); }; D2 d2 = async (RuntimeArgumentHandle h) => { await Task.Yield(); }; D3 d3 = async (ArgIterator i) => { await Task.Yield(); }; } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,39): error CS4012: Parameters or locals of type 'TypedReference' cannot be declared in async methods or async lambda expressions. // D1 d1 = async (TypedReference r) => { await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadSpecialByRefLocal, "r").WithArguments("System.TypedReference").WithLocation(10, 39), // (11,46): error CS4012: Parameters or locals of type 'RuntimeArgumentHandle' cannot be declared in async methods or async lambda expressions. // D2 d2 = async (RuntimeArgumentHandle h) => { await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadSpecialByRefLocal, "h").WithArguments("System.RuntimeArgumentHandle").WithLocation(11, 46), // (12,36): error CS4012: Parameters or locals of type 'ArgIterator' cannot be declared in async methods or async lambda expressions. // D3 d3 = async (ArgIterator i) => { await Task.Yield(); }; Diagnostic(ErrorCode.ERR_BadSpecialByRefLocal, "i").WithArguments("System.ArgIterator").WithLocation(12, 36)); } [Fact] public void BestType_01() { var source = @"using System; class A { } class B1 : A { } class B2 : A { } interface I { } class C1 : I { } class C2 : I { } class Program { static void F<T>(Func<bool, T> f) { } static void Main() { F((bool b) => { if (b) return new B1(); return new B2(); }); F((bool b) => { if (b) return new C1(); return new C2(); }); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (13,9): error CS0411: The type arguments for method 'Program.F<T>(Func<bool, T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F((bool b) => { if (b) return new B1(); return new B2(); }); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<bool, T>)").WithLocation(13, 9), // (14,9): error CS0411: The type arguments for method 'Program.F<T>(Func<bool, T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F((bool b) => { if (b) return new C1(); return new C2(); }); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<bool, T>)").WithLocation(14, 9)); } // As above but with explicit return type. [Fact] public void BestType_02() { var source = @"using System; class A { } class B1 : A { } class B2 : A { } interface I { } class C1 : I { } class C2 : I { } class Program { static void F<T>(Func<bool, T> f) { Console.WriteLine(typeof(T)); } static void Main() { F(A (bool b) => { if (b) return new B1(); return new B2(); }); F(I (bool b) => { if (b) return new C1(); return new C2(); }); } }"; CompileAndVerify(source, parseOptions: TestOptions.RegularPreview, expectedOutput: @"A I"); } [Fact] public void BestType_03() { var source = @"using System; class A { } class B1 : A { } class B2 : A { } class Program { static void F<T>(Func<T> x, Func<T> y) { } static void Main() { F(B2 () => null, B2 () => null); F(A () => null, B2 () => null); F(B1 () => null, B2 () => null); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (11,25): error CS8934: Cannot convert lambda expression to type 'Func<A>' because the return type does not match the delegate return type // F(A () => null, B2 () => null); Diagnostic(ErrorCode.ERR_CantConvAnonMethReturnType, "B2 () => null").WithArguments("lambda expression", "System.Func<A>").WithLocation(11, 25), // (12,9): error CS0411: The type arguments for method 'Program.F<T>(Func<T>, Func<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F(B1 () => null, B2 () => null); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<T>, System.Func<T>)").WithLocation(12, 9)); } [Fact] public void TypeInference_01() { var source = @"using System; class Program { static void F<T>(Func<object, T> f) { Console.WriteLine(typeof(T)); } static void Main() { F(long (o) => 1); } }"; CompileAndVerify(source, parseOptions: TestOptions.RegularPreview, expectedOutput: @"System.Int64"); } // Should method type inference make an explicit type inference // from the lambda expression return type? [Fact] public void TypeInference_02() { var source = @"using System; class Program { static void F<T>(Func<T, T> f) { Console.WriteLine(typeof(T)); } static void Main() { F(int (i) => i); } }"; var comp = CreateCompilation(source, parseOptions: TestOptions.RegularPreview); comp.VerifyDiagnostics( // (10,9): error CS0411: The type arguments for method 'Program.F<T>(Func<T, T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. // F(int (i) => i); Diagnostic(ErrorCode.ERR_CantInferMethTypeArgs, "F").WithArguments("Program.F<T>(System.Func<T, T>)").WithLocation(10, 9)); } // CS4031 is not reported for async lambda in [SecurityCritical] type. [Fact] [WorkItem(54074, "https://github.com/dotnet/roslyn/issues/54074")] public void SecurityCritical_AsyncLambda() { var source = @"using System; using System.Security; using System.Threading.Tasks; [SecurityCritical] class Program { static void Main() { Func<Task> f = async () => await Task.Yield(); } }"; var comp = CreateCompilation(source); comp.VerifyDiagnostics(); } // CS4031 is not reported for async lambda in [SecurityCritical] type. [Fact] [WorkItem(54074, "https://github.com/dotnet/roslyn/issues/54074")] public void SecurityCritical_AsyncLambda_AttributeArgument() { var source = @"using System; using System.Security; using System.Threading.Tasks; class A : Attribute { internal A(int i) { } } [SecurityCritical] [A(F(async () => await Task.Yield()))] class Program { internal static int F(Func<Task> f) => 0; }"; var comp = CreateCompilation(source); comp.VerifyDiagnostics( // (9,4): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type // [A(F(async () => await Task.Yield()))] Diagnostic(ErrorCode.ERR_BadAttributeArgument, "F(async () => await Task.Yield())").WithLocation(9, 4)); } private static LambdaSymbol GetLambdaSymbol(SemanticModel model, LambdaExpressionSyntax syntax) { return model.GetSymbolInfo(syntax).Symbol.GetSymbol<LambdaSymbol>(); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Portable/Symbols/AliasSymbol.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Generic Imports System.Collections.Immutable Imports System.Diagnostics Imports System.Linq Imports System.Threading Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' <summary> ''' Symbol representing a using alias appearing in a compilation unit. ''' Generally speaking, these symbols do not appear in the set of symbols reachable ''' from the unnamed namespace declaration. In other words, when a using alias is used in a ''' program, it acts as a transparent alias, and the symbol to which it is an alias is used in ''' the symbol table. For example, in the source code ''' <pre> ''' Imports o = System.Object ''' Namespace NS ''' partial class C : Inherits o : End Class ''' partial class C : Inherits Object : End Class ''' partial class C : Inherits System.Object : End Class ''' End Namespace ''' ''' </pre> ''' all three declarations for class C are equivalent and result in the same symbol table object for C. ''' However, these alias symbols do appear in the results of certain SemanticModel APIs. ''' Specifically, for the base clause of the first of C's class declarations, the ''' following APIs may produce a result that contains an AliasSymbol: ''' <pre> ''' SemanticInfo SemanticModel.GetSemanticInfo(ExpressionSyntax expression); ''' SemanticInfo SemanticModel.BindExpression(SyntaxNode location, ExpressionSyntax expression); ''' SemanticInfo SemanticModel.BindType(SyntaxNode location, ExpressionSyntax type); ''' SemanticInfo SemanticModel.BindNamespaceOrType(SyntaxNode location, ExpressionSyntax type); ''' </pre> ''' Also, the following are affected if container=Nothing (and, for the latter, when container=Nothing or arity=0): ''' <pre> ''' Public Function LookupNames(position As Integer, Optional container As NamespaceOrTypeSymbol = Nothing, Optional options As LookupOptions = LookupOptions.Default, Optional results As List(Of String) = Nothing) As IList(Of String) ''' Public Function LookupSymbols(position As Integer, ''' Optional container As NamespaceOrTypeSymbol = Nothing, ''' Optional name As String = Nothing, ''' Optional arity As Integer? = Nothing, ''' Optional options As LookupOptions = LookupOptions.Default, ''' Optional results As List(Of Symbol) = Nothing) As IList(Of Symbol) ''' </pre> ''' </summary> Friend NotInheritable Class AliasSymbol Inherits Symbol Implements IAliasSymbol Private ReadOnly _aliasTarget As NamespaceOrTypeSymbol Private ReadOnly _aliasName As String Private ReadOnly _aliasLocations As ImmutableArray(Of Location) Private ReadOnly _aliasContainer As Symbol Friend Sub New(compilation As VisualBasicCompilation, aliasContainer As Symbol, aliasName As String, aliasTarget As NamespaceOrTypeSymbol, aliasLocation As Location) Dim merged = TryCast(aliasContainer, MergedNamespaceSymbol) Dim sourceNs As NamespaceSymbol = Nothing If merged IsNot Nothing Then sourceNs = merged.GetConstituentForCompilation(compilation) End If Me._aliasContainer = If(sourceNs, aliasContainer) Me._aliasTarget = aliasTarget Me._aliasName = aliasName Me._aliasLocations = ImmutableArray.Create(aliasLocation) End Sub ''' <summary> ''' The alias name. ''' </summary> Public Overrides ReadOnly Property Name As String Get Return _aliasName End Get End Property ''' <summary> ''' Gets the kind of this symbol. ''' </summary> ''' <returns><see cref="SymbolKind.Alias"/></returns> Public Overrides ReadOnly Property Kind As SymbolKind Get Return SymbolKind.Alias End Get End Property ''' <summary> ''' Gets the <see cref="NamespaceOrTypeSymbol"/> for the ''' namespace or type referenced by the alias. ''' </summary> Public ReadOnly Property Target As NamespaceOrTypeSymbol Get Return Me._aliasTarget End Get End Property Private ReadOnly Property IAliasSymbol_Target As INamespaceOrTypeSymbol Implements IAliasSymbol.Target Get Return Target End Get End Property ''' <summary> ''' Gets the locations where this symbol was originally defined. ''' </summary> Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location) Get Return _aliasLocations End Get End Property ''' <summary> ''' Get the syntax node(s) where this symbol was declared in source. ''' </summary> ''' <returns> ''' The syntax node(s) that declared the symbol. ''' </returns> ''' <remarks> ''' To go the opposite direction (from syntax node to symbol), see <see cref="VBSemanticModel.GetDeclaredSymbol"/>. ''' </remarks> Public Overrides ReadOnly Property DeclaringSyntaxReferences As ImmutableArray(Of SyntaxReference) Get Return GetDeclaringSyntaxReferenceHelper(Of SimpleImportsClauseSyntax)(Locations) End Get End Property ''' <summary> ''' Returns true if this symbol was declared to override a base class members and was ''' also restricted from further overriding; i.e., declared with the "NotOverridable" ''' modifier. Never returns true for types. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsNotOverridable As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this symbol was declared as requiring an override; i.e., declared ''' with the "MustOverride" modifier. Never returns true for types. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsMustOverride As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this symbol was declared to override a base class members; i.e., declared ''' with the "Overrides" modifier. Still returns true if the members was declared ''' to override something, but (erroneously) no member to override exists. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsOverrides As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this member is overridable, has an implementation, ''' and does not override a base class member; i.e., declared with the "Overridable" ''' modifier. Does not return true for members declared as MustOverride or Overrides. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsOverridable As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this symbol is "shared"; i.e., declared with the "Shared" ''' modifier or implicitly always shared. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsShared As Boolean Get Return False End Get End Property ''' <summary> ''' Get this accessibility that was declared on this symbol. For symbols that do ''' not have accessibility declared on them, returns NotApplicable. ''' </summary> ''' <returns><see cref="Accessibility.NotApplicable"/></returns> Public Overrides ReadOnly Property DeclaredAccessibility As Accessibility Get Return Accessibility.NotApplicable End Get End Property Friend Overrides ReadOnly Property ObsoleteAttributeData As ObsoleteAttributeData Get Return Nothing End Get End Property ''' <summary> ''' Get the symbol that logically contains this symbol. ''' </summary> ''' <returns> ''' Using aliases in VB are always at the top ''' level within a compilation unit, within the [Global] namespace declaration. We ''' return that as the "containing" symbol, even though the alias isn't a member of the ''' namespace as such. ''' </returns> Public Overrides ReadOnly Property ContainingSymbol As Symbol Get Return _aliasContainer End Get End Property ''' <summary> ''' Determines whether the specified object is equal to the current object. ''' </summary> ''' <param name="obj"> ''' The object to compare with the current object. ''' </param> Public Overrides Function Equals(obj As Object) As Boolean If obj Is Me Then Return True ElseIf obj Is Nothing Then Return False End If Dim other As AliasSymbol = TryCast(obj, AliasSymbol) Return other IsNot Nothing AndAlso Equals(Me.Locations.FirstOrDefault(), other.Locations.FirstOrDefault()) AndAlso Me.ContainingAssembly Is other.ContainingAssembly End Function ''' <summary> ''' Returns a hash code for the current object. ''' </summary> Public Overrides Function GetHashCode() As Integer Return If(Me.Locations.Length > 0, Me.Locations(0).GetHashCode(), Me.Name.GetHashCode()) End Function Friend Overrides Function Accept(Of TArg, TResult)(visitor As VisualBasicSymbolVisitor(Of TArg, TResult), a As TArg) As TResult Return visitor.VisitAlias(Me, a) End Function Public Overrides Sub Accept(visitor As SymbolVisitor) visitor.VisitAlias(Me) End Sub Public Overrides Function Accept(Of TResult)(visitor As SymbolVisitor(Of TResult)) As TResult Return visitor.VisitAlias(Me) End Function Public Overrides Sub Accept(visitor As VisualBasicSymbolVisitor) visitor.VisitAlias(Me) End Sub Public Overrides Function Accept(Of TResult)(visitor As VisualBasicSymbolVisitor(Of TResult)) As TResult Return visitor.VisitAlias(Me) End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Generic Imports System.Collections.Immutable Imports System.Diagnostics Imports System.Linq Imports System.Threading Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' <summary> ''' Symbol representing a using alias appearing in a compilation unit. ''' Generally speaking, these symbols do not appear in the set of symbols reachable ''' from the unnamed namespace declaration. In other words, when a using alias is used in a ''' program, it acts as a transparent alias, and the symbol to which it is an alias is used in ''' the symbol table. For example, in the source code ''' <pre> ''' Imports o = System.Object ''' Namespace NS ''' partial class C : Inherits o : End Class ''' partial class C : Inherits Object : End Class ''' partial class C : Inherits System.Object : End Class ''' End Namespace ''' ''' </pre> ''' all three declarations for class C are equivalent and result in the same symbol table object for C. ''' However, these alias symbols do appear in the results of certain SemanticModel APIs. ''' Specifically, for the base clause of the first of C's class declarations, the ''' following APIs may produce a result that contains an AliasSymbol: ''' <pre> ''' SemanticInfo SemanticModel.GetSemanticInfo(ExpressionSyntax expression); ''' SemanticInfo SemanticModel.BindExpression(SyntaxNode location, ExpressionSyntax expression); ''' SemanticInfo SemanticModel.BindType(SyntaxNode location, ExpressionSyntax type); ''' SemanticInfo SemanticModel.BindNamespaceOrType(SyntaxNode location, ExpressionSyntax type); ''' </pre> ''' Also, the following are affected if container=Nothing (and, for the latter, when container=Nothing or arity=0): ''' <pre> ''' Public Function LookupNames(position As Integer, Optional container As NamespaceOrTypeSymbol = Nothing, Optional options As LookupOptions = LookupOptions.Default, Optional results As List(Of String) = Nothing) As IList(Of String) ''' Public Function LookupSymbols(position As Integer, ''' Optional container As NamespaceOrTypeSymbol = Nothing, ''' Optional name As String = Nothing, ''' Optional arity As Integer? = Nothing, ''' Optional options As LookupOptions = LookupOptions.Default, ''' Optional results As List(Of Symbol) = Nothing) As IList(Of Symbol) ''' </pre> ''' </summary> Friend NotInheritable Class AliasSymbol Inherits Symbol Implements IAliasSymbol Private ReadOnly _aliasTarget As NamespaceOrTypeSymbol Private ReadOnly _aliasName As String Private ReadOnly _aliasLocations As ImmutableArray(Of Location) Private ReadOnly _aliasContainer As Symbol Friend Sub New(compilation As VisualBasicCompilation, aliasContainer As Symbol, aliasName As String, aliasTarget As NamespaceOrTypeSymbol, aliasLocation As Location) Dim merged = TryCast(aliasContainer, MergedNamespaceSymbol) Dim sourceNs As NamespaceSymbol = Nothing If merged IsNot Nothing Then sourceNs = merged.GetConstituentForCompilation(compilation) End If Me._aliasContainer = If(sourceNs, aliasContainer) Me._aliasTarget = aliasTarget Me._aliasName = aliasName Me._aliasLocations = ImmutableArray.Create(aliasLocation) End Sub ''' <summary> ''' The alias name. ''' </summary> Public Overrides ReadOnly Property Name As String Get Return _aliasName End Get End Property ''' <summary> ''' Gets the kind of this symbol. ''' </summary> ''' <returns><see cref="SymbolKind.Alias"/></returns> Public Overrides ReadOnly Property Kind As SymbolKind Get Return SymbolKind.Alias End Get End Property ''' <summary> ''' Gets the <see cref="NamespaceOrTypeSymbol"/> for the ''' namespace or type referenced by the alias. ''' </summary> Public ReadOnly Property Target As NamespaceOrTypeSymbol Get Return Me._aliasTarget End Get End Property Private ReadOnly Property IAliasSymbol_Target As INamespaceOrTypeSymbol Implements IAliasSymbol.Target Get Return Target End Get End Property ''' <summary> ''' Gets the locations where this symbol was originally defined. ''' </summary> Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location) Get Return _aliasLocations End Get End Property ''' <summary> ''' Get the syntax node(s) where this symbol was declared in source. ''' </summary> ''' <returns> ''' The syntax node(s) that declared the symbol. ''' </returns> ''' <remarks> ''' To go the opposite direction (from syntax node to symbol), see <see cref="VBSemanticModel.GetDeclaredSymbol"/>. ''' </remarks> Public Overrides ReadOnly Property DeclaringSyntaxReferences As ImmutableArray(Of SyntaxReference) Get Return GetDeclaringSyntaxReferenceHelper(Of SimpleImportsClauseSyntax)(Locations) End Get End Property ''' <summary> ''' Returns true if this symbol was declared to override a base class members and was ''' also restricted from further overriding; i.e., declared with the "NotOverridable" ''' modifier. Never returns true for types. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsNotOverridable As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this symbol was declared as requiring an override; i.e., declared ''' with the "MustOverride" modifier. Never returns true for types. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsMustOverride As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this symbol was declared to override a base class members; i.e., declared ''' with the "Overrides" modifier. Still returns true if the members was declared ''' to override something, but (erroneously) no member to override exists. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsOverrides As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this member is overridable, has an implementation, ''' and does not override a base class member; i.e., declared with the "Overridable" ''' modifier. Does not return true for members declared as MustOverride or Overrides. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsOverridable As Boolean Get Return False End Get End Property ''' <summary> ''' Returns true if this symbol is "shared"; i.e., declared with the "Shared" ''' modifier or implicitly always shared. ''' </summary> ''' <returns>False</returns> Public Overrides ReadOnly Property IsShared As Boolean Get Return False End Get End Property ''' <summary> ''' Get this accessibility that was declared on this symbol. For symbols that do ''' not have accessibility declared on them, returns NotApplicable. ''' </summary> ''' <returns><see cref="Accessibility.NotApplicable"/></returns> Public Overrides ReadOnly Property DeclaredAccessibility As Accessibility Get Return Accessibility.NotApplicable End Get End Property Friend Overrides ReadOnly Property ObsoleteAttributeData As ObsoleteAttributeData Get Return Nothing End Get End Property ''' <summary> ''' Get the symbol that logically contains this symbol. ''' </summary> ''' <returns> ''' Using aliases in VB are always at the top ''' level within a compilation unit, within the [Global] namespace declaration. We ''' return that as the "containing" symbol, even though the alias isn't a member of the ''' namespace as such. ''' </returns> Public Overrides ReadOnly Property ContainingSymbol As Symbol Get Return _aliasContainer End Get End Property ''' <summary> ''' Determines whether the specified object is equal to the current object. ''' </summary> ''' <param name="obj"> ''' The object to compare with the current object. ''' </param> Public Overrides Function Equals(obj As Object) As Boolean If obj Is Me Then Return True ElseIf obj Is Nothing Then Return False End If Dim other As AliasSymbol = TryCast(obj, AliasSymbol) Return other IsNot Nothing AndAlso Equals(Me.Locations.FirstOrDefault(), other.Locations.FirstOrDefault()) AndAlso Me.ContainingAssembly Is other.ContainingAssembly End Function ''' <summary> ''' Returns a hash code for the current object. ''' </summary> Public Overrides Function GetHashCode() As Integer Return If(Me.Locations.Length > 0, Me.Locations(0).GetHashCode(), Me.Name.GetHashCode()) End Function Friend Overrides Function Accept(Of TArg, TResult)(visitor As VisualBasicSymbolVisitor(Of TArg, TResult), a As TArg) As TResult Return visitor.VisitAlias(Me, a) End Function Public Overrides Sub Accept(visitor As SymbolVisitor) visitor.VisitAlias(Me) End Sub Public Overrides Function Accept(Of TResult)(visitor As SymbolVisitor(Of TResult)) As TResult Return visitor.VisitAlias(Me) End Function Public Overrides Sub Accept(visitor As VisualBasicSymbolVisitor) visitor.VisitAlias(Me) End Sub Public Overrides Function Accept(Of TResult)(visitor As VisualBasicSymbolVisitor(Of TResult)) As TResult Return visitor.VisitAlias(Me) End Function End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Completion Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.VisualBasic.Completion.Providers Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.CompletionProviders <UseExportProvider> Public Class TypeImportCompletionProviderTests Inherits AbstractVisualBasicCompletionProviderTests Private Property ShowImportCompletionItemsOptionValue As Boolean = True Private Property IsExpandedCompletion As Boolean = True Private Property UsePartialSemantic As Boolean = False Protected Overrides Function WithChangedOptions(options As OptionSet) As OptionSet Return options _ .WithChangedOption(CompletionOptions.ShowItemsFromUnimportedNamespaces, LanguageNames.VisualBasic, ShowImportCompletionItemsOptionValue) _ .WithChangedOption(CompletionServiceOptions.IsExpandedCompletion, IsExpandedCompletion) _ .WithChangedOption(CompletionServiceOptions.UsePartialSemanticForImportCompletion, UsePartialSemantic) End Function Protected Overrides Function GetComposition() As TestComposition Return MyBase.GetComposition().AddParts(GetType(TestExperimentationService)) End Function Friend Overrides Function GetCompletionProviderType() As Type Return GetType(TypeImportCompletionProvider) End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function AttributeTypeInAttributeNameContext() As Task Dim file1 = <Text> Namespace Foo Public Class MyAttribute Inherits System.Attribute End Class Public Class MyVBClass End Class Public Class MyAttributeWithoutSuffix Inherits System.Attribute End Class End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar <$$ Sub Main() End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "My", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyAttribute", isComplexTextEdit:=True) Await VerifyItemIsAbsentAsync(markup, "MyAttributeWithoutSuffix", inlineDescription:="Foo") ' We intentionally ignore attribute types without proper suffix for perf reason Await VerifyItemIsAbsentAsync(markup, "MyAttribute", inlineDescription:="Foo") Await VerifyItemIsAbsentAsync(markup, "MyVBClass", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function AttributeTypeInNonAttributeNameContext() As Task Dim file1 = <Text> Namespace Foo Public Class MyAttribute Inherits System.Attribute End Class Public Class MyVBClass End Class Public Class MyAttributeWithoutSuffix Inherits System.Attribute End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar Sub Main() Dim x As $$ End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "MyAttribute", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyAttribute", isComplexTextEdit:=True) Await VerifyItemExistsAsync(markup, "MyAttributeWithoutSuffix", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyAttributeWithoutSuffix", isComplexTextEdit:=True) Await VerifyItemExistsAsync(markup, "MyVBClass", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyVBClass", isComplexTextEdit:=True) Await VerifyItemIsAbsentAsync(markup, "My", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function AttributeTypeInAttributeNameContext2() As Task ' attribute suffix isn't capitalized Dim file1 = <Text> Namespace Foo Public Class Myattribute Inherits System.Attribute End Class End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar <$$ Sub Main() End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "My", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.Myattribute") Await VerifyItemIsAbsentAsync(markup, "Myattribute", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function CSharpAttributeTypeWithoutSuffixInAttributeNameContext() As Task ' attribute suffix isn't capitalized Dim file1 = <Text> namespace Foo { public class Myattribute : System.Attribute { } }</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar <$$ Sub Main() End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForProjectWithProjectReference(file2, file1, LanguageNames.VisualBasic, LanguageNames.CSharp) Await VerifyItemExistsAsync(markup, "My", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.Myattribute", isComplexTextEdit:=True) Await VerifyItemIsAbsentAsync(markup, "Myattribute", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35124, "https://github.com/dotnet/roslyn/issues/35124")> Public Async Function GenericTypeShouldDisplayProperVBSyntax() As Task Dim file1 = <Text> Namespace Foo Public Class MyGenericClass(Of T) End Class End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar Sub Main() Dim x As $$ End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "MyGenericClass", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", displayTextSuffix:="(Of ...)", expectedDescriptionOrNull:="Class Foo.MyGenericClass(Of T)", isComplexTextEdit:=True) End Function <InlineData(SourceCodeKind.Regular)> <InlineData(SourceCodeKind.Script)> <WpfTheory, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(37038, "https://github.com/dotnet/roslyn/issues/37038")> Public Async Function CommitTypeInImportAliasContextShouldUseFullyQualifiedName(kind As SourceCodeKind) As Task Dim file1 = <Text> Namespace Foo Public Class Bar End Class End Namespace</Text>.Value Dim file2 = "Imports BarAlias = $$" Dim expectedCodeAfterCommit = "Imports BarAlias = Foo.Bar$$" Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyCustomCommitProviderAsync(markup, "Bar", expectedCodeAfterCommit, sourceCodeKind:=kind) End Function <InlineData(SourceCodeKind.Regular)> <InlineData(SourceCodeKind.Script)> <WpfTheory, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(37038, "https://github.com/dotnet/roslyn/issues/37038")> Public Async Function CommitGenericTypeParameterInImportAliasContextShouldUseFullyQualifiedName(kind As SourceCodeKind) As Task Dim file1 = <Text> Namespace Foo Public Class Bar End Class End Namespace</Text>.Value Dim file2 = "Imports BarAlias = System.Collections.Generic.List(Of $$)" Dim expectedCodeAfterCommit = "Imports BarAlias = System.Collections.Generic.List(Of Foo.Bar$$)" Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyCustomCommitProviderAsync(markup, "Bar", expectedCodeAfterCommit, sourceCodeKind:=kind) End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> Public Async Function TestNoCompletionItemWhenAliasExists() As Task Dim file1 = " Imports FFF = Foo1.Foo2.Foo3.Foo4 Imports FFF1 = Foo1.Foo2.Foo3.Foo4.Foo5 Namespace Bar Public Class Bar1 Private Sub EE() F$$ End Sub End Class End Namespace" Dim file2 = " Namespace Foo1 Namespace Foo2 Namespace Foo3 Public Class Foo4 Public Class Foo5 End Class End Class End Namespace End Namespace End Namespace " Dim markup = CreateMarkupForSingleProject(file1, file2, LanguageNames.VisualBasic) Await VerifyItemIsAbsentAsync(markup, "Foo4", inlineDescription:="Foo1.Foo2.Foo3") Await VerifyItemIsAbsentAsync(markup, "Foo5", inlineDescription:="Foo1.Foo2.Foo3") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> Public Async Function TestAliasHasNoEffectOnGenerics() As Task Dim file1 = " Imports FFF = Foo1.Foo2.Foo3.Foo4(Of Int) Namespace Bar Public Class Bar1 Private Sub EE() F$$ End Sub End Class End Namespace" Dim file2 = " Namespace Foo1 Namespace Foo2 Namespace Foo3 Public Class Foo4(Of T) End Class End Namespace End Namespace End Namespace" Dim markup = CreateMarkupForSingleProject(file1, file2, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "Foo4", glyph:=Glyph.ClassPublic, inlineDescription:="Foo1.Foo2.Foo3", displayTextSuffix:="(Of ...)", isComplexTextEdit:=True) End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Completion Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.VisualBasic.Completion.Providers Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.CompletionProviders <UseExportProvider> Public Class TypeImportCompletionProviderTests Inherits AbstractVisualBasicCompletionProviderTests Private Property ShowImportCompletionItemsOptionValue As Boolean = True Private Property IsExpandedCompletion As Boolean = True Private Property UsePartialSemantic As Boolean = False Protected Overrides Function WithChangedOptions(options As OptionSet) As OptionSet Return options _ .WithChangedOption(CompletionOptions.ShowItemsFromUnimportedNamespaces, LanguageNames.VisualBasic, ShowImportCompletionItemsOptionValue) _ .WithChangedOption(CompletionServiceOptions.IsExpandedCompletion, IsExpandedCompletion) _ .WithChangedOption(CompletionServiceOptions.UsePartialSemanticForImportCompletion, UsePartialSemantic) End Function Protected Overrides Function GetComposition() As TestComposition Return MyBase.GetComposition().AddParts(GetType(TestExperimentationService)) End Function Friend Overrides Function GetCompletionProviderType() As Type Return GetType(TypeImportCompletionProvider) End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function AttributeTypeInAttributeNameContext() As Task Dim file1 = <Text> Namespace Foo Public Class MyAttribute Inherits System.Attribute End Class Public Class MyVBClass End Class Public Class MyAttributeWithoutSuffix Inherits System.Attribute End Class End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar <$$ Sub Main() End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "My", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyAttribute", isComplexTextEdit:=True) Await VerifyItemIsAbsentAsync(markup, "MyAttributeWithoutSuffix", inlineDescription:="Foo") ' We intentionally ignore attribute types without proper suffix for perf reason Await VerifyItemIsAbsentAsync(markup, "MyAttribute", inlineDescription:="Foo") Await VerifyItemIsAbsentAsync(markup, "MyVBClass", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function AttributeTypeInNonAttributeNameContext() As Task Dim file1 = <Text> Namespace Foo Public Class MyAttribute Inherits System.Attribute End Class Public Class MyVBClass End Class Public Class MyAttributeWithoutSuffix Inherits System.Attribute End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar Sub Main() Dim x As $$ End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "MyAttribute", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyAttribute", isComplexTextEdit:=True) Await VerifyItemExistsAsync(markup, "MyAttributeWithoutSuffix", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyAttributeWithoutSuffix", isComplexTextEdit:=True) Await VerifyItemExistsAsync(markup, "MyVBClass", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.MyVBClass", isComplexTextEdit:=True) Await VerifyItemIsAbsentAsync(markup, "My", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function AttributeTypeInAttributeNameContext2() As Task ' attribute suffix isn't capitalized Dim file1 = <Text> Namespace Foo Public Class Myattribute Inherits System.Attribute End Class End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar <$$ Sub Main() End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "My", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.Myattribute") Await VerifyItemIsAbsentAsync(markup, "Myattribute", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35540, "https://github.com/dotnet/roslyn/issues/35540")> Public Async Function CSharpAttributeTypeWithoutSuffixInAttributeNameContext() As Task ' attribute suffix isn't capitalized Dim file1 = <Text> namespace Foo { public class Myattribute : System.Attribute { } }</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar <$$ Sub Main() End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForProjectWithProjectReference(file2, file1, LanguageNames.VisualBasic, LanguageNames.CSharp) Await VerifyItemExistsAsync(markup, "My", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", expectedDescriptionOrNull:="Class Foo.Myattribute", isComplexTextEdit:=True) Await VerifyItemIsAbsentAsync(markup, "Myattribute", inlineDescription:="Foo") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(35124, "https://github.com/dotnet/roslyn/issues/35124")> Public Async Function GenericTypeShouldDisplayProperVBSyntax() As Task Dim file1 = <Text> Namespace Foo Public Class MyGenericClass(Of T) End Class End Namespace</Text>.Value Dim file2 = <Text><![CDATA[ Public Class Bar Sub Main() Dim x As $$ End Sub End Class]]></Text>.Value Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "MyGenericClass", glyph:=Glyph.ClassPublic, inlineDescription:="Foo", displayTextSuffix:="(Of ...)", expectedDescriptionOrNull:="Class Foo.MyGenericClass(Of T)", isComplexTextEdit:=True) End Function <InlineData(SourceCodeKind.Regular)> <InlineData(SourceCodeKind.Script)> <WpfTheory, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(37038, "https://github.com/dotnet/roslyn/issues/37038")> Public Async Function CommitTypeInImportAliasContextShouldUseFullyQualifiedName(kind As SourceCodeKind) As Task Dim file1 = <Text> Namespace Foo Public Class Bar End Class End Namespace</Text>.Value Dim file2 = "Imports BarAlias = $$" Dim expectedCodeAfterCommit = "Imports BarAlias = Foo.Bar$$" Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyCustomCommitProviderAsync(markup, "Bar", expectedCodeAfterCommit, sourceCodeKind:=kind) End Function <InlineData(SourceCodeKind.Regular)> <InlineData(SourceCodeKind.Script)> <WpfTheory, Trait(Traits.Feature, Traits.Features.Completion)> <WorkItem(37038, "https://github.com/dotnet/roslyn/issues/37038")> Public Async Function CommitGenericTypeParameterInImportAliasContextShouldUseFullyQualifiedName(kind As SourceCodeKind) As Task Dim file1 = <Text> Namespace Foo Public Class Bar End Class End Namespace</Text>.Value Dim file2 = "Imports BarAlias = System.Collections.Generic.List(Of $$)" Dim expectedCodeAfterCommit = "Imports BarAlias = System.Collections.Generic.List(Of Foo.Bar$$)" Dim markup = CreateMarkupForSingleProject(file2, file1, LanguageNames.VisualBasic) Await VerifyCustomCommitProviderAsync(markup, "Bar", expectedCodeAfterCommit, sourceCodeKind:=kind) End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> Public Async Function TestNoCompletionItemWhenAliasExists() As Task Dim file1 = " Imports FFF = Foo1.Foo2.Foo3.Foo4 Imports FFF1 = Foo1.Foo2.Foo3.Foo4.Foo5 Namespace Bar Public Class Bar1 Private Sub EE() F$$ End Sub End Class End Namespace" Dim file2 = " Namespace Foo1 Namespace Foo2 Namespace Foo3 Public Class Foo4 Public Class Foo5 End Class End Class End Namespace End Namespace End Namespace " Dim markup = CreateMarkupForSingleProject(file1, file2, LanguageNames.VisualBasic) Await VerifyItemIsAbsentAsync(markup, "Foo4", inlineDescription:="Foo1.Foo2.Foo3") Await VerifyItemIsAbsentAsync(markup, "Foo5", inlineDescription:="Foo1.Foo2.Foo3") End Function <Fact, Trait(Traits.Feature, Traits.Features.Completion)> Public Async Function TestAliasHasNoEffectOnGenerics() As Task Dim file1 = " Imports FFF = Foo1.Foo2.Foo3.Foo4(Of Int) Namespace Bar Public Class Bar1 Private Sub EE() F$$ End Sub End Class End Namespace" Dim file2 = " Namespace Foo1 Namespace Foo2 Namespace Foo3 Public Class Foo4(Of T) End Class End Namespace End Namespace End Namespace" Dim markup = CreateMarkupForSingleProject(file1, file2, LanguageNames.VisualBasic) Await VerifyItemExistsAsync(markup, "Foo4", glyph:=Glyph.ClassPublic, inlineDescription:="Foo1.Foo2.Foo3", displayTextSuffix:="(Of ...)", isComplexTextEdit:=True) End Function End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Portable/Symbols/TypeSymbolExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal static partial class TypeSymbolExtensions { public static bool ImplementsInterface(this TypeSymbol subType, TypeSymbol superInterface, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { foreach (NamedTypeSymbol @interface in subType.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo)) { if (@interface.IsInterface && TypeSymbol.Equals(@interface, superInterface, TypeCompareKind.ConsiderEverything2)) { return true; } } return false; } public static bool CanBeAssignedNull(this TypeSymbol type) { return type.IsReferenceType || type.IsPointerOrFunctionPointer() || type.IsNullableType(); } public static bool CanContainNull(this TypeSymbol type) { // unbound type parameters might contain null, even though they cannot be *assigned* null. return !type.IsValueType || type.IsNullableTypeOrTypeParameter(); } public static bool CanBeConst(this TypeSymbol typeSymbol) { RoslynDebug.Assert((object)typeSymbol != null); return typeSymbol.IsReferenceType || typeSymbol.IsEnumType() || typeSymbol.SpecialType.CanBeConst() || typeSymbol.IsNativeIntegerType; } /// <summary> /// Assuming that nullable annotations are enabled: /// T => true /// T where T : struct => false /// T where T : class => false /// T where T : class? => true /// T where T : IComparable => true /// T where T : IComparable? => true /// T where T : notnull => true /// </summary> /// <remarks> /// In C#9, annotations are allowed regardless of constraints. /// </remarks> public static bool IsTypeParameterDisallowingAnnotationInCSharp8(this TypeSymbol type) { if (type.TypeKind != TypeKind.TypeParameter) { return false; } var typeParameter = (TypeParameterSymbol)type; // https://github.com/dotnet/roslyn/issues/30056: Test `where T : unmanaged`. See // UninitializedNonNullableFieldTests.TypeParameterConstraints for instance. return !typeParameter.IsValueType && !(typeParameter.IsReferenceType && typeParameter.IsNotNullable == true); } /// <summary> /// Assuming that nullable annotations are enabled: /// T => true /// T where T : struct => false /// T where T : class => false /// T where T : class? => true /// T where T : IComparable => false /// T where T : IComparable? => true /// </summary> public static bool IsPossiblyNullableReferenceTypeTypeParameter(this TypeSymbol type) { return type is TypeParameterSymbol { IsValueType: false, IsNotNullable: false }; } public static bool IsNonNullableValueType(this TypeSymbol typeArgument) { if (!typeArgument.IsValueType) { return false; } return !IsNullableTypeOrTypeParameter(typeArgument); } public static bool IsVoidType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_Void; } public static bool IsNullableTypeOrTypeParameter(this TypeSymbol? type) { if (type is null) { return false; } if (type.TypeKind == TypeKind.TypeParameter) { var constraintTypes = ((TypeParameterSymbol)type).ConstraintTypesNoUseSiteDiagnostics; foreach (var constraintType in constraintTypes) { if (constraintType.Type.IsNullableTypeOrTypeParameter()) { return true; } } return false; } return type.IsNullableType(); } /// <summary> /// Is this System.Nullable`1 type, or its substitution. /// /// To check whether a type is System.Nullable`1 or is a type parameter constrained to System.Nullable`1 /// use <see cref="TypeSymbolExtensions.IsNullableTypeOrTypeParameter" /> instead. /// </summary> public static bool IsNullableType(this TypeSymbol type) { return type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T; } public static TypeSymbol GetNullableUnderlyingType(this TypeSymbol type) { return type.GetNullableUnderlyingTypeWithAnnotations().Type; } public static TypeWithAnnotations GetNullableUnderlyingTypeWithAnnotations(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); RoslynDebug.Assert(IsNullableType(type)); RoslynDebug.Assert(type is NamedTypeSymbol); //not testing Kind because it may be an ErrorType return ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]; } public static TypeSymbol StrippedType(this TypeSymbol type) { return type.IsNullableType() ? type.GetNullableUnderlyingType() : type; } public static TypeSymbol EnumUnderlyingTypeOrSelf(this TypeSymbol type) { return type.GetEnumUnderlyingType() ?? type; } public static bool IsNativeIntegerOrNullableNativeIntegerType(this TypeSymbol? type) { return type?.StrippedType().IsNativeIntegerType == true; } public static bool IsObjectType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_Object; } public static bool IsStringType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_String; } public static bool IsCharType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_Char; } public static bool IsIntegralType(this TypeSymbol type) { return type.SpecialType.IsIntegralType(); } public static NamedTypeSymbol? GetEnumUnderlyingType(this TypeSymbol? type) { return (type is NamedTypeSymbol namedType) ? namedType.EnumUnderlyingType : null; } public static bool IsEnumType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Enum; } public static bool IsValidEnumType(this TypeSymbol type) { var underlyingType = type.GetEnumUnderlyingType(); // SpecialType will be None if the underlying type is invalid. return (underlyingType is object) && (underlyingType.SpecialType != SpecialType.None); } /// <summary> /// Determines if the given type is a valid attribute parameter type. /// </summary> /// <param name="type">Type to validated</param> /// <param name="compilation">compilation</param> /// <returns></returns> public static bool IsValidAttributeParameterType(this TypeSymbol type, CSharpCompilation compilation) { return GetAttributeParameterTypedConstantKind(type, compilation) != TypedConstantKind.Error; } /// <summary> /// Gets the typed constant kind for the given attribute parameter type. /// </summary> /// <param name="type">Type to validated</param> /// <param name="compilation">compilation</param> /// <returns>TypedConstantKind for the attribute parameter type.</returns> public static TypedConstantKind GetAttributeParameterTypedConstantKind(this TypeSymbol type, CSharpCompilation compilation) { // Spec (17.1.3) // The types of positional and named parameters for an attribute class are limited to the attribute parameter types, which are: // 1) One of the following types: bool, byte, char, double, float, int, long, sbyte, short, string, uint, ulong, ushort. // 2) The type object. // 3) The type System.Type. // 4) An enum type, provided it has public accessibility and the types in which it is nested (if any) also have public accessibility. // 5) Single-dimensional arrays of the above types. // A constructor argument or public field which does not have one of these types, cannot be used as a positional // or named parameter in an attribute specification. TypedConstantKind kind = TypedConstantKind.Error; if ((object)type == null) { return TypedConstantKind.Error; } if (type.Kind == SymbolKind.ArrayType) { var arrayType = (ArrayTypeSymbol)type; if (!arrayType.IsSZArray) { return TypedConstantKind.Error; } kind = TypedConstantKind.Array; type = arrayType.ElementType; } // enum or enum[] if (type.IsEnumType()) { // SPEC VIOLATION: Dev11 doesn't enforce either the Enum type or its enclosing types (if any) to have public accessibility. // We will be consistent with Dev11 behavior. if (kind == TypedConstantKind.Error) { // set only if kind is not already set (i.e. its not an array of enum) kind = TypedConstantKind.Enum; } type = type.GetEnumUnderlyingType()!; } var typedConstantKind = TypedConstant.GetTypedConstantKind(type, compilation); switch (typedConstantKind) { case TypedConstantKind.Array: case TypedConstantKind.Enum: case TypedConstantKind.Error: return TypedConstantKind.Error; default: if (kind == TypedConstantKind.Array || kind == TypedConstantKind.Enum) { // Array/Enum type with valid element/underlying type return kind; } return typedConstantKind; } } public static bool IsValidExtensionParameterType(this TypeSymbol type) { switch (type.TypeKind) { case TypeKind.Pointer: case TypeKind.Dynamic: case TypeKind.FunctionPointer: return false; default: return true; } } public static bool IsInterfaceType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.Kind == SymbolKind.NamedType && ((NamedTypeSymbol)type).IsInterface; } public static bool IsClassType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Class; } public static bool IsStructType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Struct; } public static bool IsErrorType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.Kind == SymbolKind.ErrorType; } public static bool IsMethodTypeParameter(this TypeParameterSymbol p) { return p.ContainingSymbol.Kind == SymbolKind.Method; } public static bool IsDynamic(this TypeSymbol type) { return type.TypeKind == TypeKind.Dynamic; } public static bool IsTypeParameter(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.TypeParameter; } public static bool IsArray(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Array; } public static bool IsSZArray(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Array && ((ArrayTypeSymbol)type).IsSZArray; } public static bool IsFunctionPointer(this TypeSymbol type) { return type.TypeKind == TypeKind.FunctionPointer; } public static bool IsPointerOrFunctionPointer(this TypeSymbol type) { switch (type.TypeKind) { case TypeKind.Pointer: case TypeKind.FunctionPointer: return true; default: return false; } } // If the type is a delegate type, it returns it. If the type is an // expression tree type associated with a delegate type, it returns // the delegate type. Otherwise, null. public static NamedTypeSymbol? GetDelegateType(this TypeSymbol? type) { if (type is null) return null; if (type.IsExpressionTree()) { type = ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; } return type.IsDelegateType() ? (NamedTypeSymbol)type : null; } public static TypeSymbol? GetDelegateOrFunctionPointerType(this TypeSymbol? type) { return (TypeSymbol?)GetDelegateType(type) ?? type as FunctionPointerTypeSymbol; } /// <summary> /// return true if the type is constructed from System.Linq.Expressions.Expression`1 /// </summary> public static bool IsExpressionTree(this TypeSymbol type) { return type.IsGenericOrNonGenericExpressionType(out bool isGenericType) && isGenericType; } public static bool IsNonGenericExpressionType(this TypeSymbol type) { return type.IsGenericOrNonGenericExpressionType(out bool isGenericType) && !isGenericType; } public static bool IsGenericOrNonGenericExpressionType(this TypeSymbol _type, out bool isGenericType) { if (_type.OriginalDefinition is NamedTypeSymbol type && type.Name == "Expression" && CheckFullName(type.ContainingSymbol, s_expressionsNamespaceName)) { if (type.Arity == 0) { isGenericType = false; return true; } if (type.Arity == 1 && type.MangleName) { isGenericType = true; return true; } } isGenericType = false; return false; } /// <summary> /// return true if the type is constructed from a generic interface that /// might be implemented by an array. /// </summary> public static bool IsPossibleArrayGenericInterface(this TypeSymbol type) { if (!(type is NamedTypeSymbol t)) { return false; } t = t.OriginalDefinition; SpecialType st = t.SpecialType; if (st == SpecialType.System_Collections_Generic_IList_T || st == SpecialType.System_Collections_Generic_ICollection_T || st == SpecialType.System_Collections_Generic_IEnumerable_T || st == SpecialType.System_Collections_Generic_IReadOnlyList_T || st == SpecialType.System_Collections_Generic_IReadOnlyCollection_T) { return true; } return false; } private static readonly string[] s_expressionsNamespaceName = { "Expressions", "Linq", MetadataHelpers.SystemString, "" }; private static bool CheckFullName(Symbol symbol, string[] names) { for (int i = 0; i < names.Length; i++) { if ((object)symbol == null || symbol.Name != names[i]) return false; symbol = symbol.ContainingSymbol; } return true; } public static bool IsDelegateType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Delegate; } public static ImmutableArray<ParameterSymbol> DelegateParameters(this TypeSymbol type) { var invokeMethod = type.DelegateInvokeMethod(); if ((object)invokeMethod == null) { return default(ImmutableArray<ParameterSymbol>); } return invokeMethod.Parameters; } public static ImmutableArray<ParameterSymbol> DelegateOrFunctionPointerParameters(this TypeSymbol type) { Debug.Assert(type is FunctionPointerTypeSymbol || type.IsDelegateType()); if (type is FunctionPointerTypeSymbol { Signature: { Parameters: var functionPointerParameters } }) { return functionPointerParameters; } else { return type.DelegateParameters(); } } public static bool TryGetElementTypesWithAnnotationsIfTupleType(this TypeSymbol type, out ImmutableArray<TypeWithAnnotations> elementTypes) { if (type.IsTupleType) { elementTypes = ((NamedTypeSymbol)type).TupleElementTypesWithAnnotations; return true; } // source not a tuple elementTypes = default(ImmutableArray<TypeWithAnnotations>); return false; } public static MethodSymbol DelegateInvokeMethod(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); RoslynDebug.Assert(type.IsDelegateType() || type.IsExpressionTree()); return type.GetDelegateType()!.DelegateInvokeMethod; } /// <summary> /// Return the default value constant for the given type, /// or null if the default value is not a constant. /// </summary> public static ConstantValue? GetDefaultValue(this TypeSymbol type) { // SPEC: A default-value-expression is a constant expression (§7.19) if the type // SPEC: is a reference type or a type parameter that is known to be a reference type (§10.1.5). // SPEC: In addition, a default-value-expression is a constant expression if the type is // SPEC: one of the following value types: // SPEC: sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, or any enumeration type. RoslynDebug.Assert((object)type != null); if (type.IsErrorType()) { return null; } if (type.IsReferenceType) { return ConstantValue.Null; } if (type.IsValueType) { type = type.EnumUnderlyingTypeOrSelf(); switch (type.SpecialType) { case SpecialType.System_SByte: case SpecialType.System_Byte: case SpecialType.System_Int16: case SpecialType.System_UInt16: case SpecialType.System_Int32: case SpecialType.System_UInt32: case SpecialType.System_Int64: case SpecialType.System_UInt64: case SpecialType.System_IntPtr when type.IsNativeIntegerType: case SpecialType.System_UIntPtr when type.IsNativeIntegerType: case SpecialType.System_Char: case SpecialType.System_Boolean: case SpecialType.System_Single: case SpecialType.System_Double: case SpecialType.System_Decimal: return ConstantValue.Default(type.SpecialType); } } return null; } public static SpecialType GetSpecialTypeSafe(this TypeSymbol? type) { return type is object ? type.SpecialType : SpecialType.None; } public static bool IsAtLeastAsVisibleAs(this TypeSymbol type, Symbol sym, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { CompoundUseSiteInfo<AssemblySymbol> localUseSiteInfo = useSiteInfo; var result = type.VisitType((type1, symbol, unused) => IsTypeLessVisibleThan(type1, symbol, ref localUseSiteInfo), sym, canDigThroughNullable: true); // System.Nullable is public useSiteInfo = localUseSiteInfo; return result is null; } private static bool IsTypeLessVisibleThan(TypeSymbol type, Symbol sym, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { switch (type.TypeKind) { case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: case TypeKind.Enum: case TypeKind.Delegate: case TypeKind.Submission: return !IsAsRestrictive((NamedTypeSymbol)type, sym, ref useSiteInfo); default: return false; } } /// <summary> /// Visit the given type and, in the case of compound types, visit all "sub type" /// (such as A in A[], or { A&lt;T&gt;, T, U } in A&lt;T&gt;.B&lt;U&gt;) invoking 'predicate' /// with the type and 'arg' at each sub type. If the predicate returns true for any type, /// traversal stops and that type is returned from this method. Otherwise if traversal /// completes without the predicate returning true for any type, this method returns null. /// </summary> public static TypeSymbol? VisitType<T>( this TypeSymbol type, Func<TypeSymbol, T, bool, bool> predicate, T arg, bool canDigThroughNullable = false) { return VisitType( typeWithAnnotationsOpt: default, type: type, typeWithAnnotationsPredicate: null, typePredicate: predicate, arg, canDigThroughNullable); } /// <summary> /// Visit the given type and, in the case of compound types, visit all "sub type". /// One of the predicates will be invoked at each type. If the type is a /// TypeWithAnnotations, <paramref name="typeWithAnnotationsPredicate"/> /// will be invoked; otherwise <paramref name="typePredicate"/> will be invoked. /// If the corresponding predicate returns true for any type, /// traversal stops and that type is returned from this method. Otherwise if traversal /// completes without the predicate returning true for any type, this method returns null. /// </summary> /// <param name="useDefaultType">If true, use <see cref="TypeWithAnnotations.DefaultType"/> /// instead of <see cref="TypeWithAnnotations.Type"/> to avoid early resolution of nullable types</param> public static TypeSymbol? VisitType<T>( this TypeWithAnnotations typeWithAnnotationsOpt, TypeSymbol? type, Func<TypeWithAnnotations, T, bool, bool>? typeWithAnnotationsPredicate, Func<TypeSymbol, T, bool, bool>? typePredicate, T arg, bool canDigThroughNullable = false, bool useDefaultType = false) { RoslynDebug.Assert(typeWithAnnotationsOpt.HasType == (type is null)); RoslynDebug.Assert(canDigThroughNullable == false || useDefaultType == false, "digging through nullable will cause early resolution of nullable types"); // In order to handle extremely "deep" types like "int[][][][][][][][][]...[]" // or int*****************...* we implement manual tail recursion rather than // doing the natural recursion. while (true) { TypeSymbol current = type ?? (useDefaultType ? typeWithAnnotationsOpt.DefaultType : typeWithAnnotationsOpt.Type); bool isNestedNamedType = false; // Visit containing types from outer-most to inner-most. switch (current.TypeKind) { case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: case TypeKind.Enum: case TypeKind.Delegate: { var containingType = current.ContainingType; if ((object)containingType != null) { isNestedNamedType = true; var result = VisitType(default, containingType, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { return result; } } } break; case TypeKind.Submission: RoslynDebug.Assert((object)current.ContainingType == null); break; } if (typeWithAnnotationsOpt.HasType && typeWithAnnotationsPredicate != null) { if (typeWithAnnotationsPredicate(typeWithAnnotationsOpt, arg, isNestedNamedType)) { return current; } } else if (typePredicate != null) { if (typePredicate(current, arg, isNestedNamedType)) { return current; } } TypeWithAnnotations next; switch (current.TypeKind) { case TypeKind.Dynamic: case TypeKind.TypeParameter: case TypeKind.Submission: case TypeKind.Enum: return null; case TypeKind.Error: case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: case TypeKind.Delegate: var typeArguments = ((NamedTypeSymbol)current).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics; if (typeArguments.IsEmpty) { return null; } int i; for (i = 0; i < typeArguments.Length - 1; i++) { // Let's try to avoid early resolution of nullable types (TypeWithAnnotations nextTypeWithAnnotations, TypeSymbol? nextType) = getNextIterationElements(typeArguments[i], canDigThroughNullable); var result = VisitType( typeWithAnnotationsOpt: nextTypeWithAnnotations, type: nextType, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { return result; } } next = typeArguments[i]; break; case TypeKind.Array: next = ((ArrayTypeSymbol)current).ElementTypeWithAnnotations; break; case TypeKind.Pointer: next = ((PointerTypeSymbol)current).PointedAtTypeWithAnnotations; break; case TypeKind.FunctionPointer: { var result = visitFunctionPointerType((FunctionPointerTypeSymbol)current, typeWithAnnotationsPredicate, typePredicate, arg, useDefaultType, canDigThroughNullable, out next); if (result is object) { return result; } break; } default: throw ExceptionUtilities.UnexpectedValue(current.TypeKind); } // Let's try to avoid early resolution of nullable types typeWithAnnotationsOpt = canDigThroughNullable ? default : next; type = canDigThroughNullable ? next.NullableUnderlyingTypeOrSelf : null; } static (TypeWithAnnotations, TypeSymbol?) getNextIterationElements(TypeWithAnnotations type, bool canDigThroughNullable) => canDigThroughNullable ? (default(TypeWithAnnotations), type.NullableUnderlyingTypeOrSelf) : (type, null); static TypeSymbol? visitFunctionPointerType(FunctionPointerTypeSymbol type, Func<TypeWithAnnotations, T, bool, bool>? typeWithAnnotationsPredicate, Func<TypeSymbol, T, bool, bool>? typePredicate, T arg, bool useDefaultType, bool canDigThroughNullable, out TypeWithAnnotations next) { MethodSymbol currentPointer = type.Signature; if (currentPointer.ParameterCount == 0) { next = currentPointer.ReturnTypeWithAnnotations; return null; } var result = VisitType( typeWithAnnotationsOpt: canDigThroughNullable ? default : currentPointer.ReturnTypeWithAnnotations, type: canDigThroughNullable ? currentPointer.ReturnTypeWithAnnotations.NullableUnderlyingTypeOrSelf : null, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { next = default; return result; } int i; for (i = 0; i < currentPointer.ParameterCount - 1; i++) { (TypeWithAnnotations nextTypeWithAnnotations, TypeSymbol? nextType) = getNextIterationElements(currentPointer.Parameters[i].TypeWithAnnotations, canDigThroughNullable); result = VisitType( typeWithAnnotationsOpt: nextTypeWithAnnotations, type: nextType, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { next = default; return result; } } next = currentPointer.Parameters[i].TypeWithAnnotations; return null; } } private static bool IsAsRestrictive(NamedTypeSymbol s1, Symbol sym2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { Accessibility acc1 = s1.DeclaredAccessibility; if (acc1 == Accessibility.Public) { return true; } for (Symbol s2 = sym2; s2.Kind != SymbolKind.Namespace; s2 = s2.ContainingSymbol) { Accessibility acc2 = s2.DeclaredAccessibility; switch (acc1) { case Accessibility.Internal: { // If s2 is private or internal, and within the same assembly as s1, // then this is at least as restrictive as s1's internal. if ((acc2 == Accessibility.Private || acc2 == Accessibility.Internal || acc2 == Accessibility.ProtectedAndInternal) && s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { return true; } break; } case Accessibility.ProtectedAndInternal: // Since s1 is private protected, s2 must pass the test for being both more restrictive than internal and more restrictive than protected. // We first do the "internal" test (copied from above), then if it passes we continue with the "protected" test. if ((acc2 == Accessibility.Private || acc2 == Accessibility.Internal || acc2 == Accessibility.ProtectedAndInternal) && s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { // passed the internal test; now do the test for the protected case goto case Accessibility.Protected; } break; case Accessibility.Protected: { var parent1 = s1.ContainingType; if ((object)parent1 == null) { // not helpful } else if (acc2 == Accessibility.Private) { // if s2 is private and within s1's parent or within a subclass of s1's parent, // then this is at least as restrictive as s1's protected. for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) { if (parent1.IsAccessibleViaInheritance(parent2, ref useSiteInfo)) { return true; } } } else if (acc2 == Accessibility.Protected || acc2 == Accessibility.ProtectedAndInternal) { // if s2 is protected, and it's parent is a subclass (or the same as) s1's parent // then this is at least as restrictive as s1's protected var parent2 = s2.ContainingType; if ((object)parent2 != null && parent1.IsAccessibleViaInheritance(parent2, ref useSiteInfo)) { return true; } } break; } case Accessibility.ProtectedOrInternal: { var parent1 = s1.ContainingType; if ((object)parent1 == null) { break; } switch (acc2) { case Accessibility.Private: // if s2 is private and within a subclass of s1's parent, // or within the same assembly as s1 // then this is at least as restrictive as s1's internal protected. if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { return true; } for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) { if (parent1.IsAccessibleViaInheritance(parent2, ref useSiteInfo)) { return true; } } break; case Accessibility.Internal: // If s2 is in the same assembly as s1, then this is more restrictive // than s1's internal protected. if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { return true; } break; case Accessibility.Protected: // if s2 is protected, and it's parent is a subclass (or the same as) s1's parent // then this is at least as restrictive as s1's internal protected if (parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) { return true; } break; case Accessibility.ProtectedAndInternal: // if s2 is private protected, and it's parent is a subclass (or the same as) s1's parent // or its in the same assembly as s1, then this is at least as restrictive as s1's protected if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly) || parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) { return true; } break; case Accessibility.ProtectedOrInternal: // if s2 is internal protected, and it's parent is a subclass (or the same as) s1's parent // and its in the same assembly as s1, then this is at least as restrictive as s1's protected if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly) && parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) { return true; } break; } break; } case Accessibility.Private: if (acc2 == Accessibility.Private) { // if s2 is private, and it is within s1's parent, then this is at // least as restrictive as s1's private. NamedTypeSymbol parent1 = s1.ContainingType; if ((object)parent1 == null) { break; } var parent1OriginalDefinition = parent1.OriginalDefinition; for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) { if (ReferenceEquals(parent2.OriginalDefinition, parent1OriginalDefinition) || parent1OriginalDefinition.TypeKind == TypeKind.Submission && parent2.TypeKind == TypeKind.Submission) { return true; } } } break; default: throw ExceptionUtilities.UnexpectedValue(acc1); } } return false; } public static bool IsUnboundGenericType(this TypeSymbol type) { return type is NamedTypeSymbol { IsUnboundGenericType: true }; } public static bool IsTopLevelType(this NamedTypeSymbol type) { return (object)type.ContainingType == null; } /// <summary> /// (null TypeParameterSymbol "parameter"): Checks if the given type is a type parameter /// or its referent type is a type parameter (array/pointer) or contains a type parameter (aggregate type) /// (non-null TypeParameterSymbol "parameter"): above + also checks if the type parameter /// is the same as "parameter" /// </summary> public static bool ContainsTypeParameter(this TypeSymbol type, TypeParameterSymbol? parameter = null) { var result = type.VisitType(s_containsTypeParameterPredicate, parameter); return result is object; } private static readonly Func<TypeSymbol, TypeParameterSymbol?, bool, bool> s_containsTypeParameterPredicate = (type, parameter, unused) => type.TypeKind == TypeKind.TypeParameter && (parameter is null || TypeSymbol.Equals(type, parameter, TypeCompareKind.ConsiderEverything2)); public static bool ContainsTypeParameter(this TypeSymbol type, MethodSymbol parameterContainer) { RoslynDebug.Assert((object)parameterContainer != null); var result = type.VisitType(s_isTypeParameterWithSpecificContainerPredicate, parameterContainer); return result is object; } private static readonly Func<TypeSymbol, Symbol, bool, bool> s_isTypeParameterWithSpecificContainerPredicate = (type, parameterContainer, unused) => type.TypeKind == TypeKind.TypeParameter && (object)type.ContainingSymbol == (object)parameterContainer; public static bool ContainsTypeParameters(this TypeSymbol type, HashSet<TypeParameterSymbol> parameters) { var result = type.VisitType(s_containsTypeParametersPredicate, parameters); return result is object; } private static readonly Func<TypeSymbol, HashSet<TypeParameterSymbol>, bool, bool> s_containsTypeParametersPredicate = (type, parameters, unused) => type.TypeKind == TypeKind.TypeParameter && parameters.Contains((TypeParameterSymbol)type); public static bool ContainsMethodTypeParameter(this TypeSymbol type) { var result = type.VisitType(s_containsMethodTypeParameterPredicate, null); return result is object; } private static readonly Func<TypeSymbol, object?, bool, bool> s_containsMethodTypeParameterPredicate = (type, _, _) => type.TypeKind == TypeKind.TypeParameter && type.ContainingSymbol is MethodSymbol; /// <summary> /// Return true if the type contains any dynamic type reference. /// </summary> public static bool ContainsDynamic(this TypeSymbol type) { var result = type.VisitType(s_containsDynamicPredicate, null, canDigThroughNullable: true); return result is object; } private static readonly Func<TypeSymbol, object?, bool, bool> s_containsDynamicPredicate = (type, unused1, unused2) => type.TypeKind == TypeKind.Dynamic; internal static bool ContainsNativeInteger(this TypeSymbol type) { var result = type.VisitType((type, unused1, unused2) => type.IsNativeIntegerType, (object?)null, canDigThroughNullable: true); return result is object; } internal static bool ContainsNativeInteger(this TypeWithAnnotations type) { return type.Type?.ContainsNativeInteger() == true; } internal static bool ContainsErrorType(this TypeSymbol type) { var result = type.VisitType((type, unused1, unused2) => type.IsErrorType(), (object?)null, canDigThroughNullable: true); return result is object; } /// <summary> /// Return true if the type contains any tuples. /// </summary> internal static bool ContainsTuple(this TypeSymbol type) => type.VisitType((TypeSymbol t, object? _1, bool _2) => t.IsTupleType, null) is object; /// <summary> /// Return true if the type contains any tuples with element names. /// </summary> internal static bool ContainsTupleNames(this TypeSymbol type) => type.VisitType((TypeSymbol t, object? _1, bool _2) => !t.TupleElementNames.IsDefault, null) is object; /// <summary> /// Return true if the type contains any function pointer types. /// </summary> internal static bool ContainsFunctionPointer(this TypeSymbol type) => type.VisitType((TypeSymbol t, object? _, bool _) => t.IsFunctionPointer(), null) is object; /// <summary> /// Guess the non-error type that the given type was intended to represent. /// If the type itself is not an error type, then it will be returned. /// Otherwise, the underlying type (if any) of the error type will be /// returned. /// </summary> /// <remarks> /// Any non-null type symbol returned is guaranteed not to be an error type. /// /// It is possible to pass in a constructed type and received back an /// unconstructed type. This can occur when the type passed in was /// constructed from an error type - the underlying definition will be /// available, but there won't be a good way to "re-substitute" back up /// to the level of the specified type. /// </remarks> internal static TypeSymbol? GetNonErrorGuess(this TypeSymbol type) { var result = ExtendedErrorTypeSymbol.ExtractNonErrorType(type); RoslynDebug.Assert((object?)result == null || !result.IsErrorType()); return result; } /// <summary> /// Guess the non-error type kind that the given type was intended to represent, /// if possible. If not, return TypeKind.Error. /// </summary> internal static TypeKind GetNonErrorTypeKindGuess(this TypeSymbol type) { return ExtendedErrorTypeSymbol.ExtractNonErrorTypeKind(type); } /// <summary> /// Returns true if the type was a valid switch expression type in C# 6. We use this test to determine /// whether or not we should attempt a user-defined conversion from the type to a C# 6 switch governing /// type, which we support for compatibility with C# 6 and earlier. /// </summary> internal static bool IsValidV6SwitchGoverningType(this TypeSymbol type, bool isTargetTypeOfUserDefinedOp = false) { // SPEC: The governing type of a switch statement is established by the switch expression. // SPEC: 1) If the type of the switch expression is sbyte, byte, short, ushort, int, uint, // SPEC: long, ulong, bool, char, string, or an enum-type, or if it is the nullable type // SPEC: corresponding to one of these types, then that is the governing type of the switch statement. // SPEC: 2) Otherwise, exactly one user-defined implicit conversion must exist from the // SPEC: type of the switch expression to one of the following possible governing types: // SPEC: sbyte, byte, short, ushort, int, uint, long, ulong, char, string, or, a nullable type // SPEC: corresponding to one of those types RoslynDebug.Assert((object)type != null); if (type.IsNullableType()) { type = type.GetNullableUnderlyingType(); } // User-defined implicit conversion with target type as Enum type is not valid. if (!isTargetTypeOfUserDefinedOp) { type = type.EnumUnderlyingTypeOrSelf(); } switch (type.SpecialType) { case SpecialType.System_SByte: case SpecialType.System_Byte: case SpecialType.System_Int16: case SpecialType.System_UInt16: case SpecialType.System_Int32: case SpecialType.System_UInt32: case SpecialType.System_Int64: case SpecialType.System_UInt64: case SpecialType.System_Char: case SpecialType.System_String: return true; case SpecialType.System_Boolean: // User-defined implicit conversion with target type as bool type is not valid. return !isTargetTypeOfUserDefinedOp; } return false; } #pragma warning disable CA1200 // Avoid using cref tags with a prefix /// <summary> /// Returns true if the type is one of the restricted types, namely: <see cref="T:System.TypedReference"/>, /// <see cref="T:System.ArgIterator"/>, or <see cref="T:System.RuntimeArgumentHandle"/>. /// or a ref-like type. /// </summary> #pragma warning restore CA1200 // Avoid using cref tags with a prefix internal static bool IsRestrictedType(this TypeSymbol type, bool ignoreSpanLikeTypes = false) { // See Dev10 C# compiler, "type.cpp", bool Type::isSpecialByRefType() const RoslynDebug.Assert((object)type != null); switch (type.SpecialType) { case SpecialType.System_TypedReference: case SpecialType.System_ArgIterator: case SpecialType.System_RuntimeArgumentHandle: return true; } return ignoreSpanLikeTypes ? false : type.IsRefLikeType; } public static bool IsIntrinsicType(this TypeSymbol type) { switch (type.SpecialType) { case SpecialType.System_Boolean: case SpecialType.System_Char: case SpecialType.System_SByte: case SpecialType.System_Int16: case SpecialType.System_Int32: case SpecialType.System_Int64: case SpecialType.System_Byte: case SpecialType.System_UInt16: case SpecialType.System_UInt32: case SpecialType.System_UInt64: case SpecialType.System_IntPtr when type.IsNativeIntegerType: case SpecialType.System_UIntPtr when type.IsNativeIntegerType: case SpecialType.System_Single: case SpecialType.System_Double: // NOTE: VB treats System.DateTime as an intrinsic, while C# does not. //case SpecialType.System_DateTime: case SpecialType.System_Decimal: return true; default: return false; } } public static bool IsPartial(this TypeSymbol type) { return type is SourceNamedTypeSymbol { IsPartial: true }; } public static bool IsPointerType(this TypeSymbol type) { return type is PointerTypeSymbol; } internal static int FixedBufferElementSizeInBytes(this TypeSymbol type) { return type.SpecialType.FixedBufferElementSizeInBytes(); } // check that its type is allowed for Volatile internal static bool IsValidVolatileFieldType(this TypeSymbol type) { switch (type.TypeKind) { case TypeKind.Struct: return type.SpecialType.IsValidVolatileFieldType(); case TypeKind.Array: case TypeKind.Class: case TypeKind.Delegate: case TypeKind.Dynamic: case TypeKind.Error: case TypeKind.Interface: case TypeKind.Pointer: case TypeKind.FunctionPointer: return true; case TypeKind.Enum: return ((NamedTypeSymbol)type).EnumUnderlyingType.SpecialType.IsValidVolatileFieldType(); case TypeKind.TypeParameter: return type.IsReferenceType; case TypeKind.Submission: throw ExceptionUtilities.UnexpectedValue(type.TypeKind); } return false; } /// <summary> /// Add this instance to the set of checked types. Returns true /// if this was added, false if the type was already in the set. /// </summary> public static bool MarkCheckedIfNecessary(this TypeSymbol type, ref HashSet<TypeSymbol> checkedTypes) { if (checkedTypes == null) { checkedTypes = new HashSet<TypeSymbol>(); } return checkedTypes.Add(type); } internal static bool IsUnsafe(this TypeSymbol type) { while (true) { switch (type.TypeKind) { case TypeKind.Pointer: case TypeKind.FunctionPointer: return true; case TypeKind.Array: type = ((ArrayTypeSymbol)type).ElementType; break; default: // NOTE: we could consider a generic type with unsafe type arguments to be unsafe, // but that's already an error, so there's no reason to report it. Also, this // matches Type::isUnsafe in Dev10. return false; } } } internal static bool IsVoidPointer(this TypeSymbol type) { return type is PointerTypeSymbol p && p.PointedAtType.IsVoidType(); } /// <summary> /// These special types are structs that contain fields of the same type /// (e.g. <see cref="System.Int32"/> contains an instance field of type <see cref="System.Int32"/>). /// </summary> internal static bool IsPrimitiveRecursiveStruct(this TypeSymbol t) { return t.SpecialType.IsPrimitiveRecursiveStruct(); } /// <summary> /// Compute a hash code for the constructed type. The return value will be /// non-zero so callers can used zero to represent an uninitialized value. /// </summary> internal static int ComputeHashCode(this NamedTypeSymbol type) { RoslynDebug.Assert(!type.Equals(type.OriginalDefinition, TypeCompareKind.AllIgnoreOptions) || wasConstructedForAnnotations(type)); if (wasConstructedForAnnotations(type)) { // A type that uses its own type parameters as type arguments was constructed only for the purpose of adding annotations. // In that case we'll use the hash from the definition. return type.OriginalDefinition.GetHashCode(); } int code = type.OriginalDefinition.GetHashCode(); code = Hash.Combine(type.ContainingType, code); // Unconstructed type may contain alpha-renamed type parameters while // may still be considered equal, we do not want to give different hashcode to such types. // // Example: // Having original type A<U>.B<V> we create two _unconstructed_ types // A<int>.B<V'> // A<int>.B<V"> // Note that V' and V" are type parameters substituted via alpha-renaming of original V // These are different objects, but represent the same "type parameter at index 1" // // In short - we are not interested in the type parameters of unconstructed types. if ((object)type.ConstructedFrom != (object)type) { foreach (var arg in type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics) { code = Hash.Combine(arg.Type, code); } } // 0 may be used by the caller to indicate the hashcode is not // initialized. If we computed 0 for the hashcode, tweak it. if (code == 0) { code++; } return code; static bool wasConstructedForAnnotations(NamedTypeSymbol type) { do { var typeArguments = type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics; var typeParameters = type.OriginalDefinition.TypeParameters; for (int i = 0; i < typeArguments.Length; i++) { if (!typeParameters[i].Equals( typeArguments[i].Type.OriginalDefinition, TypeCompareKind.ConsiderEverything)) { return false; } } type = type.ContainingType; } while (type is object && !type.IsDefinition); return true; } } /// <summary> /// If we are in a COM PIA with embedInteropTypes enabled we should turn properties and methods /// that have the type and return type of object, respectively, into type dynamic. If the requisite conditions /// are fulfilled, this method returns a dynamic type. If not, it returns the original type. /// </summary> /// <param name="type">A property type or method return type to be checked for dynamification.</param> /// <param name="containingType">Containing type.</param> /// <returns></returns> public static TypeSymbol AsDynamicIfNoPia(this TypeSymbol type, NamedTypeSymbol containingType) { return type.TryAsDynamicIfNoPia(containingType, out TypeSymbol? result) ? result : type; } public static bool TryAsDynamicIfNoPia(this TypeSymbol type, NamedTypeSymbol containingType, [NotNullWhen(true)] out TypeSymbol? result) { if (type.SpecialType == SpecialType.System_Object) { AssemblySymbol assembly = containingType.ContainingAssembly; if ((object)assembly != null && assembly.IsLinked && containingType.IsComImport) { result = DynamicTypeSymbol.Instance; return true; } } result = null; return false; } /// <summary> /// Type variables are never considered reference types by the verifier. /// </summary> internal static bool IsVerifierReference(this TypeSymbol type) { return type.IsReferenceType && type.TypeKind != TypeKind.TypeParameter; } /// <summary> /// Type variables are never considered value types by the verifier. /// </summary> internal static bool IsVerifierValue(this TypeSymbol type) { return type.IsValueType && type.TypeKind != TypeKind.TypeParameter; } /// <summary> /// Return all of the type parameters in this type and enclosing types, /// from outer-most to inner-most type. /// </summary> internal static ImmutableArray<TypeParameterSymbol> GetAllTypeParameters(this NamedTypeSymbol type) { // Avoid allocating a builder in the common case. if ((object)type.ContainingType == null) { return type.TypeParameters; } var builder = ArrayBuilder<TypeParameterSymbol>.GetInstance(); type.GetAllTypeParameters(builder); return builder.ToImmutableAndFree(); } /// <summary> /// Return all of the type parameters in this type and enclosing types, /// from outer-most to inner-most type. /// </summary> internal static void GetAllTypeParameters(this NamedTypeSymbol type, ArrayBuilder<TypeParameterSymbol> result) { var containingType = type.ContainingType; if ((object)containingType != null) { containingType.GetAllTypeParameters(result); } result.AddRange(type.TypeParameters); } /// <summary> /// Return the nearest type parameter with the given name in /// this type or any enclosing type. /// </summary> internal static TypeParameterSymbol? FindEnclosingTypeParameter(this NamedTypeSymbol type, string name) { var allTypeParameters = ArrayBuilder<TypeParameterSymbol>.GetInstance(); type.GetAllTypeParameters(allTypeParameters); TypeParameterSymbol? result = null; foreach (TypeParameterSymbol tpEnclosing in allTypeParameters) { if (name == tpEnclosing.Name) { result = tpEnclosing; break; } } allTypeParameters.Free(); return result; } /// <summary> /// Return the nearest type parameter with the given name in /// this symbol or any enclosing symbol. /// </summary> internal static TypeParameterSymbol? FindEnclosingTypeParameter(this Symbol methodOrType, string name) { while (methodOrType != null) { switch (methodOrType.Kind) { case SymbolKind.Method: case SymbolKind.NamedType: case SymbolKind.ErrorType: case SymbolKind.Field: case SymbolKind.Property: case SymbolKind.Event: break; default: return null; } foreach (var typeParameter in methodOrType.GetMemberTypeParameters()) { if (typeParameter.Name == name) { return typeParameter; } } methodOrType = methodOrType.ContainingSymbol; } return null; } /// <summary> /// Return true if the fully qualified name of the type's containing symbol /// matches the given name. This method avoids string concatenations /// in the common case where the type is a top-level type. /// </summary> internal static bool HasNameQualifier(this NamedTypeSymbol type, string qualifiedName) { const StringComparison comparison = StringComparison.Ordinal; var container = type.ContainingSymbol; if (container.Kind != SymbolKind.Namespace) { // Nested type. For simplicity, compare qualified name to SymbolDisplay result. return string.Equals(container.ToDisplayString(SymbolDisplayFormat.QualifiedNameOnlyFormat), qualifiedName, comparison); } var @namespace = (NamespaceSymbol)container; if (@namespace.IsGlobalNamespace) { return qualifiedName.Length == 0; } return HasNamespaceName(@namespace, qualifiedName, comparison, length: qualifiedName.Length); } private static bool HasNamespaceName(NamespaceSymbol @namespace, string namespaceName, StringComparison comparison, int length) { if (length == 0) { return false; } var container = @namespace.ContainingNamespace; int separator = namespaceName.LastIndexOf('.', length - 1, length); int offset = 0; if (separator >= 0) { if (container.IsGlobalNamespace) { return false; } if (!HasNamespaceName(container, namespaceName, comparison, length: separator)) { return false; } int n = separator + 1; offset = n; length -= n; } else if (!container.IsGlobalNamespace) { return false; } var name = @namespace.Name; return (name.Length == length) && (string.Compare(name, 0, namespaceName, offset, length, comparison) == 0); } internal static bool IsNonGenericTaskType(this TypeSymbol type, CSharpCompilation compilation) { var namedType = type as NamedTypeSymbol; if (namedType is null || namedType.Arity != 0) { return false; } if ((object)namedType == compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task)) { return true; } if (namedType.IsVoidType()) { return false; } return namedType.IsCustomTaskType(builderArgument: out _); } internal static bool IsGenericTaskType(this TypeSymbol type, CSharpCompilation compilation) { if (!(type is NamedTypeSymbol { Arity: 1 } namedType)) { return false; } if ((object)namedType.ConstructedFrom == compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T)) { return true; } return namedType.IsCustomTaskType(builderArgument: out _); } internal static bool IsIAsyncEnumerableType(this TypeSymbol type, CSharpCompilation compilation) { if (!(type is NamedTypeSymbol { Arity: 1 } namedType)) { return false; } return (object)namedType.ConstructedFrom == compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T); } internal static bool IsIAsyncEnumeratorType(this TypeSymbol type, CSharpCompilation compilation) { if (!(type is NamedTypeSymbol { Arity: 1 } namedType)) { return false; } return (object)namedType.ConstructedFrom == compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerator_T); } /// <summary> /// Returns true if the type is generic or non-generic custom task-like type due to the /// [AsyncMethodBuilder(typeof(B))] attribute. It returns the "B". /// </summary> /// <remarks> /// For the Task types themselves, this method might return true or false depending on mscorlib. /// The definition of "custom task-like type" is one that has an [AsyncMethodBuilder(typeof(B))] attribute, /// no more, no less. Validation of builder type B is left for elsewhere. This method returns B /// without validation of any kind. /// </remarks> internal static bool IsCustomTaskType(this NamedTypeSymbol type, [NotNullWhen(true)] out object? builderArgument) { RoslynDebug.Assert((object)type != null); var arity = type.Arity; if (arity < 2) { return type.HasAsyncMethodBuilderAttribute(out builderArgument); } builderArgument = null; return false; } /// <summary> /// Replace Task-like types with Task types. /// </summary> internal static TypeSymbol NormalizeTaskTypes(this TypeSymbol type, CSharpCompilation compilation) { NormalizeTaskTypesInType(compilation, ref type); return type; } /// <summary> /// Replace Task-like types with Task types. Returns true if there were changes. /// </summary> private static bool NormalizeTaskTypesInType(CSharpCompilation compilation, ref TypeSymbol type) { switch (type.Kind) { case SymbolKind.NamedType: case SymbolKind.ErrorType: { var namedType = (NamedTypeSymbol)type; var changed = NormalizeTaskTypesInNamedType(compilation, ref namedType); type = namedType; return changed; } case SymbolKind.ArrayType: { var arrayType = (ArrayTypeSymbol)type; var changed = NormalizeTaskTypesInArray(compilation, ref arrayType); type = arrayType; return changed; } case SymbolKind.PointerType: { var pointerType = (PointerTypeSymbol)type; var changed = NormalizeTaskTypesInPointer(compilation, ref pointerType); type = pointerType; return changed; } case SymbolKind.FunctionPointerType: { var functionPointerType = (FunctionPointerTypeSymbol)type; var changed = NormalizeTaskTypesInFunctionPointer(compilation, ref functionPointerType); type = functionPointerType; return changed; } } return false; } private static bool NormalizeTaskTypesInType(CSharpCompilation compilation, ref TypeWithAnnotations typeWithAnnotations) { var type = typeWithAnnotations.Type; if (NormalizeTaskTypesInType(compilation, ref type)) { typeWithAnnotations = TypeWithAnnotations.Create(type, customModifiers: typeWithAnnotations.CustomModifiers); return true; } return false; } private static bool NormalizeTaskTypesInNamedType(CSharpCompilation compilation, ref NamedTypeSymbol type) { bool hasChanged = false; if (!type.IsDefinition) { RoslynDebug.Assert(type.IsGenericType); var typeArgumentsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(); var discardedUseSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded; type.GetAllTypeArguments(typeArgumentsBuilder, ref discardedUseSiteInfo); for (int i = 0; i < typeArgumentsBuilder.Count; i++) { var typeWithModifier = typeArgumentsBuilder[i]; var typeArgNormalized = typeWithModifier.Type; if (NormalizeTaskTypesInType(compilation, ref typeArgNormalized)) { hasChanged = true; // Preserve custom modifiers but without normalizing those types. typeArgumentsBuilder[i] = TypeWithAnnotations.Create(typeArgNormalized, customModifiers: typeWithModifier.CustomModifiers); } } if (hasChanged) { var originalType = type; var originalDefinition = originalType.OriginalDefinition; var typeParameters = originalDefinition.GetAllTypeParameters(); var typeMap = new TypeMap(typeParameters, typeArgumentsBuilder.ToImmutable(), allowAlpha: true); type = typeMap.SubstituteNamedType(originalDefinition).WithTupleDataFrom(originalType); } typeArgumentsBuilder.Free(); } if (type.OriginalDefinition.IsCustomTaskType(builderArgument: out _)) { int arity = type.Arity; RoslynDebug.Assert(arity < 2); var taskType = compilation.GetWellKnownType( arity == 0 ? WellKnownType.System_Threading_Tasks_Task : WellKnownType.System_Threading_Tasks_Task_T); if (taskType.TypeKind == TypeKind.Error) { // Skip if Task types are not available. return false; } type = arity == 0 ? taskType : taskType.Construct( ImmutableArray.Create(type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]), unbound: false); hasChanged = true; } return hasChanged; } private static bool NormalizeTaskTypesInArray(CSharpCompilation compilation, ref ArrayTypeSymbol arrayType) { var elementType = arrayType.ElementTypeWithAnnotations; if (!NormalizeTaskTypesInType(compilation, ref elementType)) { return false; } arrayType = arrayType.WithElementType(elementType); return true; } private static bool NormalizeTaskTypesInPointer(CSharpCompilation compilation, ref PointerTypeSymbol pointerType) { var pointedAtType = pointerType.PointedAtTypeWithAnnotations; if (!NormalizeTaskTypesInType(compilation, ref pointedAtType)) { return false; } // Preserve custom modifiers but without normalizing those types. pointerType = new PointerTypeSymbol(pointedAtType); return true; } private static bool NormalizeTaskTypesInFunctionPointer(CSharpCompilation compilation, ref FunctionPointerTypeSymbol funcPtrType) { var returnType = funcPtrType.Signature.ReturnTypeWithAnnotations; var madeChanges = NormalizeTaskTypesInType(compilation, ref returnType); var paramTypes = ImmutableArray<TypeWithAnnotations>.Empty; if (funcPtrType.Signature.ParameterCount > 0) { var paramsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(funcPtrType.Signature.ParameterCount); bool madeParamChanges = false; foreach (var param in funcPtrType.Signature.Parameters) { var paramType = param.TypeWithAnnotations; madeParamChanges |= NormalizeTaskTypesInType(compilation, ref paramType); paramsBuilder.Add(paramType); } if (madeParamChanges) { madeChanges = true; paramTypes = paramsBuilder.ToImmutableAndFree(); } else { paramTypes = funcPtrType.Signature.ParameterTypesWithAnnotations; paramsBuilder.Free(); } } if (madeChanges) { funcPtrType = funcPtrType.SubstituteTypeSymbol(returnType, paramTypes, refCustomModifiers: default, paramRefCustomModifiers: default); return true; } else { return false; } } internal static Cci.TypeReferenceWithAttributes GetTypeRefWithAttributes( this TypeWithAnnotations type, Emit.PEModuleBuilder moduleBuilder, Symbol declaringSymbol, Cci.ITypeReference typeRef) { var builder = ArrayBuilder<Cci.ICustomAttribute>.GetInstance(); var compilation = declaringSymbol.DeclaringCompilation; if (compilation != null) { if (type.Type.ContainsTupleNames()) { addIfNotNull(builder, compilation.SynthesizeTupleNamesAttribute(type.Type)); } if (type.Type.ContainsNativeInteger()) { addIfNotNull(builder, moduleBuilder.SynthesizeNativeIntegerAttribute(declaringSymbol, type.Type)); } if (compilation.ShouldEmitNullableAttributes(declaringSymbol)) { addIfNotNull(builder, moduleBuilder.SynthesizeNullableAttributeIfNecessary(declaringSymbol, declaringSymbol.GetNullableContextValue(), type)); } static void addIfNotNull(ArrayBuilder<Cci.ICustomAttribute> builder, SynthesizedAttributeData? attr) { if (attr != null) { builder.Add(attr); } } } return new Cci.TypeReferenceWithAttributes(typeRef, builder.ToImmutableAndFree()); } internal static bool IsWellKnownTypeInAttribute(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownInteropServicesTopLevelType("InAttribute"); internal static bool IsWellKnownTypeUnmanagedType(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownInteropServicesTopLevelType("UnmanagedType"); internal static bool IsWellKnownTypeIsExternalInit(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownCompilerServicesTopLevelType("IsExternalInit"); internal static bool IsWellKnownTypeOutAttribute(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownInteropServicesTopLevelType("OutAttribute"); private static bool IsWellKnownInteropServicesTopLevelType(this TypeSymbol typeSymbol, string name) { if (typeSymbol.Name != name || typeSymbol.ContainingType is object) { return false; } return IsContainedInNamespace(typeSymbol, "System", "Runtime", "InteropServices"); } private static bool IsWellKnownCompilerServicesTopLevelType(this TypeSymbol typeSymbol, string name) { if (typeSymbol.Name != name) { return false; } return IsCompilerServicesTopLevelType(typeSymbol); } internal static bool IsCompilerServicesTopLevelType(this TypeSymbol typeSymbol) => typeSymbol.ContainingType is null && IsContainedInNamespace(typeSymbol, "System", "Runtime", "CompilerServices"); private static bool IsContainedInNamespace(this TypeSymbol typeSymbol, string outerNS, string midNS, string innerNS) { var innerNamespace = typeSymbol.ContainingNamespace; if (innerNamespace?.Name != innerNS) { return false; } var midNamespace = innerNamespace.ContainingNamespace; if (midNamespace?.Name != midNS) { return false; } var outerNamespace = midNamespace.ContainingNamespace; if (outerNamespace?.Name != outerNS) { return false; } var globalNamespace = outerNamespace.ContainingNamespace; return globalNamespace != null && globalNamespace.IsGlobalNamespace; } internal static int TypeToIndex(this TypeSymbol type) { switch (type.GetSpecialTypeSafe()) { case SpecialType.System_Object: return 0; case SpecialType.System_String: return 1; case SpecialType.System_Boolean: return 2; case SpecialType.System_Char: return 3; case SpecialType.System_SByte: return 4; case SpecialType.System_Int16: return 5; case SpecialType.System_Int32: return 6; case SpecialType.System_Int64: return 7; case SpecialType.System_Byte: return 8; case SpecialType.System_UInt16: return 9; case SpecialType.System_UInt32: return 10; case SpecialType.System_UInt64: return 11; case SpecialType.System_IntPtr when type.IsNativeIntegerType: return 12; case SpecialType.System_UIntPtr when type.IsNativeIntegerType: return 13; case SpecialType.System_Single: return 14; case SpecialType.System_Double: return 15; case SpecialType.System_Decimal: return 16; case SpecialType.None: if ((object)type != null && type.IsNullableType()) { TypeSymbol underlyingType = type.GetNullableUnderlyingType(); switch (underlyingType.GetSpecialTypeSafe()) { case SpecialType.System_Boolean: return 17; case SpecialType.System_Char: return 18; case SpecialType.System_SByte: return 19; case SpecialType.System_Int16: return 20; case SpecialType.System_Int32: return 21; case SpecialType.System_Int64: return 22; case SpecialType.System_Byte: return 23; case SpecialType.System_UInt16: return 24; case SpecialType.System_UInt32: return 25; case SpecialType.System_UInt64: return 26; case SpecialType.System_IntPtr when underlyingType.IsNativeIntegerType: return 27; case SpecialType.System_UIntPtr when underlyingType.IsNativeIntegerType: return 28; case SpecialType.System_Single: return 29; case SpecialType.System_Double: return 30; case SpecialType.System_Decimal: return 31; } } // fall through goto default; default: return -1; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal static partial class TypeSymbolExtensions { public static bool ImplementsInterface(this TypeSymbol subType, TypeSymbol superInterface, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { foreach (NamedTypeSymbol @interface in subType.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo)) { if (@interface.IsInterface && TypeSymbol.Equals(@interface, superInterface, TypeCompareKind.ConsiderEverything2)) { return true; } } return false; } public static bool CanBeAssignedNull(this TypeSymbol type) { return type.IsReferenceType || type.IsPointerOrFunctionPointer() || type.IsNullableType(); } public static bool CanContainNull(this TypeSymbol type) { // unbound type parameters might contain null, even though they cannot be *assigned* null. return !type.IsValueType || type.IsNullableTypeOrTypeParameter(); } public static bool CanBeConst(this TypeSymbol typeSymbol) { RoslynDebug.Assert((object)typeSymbol != null); return typeSymbol.IsReferenceType || typeSymbol.IsEnumType() || typeSymbol.SpecialType.CanBeConst() || typeSymbol.IsNativeIntegerType; } /// <summary> /// Assuming that nullable annotations are enabled: /// T => true /// T where T : struct => false /// T where T : class => false /// T where T : class? => true /// T where T : IComparable => true /// T where T : IComparable? => true /// T where T : notnull => true /// </summary> /// <remarks> /// In C#9, annotations are allowed regardless of constraints. /// </remarks> public static bool IsTypeParameterDisallowingAnnotationInCSharp8(this TypeSymbol type) { if (type.TypeKind != TypeKind.TypeParameter) { return false; } var typeParameter = (TypeParameterSymbol)type; // https://github.com/dotnet/roslyn/issues/30056: Test `where T : unmanaged`. See // UninitializedNonNullableFieldTests.TypeParameterConstraints for instance. return !typeParameter.IsValueType && !(typeParameter.IsReferenceType && typeParameter.IsNotNullable == true); } /// <summary> /// Assuming that nullable annotations are enabled: /// T => true /// T where T : struct => false /// T where T : class => false /// T where T : class? => true /// T where T : IComparable => false /// T where T : IComparable? => true /// </summary> public static bool IsPossiblyNullableReferenceTypeTypeParameter(this TypeSymbol type) { return type is TypeParameterSymbol { IsValueType: false, IsNotNullable: false }; } public static bool IsNonNullableValueType(this TypeSymbol typeArgument) { if (!typeArgument.IsValueType) { return false; } return !IsNullableTypeOrTypeParameter(typeArgument); } public static bool IsVoidType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_Void; } public static bool IsNullableTypeOrTypeParameter(this TypeSymbol? type) { if (type is null) { return false; } if (type.TypeKind == TypeKind.TypeParameter) { var constraintTypes = ((TypeParameterSymbol)type).ConstraintTypesNoUseSiteDiagnostics; foreach (var constraintType in constraintTypes) { if (constraintType.Type.IsNullableTypeOrTypeParameter()) { return true; } } return false; } return type.IsNullableType(); } /// <summary> /// Is this System.Nullable`1 type, or its substitution. /// /// To check whether a type is System.Nullable`1 or is a type parameter constrained to System.Nullable`1 /// use <see cref="TypeSymbolExtensions.IsNullableTypeOrTypeParameter" /> instead. /// </summary> public static bool IsNullableType(this TypeSymbol type) { return type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T; } public static TypeSymbol GetNullableUnderlyingType(this TypeSymbol type) { return type.GetNullableUnderlyingTypeWithAnnotations().Type; } public static TypeWithAnnotations GetNullableUnderlyingTypeWithAnnotations(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); RoslynDebug.Assert(IsNullableType(type)); RoslynDebug.Assert(type is NamedTypeSymbol); //not testing Kind because it may be an ErrorType return ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]; } public static TypeSymbol StrippedType(this TypeSymbol type) { return type.IsNullableType() ? type.GetNullableUnderlyingType() : type; } public static TypeSymbol EnumUnderlyingTypeOrSelf(this TypeSymbol type) { return type.GetEnumUnderlyingType() ?? type; } public static bool IsNativeIntegerOrNullableNativeIntegerType(this TypeSymbol? type) { return type?.StrippedType().IsNativeIntegerType == true; } public static bool IsObjectType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_Object; } public static bool IsStringType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_String; } public static bool IsCharType(this TypeSymbol type) { return type.SpecialType == SpecialType.System_Char; } public static bool IsIntegralType(this TypeSymbol type) { return type.SpecialType.IsIntegralType(); } public static NamedTypeSymbol? GetEnumUnderlyingType(this TypeSymbol? type) { return (type is NamedTypeSymbol namedType) ? namedType.EnumUnderlyingType : null; } public static bool IsEnumType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Enum; } public static bool IsValidEnumType(this TypeSymbol type) { var underlyingType = type.GetEnumUnderlyingType(); // SpecialType will be None if the underlying type is invalid. return (underlyingType is object) && (underlyingType.SpecialType != SpecialType.None); } /// <summary> /// Determines if the given type is a valid attribute parameter type. /// </summary> /// <param name="type">Type to validated</param> /// <param name="compilation">compilation</param> /// <returns></returns> public static bool IsValidAttributeParameterType(this TypeSymbol type, CSharpCompilation compilation) { return GetAttributeParameterTypedConstantKind(type, compilation) != TypedConstantKind.Error; } /// <summary> /// Gets the typed constant kind for the given attribute parameter type. /// </summary> /// <param name="type">Type to validated</param> /// <param name="compilation">compilation</param> /// <returns>TypedConstantKind for the attribute parameter type.</returns> public static TypedConstantKind GetAttributeParameterTypedConstantKind(this TypeSymbol type, CSharpCompilation compilation) { // Spec (17.1.3) // The types of positional and named parameters for an attribute class are limited to the attribute parameter types, which are: // 1) One of the following types: bool, byte, char, double, float, int, long, sbyte, short, string, uint, ulong, ushort. // 2) The type object. // 3) The type System.Type. // 4) An enum type, provided it has public accessibility and the types in which it is nested (if any) also have public accessibility. // 5) Single-dimensional arrays of the above types. // A constructor argument or public field which does not have one of these types, cannot be used as a positional // or named parameter in an attribute specification. TypedConstantKind kind = TypedConstantKind.Error; if ((object)type == null) { return TypedConstantKind.Error; } if (type.Kind == SymbolKind.ArrayType) { var arrayType = (ArrayTypeSymbol)type; if (!arrayType.IsSZArray) { return TypedConstantKind.Error; } kind = TypedConstantKind.Array; type = arrayType.ElementType; } // enum or enum[] if (type.IsEnumType()) { // SPEC VIOLATION: Dev11 doesn't enforce either the Enum type or its enclosing types (if any) to have public accessibility. // We will be consistent with Dev11 behavior. if (kind == TypedConstantKind.Error) { // set only if kind is not already set (i.e. its not an array of enum) kind = TypedConstantKind.Enum; } type = type.GetEnumUnderlyingType()!; } var typedConstantKind = TypedConstant.GetTypedConstantKind(type, compilation); switch (typedConstantKind) { case TypedConstantKind.Array: case TypedConstantKind.Enum: case TypedConstantKind.Error: return TypedConstantKind.Error; default: if (kind == TypedConstantKind.Array || kind == TypedConstantKind.Enum) { // Array/Enum type with valid element/underlying type return kind; } return typedConstantKind; } } public static bool IsValidExtensionParameterType(this TypeSymbol type) { switch (type.TypeKind) { case TypeKind.Pointer: case TypeKind.Dynamic: case TypeKind.FunctionPointer: return false; default: return true; } } public static bool IsInterfaceType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.Kind == SymbolKind.NamedType && ((NamedTypeSymbol)type).IsInterface; } public static bool IsClassType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Class; } public static bool IsStructType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Struct; } public static bool IsErrorType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.Kind == SymbolKind.ErrorType; } public static bool IsMethodTypeParameter(this TypeParameterSymbol p) { return p.ContainingSymbol.Kind == SymbolKind.Method; } public static bool IsDynamic(this TypeSymbol type) { return type.TypeKind == TypeKind.Dynamic; } public static bool IsTypeParameter(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.TypeParameter; } public static bool IsArray(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Array; } public static bool IsSZArray(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Array && ((ArrayTypeSymbol)type).IsSZArray; } public static bool IsFunctionPointer(this TypeSymbol type) { return type.TypeKind == TypeKind.FunctionPointer; } public static bool IsPointerOrFunctionPointer(this TypeSymbol type) { switch (type.TypeKind) { case TypeKind.Pointer: case TypeKind.FunctionPointer: return true; default: return false; } } // If the type is a delegate type, it returns it. If the type is an // expression tree type associated with a delegate type, it returns // the delegate type. Otherwise, null. public static NamedTypeSymbol? GetDelegateType(this TypeSymbol? type) { if (type is null) return null; if (type.IsExpressionTree()) { type = ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; } return type.IsDelegateType() ? (NamedTypeSymbol)type : null; } public static TypeSymbol? GetDelegateOrFunctionPointerType(this TypeSymbol? type) { return (TypeSymbol?)GetDelegateType(type) ?? type as FunctionPointerTypeSymbol; } /// <summary> /// return true if the type is constructed from System.Linq.Expressions.Expression`1 /// </summary> public static bool IsExpressionTree(this TypeSymbol type) { return type.IsGenericOrNonGenericExpressionType(out bool isGenericType) && isGenericType; } public static bool IsNonGenericExpressionType(this TypeSymbol type) { return type.IsGenericOrNonGenericExpressionType(out bool isGenericType) && !isGenericType; } public static bool IsGenericOrNonGenericExpressionType(this TypeSymbol _type, out bool isGenericType) { if (_type.OriginalDefinition is NamedTypeSymbol type && type.Name == "Expression" && CheckFullName(type.ContainingSymbol, s_expressionsNamespaceName)) { if (type.Arity == 0) { isGenericType = false; return true; } if (type.Arity == 1 && type.MangleName) { isGenericType = true; return true; } } isGenericType = false; return false; } /// <summary> /// return true if the type is constructed from a generic interface that /// might be implemented by an array. /// </summary> public static bool IsPossibleArrayGenericInterface(this TypeSymbol type) { if (!(type is NamedTypeSymbol t)) { return false; } t = t.OriginalDefinition; SpecialType st = t.SpecialType; if (st == SpecialType.System_Collections_Generic_IList_T || st == SpecialType.System_Collections_Generic_ICollection_T || st == SpecialType.System_Collections_Generic_IEnumerable_T || st == SpecialType.System_Collections_Generic_IReadOnlyList_T || st == SpecialType.System_Collections_Generic_IReadOnlyCollection_T) { return true; } return false; } private static readonly string[] s_expressionsNamespaceName = { "Expressions", "Linq", MetadataHelpers.SystemString, "" }; private static bool CheckFullName(Symbol symbol, string[] names) { for (int i = 0; i < names.Length; i++) { if ((object)symbol == null || symbol.Name != names[i]) return false; symbol = symbol.ContainingSymbol; } return true; } public static bool IsDelegateType(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); return type.TypeKind == TypeKind.Delegate; } public static ImmutableArray<ParameterSymbol> DelegateParameters(this TypeSymbol type) { var invokeMethod = type.DelegateInvokeMethod(); if ((object)invokeMethod == null) { return default(ImmutableArray<ParameterSymbol>); } return invokeMethod.Parameters; } public static ImmutableArray<ParameterSymbol> DelegateOrFunctionPointerParameters(this TypeSymbol type) { Debug.Assert(type is FunctionPointerTypeSymbol || type.IsDelegateType()); if (type is FunctionPointerTypeSymbol { Signature: { Parameters: var functionPointerParameters } }) { return functionPointerParameters; } else { return type.DelegateParameters(); } } public static bool TryGetElementTypesWithAnnotationsIfTupleType(this TypeSymbol type, out ImmutableArray<TypeWithAnnotations> elementTypes) { if (type.IsTupleType) { elementTypes = ((NamedTypeSymbol)type).TupleElementTypesWithAnnotations; return true; } // source not a tuple elementTypes = default(ImmutableArray<TypeWithAnnotations>); return false; } public static MethodSymbol DelegateInvokeMethod(this TypeSymbol type) { RoslynDebug.Assert((object)type != null); RoslynDebug.Assert(type.IsDelegateType() || type.IsExpressionTree()); return type.GetDelegateType()!.DelegateInvokeMethod; } /// <summary> /// Return the default value constant for the given type, /// or null if the default value is not a constant. /// </summary> public static ConstantValue? GetDefaultValue(this TypeSymbol type) { // SPEC: A default-value-expression is a constant expression (§7.19) if the type // SPEC: is a reference type or a type parameter that is known to be a reference type (§10.1.5). // SPEC: In addition, a default-value-expression is a constant expression if the type is // SPEC: one of the following value types: // SPEC: sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, or any enumeration type. RoslynDebug.Assert((object)type != null); if (type.IsErrorType()) { return null; } if (type.IsReferenceType) { return ConstantValue.Null; } if (type.IsValueType) { type = type.EnumUnderlyingTypeOrSelf(); switch (type.SpecialType) { case SpecialType.System_SByte: case SpecialType.System_Byte: case SpecialType.System_Int16: case SpecialType.System_UInt16: case SpecialType.System_Int32: case SpecialType.System_UInt32: case SpecialType.System_Int64: case SpecialType.System_UInt64: case SpecialType.System_IntPtr when type.IsNativeIntegerType: case SpecialType.System_UIntPtr when type.IsNativeIntegerType: case SpecialType.System_Char: case SpecialType.System_Boolean: case SpecialType.System_Single: case SpecialType.System_Double: case SpecialType.System_Decimal: return ConstantValue.Default(type.SpecialType); } } return null; } public static SpecialType GetSpecialTypeSafe(this TypeSymbol? type) { return type is object ? type.SpecialType : SpecialType.None; } public static bool IsAtLeastAsVisibleAs(this TypeSymbol type, Symbol sym, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { CompoundUseSiteInfo<AssemblySymbol> localUseSiteInfo = useSiteInfo; var result = type.VisitType((type1, symbol, unused) => IsTypeLessVisibleThan(type1, symbol, ref localUseSiteInfo), sym, canDigThroughNullable: true); // System.Nullable is public useSiteInfo = localUseSiteInfo; return result is null; } private static bool IsTypeLessVisibleThan(TypeSymbol type, Symbol sym, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { switch (type.TypeKind) { case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: case TypeKind.Enum: case TypeKind.Delegate: case TypeKind.Submission: return !IsAsRestrictive((NamedTypeSymbol)type, sym, ref useSiteInfo); default: return false; } } /// <summary> /// Visit the given type and, in the case of compound types, visit all "sub type" /// (such as A in A[], or { A&lt;T&gt;, T, U } in A&lt;T&gt;.B&lt;U&gt;) invoking 'predicate' /// with the type and 'arg' at each sub type. If the predicate returns true for any type, /// traversal stops and that type is returned from this method. Otherwise if traversal /// completes without the predicate returning true for any type, this method returns null. /// </summary> public static TypeSymbol? VisitType<T>( this TypeSymbol type, Func<TypeSymbol, T, bool, bool> predicate, T arg, bool canDigThroughNullable = false) { return VisitType( typeWithAnnotationsOpt: default, type: type, typeWithAnnotationsPredicate: null, typePredicate: predicate, arg, canDigThroughNullable); } /// <summary> /// Visit the given type and, in the case of compound types, visit all "sub type". /// One of the predicates will be invoked at each type. If the type is a /// TypeWithAnnotations, <paramref name="typeWithAnnotationsPredicate"/> /// will be invoked; otherwise <paramref name="typePredicate"/> will be invoked. /// If the corresponding predicate returns true for any type, /// traversal stops and that type is returned from this method. Otherwise if traversal /// completes without the predicate returning true for any type, this method returns null. /// </summary> /// <param name="useDefaultType">If true, use <see cref="TypeWithAnnotations.DefaultType"/> /// instead of <see cref="TypeWithAnnotations.Type"/> to avoid early resolution of nullable types</param> public static TypeSymbol? VisitType<T>( this TypeWithAnnotations typeWithAnnotationsOpt, TypeSymbol? type, Func<TypeWithAnnotations, T, bool, bool>? typeWithAnnotationsPredicate, Func<TypeSymbol, T, bool, bool>? typePredicate, T arg, bool canDigThroughNullable = false, bool useDefaultType = false) { RoslynDebug.Assert(typeWithAnnotationsOpt.HasType == (type is null)); RoslynDebug.Assert(canDigThroughNullable == false || useDefaultType == false, "digging through nullable will cause early resolution of nullable types"); // In order to handle extremely "deep" types like "int[][][][][][][][][]...[]" // or int*****************...* we implement manual tail recursion rather than // doing the natural recursion. while (true) { TypeSymbol current = type ?? (useDefaultType ? typeWithAnnotationsOpt.DefaultType : typeWithAnnotationsOpt.Type); bool isNestedNamedType = false; // Visit containing types from outer-most to inner-most. switch (current.TypeKind) { case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: case TypeKind.Enum: case TypeKind.Delegate: { var containingType = current.ContainingType; if ((object)containingType != null) { isNestedNamedType = true; var result = VisitType(default, containingType, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { return result; } } } break; case TypeKind.Submission: RoslynDebug.Assert((object)current.ContainingType == null); break; } if (typeWithAnnotationsOpt.HasType && typeWithAnnotationsPredicate != null) { if (typeWithAnnotationsPredicate(typeWithAnnotationsOpt, arg, isNestedNamedType)) { return current; } } else if (typePredicate != null) { if (typePredicate(current, arg, isNestedNamedType)) { return current; } } TypeWithAnnotations next; switch (current.TypeKind) { case TypeKind.Dynamic: case TypeKind.TypeParameter: case TypeKind.Submission: case TypeKind.Enum: return null; case TypeKind.Error: case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: case TypeKind.Delegate: var typeArguments = ((NamedTypeSymbol)current).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics; if (typeArguments.IsEmpty) { return null; } int i; for (i = 0; i < typeArguments.Length - 1; i++) { // Let's try to avoid early resolution of nullable types (TypeWithAnnotations nextTypeWithAnnotations, TypeSymbol? nextType) = getNextIterationElements(typeArguments[i], canDigThroughNullable); var result = VisitType( typeWithAnnotationsOpt: nextTypeWithAnnotations, type: nextType, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { return result; } } next = typeArguments[i]; break; case TypeKind.Array: next = ((ArrayTypeSymbol)current).ElementTypeWithAnnotations; break; case TypeKind.Pointer: next = ((PointerTypeSymbol)current).PointedAtTypeWithAnnotations; break; case TypeKind.FunctionPointer: { var result = visitFunctionPointerType((FunctionPointerTypeSymbol)current, typeWithAnnotationsPredicate, typePredicate, arg, useDefaultType, canDigThroughNullable, out next); if (result is object) { return result; } break; } default: throw ExceptionUtilities.UnexpectedValue(current.TypeKind); } // Let's try to avoid early resolution of nullable types typeWithAnnotationsOpt = canDigThroughNullable ? default : next; type = canDigThroughNullable ? next.NullableUnderlyingTypeOrSelf : null; } static (TypeWithAnnotations, TypeSymbol?) getNextIterationElements(TypeWithAnnotations type, bool canDigThroughNullable) => canDigThroughNullable ? (default(TypeWithAnnotations), type.NullableUnderlyingTypeOrSelf) : (type, null); static TypeSymbol? visitFunctionPointerType(FunctionPointerTypeSymbol type, Func<TypeWithAnnotations, T, bool, bool>? typeWithAnnotationsPredicate, Func<TypeSymbol, T, bool, bool>? typePredicate, T arg, bool useDefaultType, bool canDigThroughNullable, out TypeWithAnnotations next) { MethodSymbol currentPointer = type.Signature; if (currentPointer.ParameterCount == 0) { next = currentPointer.ReturnTypeWithAnnotations; return null; } var result = VisitType( typeWithAnnotationsOpt: canDigThroughNullable ? default : currentPointer.ReturnTypeWithAnnotations, type: canDigThroughNullable ? currentPointer.ReturnTypeWithAnnotations.NullableUnderlyingTypeOrSelf : null, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { next = default; return result; } int i; for (i = 0; i < currentPointer.ParameterCount - 1; i++) { (TypeWithAnnotations nextTypeWithAnnotations, TypeSymbol? nextType) = getNextIterationElements(currentPointer.Parameters[i].TypeWithAnnotations, canDigThroughNullable); result = VisitType( typeWithAnnotationsOpt: nextTypeWithAnnotations, type: nextType, typeWithAnnotationsPredicate, typePredicate, arg, canDigThroughNullable, useDefaultType); if (result is object) { next = default; return result; } } next = currentPointer.Parameters[i].TypeWithAnnotations; return null; } } private static bool IsAsRestrictive(NamedTypeSymbol s1, Symbol sym2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) { Accessibility acc1 = s1.DeclaredAccessibility; if (acc1 == Accessibility.Public) { return true; } for (Symbol s2 = sym2; s2.Kind != SymbolKind.Namespace; s2 = s2.ContainingSymbol) { Accessibility acc2 = s2.DeclaredAccessibility; switch (acc1) { case Accessibility.Internal: { // If s2 is private or internal, and within the same assembly as s1, // then this is at least as restrictive as s1's internal. if ((acc2 == Accessibility.Private || acc2 == Accessibility.Internal || acc2 == Accessibility.ProtectedAndInternal) && s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { return true; } break; } case Accessibility.ProtectedAndInternal: // Since s1 is private protected, s2 must pass the test for being both more restrictive than internal and more restrictive than protected. // We first do the "internal" test (copied from above), then if it passes we continue with the "protected" test. if ((acc2 == Accessibility.Private || acc2 == Accessibility.Internal || acc2 == Accessibility.ProtectedAndInternal) && s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { // passed the internal test; now do the test for the protected case goto case Accessibility.Protected; } break; case Accessibility.Protected: { var parent1 = s1.ContainingType; if ((object)parent1 == null) { // not helpful } else if (acc2 == Accessibility.Private) { // if s2 is private and within s1's parent or within a subclass of s1's parent, // then this is at least as restrictive as s1's protected. for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) { if (parent1.IsAccessibleViaInheritance(parent2, ref useSiteInfo)) { return true; } } } else if (acc2 == Accessibility.Protected || acc2 == Accessibility.ProtectedAndInternal) { // if s2 is protected, and it's parent is a subclass (or the same as) s1's parent // then this is at least as restrictive as s1's protected var parent2 = s2.ContainingType; if ((object)parent2 != null && parent1.IsAccessibleViaInheritance(parent2, ref useSiteInfo)) { return true; } } break; } case Accessibility.ProtectedOrInternal: { var parent1 = s1.ContainingType; if ((object)parent1 == null) { break; } switch (acc2) { case Accessibility.Private: // if s2 is private and within a subclass of s1's parent, // or within the same assembly as s1 // then this is at least as restrictive as s1's internal protected. if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { return true; } for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) { if (parent1.IsAccessibleViaInheritance(parent2, ref useSiteInfo)) { return true; } } break; case Accessibility.Internal: // If s2 is in the same assembly as s1, then this is more restrictive // than s1's internal protected. if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly)) { return true; } break; case Accessibility.Protected: // if s2 is protected, and it's parent is a subclass (or the same as) s1's parent // then this is at least as restrictive as s1's internal protected if (parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) { return true; } break; case Accessibility.ProtectedAndInternal: // if s2 is private protected, and it's parent is a subclass (or the same as) s1's parent // or its in the same assembly as s1, then this is at least as restrictive as s1's protected if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly) || parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) { return true; } break; case Accessibility.ProtectedOrInternal: // if s2 is internal protected, and it's parent is a subclass (or the same as) s1's parent // and its in the same assembly as s1, then this is at least as restrictive as s1's protected if (s2.ContainingAssembly.HasInternalAccessTo(s1.ContainingAssembly) && parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) { return true; } break; } break; } case Accessibility.Private: if (acc2 == Accessibility.Private) { // if s2 is private, and it is within s1's parent, then this is at // least as restrictive as s1's private. NamedTypeSymbol parent1 = s1.ContainingType; if ((object)parent1 == null) { break; } var parent1OriginalDefinition = parent1.OriginalDefinition; for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) { if (ReferenceEquals(parent2.OriginalDefinition, parent1OriginalDefinition) || parent1OriginalDefinition.TypeKind == TypeKind.Submission && parent2.TypeKind == TypeKind.Submission) { return true; } } } break; default: throw ExceptionUtilities.UnexpectedValue(acc1); } } return false; } public static bool IsUnboundGenericType(this TypeSymbol type) { return type is NamedTypeSymbol { IsUnboundGenericType: true }; } public static bool IsTopLevelType(this NamedTypeSymbol type) { return (object)type.ContainingType == null; } /// <summary> /// (null TypeParameterSymbol "parameter"): Checks if the given type is a type parameter /// or its referent type is a type parameter (array/pointer) or contains a type parameter (aggregate type) /// (non-null TypeParameterSymbol "parameter"): above + also checks if the type parameter /// is the same as "parameter" /// </summary> public static bool ContainsTypeParameter(this TypeSymbol type, TypeParameterSymbol? parameter = null) { var result = type.VisitType(s_containsTypeParameterPredicate, parameter); return result is object; } private static readonly Func<TypeSymbol, TypeParameterSymbol?, bool, bool> s_containsTypeParameterPredicate = (type, parameter, unused) => type.TypeKind == TypeKind.TypeParameter && (parameter is null || TypeSymbol.Equals(type, parameter, TypeCompareKind.ConsiderEverything2)); public static bool ContainsTypeParameter(this TypeSymbol type, MethodSymbol parameterContainer) { RoslynDebug.Assert((object)parameterContainer != null); var result = type.VisitType(s_isTypeParameterWithSpecificContainerPredicate, parameterContainer); return result is object; } private static readonly Func<TypeSymbol, Symbol, bool, bool> s_isTypeParameterWithSpecificContainerPredicate = (type, parameterContainer, unused) => type.TypeKind == TypeKind.TypeParameter && (object)type.ContainingSymbol == (object)parameterContainer; public static bool ContainsTypeParameters(this TypeSymbol type, HashSet<TypeParameterSymbol> parameters) { var result = type.VisitType(s_containsTypeParametersPredicate, parameters); return result is object; } private static readonly Func<TypeSymbol, HashSet<TypeParameterSymbol>, bool, bool> s_containsTypeParametersPredicate = (type, parameters, unused) => type.TypeKind == TypeKind.TypeParameter && parameters.Contains((TypeParameterSymbol)type); public static bool ContainsMethodTypeParameter(this TypeSymbol type) { var result = type.VisitType(s_containsMethodTypeParameterPredicate, null); return result is object; } private static readonly Func<TypeSymbol, object?, bool, bool> s_containsMethodTypeParameterPredicate = (type, _, _) => type.TypeKind == TypeKind.TypeParameter && type.ContainingSymbol is MethodSymbol; /// <summary> /// Return true if the type contains any dynamic type reference. /// </summary> public static bool ContainsDynamic(this TypeSymbol type) { var result = type.VisitType(s_containsDynamicPredicate, null, canDigThroughNullable: true); return result is object; } private static readonly Func<TypeSymbol, object?, bool, bool> s_containsDynamicPredicate = (type, unused1, unused2) => type.TypeKind == TypeKind.Dynamic; internal static bool ContainsNativeInteger(this TypeSymbol type) { var result = type.VisitType((type, unused1, unused2) => type.IsNativeIntegerType, (object?)null, canDigThroughNullable: true); return result is object; } internal static bool ContainsNativeInteger(this TypeWithAnnotations type) { return type.Type?.ContainsNativeInteger() == true; } internal static bool ContainsErrorType(this TypeSymbol type) { var result = type.VisitType((type, unused1, unused2) => type.IsErrorType(), (object?)null, canDigThroughNullable: true); return result is object; } /// <summary> /// Return true if the type contains any tuples. /// </summary> internal static bool ContainsTuple(this TypeSymbol type) => type.VisitType((TypeSymbol t, object? _1, bool _2) => t.IsTupleType, null) is object; /// <summary> /// Return true if the type contains any tuples with element names. /// </summary> internal static bool ContainsTupleNames(this TypeSymbol type) => type.VisitType((TypeSymbol t, object? _1, bool _2) => !t.TupleElementNames.IsDefault, null) is object; /// <summary> /// Return true if the type contains any function pointer types. /// </summary> internal static bool ContainsFunctionPointer(this TypeSymbol type) => type.VisitType((TypeSymbol t, object? _, bool _) => t.IsFunctionPointer(), null) is object; /// <summary> /// Guess the non-error type that the given type was intended to represent. /// If the type itself is not an error type, then it will be returned. /// Otherwise, the underlying type (if any) of the error type will be /// returned. /// </summary> /// <remarks> /// Any non-null type symbol returned is guaranteed not to be an error type. /// /// It is possible to pass in a constructed type and received back an /// unconstructed type. This can occur when the type passed in was /// constructed from an error type - the underlying definition will be /// available, but there won't be a good way to "re-substitute" back up /// to the level of the specified type. /// </remarks> internal static TypeSymbol? GetNonErrorGuess(this TypeSymbol type) { var result = ExtendedErrorTypeSymbol.ExtractNonErrorType(type); RoslynDebug.Assert((object?)result == null || !result.IsErrorType()); return result; } /// <summary> /// Guess the non-error type kind that the given type was intended to represent, /// if possible. If not, return TypeKind.Error. /// </summary> internal static TypeKind GetNonErrorTypeKindGuess(this TypeSymbol type) { return ExtendedErrorTypeSymbol.ExtractNonErrorTypeKind(type); } /// <summary> /// Returns true if the type was a valid switch expression type in C# 6. We use this test to determine /// whether or not we should attempt a user-defined conversion from the type to a C# 6 switch governing /// type, which we support for compatibility with C# 6 and earlier. /// </summary> internal static bool IsValidV6SwitchGoverningType(this TypeSymbol type, bool isTargetTypeOfUserDefinedOp = false) { // SPEC: The governing type of a switch statement is established by the switch expression. // SPEC: 1) If the type of the switch expression is sbyte, byte, short, ushort, int, uint, // SPEC: long, ulong, bool, char, string, or an enum-type, or if it is the nullable type // SPEC: corresponding to one of these types, then that is the governing type of the switch statement. // SPEC: 2) Otherwise, exactly one user-defined implicit conversion must exist from the // SPEC: type of the switch expression to one of the following possible governing types: // SPEC: sbyte, byte, short, ushort, int, uint, long, ulong, char, string, or, a nullable type // SPEC: corresponding to one of those types RoslynDebug.Assert((object)type != null); if (type.IsNullableType()) { type = type.GetNullableUnderlyingType(); } // User-defined implicit conversion with target type as Enum type is not valid. if (!isTargetTypeOfUserDefinedOp) { type = type.EnumUnderlyingTypeOrSelf(); } switch (type.SpecialType) { case SpecialType.System_SByte: case SpecialType.System_Byte: case SpecialType.System_Int16: case SpecialType.System_UInt16: case SpecialType.System_Int32: case SpecialType.System_UInt32: case SpecialType.System_Int64: case SpecialType.System_UInt64: case SpecialType.System_Char: case SpecialType.System_String: return true; case SpecialType.System_Boolean: // User-defined implicit conversion with target type as bool type is not valid. return !isTargetTypeOfUserDefinedOp; } return false; } #pragma warning disable CA1200 // Avoid using cref tags with a prefix /// <summary> /// Returns true if the type is one of the restricted types, namely: <see cref="T:System.TypedReference"/>, /// <see cref="T:System.ArgIterator"/>, or <see cref="T:System.RuntimeArgumentHandle"/>. /// or a ref-like type. /// </summary> #pragma warning restore CA1200 // Avoid using cref tags with a prefix internal static bool IsRestrictedType(this TypeSymbol type, bool ignoreSpanLikeTypes = false) { // See Dev10 C# compiler, "type.cpp", bool Type::isSpecialByRefType() const RoslynDebug.Assert((object)type != null); switch (type.SpecialType) { case SpecialType.System_TypedReference: case SpecialType.System_ArgIterator: case SpecialType.System_RuntimeArgumentHandle: return true; } return ignoreSpanLikeTypes ? false : type.IsRefLikeType; } public static bool IsIntrinsicType(this TypeSymbol type) { switch (type.SpecialType) { case SpecialType.System_Boolean: case SpecialType.System_Char: case SpecialType.System_SByte: case SpecialType.System_Int16: case SpecialType.System_Int32: case SpecialType.System_Int64: case SpecialType.System_Byte: case SpecialType.System_UInt16: case SpecialType.System_UInt32: case SpecialType.System_UInt64: case SpecialType.System_IntPtr when type.IsNativeIntegerType: case SpecialType.System_UIntPtr when type.IsNativeIntegerType: case SpecialType.System_Single: case SpecialType.System_Double: // NOTE: VB treats System.DateTime as an intrinsic, while C# does not. //case SpecialType.System_DateTime: case SpecialType.System_Decimal: return true; default: return false; } } public static bool IsPartial(this TypeSymbol type) { return type is SourceNamedTypeSymbol { IsPartial: true }; } public static bool IsPointerType(this TypeSymbol type) { return type is PointerTypeSymbol; } internal static int FixedBufferElementSizeInBytes(this TypeSymbol type) { return type.SpecialType.FixedBufferElementSizeInBytes(); } // check that its type is allowed for Volatile internal static bool IsValidVolatileFieldType(this TypeSymbol type) { switch (type.TypeKind) { case TypeKind.Struct: return type.SpecialType.IsValidVolatileFieldType(); case TypeKind.Array: case TypeKind.Class: case TypeKind.Delegate: case TypeKind.Dynamic: case TypeKind.Error: case TypeKind.Interface: case TypeKind.Pointer: case TypeKind.FunctionPointer: return true; case TypeKind.Enum: return ((NamedTypeSymbol)type).EnumUnderlyingType.SpecialType.IsValidVolatileFieldType(); case TypeKind.TypeParameter: return type.IsReferenceType; case TypeKind.Submission: throw ExceptionUtilities.UnexpectedValue(type.TypeKind); } return false; } /// <summary> /// Add this instance to the set of checked types. Returns true /// if this was added, false if the type was already in the set. /// </summary> public static bool MarkCheckedIfNecessary(this TypeSymbol type, ref HashSet<TypeSymbol> checkedTypes) { if (checkedTypes == null) { checkedTypes = new HashSet<TypeSymbol>(); } return checkedTypes.Add(type); } internal static bool IsUnsafe(this TypeSymbol type) { while (true) { switch (type.TypeKind) { case TypeKind.Pointer: case TypeKind.FunctionPointer: return true; case TypeKind.Array: type = ((ArrayTypeSymbol)type).ElementType; break; default: // NOTE: we could consider a generic type with unsafe type arguments to be unsafe, // but that's already an error, so there's no reason to report it. Also, this // matches Type::isUnsafe in Dev10. return false; } } } internal static bool IsVoidPointer(this TypeSymbol type) { return type is PointerTypeSymbol p && p.PointedAtType.IsVoidType(); } /// <summary> /// These special types are structs that contain fields of the same type /// (e.g. <see cref="System.Int32"/> contains an instance field of type <see cref="System.Int32"/>). /// </summary> internal static bool IsPrimitiveRecursiveStruct(this TypeSymbol t) { return t.SpecialType.IsPrimitiveRecursiveStruct(); } /// <summary> /// Compute a hash code for the constructed type. The return value will be /// non-zero so callers can used zero to represent an uninitialized value. /// </summary> internal static int ComputeHashCode(this NamedTypeSymbol type) { RoslynDebug.Assert(!type.Equals(type.OriginalDefinition, TypeCompareKind.AllIgnoreOptions) || wasConstructedForAnnotations(type)); if (wasConstructedForAnnotations(type)) { // A type that uses its own type parameters as type arguments was constructed only for the purpose of adding annotations. // In that case we'll use the hash from the definition. return type.OriginalDefinition.GetHashCode(); } int code = type.OriginalDefinition.GetHashCode(); code = Hash.Combine(type.ContainingType, code); // Unconstructed type may contain alpha-renamed type parameters while // may still be considered equal, we do not want to give different hashcode to such types. // // Example: // Having original type A<U>.B<V> we create two _unconstructed_ types // A<int>.B<V'> // A<int>.B<V"> // Note that V' and V" are type parameters substituted via alpha-renaming of original V // These are different objects, but represent the same "type parameter at index 1" // // In short - we are not interested in the type parameters of unconstructed types. if ((object)type.ConstructedFrom != (object)type) { foreach (var arg in type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics) { code = Hash.Combine(arg.Type, code); } } // 0 may be used by the caller to indicate the hashcode is not // initialized. If we computed 0 for the hashcode, tweak it. if (code == 0) { code++; } return code; static bool wasConstructedForAnnotations(NamedTypeSymbol type) { do { var typeArguments = type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics; var typeParameters = type.OriginalDefinition.TypeParameters; for (int i = 0; i < typeArguments.Length; i++) { if (!typeParameters[i].Equals( typeArguments[i].Type.OriginalDefinition, TypeCompareKind.ConsiderEverything)) { return false; } } type = type.ContainingType; } while (type is object && !type.IsDefinition); return true; } } /// <summary> /// If we are in a COM PIA with embedInteropTypes enabled we should turn properties and methods /// that have the type and return type of object, respectively, into type dynamic. If the requisite conditions /// are fulfilled, this method returns a dynamic type. If not, it returns the original type. /// </summary> /// <param name="type">A property type or method return type to be checked for dynamification.</param> /// <param name="containingType">Containing type.</param> /// <returns></returns> public static TypeSymbol AsDynamicIfNoPia(this TypeSymbol type, NamedTypeSymbol containingType) { return type.TryAsDynamicIfNoPia(containingType, out TypeSymbol? result) ? result : type; } public static bool TryAsDynamicIfNoPia(this TypeSymbol type, NamedTypeSymbol containingType, [NotNullWhen(true)] out TypeSymbol? result) { if (type.SpecialType == SpecialType.System_Object) { AssemblySymbol assembly = containingType.ContainingAssembly; if ((object)assembly != null && assembly.IsLinked && containingType.IsComImport) { result = DynamicTypeSymbol.Instance; return true; } } result = null; return false; } /// <summary> /// Type variables are never considered reference types by the verifier. /// </summary> internal static bool IsVerifierReference(this TypeSymbol type) { return type.IsReferenceType && type.TypeKind != TypeKind.TypeParameter; } /// <summary> /// Type variables are never considered value types by the verifier. /// </summary> internal static bool IsVerifierValue(this TypeSymbol type) { return type.IsValueType && type.TypeKind != TypeKind.TypeParameter; } /// <summary> /// Return all of the type parameters in this type and enclosing types, /// from outer-most to inner-most type. /// </summary> internal static ImmutableArray<TypeParameterSymbol> GetAllTypeParameters(this NamedTypeSymbol type) { // Avoid allocating a builder in the common case. if ((object)type.ContainingType == null) { return type.TypeParameters; } var builder = ArrayBuilder<TypeParameterSymbol>.GetInstance(); type.GetAllTypeParameters(builder); return builder.ToImmutableAndFree(); } /// <summary> /// Return all of the type parameters in this type and enclosing types, /// from outer-most to inner-most type. /// </summary> internal static void GetAllTypeParameters(this NamedTypeSymbol type, ArrayBuilder<TypeParameterSymbol> result) { var containingType = type.ContainingType; if ((object)containingType != null) { containingType.GetAllTypeParameters(result); } result.AddRange(type.TypeParameters); } /// <summary> /// Return the nearest type parameter with the given name in /// this type or any enclosing type. /// </summary> internal static TypeParameterSymbol? FindEnclosingTypeParameter(this NamedTypeSymbol type, string name) { var allTypeParameters = ArrayBuilder<TypeParameterSymbol>.GetInstance(); type.GetAllTypeParameters(allTypeParameters); TypeParameterSymbol? result = null; foreach (TypeParameterSymbol tpEnclosing in allTypeParameters) { if (name == tpEnclosing.Name) { result = tpEnclosing; break; } } allTypeParameters.Free(); return result; } /// <summary> /// Return the nearest type parameter with the given name in /// this symbol or any enclosing symbol. /// </summary> internal static TypeParameterSymbol? FindEnclosingTypeParameter(this Symbol methodOrType, string name) { while (methodOrType != null) { switch (methodOrType.Kind) { case SymbolKind.Method: case SymbolKind.NamedType: case SymbolKind.ErrorType: case SymbolKind.Field: case SymbolKind.Property: case SymbolKind.Event: break; default: return null; } foreach (var typeParameter in methodOrType.GetMemberTypeParameters()) { if (typeParameter.Name == name) { return typeParameter; } } methodOrType = methodOrType.ContainingSymbol; } return null; } /// <summary> /// Return true if the fully qualified name of the type's containing symbol /// matches the given name. This method avoids string concatenations /// in the common case where the type is a top-level type. /// </summary> internal static bool HasNameQualifier(this NamedTypeSymbol type, string qualifiedName) { const StringComparison comparison = StringComparison.Ordinal; var container = type.ContainingSymbol; if (container.Kind != SymbolKind.Namespace) { // Nested type. For simplicity, compare qualified name to SymbolDisplay result. return string.Equals(container.ToDisplayString(SymbolDisplayFormat.QualifiedNameOnlyFormat), qualifiedName, comparison); } var @namespace = (NamespaceSymbol)container; if (@namespace.IsGlobalNamespace) { return qualifiedName.Length == 0; } return HasNamespaceName(@namespace, qualifiedName, comparison, length: qualifiedName.Length); } private static bool HasNamespaceName(NamespaceSymbol @namespace, string namespaceName, StringComparison comparison, int length) { if (length == 0) { return false; } var container = @namespace.ContainingNamespace; int separator = namespaceName.LastIndexOf('.', length - 1, length); int offset = 0; if (separator >= 0) { if (container.IsGlobalNamespace) { return false; } if (!HasNamespaceName(container, namespaceName, comparison, length: separator)) { return false; } int n = separator + 1; offset = n; length -= n; } else if (!container.IsGlobalNamespace) { return false; } var name = @namespace.Name; return (name.Length == length) && (string.Compare(name, 0, namespaceName, offset, length, comparison) == 0); } internal static bool IsNonGenericTaskType(this TypeSymbol type, CSharpCompilation compilation) { var namedType = type as NamedTypeSymbol; if (namedType is null || namedType.Arity != 0) { return false; } if ((object)namedType == compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task)) { return true; } if (namedType.IsVoidType()) { return false; } return namedType.IsCustomTaskType(builderArgument: out _); } internal static bool IsGenericTaskType(this TypeSymbol type, CSharpCompilation compilation) { if (!(type is NamedTypeSymbol { Arity: 1 } namedType)) { return false; } if ((object)namedType.ConstructedFrom == compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T)) { return true; } return namedType.IsCustomTaskType(builderArgument: out _); } internal static bool IsIAsyncEnumerableType(this TypeSymbol type, CSharpCompilation compilation) { if (!(type is NamedTypeSymbol { Arity: 1 } namedType)) { return false; } return (object)namedType.ConstructedFrom == compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T); } internal static bool IsIAsyncEnumeratorType(this TypeSymbol type, CSharpCompilation compilation) { if (!(type is NamedTypeSymbol { Arity: 1 } namedType)) { return false; } return (object)namedType.ConstructedFrom == compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerator_T); } /// <summary> /// Returns true if the type is generic or non-generic custom task-like type due to the /// [AsyncMethodBuilder(typeof(B))] attribute. It returns the "B". /// </summary> /// <remarks> /// For the Task types themselves, this method might return true or false depending on mscorlib. /// The definition of "custom task-like type" is one that has an [AsyncMethodBuilder(typeof(B))] attribute, /// no more, no less. Validation of builder type B is left for elsewhere. This method returns B /// without validation of any kind. /// </remarks> internal static bool IsCustomTaskType(this NamedTypeSymbol type, [NotNullWhen(true)] out object? builderArgument) { RoslynDebug.Assert((object)type != null); var arity = type.Arity; if (arity < 2) { return type.HasAsyncMethodBuilderAttribute(out builderArgument); } builderArgument = null; return false; } /// <summary> /// Replace Task-like types with Task types. /// </summary> internal static TypeSymbol NormalizeTaskTypes(this TypeSymbol type, CSharpCompilation compilation) { NormalizeTaskTypesInType(compilation, ref type); return type; } /// <summary> /// Replace Task-like types with Task types. Returns true if there were changes. /// </summary> private static bool NormalizeTaskTypesInType(CSharpCompilation compilation, ref TypeSymbol type) { switch (type.Kind) { case SymbolKind.NamedType: case SymbolKind.ErrorType: { var namedType = (NamedTypeSymbol)type; var changed = NormalizeTaskTypesInNamedType(compilation, ref namedType); type = namedType; return changed; } case SymbolKind.ArrayType: { var arrayType = (ArrayTypeSymbol)type; var changed = NormalizeTaskTypesInArray(compilation, ref arrayType); type = arrayType; return changed; } case SymbolKind.PointerType: { var pointerType = (PointerTypeSymbol)type; var changed = NormalizeTaskTypesInPointer(compilation, ref pointerType); type = pointerType; return changed; } case SymbolKind.FunctionPointerType: { var functionPointerType = (FunctionPointerTypeSymbol)type; var changed = NormalizeTaskTypesInFunctionPointer(compilation, ref functionPointerType); type = functionPointerType; return changed; } } return false; } private static bool NormalizeTaskTypesInType(CSharpCompilation compilation, ref TypeWithAnnotations typeWithAnnotations) { var type = typeWithAnnotations.Type; if (NormalizeTaskTypesInType(compilation, ref type)) { typeWithAnnotations = TypeWithAnnotations.Create(type, customModifiers: typeWithAnnotations.CustomModifiers); return true; } return false; } private static bool NormalizeTaskTypesInNamedType(CSharpCompilation compilation, ref NamedTypeSymbol type) { bool hasChanged = false; if (!type.IsDefinition) { RoslynDebug.Assert(type.IsGenericType); var typeArgumentsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(); var discardedUseSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded; type.GetAllTypeArguments(typeArgumentsBuilder, ref discardedUseSiteInfo); for (int i = 0; i < typeArgumentsBuilder.Count; i++) { var typeWithModifier = typeArgumentsBuilder[i]; var typeArgNormalized = typeWithModifier.Type; if (NormalizeTaskTypesInType(compilation, ref typeArgNormalized)) { hasChanged = true; // Preserve custom modifiers but without normalizing those types. typeArgumentsBuilder[i] = TypeWithAnnotations.Create(typeArgNormalized, customModifiers: typeWithModifier.CustomModifiers); } } if (hasChanged) { var originalType = type; var originalDefinition = originalType.OriginalDefinition; var typeParameters = originalDefinition.GetAllTypeParameters(); var typeMap = new TypeMap(typeParameters, typeArgumentsBuilder.ToImmutable(), allowAlpha: true); type = typeMap.SubstituteNamedType(originalDefinition).WithTupleDataFrom(originalType); } typeArgumentsBuilder.Free(); } if (type.OriginalDefinition.IsCustomTaskType(builderArgument: out _)) { int arity = type.Arity; RoslynDebug.Assert(arity < 2); var taskType = compilation.GetWellKnownType( arity == 0 ? WellKnownType.System_Threading_Tasks_Task : WellKnownType.System_Threading_Tasks_Task_T); if (taskType.TypeKind == TypeKind.Error) { // Skip if Task types are not available. return false; } type = arity == 0 ? taskType : taskType.Construct( ImmutableArray.Create(type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]), unbound: false); hasChanged = true; } return hasChanged; } private static bool NormalizeTaskTypesInArray(CSharpCompilation compilation, ref ArrayTypeSymbol arrayType) { var elementType = arrayType.ElementTypeWithAnnotations; if (!NormalizeTaskTypesInType(compilation, ref elementType)) { return false; } arrayType = arrayType.WithElementType(elementType); return true; } private static bool NormalizeTaskTypesInPointer(CSharpCompilation compilation, ref PointerTypeSymbol pointerType) { var pointedAtType = pointerType.PointedAtTypeWithAnnotations; if (!NormalizeTaskTypesInType(compilation, ref pointedAtType)) { return false; } // Preserve custom modifiers but without normalizing those types. pointerType = new PointerTypeSymbol(pointedAtType); return true; } private static bool NormalizeTaskTypesInFunctionPointer(CSharpCompilation compilation, ref FunctionPointerTypeSymbol funcPtrType) { var returnType = funcPtrType.Signature.ReturnTypeWithAnnotations; var madeChanges = NormalizeTaskTypesInType(compilation, ref returnType); var paramTypes = ImmutableArray<TypeWithAnnotations>.Empty; if (funcPtrType.Signature.ParameterCount > 0) { var paramsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(funcPtrType.Signature.ParameterCount); bool madeParamChanges = false; foreach (var param in funcPtrType.Signature.Parameters) { var paramType = param.TypeWithAnnotations; madeParamChanges |= NormalizeTaskTypesInType(compilation, ref paramType); paramsBuilder.Add(paramType); } if (madeParamChanges) { madeChanges = true; paramTypes = paramsBuilder.ToImmutableAndFree(); } else { paramTypes = funcPtrType.Signature.ParameterTypesWithAnnotations; paramsBuilder.Free(); } } if (madeChanges) { funcPtrType = funcPtrType.SubstituteTypeSymbol(returnType, paramTypes, refCustomModifiers: default, paramRefCustomModifiers: default); return true; } else { return false; } } internal static Cci.TypeReferenceWithAttributes GetTypeRefWithAttributes( this TypeWithAnnotations type, Emit.PEModuleBuilder moduleBuilder, Symbol declaringSymbol, Cci.ITypeReference typeRef) { var builder = ArrayBuilder<Cci.ICustomAttribute>.GetInstance(); var compilation = declaringSymbol.DeclaringCompilation; if (compilation != null) { if (type.Type.ContainsTupleNames()) { addIfNotNull(builder, compilation.SynthesizeTupleNamesAttribute(type.Type)); } if (type.Type.ContainsNativeInteger()) { addIfNotNull(builder, moduleBuilder.SynthesizeNativeIntegerAttribute(declaringSymbol, type.Type)); } if (compilation.ShouldEmitNullableAttributes(declaringSymbol)) { addIfNotNull(builder, moduleBuilder.SynthesizeNullableAttributeIfNecessary(declaringSymbol, declaringSymbol.GetNullableContextValue(), type)); } static void addIfNotNull(ArrayBuilder<Cci.ICustomAttribute> builder, SynthesizedAttributeData? attr) { if (attr != null) { builder.Add(attr); } } } return new Cci.TypeReferenceWithAttributes(typeRef, builder.ToImmutableAndFree()); } internal static bool IsWellKnownTypeInAttribute(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownInteropServicesTopLevelType("InAttribute"); internal static bool IsWellKnownTypeUnmanagedType(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownInteropServicesTopLevelType("UnmanagedType"); internal static bool IsWellKnownTypeIsExternalInit(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownCompilerServicesTopLevelType("IsExternalInit"); internal static bool IsWellKnownTypeOutAttribute(this TypeSymbol typeSymbol) => typeSymbol.IsWellKnownInteropServicesTopLevelType("OutAttribute"); private static bool IsWellKnownInteropServicesTopLevelType(this TypeSymbol typeSymbol, string name) { if (typeSymbol.Name != name || typeSymbol.ContainingType is object) { return false; } return IsContainedInNamespace(typeSymbol, "System", "Runtime", "InteropServices"); } private static bool IsWellKnownCompilerServicesTopLevelType(this TypeSymbol typeSymbol, string name) { if (typeSymbol.Name != name) { return false; } return IsCompilerServicesTopLevelType(typeSymbol); } internal static bool IsCompilerServicesTopLevelType(this TypeSymbol typeSymbol) => typeSymbol.ContainingType is null && IsContainedInNamespace(typeSymbol, "System", "Runtime", "CompilerServices"); private static bool IsContainedInNamespace(this TypeSymbol typeSymbol, string outerNS, string midNS, string innerNS) { var innerNamespace = typeSymbol.ContainingNamespace; if (innerNamespace?.Name != innerNS) { return false; } var midNamespace = innerNamespace.ContainingNamespace; if (midNamespace?.Name != midNS) { return false; } var outerNamespace = midNamespace.ContainingNamespace; if (outerNamespace?.Name != outerNS) { return false; } var globalNamespace = outerNamespace.ContainingNamespace; return globalNamespace != null && globalNamespace.IsGlobalNamespace; } internal static int TypeToIndex(this TypeSymbol type) { switch (type.GetSpecialTypeSafe()) { case SpecialType.System_Object: return 0; case SpecialType.System_String: return 1; case SpecialType.System_Boolean: return 2; case SpecialType.System_Char: return 3; case SpecialType.System_SByte: return 4; case SpecialType.System_Int16: return 5; case SpecialType.System_Int32: return 6; case SpecialType.System_Int64: return 7; case SpecialType.System_Byte: return 8; case SpecialType.System_UInt16: return 9; case SpecialType.System_UInt32: return 10; case SpecialType.System_UInt64: return 11; case SpecialType.System_IntPtr when type.IsNativeIntegerType: return 12; case SpecialType.System_UIntPtr when type.IsNativeIntegerType: return 13; case SpecialType.System_Single: return 14; case SpecialType.System_Double: return 15; case SpecialType.System_Decimal: return 16; case SpecialType.None: if ((object)type != null && type.IsNullableType()) { TypeSymbol underlyingType = type.GetNullableUnderlyingType(); switch (underlyingType.GetSpecialTypeSafe()) { case SpecialType.System_Boolean: return 17; case SpecialType.System_Char: return 18; case SpecialType.System_SByte: return 19; case SpecialType.System_Int16: return 20; case SpecialType.System_Int32: return 21; case SpecialType.System_Int64: return 22; case SpecialType.System_Byte: return 23; case SpecialType.System_UInt16: return 24; case SpecialType.System_UInt32: return 25; case SpecialType.System_UInt64: return 26; case SpecialType.System_IntPtr when underlyingType.IsNativeIntegerType: return 27; case SpecialType.System_UIntPtr when underlyingType.IsNativeIntegerType: return 28; case SpecialType.System_Single: return 29; case SpecialType.System_Double: return 30; case SpecialType.System_Decimal: return 31; } } // fall through goto default; default: return -1; } } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmGetChildrenAsyncResult.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #region Assembly Microsoft.VisualStudio.Debugger.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a // References\Debugger\v2.0\Microsoft.VisualStudio.Debugger.Engine.dll #endregion using System; namespace Microsoft.VisualStudio.Debugger.Evaluation { public struct DkmGetChildrenAsyncResult { public DkmGetChildrenAsyncResult(DkmEvaluationResult[] InitialChildren, DkmEvaluationResultEnumContext EnumContext) : this() { if (InitialChildren == null) { throw new ArgumentNullException(); } this.InitialChildren = InitialChildren; this.EnumContext = EnumContext; } public DkmEvaluationResultEnumContext EnumContext { get; } public DkmEvaluationResult[] InitialChildren { get; } internal Exception Exception { get; set; } public static DkmGetChildrenAsyncResult CreateErrorResult(Exception exception) { return new DkmGetChildrenAsyncResult(new DkmEvaluationResult[0], EnumContext: null) { Exception = exception }; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #region Assembly Microsoft.VisualStudio.Debugger.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a // References\Debugger\v2.0\Microsoft.VisualStudio.Debugger.Engine.dll #endregion using System; namespace Microsoft.VisualStudio.Debugger.Evaluation { public struct DkmGetChildrenAsyncResult { public DkmGetChildrenAsyncResult(DkmEvaluationResult[] InitialChildren, DkmEvaluationResultEnumContext EnumContext) : this() { if (InitialChildren == null) { throw new ArgumentNullException(); } this.InitialChildren = InitialChildren; this.EnumContext = EnumContext; } public DkmEvaluationResultEnumContext EnumContext { get; } public DkmEvaluationResult[] InitialChildren { get; } internal Exception Exception { get; set; } public static DkmGetChildrenAsyncResult CreateErrorResult(Exception exception) { return new DkmGetChildrenAsyncResult(new DkmEvaluationResult[0], EnumContext: null) { Exception = exception }; } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Portable/Syntax/InternalSyntax/SyntaxTrivia.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax { internal class SyntaxTrivia : CSharpSyntaxNode { public readonly string Text; internal SyntaxTrivia(SyntaxKind kind, string text, DiagnosticInfo[]? diagnostics = null, SyntaxAnnotation[]? annotations = null) : base(kind, diagnostics, annotations, text.Length) { this.Text = text; if (kind == SyntaxKind.PreprocessingMessageTrivia) { this.flags |= NodeFlags.ContainsSkippedText; } } internal SyntaxTrivia(ObjectReader reader) : base(reader) { this.Text = reader.ReadString(); this.FullWidth = this.Text.Length; } static SyntaxTrivia() { ObjectBinder.RegisterTypeReader(typeof(SyntaxTrivia), r => new SyntaxTrivia(r)); } public override bool IsTrivia => true; internal override bool ShouldReuseInSerialization => this.Kind == SyntaxKind.WhitespaceTrivia && FullWidth < Lexer.MaxCachedTokenSize; internal override void WriteTo(ObjectWriter writer) { base.WriteTo(writer); writer.WriteString(this.Text); } internal static SyntaxTrivia Create(SyntaxKind kind, string text) { return new SyntaxTrivia(kind, text); } public override string ToFullString() { return this.Text; } public override string ToString() { return this.Text; } internal override GreenNode GetSlot(int index) { throw ExceptionUtilities.Unreachable; } public override int Width { get { Debug.Assert(this.FullWidth == this.Text.Length); return this.FullWidth; } } public override int GetLeadingTriviaWidth() { return 0; } public override int GetTrailingTriviaWidth() { return 0; } internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) { return new SyntaxTrivia(this.Kind, this.Text, diagnostics, GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) { return new SyntaxTrivia(this.Kind, this.Text, GetDiagnostics(), annotations); } public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) { return visitor.VisitTrivia(this); } public override void Accept(CSharpSyntaxVisitor visitor) { visitor.VisitTrivia(this); } protected override void WriteTriviaTo(System.IO.TextWriter writer) { writer.Write(Text); } public static implicit operator CodeAnalysis.SyntaxTrivia(SyntaxTrivia trivia) { return new CodeAnalysis.SyntaxTrivia(token: default, trivia, position: 0, index: 0); } public override bool IsEquivalentTo(GreenNode? other) { if (!base.IsEquivalentTo(other)) { return false; } if (this.Text != ((SyntaxTrivia)other).Text) { return false; } return true; } internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) { throw ExceptionUtilities.Unreachable; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax { internal class SyntaxTrivia : CSharpSyntaxNode { public readonly string Text; internal SyntaxTrivia(SyntaxKind kind, string text, DiagnosticInfo[]? diagnostics = null, SyntaxAnnotation[]? annotations = null) : base(kind, diagnostics, annotations, text.Length) { this.Text = text; if (kind == SyntaxKind.PreprocessingMessageTrivia) { this.flags |= NodeFlags.ContainsSkippedText; } } internal SyntaxTrivia(ObjectReader reader) : base(reader) { this.Text = reader.ReadString(); this.FullWidth = this.Text.Length; } static SyntaxTrivia() { ObjectBinder.RegisterTypeReader(typeof(SyntaxTrivia), r => new SyntaxTrivia(r)); } public override bool IsTrivia => true; internal override bool ShouldReuseInSerialization => this.Kind == SyntaxKind.WhitespaceTrivia && FullWidth < Lexer.MaxCachedTokenSize; internal override void WriteTo(ObjectWriter writer) { base.WriteTo(writer); writer.WriteString(this.Text); } internal static SyntaxTrivia Create(SyntaxKind kind, string text) { return new SyntaxTrivia(kind, text); } public override string ToFullString() { return this.Text; } public override string ToString() { return this.Text; } internal override GreenNode GetSlot(int index) { throw ExceptionUtilities.Unreachable; } public override int Width { get { Debug.Assert(this.FullWidth == this.Text.Length); return this.FullWidth; } } public override int GetLeadingTriviaWidth() { return 0; } public override int GetTrailingTriviaWidth() { return 0; } internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) { return new SyntaxTrivia(this.Kind, this.Text, diagnostics, GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) { return new SyntaxTrivia(this.Kind, this.Text, GetDiagnostics(), annotations); } public override TResult Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor) { return visitor.VisitTrivia(this); } public override void Accept(CSharpSyntaxVisitor visitor) { visitor.VisitTrivia(this); } protected override void WriteTriviaTo(System.IO.TextWriter writer) { writer.Write(Text); } public static implicit operator CodeAnalysis.SyntaxTrivia(SyntaxTrivia trivia) { return new CodeAnalysis.SyntaxTrivia(token: default, trivia, position: 0, index: 0); } public override bool IsEquivalentTo(GreenNode? other) { if (!base.IsEquivalentTo(other)) { return false; } if (this.Text != ((SyntaxTrivia)other).Text) { return false; } return true; } internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) { throw ExceptionUtilities.Unreachable; } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/VisualBasicTest/ConvertToInterpolatedString/ConvertPlaceholderToInterpolatedStringTests.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.CodeRefactorings Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings Imports Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ConvertToInterpolatedString Public Class ConvertPlaceholderToInterpolatedStringTests Inherits AbstractVisualBasicCodeActionTest Protected Overrides Function CreateCodeRefactoringProvider(workspace As Workspace, parameters As TestParameters) As CodeRefactoringProvider Return New VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider() End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestSingleItemSubstitution() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}", 1)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOrdering() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{1}{2}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }{2 }{3 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOrdering2() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{2}{1}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }{3 }{2 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOrdering3() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{0}{0}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }{1 }{1 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOutsideRange() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{4}{5}{6}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{4}{5}{6}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemDoNotHaveCast() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{1}{2}", 0.5, "Hello", 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{0.5 }{"Hello" }{3 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemWithoutSyntaxErrorDoesNotHaveCast() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{1}{2}", 0.5, "Hello", 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{0.5 }{"Hello" }{3 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestPreserveParenthesis() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}", (New Object))|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{(New Object) }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestMultiLineExpression() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}", If(True, "Yes", TryCast(False, Object)))|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{If(True, "Yes", TryCast(False, Object)) }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers() As Task Dim text = <File> Imports System Module T Sub M() Dim pricePerOunce As Decimal = 17.36 Dim s = [|String.Format("The current price Is {0:C2} per ounce.", pricePerOunce)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim pricePerOunce As Decimal = 17.36 Dim s = $"The current price Is {pricePerOunce:C2} per ounce." End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers2() As Task Dim text = <File> Imports System Module T Sub M() Dim s = [|String.Format("It Is now {0:d} at {0:T}", DateTime.Now)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim s = $"It Is now {DateTime.Now:d} at {DateTime.Now:T}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers3() As Task Dim text = <File> Imports System Module T Sub M() Dim years As Integer() = {2013, 2014, 2015} Dim population As Integer() = {1025632, 1105967, 1148203} Dim s = String.Format("{0,6} {1,15}\n\n", "Year", "Population") For index = 0 To years.Length - 1 s += [|String.Format("{0, 6} {1, 15: N0}\n", years(index), population(index))|] Next End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim years As Integer() = {2013, 2014, 2015} Dim population As Integer() = {1025632, 1105967, 1148203} Dim s = String.Format("{0,6} {1,15}\n\n", "Year", "Population") For index = 0 To years.Length - 1 s += $"{years(index), 6} {population(index), 15: N0}\n" Next End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers4() As Task Dim text = <File> Imports System Module T Sub M() Dim s = [|String.Format("{0,-10:C}", 126347.89)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim s = $"{126347.89,-10:C}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers5() As Task Dim text = <File> Imports System Module T Sub M() Dim cities As Tuple(Of String, DateTime, Integer, DateTime, Integer)() = {Tuple.Create("Los Angeles", New DateTime(1940, 1, 1), 1504277, New DateTime(1950, 1, 1), 1970358), Tuple.Create("New York", New DateTime(1940, 1, 1), 7454995, New DateTime(1950, 1, 1), 7891957), Tuple.Create("Chicago", New DateTime(1940, 1, 1), 3396808, New DateTime(1950, 1, 1), 3620962), Tuple.Create("Detroit", New DateTime(1940, 1, 1), 1623452, New DateTime(1950, 1, 1), 1849568)} Dim output As String For Each city In cities output = [|String.Format("{0,-12}{1,8:yyyy}{2,12:N0}{3,8:yyyy}{4,12:N0}{5,14:P1}", city.Item1, city.Item2, city.Item3, city.Item4, city.Item5, (city.Item5 - city.Item3) / CType(city.Item3, Double))|] Next End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim cities As Tuple(Of String, DateTime, Integer, DateTime, Integer)() = {Tuple.Create("Los Angeles", New DateTime(1940, 1, 1), 1504277, New DateTime(1950, 1, 1), 1970358), Tuple.Create("New York", New DateTime(1940, 1, 1), 7454995, New DateTime(1950, 1, 1), 7891957), Tuple.Create("Chicago", New DateTime(1940, 1, 1), 3396808, New DateTime(1950, 1, 1), 3620962), Tuple.Create("Detroit", New DateTime(1940, 1, 1), 1623452, New DateTime(1950, 1, 1), 1849568)} Dim output As String For Each city In cities output = $"{city.Item1,-12}{city.Item2,8:yyyy}{city.Item3,12:N0}{city.Item4,8:yyyy}{city.Item5,12:N0}{(city.Item5 - city.Item3) / CType(city.Item3, Double),14:P1}" Next End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers6() As Task Dim text = <File> Imports System Module T Sub M() Dim values As Short() = {Int16.MaxValue, -27, 0, 1042, Int16.MaxValue} For Each value In values Dim s = [|String.Format("{0,10:G}: {0,10:X}", value)|] Next End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim values As Short() = {Int16.MaxValue, -27, 0, 1042, Int16.MaxValue} For Each value In values Dim s = $"{value,10:G}: {value,10:X}" Next End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestMultilineStringLiteral2() As Task Dim text = <File> Imports System Module T Sub M() Dim value1 = 16932 Dim value2 = 15421 Dim result = [|String.Format(" {0,10} ({0,8:X8}) And {1,10} ({1,8:X8}) = {2,10} ({2,8:X8})", value1, value2, value1 And value2)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim value1 = 16932 Dim value2 = 15421 Dim result = $" {value1,10} ({value1,8:X8}) And {value2,10} ({value2,8:X8}) = {value1 And value2,10} ({value1 And value2,8:X8})" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestParamsArray() As Task Dim text = <File> Imports System Module T Sub M(args As String()) Dim s = [|String.Format("{0}", args)|] End Sub End Module</File>.ConvertTestSourceTag() Await TestMissingInRegularAndScriptAsync(text) End Function <WorkItem(13605, "https://github.com/dotnet/roslyn/issues/13605")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestInvocationWithNullArguments() As Task Dim text = "Module Module1 Sub Main() [|TaskAwaiter|] End Sub End Module" Await TestMissingInRegularAndScriptAsync(text) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments1() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format(arg0:="test", arg1:="also", format:="This {0} {1} works")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"This {"test" } {"also" } works" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments2() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("This {0} {1} works", arg0:="test", arg1:="also")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"This {"test" } {"also" } works" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments3() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2}", "10", arg1:="11", arg2:="12")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments4() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2}", "10", arg2:="12", arg1:="11")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments5() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2} {3}", "10", arg1:="11", arg2:="12")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" } {3}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments_CaseInsensitive() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2}", ARg0:="10", aRg1:="11", Arg2:="12")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.CodeRefactorings Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings Imports Microsoft.CodeAnalysis.VisualBasic.ConvertToInterpolatedString Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ConvertToInterpolatedString Public Class ConvertPlaceholderToInterpolatedStringTests Inherits AbstractVisualBasicCodeActionTest Protected Overrides Function CreateCodeRefactoringProvider(workspace As Workspace, parameters As TestParameters) As CodeRefactoringProvider Return New VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider() End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestSingleItemSubstitution() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}", 1)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOrdering() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{1}{2}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }{2 }{3 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOrdering2() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{2}{1}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }{3 }{2 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOrdering3() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{0}{0}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{1 }{1 }{1 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemOutsideRange() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{4}{5}{6}", 1, 2, 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{4}{5}{6}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemDoNotHaveCast() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{1}{2}", 0.5, "Hello", 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{0.5 }{"Hello" }{3 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestItemWithoutSyntaxErrorDoesNotHaveCast() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}{1}{2}", 0.5, "Hello", 3)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{0.5 }{"Hello" }{3 }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestPreserveParenthesis() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}", (New Object))|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{(New Object) }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestMultiLineExpression() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0}", If(True, "Yes", TryCast(False, Object)))|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{If(True, "Yes", TryCast(False, Object)) }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers() As Task Dim text = <File> Imports System Module T Sub M() Dim pricePerOunce As Decimal = 17.36 Dim s = [|String.Format("The current price Is {0:C2} per ounce.", pricePerOunce)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim pricePerOunce As Decimal = 17.36 Dim s = $"The current price Is {pricePerOunce:C2} per ounce." End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers2() As Task Dim text = <File> Imports System Module T Sub M() Dim s = [|String.Format("It Is now {0:d} at {0:T}", DateTime.Now)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim s = $"It Is now {DateTime.Now:d} at {DateTime.Now:T}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers3() As Task Dim text = <File> Imports System Module T Sub M() Dim years As Integer() = {2013, 2014, 2015} Dim population As Integer() = {1025632, 1105967, 1148203} Dim s = String.Format("{0,6} {1,15}\n\n", "Year", "Population") For index = 0 To years.Length - 1 s += [|String.Format("{0, 6} {1, 15: N0}\n", years(index), population(index))|] Next End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim years As Integer() = {2013, 2014, 2015} Dim population As Integer() = {1025632, 1105967, 1148203} Dim s = String.Format("{0,6} {1,15}\n\n", "Year", "Population") For index = 0 To years.Length - 1 s += $"{years(index), 6} {population(index), 15: N0}\n" Next End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers4() As Task Dim text = <File> Imports System Module T Sub M() Dim s = [|String.Format("{0,-10:C}", 126347.89)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim s = $"{126347.89,-10:C}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers5() As Task Dim text = <File> Imports System Module T Sub M() Dim cities As Tuple(Of String, DateTime, Integer, DateTime, Integer)() = {Tuple.Create("Los Angeles", New DateTime(1940, 1, 1), 1504277, New DateTime(1950, 1, 1), 1970358), Tuple.Create("New York", New DateTime(1940, 1, 1), 7454995, New DateTime(1950, 1, 1), 7891957), Tuple.Create("Chicago", New DateTime(1940, 1, 1), 3396808, New DateTime(1950, 1, 1), 3620962), Tuple.Create("Detroit", New DateTime(1940, 1, 1), 1623452, New DateTime(1950, 1, 1), 1849568)} Dim output As String For Each city In cities output = [|String.Format("{0,-12}{1,8:yyyy}{2,12:N0}{3,8:yyyy}{4,12:N0}{5,14:P1}", city.Item1, city.Item2, city.Item3, city.Item4, city.Item5, (city.Item5 - city.Item3) / CType(city.Item3, Double))|] Next End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim cities As Tuple(Of String, DateTime, Integer, DateTime, Integer)() = {Tuple.Create("Los Angeles", New DateTime(1940, 1, 1), 1504277, New DateTime(1950, 1, 1), 1970358), Tuple.Create("New York", New DateTime(1940, 1, 1), 7454995, New DateTime(1950, 1, 1), 7891957), Tuple.Create("Chicago", New DateTime(1940, 1, 1), 3396808, New DateTime(1950, 1, 1), 3620962), Tuple.Create("Detroit", New DateTime(1940, 1, 1), 1623452, New DateTime(1950, 1, 1), 1849568)} Dim output As String For Each city In cities output = $"{city.Item1,-12}{city.Item2,8:yyyy}{city.Item3,12:N0}{city.Item4,8:yyyy}{city.Item5,12:N0}{(city.Item5 - city.Item3) / CType(city.Item3, Double),14:P1}" Next End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatSpecifiers6() As Task Dim text = <File> Imports System Module T Sub M() Dim values As Short() = {Int16.MaxValue, -27, 0, 1042, Int16.MaxValue} For Each value In values Dim s = [|String.Format("{0,10:G}: {0,10:X}", value)|] Next End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim values As Short() = {Int16.MaxValue, -27, 0, 1042, Int16.MaxValue} For Each value In values Dim s = $"{value,10:G}: {value,10:X}" Next End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestMultilineStringLiteral2() As Task Dim text = <File> Imports System Module T Sub M() Dim value1 = 16932 Dim value2 = 15421 Dim result = [|String.Format(" {0,10} ({0,8:X8}) And {1,10} ({1,8:X8}) = {2,10} ({2,8:X8})", value1, value2, value1 And value2)|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim value1 = 16932 Dim value2 = 15421 Dim result = $" {value1,10} ({value1,8:X8}) And {value2,10} ({value2,8:X8}) = {value1 And value2,10} ({value1 And value2,8:X8})" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestParamsArray() As Task Dim text = <File> Imports System Module T Sub M(args As String()) Dim s = [|String.Format("{0}", args)|] End Sub End Module</File>.ConvertTestSourceTag() Await TestMissingInRegularAndScriptAsync(text) End Function <WorkItem(13605, "https://github.com/dotnet/roslyn/issues/13605")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestInvocationWithNullArguments() As Task Dim text = "Module Module1 Sub Main() [|TaskAwaiter|] End Sub End Module" Await TestMissingInRegularAndScriptAsync(text) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments1() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format(arg0:="test", arg1:="also", format:="This {0} {1} works")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"This {"test" } {"also" } works" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments2() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("This {0} {1} works", arg0:="test", arg1:="also")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"This {"test" } {"also" } works" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments3() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2}", "10", arg1:="11", arg2:="12")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments4() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2}", "10", arg2:="12", arg1:="11")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments5() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2} {3}", "10", arg1:="11", arg2:="12")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" } {3}" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function <WorkItem(19162, "https://github.com/dotnet/roslyn/issues/19162")> <Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertToInterpolatedString)> Public Async Function TestFormatWithNamedArguments_CaseInsensitive() As Task Dim text = <File> Imports System Module T Sub M() Dim a = [|String.Format("{0} {1} {2}", ARg0:="10", aRg1:="11", Arg2:="12")|] End Sub End Module</File>.ConvertTestSourceTag() Dim expected = <File> Imports System Module T Sub M() Dim a = $"{"10" } {"11" } {"12" }" End Sub End Module</File>.ConvertTestSourceTag() Await TestInRegularAndScriptAsync(text, expected) End Function End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/Core/Implementation/Classification/ClassificationTypeDefinitions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Classification; using Microsoft.VisualStudio.Language.StandardClassification; using Microsoft.VisualStudio.Text.Classification; using Microsoft.VisualStudio.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Classification { internal sealed class ClassificationTypeDefinitions { #region Preprocessor Text [Export] [Name(ClassificationTypeNames.PreprocessorText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal ClassificationTypeDefinition PreprocessorTextTypeDefinition { get; set; } #endregion #region Punctuation [Export] [Name(ClassificationTypeNames.Punctuation)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal ClassificationTypeDefinition PunctuationTypeDefinition; #endregion #region String - Verbatim [Export] [Name(ClassificationTypeNames.VerbatimStringLiteral)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition StringVerbatimTypeDefinition; [Export] [Name(ClassificationTypeNames.StringEscapeCharacter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition StringEscapeCharacterTypeDefinition; #endregion #region Keyword - Control // Keyword - Control sets its BaseDefinitions to be Keyword so that // in the absence of specific styling they will appear as keywords. [Export] [Name(ClassificationTypeNames.ControlKeyword)] [BaseDefinition(PredefinedClassificationTypeNames.Keyword)] internal ClassificationTypeDefinition ControlKeywordTypeDefinition; #endregion #region User Types - Classes [Export] [Name(ClassificationTypeNames.ClassName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeClassesTypeDefinition; #endregion #region User Types - Records [Export] [Name(ClassificationTypeNames.RecordClassName)] [BaseDefinition(ClassificationTypeNames.ClassName)] internal readonly ClassificationTypeDefinition UserTypeRecordsTypeDefinition; #endregion #region User Types - Record Structs [Export] [Name(ClassificationTypeNames.RecordStructName)] [BaseDefinition(ClassificationTypeNames.StructName)] internal readonly ClassificationTypeDefinition UserTypeRecordStructsTypeDefinition; #endregion #region User Types - Delegates [Export] [Name(ClassificationTypeNames.DelegateName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeDelegatesTypeDefinition; #endregion #region User Types - Enums [Export] [Name(ClassificationTypeNames.EnumName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeEnumsTypeDefinition; #endregion #region User Types - Interfaces [Export] [Name(ClassificationTypeNames.InterfaceName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeInterfacesTypeDefinition; #endregion #region User Types - Modules [Export] [Name(ClassificationTypeNames.ModuleName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeModulesTypeDefinition; #endregion #region User Types - Structures [Export] [Name(ClassificationTypeNames.StructName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeStructuresTypeDefinition; #endregion #region User Types - Type Parameters [Export] [Name(ClassificationTypeNames.TypeParameterName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeTypeParametersTypeDefinition; #endregion // User Members - * set their BaseDefinitions to be Identifier so that // in the absence of specific styling they will appear as identifiers. // Extension Methods are an exception and their base definition is Method // since it is a more specific type of method. #region User Members - Fields [Export] [Name(ClassificationTypeNames.FieldName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersFieldsTypeDefinition; #endregion #region User Members - Enum Memberd [Export] [Name(ClassificationTypeNames.EnumMemberName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersEnumMembersTypeDefinition; #endregion #region User Members - Constants [Export] [Name(ClassificationTypeNames.ConstantName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersConstantsTypeDefinition; #endregion #region User Members - Locals [Export] [Name(ClassificationTypeNames.LocalName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersLocalsTypeDefinition; #endregion #region User Members - Parameters [Export] [Name(ClassificationTypeNames.ParameterName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersParametersTypeDefinition; #endregion #region User Members - Methods [Export] [Name(ClassificationTypeNames.MethodName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersMethodsTypeDefinition; #endregion #region User Members - Extension Methods [Export] [Name(ClassificationTypeNames.ExtensionMethodName)] [BaseDefinition(ClassificationTypeNames.MethodName)] internal readonly ClassificationTypeDefinition UserMembersExtensionMethodsTypeDefinition; #endregion #region User Members - Properties [Export] [Name(ClassificationTypeNames.PropertyName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersPropertiesTypeDefinition; #endregion #region User Members - Events [Export] [Name(ClassificationTypeNames.EventName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersEventsTypeDefinition; #endregion #region User Members - Namespaces [Export] [Name(ClassificationTypeNames.NamespaceName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersNamespacesTypeDefinition; #endregion #region User Members - Labels [Export] [Name(ClassificationTypeNames.LabelName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersLabelsTypeDefinition; #endregion #region XML Doc Comments - Attribute Name [Export] [Name(ClassificationTypeNames.XmlDocCommentAttributeName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentAttributeNameTypeDefinition; #endregion #region XML Doc Comments - Attribute Quotes [Export] [Name(ClassificationTypeNames.XmlDocCommentAttributeQuotes)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentAttributeQuotesTypeDefinition; #endregion #region XML Doc Comments - Attribute Value [Export] [Name(ClassificationTypeNames.XmlDocCommentAttributeValue)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentAttributeValueTypeDefinition; #endregion #region XML Doc Comments - CData Section [Export] [Name(ClassificationTypeNames.XmlDocCommentCDataSection)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentCDataSectionTypeDefinition; #endregion #region XML Doc Comments - Comment [Export] [Name(ClassificationTypeNames.XmlDocCommentComment)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentCommentTypeDefinition; #endregion #region XML Doc Comments - Delimiter [Export] [Name(ClassificationTypeNames.XmlDocCommentDelimiter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentDelimiterTypeDefinition; #endregion #region XML Doc Comments - Entity Reference [Export] [Name(ClassificationTypeNames.XmlDocCommentEntityReference)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentEntityReferenceTypeDefinition; #endregion #region XML Doc Comments - Name [Export] [Name(ClassificationTypeNames.XmlDocCommentName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentNameTypeDefinition; #endregion #region XML Doc Comments - Processing Instruction [Export] [Name(ClassificationTypeNames.XmlDocCommentProcessingInstruction)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentProcessingInstructionTypeDefinition; #endregion #region XML Doc Comments - Text [Export] [Name(ClassificationTypeNames.XmlDocCommentText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentTextTypeDefinition; #endregion #region Regex [Export] [Name(ClassificationTypeNames.RegexComment)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexCommentTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexTextTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexCharacterClass)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexCharacterClassTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexQuantifier)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexQuantifierTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexAnchor)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexAnchorTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexAlternation)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexAlternationTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexOtherEscape)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexOtherEscapeTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexSelfEscapedCharacter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexSelfEscapedCharacterTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexGrouping)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexGroupingTypeDefinition; #endregion #region VB XML Literals - Attribute Name [Export] [Name(ClassificationTypeNames.XmlLiteralAttributeName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralAttributeNameTypeDefinition; #endregion #region VB XML Literals - Attribute Quotes [Export] [Name(ClassificationTypeNames.XmlLiteralAttributeQuotes)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralAttributeQuotesTypeDefinition; #endregion #region VB XML Literals - Attribute Value [Export] [Name(ClassificationTypeNames.XmlLiteralAttributeValue)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralAttributeValueTypeDefinition; #endregion #region VB XML Literals - CData Section [Export] [Name(ClassificationTypeNames.XmlLiteralCDataSection)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralCDataSectionTypeDefinition; #endregion #region VB XML Literals - Comment [Export] [Name(ClassificationTypeNames.XmlLiteralComment)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralCommentTypeDefinition; #endregion #region VB XML Literals - Delimiter [Export] [Name(ClassificationTypeNames.XmlLiteralDelimiter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralDelimiterTypeDefinition; #endregion #region VB XML Literals - Embedded Expression [Export] [Name(ClassificationTypeNames.XmlLiteralEmbeddedExpression)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralEmbeddedExpressionTypeDefinition; #endregion #region VB XML Literals - Entity Reference [Export] [Name(ClassificationTypeNames.XmlLiteralEntityReference)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralEntityReferenceTypeDefinition; #endregion #region VB XML Literals - Name [Export] [Name(ClassificationTypeNames.XmlLiteralName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralNameTypeDefinition; #endregion #region VB XML Literals - Processing Instruction [Export] [Name(ClassificationTypeNames.XmlLiteralProcessingInstruction)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralProcessingInstructionTypeDefinition; #endregion #region VB XML Literals - Text [Export] [Name(ClassificationTypeNames.XmlLiteralText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralTextTypeDefinition; #endregion #region Reassigned Variable [Export] [Name(ClassificationTypeNames.ReassignedVariable)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition ReassignedVariableTypeDefinition; #endregion #region Static Symbol [Export] [Name(ClassificationTypeNames.StaticSymbol)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition StaticSymbolTypeDefinition; #endregion #region Operator - Overloaded // Operator - Overloaded sets its BaseDefinitions to be Operator so that // in the absence of specific styling they will appear as operators. [Export] [Name(ClassificationTypeNames.OperatorOverloaded)] [BaseDefinition(PredefinedClassificationTypeNames.Operator)] internal readonly ClassificationTypeDefinition OperatorOverloadTypeDefinition; #endregion } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Classification; using Microsoft.VisualStudio.Language.StandardClassification; using Microsoft.VisualStudio.Text.Classification; using Microsoft.VisualStudio.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Classification { internal sealed class ClassificationTypeDefinitions { #region Preprocessor Text [Export] [Name(ClassificationTypeNames.PreprocessorText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal ClassificationTypeDefinition PreprocessorTextTypeDefinition { get; set; } #endregion #region Punctuation [Export] [Name(ClassificationTypeNames.Punctuation)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal ClassificationTypeDefinition PunctuationTypeDefinition; #endregion #region String - Verbatim [Export] [Name(ClassificationTypeNames.VerbatimStringLiteral)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition StringVerbatimTypeDefinition; [Export] [Name(ClassificationTypeNames.StringEscapeCharacter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition StringEscapeCharacterTypeDefinition; #endregion #region Keyword - Control // Keyword - Control sets its BaseDefinitions to be Keyword so that // in the absence of specific styling they will appear as keywords. [Export] [Name(ClassificationTypeNames.ControlKeyword)] [BaseDefinition(PredefinedClassificationTypeNames.Keyword)] internal ClassificationTypeDefinition ControlKeywordTypeDefinition; #endregion #region User Types - Classes [Export] [Name(ClassificationTypeNames.ClassName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeClassesTypeDefinition; #endregion #region User Types - Records [Export] [Name(ClassificationTypeNames.RecordClassName)] [BaseDefinition(ClassificationTypeNames.ClassName)] internal readonly ClassificationTypeDefinition UserTypeRecordsTypeDefinition; #endregion #region User Types - Record Structs [Export] [Name(ClassificationTypeNames.RecordStructName)] [BaseDefinition(ClassificationTypeNames.StructName)] internal readonly ClassificationTypeDefinition UserTypeRecordStructsTypeDefinition; #endregion #region User Types - Delegates [Export] [Name(ClassificationTypeNames.DelegateName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeDelegatesTypeDefinition; #endregion #region User Types - Enums [Export] [Name(ClassificationTypeNames.EnumName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeEnumsTypeDefinition; #endregion #region User Types - Interfaces [Export] [Name(ClassificationTypeNames.InterfaceName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeInterfacesTypeDefinition; #endregion #region User Types - Modules [Export] [Name(ClassificationTypeNames.ModuleName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeModulesTypeDefinition; #endregion #region User Types - Structures [Export] [Name(ClassificationTypeNames.StructName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeStructuresTypeDefinition; #endregion #region User Types - Type Parameters [Export] [Name(ClassificationTypeNames.TypeParameterName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition UserTypeTypeParametersTypeDefinition; #endregion // User Members - * set their BaseDefinitions to be Identifier so that // in the absence of specific styling they will appear as identifiers. // Extension Methods are an exception and their base definition is Method // since it is a more specific type of method. #region User Members - Fields [Export] [Name(ClassificationTypeNames.FieldName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersFieldsTypeDefinition; #endregion #region User Members - Enum Memberd [Export] [Name(ClassificationTypeNames.EnumMemberName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersEnumMembersTypeDefinition; #endregion #region User Members - Constants [Export] [Name(ClassificationTypeNames.ConstantName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersConstantsTypeDefinition; #endregion #region User Members - Locals [Export] [Name(ClassificationTypeNames.LocalName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersLocalsTypeDefinition; #endregion #region User Members - Parameters [Export] [Name(ClassificationTypeNames.ParameterName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersParametersTypeDefinition; #endregion #region User Members - Methods [Export] [Name(ClassificationTypeNames.MethodName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersMethodsTypeDefinition; #endregion #region User Members - Extension Methods [Export] [Name(ClassificationTypeNames.ExtensionMethodName)] [BaseDefinition(ClassificationTypeNames.MethodName)] internal readonly ClassificationTypeDefinition UserMembersExtensionMethodsTypeDefinition; #endregion #region User Members - Properties [Export] [Name(ClassificationTypeNames.PropertyName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersPropertiesTypeDefinition; #endregion #region User Members - Events [Export] [Name(ClassificationTypeNames.EventName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersEventsTypeDefinition; #endregion #region User Members - Namespaces [Export] [Name(ClassificationTypeNames.NamespaceName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersNamespacesTypeDefinition; #endregion #region User Members - Labels [Export] [Name(ClassificationTypeNames.LabelName)] [BaseDefinition(PredefinedClassificationTypeNames.Identifier)] internal readonly ClassificationTypeDefinition UserMembersLabelsTypeDefinition; #endregion #region XML Doc Comments - Attribute Name [Export] [Name(ClassificationTypeNames.XmlDocCommentAttributeName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentAttributeNameTypeDefinition; #endregion #region XML Doc Comments - Attribute Quotes [Export] [Name(ClassificationTypeNames.XmlDocCommentAttributeQuotes)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentAttributeQuotesTypeDefinition; #endregion #region XML Doc Comments - Attribute Value [Export] [Name(ClassificationTypeNames.XmlDocCommentAttributeValue)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentAttributeValueTypeDefinition; #endregion #region XML Doc Comments - CData Section [Export] [Name(ClassificationTypeNames.XmlDocCommentCDataSection)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentCDataSectionTypeDefinition; #endregion #region XML Doc Comments - Comment [Export] [Name(ClassificationTypeNames.XmlDocCommentComment)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentCommentTypeDefinition; #endregion #region XML Doc Comments - Delimiter [Export] [Name(ClassificationTypeNames.XmlDocCommentDelimiter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentDelimiterTypeDefinition; #endregion #region XML Doc Comments - Entity Reference [Export] [Name(ClassificationTypeNames.XmlDocCommentEntityReference)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentEntityReferenceTypeDefinition; #endregion #region XML Doc Comments - Name [Export] [Name(ClassificationTypeNames.XmlDocCommentName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentNameTypeDefinition; #endregion #region XML Doc Comments - Processing Instruction [Export] [Name(ClassificationTypeNames.XmlDocCommentProcessingInstruction)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentProcessingInstructionTypeDefinition; #endregion #region XML Doc Comments - Text [Export] [Name(ClassificationTypeNames.XmlDocCommentText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlDocCommentTextTypeDefinition; #endregion #region Regex [Export] [Name(ClassificationTypeNames.RegexComment)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexCommentTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexTextTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexCharacterClass)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexCharacterClassTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexQuantifier)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexQuantifierTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexAnchor)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexAnchorTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexAlternation)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexAlternationTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexOtherEscape)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexOtherEscapeTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexSelfEscapedCharacter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexSelfEscapedCharacterTypeDefinition; [Export] [Name(ClassificationTypeNames.RegexGrouping)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition RegexGroupingTypeDefinition; #endregion #region VB XML Literals - Attribute Name [Export] [Name(ClassificationTypeNames.XmlLiteralAttributeName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralAttributeNameTypeDefinition; #endregion #region VB XML Literals - Attribute Quotes [Export] [Name(ClassificationTypeNames.XmlLiteralAttributeQuotes)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralAttributeQuotesTypeDefinition; #endregion #region VB XML Literals - Attribute Value [Export] [Name(ClassificationTypeNames.XmlLiteralAttributeValue)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralAttributeValueTypeDefinition; #endregion #region VB XML Literals - CData Section [Export] [Name(ClassificationTypeNames.XmlLiteralCDataSection)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralCDataSectionTypeDefinition; #endregion #region VB XML Literals - Comment [Export] [Name(ClassificationTypeNames.XmlLiteralComment)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralCommentTypeDefinition; #endregion #region VB XML Literals - Delimiter [Export] [Name(ClassificationTypeNames.XmlLiteralDelimiter)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralDelimiterTypeDefinition; #endregion #region VB XML Literals - Embedded Expression [Export] [Name(ClassificationTypeNames.XmlLiteralEmbeddedExpression)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralEmbeddedExpressionTypeDefinition; #endregion #region VB XML Literals - Entity Reference [Export] [Name(ClassificationTypeNames.XmlLiteralEntityReference)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralEntityReferenceTypeDefinition; #endregion #region VB XML Literals - Name [Export] [Name(ClassificationTypeNames.XmlLiteralName)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralNameTypeDefinition; #endregion #region VB XML Literals - Processing Instruction [Export] [Name(ClassificationTypeNames.XmlLiteralProcessingInstruction)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralProcessingInstructionTypeDefinition; #endregion #region VB XML Literals - Text [Export] [Name(ClassificationTypeNames.XmlLiteralText)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition XmlLiteralTextTypeDefinition; #endregion #region Reassigned Variable [Export] [Name(ClassificationTypeNames.ReassignedVariable)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition ReassignedVariableTypeDefinition; #endregion #region Static Symbol [Export] [Name(ClassificationTypeNames.StaticSymbol)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] internal readonly ClassificationTypeDefinition StaticSymbolTypeDefinition; #endregion #region Operator - Overloaded // Operator - Overloaded sets its BaseDefinitions to be Operator so that // in the absence of specific styling they will appear as operators. [Export] [Name(ClassificationTypeNames.OperatorOverloaded)] [BaseDefinition(PredefinedClassificationTypeNames.Operator)] internal readonly ClassificationTypeDefinition OperatorOverloadTypeDefinition; #endregion } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Portable/Semantics/StatementSyntaxWalker.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic ''' <summary> ''' This class walks all the statements in some syntax, in order, except those statements that are contained ''' inside expressions (a statement can occur inside an expression if it is inside ''' a lambda.) ''' ''' This is used when collecting the declarations and declaration spaces of a method body. ''' ''' Typically the client overrides this class and overrides various Visit methods, being sure to always ''' delegate back to the base. ''' </summary> Friend Class StatementSyntaxWalker Inherits VisualBasicSyntaxVisitor Public Overridable Sub VisitList(list As IEnumerable(Of VisualBasicSyntaxNode)) For Each n In list Visit(n) Next End Sub Public Overrides Sub VisitCompilationUnit(node As CompilationUnitSyntax) VisitList(node.Options) VisitList(node.Imports) VisitList(node.Attributes) VisitList(node.Members) End Sub Public Overrides Sub VisitNamespaceBlock(node As NamespaceBlockSyntax) Visit(node.NamespaceStatement) VisitList(node.Members) Visit(node.EndNamespaceStatement) End Sub Public Overrides Sub VisitModuleBlock(ByVal node As ModuleBlockSyntax) Visit(node.BlockStatement) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitClassBlock(ByVal node As ClassBlockSyntax) Visit(node.BlockStatement) VisitList(node.Inherits) VisitList(node.Implements) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitStructureBlock(ByVal node As StructureBlockSyntax) Visit(node.BlockStatement) VisitList(node.Inherits) VisitList(node.Implements) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitInterfaceBlock(ByVal node As InterfaceBlockSyntax) Visit(node.BlockStatement) VisitList(node.Inherits) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitEnumBlock(ByVal node As EnumBlockSyntax) Visit(node.EnumStatement) VisitList(node.Members) Visit(node.EndEnumStatement) End Sub Public Overrides Sub VisitMethodBlock(ByVal node As MethodBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitConstructorBlock(node As ConstructorBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitOperatorBlock(node As OperatorBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitAccessorBlock(node As AccessorBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitPropertyBlock(ByVal node As PropertyBlockSyntax) Visit(node.PropertyStatement) VisitList(node.Accessors) Visit(node.EndPropertyStatement) End Sub Public Overrides Sub VisitEventBlock(ByVal node As EventBlockSyntax) Visit(node.EventStatement) VisitList(node.Accessors) Visit(node.EndEventStatement) End Sub Public Overrides Sub VisitWhileBlock(ByVal node As WhileBlockSyntax) Visit(node.WhileStatement) VisitList(node.Statements) Visit(node.EndWhileStatement) End Sub Public Overrides Sub VisitUsingBlock(ByVal node As UsingBlockSyntax) Visit(node.UsingStatement) VisitList(node.Statements) Visit(node.EndUsingStatement) End Sub Public Overrides Sub VisitSyncLockBlock(ByVal node As SyncLockBlockSyntax) Visit(node.SyncLockStatement) VisitList(node.Statements) Visit(node.EndSyncLockStatement) End Sub Public Overrides Sub VisitWithBlock(ByVal node As WithBlockSyntax) Visit(node.WithStatement) VisitList(node.Statements) Visit(node.EndWithStatement) End Sub Public Overrides Sub VisitSingleLineIfStatement(ByVal node As SingleLineIfStatementSyntax) VisitList(node.Statements) Visit(node.ElseClause) End Sub Public Overrides Sub VisitSingleLineElseClause(ByVal node As SingleLineElseClauseSyntax) VisitList(node.Statements) End Sub Public Overrides Sub VisitMultiLineIfBlock(ByVal node As MultiLineIfBlockSyntax) Visit(node.IfStatement) VisitList(node.Statements) VisitList(node.ElseIfBlocks) Visit(node.ElseBlock) Visit(node.EndIfStatement) End Sub Public Overrides Sub VisitElseIfBlock(ByVal node As ElseIfBlockSyntax) Visit(node.ElseIfStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitElseBlock(ByVal node As ElseBlockSyntax) Visit(node.ElseStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitTryBlock(ByVal node As TryBlockSyntax) Visit(node.TryStatement) VisitList(node.Statements) VisitList(node.CatchBlocks) Visit(node.FinallyBlock) Visit(node.EndTryStatement) End Sub Public Overrides Sub VisitCatchBlock(ByVal node As CatchBlockSyntax) Visit(node.CatchStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitFinallyBlock(ByVal node As FinallyBlockSyntax) Visit(node.FinallyStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitSelectBlock(ByVal node As SelectBlockSyntax) Visit(node.SelectStatement) VisitList(node.CaseBlocks) Visit(node.EndSelectStatement) End Sub Public Overrides Sub VisitCaseBlock(ByVal node As CaseBlockSyntax) Visit(node.CaseStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitDoLoopBlock(ByVal node As DoLoopBlockSyntax) Visit(node.DoStatement) VisitList(node.Statements) Visit(node.LoopStatement) End Sub Public Overrides Sub VisitForBlock(ByVal node As ForBlockSyntax) Visit(node.ForStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitForEachBlock(ByVal node As ForEachBlockSyntax) Visit(node.ForEachStatement) VisitList(node.Statements) End Sub End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic ''' <summary> ''' This class walks all the statements in some syntax, in order, except those statements that are contained ''' inside expressions (a statement can occur inside an expression if it is inside ''' a lambda.) ''' ''' This is used when collecting the declarations and declaration spaces of a method body. ''' ''' Typically the client overrides this class and overrides various Visit methods, being sure to always ''' delegate back to the base. ''' </summary> Friend Class StatementSyntaxWalker Inherits VisualBasicSyntaxVisitor Public Overridable Sub VisitList(list As IEnumerable(Of VisualBasicSyntaxNode)) For Each n In list Visit(n) Next End Sub Public Overrides Sub VisitCompilationUnit(node As CompilationUnitSyntax) VisitList(node.Options) VisitList(node.Imports) VisitList(node.Attributes) VisitList(node.Members) End Sub Public Overrides Sub VisitNamespaceBlock(node As NamespaceBlockSyntax) Visit(node.NamespaceStatement) VisitList(node.Members) Visit(node.EndNamespaceStatement) End Sub Public Overrides Sub VisitModuleBlock(ByVal node As ModuleBlockSyntax) Visit(node.BlockStatement) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitClassBlock(ByVal node As ClassBlockSyntax) Visit(node.BlockStatement) VisitList(node.Inherits) VisitList(node.Implements) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitStructureBlock(ByVal node As StructureBlockSyntax) Visit(node.BlockStatement) VisitList(node.Inherits) VisitList(node.Implements) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitInterfaceBlock(ByVal node As InterfaceBlockSyntax) Visit(node.BlockStatement) VisitList(node.Inherits) VisitList(node.Members) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitEnumBlock(ByVal node As EnumBlockSyntax) Visit(node.EnumStatement) VisitList(node.Members) Visit(node.EndEnumStatement) End Sub Public Overrides Sub VisitMethodBlock(ByVal node As MethodBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitConstructorBlock(node As ConstructorBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitOperatorBlock(node As OperatorBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitAccessorBlock(node As AccessorBlockSyntax) Visit(node.BlockStatement) VisitList(node.Statements) Visit(node.EndBlockStatement) End Sub Public Overrides Sub VisitPropertyBlock(ByVal node As PropertyBlockSyntax) Visit(node.PropertyStatement) VisitList(node.Accessors) Visit(node.EndPropertyStatement) End Sub Public Overrides Sub VisitEventBlock(ByVal node As EventBlockSyntax) Visit(node.EventStatement) VisitList(node.Accessors) Visit(node.EndEventStatement) End Sub Public Overrides Sub VisitWhileBlock(ByVal node As WhileBlockSyntax) Visit(node.WhileStatement) VisitList(node.Statements) Visit(node.EndWhileStatement) End Sub Public Overrides Sub VisitUsingBlock(ByVal node As UsingBlockSyntax) Visit(node.UsingStatement) VisitList(node.Statements) Visit(node.EndUsingStatement) End Sub Public Overrides Sub VisitSyncLockBlock(ByVal node As SyncLockBlockSyntax) Visit(node.SyncLockStatement) VisitList(node.Statements) Visit(node.EndSyncLockStatement) End Sub Public Overrides Sub VisitWithBlock(ByVal node As WithBlockSyntax) Visit(node.WithStatement) VisitList(node.Statements) Visit(node.EndWithStatement) End Sub Public Overrides Sub VisitSingleLineIfStatement(ByVal node As SingleLineIfStatementSyntax) VisitList(node.Statements) Visit(node.ElseClause) End Sub Public Overrides Sub VisitSingleLineElseClause(ByVal node As SingleLineElseClauseSyntax) VisitList(node.Statements) End Sub Public Overrides Sub VisitMultiLineIfBlock(ByVal node As MultiLineIfBlockSyntax) Visit(node.IfStatement) VisitList(node.Statements) VisitList(node.ElseIfBlocks) Visit(node.ElseBlock) Visit(node.EndIfStatement) End Sub Public Overrides Sub VisitElseIfBlock(ByVal node As ElseIfBlockSyntax) Visit(node.ElseIfStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitElseBlock(ByVal node As ElseBlockSyntax) Visit(node.ElseStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitTryBlock(ByVal node As TryBlockSyntax) Visit(node.TryStatement) VisitList(node.Statements) VisitList(node.CatchBlocks) Visit(node.FinallyBlock) Visit(node.EndTryStatement) End Sub Public Overrides Sub VisitCatchBlock(ByVal node As CatchBlockSyntax) Visit(node.CatchStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitFinallyBlock(ByVal node As FinallyBlockSyntax) Visit(node.FinallyStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitSelectBlock(ByVal node As SelectBlockSyntax) Visit(node.SelectStatement) VisitList(node.CaseBlocks) Visit(node.EndSelectStatement) End Sub Public Overrides Sub VisitCaseBlock(ByVal node As CaseBlockSyntax) Visit(node.CaseStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitDoLoopBlock(ByVal node As DoLoopBlockSyntax) Visit(node.DoStatement) VisitList(node.Statements) Visit(node.LoopStatement) End Sub Public Overrides Sub VisitForBlock(ByVal node As ForBlockSyntax) Visit(node.ForStatement) VisitList(node.Statements) End Sub Public Overrides Sub VisitForEachBlock(ByVal node As ForEachBlockSyntax) Visit(node.ForEachStatement) VisitList(node.Statements) End Sub End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Await.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using Microsoft.CodeAnalysis.CSharp.Symbols; namespace Microsoft.CodeAnalysis.CSharp { internal sealed partial class LocalRewriter { public override BoundNode VisitAwaitExpression(BoundAwaitExpression node) { return VisitAwaitExpression(node, true); } public BoundExpression VisitAwaitExpression(BoundAwaitExpression node, bool used) { return RewriteAwaitExpression((BoundExpression)base.VisitAwaitExpression(node)!, used); } private BoundExpression RewriteAwaitExpression(SyntaxNode syntax, BoundExpression rewrittenExpression, BoundAwaitableInfo awaitableInfo, TypeSymbol type, bool used) { return RewriteAwaitExpression(new BoundAwaitExpression(syntax, rewrittenExpression, awaitableInfo, type) { WasCompilerGenerated = true }, used); } /// <summary> /// Lower an await expression that has already had its components rewritten. /// </summary> private BoundExpression RewriteAwaitExpression(BoundExpression rewrittenAwait, bool used) { _sawAwait = true; if (!used) { // Await expression is already at the statement level. return rewrittenAwait; } // The await expression will be lowered to code that involves the use of side-effects // such as jumps and labels, which we can only emit with an empty stack, so we require // that the await expression itself is produced only when the stack is empty. // Therefore it is represented by a BoundSpillSequence. The resulting nodes will be "spilled" to move // such statements to the top level (i.e. into the enclosing statement list). Here we ensure // that the await result itself is stored into a temp at the statement level, as that is // the form handled by async lowering. _needsSpilling = true; var tempAccess = _factory.StoreToTemp(rewrittenAwait, out BoundAssignmentOperator tempAssignment, syntaxOpt: rewrittenAwait.Syntax, kind: SynthesizedLocalKind.Spill); return new BoundSpillSequence( syntax: rewrittenAwait.Syntax, locals: ImmutableArray.Create<LocalSymbol>(tempAccess.LocalSymbol), sideEffects: ImmutableArray.Create<BoundExpression>(tempAssignment), value: tempAccess, type: tempAccess.Type); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using Microsoft.CodeAnalysis.CSharp.Symbols; namespace Microsoft.CodeAnalysis.CSharp { internal sealed partial class LocalRewriter { public override BoundNode VisitAwaitExpression(BoundAwaitExpression node) { return VisitAwaitExpression(node, true); } public BoundExpression VisitAwaitExpression(BoundAwaitExpression node, bool used) { return RewriteAwaitExpression((BoundExpression)base.VisitAwaitExpression(node)!, used); } private BoundExpression RewriteAwaitExpression(SyntaxNode syntax, BoundExpression rewrittenExpression, BoundAwaitableInfo awaitableInfo, TypeSymbol type, bool used) { return RewriteAwaitExpression(new BoundAwaitExpression(syntax, rewrittenExpression, awaitableInfo, type) { WasCompilerGenerated = true }, used); } /// <summary> /// Lower an await expression that has already had its components rewritten. /// </summary> private BoundExpression RewriteAwaitExpression(BoundExpression rewrittenAwait, bool used) { _sawAwait = true; if (!used) { // Await expression is already at the statement level. return rewrittenAwait; } // The await expression will be lowered to code that involves the use of side-effects // such as jumps and labels, which we can only emit with an empty stack, so we require // that the await expression itself is produced only when the stack is empty. // Therefore it is represented by a BoundSpillSequence. The resulting nodes will be "spilled" to move // such statements to the top level (i.e. into the enclosing statement list). Here we ensure // that the await result itself is stored into a temp at the statement level, as that is // the form handled by async lowering. _needsSpilling = true; var tempAccess = _factory.StoreToTemp(rewrittenAwait, out BoundAssignmentOperator tempAssignment, syntaxOpt: rewrittenAwait.Syntax, kind: SynthesizedLocalKind.Spill); return new BoundSpillSequence( syntax: rewrittenAwait.Syntax, locals: ImmutableArray.Create<LocalSymbol>(tempAccess.LocalSymbol), sideEffects: ImmutableArray.Create<BoundExpression>(tempAssignment), value: tempAccess, type: tempAccess.Type); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Portable/Errors/ErrorMessageHelpers.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Runtime.CompilerServices Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic Friend Module ErrorMessageHelpers <Extension()> Public Function ToDisplay(access As Accessibility) As String Select Case access Case Accessibility.NotApplicable Return "" Case Accessibility.Private Return "Private" Case Accessibility.Protected Return "Protected" Case Accessibility.ProtectedOrFriend Return "Protected Friend" Case Accessibility.ProtectedAndFriend Return "Private Protected" Case Accessibility.Friend Return "Friend" Case Accessibility.Public Return "Public" Case Else Throw ExceptionUtilities.UnexpectedValue(access) End Select End Function End Module End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Runtime.CompilerServices Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic Friend Module ErrorMessageHelpers <Extension()> Public Function ToDisplay(access As Accessibility) As String Select Case access Case Accessibility.NotApplicable Return "" Case Accessibility.Private Return "Private" Case Accessibility.Protected Return "Protected" Case Accessibility.ProtectedOrFriend Return "Protected Friend" Case Accessibility.ProtectedAndFriend Return "Private Protected" Case Accessibility.Friend Return "Friend" Case Accessibility.Public Return "Public" Case Else Throw ExceptionUtilities.UnexpectedValue(access) End Select End Function End Module End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/VisualStudio/Core/Def/Implementation/Progression/GraphNodeIdCreation.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.VisualStudio.GraphModel; using Microsoft.VisualStudio.GraphModel.CodeSchema; using Microsoft.VisualStudio.GraphModel.Schemas; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.Progression.CodeSchema; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression { /// <summary> /// A helper class that implements the creation of GraphNodeIds that matches the .dgml creation /// by the metadata progression provider. /// </summary> internal static class GraphNodeIdCreation { public static GraphNodeId GetIdForDocument(Document document) { return GraphNodeId.GetNested( GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, new Uri(document.Project.FilePath, UriKind.RelativeOrAbsolute)), GraphNodeId.GetPartial(CodeGraphNodeIdName.File, new Uri(document.FilePath, UriKind.RelativeOrAbsolute))); } internal static async Task<GraphNodeId> GetIdForNamespaceAsync(INamespaceSymbol symbol, Solution solution, CancellationToken cancellationToken) { var builder = new CodeQualifiedIdentifierBuilder(); var assembly = await GetAssemblyFullPathAsync(symbol, solution, cancellationToken).ConfigureAwait(false); if (assembly != null) { builder.Assembly = assembly; } builder.Namespace = symbol.ToDisplayString(); return builder.ToQualifiedIdentifier(); } internal static async Task<GraphNodeId> GetIdForTypeAsync(ITypeSymbol symbol, Solution solution, CancellationToken cancellationToken) { var nodes = await GetPartialsForNamespaceAndTypeAsync(symbol, true, solution, cancellationToken).ConfigureAwait(false); var partials = nodes.ToArray(); if (partials.Length == 1) { return partials[0]; } else { return GraphNodeId.GetNested(partials); } } private static async Task<IEnumerable<GraphNodeId>> GetPartialsForNamespaceAndTypeAsync(ITypeSymbol symbol, bool includeNamespace, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) { var items = new List<GraphNodeId>(); Uri assembly = null; if (includeNamespace) { assembly = await GetAssemblyFullPathAsync(symbol, solution, cancellationToken).ConfigureAwait(false); } var underlyingType = ChaseToUnderlyingType(symbol); if (symbol.TypeKind == TypeKind.TypeParameter) { var typeParameter = (ITypeParameterSymbol)symbol; if (typeParameter.TypeParameterKind == TypeParameterKind.Type) { if (includeNamespace && !typeParameter.ContainingNamespace.IsGlobalNamespace) { if (assembly != null) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, assembly)); } items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Namespace, typeParameter.ContainingNamespace.ToDisplayString())); } items.Add(await GetPartialForTypeAsync(symbol.ContainingType, CodeGraphNodeIdName.Type, solution, cancellationToken).ConfigureAwait(false)); } items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Parameter, ((ITypeParameterSymbol)symbol).Ordinal.ToString())); } else { if (assembly != null) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, assembly)); } if (underlyingType.TypeKind == TypeKind.Dynamic) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Namespace, "System")); } else if (underlyingType.ContainingNamespace != null && !underlyingType.ContainingNamespace.IsGlobalNamespace) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Namespace, underlyingType.ContainingNamespace.ToDisplayString())); } items.Add(await GetPartialForTypeAsync(symbol, CodeGraphNodeIdName.Type, solution, cancellationToken, isInGenericArguments).ConfigureAwait(false)); } return items; } private static async Task<GraphNodeId> GetPartialForTypeAsync(ITypeSymbol symbol, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) { if (symbol is IArrayTypeSymbol arrayType) { return await GetPartialForArrayTypeAsync(arrayType, nodeName, solution, cancellationToken).ConfigureAwait(false); } else if (symbol is INamedTypeSymbol namedType) { return await GetPartialForNamedTypeAsync(namedType, nodeName, solution, cancellationToken, isInGenericArguments).ConfigureAwait(false); } else if (symbol is IPointerTypeSymbol pointerType) { return await GetPartialForPointerTypeAsync(pointerType, nodeName, solution, cancellationToken).ConfigureAwait(false); } else if (symbol is ITypeParameterSymbol typeParameter) { return await GetPartialForTypeParameterSymbolAsync(typeParameter, nodeName, solution, cancellationToken).ConfigureAwait(false); } else if (symbol is IDynamicTypeSymbol) { return GetPartialForDynamicType(nodeName); } throw ExceptionUtilities.Unreachable; } private static GraphNodeId GetPartialForDynamicType(GraphNodeIdName nodeName) { // We always consider this to be the "Object" type since Progression takes a very metadata-ish view of the type return GraphNodeId.GetPartial(nodeName, "Object"); } private static async Task<GraphNodeId> GetPartialForNamedTypeAsync(INamedTypeSymbol namedType, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) { // If this is a simple type, then we don't have much to do if (namedType.ContainingType == null && Equals(namedType.ConstructedFrom, namedType) && namedType.Arity == 0) { return GraphNodeId.GetPartial(nodeName, namedType.Name); } else { // For a generic type, we need to populate "type" property with the following form: // // Type = (Name =...GenericParameterCount = GenericArguments =...ParentType =...) // // where "Name" contains a symbol name // and "GenericParameterCount" contains the number of type parameters, // and "GenericArguments" contains its type parameters' node information. // and "ParentType" contains its containing type's node information. var partials = new List<GraphNodeId>(); partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, namedType.Name)); if (namedType.Arity > 0) { partials.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.GenericParameterCountIdentifier, namedType.Arity.ToString())); } // For the property "GenericArguments", we only populate them // when type parameters are constructed using instance types (i.e., namedType.ConstructedFrom != namedType). // However, there is a case where we need to populate "GenericArguments" even though arguments are not marked as "constructed" // because a symbol is not marked as "constructed" when a type is constructed using its own type parameters. // To distinguish this case, we use "isInGenericArguments" flag which we pass either to populate arguments recursively or to populate "ParentType". var hasGenericArguments = (!Equals(namedType.ConstructedFrom, namedType) || isInGenericArguments) && namedType.TypeArguments != null && namedType.TypeArguments.Any(); if (hasGenericArguments) { var genericArguments = new List<GraphNodeId>(); foreach (var arg in namedType.TypeArguments) { var nodes = await GetPartialsForNamespaceAndTypeAsync(arg, includeNamespace: true, solution: solution, cancellationToken: cancellationToken, isInGenericArguments: true).ConfigureAwait(false); genericArguments.Add(GraphNodeId.GetNested(nodes.ToArray())); } partials.Add(GraphNodeId.GetArray( CodeGraphNodeIdName.GenericArgumentsIdentifier, genericArguments.ToArray())); } if (namedType.ContainingType != null) { partials.Add(await GetPartialForTypeAsync(namedType.ContainingType, CodeGraphNodeIdName.ParentType, solution, cancellationToken, hasGenericArguments).ConfigureAwait(false)); } return GraphNodeId.GetPartial(nodeName, MakeCollectionIfNecessary(partials.ToArray())); } } private static async Task<GraphNodeId> GetPartialForPointerTypeAsync(IPointerTypeSymbol pointerType, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken) { var indirection = 1; while (pointerType.PointedAtType.TypeKind == TypeKind.Pointer) { indirection++; pointerType = (IPointerTypeSymbol)pointerType.PointedAtType; } var partials = new List<GraphNodeId>(); partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, pointerType.PointedAtType.Name)); partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Indirection, indirection.ToString())); if (pointerType.PointedAtType.ContainingType != null) { partials.Add(await GetPartialForTypeAsync(pointerType.PointedAtType.ContainingType, CodeGraphNodeIdName.ParentType, solution, cancellationToken).ConfigureAwait(false)); } return GraphNodeId.GetPartial(nodeName, MakeCollectionIfNecessary(partials.ToArray())); } private static async Task<GraphNodeId> GetPartialForArrayTypeAsync(IArrayTypeSymbol arrayType, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken) { var partials = new List<GraphNodeId>(); var underlyingType = ChaseToUnderlyingType(arrayType); if (underlyingType.TypeKind == TypeKind.Dynamic) { partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, "Object")); } else if (underlyingType.TypeKind != TypeKind.TypeParameter) { partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, underlyingType.Name)); } partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.ArrayRank, arrayType.Rank.ToString())); partials.Add(await GetPartialForTypeAsync(arrayType.ElementType, CodeGraphNodeIdName.ParentType, solution, cancellationToken).ConfigureAwait(false)); return GraphNodeId.GetPartial(nodeName, MakeCollectionIfNecessary(partials.ToArray())); } private static async Task<GraphNodeId> GetPartialForTypeParameterSymbolAsync(ITypeParameterSymbol typeParameterSymbol, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken) { if (typeParameterSymbol.TypeParameterKind == TypeParameterKind.Method) { return GraphNodeId.GetPartial(nodeName, new GraphNodeIdCollection(false, GraphNodeId.GetPartial(CodeGraphNodeIdName.Parameter, typeParameterSymbol.Ordinal.ToString()))); } else { var nodes = await GetPartialsForNamespaceAndTypeAsync(typeParameterSymbol, false, solution, cancellationToken).ConfigureAwait(false); return GraphNodeId.GetPartial(nodeName, new GraphNodeIdCollection(false, nodes.ToArray())); } } private static ITypeSymbol ChaseToUnderlyingType(ITypeSymbol symbol) { while (symbol.TypeKind == TypeKind.Array) { symbol = ((IArrayTypeSymbol)symbol).ElementType; } while (symbol.TypeKind == TypeKind.Pointer) { symbol = ((IPointerTypeSymbol)symbol).PointedAtType; } return symbol; } public static async Task<GraphNodeId> GetIdForMemberAsync(ISymbol member, Solution solution, CancellationToken cancellationToken) { var partials = new List<GraphNodeId>(); partials.AddRange(await GetPartialsForNamespaceAndTypeAsync(member.ContainingType, true, solution, cancellationToken).ConfigureAwait(false)); var parameters = member.GetParameters(); if (parameters.Any() || member.GetArity() > 0) { var memberPartials = new List<GraphNodeId>(); memberPartials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, member.MetadataName)); if (member.GetArity() > 0) { memberPartials.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.GenericParameterCountIdentifier, member.GetArity().ToString())); } if (parameters.Any()) { var parameterTypeIds = new List<GraphNodeId>(); foreach (var p in parameters) { var parameterIds = await GetPartialsForNamespaceAndTypeAsync(p.Type, true, solution, cancellationToken).ConfigureAwait(false); var nodes = parameterIds.ToList(); if (p.IsRefOrOut()) { nodes.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.ParamKind, ParamKind.Ref)); } parameterTypeIds.Add(GraphNodeId.GetNested(nodes.ToArray())); } if (member is IMethodSymbol methodSymbol && methodSymbol.MethodKind == MethodKind.Conversion) { // For explicit/implicit conversion operators, we need to include the return type in the method Id, // because there can be several conversion operators with same parameters and only differ by return type. // For example, // // public class Class1 // { // public static explicit (explicit) operator int(Class1 c) { ... } // public static explicit (explicit) operator double(Class1 c) { ... } // } var nodes = await GetPartialsForNamespaceAndTypeAsync(methodSymbol.ReturnType, true, solution, cancellationToken).ConfigureAwait(false); var returnTypePartial = nodes.ToList(); returnTypePartial.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.ParamKind, Microsoft.VisualStudio.GraphModel.CodeSchema.ParamKind.Return)); var returnCollection = GraphNodeId.GetNested(returnTypePartial.ToArray()); parameterTypeIds.Add(returnCollection); } memberPartials.Add(GraphNodeId.GetArray( CodeGraphNodeIdName.OverloadingParameters, parameterTypeIds.ToArray())); } partials.Add(GraphNodeId.GetPartial( CodeGraphNodeIdName.Member, MakeCollectionIfNecessary(memberPartials.ToArray()))); } else { partials.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Member, member.MetadataName)); } return GraphNodeId.GetNested(partials.ToArray()); } private static object MakeCollectionIfNecessary(GraphNodeId[] array) { // Place the array of GraphNodeId's into the collection if necessary, so to make them appear in VS Properties Panel if (array.Length > 1) { return new GraphNodeIdCollection(false, array); } return GraphNodeId.GetNested(array); } private static IAssemblySymbol GetContainingAssembly(ISymbol symbol) { if (symbol.ContainingAssembly != null) { return symbol.ContainingAssembly; } if (!(symbol is ITypeSymbol typeSymbol)) { return null; } var underlyingType = ChaseToUnderlyingType(typeSymbol); if (Equals(typeSymbol, underlyingType)) { // when symbol is for dynamic type return null; } return GetContainingAssembly(underlyingType); } private static async Task<Uri> GetAssemblyFullPathAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken) { var containingAssembly = GetContainingAssembly(symbol); return await GetAssemblyFullPathAsync(containingAssembly, solution, cancellationToken).ConfigureAwait(false); } private static async Task<Uri> GetAssemblyFullPathAsync(IAssemblySymbol containingAssembly, Solution solution, CancellationToken cancellationToken) { if (containingAssembly == null) { return null; } var foundProject = solution.GetProject(containingAssembly, cancellationToken); if (foundProject != null) { if (solution.Workspace is VisualStudioWorkspace) { // TODO: audit the OutputFilePath and whether this is bin or obj if (!string.IsNullOrWhiteSpace(foundProject.OutputFilePath)) { return new Uri(foundProject.OutputFilePath, UriKind.RelativeOrAbsolute); } return null; } } else { // This symbol is not present in the source code, we need to resolve it from the references! // If a MetadataReference returned by Compilation.GetMetadataReference(AssemblySymbol) has a path, we could use it. foreach (var project in solution.Projects) { var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); if (compilation != null) { if (compilation.GetMetadataReference(containingAssembly) is PortableExecutableReference reference && !string.IsNullOrEmpty(reference.FilePath)) { return new Uri(reference.FilePath, UriKind.RelativeOrAbsolute); } } } } // If we are not in VS, return project.OutputFilePath as a reasonable fallback. // For an example, it could be AdhocWorkspace for unit tests. if (foundProject != null && !string.IsNullOrEmpty(foundProject.OutputFilePath)) { return new Uri(foundProject.OutputFilePath, UriKind.Absolute); } return null; } internal static async Task<GraphNodeId> GetIdForAssemblyAsync(IAssemblySymbol assemblySymbol, Solution solution, CancellationToken cancellationToken) { var assembly = await GetAssemblyFullPathAsync(assemblySymbol, solution, cancellationToken).ConfigureAwait(false); if (assembly != null) { var builder = new CodeQualifiedIdentifierBuilder(); builder.Assembly = assembly; return builder.ToQualifiedIdentifier(); } return null; } internal static async Task<GraphNodeId> GetIdForParameterAsync(IParameterSymbol symbol, Solution solution, CancellationToken cancellationToken) { if (symbol.ContainingSymbol == null || (symbol.ContainingSymbol.Kind != SymbolKind.Method && symbol.ContainingSymbol.Kind != SymbolKind.Property)) { // We are only support parameters inside methods or properties. throw new ArgumentException("symbol"); } var containingSymbol = symbol.ContainingSymbol; if (containingSymbol is IMethodSymbol method && method.AssociatedSymbol != null && method.AssociatedSymbol.Kind == SymbolKind.Property) { var property = (IPropertySymbol)method.AssociatedSymbol; if (property.Parameters.Any(p => p.Name == symbol.Name)) { containingSymbol = property; } } var memberId = await GetIdForMemberAsync(containingSymbol, solution, cancellationToken).ConfigureAwait(false); if (memberId != null) { return memberId + GraphNodeId.GetPartial(CodeGraphNodeIdName.Parameter, symbol.Name); } return null; } internal static async Task<GraphNodeId> GetIdForLocalVariableAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken) { if (symbol.ContainingSymbol == null || (symbol.ContainingSymbol.Kind != SymbolKind.Method && symbol.ContainingSymbol.Kind != SymbolKind.Property)) { // We are only support local variables inside methods or properties. throw new ArgumentException("symbol"); } var memberId = await GetIdForMemberAsync(symbol.ContainingSymbol, solution, cancellationToken).ConfigureAwait(false); if (memberId != null) { var builder = new CodeQualifiedIdentifierBuilder(memberId); builder.LocalVariable = symbol.Name; builder.LocalVariableIndex = await GetLocalVariableIndexAsync(symbol, solution, cancellationToken).ConfigureAwait(continueOnCapturedContext: false); return builder.ToQualifiedIdentifier(); } return null; } /// <summary> /// Get the position of where a given local variable is defined considering there could be multiple variables with the same name in method body. /// For example, in "int M() { { int goo = 0; ...} { int goo = 1; ...} }", /// the return value for the first "goo" would be 0 while the value for the second one would be 1. /// It will be used to create a node with LocalVariableIndex for a non-zero value. /// In the above example, hence, a node id for the first "goo" would look like (... Member=M LocalVariable=bar) /// but an id for the second "goo" would be (... Member=M LocalVariable=bar LocalVariableIndex=1) /// </summary> private static async Task<int> GetLocalVariableIndexAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken) { var pos = 0; foreach (var reference in symbol.ContainingSymbol.DeclaringSyntaxReferences) { var currentNode = await reference.GetSyntaxAsync(cancellationToken).ConfigureAwait(false); // For VB, we have to ask its parent to get local variables within this method body // since DeclaringSyntaxReferences return statement rather than enclosing block. if (currentNode != null && symbol.Language == LanguageNames.VisualBasic) { currentNode = currentNode.Parent; } if (currentNode != null) { var document = solution.GetDocument(currentNode.SyntaxTree); if (document == null) { continue; } var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); foreach (var node in currentNode.DescendantNodes()) { var current = semanticModel.GetDeclaredSymbol(node, cancellationToken); if (current != null && current.Name == symbol.Name && (current.Kind == SymbolKind.Local || current.Kind == SymbolKind.RangeVariable)) { if (!current.Equals(symbol)) { pos++; } else { return pos; } } } } } throw ExceptionUtilities.Unreachable; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.VisualStudio.GraphModel; using Microsoft.VisualStudio.GraphModel.CodeSchema; using Microsoft.VisualStudio.GraphModel.Schemas; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.Progression.CodeSchema; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression { /// <summary> /// A helper class that implements the creation of GraphNodeIds that matches the .dgml creation /// by the metadata progression provider. /// </summary> internal static class GraphNodeIdCreation { public static GraphNodeId GetIdForDocument(Document document) { return GraphNodeId.GetNested( GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, new Uri(document.Project.FilePath, UriKind.RelativeOrAbsolute)), GraphNodeId.GetPartial(CodeGraphNodeIdName.File, new Uri(document.FilePath, UriKind.RelativeOrAbsolute))); } internal static async Task<GraphNodeId> GetIdForNamespaceAsync(INamespaceSymbol symbol, Solution solution, CancellationToken cancellationToken) { var builder = new CodeQualifiedIdentifierBuilder(); var assembly = await GetAssemblyFullPathAsync(symbol, solution, cancellationToken).ConfigureAwait(false); if (assembly != null) { builder.Assembly = assembly; } builder.Namespace = symbol.ToDisplayString(); return builder.ToQualifiedIdentifier(); } internal static async Task<GraphNodeId> GetIdForTypeAsync(ITypeSymbol symbol, Solution solution, CancellationToken cancellationToken) { var nodes = await GetPartialsForNamespaceAndTypeAsync(symbol, true, solution, cancellationToken).ConfigureAwait(false); var partials = nodes.ToArray(); if (partials.Length == 1) { return partials[0]; } else { return GraphNodeId.GetNested(partials); } } private static async Task<IEnumerable<GraphNodeId>> GetPartialsForNamespaceAndTypeAsync(ITypeSymbol symbol, bool includeNamespace, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) { var items = new List<GraphNodeId>(); Uri assembly = null; if (includeNamespace) { assembly = await GetAssemblyFullPathAsync(symbol, solution, cancellationToken).ConfigureAwait(false); } var underlyingType = ChaseToUnderlyingType(symbol); if (symbol.TypeKind == TypeKind.TypeParameter) { var typeParameter = (ITypeParameterSymbol)symbol; if (typeParameter.TypeParameterKind == TypeParameterKind.Type) { if (includeNamespace && !typeParameter.ContainingNamespace.IsGlobalNamespace) { if (assembly != null) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, assembly)); } items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Namespace, typeParameter.ContainingNamespace.ToDisplayString())); } items.Add(await GetPartialForTypeAsync(symbol.ContainingType, CodeGraphNodeIdName.Type, solution, cancellationToken).ConfigureAwait(false)); } items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Parameter, ((ITypeParameterSymbol)symbol).Ordinal.ToString())); } else { if (assembly != null) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Assembly, assembly)); } if (underlyingType.TypeKind == TypeKind.Dynamic) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Namespace, "System")); } else if (underlyingType.ContainingNamespace != null && !underlyingType.ContainingNamespace.IsGlobalNamespace) { items.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Namespace, underlyingType.ContainingNamespace.ToDisplayString())); } items.Add(await GetPartialForTypeAsync(symbol, CodeGraphNodeIdName.Type, solution, cancellationToken, isInGenericArguments).ConfigureAwait(false)); } return items; } private static async Task<GraphNodeId> GetPartialForTypeAsync(ITypeSymbol symbol, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) { if (symbol is IArrayTypeSymbol arrayType) { return await GetPartialForArrayTypeAsync(arrayType, nodeName, solution, cancellationToken).ConfigureAwait(false); } else if (symbol is INamedTypeSymbol namedType) { return await GetPartialForNamedTypeAsync(namedType, nodeName, solution, cancellationToken, isInGenericArguments).ConfigureAwait(false); } else if (symbol is IPointerTypeSymbol pointerType) { return await GetPartialForPointerTypeAsync(pointerType, nodeName, solution, cancellationToken).ConfigureAwait(false); } else if (symbol is ITypeParameterSymbol typeParameter) { return await GetPartialForTypeParameterSymbolAsync(typeParameter, nodeName, solution, cancellationToken).ConfigureAwait(false); } else if (symbol is IDynamicTypeSymbol) { return GetPartialForDynamicType(nodeName); } throw ExceptionUtilities.Unreachable; } private static GraphNodeId GetPartialForDynamicType(GraphNodeIdName nodeName) { // We always consider this to be the "Object" type since Progression takes a very metadata-ish view of the type return GraphNodeId.GetPartial(nodeName, "Object"); } private static async Task<GraphNodeId> GetPartialForNamedTypeAsync(INamedTypeSymbol namedType, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken, bool isInGenericArguments = false) { // If this is a simple type, then we don't have much to do if (namedType.ContainingType == null && Equals(namedType.ConstructedFrom, namedType) && namedType.Arity == 0) { return GraphNodeId.GetPartial(nodeName, namedType.Name); } else { // For a generic type, we need to populate "type" property with the following form: // // Type = (Name =...GenericParameterCount = GenericArguments =...ParentType =...) // // where "Name" contains a symbol name // and "GenericParameterCount" contains the number of type parameters, // and "GenericArguments" contains its type parameters' node information. // and "ParentType" contains its containing type's node information. var partials = new List<GraphNodeId>(); partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, namedType.Name)); if (namedType.Arity > 0) { partials.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.GenericParameterCountIdentifier, namedType.Arity.ToString())); } // For the property "GenericArguments", we only populate them // when type parameters are constructed using instance types (i.e., namedType.ConstructedFrom != namedType). // However, there is a case where we need to populate "GenericArguments" even though arguments are not marked as "constructed" // because a symbol is not marked as "constructed" when a type is constructed using its own type parameters. // To distinguish this case, we use "isInGenericArguments" flag which we pass either to populate arguments recursively or to populate "ParentType". var hasGenericArguments = (!Equals(namedType.ConstructedFrom, namedType) || isInGenericArguments) && namedType.TypeArguments != null && namedType.TypeArguments.Any(); if (hasGenericArguments) { var genericArguments = new List<GraphNodeId>(); foreach (var arg in namedType.TypeArguments) { var nodes = await GetPartialsForNamespaceAndTypeAsync(arg, includeNamespace: true, solution: solution, cancellationToken: cancellationToken, isInGenericArguments: true).ConfigureAwait(false); genericArguments.Add(GraphNodeId.GetNested(nodes.ToArray())); } partials.Add(GraphNodeId.GetArray( CodeGraphNodeIdName.GenericArgumentsIdentifier, genericArguments.ToArray())); } if (namedType.ContainingType != null) { partials.Add(await GetPartialForTypeAsync(namedType.ContainingType, CodeGraphNodeIdName.ParentType, solution, cancellationToken, hasGenericArguments).ConfigureAwait(false)); } return GraphNodeId.GetPartial(nodeName, MakeCollectionIfNecessary(partials.ToArray())); } } private static async Task<GraphNodeId> GetPartialForPointerTypeAsync(IPointerTypeSymbol pointerType, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken) { var indirection = 1; while (pointerType.PointedAtType.TypeKind == TypeKind.Pointer) { indirection++; pointerType = (IPointerTypeSymbol)pointerType.PointedAtType; } var partials = new List<GraphNodeId>(); partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, pointerType.PointedAtType.Name)); partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Indirection, indirection.ToString())); if (pointerType.PointedAtType.ContainingType != null) { partials.Add(await GetPartialForTypeAsync(pointerType.PointedAtType.ContainingType, CodeGraphNodeIdName.ParentType, solution, cancellationToken).ConfigureAwait(false)); } return GraphNodeId.GetPartial(nodeName, MakeCollectionIfNecessary(partials.ToArray())); } private static async Task<GraphNodeId> GetPartialForArrayTypeAsync(IArrayTypeSymbol arrayType, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken) { var partials = new List<GraphNodeId>(); var underlyingType = ChaseToUnderlyingType(arrayType); if (underlyingType.TypeKind == TypeKind.Dynamic) { partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, "Object")); } else if (underlyingType.TypeKind != TypeKind.TypeParameter) { partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, underlyingType.Name)); } partials.Add(GraphNodeId.GetPartial(CodeQualifiedName.ArrayRank, arrayType.Rank.ToString())); partials.Add(await GetPartialForTypeAsync(arrayType.ElementType, CodeGraphNodeIdName.ParentType, solution, cancellationToken).ConfigureAwait(false)); return GraphNodeId.GetPartial(nodeName, MakeCollectionIfNecessary(partials.ToArray())); } private static async Task<GraphNodeId> GetPartialForTypeParameterSymbolAsync(ITypeParameterSymbol typeParameterSymbol, GraphNodeIdName nodeName, Solution solution, CancellationToken cancellationToken) { if (typeParameterSymbol.TypeParameterKind == TypeParameterKind.Method) { return GraphNodeId.GetPartial(nodeName, new GraphNodeIdCollection(false, GraphNodeId.GetPartial(CodeGraphNodeIdName.Parameter, typeParameterSymbol.Ordinal.ToString()))); } else { var nodes = await GetPartialsForNamespaceAndTypeAsync(typeParameterSymbol, false, solution, cancellationToken).ConfigureAwait(false); return GraphNodeId.GetPartial(nodeName, new GraphNodeIdCollection(false, nodes.ToArray())); } } private static ITypeSymbol ChaseToUnderlyingType(ITypeSymbol symbol) { while (symbol.TypeKind == TypeKind.Array) { symbol = ((IArrayTypeSymbol)symbol).ElementType; } while (symbol.TypeKind == TypeKind.Pointer) { symbol = ((IPointerTypeSymbol)symbol).PointedAtType; } return symbol; } public static async Task<GraphNodeId> GetIdForMemberAsync(ISymbol member, Solution solution, CancellationToken cancellationToken) { var partials = new List<GraphNodeId>(); partials.AddRange(await GetPartialsForNamespaceAndTypeAsync(member.ContainingType, true, solution, cancellationToken).ConfigureAwait(false)); var parameters = member.GetParameters(); if (parameters.Any() || member.GetArity() > 0) { var memberPartials = new List<GraphNodeId>(); memberPartials.Add(GraphNodeId.GetPartial(CodeQualifiedName.Name, member.MetadataName)); if (member.GetArity() > 0) { memberPartials.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.GenericParameterCountIdentifier, member.GetArity().ToString())); } if (parameters.Any()) { var parameterTypeIds = new List<GraphNodeId>(); foreach (var p in parameters) { var parameterIds = await GetPartialsForNamespaceAndTypeAsync(p.Type, true, solution, cancellationToken).ConfigureAwait(false); var nodes = parameterIds.ToList(); if (p.IsRefOrOut()) { nodes.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.ParamKind, ParamKind.Ref)); } parameterTypeIds.Add(GraphNodeId.GetNested(nodes.ToArray())); } if (member is IMethodSymbol methodSymbol && methodSymbol.MethodKind == MethodKind.Conversion) { // For explicit/implicit conversion operators, we need to include the return type in the method Id, // because there can be several conversion operators with same parameters and only differ by return type. // For example, // // public class Class1 // { // public static explicit (explicit) operator int(Class1 c) { ... } // public static explicit (explicit) operator double(Class1 c) { ... } // } var nodes = await GetPartialsForNamespaceAndTypeAsync(methodSymbol.ReturnType, true, solution, cancellationToken).ConfigureAwait(false); var returnTypePartial = nodes.ToList(); returnTypePartial.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.ParamKind, Microsoft.VisualStudio.GraphModel.CodeSchema.ParamKind.Return)); var returnCollection = GraphNodeId.GetNested(returnTypePartial.ToArray()); parameterTypeIds.Add(returnCollection); } memberPartials.Add(GraphNodeId.GetArray( CodeGraphNodeIdName.OverloadingParameters, parameterTypeIds.ToArray())); } partials.Add(GraphNodeId.GetPartial( CodeGraphNodeIdName.Member, MakeCollectionIfNecessary(memberPartials.ToArray()))); } else { partials.Add(GraphNodeId.GetPartial(CodeGraphNodeIdName.Member, member.MetadataName)); } return GraphNodeId.GetNested(partials.ToArray()); } private static object MakeCollectionIfNecessary(GraphNodeId[] array) { // Place the array of GraphNodeId's into the collection if necessary, so to make them appear in VS Properties Panel if (array.Length > 1) { return new GraphNodeIdCollection(false, array); } return GraphNodeId.GetNested(array); } private static IAssemblySymbol GetContainingAssembly(ISymbol symbol) { if (symbol.ContainingAssembly != null) { return symbol.ContainingAssembly; } if (!(symbol is ITypeSymbol typeSymbol)) { return null; } var underlyingType = ChaseToUnderlyingType(typeSymbol); if (Equals(typeSymbol, underlyingType)) { // when symbol is for dynamic type return null; } return GetContainingAssembly(underlyingType); } private static async Task<Uri> GetAssemblyFullPathAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken) { var containingAssembly = GetContainingAssembly(symbol); return await GetAssemblyFullPathAsync(containingAssembly, solution, cancellationToken).ConfigureAwait(false); } private static async Task<Uri> GetAssemblyFullPathAsync(IAssemblySymbol containingAssembly, Solution solution, CancellationToken cancellationToken) { if (containingAssembly == null) { return null; } var foundProject = solution.GetProject(containingAssembly, cancellationToken); if (foundProject != null) { if (solution.Workspace is VisualStudioWorkspace) { // TODO: audit the OutputFilePath and whether this is bin or obj if (!string.IsNullOrWhiteSpace(foundProject.OutputFilePath)) { return new Uri(foundProject.OutputFilePath, UriKind.RelativeOrAbsolute); } return null; } } else { // This symbol is not present in the source code, we need to resolve it from the references! // If a MetadataReference returned by Compilation.GetMetadataReference(AssemblySymbol) has a path, we could use it. foreach (var project in solution.Projects) { var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); if (compilation != null) { if (compilation.GetMetadataReference(containingAssembly) is PortableExecutableReference reference && !string.IsNullOrEmpty(reference.FilePath)) { return new Uri(reference.FilePath, UriKind.RelativeOrAbsolute); } } } } // If we are not in VS, return project.OutputFilePath as a reasonable fallback. // For an example, it could be AdhocWorkspace for unit tests. if (foundProject != null && !string.IsNullOrEmpty(foundProject.OutputFilePath)) { return new Uri(foundProject.OutputFilePath, UriKind.Absolute); } return null; } internal static async Task<GraphNodeId> GetIdForAssemblyAsync(IAssemblySymbol assemblySymbol, Solution solution, CancellationToken cancellationToken) { var assembly = await GetAssemblyFullPathAsync(assemblySymbol, solution, cancellationToken).ConfigureAwait(false); if (assembly != null) { var builder = new CodeQualifiedIdentifierBuilder(); builder.Assembly = assembly; return builder.ToQualifiedIdentifier(); } return null; } internal static async Task<GraphNodeId> GetIdForParameterAsync(IParameterSymbol symbol, Solution solution, CancellationToken cancellationToken) { if (symbol.ContainingSymbol == null || (symbol.ContainingSymbol.Kind != SymbolKind.Method && symbol.ContainingSymbol.Kind != SymbolKind.Property)) { // We are only support parameters inside methods or properties. throw new ArgumentException("symbol"); } var containingSymbol = symbol.ContainingSymbol; if (containingSymbol is IMethodSymbol method && method.AssociatedSymbol != null && method.AssociatedSymbol.Kind == SymbolKind.Property) { var property = (IPropertySymbol)method.AssociatedSymbol; if (property.Parameters.Any(p => p.Name == symbol.Name)) { containingSymbol = property; } } var memberId = await GetIdForMemberAsync(containingSymbol, solution, cancellationToken).ConfigureAwait(false); if (memberId != null) { return memberId + GraphNodeId.GetPartial(CodeGraphNodeIdName.Parameter, symbol.Name); } return null; } internal static async Task<GraphNodeId> GetIdForLocalVariableAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken) { if (symbol.ContainingSymbol == null || (symbol.ContainingSymbol.Kind != SymbolKind.Method && symbol.ContainingSymbol.Kind != SymbolKind.Property)) { // We are only support local variables inside methods or properties. throw new ArgumentException("symbol"); } var memberId = await GetIdForMemberAsync(symbol.ContainingSymbol, solution, cancellationToken).ConfigureAwait(false); if (memberId != null) { var builder = new CodeQualifiedIdentifierBuilder(memberId); builder.LocalVariable = symbol.Name; builder.LocalVariableIndex = await GetLocalVariableIndexAsync(symbol, solution, cancellationToken).ConfigureAwait(continueOnCapturedContext: false); return builder.ToQualifiedIdentifier(); } return null; } /// <summary> /// Get the position of where a given local variable is defined considering there could be multiple variables with the same name in method body. /// For example, in "int M() { { int goo = 0; ...} { int goo = 1; ...} }", /// the return value for the first "goo" would be 0 while the value for the second one would be 1. /// It will be used to create a node with LocalVariableIndex for a non-zero value. /// In the above example, hence, a node id for the first "goo" would look like (... Member=M LocalVariable=bar) /// but an id for the second "goo" would be (... Member=M LocalVariable=bar LocalVariableIndex=1) /// </summary> private static async Task<int> GetLocalVariableIndexAsync(ISymbol symbol, Solution solution, CancellationToken cancellationToken) { var pos = 0; foreach (var reference in symbol.ContainingSymbol.DeclaringSyntaxReferences) { var currentNode = await reference.GetSyntaxAsync(cancellationToken).ConfigureAwait(false); // For VB, we have to ask its parent to get local variables within this method body // since DeclaringSyntaxReferences return statement rather than enclosing block. if (currentNode != null && symbol.Language == LanguageNames.VisualBasic) { currentNode = currentNode.Parent; } if (currentNode != null) { var document = solution.GetDocument(currentNode.SyntaxTree); if (document == null) { continue; } var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); foreach (var node in currentNode.DescendantNodes()) { var current = semanticModel.GetDeclaredSymbol(node, cancellationToken); if (current != null && current.Name == symbol.Name && (current.Kind == SymbolKind.Local || current.Kind == SymbolKind.RangeVariable)) { if (!current.Equals(symbol)) { pos++; } else { return pos; } } } } } throw ExceptionUtilities.Unreachable; } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Test/Emit/PDB/CSharpDeterministicBuildCompilationTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Reflection.Metadata; using System.Reflection.PortableExecutable; using System.Text; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Debugging; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Test.Utilities.PDB; using Roslyn.Utilities; using TestResources.NetFX; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.PDB { public class CSharpDeterministicBuildCompilationTests : CSharpTestBase, IEnumerable<object[]> { private static void VerifyCompilationOptions( CSharpCompilationOptions originalOptions, Compilation compilation, EmitOptions emitOptions, BlobReader compilationOptionsBlobReader, string langVersion, int sourceFileCount) { var pdbOptions = DeterministicBuildCompilationTestHelpers.ParseCompilationOptions(compilationOptionsBlobReader); DeterministicBuildCompilationTestHelpers.AssertCommonOptions(emitOptions, originalOptions, compilation, pdbOptions); // See CSharpCompilation.SerializeForPdb to see options that are included pdbOptions.VerifyPdbOption("nullable", originalOptions.NullableContextOptions); pdbOptions.VerifyPdbOption("checked", originalOptions.CheckOverflow); pdbOptions.VerifyPdbOption("unsafe", originalOptions.AllowUnsafe); Assert.Equal(langVersion, pdbOptions["language-version"]); Assert.Equal(sourceFileCount.ToString(), pdbOptions["source-file-count"]); var firstSyntaxTree = (CSharpSyntaxTree)compilation.SyntaxTrees.FirstOrDefault(); pdbOptions.VerifyPdbOption("define", firstSyntaxTree.Options.PreprocessorSymbolNames, isDefault: v => v.IsEmpty(), toString: v => string.Join(",", v)); } private static void TestDeterministicCompilationCSharp( string langVersion, SyntaxTree[] syntaxTrees, CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, TestMetadataReferenceInfo[] metadataReferences, int? debugDocumentsCount = null) { var targetFramework = TargetFramework.NetCoreApp; var originalCompilation = CreateCompilation( syntaxTrees, references: metadataReferences.SelectAsArray(r => r.MetadataReference), options: compilationOptions, targetFramework: targetFramework); var peBlob = originalCompilation.EmitToArray(options: emitOptions); using (var peReader = new PEReader(peBlob)) { var entries = peReader.ReadDebugDirectory(); AssertEx.Equal(new[] { DebugDirectoryEntryType.CodeView, DebugDirectoryEntryType.PdbChecksum, DebugDirectoryEntryType.Reproducible, DebugDirectoryEntryType.EmbeddedPortablePdb }, entries.Select(e => e.Type)); var codeView = entries[0]; var checksum = entries[1]; var reproducible = entries[2]; var embedded = entries[3]; using (var embeddedPdb = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded)) { var pdbReader = embeddedPdb.GetMetadataReader(); var metadataReferenceReader = DeterministicBuildCompilationTestHelpers.GetSingleBlob(PortableCustomDebugInfoKinds.CompilationMetadataReferences, pdbReader); var compilationOptionsReader = DeterministicBuildCompilationTestHelpers.GetSingleBlob(PortableCustomDebugInfoKinds.CompilationOptions, pdbReader); Assert.Equal(debugDocumentsCount ?? syntaxTrees.Length, pdbReader.Documents.Count); VerifyCompilationOptions(compilationOptions, originalCompilation, emitOptions, compilationOptionsReader, langVersion, syntaxTrees.Length); DeterministicBuildCompilationTestHelpers.VerifyReferenceInfo(metadataReferences, targetFramework, metadataReferenceReader); } } } [Theory] [ClassData(typeof(CSharpDeterministicBuildCompilationTests))] public void PortablePdb_DeterministicCompilation(CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, CSharpParseOptions parseOptions) { var sourceOne = Parse(@" using System; class MainType { public static void Main() { Console.WriteLine(); } } ", filename: "a.cs", options: parseOptions, encoding: Encoding.UTF8); var sourceTwo = Parse(@" class TypeTwo { }", filename: "b.cs", options: parseOptions, encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); var sourceThree = Parse(@" class TypeThree { }", filename: "c.cs", options: parseOptions, encoding: Encoding.Unicode); var referenceOneCompilation = CreateCompilation( @"public struct StructWithReference { string PrivateData; } public struct StructWithValue { int PrivateData; }", options: TestOptions.DebugDll); var referenceTwoCompilation = CreateCompilation( @"public class ReferenceTwo { }", options: TestOptions.DebugDll); using var referenceOne = TestMetadataReferenceInfo.Create( referenceOneCompilation, fullPath: "abcd.dll", emitOptions: emitOptions); using var referenceTwo = TestMetadataReferenceInfo.Create( referenceTwoCompilation, fullPath: "efgh.dll", emitOptions: emitOptions); var testSource = new[] { sourceOne, sourceTwo, sourceThree }; TestDeterministicCompilationCSharp( parseOptions.LanguageVersion.MapSpecifiedToEffectiveVersion().ToDisplayString(), testSource, compilationOptions, emitOptions, new[] { referenceOne, referenceTwo }); } [Theory] [ClassData(typeof(CSharpDeterministicBuildCompilationTests))] public void PortablePdb_DeterministicCompilation_DuplicateFilePaths(CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, CSharpParseOptions parseOptions) { var sourceOne = Parse(@" using System; class MainType { public static void Main() { Console.WriteLine(); } } ", filename: "a.cs", options: parseOptions, encoding: Encoding.UTF8); var sourceTwo = Parse(@" class TypeTwo { }", filename: "b.cs", options: parseOptions, encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); var sourceThree = Parse(@" class TypeThree { }", filename: "a.cs", options: parseOptions, encoding: Encoding.Unicode); var referenceOneCompilation = CreateCompilation( @"public struct StructWithReference { string PrivateData; } public struct StructWithValue { int PrivateData; }", options: TestOptions.DebugDll); var referenceTwoCompilation = CreateCompilation( @"public class ReferenceTwo { }", options: TestOptions.DebugDll); using var referenceOne = TestMetadataReferenceInfo.Create( referenceOneCompilation, fullPath: "abcd.dll", emitOptions: emitOptions); using var referenceTwo = TestMetadataReferenceInfo.Create( referenceTwoCompilation, fullPath: "efgh.dll", emitOptions: emitOptions); var testSource = new[] { sourceOne, sourceTwo, sourceThree }; // Note that only one debug document can be present for each distinct source path. // So if more than one syntax tree has the same file path, it won't be possible to do a rebuild from the DLL+PDB. TestDeterministicCompilationCSharp( parseOptions.LanguageVersion.MapSpecifiedToEffectiveVersion().ToDisplayString(), testSource, compilationOptions, emitOptions, new[] { referenceOne, referenceTwo }, debugDocumentsCount: 2); } [ConditionalTheory(typeof(DesktopOnly))] [ClassData(typeof(CSharpDeterministicBuildCompilationTests))] public void PortablePdb_DeterministicCompilationWithSJIS(CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, CSharpParseOptions parseOptions) { var sourceOne = Parse(@" using System; class MainType { public static void Main() { Console.WriteLine(); } } ", filename: "a.cs", options: parseOptions, encoding: Encoding.UTF8); var sourceTwo = Parse(@" class TypeTwo { }", filename: "b.cs", options: parseOptions, encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); var sourceThree = Parse(@" class TypeThree { }", filename: "c.cs", options: parseOptions, encoding: Encoding.GetEncoding(932)); // SJIS encoding var referenceOneCompilation = CreateCompilation( @"public struct StructWithReference { string PrivateData; } public struct StructWithValue { int PrivateData; }", options: TestOptions.DebugDll); var referenceTwoCompilation = CreateCompilation( @"public class ReferenceTwo { }", options: TestOptions.DebugDll); using var referenceOne = TestMetadataReferenceInfo.Create( referenceOneCompilation, fullPath: "abcd.dll", emitOptions: emitOptions); using var referenceTwo = TestMetadataReferenceInfo.Create( referenceTwoCompilation, fullPath: "efgh.dll", emitOptions: emitOptions); var testSource = new[] { sourceOne, sourceTwo, sourceThree }; TestDeterministicCompilationCSharp( parseOptions.LanguageVersion.MapSpecifiedToEffectiveVersion().ToDisplayString(), testSource, compilationOptions, emitOptions, new[] { referenceOne, referenceTwo }); } public IEnumerator<object[]> GetEnumerator() => GetTestParameters().GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); private static IEnumerable<object[]> GetTestParameters() { foreach (var compilationOptions in GetCompilationOptions()) { foreach (var emitOptions in DeterministicBuildCompilationTestHelpers.GetEmitOptions()) { foreach (var parseOptions in GetCSharpParseOptions()) { yield return new object[] { compilationOptions, emitOptions, parseOptions }; } } } } private static IEnumerable<CSharpCompilationOptions> GetCompilationOptions() { // Provide non default options for to test that they are being serialized // to the pdb correctly. It needs to produce a compilation to be emitted, but otherwise // everything should be non-default if possible. Diagnostic settings are ignored // because they won't be serialized. // Use constructor that requires all arguments. If new arguments are added, it's possible they need to be // included in the pdb serialization and added to tests here var defaultOptions = new CSharpCompilationOptions( OutputKind.ConsoleApplication, reportSuppressedDiagnostics: false, moduleName: "Module", mainTypeName: "MainType", scriptClassName: null, usings: new[] { "System", "System.Threading" }, optimizationLevel: OptimizationLevel.Debug, checkOverflow: true, allowUnsafe: true, cryptoKeyContainer: null, cryptoKeyFile: null, cryptoPublicKey: default, delaySign: null, platform: Platform.AnyCpu, generalDiagnosticOption: ReportDiagnostic.Default, warningLevel: 4, specificDiagnosticOptions: null, concurrentBuild: true, deterministic: true, currentLocalTime: default, debugPlusMode: false, xmlReferenceResolver: null, sourceReferenceResolver: null, syntaxTreeOptionsProvider: null, metadataReferenceResolver: null, assemblyIdentityComparer: null, strongNameProvider: null, metadataImportOptions: MetadataImportOptions.Public, referencesSupersedeLowerVersions: false, publicSign: false, topLevelBinderFlags: BinderFlags.None, nullableContextOptions: NullableContextOptions.Enable); yield return defaultOptions; yield return defaultOptions.WithNullableContextOptions(NullableContextOptions.Disable); yield return defaultOptions.WithNullableContextOptions(NullableContextOptions.Warnings); yield return defaultOptions.WithOptimizationLevel(OptimizationLevel.Release); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: false, suppressSilverlightPlatformAssembliesPortability: false))); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: true, suppressSilverlightPlatformAssembliesPortability: false))); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: false, suppressSilverlightPlatformAssembliesPortability: true))); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: true, suppressSilverlightPlatformAssembliesPortability: true))); } private static IEnumerable<CSharpParseOptions> GetCSharpParseOptions() { var parseOptions = new CSharpParseOptions( languageVersion: LanguageVersion.CSharp8, kind: SourceCodeKind.Regular); yield return parseOptions; yield return parseOptions.WithLanguageVersion(LanguageVersion.CSharp9); yield return parseOptions.WithLanguageVersion(LanguageVersion.Latest); yield return parseOptions.WithLanguageVersion(LanguageVersion.Preview); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Reflection.Metadata; using System.Reflection.PortableExecutable; using System.Text; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Debugging; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Test.Utilities.PDB; using Roslyn.Utilities; using TestResources.NetFX; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.PDB { public class CSharpDeterministicBuildCompilationTests : CSharpTestBase, IEnumerable<object[]> { private static void VerifyCompilationOptions( CSharpCompilationOptions originalOptions, Compilation compilation, EmitOptions emitOptions, BlobReader compilationOptionsBlobReader, string langVersion, int sourceFileCount) { var pdbOptions = DeterministicBuildCompilationTestHelpers.ParseCompilationOptions(compilationOptionsBlobReader); DeterministicBuildCompilationTestHelpers.AssertCommonOptions(emitOptions, originalOptions, compilation, pdbOptions); // See CSharpCompilation.SerializeForPdb to see options that are included pdbOptions.VerifyPdbOption("nullable", originalOptions.NullableContextOptions); pdbOptions.VerifyPdbOption("checked", originalOptions.CheckOverflow); pdbOptions.VerifyPdbOption("unsafe", originalOptions.AllowUnsafe); Assert.Equal(langVersion, pdbOptions["language-version"]); Assert.Equal(sourceFileCount.ToString(), pdbOptions["source-file-count"]); var firstSyntaxTree = (CSharpSyntaxTree)compilation.SyntaxTrees.FirstOrDefault(); pdbOptions.VerifyPdbOption("define", firstSyntaxTree.Options.PreprocessorSymbolNames, isDefault: v => v.IsEmpty(), toString: v => string.Join(",", v)); } private static void TestDeterministicCompilationCSharp( string langVersion, SyntaxTree[] syntaxTrees, CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, TestMetadataReferenceInfo[] metadataReferences, int? debugDocumentsCount = null) { var targetFramework = TargetFramework.NetCoreApp; var originalCompilation = CreateCompilation( syntaxTrees, references: metadataReferences.SelectAsArray(r => r.MetadataReference), options: compilationOptions, targetFramework: targetFramework); var peBlob = originalCompilation.EmitToArray(options: emitOptions); using (var peReader = new PEReader(peBlob)) { var entries = peReader.ReadDebugDirectory(); AssertEx.Equal(new[] { DebugDirectoryEntryType.CodeView, DebugDirectoryEntryType.PdbChecksum, DebugDirectoryEntryType.Reproducible, DebugDirectoryEntryType.EmbeddedPortablePdb }, entries.Select(e => e.Type)); var codeView = entries[0]; var checksum = entries[1]; var reproducible = entries[2]; var embedded = entries[3]; using (var embeddedPdb = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded)) { var pdbReader = embeddedPdb.GetMetadataReader(); var metadataReferenceReader = DeterministicBuildCompilationTestHelpers.GetSingleBlob(PortableCustomDebugInfoKinds.CompilationMetadataReferences, pdbReader); var compilationOptionsReader = DeterministicBuildCompilationTestHelpers.GetSingleBlob(PortableCustomDebugInfoKinds.CompilationOptions, pdbReader); Assert.Equal(debugDocumentsCount ?? syntaxTrees.Length, pdbReader.Documents.Count); VerifyCompilationOptions(compilationOptions, originalCompilation, emitOptions, compilationOptionsReader, langVersion, syntaxTrees.Length); DeterministicBuildCompilationTestHelpers.VerifyReferenceInfo(metadataReferences, targetFramework, metadataReferenceReader); } } } [Theory] [ClassData(typeof(CSharpDeterministicBuildCompilationTests))] public void PortablePdb_DeterministicCompilation(CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, CSharpParseOptions parseOptions) { var sourceOne = Parse(@" using System; class MainType { public static void Main() { Console.WriteLine(); } } ", filename: "a.cs", options: parseOptions, encoding: Encoding.UTF8); var sourceTwo = Parse(@" class TypeTwo { }", filename: "b.cs", options: parseOptions, encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); var sourceThree = Parse(@" class TypeThree { }", filename: "c.cs", options: parseOptions, encoding: Encoding.Unicode); var referenceOneCompilation = CreateCompilation( @"public struct StructWithReference { string PrivateData; } public struct StructWithValue { int PrivateData; }", options: TestOptions.DebugDll); var referenceTwoCompilation = CreateCompilation( @"public class ReferenceTwo { }", options: TestOptions.DebugDll); using var referenceOne = TestMetadataReferenceInfo.Create( referenceOneCompilation, fullPath: "abcd.dll", emitOptions: emitOptions); using var referenceTwo = TestMetadataReferenceInfo.Create( referenceTwoCompilation, fullPath: "efgh.dll", emitOptions: emitOptions); var testSource = new[] { sourceOne, sourceTwo, sourceThree }; TestDeterministicCompilationCSharp( parseOptions.LanguageVersion.MapSpecifiedToEffectiveVersion().ToDisplayString(), testSource, compilationOptions, emitOptions, new[] { referenceOne, referenceTwo }); } [Theory] [ClassData(typeof(CSharpDeterministicBuildCompilationTests))] public void PortablePdb_DeterministicCompilation_DuplicateFilePaths(CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, CSharpParseOptions parseOptions) { var sourceOne = Parse(@" using System; class MainType { public static void Main() { Console.WriteLine(); } } ", filename: "a.cs", options: parseOptions, encoding: Encoding.UTF8); var sourceTwo = Parse(@" class TypeTwo { }", filename: "b.cs", options: parseOptions, encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); var sourceThree = Parse(@" class TypeThree { }", filename: "a.cs", options: parseOptions, encoding: Encoding.Unicode); var referenceOneCompilation = CreateCompilation( @"public struct StructWithReference { string PrivateData; } public struct StructWithValue { int PrivateData; }", options: TestOptions.DebugDll); var referenceTwoCompilation = CreateCompilation( @"public class ReferenceTwo { }", options: TestOptions.DebugDll); using var referenceOne = TestMetadataReferenceInfo.Create( referenceOneCompilation, fullPath: "abcd.dll", emitOptions: emitOptions); using var referenceTwo = TestMetadataReferenceInfo.Create( referenceTwoCompilation, fullPath: "efgh.dll", emitOptions: emitOptions); var testSource = new[] { sourceOne, sourceTwo, sourceThree }; // Note that only one debug document can be present for each distinct source path. // So if more than one syntax tree has the same file path, it won't be possible to do a rebuild from the DLL+PDB. TestDeterministicCompilationCSharp( parseOptions.LanguageVersion.MapSpecifiedToEffectiveVersion().ToDisplayString(), testSource, compilationOptions, emitOptions, new[] { referenceOne, referenceTwo }, debugDocumentsCount: 2); } [ConditionalTheory(typeof(DesktopOnly))] [ClassData(typeof(CSharpDeterministicBuildCompilationTests))] public void PortablePdb_DeterministicCompilationWithSJIS(CSharpCompilationOptions compilationOptions, EmitOptions emitOptions, CSharpParseOptions parseOptions) { var sourceOne = Parse(@" using System; class MainType { public static void Main() { Console.WriteLine(); } } ", filename: "a.cs", options: parseOptions, encoding: Encoding.UTF8); var sourceTwo = Parse(@" class TypeTwo { }", filename: "b.cs", options: parseOptions, encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); var sourceThree = Parse(@" class TypeThree { }", filename: "c.cs", options: parseOptions, encoding: Encoding.GetEncoding(932)); // SJIS encoding var referenceOneCompilation = CreateCompilation( @"public struct StructWithReference { string PrivateData; } public struct StructWithValue { int PrivateData; }", options: TestOptions.DebugDll); var referenceTwoCompilation = CreateCompilation( @"public class ReferenceTwo { }", options: TestOptions.DebugDll); using var referenceOne = TestMetadataReferenceInfo.Create( referenceOneCompilation, fullPath: "abcd.dll", emitOptions: emitOptions); using var referenceTwo = TestMetadataReferenceInfo.Create( referenceTwoCompilation, fullPath: "efgh.dll", emitOptions: emitOptions); var testSource = new[] { sourceOne, sourceTwo, sourceThree }; TestDeterministicCompilationCSharp( parseOptions.LanguageVersion.MapSpecifiedToEffectiveVersion().ToDisplayString(), testSource, compilationOptions, emitOptions, new[] { referenceOne, referenceTwo }); } public IEnumerator<object[]> GetEnumerator() => GetTestParameters().GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); private static IEnumerable<object[]> GetTestParameters() { foreach (var compilationOptions in GetCompilationOptions()) { foreach (var emitOptions in DeterministicBuildCompilationTestHelpers.GetEmitOptions()) { foreach (var parseOptions in GetCSharpParseOptions()) { yield return new object[] { compilationOptions, emitOptions, parseOptions }; } } } } private static IEnumerable<CSharpCompilationOptions> GetCompilationOptions() { // Provide non default options for to test that they are being serialized // to the pdb correctly. It needs to produce a compilation to be emitted, but otherwise // everything should be non-default if possible. Diagnostic settings are ignored // because they won't be serialized. // Use constructor that requires all arguments. If new arguments are added, it's possible they need to be // included in the pdb serialization and added to tests here var defaultOptions = new CSharpCompilationOptions( OutputKind.ConsoleApplication, reportSuppressedDiagnostics: false, moduleName: "Module", mainTypeName: "MainType", scriptClassName: null, usings: new[] { "System", "System.Threading" }, optimizationLevel: OptimizationLevel.Debug, checkOverflow: true, allowUnsafe: true, cryptoKeyContainer: null, cryptoKeyFile: null, cryptoPublicKey: default, delaySign: null, platform: Platform.AnyCpu, generalDiagnosticOption: ReportDiagnostic.Default, warningLevel: 4, specificDiagnosticOptions: null, concurrentBuild: true, deterministic: true, currentLocalTime: default, debugPlusMode: false, xmlReferenceResolver: null, sourceReferenceResolver: null, syntaxTreeOptionsProvider: null, metadataReferenceResolver: null, assemblyIdentityComparer: null, strongNameProvider: null, metadataImportOptions: MetadataImportOptions.Public, referencesSupersedeLowerVersions: false, publicSign: false, topLevelBinderFlags: BinderFlags.None, nullableContextOptions: NullableContextOptions.Enable); yield return defaultOptions; yield return defaultOptions.WithNullableContextOptions(NullableContextOptions.Disable); yield return defaultOptions.WithNullableContextOptions(NullableContextOptions.Warnings); yield return defaultOptions.WithOptimizationLevel(OptimizationLevel.Release); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: false, suppressSilverlightPlatformAssembliesPortability: false))); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: true, suppressSilverlightPlatformAssembliesPortability: false))); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: false, suppressSilverlightPlatformAssembliesPortability: true))); yield return defaultOptions.WithAssemblyIdentityComparer(new DesktopAssemblyIdentityComparer(new AssemblyPortabilityPolicy(suppressSilverlightLibraryAssembliesPortability: true, suppressSilverlightPlatformAssembliesPortability: true))); } private static IEnumerable<CSharpParseOptions> GetCSharpParseOptions() { var parseOptions = new CSharpParseOptions( languageVersion: LanguageVersion.CSharp8, kind: SourceCodeKind.Regular); yield return parseOptions; yield return parseOptions.WithLanguageVersion(LanguageVersion.CSharp9); yield return parseOptions.WithLanguageVersion(LanguageVersion.Latest); yield return parseOptions.WithLanguageVersion(LanguageVersion.Preview); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Test/IOperation/IOperation/IOperationTests_ISymbolInitializer.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Operations Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Partial Public Class IOperationTests Inherits SemanticModelTestBase <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub NoInitializers() Dim source = <compilation> <file name="c.vb"> <![CDATA[ Class C Shared s1 As Integer Private i1 As Integer Private Property P1 As Integer End Class ]]> </file> </compilation> Dim compilation = CreateCompilationWithMscorlib40(source, options:=TestOptions.ReleaseDll, parseOptions:=TestOptions.Regular) Dim tree = compilation.SyntaxTrees.Single() Dim nodes = tree.GetRoot().DescendantNodes().Where(Function(n) TryCast(n, VariableDeclaratorSyntax) IsNot Nothing OrElse TryCast(n, PropertyStatementSyntax) IsNot Nothing).ToArray() Assert.Equal(3, nodes.Length) Dim semanticModel = compilation.GetSemanticModel(tree) For Each node In nodes Assert.Null(semanticModel.GetOperation(node)) Next End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_StaticField() Dim source = <![CDATA[ Class C Shared s1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_InstanceField() Dim source = <![CDATA[ Class C Private i1 As Integer = 1, i2 As Integer = 2'BIND:"= 2" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.i2 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_Property() Dim source = <![CDATA[ Class C Private Property P1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (Property: Property C.P1 As System.Int32) (OperationKind.PropertyInitializer, Type: null) (Syntax: '= 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_DefaultValueParameter() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= 0" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IParameterInitializerOperation (Parameter: [p1 As System.Int32 = 0]) (OperationKind.ParameterInitializer, Type: null) (Syntax: '= 0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30642: 'Optional' and 'ParamArray' cannot be combined. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= 0" ~~~~~~~~~~ BC30046: Method cannot have both a ParamArray and Optional parameters. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= 0" ~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_DefaultValueParamsArray() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= Nothing" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IParameterInitializerOperation (Parameter: [ParamArray p2 As System.Int32() = Nothing]) (OperationKind.ParameterInitializer, Type: null) (Syntax: '= Nothing') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32(), Constant: null, IsImplicit) (Syntax: 'Nothing') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'Nothing') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30642: 'Optional' and 'ParamArray' cannot be combined. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= Nothing" ~~~~~~~~~~ BC30046: Method cannot have both a ParamArray and Optional parameters. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= Nothing" ~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub AsNewFieldInitializer() Dim source = <![CDATA[ Class C Dim x As New Object'BIND:"As New Object" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.x As System.Object) (OperationKind.FieldInitializer, Type: null) (Syntax: 'As New Object') IObjectCreationOperation (Constructor: Sub System.Object..ctor()) (OperationKind.ObjectCreation, Type: System.Object) (Syntax: 'New Object') Arguments(0) Initializer: null ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub MultipleFieldInitializers() Dim source = <![CDATA[ Class C Dim x, y As New Object'BIND:"As New Object" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (2 initialized fields) (OperationKind.FieldInitializer, Type: null) (Syntax: 'As New Object') Field_1: C.x As System.Object Field_2: C.y As System.Object IObjectCreationOperation (Constructor: Sub System.Object..ctor()) (OperationKind.ObjectCreation, Type: System.Object) (Syntax: 'New Object') Arguments(0) Initializer: null ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub SingleFieldInitializerErrorCase() Dim source = <![CDATA[ Class C1 Dim x, y As Object = Me'BIND:"= Me" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (2 initialized fields) (OperationKind.FieldInitializer, Type: null, IsInvalid) (Syntax: '= Me') Field_1: C1.x As System.Object Field_2: C1.y As System.Object IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'Me') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C1, IsInvalid) (Syntax: 'Me') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30671: Explicit initialization is not permitted with multiple variables declared with a single type specifier. Dim x, y As Object = Me'BIND:"= Me" ~~~~~~~~~~~~~~~~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub MultipleWithEventsInitializers() Dim source = <![CDATA[ Class C1 Public Sub New(c As C1) End Sub WithEvents e, f As New C1(Me)'BIND:"As New C1(Me)" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (2 initialized properties) (OperationKind.PropertyInitializer, Type: null) (Syntax: 'As New C1(Me)') Property_1: WithEvents C1.e As C1 Property_2: WithEvents C1.f As C1 IObjectCreationOperation (Constructor: Sub C1..ctor(c As C1)) (OperationKind.ObjectCreation, Type: C1) (Syntax: 'New C1(Me)') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: c) (OperationKind.Argument, Type: null) (Syntax: 'Me') IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C1) (Syntax: 'Me') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub SingleWithEventsInitializersErrorCase() Dim source = <![CDATA[ Class C1 Public Sub New(c As C1) End Sub WithEvents e, f As C1 = Me'BIND:"= Me" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (2 initialized properties) (OperationKind.PropertyInitializer, Type: null, IsInvalid) (Syntax: '= Me') Property_1: WithEvents C1.e As C1 Property_2: WithEvents C1.f As C1 IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C1, IsInvalid) (Syntax: 'Me') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30671: Explicit initialization is not permitted with multiple variables declared with a single type specifier. WithEvents e, f As C1 = Me'BIND:"= Me" ~~~~~~~~~~~~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ExpressionInitializers_StaticField() Dim source = <![CDATA[ Class C Shared s1 As Integer = 1 + F()'BIND:"= 1 + F()" Private Shared Function F() As Integer Return 1 End Function End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1 + F()') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32) (Syntax: '1 + F()') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: IInvocationOperation (Function C.F() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'F()') Instance Receiver: null Arguments(0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ExpressionInitializers_InstanceField() Dim source = <![CDATA[ Class C Private i1 As Integer = 1 + F()'BIND:"= 1 + F()" Private Shared Function F() As Integer Return 1 End Function End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.i1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1 + F()') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32) (Syntax: '1 + F()') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: IInvocationOperation (Function C.F() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'F()') Instance Receiver: null Arguments(0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ExpressionInitializers_Property() Dim source = <![CDATA[ Class C Private Property P1 As Integer = 1 + F()'BIND:"= 1 + F()" Private Shared Function F() As Integer Return 1 End Function End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (Property: Property C.P1 As System.Int32) (OperationKind.PropertyInitializer, Type: null) (Syntax: '= 1 + F()') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32) (Syntax: '1 + F()') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: IInvocationOperation (Function C.F() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'F()') Instance Receiver: null Arguments(0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub PartialClasses_StaticField() Dim source = <![CDATA[ Partial Class C Shared s1 As Integer = 1'BIND:"= 1" Private i1 As Integer = 1 End Class Partial Class C Shared s2 As Integer = 2 Private i2 As Integer = 2 End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub PartialClasses_InstanceField() Dim source = <![CDATA[ Partial Class C Shared s1 As Integer = 1 Private i1 As Integer = 1 End Class Partial Class C Shared s2 As Integer = 2 Private i2 As Integer = 2'BIND:"= 2" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.i2 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(7299, "https://github.com/dotnet/roslyn/issues/7299")> Public Sub FieldInitializer_ConstantConversions_01() Dim source = <![CDATA[ Option Strict On Class C Private s1 As Byte = 0.0'BIND:"= 0.0" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Byte) (OperationKind.FieldInitializer, Type: null, IsInvalid) (Syntax: '= 0.0') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Byte, Constant: 0, IsInvalid, IsImplicit) (Syntax: '0.0') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 0, IsInvalid) (Syntax: '0.0') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Byte'. Private s1 As Byte = 0.0'BIND:"= 0.0" ~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(7299, "https://github.com/dotnet/roslyn/issues/7299")> Public Sub FieldInitializer_ConstantConversions_02() Dim source = <![CDATA[ Option Strict On Class C Private s1 As Byte = 0'BIND:"= 0" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Byte) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 0') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Byte, Constant: 0, IsImplicit) (Syntax: '0') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantInitializer_NonConstantField() Dim source = <![CDATA[ Class C Shared s1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantInitializer_NonConstantStaticField() ' This unit test also includes declaration with multiple variables. Dim source = <![CDATA[ Class C Shared s0 As Integer = 0, s1 As Integer = M(), s2 As Integer 'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: null Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantInitializer_NonConstantInstanceField() Dim source = <![CDATA[ Class C Private s1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= M()') Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M()') Instance Receiver: null Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Const s1 As Integer = M()'BIND:"= M()" ~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_AsNewFieldInitializer() Dim source = <![CDATA[ Class C Private s1, s2 As New Integer()'BIND:"As New Integer()" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (2) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New Integer()') Right: IObjectCreationOperation (Constructor: Sub System.Int32..ctor()) (OperationKind.ObjectCreation, Type: System.Int32) (Syntax: 'New Integer()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Left: IFieldReferenceOperation: C.s2 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New Integer()') Right: IObjectCreationOperation (Constructor: Sub System.Int32..ctor()) (OperationKind.ObjectCreation, Type: System.Int32) (Syntax: 'New Integer()') Arguments(0) Initializer: null Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ArrayDeclaration() Dim source = <![CDATA[ Class C Private s1(10) As Integer = Nothing'BIND:"= Nothing" End Class ]]>.Value ' Expected Flow graph should also include the implicit array initializer (10). ' This is tracked by https://github.com/dotnet/roslyn/issues/26780 Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32(), IsImplicit) (Syntax: '= Nothing') Left: IFieldReferenceOperation: C.s1 As System.Int32() (OperationKind.FieldReference, Type: System.Int32(), IsImplicit) (Syntax: '= Nothing') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= Nothing') Right: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32(), Constant: null, IsImplicit) (Syntax: 'Nothing') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) (WideningNothingLiteral) Operand: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'Nothing') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30672: Explicit initialization is not permitted for arrays declared with explicit bounds. Private s1(10) As Integer = Nothing'BIND:"= Nothing" ~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_ConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = If(True, 1, 2)'BIND:"= If(True, 1, 2)" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (0) Jump if False (Regular) to Block[B3] ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'True') Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: '1') Value: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B4] Block[B3] - Block [UnReachable] Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: '2') Value: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(True, 1, 2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= If(True, 1, 2)') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(True, 1, 2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantInitializer_NonConstantStaticField() Dim source = <![CDATA[ Class C Private Shared s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantInitializer_NonConstantInstanceField() Dim source = <![CDATA[ Class C Private s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= If(M(), M2)') Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32), IsInvalid) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M2') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M(), M2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M(), M2)') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'If(M(), M2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Const s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" ~~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_AsNewFieldInitializer() Dim source = <![CDATA[ Class C Private s1, s2 As New C(If(a, b))'BIND:"As New C(If(a, b))" Private Shared a As Integer? = 1 Private Shared b As Integer = 1 Public Sub New(a As Integer) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IFieldReferenceOperation: C.s1 As C (OperationKind.FieldReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B5] Leaving: {R1} Entering: {R3} {R4} } .locals {R3} { CaptureIds: [3] .locals {R4} { CaptureIds: [2] Block[B5] - Block Predecessors: [B4] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B7] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R4} Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B8] Leaving: {R4} } Block[B7] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B6] [B7] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IFieldReferenceOperation: C.s2 As C (OperationKind.FieldReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B9] Leaving: {R3} } Block[B9] - Exit Predecessors: [B8] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_MissingFieldInitializerValue() Dim source = <![CDATA[ Class C Public s1 As Integer = 'BIND:"=" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= ') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= ') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsInvalid, IsImplicit) (Syntax: '= ') Right: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. Public s1 As Integer = 'BIND:"=" ~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantPropertyInitializer_StaticProperty() Dim source = <![CDATA[ Class C Shared Property P1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantPropertyInitializer_InstanceProperty() Dim source = <![CDATA[ Class C Public Property P1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= 1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantPropertyInitializer_StaticProperty() Dim source = <![CDATA[ Class C Shared Property P1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: null Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantPropertyInitializer_InstanceProperty() Dim source = <![CDATA[ Class C Public Property P1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= M()') Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_PropertyInitializerWithArguments() Dim source = <![CDATA[ Class C Shared Property P1(i As Integer) As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IPropertyReferenceOperation: Property C.P1(i As System.Int32) As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '= 1') IInvalidOperation (OperationKind.Invalid, Type: System.Int32, IsImplicit) (Syntax: '= 1') Children(0) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC36759: Auto-implemented properties cannot have parameters. Shared Property P1(i As Integer) As Integer = 1'BIND:"= 1" ~~~~~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_AsNewPropertyInitializer() Dim source = <![CDATA[ Class C Private ReadOnly Property P1 As New Integer()'BIND:"As New Integer()" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Left: IPropertyReferenceOperation: ReadOnly Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New Integer()') Right: IObjectCreationOperation (Constructor: Sub System.Int32..ctor()) (OperationKind.ObjectCreation, Type: System.Int32) (Syntax: 'New Integer()') Arguments(0) Initializer: null Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_WithEventsAsNewPropertyInitializer() Dim source = <![CDATA[ Class C WithEvents e, f As New C() 'BIND:"As New C()" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (2) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C()') Left: IPropertyReferenceOperation: WithEvents C.e As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C()') Right: IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C()') Left: IPropertyReferenceOperation: WithEvents C.f As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C()') Right: IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C()') Arguments(0) Initializer: null Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantPropertyInitializer_StaticProperty() Dim source = <![CDATA[ Class C Shared Property P1 As Integer = If(M(), M2())'BIND:"= If(M(), M2())" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2()') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2()') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2())') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantPropertyInitializer_InstanceProperty() Dim source = <![CDATA[ Class C Public Property P1 As Integer = If(M(), M2())'BIND:"= If(M(), M2())" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2()') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2()') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= If(M(), M2())') Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2())') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_AsNewPropertyInitializer() Dim source = <![CDATA[ Class C Private ReadOnly Property P1 As New C(If(a, b))'BIND:"As New C(If(a, b))" Private Shared a As Integer? = 1 Private Shared b As Integer = 1 Public Sub New(a As Integer) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IPropertyReferenceOperation: ReadOnly Property C.P1 As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_WithEventsAsNewPropertyInitializer() Dim source = <![CDATA[ Class C WithEvents e, f As New C(If(a, b)) 'BIND:"As New C(If(a, b))" Private Shared a As Integer? = 1 Private Shared b As Integer = 1 Public Sub New(a As Integer) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IPropertyReferenceOperation: WithEvents C.e As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B5] Leaving: {R1} Entering: {R3} {R4} } .locals {R3} { CaptureIds: [3] .locals {R4} { CaptureIds: [2] Block[B5] - Block Predecessors: [B4] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B7] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R4} Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B8] Leaving: {R4} } Block[B7] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B6] [B7] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IPropertyReferenceOperation: WithEvents C.f As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B9] Leaving: {R3} } Block[B9] - Exit Predecessors: [B8] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_MissingPropertyInitializerValue() Dim source = <![CDATA[ Class C Public Property P1 As Integer ='BIND:"=" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsInvalid, IsImplicit) (Syntax: '=') Right: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. Public Property P1 As Integer ='BIND:"=" ~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantParameterInitializer() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = 1)'BIND:"= 1" End Sub End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantParameterInitializer() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = M1())'BIND:"= M1()" End Sub Private Shared Function M1() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M1()') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M1()') Right: IInvalidOperation (OperationKind.Invalid, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'M1()') Children(1): IInvocationOperation (Function C.M1() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M1()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Private Sub M(Optional p1 As Integer = M1())'BIND:"= M1()" ~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantParameterInitializer() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = If(M1(), M2()))'BIND:"= If(M1(), M2())" End Sub Private Shared Function M1() As Integer? Return 0 End Function Private Shared Function M2() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M1()') Value: IInvocationOperation (Function C.M1() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32), IsInvalid) (Syntax: 'M1()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'M1()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M1()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M1()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'M1()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M1()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2()') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M2()') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M1(), M2())') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M1(), M2())') Right: IInvalidOperation (OperationKind.Invalid, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'If(M1(), M2())') Children(1): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'If(M1(), M2())') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Private Sub M(Optional p1 As Integer = If(M1(), M2()))'BIND:"= If(M1(), M2())" ~~~~~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_MissingParameterInitializerValue() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer =)'BIND:"=" End Sub End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Right: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. Private Sub M(Optional p1 As Integer =)'BIND:"=" ~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Operations Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Partial Public Class IOperationTests Inherits SemanticModelTestBase <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub NoInitializers() Dim source = <compilation> <file name="c.vb"> <![CDATA[ Class C Shared s1 As Integer Private i1 As Integer Private Property P1 As Integer End Class ]]> </file> </compilation> Dim compilation = CreateCompilationWithMscorlib40(source, options:=TestOptions.ReleaseDll, parseOptions:=TestOptions.Regular) Dim tree = compilation.SyntaxTrees.Single() Dim nodes = tree.GetRoot().DescendantNodes().Where(Function(n) TryCast(n, VariableDeclaratorSyntax) IsNot Nothing OrElse TryCast(n, PropertyStatementSyntax) IsNot Nothing).ToArray() Assert.Equal(3, nodes.Length) Dim semanticModel = compilation.GetSemanticModel(tree) For Each node In nodes Assert.Null(semanticModel.GetOperation(node)) Next End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_StaticField() Dim source = <![CDATA[ Class C Shared s1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_InstanceField() Dim source = <![CDATA[ Class C Private i1 As Integer = 1, i2 As Integer = 2'BIND:"= 2" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.i2 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_Property() Dim source = <![CDATA[ Class C Private Property P1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (Property: Property C.P1 As System.Int32) (OperationKind.PropertyInitializer, Type: null) (Syntax: '= 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_DefaultValueParameter() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= 0" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IParameterInitializerOperation (Parameter: [p1 As System.Int32 = 0]) (OperationKind.ParameterInitializer, Type: null) (Syntax: '= 0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30642: 'Optional' and 'ParamArray' cannot be combined. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= 0" ~~~~~~~~~~ BC30046: Method cannot have both a ParamArray and Optional parameters. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= 0" ~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ConstantInitializers_DefaultValueParamsArray() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= Nothing" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IParameterInitializerOperation (Parameter: [ParamArray p2 As System.Int32() = Nothing]) (OperationKind.ParameterInitializer, Type: null) (Syntax: '= Nothing') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32(), Constant: null, IsImplicit) (Syntax: 'Nothing') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'Nothing') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30642: 'Optional' and 'ParamArray' cannot be combined. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= Nothing" ~~~~~~~~~~ BC30046: Method cannot have both a ParamArray and Optional parameters. Private Sub M(Optional p1 As Integer = 0, Optional ParamArray p2 As Integer() = Nothing)'BIND:"= Nothing" ~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub AsNewFieldInitializer() Dim source = <![CDATA[ Class C Dim x As New Object'BIND:"As New Object" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.x As System.Object) (OperationKind.FieldInitializer, Type: null) (Syntax: 'As New Object') IObjectCreationOperation (Constructor: Sub System.Object..ctor()) (OperationKind.ObjectCreation, Type: System.Object) (Syntax: 'New Object') Arguments(0) Initializer: null ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub MultipleFieldInitializers() Dim source = <![CDATA[ Class C Dim x, y As New Object'BIND:"As New Object" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (2 initialized fields) (OperationKind.FieldInitializer, Type: null) (Syntax: 'As New Object') Field_1: C.x As System.Object Field_2: C.y As System.Object IObjectCreationOperation (Constructor: Sub System.Object..ctor()) (OperationKind.ObjectCreation, Type: System.Object) (Syntax: 'New Object') Arguments(0) Initializer: null ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub SingleFieldInitializerErrorCase() Dim source = <![CDATA[ Class C1 Dim x, y As Object = Me'BIND:"= Me" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (2 initialized fields) (OperationKind.FieldInitializer, Type: null, IsInvalid) (Syntax: '= Me') Field_1: C1.x As System.Object Field_2: C1.y As System.Object IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'Me') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C1, IsInvalid) (Syntax: 'Me') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30671: Explicit initialization is not permitted with multiple variables declared with a single type specifier. Dim x, y As Object = Me'BIND:"= Me" ~~~~~~~~~~~~~~~~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub MultipleWithEventsInitializers() Dim source = <![CDATA[ Class C1 Public Sub New(c As C1) End Sub WithEvents e, f As New C1(Me)'BIND:"As New C1(Me)" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (2 initialized properties) (OperationKind.PropertyInitializer, Type: null) (Syntax: 'As New C1(Me)') Property_1: WithEvents C1.e As C1 Property_2: WithEvents C1.f As C1 IObjectCreationOperation (Constructor: Sub C1..ctor(c As C1)) (OperationKind.ObjectCreation, Type: C1) (Syntax: 'New C1(Me)') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: c) (OperationKind.Argument, Type: null) (Syntax: 'Me') IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C1) (Syntax: 'Me') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17813, "https://github.com/dotnet/roslyn/issues/17813")> Public Sub SingleWithEventsInitializersErrorCase() Dim source = <![CDATA[ Class C1 Public Sub New(c As C1) End Sub WithEvents e, f As C1 = Me'BIND:"= Me" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (2 initialized properties) (OperationKind.PropertyInitializer, Type: null, IsInvalid) (Syntax: '= Me') Property_1: WithEvents C1.e As C1 Property_2: WithEvents C1.f As C1 IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C1, IsInvalid) (Syntax: 'Me') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30671: Explicit initialization is not permitted with multiple variables declared with a single type specifier. WithEvents e, f As C1 = Me'BIND:"= Me" ~~~~~~~~~~~~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ExpressionInitializers_StaticField() Dim source = <![CDATA[ Class C Shared s1 As Integer = 1 + F()'BIND:"= 1 + F()" Private Shared Function F() As Integer Return 1 End Function End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1 + F()') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32) (Syntax: '1 + F()') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: IInvocationOperation (Function C.F() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'F()') Instance Receiver: null Arguments(0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ExpressionInitializers_InstanceField() Dim source = <![CDATA[ Class C Private i1 As Integer = 1 + F()'BIND:"= 1 + F()" Private Shared Function F() As Integer Return 1 End Function End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.i1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1 + F()') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32) (Syntax: '1 + F()') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: IInvocationOperation (Function C.F() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'F()') Instance Receiver: null Arguments(0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub ExpressionInitializers_Property() Dim source = <![CDATA[ Class C Private Property P1 As Integer = 1 + F()'BIND:"= 1 + F()" Private Shared Function F() As Integer Return 1 End Function End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IPropertyInitializerOperation (Property: Property C.P1 As System.Int32) (OperationKind.PropertyInitializer, Type: null) (Syntax: '= 1 + F()') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32) (Syntax: '1 + F()') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: IInvocationOperation (Function C.F() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'F()') Instance Receiver: null Arguments(0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub PartialClasses_StaticField() Dim source = <![CDATA[ Partial Class C Shared s1 As Integer = 1'BIND:"= 1" Private i1 As Integer = 1 End Class Partial Class C Shared s2 As Integer = 2 Private i2 As Integer = 2 End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(17595, "https://github.com/dotnet/roslyn/issues/17595")> Public Sub PartialClasses_InstanceField() Dim source = <![CDATA[ Partial Class C Shared s1 As Integer = 1 Private i1 As Integer = 1 End Class Partial Class C Shared s2 As Integer = 2 Private i2 As Integer = 2'BIND:"= 2" End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.i2 As System.Int32) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(7299, "https://github.com/dotnet/roslyn/issues/7299")> Public Sub FieldInitializer_ConstantConversions_01() Dim source = <![CDATA[ Option Strict On Class C Private s1 As Byte = 0.0'BIND:"= 0.0" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Byte) (OperationKind.FieldInitializer, Type: null, IsInvalid) (Syntax: '= 0.0') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Byte, Constant: 0, IsInvalid, IsImplicit) (Syntax: '0.0') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 0, IsInvalid) (Syntax: '0.0') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Byte'. Private s1 As Byte = 0.0'BIND:"= 0.0" ~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(7299, "https://github.com/dotnet/roslyn/issues/7299")> Public Sub FieldInitializer_ConstantConversions_02() Dim source = <![CDATA[ Option Strict On Class C Private s1 As Byte = 0'BIND:"= 0" End Class ]]>.Value Dim expectedOperationTree = <![CDATA[ IFieldInitializerOperation (Field: C.s1 As System.Byte) (OperationKind.FieldInitializer, Type: null) (Syntax: '= 0') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Byte, Constant: 0, IsImplicit) (Syntax: '0') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantInitializer_NonConstantField() Dim source = <![CDATA[ Class C Shared s1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantInitializer_NonConstantStaticField() ' This unit test also includes declaration with multiple variables. Dim source = <![CDATA[ Class C Shared s0 As Integer = 0, s1 As Integer = M(), s2 As Integer 'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: null Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantInitializer_NonConstantInstanceField() Dim source = <![CDATA[ Class C Private s1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= M()') Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M()') Instance Receiver: null Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Const s1 As Integer = M()'BIND:"= M()" ~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_AsNewFieldInitializer() Dim source = <![CDATA[ Class C Private s1, s2 As New Integer()'BIND:"As New Integer()" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (2) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New Integer()') Right: IObjectCreationOperation (Constructor: Sub System.Int32..ctor()) (OperationKind.ObjectCreation, Type: System.Int32) (Syntax: 'New Integer()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Left: IFieldReferenceOperation: C.s2 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New Integer()') Right: IObjectCreationOperation (Constructor: Sub System.Int32..ctor()) (OperationKind.ObjectCreation, Type: System.Int32) (Syntax: 'New Integer()') Arguments(0) Initializer: null Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ArrayDeclaration() Dim source = <![CDATA[ Class C Private s1(10) As Integer = Nothing'BIND:"= Nothing" End Class ]]>.Value ' Expected Flow graph should also include the implicit array initializer (10). ' This is tracked by https://github.com/dotnet/roslyn/issues/26780 Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32(), IsImplicit) (Syntax: '= Nothing') Left: IFieldReferenceOperation: C.s1 As System.Int32() (OperationKind.FieldReference, Type: System.Int32(), IsImplicit) (Syntax: '= Nothing') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= Nothing') Right: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32(), Constant: null, IsImplicit) (Syntax: 'Nothing') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) (WideningNothingLiteral) Operand: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'Nothing') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30672: Explicit initialization is not permitted for arrays declared with explicit bounds. Private s1(10) As Integer = Nothing'BIND:"= Nothing" ~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_ConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = If(True, 1, 2)'BIND:"= If(True, 1, 2)" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (0) Jump if False (Regular) to Block[B3] ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'True') Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: '1') Value: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B4] Block[B3] - Block [UnReachable] Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: '2') Value: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(True, 1, 2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= If(True, 1, 2)') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(True, 1, 2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantInitializer_NonConstantStaticField() Dim source = <![CDATA[ Class C Private Shared s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantInitializer_NonConstantInstanceField() Dim source = <![CDATA[ Class C Private s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2)') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= If(M(), M2)') Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantInitializer_ConstantField() Dim source = <![CDATA[ Class C Const s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32), IsInvalid) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M2') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M(), M2)') Left: IFieldReferenceOperation: C.s1 As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M(), M2)') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'If(M(), M2)') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Const s1 As Integer = If(M(), M2)'BIND:"= If(M(), M2)" ~~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_AsNewFieldInitializer() Dim source = <![CDATA[ Class C Private s1, s2 As New C(If(a, b))'BIND:"As New C(If(a, b))" Private Shared a As Integer? = 1 Private Shared b As Integer = 1 Public Sub New(a As Integer) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IFieldReferenceOperation: C.s1 As C (OperationKind.FieldReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B5] Leaving: {R1} Entering: {R3} {R4} } .locals {R3} { CaptureIds: [3] .locals {R4} { CaptureIds: [2] Block[B5] - Block Predecessors: [B4] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B7] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R4} Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B8] Leaving: {R4} } Block[B7] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B6] [B7] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IFieldReferenceOperation: C.s2 As C (OperationKind.FieldReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B9] Leaving: {R3} } Block[B9] - Exit Predecessors: [B8] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_MissingFieldInitializerValue() Dim source = <![CDATA[ Class C Public s1 As Integer = 'BIND:"=" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= ') Left: IFieldReferenceOperation: C.s1 As System.Int32 (OperationKind.FieldReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= ') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsInvalid, IsImplicit) (Syntax: '= ') Right: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. Public s1 As Integer = 'BIND:"=" ~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantPropertyInitializer_StaticProperty() Dim source = <![CDATA[ Class C Shared Property P1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantPropertyInitializer_InstanceProperty() Dim source = <![CDATA[ Class C Public Property P1 As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= 1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantPropertyInitializer_StaticProperty() Dim source = <![CDATA[ Class C Shared Property P1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: null Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantPropertyInitializer_InstanceProperty() Dim source = <![CDATA[ Class C Public Property P1 As Integer = M()'BIND:"= M()" Public Shared Function M() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= M()') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= M()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= M()') Right: IInvocationOperation (Function C.M() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_PropertyInitializerWithArguments() Dim source = <![CDATA[ Class C Shared Property P1(i As Integer) As Integer = 1'BIND:"= 1" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IPropertyReferenceOperation: Property C.P1(i As System.Int32) As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '= 1') IInvalidOperation (OperationKind.Invalid, Type: System.Int32, IsImplicit) (Syntax: '= 1') Children(0) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC36759: Auto-implemented properties cannot have parameters. Shared Property P1(i As Integer) As Integer = 1'BIND:"= 1" ~~~~~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_AsNewPropertyInitializer() Dim source = <![CDATA[ Class C Private ReadOnly Property P1 As New Integer()'BIND:"As New Integer()" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Left: IPropertyReferenceOperation: ReadOnly Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'As New Integer()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New Integer()') Right: IObjectCreationOperation (Constructor: Sub System.Int32..ctor()) (OperationKind.ObjectCreation, Type: System.Int32) (Syntax: 'New Integer()') Arguments(0) Initializer: null Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_WithEventsAsNewPropertyInitializer() Dim source = <![CDATA[ Class C WithEvents e, f As New C() 'BIND:"As New C()" End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (2) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C()') Left: IPropertyReferenceOperation: WithEvents C.e As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C()') Right: IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C()') Left: IPropertyReferenceOperation: WithEvents C.f As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C()') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C()') Right: IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C()') Arguments(0) Initializer: null Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantPropertyInitializer_StaticProperty() Dim source = <![CDATA[ Class C Shared Property P1 As Integer = If(M(), M2())'BIND:"= If(M(), M2())" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2()') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2()') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (Static) (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Instance Receiver: null Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2())') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantPropertyInitializer_InstanceProperty() Dim source = <![CDATA[ Class C Public Property P1 As Integer = If(M(), M2())'BIND:"= If(M(), M2())" Public Shared Function M() As Integer? Return 0 End Function Public Shared Function M2() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation (Function C.M() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32)) (Syntax: 'M()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'M()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'M()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'M()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'M2()') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'M2()') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '= If(M(), M2())') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '= If(M(), M2())') Right: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(M(), M2())') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_AsNewPropertyInitializer() Dim source = <![CDATA[ Class C Private ReadOnly Property P1 As New C(If(a, b))'BIND:"As New C(If(a, b))" Private Shared a As Integer? = 1 Private Shared b As Integer = 1 Public Sub New(a As Integer) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IPropertyReferenceOperation: ReadOnly Property C.P1 As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_WithEventsAsNewPropertyInitializer() Dim source = <![CDATA[ Class C WithEvents e, f As New C(If(a, b)) 'BIND:"As New C(If(a, b))" Private Shared a As Integer? = 1 Private Shared b As Integer = 1 Public Sub New(a As Integer) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IPropertyReferenceOperation: WithEvents C.e As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B5] Leaving: {R1} Entering: {R3} {R4} } .locals {R3} { CaptureIds: [3] .locals {R4} { CaptureIds: [2] Block[B5] - Block Predecessors: [B4] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IFieldReferenceOperation: C.a As System.Nullable(Of System.Int32) (Static) (OperationKind.FieldReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a') Instance Receiver: null Jump if True (Regular) to Block[B7] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Leaving: {R4} Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a') Arguments(0) Next (Regular) Block[B8] Leaving: {R4} } Block[B7] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IFieldReferenceOperation: C.b As System.Int32 (Static) (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: null Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B6] [B7] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Left: IPropertyReferenceOperation: WithEvents C.f As C (OperationKind.PropertyReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'As New C(If(a, b))') Right: IObjectCreationOperation (Constructor: Sub C..ctor(a As System.Int32)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C(If(a, b))') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'If(a, b)') IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a, b)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Initializer: null Next (Regular) Block[B9] Leaving: {R3} } Block[B9] - Exit Predecessors: [B8] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of AsNewClauseSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_MissingPropertyInitializerValue() Dim source = <![CDATA[ Class C Public Property P1 As Integer ='BIND:"=" End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Left: IPropertyReferenceOperation: Property C.P1 As System.Int32 (OperationKind.PropertyReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: C, IsInvalid, IsImplicit) (Syntax: '=') Right: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. Public Property P1 As Integer ='BIND:"=" ~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_ConstantParameterInitializer() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = 1)'BIND:"= 1" End Sub End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '= 1') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: '= 1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_NonConstantParameterInitializer() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = M1())'BIND:"= M1()" End Sub Private Shared Function M1() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M1()') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= M1()') Right: IInvalidOperation (OperationKind.Invalid, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'M1()') Children(1): IInvocationOperation (Function C.M1() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M1()') Instance Receiver: null Arguments(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Private Sub M(Optional p1 As Integer = M1())'BIND:"= M1()" ~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub ControlFlow_NonConstantParameterInitializer() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer = If(M1(), M2()))'BIND:"= If(M1(), M2())" End Sub Private Shared Function M1() As Integer? Return 0 End Function Private Shared Function M2() As Integer Return 0 End Function End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M1()') Value: IInvocationOperation (Function C.M1() As System.Nullable(Of System.Int32)) (OperationKind.Invocation, Type: System.Nullable(Of System.Int32), IsInvalid) (Syntax: 'M1()') Instance Receiver: null Arguments(0) Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'M1()') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M1()') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M1()') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'M1()') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsInvalid, IsImplicit) (Syntax: 'M1()') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2()') Value: IInvocationOperation (Function C.M2() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsInvalid) (Syntax: 'M2()') Instance Receiver: null Arguments(0) Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M1(), M2())') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '= If(M1(), M2())') Right: IInvalidOperation (OperationKind.Invalid, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'If(M1(), M2())') Children(1): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: 'If(M1(), M2())') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30059: Constant expression is required. Private Sub M(Optional p1 As Integer = If(M1(), M2()))'BIND:"= If(M1(), M2())" ~~~~~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact> Public Sub NoControlFlow_MissingParameterInitializerValue() Dim source = <![CDATA[ Class C Private Sub M(Optional p1 As Integer =)'BIND:"=" End Sub End Class]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Left: IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '=') Right: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. Private Sub M(Optional p1 As Integer =)'BIND:"=" ~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of EqualsValueSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/GeneralPia.dll
MZ@ !L!This program cannot be run in DOS mode. $PEL3L! Lj @ @jS   H.textK L `.sdataWP@.rsrcR@@.reloc V@BjHl"<H&( **( *s s s s *0~o +*0~o +*0~o +*0~o +*0( ( +*0 ( +*0( +*0 ( +*0 - (+ ++ +*0 **( *0/ { o -(+ { o  +*V( s } *&( *&( *&(+ *&( *&( *&( *&( *BSJB v4.0.30319l$$#~$#Strings8#US8#GUID8#BlobW %3ID  A! $F  {  A{ Af}4H Kb K w  8"Q"~f  Q4f /CQhyA/Xm~ 1Pbfw*>Mfmf)7:7 E7 O ] x!   - - -  !)5#J5!%W5!)e5-j51n51w5759AE MNS [\_=b#c>!iBmbn pqss-s - s !@- s\!s\!uf\!xsz!zz!|z!z!z!z!z!z!z ! ! !  !  ! *!<*!Y*!g*!1 1--1O:1tG!PkVsVxkVsVVxV VfV0>PTglVqsxkV" %V& %kV" *V& ** , /q3P \ h   ( F5 dB!Fc$!Fh<!lX!Fqp!x!!!"FF F F> FzqF~FF F FFFFF>Fz0F>=FzJ!F+T$F7Y$%Fd'F+Fo,.Fv0F4F5FW7Fh7Fl9F9F9F9F9F9F9F9F9F:F;F<F=F>F?F @F AF BF- CF6 DF@ qDFN DF- EF6 FF@ qFFN FFf GFr HF qHF H"IF>IFzhIF IF JF KF>MFzhMF MF NF OF QF SF T$"VF>VFzWFB hYFF YFO YFX Z0"[Fl [Fw \F ]F ^F `F dhFjFlFmF mF mF n<"oF hoFzpF>pFzhpF>pFzhpF>7pT <rT BtFY uF\ huFf vFk vFp vFu vFz vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF$ vF) vF. vF3 vF8 vF= vFB vFG vFL vFQ vFV vF[ vF` vFe vFj vFo vFt vFy vF~ vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF# vF( vF- vF2 vF7 vF< vFA vFF vFK vFP vFU vFZ vF_ vFd KvFY 7xFc zFf q{Fm {FY |Fc |Ft }F~ Q~F YF KF F F\ hF F Ff qFm F qF F F jF~ QF YF qF Fd sFc Ft F 7F F F Ff Fm F F F F H"F F T"`"F>FzqF~FF>FzqF~Fx   UUUU                   *       x x 5`lpt!&2=5> ,4<D,4<Dxch)qLPTT"Tj !19AIQYa5iyqj5jjy   S   !19AI (,048<Tdehimpqtuy} #)F.... ..^@@3CCId`#cciW3{233133 3 #7@@3Ca``333333#CCmc#CC\cCC XK;+k1S#K#,#SCVccks{$ KC k 8 #k#Cb C c cccZ {1cJ k cJ +Q#HZ cJ {1 kc # @+QC cA k   # # ##B @#Cl `#c cS cK ##K #K:`## #` #    k1$ k1$ m @ #D kd  k1  #H k1 m k   # # k# !#!#!#< > oZqZ Zw w Zw   w      !Z#Z-w 57;=./#(-}()X\XXX      !$&4789:;C#D$OTAY^ZC_\ \    + ]   c G  bY c G Y c Gt  o bY >   78:9;<>= @ ?  o n   #$CDGHLKRQWVZY_!`!c#d%{'))++--//113579;;==??AACEGGIIuu   //<Module>mscorlibMicrosoft.VisualBasicMyApplicationMyMyComputerMyProjectMyWebServicesThreadSafeObjectProvider`1NoAttributesEnumNoAttributesDelegateFooEnumFooStructFooConstStructISubFuncPropIDuplicatesNoAttributesStructureSomeNamespaceIAParametersIBICIDIByRefIOptionalParamIEventArgs2GeneralEventScenarioEventHandlerEventHandler2_ArcArcArcEventArcEvent_EventArcEvent_Event2IBaseInheritanceIDerivedDerivedImplInheritanceConflictINoPIAInterfaceLateboundINoPIAInterface2SomeOtherAttributeNoPIACopyAttributesIHasAllSupportedAttributesFooIHasAllSupportedAttributesEventIHasAllSupportedAttributes_EventHasAllSupportedAttributesCoClassIHasUnsupportedAttributesEnumHasAllSupportedAttributesEnumHasOnlyUnsupportedAttributesStructHasAllSupportedAttributesStructHasOnlyUnsupportedAttributesOtherPseudoCustomAttributesOverloadsIInSameClassIScen1VTableGapIScen2IScen3IScen4IScen5IScen6IScen7IComplicatedVTableIComplicatedVTableImplIIfeInheritsFromEnumIIfeScen2CoClassIfeCoClassIfeScen2INoAttributesOrMembersLackingAttributesIComImportButNoGuidOrMembersINoAttributesIComImportButNoGuidMicrosoft.VisualBasic.ApplicationServicesApplicationBase.ctorMicrosoft.VisualBasic.DevicesComputerSystemObject.cctorget_Computerm_ComputerObjectProviderget_Applicationm_AppObjectProviderUserget_Userm_UserObjectProviderget_WebServicesm_MyWebServicesObjectProviderApplicationWebServicesEqualsoGetHashCodeTypeGetTypeToStringCreate__Instance__TinstanceDispose__Instance__get_GetInstanceMicrosoft.VisualBasic.MyServices.InternalContextValue`1m_ContextGetInstanceEnumvalue__Foo1Foo2MulticastDelegateTargetObjectTargetMethodIAsyncResultAsyncCallbackBeginInvokexyDelegateCallbackDelegateAsyncStateEndInvokeDelegateAsyncResultInvoke__列挙識別子COMValueTypeStructureDecimalNET構造メンバーFoo3Foo4Field1pBarget_Propset_PropValuePropDuplicateADuplicateBget_PropDupeAset_PropDupeAget_PropDupeBset_PropDupeBPropDupeAPropDupeBp1p2p3p4p5System.CollectionsIEnumerableget_GetDataset_GetDataGetDataEventArgseSomeUnusedMethodCutSomeOtherUnusedMethodSomeLastMethodOneclickmovegrooveshakerattleadd_clickobjremove_clickadd_moveremove_moveadd_grooveremove_grooveadd_shakeremove_shakeadd_rattleremove_rattleIBaseSubIBaseFuncget_IBasePropset_IBasePropIBasePropIDerivedSubIDerivedFuncget_IDerivedPropset_IDerivedPropIDerivedPropConflictMethodget_IndexedPropertyset_IndexedPropertyIndexedPropertyget_IndexedPropertyDerivedset_IndexedPropertyDerivedIndexedPropertyDerivedMooget_Blahset_BlahFazzBlahAttributeset_WOPropget_ROPropPropAndRetHasAllSupportedAttributesScenario11strScenario12Scenario13WOPropROPropScenario14add_Scenario14remove_Scenario14FuncHasUnsupportedAttributesID1ID2aFieldHasAllSupportedAttributesDateTimeOverg1get_g2g2g000g001g002g003g004g005g006g007g008g009g010g011g012g013g014g015g016g017g018g019g020g021g022g023g024g025g026g027g028g029g030g031g032g033g034g035g036g037g038g039g040g041g042g043g044g045g046g047g048g049g050g051g052g053g054g055g056g057g058g059g060g061g062g063g064g065g066g067g068g069g070g071g072g073g074g075g076g077g078g079g080g081g082g083g084g085g086g087g088g089g090g091g092g093g094g095g096g097g098g099g100g101Mget_P1set_P1g3Func`1get_P2set_P2P1P2M1get_g1set_g1set_g2M2get_g3set_g4g4bcget_Fooindexset_Fooset_P3M3get_P4M4P3P4ConcatSystem.Collections.GenericIEnumerable`1System.ComponentModelEditorBrowsableAttributeEditorBrowsableStateSystem.CodeDom.CompilerGeneratedCodeAttributeSystem.DiagnosticsDebuggerNonUserCodeAttributeDebuggerHiddenAttributeMicrosoft.VisualBasic.CompilerServicesStandardModuleAttributeHideModuleNameAttributeSystem.ComponentModel.DesignHelpKeywordAttributeSystem.Runtime.CompilerServicesRuntimeHelpersGetObjectValueRuntimeTypeHandleGetTypeFromHandleActivatorCreateInstanceMyGroupCollectionAttributeget_Valueset_ValueSystem.Runtime.InteropServicesComVisibleAttributeGuidAttributeInterfaceTypeAttributeComInterfaceTypeComImportAttributeMarshalAsAttributeUnmanagedTypePreserveSigAttributeLCIDConversionAttributeDispIdAttributeOutAttributeInAttributeComEventInterfaceAttributeCoClassAttributeSystem.ReflectionDefaultMemberAttributeTypeLibTypeAttributeTypeLibTypeFlagsCLSCompliantAttributeTypeLibImportClassAttributeBestFitMappingAttributeAutomationProxyAttributeComAliasNameAttributeTypeLibFuncAttributeTypeLibFuncFlagsParamArrayAttributeDefaultParameterValueAttributeOptionalAttributeSpecialNameAttributeUnmanagedFunctionPointerAttributeCallingConventionFlagsAttributeStructLayoutAttributeLayoutKindFieldOffsetAttributeTypeLibVarAttributeTypeLibVarFlagsSerializableAttributeDebuggableAttributeDebuggingModesCompilationRelaxationsAttributeRuntimeCompatibilityAttributeSystem.Runtime.VersioningTargetFrameworkAttributeImportedFromTypeLibAttributeGeneralPiaGeneralPia.dll |k$@岐{oz\V4?_ :        0 (  %) % $1 2  1 1(1  0 0(0 H<@D < H<@D <  < <(< %9) 9 %T) T   X \ (  (  1 1(1    ( 1    (1 %) A   (   E E(E (        ((( I  Q  MyTemplate10.0.0.0  My.WebServices My.Computer My.UserMy.Applicationq  a4System.Web.Services.Protocols.SoapHttpClientProtocolCreate__Instance__Dispose__Instance__  )$ee3c2bee-9dfb-4d1c-91de-4cd32ff13302)$63370d76-3395-4560-92fd-b69ccfdaf461 )$bd62ff24-a97c-4a9c-a43e-09a31ff8b312 )$6a97be13-2611-4fc0-9d78-926dccec3243)$ed4bf792-06dd-449a-91d7-dde226e9f471)$3b3fce76-b864-4a7c-93f6-87ec17339299)$a6fa1a95-b29f-4f59-b457-29f8a55b3b6e)$906b08a3-e478-4c52-ae30-ecb484ac01f0)$bedd42c1-d023-4f53-8bfd-7c0b9de3aac7)$1313c178-13f6-4450-8360-cf50d751a0f4)$00000502-0000-6600-c000-000000000046)$00000002-0000-0000-c000-000000000046 )$00000002-0000-0000-c000-000000000047 |GeneralEventScenario.ArcEventYSystem.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)$27e3e649-994b-4f58-b3c6-f8089a5f2c6c Inheritance.DerivedImpl)$bd60d4b3-f50b-478b-8ef2-e777df99d810)$c9dcf748-b634-4504-a7ce-348cf7c61891IndexedProperty)$76a62998-7740-4ebd-a09f-e401ffff5c8cIndexedPropertyDerived$InheritanceConflict.DerivedImpl)$d6c92e52-47f4-4075-8078-99a21c29c8fa)$7e12bd3c-1ad1-427f-bab8-af82e30d980d)$43f3a25e-fccb-4b92-adc1-2fe84c922125)$ae390f6a-e7e4-47d7-a7b2-d95dfe14aac6 @94NoPIACopyAttributes.HasAllSupportedAttributesCoClassSThrowOnUnmappableChar)$16063cdc-9759-461c-9ad7-56376771a8fb aoeu    *--* SUsSystem.Runtime.InteropServices.CharSet, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089CharSet)$7b072a0e-065c-4266-89f4-bdb0de8df3b53NoPIACopyAttributes.IHasAllSupportedAttributesEventYSystem.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)$ef307d1d-343d-44ef-a2f0-8235e214295e)$7b072a0e-065c-4266-89f4-bdb0de8df2b5 )$6f4eb02b-3469-424c-bbcc-2672f653e646)$25f37bfe-5a80-42b8-9e35-af88676d7178   )$53de85e6-70eb-4b35-aff6-f34c0313637d )$f618f410-0331-487d-ade1-bd46289d9fe1)$984c80ba-2aec-4abf-afdd-c2bce69daa83)$a314887a-b963-4c6c-98a0-ff42d942cc9b)$4cfdb6c3-ff27-4fc2-b477-07b914286230)$6c5d196f-916c-433a-b62b-0bfc2f97675d)$d0f4f3fc-6599-4c8f-b97b-8d0ba9a4a3c8*P)$8feb04fb-8bb6-4121-b883-78b261936ae7&)$858df621-87bb-40a0-99b5-617f85d04c88)$11e95f23-fc7a-4a45-a3b4-b968f0e2cb2c)$2f7b5524-4f8d-4471-95e9-ce319babf8d0Foo% VTableGap.IComplicatedVTableImpl)$e08004c7-a558-4b02-b5f4-146c4b94aaa2 InheritsFromEnum.CoClassIfe)$ed9e4072-9bf4-4f6c-994d-8e415bcc6fd2% InheritsFromEnum.CoClassIfeScen2)$97792ef5-1377-46c1-9815-59c5828d034f)$f7cdfd32-d2e6-4f3f-92f0-bd2c9dcfa923)$8a8c22bf-d666-4462-bc8d-2faf1940e041 TWrapNonExceptionThrowsG.NETFramework,Version=v4.0TFrameworkDisplayName.NET Framework 4)$f9c2d51d-4f44-45f0-9eda-c9d599b58257GeneralPIA.dlljj j_CorDllMainmscoree.dll% @3L;PRSDScIMp]<D:\School\obj\Debug\GeneralPia.pdb0HXTT4VS_VERSION_INFO?DVarFileInfo$TranslationStringFileInfo000004b0,FileDescription 0FileVersion0.0.0.0@InternalNameGeneralPia.dll(LegalCopyright HOriginalFilenameGeneralPia.dll4ProductVersion0.0.0.08Assembly Version0.0.0.0` ;
MZ@ !L!This program cannot be run in DOS mode. $PEL3L! Lj @ @jS   H.textK L `.sdataWP@.rsrcR@@.reloc V@BjHl"<H&( **( *s s s s *0~o +*0~o +*0~o +*0~o +*0( ( +*0 ( +*0( +*0 ( +*0 - (+ ++ +*0 **( *0/ { o -(+ { o  +*V( s } *&( *&( *&(+ *&( *&( *&( *&( *BSJB v4.0.30319l$$#~$#Strings8#US8#GUID8#BlobW %3ID  A! $F  {  A{ Af}4H Kb K w  8"Q"~f  Q4f /CQhyA/Xm~ 1Pbfw*>Mfmf)7:7 E7 O ] x!   - - -  !)5#J5!%W5!)e5-j51n51w5759AE MNS [\_=b#c>!iBmbn pqss-s - s !@- s\!s\!uf\!xsz!zz!|z!z!z!z!z!z!z ! ! !  !  ! *!<*!Y*!g*!1 1--1O:1tG!PkVsVxkVsVVxV VfV0>PTglVqsxkV" %V& %kV" *V& ** , /q3P \ h   ( F5 dB!Fc$!Fh<!lX!Fqp!x!!!"FF F F> FzqF~FF F FFFFF>Fz0F>=FzJ!F+T$F7Y$%Fd'F+Fo,.Fv0F4F5FW7Fh7Fl9F9F9F9F9F9F9F9F9F:F;F<F=F>F?F @F AF BF- CF6 DF@ qDFN DF- EF6 FF@ qFFN FFf GFr HF qHF H"IF>IFzhIF IF JF KF>MFzhMF MF NF OF QF SF T$"VF>VFzWFB hYFF YFO YFX Z0"[Fl [Fw \F ]F ^F `F dhFjFlFmF mF mF n<"oF hoFzpF>pFzhpF>pFzhpF>7pT <rT BtFY uF\ huFf vFk vFp vFu vFz vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF$ vF) vF. vF3 vF8 vF= vFB vFG vFL vFQ vFV vF[ vF` vFe vFj vFo vFt vFy vF~ vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF vF# vF( vF- vF2 vF7 vF< vFA vFF vFK vFP vFU vFZ vF_ vFd KvFY 7xFc zFf q{Fm {FY |Fc |Ft }F~ Q~F YF KF F F\ hF F Ff qFm F qF F F jF~ QF YF qF Fd sFc Ft F 7F F F Ff Fm F F F F H"F F T"`"F>FzqF~FF>FzqF~Fx   UUUU                   *       x x 5`lpt!&2=5> ,4<D,4<Dxch)qLPTT"Tj !19AIQYa5iyqj5jjy   S   !19AI (,048<Tdehimpqtuy} #)F.... ..^@@3CCId`#cciW3{233133 3 #7@@3Ca``333333#CCmc#CC\cCC XK;+k1S#K#,#SCVccks{$ KC k 8 #k#Cb C c cccZ {1cJ k cJ +Q#HZ cJ {1 kc # @+QC cA k   # # ##B @#Cl `#c cS cK ##K #K:`## #` #    k1$ k1$ m @ #D kd  k1  #H k1 m k   # # k# !#!#!#< > oZqZ Zw w Zw   w      !Z#Z-w 57;=./#(-}()X\XXX      !$&4789:;C#D$OTAY^ZC_\ \    + ]   c G  bY c G Y c Gt  o bY >   78:9;<>= @ ?  o n   #$CDGHLKRQWVZY_!`!c#d%{'))++--//113579;;==??AACEGGIIuu   //<Module>mscorlibMicrosoft.VisualBasicMyApplicationMyMyComputerMyProjectMyWebServicesThreadSafeObjectProvider`1NoAttributesEnumNoAttributesDelegateFooEnumFooStructFooConstStructISubFuncPropIDuplicatesNoAttributesStructureSomeNamespaceIAParametersIBICIDIByRefIOptionalParamIEventArgs2GeneralEventScenarioEventHandlerEventHandler2_ArcArcArcEventArcEvent_EventArcEvent_Event2IBaseInheritanceIDerivedDerivedImplInheritanceConflictINoPIAInterfaceLateboundINoPIAInterface2SomeOtherAttributeNoPIACopyAttributesIHasAllSupportedAttributesFooIHasAllSupportedAttributesEventIHasAllSupportedAttributes_EventHasAllSupportedAttributesCoClassIHasUnsupportedAttributesEnumHasAllSupportedAttributesEnumHasOnlyUnsupportedAttributesStructHasAllSupportedAttributesStructHasOnlyUnsupportedAttributesOtherPseudoCustomAttributesOverloadsIInSameClassIScen1VTableGapIScen2IScen3IScen4IScen5IScen6IScen7IComplicatedVTableIComplicatedVTableImplIIfeInheritsFromEnumIIfeScen2CoClassIfeCoClassIfeScen2INoAttributesOrMembersLackingAttributesIComImportButNoGuidOrMembersINoAttributesIComImportButNoGuidMicrosoft.VisualBasic.ApplicationServicesApplicationBase.ctorMicrosoft.VisualBasic.DevicesComputerSystemObject.cctorget_Computerm_ComputerObjectProviderget_Applicationm_AppObjectProviderUserget_Userm_UserObjectProviderget_WebServicesm_MyWebServicesObjectProviderApplicationWebServicesEqualsoGetHashCodeTypeGetTypeToStringCreate__Instance__TinstanceDispose__Instance__get_GetInstanceMicrosoft.VisualBasic.MyServices.InternalContextValue`1m_ContextGetInstanceEnumvalue__Foo1Foo2MulticastDelegateTargetObjectTargetMethodIAsyncResultAsyncCallbackBeginInvokexyDelegateCallbackDelegateAsyncStateEndInvokeDelegateAsyncResultInvoke__列挙識別子COMValueTypeStructureDecimalNET構造メンバーFoo3Foo4Field1pBarget_Propset_PropValuePropDuplicateADuplicateBget_PropDupeAset_PropDupeAget_PropDupeBset_PropDupeBPropDupeAPropDupeBp1p2p3p4p5System.CollectionsIEnumerableget_GetDataset_GetDataGetDataEventArgseSomeUnusedMethodCutSomeOtherUnusedMethodSomeLastMethodOneclickmovegrooveshakerattleadd_clickobjremove_clickadd_moveremove_moveadd_grooveremove_grooveadd_shakeremove_shakeadd_rattleremove_rattleIBaseSubIBaseFuncget_IBasePropset_IBasePropIBasePropIDerivedSubIDerivedFuncget_IDerivedPropset_IDerivedPropIDerivedPropConflictMethodget_IndexedPropertyset_IndexedPropertyIndexedPropertyget_IndexedPropertyDerivedset_IndexedPropertyDerivedIndexedPropertyDerivedMooget_Blahset_BlahFazzBlahAttributeset_WOPropget_ROPropPropAndRetHasAllSupportedAttributesScenario11strScenario12Scenario13WOPropROPropScenario14add_Scenario14remove_Scenario14FuncHasUnsupportedAttributesID1ID2aFieldHasAllSupportedAttributesDateTimeOverg1get_g2g2g000g001g002g003g004g005g006g007g008g009g010g011g012g013g014g015g016g017g018g019g020g021g022g023g024g025g026g027g028g029g030g031g032g033g034g035g036g037g038g039g040g041g042g043g044g045g046g047g048g049g050g051g052g053g054g055g056g057g058g059g060g061g062g063g064g065g066g067g068g069g070g071g072g073g074g075g076g077g078g079g080g081g082g083g084g085g086g087g088g089g090g091g092g093g094g095g096g097g098g099g100g101Mget_P1set_P1g3Func`1get_P2set_P2P1P2M1get_g1set_g1set_g2M2get_g3set_g4g4bcget_Fooindexset_Fooset_P3M3get_P4M4P3P4ConcatSystem.Collections.GenericIEnumerable`1System.ComponentModelEditorBrowsableAttributeEditorBrowsableStateSystem.CodeDom.CompilerGeneratedCodeAttributeSystem.DiagnosticsDebuggerNonUserCodeAttributeDebuggerHiddenAttributeMicrosoft.VisualBasic.CompilerServicesStandardModuleAttributeHideModuleNameAttributeSystem.ComponentModel.DesignHelpKeywordAttributeSystem.Runtime.CompilerServicesRuntimeHelpersGetObjectValueRuntimeTypeHandleGetTypeFromHandleActivatorCreateInstanceMyGroupCollectionAttributeget_Valueset_ValueSystem.Runtime.InteropServicesComVisibleAttributeGuidAttributeInterfaceTypeAttributeComInterfaceTypeComImportAttributeMarshalAsAttributeUnmanagedTypePreserveSigAttributeLCIDConversionAttributeDispIdAttributeOutAttributeInAttributeComEventInterfaceAttributeCoClassAttributeSystem.ReflectionDefaultMemberAttributeTypeLibTypeAttributeTypeLibTypeFlagsCLSCompliantAttributeTypeLibImportClassAttributeBestFitMappingAttributeAutomationProxyAttributeComAliasNameAttributeTypeLibFuncAttributeTypeLibFuncFlagsParamArrayAttributeDefaultParameterValueAttributeOptionalAttributeSpecialNameAttributeUnmanagedFunctionPointerAttributeCallingConventionFlagsAttributeStructLayoutAttributeLayoutKindFieldOffsetAttributeTypeLibVarAttributeTypeLibVarFlagsSerializableAttributeDebuggableAttributeDebuggingModesCompilationRelaxationsAttributeRuntimeCompatibilityAttributeSystem.Runtime.VersioningTargetFrameworkAttributeImportedFromTypeLibAttributeGeneralPiaGeneralPia.dll |k$@岐{oz\V4?_ :        0 (  %) % $1 2  1 1(1  0 0(0 H<@D < H<@D <  < <(< %9) 9 %T) T   X \ (  (  1 1(1    ( 1    (1 %) A   (   E E(E (        ((( I  Q  MyTemplate10.0.0.0  My.WebServices My.Computer My.UserMy.Applicationq  a4System.Web.Services.Protocols.SoapHttpClientProtocolCreate__Instance__Dispose__Instance__  )$ee3c2bee-9dfb-4d1c-91de-4cd32ff13302)$63370d76-3395-4560-92fd-b69ccfdaf461 )$bd62ff24-a97c-4a9c-a43e-09a31ff8b312 )$6a97be13-2611-4fc0-9d78-926dccec3243)$ed4bf792-06dd-449a-91d7-dde226e9f471)$3b3fce76-b864-4a7c-93f6-87ec17339299)$a6fa1a95-b29f-4f59-b457-29f8a55b3b6e)$906b08a3-e478-4c52-ae30-ecb484ac01f0)$bedd42c1-d023-4f53-8bfd-7c0b9de3aac7)$1313c178-13f6-4450-8360-cf50d751a0f4)$00000502-0000-6600-c000-000000000046)$00000002-0000-0000-c000-000000000046 )$00000002-0000-0000-c000-000000000047 |GeneralEventScenario.ArcEventYSystem.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)$27e3e649-994b-4f58-b3c6-f8089a5f2c6c Inheritance.DerivedImpl)$bd60d4b3-f50b-478b-8ef2-e777df99d810)$c9dcf748-b634-4504-a7ce-348cf7c61891IndexedProperty)$76a62998-7740-4ebd-a09f-e401ffff5c8cIndexedPropertyDerived$InheritanceConflict.DerivedImpl)$d6c92e52-47f4-4075-8078-99a21c29c8fa)$7e12bd3c-1ad1-427f-bab8-af82e30d980d)$43f3a25e-fccb-4b92-adc1-2fe84c922125)$ae390f6a-e7e4-47d7-a7b2-d95dfe14aac6 @94NoPIACopyAttributes.HasAllSupportedAttributesCoClassSThrowOnUnmappableChar)$16063cdc-9759-461c-9ad7-56376771a8fb aoeu    *--* SUsSystem.Runtime.InteropServices.CharSet, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089CharSet)$7b072a0e-065c-4266-89f4-bdb0de8df3b53NoPIACopyAttributes.IHasAllSupportedAttributesEventYSystem.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)$ef307d1d-343d-44ef-a2f0-8235e214295e)$7b072a0e-065c-4266-89f4-bdb0de8df2b5 )$6f4eb02b-3469-424c-bbcc-2672f653e646)$25f37bfe-5a80-42b8-9e35-af88676d7178   )$53de85e6-70eb-4b35-aff6-f34c0313637d )$f618f410-0331-487d-ade1-bd46289d9fe1)$984c80ba-2aec-4abf-afdd-c2bce69daa83)$a314887a-b963-4c6c-98a0-ff42d942cc9b)$4cfdb6c3-ff27-4fc2-b477-07b914286230)$6c5d196f-916c-433a-b62b-0bfc2f97675d)$d0f4f3fc-6599-4c8f-b97b-8d0ba9a4a3c8*P)$8feb04fb-8bb6-4121-b883-78b261936ae7&)$858df621-87bb-40a0-99b5-617f85d04c88)$11e95f23-fc7a-4a45-a3b4-b968f0e2cb2c)$2f7b5524-4f8d-4471-95e9-ce319babf8d0Foo% VTableGap.IComplicatedVTableImpl)$e08004c7-a558-4b02-b5f4-146c4b94aaa2 InheritsFromEnum.CoClassIfe)$ed9e4072-9bf4-4f6c-994d-8e415bcc6fd2% InheritsFromEnum.CoClassIfeScen2)$97792ef5-1377-46c1-9815-59c5828d034f)$f7cdfd32-d2e6-4f3f-92f0-bd2c9dcfa923)$8a8c22bf-d666-4462-bc8d-2faf1940e041 TWrapNonExceptionThrowsG.NETFramework,Version=v4.0TFrameworkDisplayName.NET Framework 4)$f9c2d51d-4f44-45f0-9eda-c9d599b58257GeneralPIA.dlljj j_CorDllMainmscoree.dll% @3L;PRSDScIMp]<D:\School\obj\Debug\GeneralPia.pdb0HXTT4VS_VERSION_INFO?DVarFileInfo$TranslationStringFileInfo000004b0,FileDescription 0FileVersion0.0.0.0@InternalNameGeneralPia.dll(LegalCopyright HOriginalFilenameGeneralPia.dll4ProductVersion0.0.0.08Assembly Version0.0.0.0` ;
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Features/VisualBasic/Portable/Structure/Providers/DelegateDeclarationStructureProvider.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Threading Imports Microsoft.CodeAnalysis.[Shared].Collections Imports Microsoft.CodeAnalysis.Structure Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Structure Friend Class DelegateDeclarationStructureProvider Inherits AbstractSyntaxNodeStructureProvider(Of DelegateStatementSyntax) Protected Overrides Sub CollectBlockSpans(previousToken As SyntaxToken, delegateDeclaration As DelegateStatementSyntax, ByRef spans As TemporaryArray(Of BlockSpan), optionProvider As BlockStructureOptionProvider, cancellationToken As CancellationToken) CollectCommentsRegions(delegateDeclaration, spans, optionProvider) End Sub End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Threading Imports Microsoft.CodeAnalysis.[Shared].Collections Imports Microsoft.CodeAnalysis.Structure Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Structure Friend Class DelegateDeclarationStructureProvider Inherits AbstractSyntaxNodeStructureProvider(Of DelegateStatementSyntax) Protected Overrides Sub CollectBlockSpans(previousToken As SyntaxToken, delegateDeclaration As DelegateStatementSyntax, ByRef spans As TemporaryArray(Of BlockSpan), optionProvider As BlockStructureOptionProvider, cancellationToken As CancellationToken) CollectCommentsRegions(delegateDeclaration, spans, optionProvider) End Sub End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Test/Resources/Core/SymbolsTests/netModule/CrossRefModule1.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Public Class M1 End Class
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Public Class M1 End Class
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./scripts/generate-badges.ps1
# Script for generating our badges line in the README.md [CmdletBinding(PositionalBinding=$false)] param () $branchNames = @( 'main', 'main-vs-deps') function Get-AzureBadge($branchName, $jobName, $configName, [switch]$integration = $false) { $name = if ($integration) { "roslyn-integration-CI" } else { "roslyn-CI" } $id = if ($integration) { 245 } else { 15 } $template = "[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/$($name)?branchname=$branchName&jobname=$jobName&configuration=$jobName$configName&label=build)]" $template += "(https://dev.azure.com/dnceng/public/_build/latest?definitionId=$($id)&branchname=$branchName&view=logs)" return $template } function Get-AzureLine($branchName, $jobNames, [switch]$integration = $false) { $line = "**$branchName**|" foreach ($jobName in $jobNames) { $configName = "" $i = $jobName.IndexOf('#') if ($i -ge 0) { $configName = "%20$($jobName.SubString($i + 1))" $jobName = $jobName.Substring(0, $i) } $line += Get-AzureBadge $branchName $jobName $configName -integration:$integration $line += "|" } return $line + [Environment]::NewLine } function Get-BuildsTable() { $jobNames = @( 'Build_Windows_Debug' 'Build_Windows_Release' 'Build_Unix_Debug' ) $table = @' #### Builds |Branch|Windows Debug|Windows Release|Unix Debug| |:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } function Get-DesktopTable() { $jobNames = @( 'Test_Windows_Desktop_Debug_32' 'Test_Windows_Desktop_Debug_64' 'Test_Windows_Desktop_Release_32' 'Test_Windows_Desktop_Release_64' ) $table = @' #### Desktop Unit Tests |Branch|Debug x86|Debug x64|Release x86|Release x64| |:--:|:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } function Get-CoreClrTable() { $jobNames = @( 'Test_Windows_CoreClr_Debug', 'Test_Windows_CoreClr_Release', 'Test_Linux_Debug' ) $table = @' #### CoreClr Unit Tests |Branch|Windows Debug|Windows Release|Linux| |:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } function Get-IntegrationTable() { $jobNames = @( 'VS_Integration#debug_32', 'VS_Integration#debug_64', 'VS_Integration#release_32', 'VS_Integration#release_64' ) $table = @' #### Integration Tests |Branch|Debug x86|Debug x64|Release x86|Release x64 |:--:|:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames -integration:$true } return $table } function Get-MiscTable() { $jobNames = @( 'Correctness_Determinism', 'Correctness_Build', 'Correctness_SourceBuild', 'Test_Windows_Desktop_Spanish_Release_32', 'Test_macOS_Debug' ) $table = @' #### Misc Tests |Branch|Determinism|Build Correctness|Source build|Spanish|MacOS| |:--:|:--:|:--|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } Set-StrictMode -version 2.0 $ErrorActionPreference="Stop" try { Get-BuildsTable | Write-Output Get-DesktopTable | Write-Output Get-CoreClrTable | Write-Output Get-IntegrationTable | Write-Output Get-MiscTable | Write-Output exit 0 } catch { Write-Host $_ Write-Host $_.Exception Write-Host $_.ScriptStackTrace exit 1 }
# Script for generating our badges line in the README.md [CmdletBinding(PositionalBinding=$false)] param () $branchNames = @( 'main', 'main-vs-deps') function Get-AzureBadge($branchName, $jobName, $configName, [switch]$integration = $false) { $name = if ($integration) { "roslyn-integration-CI" } else { "roslyn-CI" } $id = if ($integration) { 245 } else { 15 } $template = "[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/$($name)?branchname=$branchName&jobname=$jobName&configuration=$jobName$configName&label=build)]" $template += "(https://dev.azure.com/dnceng/public/_build/latest?definitionId=$($id)&branchname=$branchName&view=logs)" return $template } function Get-AzureLine($branchName, $jobNames, [switch]$integration = $false) { $line = "**$branchName**|" foreach ($jobName in $jobNames) { $configName = "" $i = $jobName.IndexOf('#') if ($i -ge 0) { $configName = "%20$($jobName.SubString($i + 1))" $jobName = $jobName.Substring(0, $i) } $line += Get-AzureBadge $branchName $jobName $configName -integration:$integration $line += "|" } return $line + [Environment]::NewLine } function Get-BuildsTable() { $jobNames = @( 'Build_Windows_Debug' 'Build_Windows_Release' 'Build_Unix_Debug' ) $table = @' #### Builds |Branch|Windows Debug|Windows Release|Unix Debug| |:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } function Get-DesktopTable() { $jobNames = @( 'Test_Windows_Desktop_Debug_32' 'Test_Windows_Desktop_Debug_64' 'Test_Windows_Desktop_Release_32' 'Test_Windows_Desktop_Release_64' ) $table = @' #### Desktop Unit Tests |Branch|Debug x86|Debug x64|Release x86|Release x64| |:--:|:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } function Get-CoreClrTable() { $jobNames = @( 'Test_Windows_CoreClr_Debug', 'Test_Windows_CoreClr_Release', 'Test_Linux_Debug' ) $table = @' #### CoreClr Unit Tests |Branch|Windows Debug|Windows Release|Linux| |:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } function Get-IntegrationTable() { $jobNames = @( 'VS_Integration#debug_32', 'VS_Integration#debug_64', 'VS_Integration#release_32', 'VS_Integration#release_64' ) $table = @' #### Integration Tests |Branch|Debug x86|Debug x64|Release x86|Release x64 |:--:|:--:|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames -integration:$true } return $table } function Get-MiscTable() { $jobNames = @( 'Correctness_Determinism', 'Correctness_Build', 'Correctness_SourceBuild', 'Test_Windows_Desktop_Spanish_Release_32', 'Test_macOS_Debug' ) $table = @' #### Misc Tests |Branch|Determinism|Build Correctness|Source build|Spanish|MacOS| |:--:|:--:|:--|:--:|:--:|:--:| '@ foreach ($branchName in $branchNames) { $table += Get-AzureLine $branchName $jobNames } return $table } Set-StrictMode -version 2.0 $ErrorActionPreference="Stop" try { Get-BuildsTable | Write-Output Get-DesktopTable | Write-Output Get-CoreClrTable | Write-Output Get-IntegrationTable | Write-Output Get-MiscTable | Write-Output exit 0 } catch { Write-Host $_ Write-Host $_.Exception Write-Host $_.ScriptStackTrace exit 1 }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableDictionaryBuilderTestBase.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTestBase.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { public abstract partial class ImmutableDictionaryBuilderTestBase : ImmutablesTestBase { [Fact] public void Add() { var builder = this.GetBuilder<string, int>(); builder.Add("five", 5); builder.Add(new KeyValuePair<string, int>("six", 6)); Assert.Equal(5, builder["five"]); Assert.Equal(6, builder["six"]); Assert.False(builder.ContainsKey("four")); } /// <summary> /// Verifies that "adding" an entry to the dictionary that already exists /// with exactly the same key and value will *not* throw an exception. /// </summary> /// <remarks> /// The BCL Dictionary type would throw in this circumstance. /// But in an immutable world, not only do we not care so much since the result is the same. /// </remarks> [Fact] public void AddExactDuplicate() { var builder = this.GetBuilder<string, int>(); builder.Add("five", 5); builder.Add("five", 5); Assert.Equal(1, builder.Count); } [Fact] public void AddExistingKeyWithDifferentValue() { var builder = this.GetBuilder<string, int>(); builder.Add("five", 5); Assert.Throws<ArgumentException>(null, () => builder.Add("five", 6)); } [Fact] public void Indexer() { var builder = this.GetBuilder<string, int>(); // Set and set again. builder["five"] = 5; Assert.Equal(5, builder["five"]); builder["five"] = 5; Assert.Equal(5, builder["five"]); // Set to a new value. builder["five"] = 50; Assert.Equal(50, builder["five"]); // Retrieve an invalid value. Assert.Throws<KeyNotFoundException>(() => builder["foo"]); } [Fact] public void ContainsPair() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5); var builder = this.GetBuilder(map); Assert.True(builder.Contains(new KeyValuePair<string, int>("five", 5))); } [Fact] public void RemovePair() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); Assert.True(builder.Remove(new KeyValuePair<string, int>("five", 5))); Assert.False(builder.Remove(new KeyValuePair<string, int>("foo", 1))); Assert.Equal(1, builder.Count); Assert.Equal(6, builder["six"]); } [Fact] public void RemoveKey() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); builder.Remove("five"); Assert.Equal(1, builder.Count); Assert.Equal(6, builder["six"]); } [Fact] public void CopyTo() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5); var builder = this.GetBuilder(map); var array = new KeyValuePair<string, int>[2]; // intentionally larger than source. builder.CopyTo(array, 1); Assert.Equal(new KeyValuePair<string, int>(), array[0]); Assert.Equal(new KeyValuePair<string, int>("five", 5), array[1]); Assert.Throws<ArgumentNullException>("array", () => builder.CopyTo(null!, 0)); } [Fact] public void IsReadOnly() { var builder = this.GetBuilder<string, int>(); Assert.False(builder.IsReadOnly); } [Fact] public void Keys() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); CollectionAssertAreEquivalent(new[] { "five", "six" }, builder.Keys); CollectionAssertAreEquivalent(new[] { "five", "six" }, ((IReadOnlyDictionary<string, int>)builder).Keys.ToArray()); } [Fact] public void Values() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); CollectionAssertAreEquivalent(new[] { 5, 6 }, builder.Values); CollectionAssertAreEquivalent(new[] { 5, 6 }, ((IReadOnlyDictionary<string, int>)builder).Values.ToArray()); } [Fact] public void TryGetValue() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); Assert.True(builder.TryGetValue("five", out int value) && value == 5); Assert.True(builder.TryGetValue("six", out value) && value == 6); Assert.False(builder.TryGetValue("four", out value)); Assert.Equal(0, value); } [Fact] public void EnumerateTest() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); using (var enumerator = builder.GetEnumerator()) { Assert.True(enumerator.MoveNext()); Assert.True(enumerator.MoveNext()); Assert.False(enumerator.MoveNext()); } var manualEnum = builder.GetEnumerator(); Assert.Equal(default(KeyValuePair<string, int>), manualEnum.Current); while (manualEnum.MoveNext()) { } Assert.False(manualEnum.MoveNext()); Assert.Equal(default(KeyValuePair<string, int>), manualEnum.Current); } [Fact] public void IDictionaryMembers() { var builder = this.GetBuilder<string, int>(); var dictionary = (IDictionary)builder; dictionary.Add("a", 1); Assert.True(dictionary.Contains("a")); Assert.Equal(1, dictionary["a"]); Assert.Equal(new[] { "a" }, dictionary.Keys.Cast<string>().ToArray()); Assert.Equal(new[] { 1 }, dictionary.Values.Cast<int>().ToArray()); dictionary["a"] = 2; Assert.Equal(2, dictionary["a"]); dictionary.Remove("a"); Assert.False(dictionary.Contains("a")); Assert.False(dictionary.IsFixedSize); Assert.False(dictionary.IsReadOnly); } [Fact] public void IDictionaryEnumerator() { var builder = this.GetBuilder<string, int>(); var dictionary = (IDictionary)builder; dictionary.Add("a", 1); var enumerator = dictionary.GetEnumerator(); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.True(enumerator.MoveNext()); Assert.Equal(enumerator.Entry, enumerator.Current); Assert.Equal(enumerator.Key, enumerator.Entry.Key); Assert.Equal(enumerator.Value, enumerator.Entry.Value); Assert.Equal("a", enumerator.Key); Assert.Equal(1, enumerator.Value); Assert.False(enumerator.MoveNext()); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.False(enumerator.MoveNext()); enumerator.Reset(); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.True(enumerator.MoveNext()); Assert.Equal(enumerator.Key, ((DictionaryEntry)enumerator.Current).Key); Assert.Equal(enumerator.Value, ((DictionaryEntry)enumerator.Current).Value); Assert.Equal("a", enumerator.Key); Assert.Equal(1, enumerator.Value); Assert.False(enumerator.MoveNext()); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.False(enumerator.MoveNext()); } [Fact] public void ICollectionMembers() { var builder = this.GetBuilder<string, int>(); var collection = (ICollection)builder; collection.CopyTo(Array.Empty<object>(), 0); builder.Add("b", 2); Assert.True(builder.ContainsKey("b")); var array = new object[builder.Count + 1]; collection.CopyTo(array, 1); Assert.Null(array[0]); Assert.Equal(new object?[] { null, new KeyValuePair<string, int>("b", 2) }, array); var entryArray = new DictionaryEntry[builder.Count + 1]; collection.CopyTo(entryArray, 1); Assert.Equal(default(DictionaryEntry), entryArray[0]); Assert.Equal(new DictionaryEntry[] { default, new DictionaryEntry("b", 2) }, entryArray); Assert.False(collection.IsSynchronized); Assert.NotNull(collection.SyncRoot); Assert.Same(collection.SyncRoot, collection.SyncRoot); } protected abstract bool TryGetKeyHelper<TKey, TValue>(IDictionary<TKey, TValue> dictionary, TKey equalKey, out TKey actualKey) where TKey : notnull; /// <summary> /// Gets the Builder for a given dictionary instance. /// </summary> /// <typeparam name="TKey">The type of key.</typeparam> /// <typeparam name="TValue">The type of value.</typeparam> /// <returns>The builder.</returns> protected abstract IDictionary<TKey, TValue> GetBuilder<TKey, TValue>(IImmutableDictionary<TKey, TValue>? basis = null) where TKey : notnull; /// <summary> /// Gets an empty immutable dictionary. /// </summary> /// <typeparam name="TKey">The type of key.</typeparam> /// <typeparam name="TValue">The type of value.</typeparam> /// <returns>The immutable dictionary.</returns> protected abstract IImmutableDictionary<TKey, TValue> GetEmptyImmutableDictionary<TKey, TValue>() where TKey : notnull; protected abstract IImmutableDictionary<string, TValue> Empty<TValue>(StringComparer comparer); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTestBase.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { public abstract partial class ImmutableDictionaryBuilderTestBase : ImmutablesTestBase { [Fact] public void Add() { var builder = this.GetBuilder<string, int>(); builder.Add("five", 5); builder.Add(new KeyValuePair<string, int>("six", 6)); Assert.Equal(5, builder["five"]); Assert.Equal(6, builder["six"]); Assert.False(builder.ContainsKey("four")); } /// <summary> /// Verifies that "adding" an entry to the dictionary that already exists /// with exactly the same key and value will *not* throw an exception. /// </summary> /// <remarks> /// The BCL Dictionary type would throw in this circumstance. /// But in an immutable world, not only do we not care so much since the result is the same. /// </remarks> [Fact] public void AddExactDuplicate() { var builder = this.GetBuilder<string, int>(); builder.Add("five", 5); builder.Add("five", 5); Assert.Equal(1, builder.Count); } [Fact] public void AddExistingKeyWithDifferentValue() { var builder = this.GetBuilder<string, int>(); builder.Add("five", 5); Assert.Throws<ArgumentException>(null, () => builder.Add("five", 6)); } [Fact] public void Indexer() { var builder = this.GetBuilder<string, int>(); // Set and set again. builder["five"] = 5; Assert.Equal(5, builder["five"]); builder["five"] = 5; Assert.Equal(5, builder["five"]); // Set to a new value. builder["five"] = 50; Assert.Equal(50, builder["five"]); // Retrieve an invalid value. Assert.Throws<KeyNotFoundException>(() => builder["foo"]); } [Fact] public void ContainsPair() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5); var builder = this.GetBuilder(map); Assert.True(builder.Contains(new KeyValuePair<string, int>("five", 5))); } [Fact] public void RemovePair() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); Assert.True(builder.Remove(new KeyValuePair<string, int>("five", 5))); Assert.False(builder.Remove(new KeyValuePair<string, int>("foo", 1))); Assert.Equal(1, builder.Count); Assert.Equal(6, builder["six"]); } [Fact] public void RemoveKey() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); builder.Remove("five"); Assert.Equal(1, builder.Count); Assert.Equal(6, builder["six"]); } [Fact] public void CopyTo() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5); var builder = this.GetBuilder(map); var array = new KeyValuePair<string, int>[2]; // intentionally larger than source. builder.CopyTo(array, 1); Assert.Equal(new KeyValuePair<string, int>(), array[0]); Assert.Equal(new KeyValuePair<string, int>("five", 5), array[1]); Assert.Throws<ArgumentNullException>("array", () => builder.CopyTo(null!, 0)); } [Fact] public void IsReadOnly() { var builder = this.GetBuilder<string, int>(); Assert.False(builder.IsReadOnly); } [Fact] public void Keys() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); CollectionAssertAreEquivalent(new[] { "five", "six" }, builder.Keys); CollectionAssertAreEquivalent(new[] { "five", "six" }, ((IReadOnlyDictionary<string, int>)builder).Keys.ToArray()); } [Fact] public void Values() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); CollectionAssertAreEquivalent(new[] { 5, 6 }, builder.Values); CollectionAssertAreEquivalent(new[] { 5, 6 }, ((IReadOnlyDictionary<string, int>)builder).Values.ToArray()); } [Fact] public void TryGetValue() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); Assert.True(builder.TryGetValue("five", out int value) && value == 5); Assert.True(builder.TryGetValue("six", out value) && value == 6); Assert.False(builder.TryGetValue("four", out value)); Assert.Equal(0, value); } [Fact] public void EnumerateTest() { var map = this.GetEmptyImmutableDictionary<string, int>().Add("five", 5).Add("six", 6); var builder = this.GetBuilder(map); using (var enumerator = builder.GetEnumerator()) { Assert.True(enumerator.MoveNext()); Assert.True(enumerator.MoveNext()); Assert.False(enumerator.MoveNext()); } var manualEnum = builder.GetEnumerator(); Assert.Equal(default(KeyValuePair<string, int>), manualEnum.Current); while (manualEnum.MoveNext()) { } Assert.False(manualEnum.MoveNext()); Assert.Equal(default(KeyValuePair<string, int>), manualEnum.Current); } [Fact] public void IDictionaryMembers() { var builder = this.GetBuilder<string, int>(); var dictionary = (IDictionary)builder; dictionary.Add("a", 1); Assert.True(dictionary.Contains("a")); Assert.Equal(1, dictionary["a"]); Assert.Equal(new[] { "a" }, dictionary.Keys.Cast<string>().ToArray()); Assert.Equal(new[] { 1 }, dictionary.Values.Cast<int>().ToArray()); dictionary["a"] = 2; Assert.Equal(2, dictionary["a"]); dictionary.Remove("a"); Assert.False(dictionary.Contains("a")); Assert.False(dictionary.IsFixedSize); Assert.False(dictionary.IsReadOnly); } [Fact] public void IDictionaryEnumerator() { var builder = this.GetBuilder<string, int>(); var dictionary = (IDictionary)builder; dictionary.Add("a", 1); var enumerator = dictionary.GetEnumerator(); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.True(enumerator.MoveNext()); Assert.Equal(enumerator.Entry, enumerator.Current); Assert.Equal(enumerator.Key, enumerator.Entry.Key); Assert.Equal(enumerator.Value, enumerator.Entry.Value); Assert.Equal("a", enumerator.Key); Assert.Equal(1, enumerator.Value); Assert.False(enumerator.MoveNext()); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.False(enumerator.MoveNext()); enumerator.Reset(); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.True(enumerator.MoveNext()); Assert.Equal(enumerator.Key, ((DictionaryEntry)enumerator.Current).Key); Assert.Equal(enumerator.Value, ((DictionaryEntry)enumerator.Current).Value); Assert.Equal("a", enumerator.Key); Assert.Equal(1, enumerator.Value); Assert.False(enumerator.MoveNext()); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Current); Assert.Null(enumerator.Key); Assert.Equal(0, enumerator.Value); Assert.Equal(new DictionaryEntry(null!, 0), enumerator.Entry); Assert.False(enumerator.MoveNext()); } [Fact] public void ICollectionMembers() { var builder = this.GetBuilder<string, int>(); var collection = (ICollection)builder; collection.CopyTo(Array.Empty<object>(), 0); builder.Add("b", 2); Assert.True(builder.ContainsKey("b")); var array = new object[builder.Count + 1]; collection.CopyTo(array, 1); Assert.Null(array[0]); Assert.Equal(new object?[] { null, new KeyValuePair<string, int>("b", 2) }, array); var entryArray = new DictionaryEntry[builder.Count + 1]; collection.CopyTo(entryArray, 1); Assert.Equal(default(DictionaryEntry), entryArray[0]); Assert.Equal(new DictionaryEntry[] { default, new DictionaryEntry("b", 2) }, entryArray); Assert.False(collection.IsSynchronized); Assert.NotNull(collection.SyncRoot); Assert.Same(collection.SyncRoot, collection.SyncRoot); } protected abstract bool TryGetKeyHelper<TKey, TValue>(IDictionary<TKey, TValue> dictionary, TKey equalKey, out TKey actualKey) where TKey : notnull; /// <summary> /// Gets the Builder for a given dictionary instance. /// </summary> /// <typeparam name="TKey">The type of key.</typeparam> /// <typeparam name="TValue">The type of value.</typeparam> /// <returns>The builder.</returns> protected abstract IDictionary<TKey, TValue> GetBuilder<TKey, TValue>(IImmutableDictionary<TKey, TValue>? basis = null) where TKey : notnull; /// <summary> /// Gets an empty immutable dictionary. /// </summary> /// <typeparam name="TKey">The type of key.</typeparam> /// <typeparam name="TValue">The type of value.</typeparam> /// <returns>The immutable dictionary.</returns> protected abstract IImmutableDictionary<TKey, TValue> GetEmptyImmutableDictionary<TKey, TValue>() where TKey : notnull; protected abstract IImmutableDictionary<string, TValue> Empty<TValue>(StringComparer comparer); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="it" original="../CSharpResources.resx"> <body> <trans-unit id="CallingConventionTypeIsInvalid"> <source>Cannot use '{0}' as a calling convention modifier.</source> <target state="translated">Non è possibile usare '{0}' come modificatore di convenzione di chiamata.</target> <note /> </trans-unit> <trans-unit id="CallingConventionTypesRequireUnmanaged"> <source>Passing '{0}' is not valid unless '{1}' is 'SignatureCallingConvention.Unmanaged'.</source> <target state="translated">Non è possibile '{0}' a meno che '{1}' non sia 'SignatureCallingConvention.Unmanaged'.</target> <note /> </trans-unit> <trans-unit id="CannotCreateConstructedFromConstructed"> <source>Cannot create constructed generic type from another constructed generic type.</source> <target state="translated">Non è possibile creare un tipo generico costruito a partire da un altro tipo generico costruito.</target> <note /> </trans-unit> <trans-unit id="CannotCreateConstructedFromNongeneric"> <source>Cannot create constructed generic type from non-generic type.</source> <target state="translated">Non è possibile creare un tipo generico costruito a partire da un tipo non generico.</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractConversionNotInvolvingContainedType"> <source>User-defined conversion in an interface must convert to or from a type parameter on the enclosing type constrained to the enclosing type</source> <target state="new">User-defined conversion in an interface must convert to or from a type parameter on the enclosing type constrained to the enclosing type</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractEventHasAccessors"> <source>'{0}': abstract event cannot use event accessor syntax</source> <target state="translated">'{0}': l'evento astratto non può usare la sintassi della funzione di accesso agli eventi</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfMethodGroupInExpressionTree"> <source>'&amp;' on method groups cannot be used in expression trees</source> <target state="translated">Non è possibile usare '&amp;' su gruppi di metodi in alberi delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfToNonFunctionPointer"> <source>Cannot convert &amp;method group '{0}' to non-function pointer type '{1}'.</source> <target state="translated">Non è possibile convertire il gruppo di &amp;metodi '{0}' nel tipo di puntatore non a funzione '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AltInterpolatedVerbatimStringsNotAvailable"> <source>To use '@$' instead of '$@' for an interpolated verbatim string, please use language version '{0}' or greater.</source> <target state="translated">Per usare '@$' invece di '$@' per una stringa verbatim interpolata, usare la versione '{0}' o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigBinaryOpsOnDefault"> <source>Operator '{0}' is ambiguous on operands '{1}' and '{2}'</source> <target state="translated">L'operatore '{0}' è ambiguo sugli operandi '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigBinaryOpsOnUnconstrainedDefault"> <source>Operator '{0}' cannot be applied to 'default' and operand of type '{1}' because it is a type parameter that is not known to be a reference type</source> <target state="translated">Non è possibile applicare l'operatore '{0}' a 'default ' e all'operando di tipo '{1}' perché è un parametro di tipo non noto come tipo riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_AnnotationDisallowedInObjectCreation"> <source>Cannot use a nullable reference type in object creation.</source> <target state="translated">Non è possibile usare un tipo riferimento nullable durante la creazione di oggetti.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNameInITuplePattern"> <source>Element names are not permitted when pattern-matching via 'System.Runtime.CompilerServices.ITuple'.</source> <target state="translated">I nomi di elemento non sono consentiti quando si definiscono criteri di ricerca tramite 'System.Runtime.CompilerServices.ITuple'.</target> <note /> </trans-unit> <trans-unit id="ERR_AsNullableType"> <source>It is not legal to use nullable reference type '{0}?' in an as expression; use the underlying type '{0}' instead.</source> <target state="translated">Non è consentito usare il tipo riferimento nullable '{0}?' in un'espressione as. Usare il tipo sottostante '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AssignmentInitOnly"> <source>Init-only property or indexer '{0}' can only be assigned in an object initializer, or on 'this' or 'base' in an instance constructor or an 'init' accessor.</source> <target state="translated">L'indicizzatore o la proprietà di sola inizializzazione '{0}' può essere assegnata solo in un inizializzatore di oggetto oppure in 'this' o 'base' in un costruttore di istanza o una funzione di accesso 'init'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrDependentTypeNotAllowed"> <source>Type '{0}' cannot be used in this context because it cannot be represented in metadata.</source> <target state="new">Type '{0}' cannot be used in this context because it cannot be represented in metadata.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrTypeArgCannotBeTypeVar"> <source>'{0}': an attribute type argument cannot use type parameters</source> <target state="new">'{0}': an attribute type argument cannot use type parameters</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeNotOnEventAccessor"> <source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source> <target state="translated">L'attributo '{0}' non è valido nelle funzioni di accesso a eventi. È valido solo nelle dichiarazioni di '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributesRequireParenthesizedLambdaExpression"> <source>Attributes on lambda expressions require a parenthesized parameter list.</source> <target state="new">Attributes on lambda expressions require a parenthesized parameter list.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyWithSetterCantBeReadOnly"> <source>Auto-implemented property '{0}' cannot be marked 'readonly' because it has a 'set' accessor.</source> <target state="translated">La proprietà implementata automaticamente '{0}' non può essere contrassegnata come 'readonly' perché include una funzione di accesso 'set'.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoSetterCantBeReadOnly"> <source>Auto-implemented 'set' accessor '{0}' cannot be marked 'readonly'.</source> <target state="translated">La funzione di accesso 'set' '{0}' implementata automaticamente non può essere contrassegnata come 'readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_AwaitForEachMissingMember"> <source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance or extension definition for '{1}'</source> <target state="translated">L'istruzione foreach asincrona non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica idonea per '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AwaitForEachMissingMemberWrongAsync"> <source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'. Did you mean 'foreach' rather than 'await foreach'?</source> <target state="translated">L'istruzione foreach asincrona non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica per '{1}'. Si intendeva 'foreach' invece di 'await foreach'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractBinaryOperatorSignature"> <source>One of the parameters of a binary operator must be the containing type, or its type parameter constrained to it.</source> <target state="new">One of the parameters of a binary operator must be the containing type, or its type parameter constrained to it.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractIncDecRetType"> <source>The return type for ++ or -- operator must either match the parameter type, or be derived from the parameter type, or be the containing type's type parameter constrained to it unless the parameter type is a different type parameter.</source> <target state="new">The return type for ++ or -- operator must either match the parameter type, or be derived from the parameter type, or be the containing type's type parameter constrained to it unless the parameter type is a different type parameter.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractIncDecSignature"> <source>The parameter type for ++ or -- operator must be the containing type, or its type parameter constrained to it.</source> <target state="new">The parameter type for ++ or -- operator must be the containing type, or its type parameter constrained to it.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractShiftOperatorSignature"> <source>The first operand of an overloaded shift operator must have the same type as the containing type or its type parameter constrained to it, and the type of the second operand must be int</source> <target state="new">The first operand of an overloaded shift operator must have the same type as the containing type or its type parameter constrained to it, and the type of the second operand must be int</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractStaticMemberAccess"> <source>A static abstract interface member can be accessed only on a type parameter.</source> <target state="new">A static abstract interface member can be accessed only on a type parameter.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractUnaryOperatorSignature"> <source>The parameter of a unary operator must be the containing type, or its type parameter constrained to it.</source> <target state="new">The parameter of a unary operator must be the containing type, or its type parameter constrained to it.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerArgumentExpressionParamWithoutDefaultValue"> <source>The CallerArgumentExpressionAttribute may only be applied to parameters with default values</source> <target state="new">The CallerArgumentExpressionAttribute may only be applied to parameters with default values</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicAwaitForEach"> <source>Cannot use a collection of dynamic type in an asynchronous foreach</source> <target state="translated">Non è possibile usare una raccolta di tipo dinamico in un'istruzione foreach asincrona</target> <note /> </trans-unit> <trans-unit id="ERR_BadFieldTypeInRecord"> <source>The type '{0}' may not be used for a field of a record.</source> <target state="translated">Il tipo '{0}' non può essere usato per un campo di un record.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFuncPointerArgCount"> <source>Function pointer '{0}' does not take {1} arguments</source> <target state="translated">Il puntatore a funzione '{0}' non accetta {1} argomenti</target> <note /> </trans-unit> <trans-unit id="ERR_BadFuncPointerParamModifier"> <source>'{0}' cannot be used as a modifier on a function pointer parameter.</source> <target state="translated">Non è possibile usare '{0}' come modificatore in un parametro di puntatore a funzione.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInheritanceFromRecord"> <source>Only records may inherit from records.</source> <target state="translated">Solo i record possono ereditare dai record.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInitAccessor"> <source>The 'init' accessor is not valid on static members</source> <target state="translated">La funzione di accesso 'init' non è valida nei membri statici</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullableContextOption"> <source>Invalid option '{0}' for /nullable; must be 'disable', 'enable', 'warnings' or 'annotations'</source> <target state="translated">L'opzione '{0}' non è valida per /nullable. Deve essere 'disable', 'enable', 'warnings' o 'annotations'</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullableTypeof"> <source>The typeof operator cannot be used on a nullable reference type</source> <target state="translated">Non è possibile usare l'operatore typeof nel tipo riferimento nullable</target> <note /> </trans-unit> <trans-unit id="ERR_BadOpOnNullOrDefaultOrNew"> <source>Operator '{0}' cannot be applied to operand '{1}'</source> <target state="translated">Non è possibile applicare l'operatore '{0}' all'operando '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadPatternExpression"> <source>Invalid operand for pattern match; value required, but found '{0}'.</source> <target state="translated">L'operando non è valido per i criteri di ricerca. È richiesto un valore ma è stato trovato '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordBase"> <source>Records may only inherit from object or another record</source> <target state="translated">I record possono ereditare solo dall'oggetto o da un altro record</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordMemberForPositionalParameter"> <source>Record member '{0}' must be a readable instance property or field of type '{1}' to match positional parameter '{2}'.</source> <target state="needs-review-translation">Il membro di record '{0}' deve essere una proprietà di istanza leggibile di tipo '{1}' per corrispondere al parametro posizionale '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitchValue"> <source>Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'.</source> <target state="translated">Errore di sintassi della riga di comando: '{0}' non è un valore valido per l'opzione '{1}'. Il valore deve essere espresso nel formato '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BuilderAttributeDisallowed"> <source>The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.</source> <target state="new">The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotClone"> <source>The receiver type '{0}' is not a valid record type and is not a struct type.</source> <target state="new">The receiver type '{0}' is not a valid record type and is not a struct type.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotConvertAddressOfToDelegate"> <source>Cannot convert &amp;method group '{0}' to delegate type '{0}'.</source> <target state="translated">Non è possibile convertire il gruppo di &amp;metodi '{0}' nel tipo delegato '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotInferDelegateType"> <source>The delegate type could not be inferred.</source> <target state="new">The delegate type could not be inferred.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotSpecifyManagedWithUnmanagedSpecifiers"> <source>'managed' calling convention cannot be combined with unmanaged calling convention specifiers.</source> <target state="translated">Non è possibile combinare la convenzione di chiamata 'managed' con identificatori di convenzione di chiamata non gestita.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseFunctionPointerAsFixedLocal"> <source>The type of a local declared in a fixed statement cannot be a function pointer type.</source> <target state="translated">Il tipo di una variabile locale dichiarata in un'istruzione fixed non può essere un tipo di puntatore a funzione.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseManagedTypeInUnmanagedCallersOnly"> <source>Cannot use '{0}' as a {1} type on a method attributed with 'UnmanagedCallersOnly'.</source> <target state="translated">Non è possibile usare '{0}' come tipo {1} in un metodo con attributo 'UnmanagedCallersOnly'.</target> <note>1 is the localized word for 'parameter' or 'return'. UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_CannotUseReducedExtensionMethodInAddressOf"> <source>Cannot use an extension method with a receiver as the target of a '&amp;' operator.</source> <target state="translated">Non è possibile usare un metodo di estensione con un ricevitore come destinazione di un operatore '&amp;'.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseSelfAsInterpolatedStringHandlerArgument"> <source>InterpolatedStringHandlerArgumentAttribute arguments cannot refer to the parameter the attribute is used on.</source> <target state="new">InterpolatedStringHandlerArgumentAttribute arguments cannot refer to the parameter the attribute is used on.</target> <note>InterpolatedStringHandlerArgumentAttribute is a type name and should not be translated.</note> </trans-unit> <trans-unit id="ERR_CantChangeInitOnlyOnOverride"> <source>'{0}' must match by init-only of overridden member '{1}'</source> <target state="translated">'{0}' deve corrispondere per sola inizializzazione del membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethReturnType"> <source>Cannot convert {0} to type '{1}' because the return type does not match the delegate return type</source> <target state="new">Cannot convert {0} to type '{1}' because the return type does not match the delegate return type</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseInOrOutInArglist"> <source>__arglist cannot have an argument passed by 'in' or 'out'</source> <target state="translated">__arglist non può contenere un argomento passato da 'in' o 'out'</target> <note /> </trans-unit> <trans-unit id="ERR_CloneDisallowedInRecord"> <source>Members named 'Clone' are disallowed in records.</source> <target state="translated">Nei record non sono consentiti membri denominati 'Clone'.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberNotStatic"> <source>'{0}' does not implement static interface member '{1}'. '{2}' cannot implement the interface member because it is not static.</source> <target state="new">'{0}' does not implement static interface member '{1}'. '{2}' cannot implement the interface member because it is not static.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberWrongInitOnly"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}'.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConWithUnmanagedCon"> <source>Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}'</source> <target state="translated">Il parametro di tipo '{1}' ha il vincolo 'managed'. Non è quindi possibile usare '{1}' come vincolo per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnLocalFunction"> <source>Local function '{0}' must be 'static' in order to use the Conditional attribute</source> <target state="translated">Per usare l'attributo Conditional, la funzione locale '{0}' deve essere 'static'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantPatternVsOpenType"> <source>An expression of type '{0}' cannot be handled by a pattern of type '{1}'. Please use language version '{2}' or greater to match an open type with a constant pattern.</source> <target state="translated">Un'espressione di tipo '{0}' non può essere gestita da un criterio di tipo '{1}'. Usare la versione '{2}' o versioni successive del linguaggio per abbinare un tipo aperto a un criterio costante.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyConstructorMustInvokeBaseCopyConstructor"> <source>A copy constructor in a record must call a copy constructor of the base, or a parameterless object constructor if the record inherits from object.</source> <target state="translated">Un costruttore di copia in un record deve chiamare un costruttore di copia della base o un costruttore di oggetto senza parametri se il record eredita dall'oggetto.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyConstructorWrongAccessibility"> <source>A copy constructor '{0}' must be public or protected because the record is not sealed.</source> <target state="translated">Un costruttore di copia '{0}' deve essere pubblico o protetto perché il record non è sealed.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructParameterNameMismatch"> <source>The name '{0}' does not match the corresponding 'Deconstruct' parameter '{1}'.</source> <target state="translated">Il nome '{0}' non corrisponde al parametro '{1}' di 'Deconstruct' corrispondente.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultConstraintOverrideOnly"> <source>The 'default' constraint is valid on override and explicit interface implementation methods only.</source> <target state="translated">Il vincolo 'default' è valido solo in metodi di override e di implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultInterfaceImplementationInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché contiene un membro non astratto. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultLiteralNoTargetType"> <source>There is no target type for the default literal.</source> <target state="translated">Non esiste alcun tipo di destinazione per il valore letterale predefinito.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPattern"> <source>A default literal 'default' is not valid as a pattern. Use another literal (e.g. '0' or 'null') as appropriate. To match everything, use a discard pattern '_'.</source> <target state="translated">Non è possibile usare un valore letterale predefinito 'default' come criterio. Usare un altro valore letterale, ad esempio '0' o 'null'. Per abbinare tutto, usare un criterio di rimozione '_'.</target> <note /> </trans-unit> <trans-unit id="ERR_DesignatorBeneathPatternCombinator"> <source>A variable may not be declared within a 'not' or 'or' pattern.</source> <target state="translated">Non è possibile dichiarare una variabile all'interno di un criterio 'not' o 'or'.</target> <note /> </trans-unit> <trans-unit id="ERR_DiscardPatternInSwitchStatement"> <source>The discard pattern is not permitted as a case label in a switch statement. Use 'case var _:' for a discard pattern, or 'case @_:' for a constant named '_'.</source> <target state="translated">Il criterio di rimozione non è consentito come etichetta case in un'istruzione switch. Usare 'case var _:' per un criterio di rimozione oppure 'case @_:' per una costante denominata '_'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesNotOverrideBaseEqualityContract"> <source>'{0}' does not override expected property from '{1}'.</source> <target state="translated">'{0}' non esegue l'override della proprietà prevista da '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesNotOverrideBaseMethod"> <source>'{0}' does not override expected method from '{1}'.</source> <target state="translated">'{0}' non esegue l'override del metodo previsto da '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesNotOverrideMethodFromObject"> <source>'{0}' does not override expected method from 'object'.</source> <target state="translated">'{0}' non esegue l'override del metodo previsto da 'object'.</target> <note /> </trans-unit> <trans-unit id="ERR_DupReturnTypeMod"> <source>A return type can only have one '{0}' modifier.</source> <target state="translated">Un tipo restituito può avere un solo modificatore '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateExplicitImpl"> <source>'{0}' is explicitly implemented more than once.</source> <target state="translated">'{0}' è implementato più di una volta in modo esplicito.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInterfaceWithDifferencesInBaseList"> <source>'{0}' is already listed in the interface list on type '{2}' as '{1}'.</source> <target state="translated">'{0}' è già incluso nell'elenco di interfacce nel tipo '{2}' come '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNullSuppression"> <source>Duplicate null suppression operator ('!')</source> <target state="translated">Operatore di eliminazione Null duplicato ('!')</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyReadOnlyMods"> <source>Cannot specify 'readonly' modifiers on both accessors of property or indexer '{0}'. Instead, put a 'readonly' modifier on the property itself.</source> <target state="translated">Non è possibile specificare i modificatori 'readonly' in entrambe le funzioni di accesso della proprietà o dell'indicizzatore '{0}'. Inserire invece un modificatore 'readonly' nella proprietà stessa.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseCannotStartStatement"> <source>'else' cannot start a statement.</source> <target state="translated">Un'istruzione non può iniziare con 'else'.</target> <note /> </trans-unit> <trans-unit id="ERR_EntryPointCannotBeUnmanagedCallersOnly"> <source>Application entry points cannot be attributed with 'UnmanagedCallersOnly'.</source> <target state="translated">Non è possibile aggiungere ai punti di ingresso dell'applicazione l'attributo 'UnmanagedCallersOnly'.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_EqualityContractRequiresGetter"> <source>Record equality contract property '{0}' must have a get accessor.</source> <target state="translated">La proprietà '{0}' del contratto di uguaglianza record deve contenere una funzione di accesso get.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitImplementationOfOperatorsMustBeStatic"> <source>Explicit implementation of a user-defined operator '{0}' must be declared static</source> <target state="new">Explicit implementation of a user-defined operator '{0}' must be declared static</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitNullableAttribute"> <source>Explicit application of 'System.Runtime.CompilerServices.NullableAttribute' is not allowed.</source> <target state="translated">L'applicazione esplicita di 'System.Runtime.CompilerServices.NullableAttribute' non è consentita.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitPropertyMismatchInitOnly"> <source>Accessors '{0}' and '{1}' should both be init-only or neither</source> <target state="translated">Il tipo di sola inizializzazione può essere specificato per entrambe le funzioni di accesso '{0}' e '{1}' o per nessuna di esse</target> <note /> </trans-unit> <trans-unit id="ERR_ExprCannotBeFixed"> <source>The given expression cannot be used in a fixed statement</source> <target state="translated">Non è possibile usare l'espressione specificata in un'istruzione fixed</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeCantContainNullCoalescingAssignment"> <source>An expression tree may not contain a null coalescing assignment</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione Null di coalescenza</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeCantContainRefStruct"> <source>Expression tree cannot contain value of ref struct or restricted type '{0}'.</source> <target state="translated">L'albero delle espressioni non può contenere il valore '{0}' per lo struct ref o il tipo limitato.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsAbstractStaticMemberAccess"> <source>An expression tree may not contain an access of static abstract interface member</source> <target state="new">An expression tree may not contain an access of static abstract interface member</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression"> <source>An expression tree may not contain a from-end index ('^') expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione di indice from end ('^').</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsInterpolatedStringHandlerConversion"> <source>An expression tree may not contain an interpolated string handler conversion.</source> <target state="new">An expression tree may not contain an interpolated string handler conversion.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer"> <source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source> <target state="translated">Un albero delle espressioni non può contenere un accesso a indicizzatore System.Index o System.Range di criterio</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsRangeExpression"> <source>An expression tree may not contain a range ('..') expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione ('..').</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsSwitchExpression"> <source>An expression tree may not contain a switch expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione switch.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsTupleBinOp"> <source>An expression tree may not contain a tuple == or != operator</source> <target state="translated">Un albero delle espressioni non può contenere un operatore == o != di tupla</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsWithExpression"> <source>An expression tree may not contain a with-expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione with.</target> <note /> </trans-unit> <trans-unit id="ERR_ExternEventInitializer"> <source>'{0}': extern event cannot have initializer</source> <target state="translated">'{0}': l'evento extern non può avere inizializzatori</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureInPreview"> <source>The feature '{0}' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.</source> <target state="translated">La funzionalità '{0}' è attualmente disponibile in anteprima e *non è supportata*. Per usare funzionalità in anteprima, scegliere la versione del linguaggio 'preview'.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureIsExperimental"> <source>Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable.</source> <target state="translated">La funzionalità '{0}' è sperimentale e non è supportata. Per abilitare, usare '/features:{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion10"> <source>Feature '{0}' is not available in C# 10.0. Please use language version {1} or greater.</source> <target state="new">Feature '{0}' is not available in C# 10.0. Please use language version {1} or greater.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion8"> <source>Feature '{0}' is not available in C# 8.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 8.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion8_0"> <source>Feature '{0}' is not available in C# 8.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 8.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion9"> <source>Feature '{0}' is not available in C# 9.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 9.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldLikeEventCantBeReadOnly"> <source>Field-like event '{0}' cannot be 'readonly'.</source> <target state="translated">L'evento simile a campo '{0}' non può essere 'readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_FileScopedAndNormalNamespace"> <source>Source file can not contain both file-scoped and normal namespace declarations.</source> <target state="new">Source file can not contain both file-scoped and normal namespace declarations.</target> <note /> </trans-unit> <trans-unit id="ERR_FileScopedNamespaceNotBeforeAllMembers"> <source>File-scoped namespace must precede all other members in a file.</source> <target state="new">File-scoped namespace must precede all other members in a file.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachMissingMemberWrongAsync"> <source>foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'. Did you mean 'await foreach' rather than 'foreach'?</source> <target state="translated">L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica per '{1}'. Si intendeva 'await foreach' invece di 'foreach'?</target> <note /> </trans-unit> <trans-unit id="ERR_FuncPtrMethMustBeStatic"> <source>Cannot create a function pointer for '{0}' because it is not a static method</source> <target state="translated">Non è possibile creare un puntatore a funzione per '{0}' perché non è un metodo statico</target> <note /> </trans-unit> <trans-unit id="ERR_FuncPtrRefMismatch"> <source>Ref mismatch between '{0}' and function pointer '{1}'</source> <target state="translated">Modificatore di riferimento non corrispondente tra '{0}' e il puntatore a funzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionPointerTypesInAttributeNotSupported"> <source>Using a function pointer type in a 'typeof' in an attribute is not supported.</source> <target state="needs-review-translation">L'uso di un tipo di puntatore a funzione in un elemento 'typeof' di un attributo non è supportato.</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionPointersCannotBeCalledWithNamedArguments"> <source>A function pointer cannot be called with named arguments.</source> <target state="translated">Non è possibile chiamare un puntatore a funzione con argomenti denominati.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers"> <source>The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract members.</source> <target state="new">The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract members.</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalUsingInNamespace"> <source>A global using directive cannot be used in a namespace declaration.</source> <target state="new">A global using directive cannot be used in a namespace declaration.</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalUsingOutOfOrder"> <source>A global using directive must precede all non-global using directives.</source> <target state="new">A global using directive must precede all non-global using directives.</target> <note /> </trans-unit> <trans-unit id="ERR_GoToBackwardJumpOverUsingVar"> <source>A goto cannot jump to a location before a using declaration within the same block.</source> <target state="translated">Un'istruzione goto non può passare a una posizione che precede una dichiarazione using all'interno dello stesso blocco.</target> <note /> </trans-unit> <trans-unit id="ERR_GoToForwardJumpOverUsingVar"> <source>A goto cannot jump to a location after a using declaration.</source> <target state="translated">Un'istruzione goto non può passare a una posizione successiva a una dichiarazione using.</target> <note /> </trans-unit> <trans-unit id="ERR_HiddenPositionalMember"> <source>The positional member '{0}' found corresponding to this parameter is hidden.</source> <target state="translated">Il membro posizionale '{0}' trovato e corrispondente a questo parametro è nascosto.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalSuppression"> <source>The suppression operator is not allowed in this context</source> <target state="translated">L'operatore di eliminazione non è consentito in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitIndexIndexerWithName"> <source>Invocation of implicit Index Indexer cannot name the argument.</source> <target state="translated">La chiamata dell'indicizzatore di indice implicito non può assegnare un nome all'argomento.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitObjectCreationIllegalTargetType"> <source>The type '{0}' may not be used as the target type of new()</source> <target state="translated">Non è possibile usare il tipo '{0}' come tipo di destinazione di new()</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitObjectCreationNoTargetType"> <source>There is no target type for '{0}'</source> <target state="translated">Non esiste alcun tipo di destinazione per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitObjectCreationNotValid"> <source>Use of new() is not valid in this context</source> <target state="translated">Non è possibile usare new() in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitRangeIndexerWithName"> <source>Invocation of implicit Range Indexer cannot name the argument.</source> <target state="translated">La chiamata dell'indicizzatore di intervallo implicito non può assegnare un nome all'argomento.</target> <note /> </trans-unit> <trans-unit id="ERR_InDynamicMethodArg"> <source>Arguments with 'in' modifier cannot be used in dynamically dispatched expressions.</source> <target state="translated">Non è possibile usare argomenti con il modificatore 'in' nelle espressioni inviate in modo dinamico.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritingFromRecordWithSealedToString"> <source>Inheriting from a record with a sealed 'Object.ToString' is not supported in C# {0}. Please use language version '{1}' or greater.</source> <target state="translated">L'ereditarietà da un record con un 'Object.ToString' di tipo sealed non è supportata in C# {0}. Usare la versione '{1}' o successiva del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_InitCannotBeReadonly"> <source>'init' accessors cannot be marked 'readonly'. Mark '{0}' readonly instead.</source> <target state="translated">Non è possibile contrassegnare le funzioni di accesso 'init' come 'readonly'. Contrassegnare '{0}' come readonly.</target> <note /> </trans-unit> <trans-unit id="ERR_InstancePropertyInitializerInInterface"> <source>Instance properties in interfaces cannot have initializers.</source> <target state="translated">Le proprietà di istanza nelle interfacce non possono avere inizializzatori.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedByUnmanagedCallersOnlyMethod"> <source>'UnmanagedCallersOnly' method '{0}' cannot implement interface member '{1}' in type '{2}'</source> <target state="new">'UnmanagedCallersOnly' method '{0}' cannot implement interface member '{1}' in type '{2}'</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_InterfaceImplementedImplicitlyByVariadic"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter</source> <target state="translated">'{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}' perché contiene un parametro __arglist</target> <note /> </trans-unit> <trans-unit id="ERR_InternalError"> <source>Internal error in the C# compiler.</source> <target state="translated">Si è verificato un errore interno nel compilatore C#.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerArgumentAttributeMalformed"> <source>The InterpolatedStringHandlerArgumentAttribute applied to parameter '{0}' is malformed and cannot be interpreted. Construct an instance of '{1}' manually.</source> <target state="new">The InterpolatedStringHandlerArgumentAttribute applied to parameter '{0}' is malformed and cannot be interpreted. Construct an instance of '{1}' manually.</target> <note>InterpolatedStringHandlerArgumentAttribute is a type name and should not be translated.</note> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerArgumentLocatedAfterInterpolatedString"> <source>Parameter '{0}' is an argument to the interpolated string handler conversion on parameter '{1}', but the corresponding argument is specified after the interpolated string expression. Reorder the arguments to move '{0}' before '{1}'.</source> <target state="new">Parameter '{0}' is an argument to the interpolated string handler conversion on parameter '{1}', but the corresponding argument is specified after the interpolated string expression. Reorder the arguments to move '{0}' before '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerArgumentOptionalNotSpecified"> <source>Parameter '{0}' is not explicitly provided, but is used as an argument to the interpolated string handler conversion on parameter '{1}'. Specify the value of '{0}' before '{1}'.</source> <target state="new">Parameter '{0}' is not explicitly provided, but is used as an argument to the interpolated string handler conversion on parameter '{1}'. Specify the value of '{0}' before '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerCreationCannotUseDynamic"> <source>An interpolated string handler construction cannot use dynamic. Manually construct an instance of '{0}'.</source> <target state="new">An interpolated string handler construction cannot use dynamic. Manually construct an instance of '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerMethodReturnInconsistent"> <source>Interpolated string handler method '{0}' has inconsistent return type. Expected to return '{1}'.</source> <target state="new">Interpolated string handler method '{0}' has inconsistent return type. Expected to return '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerMethodReturnMalformed"> <source>Interpolated string handler method '{0}' is malformed. It does not return 'void' or 'bool'.</source> <target state="new">Interpolated string handler method '{0}' is malformed. It does not return 'void' or 'bool'.</target> <note>void and bool are keywords</note> </trans-unit> <trans-unit id="ERR_InvalidFuncPointerReturnTypeModifier"> <source>'{0}' is not a valid function pointer return type modifier. Valid modifiers are 'ref' and 'ref readonly'.</source> <target state="translated">'{0}' non è un modificatore di tipo restituito di puntatore a funzione valido. I modificatori validi sono 'ref' e 'ref readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFunctionPointerCallingConvention"> <source>'{0}' is not a valid calling convention specifier for a function pointer.</source> <target state="translated">'{0}' non è un identificatore di convenzione di chiamata valido per un puntatore a funzione.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHashAlgorithmName"> <source>Invalid hash algorithm name: '{0}'</source> <target state="translated">Il nome dell'algoritmo hash non è valido: '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInterpolatedStringHandlerArgumentName"> <source>'{0}' is not a valid parameter name from '{1}'.</source> <target state="new">'{0}' is not a valid parameter name from '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidModifierForLanguageVersion"> <source>The modifier '{0}' is not valid for this item in C# {1}. Please use language version '{2}' or greater.</source> <target state="translated">Il modificatore '{0}' non è valido per questo elemento in C# {1}. Usare la versione '{2}' o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNameInSubpattern"> <source>Identifier or a simple member access expected.</source> <target state="new">Identifier or a simple member access expected.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidObjectCreation"> <source>Invalid object creation</source> <target state="translated">Creazione oggetto non valida</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPropertyReadOnlyMods"> <source>Cannot specify 'readonly' modifiers on both property or indexer '{0}' and its accessor. Remove one of them.</source> <target state="translated">Non è possibile specificare i modificatori 'readonly' nella proprietà o nell'indicizzatore '{0}' e nella relativa funzione di accesso. Rimuoverne uno.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidStackAllocArray"> <source>"Invalid rank specifier: expected ']'</source> <target state="translated">"L'identificatore del numero di dimensioni non è valido: è previsto ']'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUnmanagedCallersOnlyCallConv"> <source>'{0}' is not a valid calling convention type for 'UnmanagedCallersOnly'.</source> <target state="translated">'{0}' non è un tipo di convenzione di chiamata valido per 'UnmanagedCallersOnly'.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_InvalidWithReceiverType"> <source>The receiver of a `with` expression must have a non-void type.</source> <target state="translated">Il ricevitore di un'espressione `with` deve avere un tipo non void.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNullableType"> <source>It is not legal to use nullable reference type '{0}?' in an is-type expression; use the underlying type '{0}' instead.</source> <target state="translated">Non è consentito usare il tipo riferimento nullable '{0}?' in un'espressione is-type. Usare il tipo sottostante '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsPatternImpossible"> <source>An expression of type '{0}' can never match the provided pattern.</source> <target state="translated">Un'espressione di tipo '{0}' non può mai corrispondere al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="ERR_IteratorMustBeAsync"> <source>Method '{0}' with an iterator block must be 'async' to return '{1}'</source> <target state="translated">Il metodo '{0}' con un blocco iteratore deve essere 'async' per restituire '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_LineSpanDirectiveEndLessThanStart"> <source>The #line directive end position must be greater than or equal to the start position</source> <target state="new">The #line directive end position must be greater than or equal to the start position</target> <note /> </trans-unit> <trans-unit id="ERR_LineSpanDirectiveInvalidValue"> <source>The #line directive value is missing or out of range</source> <target state="new">The #line directive value is missing or out of range</target> <note /> </trans-unit> <trans-unit id="ERR_MethFuncPtrMismatch"> <source>No overload for '{0}' matches function pointer '{1}'</source> <target state="translated">Nessun overload per '{0}' corrisponde al puntatore a funzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingAddressOf"> <source>Cannot convert method group to function pointer (Are you missing a '&amp;'?)</source> <target state="translated">Non è possibile convertire il gruppo di metodi nel puntatore a funzione. Manca un operatore '&amp;'?</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPattern"> <source>Pattern missing</source> <target state="translated">Criterio mancante</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerCannotBeUnmanagedCallersOnly"> <source>Module initializer cannot be attributed with 'UnmanagedCallersOnly'.</source> <target state="translated">Non è possibile aggiungere all'inizializzatore di modulo l'attributo 'UnmanagedCallersOnly'.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric"> <source>Module initializer method '{0}' must not be generic and must not be contained in a generic type</source> <target state="translated">Il metodo '{0}' dell'inizializzatore di modulo non deve essere generico e non deve essere contenuto in un tipo generico</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodMustBeAccessibleOutsideTopLevelType"> <source>Module initializer method '{0}' must be accessible at the module level</source> <target state="translated">Il metodo '{0}' dell'inizializzatore di modulo deve essere accessibile a livello di modulo</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodMustBeOrdinary"> <source>A module initializer must be an ordinary member method</source> <target state="translated">Un inizializzatore di modulo deve essere un metodo membro normale</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodMustBeStaticParameterlessVoid"> <source>Module initializer method '{0}' must be static, must have no parameters, and must return 'void'</source> <target state="translated">Il metodo '{0}' dell'inizializzatore di modulo deve essere statico, non deve contenere parametri e deve restituire 'void'</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleAnalyzerConfigsInSameDir"> <source>Multiple analyzer config files cannot be in the same directory ('{0}').</source> <target state="translated">La stessa directory ('{0}') non può contenere più file di configurazione dell'analizzatore.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEnumeratorCancellationAttributes"> <source>The attribute [EnumeratorCancellation] cannot be used on multiple parameters</source> <target state="translated">Non è possibile usare l'attributo [EnumeratorCancellation] in più parametri</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleFileScopedNamespace"> <source>Source file can only contain one file-scoped namespace declaration.</source> <target state="new">Source file can only contain one file-scoped namespace declaration.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleRecordParameterLists"> <source>Only a single record partial declaration may have a parameter list</source> <target state="translated">Solo una dichiarazione parziale di singolo record può includere un elenco di parametri</target> <note /> </trans-unit> <trans-unit id="ERR_NewBoundWithUnmanaged"> <source>The 'new()' constraint cannot be used with the 'unmanaged' constraint</source> <target state="translated">Non è possibile usare il vincolo 'new()' con il vincolo 'unmanaged'</target> <note /> </trans-unit> <trans-unit id="ERR_NewlinesAreNotAllowedInsideANonVerbatimInterpolatedString"> <source>Newlines are not allowed inside a non-verbatim interpolated string</source> <target state="new">Newlines are not allowed inside a non-verbatim interpolated string</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIAsyncDispWrongAsync"> <source>'{0}': type used in an asynchronous using statement must be implicitly convertible to 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method. Did you mean 'using' rather than 'await using'?</source> <target state="translated">'{0}': il tipo usato in un'istruzione using asincrona deve essere convertibile in modo implicito in 'System.IAsyncDisposable' o implementare un metodo 'DisposeAsync' adatto. Si intendeva 'using' invece di 'await using'?</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIDispWrongAsync"> <source>'{0}': type used in a using statement must be implicitly convertible to 'System.IDisposable'. Did you mean 'await using' rather than 'using'?</source> <target state="translated">'{0}': il tipo usato in un'istruzione using deve essere convertibile in modo implicito in 'System.IDisposable'. Si intendeva 'await using' invece di 'using'?</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerArgumentExpressionParam"> <source>CallerArgumentExpressionAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="new">CallerArgumentExpressionAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoCopyConstructorInBaseType"> <source>No accessible copy constructor found in base type '{0}'.</source> <target state="translated">Non è stato trovato alcun costruttore di copia accessibile nel tipo di base '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoImplicitConvTargetTypedConditional"> <source>Conditional expression is not valid in language version {0} because a common type was not found between '{1}' and '{2}'. To use a target-typed conversion, upgrade to language version {3} or greater.</source> <target state="new">Conditional expression is not valid in language version {0} because a common type was not found between '{1}' and '{2}'. To use a target-typed conversion, upgrade to language version {3} or greater.</target> <note /> </trans-unit> <trans-unit id="ERR_NoOutputDirectory"> <source>Output directory could not be determined</source> <target state="translated">Non è stato possibile individuare la directory di output</target> <note /> </trans-unit> <trans-unit id="ERR_NonPrivateAPIInRecord"> <source>Record member '{0}' must be private.</source> <target state="translated">Il membro del record '{0}' deve essere privato.</target> <note /> </trans-unit> <trans-unit id="ERR_NonProtectedAPIInRecord"> <source>Record member '{0}' must be protected.</source> <target state="translated">Il membro del record '{0}' deve essere protetto.</target> <note /> </trans-unit> <trans-unit id="ERR_NonPublicAPIInRecord"> <source>Record member '{0}' must be public.</source> <target state="translated">Il membro del record '{0}' deve essere pubblico.</target> <note /> </trans-unit> <trans-unit id="ERR_NonPublicParameterlessStructConstructor"> <source>The parameterless struct constructor must be 'public'.</source> <target state="new">The parameterless struct constructor must be 'public'.</target> <note /> </trans-unit> <trans-unit id="ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName"> <source>'{0}' is not an instance method, the receiver cannot be an interpolated string handler argument.</source> <target state="new">'{0}' is not an instance method, the receiver cannot be an interpolated string handler argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NotOverridableAPIInRecord"> <source>'{0}' must allow overriding because the containing record is not sealed.</source> <target state="translated">'{0}' deve consentire l'override perché il record contenitore non è sealed.</target> <note /> </trans-unit> <trans-unit id="ERR_NullInvalidInterpolatedStringHandlerArgumentName"> <source>null is not a valid parameter name. To get access to the receiver of an instance method, use the empty string as the parameter name.</source> <target state="new">null is not a valid parameter name. To get access to the receiver of an instance method, use the empty string as the parameter name.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDirectiveQualifierExpected"> <source>Expected 'enable', 'disable', or 'restore'</source> <target state="translated">È previsto 'enable', 'disable' o 'restore'</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDirectiveTargetExpected"> <source>Expected 'warnings', 'annotations', or end of directive</source> <target state="translated">È previsto 'warnings', 'annotations' o la fine della direttiva</target> <note /> </trans-unit> <trans-unit id="ERR_NullableOptionNotAvailable"> <source>Invalid '{0}' value: '{1}' for C# {2}. Please use language version '{3}' or greater.</source> <target state="translated">Valore '{1}' di '{0}' non valido per C# {2}. Usare la versione {3} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableUnconstrainedTypeParameter"> <source>A nullable type parameter must be known to be a value type or non-nullable reference type unless language version '{0}' or greater is used. Consider changing the language version or adding a 'class', 'struct', or type constraint.</source> <target state="translated">Un parametro di tipo nullable deve essere noto per essere un tipo valore o un tipo riferimento non nullable, a meno che non venga usata la versione '{0}' o successiva del linguaggio. Provare a cambiare la versione del linguaggio o ad aggiungere un vincolo di tipo, 'class' o 'struct'.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedTypeArgument"> <source>Omitting the type argument is not allowed in the current context</source> <target state="translated">Nel contesto corrente non è possibile omettere l'argomento tipo</target> <note /> </trans-unit> <trans-unit id="ERR_OutVariableCannotBeByRef"> <source>An out variable cannot be declared as a ref local</source> <target state="translated">Non è possibile dichiarare una variabile out come variabile locale ref</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideDefaultConstraintNotSatisfied"> <source>Method '{0}' specifies a 'default' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is constrained to a reference type or a value type.</source> <target state="translated">Il metodo '{0}' specifica un vincolo 'default' per il parametro di tipo '{1}', ma il parametro di tipo corrispondente '{2}' del metodo '{3}' sottoposto a override o implementato in modo esplicito è vincolato a un tipo riferimento a un tipo valore.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideRefConstraintNotSatisfied"> <source>Method '{0}' specifies a 'class' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is not a reference type.</source> <target state="translated">Il metodo '{0}' specifica un vincolo 'class' per il parametro di tipo '{1}', ma il parametro di tipo corrispondente '{2}' del metodo '{3}' sottoposto a override o implementato in modo esplicito non è un tipo riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideValConstraintNotSatisfied"> <source>Method '{0}' specifies a 'struct' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is not a non-nullable value type.</source> <target state="translated">Il metodo '{0}' specifica un vincolo 'struct' per il parametro di tipo '{1}', ma il parametro di tipo corrispondente '{2}' del metodo '{3}' sottoposto a override o implementato in modo esplicito non è un tipo valore che non ammette valori Null.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodAccessibilityDifference"> <source>Both partial method declarations must have identical accessibility modifiers.</source> <target state="translated">I modificatori di accessibilità devono essere identici in entrambe le dichiarazioni di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodExtendedModDifference"> <source>Both partial method declarations must have identical combinations of 'virtual', 'override', 'sealed', and 'new' modifiers.</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono contenere combinazioni identiche di modificatori 'virtual', 'override', 'sealed' e 'new'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodReadOnlyDifference"> <source>Both partial method declarations must be readonly or neither may be readonly</source> <target state="translated">Nessuna o entrambe le dichiarazioni di metodi parziali devono essere di tipo readonly</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodRefReturnDifference"> <source>Partial method declarations must have matching ref return values.</source> <target state="translated">Le dichiarazioni di metodo parziale devono contenere valori restituiti di riferimento corrispondenti.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodReturnTypeDifference"> <source>Both partial method declarations must have the same return type.</source> <target state="translated">Il tipo restituito deve essere identico in entrambe le dichiarazioni di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithAccessibilityModsMustHaveImplementation"> <source>Partial method '{0}' must have an implementation part because it has accessibility modifiers.</source> <target state="translated">Il metodo parziale '{0}' deve contenere una parte di implementazione perché include modificatori di accessibilità.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithExtendedModMustHaveAccessMods"> <source>Partial method '{0}' must have accessibility modifiers because it has a 'virtual', 'override', 'sealed', 'new', or 'extern' modifier.</source> <target state="translated">Il metodo parziale '{0}' deve contenere modificatori di accessibilità perché include un modificatore 'virtual', 'override', 'sealed', 'new' o 'extern'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithNonVoidReturnMustHaveAccessMods"> <source>Partial method '{0}' must have accessibility modifiers because it has a non-void return type.</source> <target state="translated">Il metodo parziale '{0}' deve contenere modificatori di accessibilità perché include un tipo restituito non void.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithOutParamMustHaveAccessMods"> <source>Partial method '{0}' must have accessibility modifiers because it has 'out' parameters.</source> <target state="translated">Il metodo parziale '{0}' deve contenere modificatori di accessibilità perché include parametri 'out'.</target> <note /> </trans-unit> <trans-unit id="ERR_PointerTypeInPatternMatching"> <source>Pattern-matching is not permitted for pointer types.</source> <target state="translated">I criteri di ricerca non sono consentiti per i tipi di puntatore.</target> <note /> </trans-unit> <trans-unit id="ERR_PossibleAsyncIteratorWithoutYield"> <source>The body of an async-iterator method must contain a 'yield' statement.</source> <target state="translated">Il corpo di un metodo di iteratore asincrono deve contenere un'istruzione 'yield'.</target> <note /> </trans-unit> <trans-unit id="ERR_PossibleAsyncIteratorWithoutYieldOrAwait"> <source>The body of an async-iterator method must contain a 'yield' statement. Consider removing 'async' from the method declaration or adding a 'yield' statement.</source> <target state="translated">Il corpo di un metodo di iteratore asincrono deve contenere un'istruzione 'yield'. Provare a rimuovere 'async' dalla dichiarazione del metodo o ad aggiungere un'istruzione 'yield'.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyPatternNameMissing"> <source>A property subpattern requires a reference to the property or field to be matched, e.g. '{{ Name: {0} }}'</source> <target state="translated">Con un criterio secondario di proprietà è richiesto un riferimento alla proprietà o al campo da abbinare, ad esempio '{{ Name: {0} }}'</target> <note /> </trans-unit> <trans-unit id="ERR_ReAbstractionInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché contiene una nuova astrazione di un membro dell'interfaccia di base. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyModMissingAccessor"> <source>'{0}': 'readonly' can only be used on accessors if the property or indexer has both a get and a set accessor</source> <target state="translated">'{0}': 'readonly' può essere usato su funzioni di accesso solo se la proprietà o l'indicizzatore include entrambi le funzioni di accesso get e set</target> <note /> </trans-unit> <trans-unit id="ERR_RecordAmbigCtor"> <source>The primary constructor conflicts with the synthesized copy constructor.</source> <target state="translated">Il costruttore primario è in conflitto con il costruttore di copia sintetizzato.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAssignNarrower"> <source>Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'.</source> <target state="translated">Non è possibile assegnare '{1}' a '{0}' come ref perché l'ambito di escape di '{1}' è ridotto rispetto a quello di '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RefLocalOrParamExpected"> <source>The left-hand side of a ref assignment must be a ref local or parameter.</source> <target state="translated">La parte sinistra di un'assegnazione ref deve essere un parametro o una variabile locale ref.</target> <note /> </trans-unit> <trans-unit id="ERR_RelationalPatternWithNaN"> <source>Relational patterns may not be used for a floating-point NaN.</source> <target state="translated">Non è possibile usare i criteri relazionali per un valore NaN a virgola mobile.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportCovariantPropertiesOfClasses"> <source>'{0}': Target runtime doesn't support covariant types in overrides. Type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il runtime di destinazione non supporta tipi covarianti negli override. Il tipo deve essere '{2}' in modo da corrispondere al membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportCovariantReturnsOfClasses"> <source>'{0}': Target runtime doesn't support covariant return types in overrides. Return type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il runtime di destinazione non supporta tipi restituiti covarianti negli override. Il tipo restituito deve essere '{2}' in modo da corrispondere al membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember"> <source>Target runtime doesn't support 'protected', 'protected internal', or 'private protected' accessibility for a member of an interface.</source> <target state="translated">Il runtime di destinazione non supporta l'accessibilità 'protected', 'protected internal' o 'private protected' per un membro di un'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces"> <source>Target runtime doesn't support static abstract members in interfaces.</source> <target state="new">Target runtime doesn't support static abstract members in interfaces.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfacesForMember"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support static abstract members in interfaces.</source> <target state="new">'{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support static abstract members in interfaces.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportUnmanagedDefaultCallConv"> <source>The target runtime doesn't support extensible or runtime-environment default calling conventions.</source> <target state="translated">Il runtime di destinazione non supporta convenzioni di chiamata predefinite estendibili o dell'ambiente di runtime.</target> <note /> </trans-unit> <trans-unit id="ERR_SealedAPIInRecord"> <source>'{0}' cannot be sealed because containing record is not sealed.</source> <target state="translated">'{0}' non può essere sealed perché il record contenitore non è sealed.</target> <note /> </trans-unit> <trans-unit id="ERR_SignatureMismatchInRecord"> <source>Record member '{0}' must return '{1}'.</source> <target state="translated">Il membro di record '{0}' deve restituire '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramDisallowsMainType"> <source>Cannot specify /main if there is a compilation unit with top-level statements.</source> <target state="translated">Non è possibile specificare /main se è presente un'unità di compilazione con istruzioni di primo livello.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramIsEmpty"> <source>At least one top-level statement must be non-empty.</source> <target state="new">At least one top-level statement must be non-empty.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramLocalIsReferencedOutsideOfTopLevelStatement"> <source>Cannot use local variable or local function '{0}' declared in a top-level statement in this context.</source> <target state="translated">In questo contesto non è possibile usare la variabile locale o la funzione locale '{0}' dichiarata in un'istruzione di primo livello.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramMultipleUnitsWithTopLevelStatements"> <source>Only one compilation unit can have top-level statements.</source> <target state="translated">Le istruzioni di primo livello possono essere presenti solo in un'unica unità di compilazione.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramNotAnExecutable"> <source>Program using top-level statements must be an executable.</source> <target state="translated">Il programma che usa istruzioni di primo livello deve essere un eseguibile.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleElementPositionalPatternRequiresDisambiguation"> <source>A single-element deconstruct pattern requires some other syntax for disambiguation. It is recommended to add a discard designator '_' after the close paren ')'.</source> <target state="translated">Per risolvere le ambiguità, è necessario usare una sintassi diversa per il criterio di decostruzione di singoli elementi. È consigliabile aggiungere un indicatore di rimozione '_' dopo la parentesi di chiusura ')'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticAPIInRecord"> <source>Record member '{0}' may not be static.</source> <target state="translated">Il membro di record '{0}' non può essere statico.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticAnonymousFunctionCannotCaptureThis"> <source>A static anonymous function cannot contain a reference to 'this' or 'base'.</source> <target state="translated">Una funzione anonima statica non può contenere un riferimento a 'this' o 'base'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticAnonymousFunctionCannotCaptureVariable"> <source>A static anonymous function cannot contain a reference to '{0}'.</source> <target state="translated">Una funzione anonima statica non può contenere un riferimento a '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticLocalFunctionCannotCaptureThis"> <source>A static local function cannot contain a reference to 'this' or 'base'.</source> <target state="translated">Una funzione locale statica non può contenere un riferimento a 'this' o 'base'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticLocalFunctionCannotCaptureVariable"> <source>A static local function cannot contain a reference to '{0}'.</source> <target state="translated">Una funzione locale statica non può contenere un riferimento a '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticMemberCantBeReadOnly"> <source>Static member '{0}' cannot be marked 'readonly'.</source> <target state="translated">Il membro statico '{0}' non può essere contrassegnato come 'readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_StdInOptionProvidedButConsoleInputIsNotRedirected"> <source>stdin argument '-' is specified, but input has not been redirected from the standard input stream.</source> <target state="translated">è stato specificato l'argomento stdin '-', ma l'input non è stato reindirizzato dal flusso di input standard.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchArmSubsumed"> <source>The pattern is unreachable. It has already been handled by a previous arm of the switch expression or it is impossible to match.</source> <target state="translated">Il criterio non è raggiungibile. È già stato gestito da un elemento precedente dell'espressione switch oppure non è possibile trovare una corrispondenza.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchCaseSubsumed"> <source>The switch case is unreachable. It has already been handled by a previous case or it is impossible to match.</source> <target state="translated">Lo switch case on è raggiungibile. È già stato gestito da un case precedente oppure non è possibile trovare una corrispondenza.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchExpressionNoBestType"> <source>No best type was found for the switch expression.</source> <target state="translated">Non è stato trovato alcun tipo ottimale per l'espressione switch.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchGoverningExpressionRequiresParens"> <source>Parentheses are required around the switch governing expression.</source> <target state="translated">L'espressione che gestisce lo switch deve essere racchiusa tra parentesi.</target> <note /> </trans-unit> <trans-unit id="ERR_TopLevelStatementAfterNamespaceOrType"> <source>Top-level statements must precede namespace and type declarations.</source> <target state="translated">Le istruzioni di primo livello devono precedere le dichiarazioni di tipo e di spazio dei nomi.</target> <note /> </trans-unit> <trans-unit id="ERR_TripleDotNotAllowed"> <source>Unexpected character sequence '...'</source> <target state="translated">La sequenza di caratteri '...' è imprevista</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNameMismatch"> <source>The name '{0}' does not identify tuple element '{1}'.</source> <target state="translated">Il nome '{0}' non identifica l'elemento di tupla '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleSizesMismatchForBinOps"> <source>Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right.</source> <target state="translated">Le cardinalità dei tipi di tupla usati come operandi di un operatore == o != devono essere uguali, ma questo operatore presenta tipi di tupla con cardinalità {0} sulla sinistra e {1} sulla destra.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeConstraintsMustBeUniqueAndFirst"> <source>The 'class', 'struct', 'unmanaged', 'notnull', and 'default' constraints cannot be combined or duplicated, and must be specified first in the constraints list.</source> <target state="translated">I vincoli 'class', 'struct', 'unmanaged', 'notnull' e 'default' non possono essere combinati o duplicati e devono essere specificati per primi nell'elenco di vincoli.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeIsNotAnInterpolatedStringHandlerType"> <source>'{0}' is not an interpolated string handler type.</source> <target state="new">'{0}' is not an interpolated string handler type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMustBePublic"> <source>Type '{0}' must be public to be used as a calling convention.</source> <target state="translated">Il tipo '{0}' deve essere pubblico per poterlo usare come convenzione di chiamata.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyMethodsCannotBeCalledDirectly"> <source>'{0}' is attributed with 'UnmanagedCallersOnly' and cannot be called directly. Obtain a function pointer to this method.</source> <target state="translated">'{0}', a cui è assegnato l'attributo 'UnmanagedCallersOnly', non può essere chiamato direttamente. Ottenere un puntatore a funzione per questo metodo.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyMethodsCannotBeConvertedToDelegate"> <source>'{0}' is attributed with 'UnmanagedCallersOnly' and cannot be converted to a delegate type. Obtain a function pointer to this method.</source> <target state="translated">'{0}', a cui è assegnato l'attributo 'UnmanagedCallersOnly', non può essere convertito in un tipo delegato. Ottenere un puntatore a funzione per questo metodo.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_WrongArityAsyncReturn"> <source>A generic task-like return type was expected, but the type '{0}' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.</source> <target state="new">A generic task-like return type was expected, but the type '{0}' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.</target> <note /> </trans-unit> <trans-unit id="HDN_DuplicateWithGlobalUsing"> <source>The using directive for '{0}' appeared previously as global using</source> <target state="new">The using directive for '{0}' appeared previously as global using</target> <note /> </trans-unit> <trans-unit id="HDN_DuplicateWithGlobalUsing_Title"> <source>The using directive appeared previously as global using</source> <target state="new">The using directive appeared previously as global using</target> <note /> </trans-unit> <trans-unit id="IDS_AsyncMethodBuilderOverride"> <source>async method builder override</source> <target state="new">async method builder override</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureCovariantReturnsForOverrides"> <source>covariant returns</source> <target state="translated">tipi restituiti covarianti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDiscards"> <source>discards</source> <target state="translated">rimozioni</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtendedPropertyPatterns"> <source>extended property patterns</source> <target state="new">extended property patterns</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureFileScopedNamespace"> <source>file-scoped namespace</source> <target state="new">file-scoped namespace</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGenericAttributes"> <source>generic attributes</source> <target state="new">generic attributes</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGlobalUsing"> <source>global using directive</source> <target state="new">global using directive</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImplicitObjectCreation"> <source>target-typed object creation</source> <target state="translated">creazione di oggetti con tipo di destinazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImprovedInterpolatedStrings"> <source>interpolated string handlers</source> <target state="new">interpolated string handlers</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureInferredDelegateType"> <source>inferred delegate type</source> <target state="new">inferred delegate type</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambdaAttributes"> <source>lambda attributes</source> <target state="new">lambda attributes</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambdaReturnType"> <source>lambda return type</source> <target state="new">lambda return type</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLineSpanDirective"> <source>line span directive</source> <target state="new">line span directive</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureParameterlessStructConstructors"> <source>parameterless struct constructors</source> <target state="new">parameterless struct constructors</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePositionalFieldsInRecords"> <source>positional fields in records</source> <target state="new">positional fields in records</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRecordStructs"> <source>record structs</source> <target state="new">record structs</target> <note>'record structs' is not localizable.</note> </trans-unit> <trans-unit id="IDS_FeatureSealedToStringInRecord"> <source>sealed ToString in record</source> <target state="translated">ToString sealed nel record</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStructFieldInitializers"> <source>struct field initializers</source> <target state="new">struct field initializers</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureWithOnAnonymousTypes"> <source>with on anonymous types</source> <target state="new">with on anonymous types</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticAbstractMembersInInterfaces"> <source>static abstract members in interfaces</source> <target state="new">static abstract members in interfaces</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureWithOnStructs"> <source>with on structs</source> <target state="new">with on structs</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework"> <source>The assembly '{0}' containing type '{1}' references .NET Framework, which is not supported.</source> <target state="translated">L'assembly '{0}' che contiene il tipo '{1}' fa riferimento a .NET Framework, che non è supportato.</target> <note>{1} is the type that was loaded, {0} is the containing assembly.</note> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework_Title"> <source>The loaded assembly references .NET Framework, which is not supported.</source> <target state="translated">L'assembly caricato fa riferimento a .NET Framework, che non è supportato.</target> <note /> </trans-unit> <trans-unit id="WRN_AttrDependentTypeNotAllowed"> <source>Type '{0}' cannot be used in this context because it cannot be represented in metadata.</source> <target state="new">Type '{0}' cannot be used in this context because it cannot be represented in metadata.</target> <note /> </trans-unit> <trans-unit id="WRN_AttrDependentTypeNotAllowed_Title"> <source>Type cannot be used in this context because it cannot be represented in metadata.</source> <target state="new">Type cannot be used in this context because it cannot be represented in metadata.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName_Title"> <source>The CallerArgumentExpressionAttribute is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-refential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-refential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionParamForUnconsumedLocation"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionParamForUnconsumedLocation_Title"> <source>The CallerArgumentExpressionAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerArgumentExpression"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerArgumentExpression_Title"> <source>The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerFilePathAttribute</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerFilePathAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerArgumentExpression"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerArgumentExpression_Title"> <source>The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNamePreferredOverCallerArgumentExpression"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerMemberNameAttribute.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerMemberNameAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNamePreferredOverCallerArgumentExpression_Title"> <source>The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerMemberNameAttribute</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerMemberNameAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_DoNotCompareFunctionPointers"> <source>Comparison of function pointers might yield an unexpected result, since pointers to the same function may be distinct.</source> <target state="translated">Il confronto dei puntatori a funzione potrebbe produrre un risultato imprevisto perché i puntatori alla stessa funzione possono essere distinti.</target> <note /> </trans-unit> <trans-unit id="WRN_DoNotCompareFunctionPointers_Title"> <source>Do not compare function pointer values</source> <target state="translated">Non confrontare valori del puntatore a funzione</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterNotNullIfNotNull"> <source>Parameter '{0}' must have a non-null value when exiting because parameter '{1}' is non-null.</source> <target state="translated">Il parametro '{0}' deve avere un valore non Null quando viene terminato perché il parametro '{1}' è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterNotNullIfNotNull_Title"> <source>Parameter must have a non-null value when exiting because parameter referenced by NotNullIfNotNull is non-null.</source> <target state="translated">Il parametro deve avere un valore non Null quando viene terminato perché il parametro a cui fa riferimento NotNullIfNotNull è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterOccursAfterInterpolatedStringHandlerParameter"> <source>Parameter {0} occurs after {1} in the parameter list, but is used as an argument for interpolated string handler conversions. This will require the caller to reorder parameters with named arguments at the call site. Consider putting the interpolated string handler parameter after all arguments involved.</source> <target state="new">Parameter {0} occurs after {1} in the parameter list, but is used as an argument for interpolated string handler conversions. This will require the caller to reorder parameters with named arguments at the call site. Consider putting the interpolated string handler parameter after all arguments involved.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterOccursAfterInterpolatedStringHandlerParameter_Title"> <source>Parameter to interpolated string handler conversion occurs after handler parameter</source> <target state="new">Parameter to interpolated string handler conversion occurs after handler parameter</target> <note /> </trans-unit> <trans-unit id="WRN_RecordEqualsWithoutGetHashCode"> <source>'{0}' defines 'Equals' but not 'GetHashCode'</source> <target state="translated">'{0}' definisce 'Equals' ma non 'GetHashCode'</target> <note>'GetHashCode' and 'Equals' are not localizable.</note> </trans-unit> <trans-unit id="WRN_RecordEqualsWithoutGetHashCode_Title"> <source>Record defines 'Equals' but not 'GetHashCode'.</source> <target state="translated">Il record definisce 'Equals' ma non 'GetHashCode'.</target> <note>'GetHashCode' and 'Equals' are not localizable.</note> </trans-unit> <trans-unit id="IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction"> <source>Mixed declarations and expressions in deconstruction</source> <target state="translated">Dichiarazioni ed espressioni miste nella decostruzione</target> <note /> </trans-unit> <trans-unit id="WRN_PartialMethodTypeDifference"> <source>Partial method declarations '{0}' and '{1}' have signature differences.</source> <target state="new">Partial method declarations '{0}' and '{1}' have signature differences.</target> <note /> </trans-unit> <trans-unit id="WRN_PartialMethodTypeDifference_Title"> <source>Partial method declarations have signature differences.</source> <target state="new">Partial method declarations have signature differences.</target> <note /> </trans-unit> <trans-unit id="WRN_RecordNamedDisallowed"> <source>Types and aliases should not be named 'record'.</source> <target state="translated">Il nome di tipi e alias non deve essere 'record'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecordNamedDisallowed_Title"> <source>Types and aliases should not be named 'record'.</source> <target state="translated">Il nome di tipi e alias non deve essere 'record'.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnNotNullIfNotNull"> <source>Return value must be non-null because parameter '{0}' is non-null.</source> <target state="translated">Il valore restituito deve essere non Null perché il parametro '{0}' è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnNotNullIfNotNull_Title"> <source>Return value must be non-null because parameter is non-null.</source> <target state="translated">Il valore restituito deve essere non Null perché il parametro è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithUnnamedEnumValue"> <source>The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '{0}' is not covered.</source> <target state="translated">L'espressione switch non gestisce alcuni valori del relativo tipo di input (non è esaustiva) che interessa un valore di enumerazione senza nome. Ad esempio, il criterio '{0}' non è coperto.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithUnnamedEnumValue_Title"> <source>The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value.</source> <target state="translated">L'espressione switch non gestisce alcuni valori del relativo tipo di input (non è esaustiva) che interessa un valore di enumerazione senza nome.</target> <note /> </trans-unit> <trans-unit id="WRN_SyncAndAsyncEntryPoints"> <source>Method '{0}' will not be used as an entry point because a synchronous entry point '{1}' was found.</source> <target state="translated">Il metodo '{0}' non verrà usato come punto di ingresso perché è stato trovato un punto di ingresso sincrono '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeNotFound"> <source>Type '{0}' is not defined.</source> <target state="translated">Il tipo '{0}' non è definito.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedArgumentList"> <source>Unexpected argument list.</source> <target state="translated">Elenco di argomenti imprevisto.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedOrMissingConstructorInitializerInRecord"> <source>A constructor declared in a record with parameter list must have 'this' constructor initializer.</source> <target state="translated">Un costruttore dichiarato in un record con elenco di parametri deve includere l'inizializzatore di costruttore 'this'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedVarianceStaticMember"> <source>Invalid variance: The type parameter '{1}' must be {3} valid on '{0}' unless language version '{4}' or greater is used. '{1}' is {2}.</source> <target state="translated">Varianza non valida: il parametro di tipo '{1}' deve essere {3} valido in '{0}' a meno che non venga usata la versione '{4}' o successiva del linguaggio. '{1}' è {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedBoundWithClass"> <source>'{0}': cannot specify both a constraint class and the 'unmanaged' constraint</source> <target state="translated">'{0}': non è possibile specificare sia una classe constraint che il vincolo 'unmanaged'</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyMethodOrTypeCannotBeGeneric"> <source>Methods attributed with 'UnmanagedCallersOnly' cannot have generic type parameters and cannot be declared in a generic type.</source> <target state="translated">I metodi attribuiti con 'UnmanagedCallersOnly' non possono avere parametri di tipo generico e non possono essere dichiarati in un tipo generico.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyRequiresStatic"> <source>'UnmanagedCallersOnly' can only be applied to ordinary static non-abstract methods or static local functions.</source> <target state="needs-review-translation">'UnmanagedCallersOnly' può essere applicato solo a metodi statici normali o funzioni locali statiche.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_UnmanagedConstraintNotSatisfied"> <source>The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">Il tipo '{2}' deve essere un tipo valore che non ammette i valori Null, unitamente a tutti i campi a ogni livello di annidamento, per poter essere usato come parametro '{1}' nel tipo o metodo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedCallingConvention"> <source>The calling convention of '{0}' is not supported by the language.</source> <target state="translated">La convenzione di chiamata di '{0}' non è supportata dal linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedTypeForRelationalPattern"> <source>Relational patterns may not be used for a value of type '{0}'.</source> <target state="translated">Non è possibile usare i criteri relazionali per un valore di tipo '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingVarInSwitchCase"> <source>A using variable cannot be used directly within a switch section (consider using braces). </source> <target state="translated">Non è possibile usare una variabile using direttamente in una sezione di switch; provare a usare le parentesi graffe. </target> <note /> </trans-unit> <trans-unit id="ERR_VarMayNotBindToType"> <source>The syntax 'var' for a pattern is not permitted to refer to a type, but '{0}' is in scope here.</source> <target state="translated">Per fare riferimento a un tipo, non è consentito usare la sintassi 'var' per un criterio, ma in questo '{0}' è incluso nell'ambito.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInterfaceNesting"> <source>Enums, classes, and structures cannot be declared in an interface that has an 'in' or 'out' type parameter.</source> <target state="translated">Non è possibile dichiarare enumerazioni, classi e strutture in un'interfaccia che contiene un parametro di tipo 'in' o 'out'.</target> <note /> </trans-unit> <trans-unit id="ERR_WrongFuncPtrCallingConvention"> <source>Calling convention of '{0}' is not compatible with '{1}'.</source> <target state="translated">La convenzione di chiamata di '{0}' non è compatibile con '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_WrongNumberOfSubpatterns"> <source>Matching the tuple type '{0}' requires '{1}' subpatterns, but '{2}' subpatterns are present.</source> <target state="translated">Per la corrispondenza del tipo di tupla '{0}' sono richiesti '{1}' criteri secondari, ma ne sono presenti '{2}'.</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidInputFileName"> <source>File name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long</source> <target state="translated">Il nome file '{0}' è vuoto, contiene caratteri non validi, include una specifica di unità senza percorso assoluto oppure è troppo lungo</target> <note /> </trans-unit> <trans-unit id="IDS_AddressOfMethodGroup"> <source>&amp;method group</source> <target state="translated">gruppo di &amp;metodi</target> <note /> </trans-unit> <trans-unit id="IDS_CSCHelp"> <source> Visual C# Compiler Options - OUTPUT FILES - -out:&lt;file&gt; Specify output file name (default: base name of file with main class or first file) -target:exe Build a console executable (default) (Short form: -t:exe) -target:winexe Build a Windows executable (Short form: -t:winexe) -target:library Build a library (Short form: -t:library) -target:module Build a module that can be added to another assembly (Short form: -t:module) -target:appcontainerexe Build an Appcontainer executable (Short form: -t:appcontainerexe) -target:winmdobj Build a Windows Runtime intermediate file that is consumed by WinMDExp (Short form: -t:winmdobj) -doc:&lt;file&gt; XML Documentation file to generate -refout:&lt;file&gt; Reference assembly output to generate -platform:&lt;string&gt; Limit which platforms this code can run on: x86, Itanium, x64, arm, arm64, anycpu32bitpreferred, or anycpu. The default is anycpu. - INPUT FILES - -recurse:&lt;wildcard&gt; Include all files in the current directory and subdirectories according to the wildcard specifications -reference:&lt;alias&gt;=&lt;file&gt; Reference metadata from the specified assembly file using the given alias (Short form: -r) -reference:&lt;file list&gt; Reference metadata from the specified assembly files (Short form: -r) -addmodule:&lt;file list&gt; Link the specified modules into this assembly -link:&lt;file list&gt; Embed metadata from the specified interop assembly files (Short form: -l) -analyzer:&lt;file list&gt; Run the analyzers from this assembly (Short form: -a) -additionalfile:&lt;file list&gt; Additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings. -embed Embed all source files in the PDB. -embed:&lt;file list&gt; Embed specific files in the PDB. - RESOURCES - -win32res:&lt;file&gt; Specify a Win32 resource file (.res) -win32icon:&lt;file&gt; Use this icon for the output -win32manifest:&lt;file&gt; Specify a Win32 manifest file (.xml) -nowin32manifest Do not include the default Win32 manifest -resource:&lt;resinfo&gt; Embed the specified resource (Short form: -res) -linkresource:&lt;resinfo&gt; Link the specified resource to this assembly (Short form: -linkres) Where the resinfo format is &lt;file&gt;[,&lt;string name&gt;[,public|private]] - CODE GENERATION - -debug[+|-] Emit debugging information -debug:{full|pdbonly|portable|embedded} Specify debugging type ('full' is default, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the target .dll or .exe) -optimize[+|-] Enable optimizations (Short form: -o) -deterministic Produce a deterministic assembly (including module version GUID and timestamp) -refonly Produce a reference assembly in place of the main output -instrument:TestCoverage Produce an assembly instrumented to collect coverage information -sourcelink:&lt;file&gt; Source link info to embed into PDB. - ERRORS AND WARNINGS - -warnaserror[+|-] Report all warnings as errors -warnaserror[+|-]:&lt;warn list&gt; Report specific warnings as errors (use "nullable" for all nullability warnings) -warn:&lt;n&gt; Set warning level (0 or higher) (Short form: -w) -nowarn:&lt;warn list&gt; Disable specific warning messages (use "nullable" for all nullability warnings) -ruleset:&lt;file&gt; Specify a ruleset file that disables specific diagnostics. -errorlog:&lt;file&gt;[,version=&lt;sarif_version&gt;] Specify a file to log all compiler and analyzer diagnostics. sarif_version:{1|2|2.1} Default is 1. 2 and 2.1 both mean SARIF version 2.1.0. -reportanalyzer Report additional analyzer information, such as execution time. -skipanalyzers[+|-] Skip execution of diagnostic analyzers. - LANGUAGE - -checked[+|-] Generate overflow checks -unsafe[+|-] Allow 'unsafe' code -define:&lt;symbol list&gt; Define conditional compilation symbol(s) (Short form: -d) -langversion:? Display the allowed values for language version -langversion:&lt;string&gt; Specify language version such as `latest` (latest version, including minor versions), `default` (same as `latest`), `latestmajor` (latest version, excluding minor versions), `preview` (latest version, including features in unsupported preview), or specific versions like `6` or `7.1` -nullable[+|-] Specify nullable context option enable|disable. -nullable:{enable|disable|warnings|annotations} Specify nullable context option enable|disable|warnings|annotations. - SECURITY - -delaysign[+|-] Delay-sign the assembly using only the public portion of the strong name key -publicsign[+|-] Public-sign the assembly using only the public portion of the strong name key -keyfile:&lt;file&gt; Specify a strong name key file -keycontainer:&lt;string&gt; Specify a strong name key container -highentropyva[+|-] Enable high-entropy ASLR - MISCELLANEOUS - @&lt;file&gt; Read response file for more options -help Display this usage message (Short form: -?) -nologo Suppress compiler copyright message -noconfig Do not auto include CSC.RSP file -parallel[+|-] Concurrent build. -version Display the compiler version number and exit. - ADVANCED - -baseaddress:&lt;address&gt; Base address for the library to be built -checksumalgorithm:&lt;alg&gt; Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default). -codepage:&lt;n&gt; Specify the codepage to use when opening source files -utf8output Output compiler messages in UTF-8 encoding -main:&lt;type&gt; Specify the type that contains the entry point (ignore all other possible entry points) (Short form: -m) -fullpaths Compiler generates fully qualified paths -filealign:&lt;n&gt; Specify the alignment used for output file sections -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Specify a mapping for source path names output by the compiler. -pdb:&lt;file&gt; Specify debug information file name (default: output file name with .pdb extension) -errorendlocation Output line and column of the end location of each error -preferreduilang Specify the preferred output language name. -nosdkpath Disable searching the default SDK path for standard library assemblies. -nostdlib[+|-] Do not reference standard library (mscorlib.dll) -subsystemversion:&lt;string&gt; Specify subsystem version of this assembly -lib:&lt;file list&gt; Specify additional directories to search in for references -errorreport:&lt;string&gt; Specify how to handle internal compiler errors: prompt, send, queue, or none. The default is queue. -appconfig:&lt;file&gt; Specify an application configuration file containing assembly binding settings -moduleassemblyname:&lt;string&gt; Name of the assembly which this module will be a part of -modulename:&lt;string&gt; Specify the name of the source module -generatedfilesout:&lt;dir&gt; Place files generated during compilation in the specified directory. </source> <target state="translated"> Opzioni del compilatore Visual C# - FILE DI OUTPUT - -out:&lt;file&gt; Consente di specificare il nome del file di output (impostazione predefinita: nome di base del file con la classe principale o primo file) -target:exe Compila un file eseguibile da console (impostazione predefinita). Forma breve: -t:exe -target:winexe Compila un eseguibile Windows. Forma breve: -t:winexe -target:library Compila una libreria. Forma breve: -t:library -target:module Compila un modulo che può essere aggiunto a un altro assembly. Forma breve: -t:module -target:appcontainerexe Compila un file eseguibile Appcontainer. Forma breve: -t:appcontainerexe -target:winmdobj Compila un file Windows Runtime intermedio usato da WinMDExp. Forma breve: -t:winmdobj -doc:&lt;file&gt; File di documentazione XML da generare -refout:&lt;file&gt; Output dell'assembly di riferimento da generare -platform:&lt;stringa&gt; Limita le piattaforme in cui è possibile eseguire il codice: x86, Itanium, x64, arm, arm64, anycpu32bitpreferred o anycpu. Il valore predefinito è anycpu. - FILE DI INPUT - -recurse:&lt;caratteri_jolly&gt; Include tutti i file presenti nella directory corrente e nelle relative sottodirectory in base ai caratteri jolly specificati -reference:&lt;alias&gt;=&lt;file&gt; Crea un riferimento ai metadati dal file di assembly specificato usando l'alias indicato. Forma breve: -r -reference:&lt;elenco file&gt; Crea un riferimento ai metadati dai file di assembly specificati. Forma breve: -r -addmodule:&lt;elenco file&gt; Collega i moduli specificati in questo assembly -link:&lt;elenco file&gt; Incorpora metadati dai file di assembly di interoperabilità specificati. Forma breve: -l -analyzer:&lt;elenco file&gt; Esegue gli analizzatori dall'assembly. Forma breve: -a -additionalfile:&lt;elenco file&gt; File aggiuntivi che non influiscono direttamente sulla generazione del codice ma possono essere usati dagli analizzatori per produrre errori o avvisi. -embed Incorpora tutti i file di origine nel file PDB. -embed:&lt;elenco file&gt; Incorpora file specifici nel file PDB. - RISORSE - -win32res:&lt;file&gt; Consente di specificare un file di risorse Win32 (.res) -win32icon:&lt;file&gt; Usa questa icona per l'output -win32manifest:&lt;file&gt; Consente di specificare un file manifesto Win32 (.xml) -nowin32manifest Non include il manifesto Win32 predefinito -resource:&lt;info_risorsa&gt; Incorpora la risorsa specificata. Forma breve: -res -linkresource:&lt;info_risorsa&gt; Collega la risorsa specificata all'assembly. Forma breve: -linkres. Il formato di info_risorsa è &lt;file&gt;[,&lt;nome stringa&gt;[,public|private]] - GENERAZIONE DEL CODICE - -debug[+|-] Crea le informazioni di debug -debug:{full|pdbonly|portable|embedded} Specifica il tipo di debug ('full' è l'impostazione predefinita, 'portable' è un formato multipiattaforma, 'embedded' è un formato multipiattaforma incorporato nel file DLL o EXE di destinazione) -optimize[+|-] Abilita le ottimizzazioni. Forma breve: -o -deterministic Produce un assembly deterministico (che include GUID e timestamp della versione del modulo) -refonly Produce un assembly di riferimento al posto dell'output principale -instrument:TestCoverage Produce un assembly instrumentato per raccogliere informazioni sul code coverage -sourcelink:&lt;file&gt; Informazioni sul collegamento all'origine da incorporare nel file PDB. - ERRORI E AVVISI - -warnaserror[+|-] Segnala tutti gli avvisi come errori -warnaserror[+|-]:&lt;elenco avvisi&gt; Segnala determinati avvisi come errori (usare "nullable" per tutti gli avvisi di supporto dei valori Null) -warn:&lt;n&gt; Imposta il livello di avviso (0 o valore superiore). Forma breve: -w -nowarn:&lt;elenco avvisi&gt; Disabilita messaggi di avviso specifici (usare "nullable" per tutti gli avvisi di supporto dei valori Null) -ruleset:&lt;file&gt; Consente di specificare un file di set di regole che disabilita diagnostica specifica. -errorlog:&lt;file&gt;[,version=&lt;versione _SARIF&gt;] Consente di specificare un file in cui registrare tutte le diagnostiche del compilatore e dell'analizzatore. versione_SARIF:{1|2|2.1} L'impostazione predefinita è 1. 2 e 2.1 si riferiscono entrambi a SARIF versione 2.1.0. -reportanalyzer Restituisce informazioni aggiuntive dell'analizzatore, ad esempio il tempo di esecuzione. -skipanalyzers[+|-] Ignora l'esecuzione degli analizzatori diagnostici. - LINGUAGGIO - -checked[+|-] Genera controlli dell'overflow -unsafe[+|-] Consente codice 'unsafe' -define:&lt;elenco simboli&gt; Consente di definire simboli di compilazione condizionale. Forma breve: -d -langversion:? Visualizza i valori consentiti per la versione del linguaggio -langversion:&lt;stringa&gt; Consente di specificare la versione del linguaggio, ad esempio `latest` (ultima versione che include versioni secondarie), `default` (uguale a `latest`), `latestmajor` (ultima versione, escluse le versioni secondarie), `preview` (ultima versione, incluse le funzionalità nell'anteprima non supportata), o versioni specifiche come `6` o `7.1` -nullable[+|-] Consente di specificare l'opzione di contesto nullable enable|disable. -nullable:{enable|disable|warnings|annotations} Consente di specificare l'opzione di contesto nullable enable|disable|warnings|annotations. - SICUREZZA - -delaysign[+|-] Ritarda la firma dell'assembly usando solo la parte pubblica della chiave con nome sicuro -publicsign[+|-] Firma pubblicamente l'assembly usando solo la parte pubblica della chiave con nome sicuro -keyfile:&lt;file&gt; Consente di specificare un file di chiave con nome sicuro -keycontainer:&lt;stringa&gt; Consente di specificare un contenitore di chiavi con nome sicuro -highentropyva[+|-] Abilita ASLR a entropia elevata - VARIE - @&lt;file&gt; Legge il file di risposta per altre opzioni -help Visualizza questo messaggio relativo all'utilizzo. Forma breve: -? -nologo Non visualizza il messaggio di copyright del compilatore -noconfig Non include automaticamente il file CSC.RSP -parallel[+|-] Compilazione simultanea. -version Visualizza il numero di versione del compilatore ed esce. - AVANZATE - -baseaddress:&lt;indirizzo&gt; Indirizzo di base della libreria da compilare -checksumalgorithm:&lt;alg&gt; Consente di specificare l'algoritmo per calcolare il checksum del file di origine archiviato nel file PDB. I valori supportati sono: SHA1 o SHA256 (impostazione predefinita). -codepage:&lt;n&gt; Consente di specificare la tabella codici da usare all'apertura dei file di origine -utf8output Restituisce i messaggi del compilatore usando la codifica UTF-8 -main:&lt;tipo&gt; Consente di specificare il tipo che contiene il punto di ingresso, ignorando tutti gli altri punti di ingresso possibili. Forma breve: -m -fullpaths Il compilatore genera percorsi completi -filealign:&lt;n&gt; Consente di specificare l'allineamento usato per le sezioni del file di output -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Consente di specificare un mapping per i nomi di percorso di origine visualizzati dal compilatore. -pdb:&lt;file&gt; Consente di specificare il nome del file di informazioni di debug (impostazione predefinita: nome del file di output con estensione pdb) -errorendlocation Riga e colonna di output della posizione finale di ogni errore -preferreduilang Consente di specificare il nome del linguaggio di output preferito. -nosdkpath Disabilita la ricerca di assembly di librerie standard nel percorso predefinito dell'SDK. -nostdlib[+|-] Omette i riferimenti alla libreria standard (mscorlib.dll) -subsystemversion:&lt;stringa&gt; Consente di specificare la versione del sottosistema di questo assembly -lib:&lt;elenco file&gt; Consente di specificare le directory aggiuntive in cui cercare i riferimenti -errorreport:&lt;stringa&gt; Consente di specificare la modalità di gestione degli errori interni del compilatore: prompt, send, queue o none. L'impostazione predefinita è queue. -appconfig:&lt;file&gt; Consente di specificare un file di configurazione dell'applicazione contenente le impostazioni di binding dell'assembly -moduleassemblyname:&lt;stringa&gt; Nome dell'assembly di cui farà parte questo modulo -modulename:&lt;stringa&gt; Consente di specificare il nome del modulo di origine -generatedfilesout:&lt;dir&gt; Inserisce i file generati durante la compilazione nella directory specificata. </target> <note>Visual C# Compiler Options</note> </trans-unit> <trans-unit id="IDS_DefaultInterfaceImplementation"> <source>default interface implementation</source> <target state="translated">implementazione di interfaccia predefinita</target> <note /> </trans-unit> <trans-unit id="IDS_Disposable"> <source>disposable</source> <target state="translated">disposable</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAltInterpolatedVerbatimStrings"> <source>alternative interpolated verbatim strings</source> <target state="translated">stringhe verbatim interpolate alternative</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAndPattern"> <source>and pattern</source> <target state="translated">criterio and</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsyncUsing"> <source>asynchronous using</source> <target state="translated">using asincrono</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureCoalesceAssignmentExpression"> <source>coalescing assignment</source> <target state="translated">assegnazione di coalescenza</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureConstantInterpolatedStrings"> <source>constant interpolated strings</source> <target state="translated">stringhe interpolate costanti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDefaultTypeParameterConstraint"> <source>default type parameter constraints</source> <target state="translated">vincoli di parametro di tipo predefiniti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDelegateGenericTypeConstraint"> <source>delegate generic type constraints</source> <target state="translated">vincoli di tipo generico delegato</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureEnumGenericTypeConstraint"> <source>enum generic type constraints</source> <target state="translated">vincoli di tipo generico enumerazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionVariablesInQueriesAndInitializers"> <source>declaration of expression variables in member initializers and queries</source> <target state="translated">dichiarazione di variabili di espressione in query e inizializzatori di membri</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtendedPartialMethods"> <source>extended partial methods</source> <target state="translated">metodi parziali estesi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensibleFixedStatement"> <source>extensible fixed statement</source> <target state="translated">istruzione fixed estendibile</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensionGetAsyncEnumerator"> <source>extension GetAsyncEnumerator</source> <target state="translated">GetAsyncEnumerator dell'estensione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensionGetEnumerator"> <source>extension GetEnumerator</source> <target state="translated">GetEnumerator dell'estensione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExternLocalFunctions"> <source>extern local functions</source> <target state="translated">funzioni locali extern</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureFunctionPointers"> <source>function pointers</source> <target state="translated">puntatori a funzione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureIndexOperator"> <source>index operator</source> <target state="translated">operatore di indice</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureIndexingMovableFixedBuffers"> <source>indexing movable fixed buffers</source> <target state="translated">indicizzazione di buffer fissi mobili</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureInitOnlySetters"> <source>init-only setters</source> <target state="translated">setter di sola inizializzazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLocalFunctionAttributes"> <source>local function attributes</source> <target state="translated">attributi di funzione locale</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambdaDiscardParameters"> <source>lambda discard parameters</source> <target state="translated">parametri di rimozione lambda</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureMemberNotNull"> <source>MemberNotNull attribute</source> <target state="translated">Attributo MemberNotNull</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureModuleInitializers"> <source>module initializers</source> <target state="translated">inizializzatori di modulo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNameShadowingInNestedFunctions"> <source>name shadowing in nested functions</source> <target state="translated">shadowing dei nomi nelle funzioni annidate</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNativeInt"> <source>native-sized integers</source> <target state="translated">Integer di dimensioni native</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNestedStackalloc"> <source>stackalloc in nested expressions</source> <target state="translated">stackalloc in espressioni annidate</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNotNullGenericTypeConstraint"> <source>notnull generic type constraint</source> <target state="translated">vincolo di tipo generico notnull</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNotPattern"> <source>not pattern</source> <target state="translated">criterio not</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullPointerConstantPattern"> <source>null pointer constant pattern</source> <target state="translated">criterio per costante puntatore Null</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullableReferenceTypes"> <source>nullable reference types</source> <target state="translated">tipi riferimento nullable</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor"> <source>obsolete on property accessor</source> <target state="translated">funzionalità obsoleta nella funzione di accesso proprietà</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureOrPattern"> <source>or pattern</source> <target state="translated">criterio or</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureParenthesizedPattern"> <source>parenthesized pattern</source> <target state="translated">criterio tra parentesi</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePragmaWarningEnable"> <source>warning action enable</source> <target state="translated">azione di avviso enable</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRangeOperator"> <source>range operator</source> <target state="translated">operatore di intervallo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadOnlyMembers"> <source>readonly members</source> <target state="translated">membri readonly</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRecords"> <source>records</source> <target state="translated">record</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRecursivePatterns"> <source>recursive patterns</source> <target state="translated">criteri ricorsivi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefConditional"> <source>ref conditional expression</source> <target state="translated">espressione condizionale ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefFor"> <source>ref for-loop variables</source> <target state="translated">variabili ciclo for ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefForEach"> <source>ref foreach iteration variables</source> <target state="translated">variabili di iterazione foreach ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefReassignment"> <source>ref reassignment</source> <target state="translated">riassegnazione ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRelationalPattern"> <source>relational pattern</source> <target state="translated">criterio relazionale</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStackAllocInitializer"> <source>stackalloc initializer</source> <target state="translated">inizializzatore stackalloc</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticAnonymousFunction"> <source>static anonymous function</source> <target state="translated">funzione anonima statica</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticLocalFunctions"> <source>static local functions</source> <target state="translated">funzioni locali statiche</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureSwitchExpression"> <source>&lt;switch expression&gt;</source> <target state="translated">&lt;espressione switch&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTargetTypedConditional"> <source>target-typed conditional expression</source> <target state="translated">espressione condizionale con tipo di destinazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTupleEquality"> <source>tuple equality</source> <target state="translated">uguaglianza tuple</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTypePattern"> <source>type pattern</source> <target state="translated">criterio di tipo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator"> <source>unconstrained type parameters in null coalescing operator</source> <target state="translated">parametri di tipo senza vincoli nell'operatore Null di coalescenza</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUnmanagedConstructedTypes"> <source>unmanaged constructed types</source> <target state="translated">tipi costruiti non gestiti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUnmanagedGenericTypeConstraint"> <source>unmanaged generic type constraints</source> <target state="translated">vincoli di tipo generico unmanaged</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUsingDeclarations"> <source>using declarations</source> <target state="translated">dichiarazioni using</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureVarianceSafetyForStaticInterfaceMembers"> <source>variance safety for static interface members</source> <target state="translated">sicurezza della varianza per i membri di interfaccia statici</target> <note /> </trans-unit> <trans-unit id="IDS_NULL"> <source>&lt;null&gt;</source> <target state="translated">&lt;Null&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_OverrideWithConstraints"> <source>constraints for override and explicit interface implementation methods</source> <target state="translated">vincoli per i metodi di override e di implementazione esplicita dell'interfaccia</target> <note /> </trans-unit> <trans-unit id="IDS_Parameter"> <source>parameter</source> <target state="translated">parametro</target> <note /> </trans-unit> <trans-unit id="IDS_Return"> <source>return</source> <target state="translated">restituito</target> <note /> </trans-unit> <trans-unit id="IDS_ThrowExpression"> <source>&lt;throw expression&gt;</source> <target state="translated">&lt;espressione throw&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_RELATEDERROR"> <source>(Location of symbol related to previous error)</source> <target state="translated">(Posizione del simbolo relativo all'errore precedente)</target> <note /> </trans-unit> <trans-unit id="IDS_RELATEDWARNING"> <source>(Location of symbol related to previous warning)</source> <target state="translated">(Posizione del simbolo relativo all'avviso precedente)</target> <note /> </trans-unit> <trans-unit id="IDS_TopLevelStatements"> <source>top-level statements</source> <target state="translated">istruzioni di primo livello</target> <note /> </trans-unit> <trans-unit id="IDS_XMLIGNORED"> <source>&lt;!-- Badly formed XML comment ignored for member "{0}" --&gt;</source> <target state="translated">&lt;!-- Badly formed XML comment ignored for member "{0}" --&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_XMLIGNORED2"> <source> Badly formed XML file "{0}" cannot be included </source> <target state="translated"> Il formato XML non è valido. Non è possibile includere il file "{0}" </target> <note /> </trans-unit> <trans-unit id="IDS_XMLFAILEDINCLUDE"> <source> Failed to insert some or all of included XML </source> <target state="translated"> Non è stato possibile inserire alcuni o tutti gli XML inclusi </target> <note /> </trans-unit> <trans-unit id="IDS_XMLBADINCLUDE"> <source> Include tag is invalid </source> <target state="translated"> Il tag di inclusione non è valido </target> <note /> </trans-unit> <trans-unit id="IDS_XMLNOINCLUDE"> <source> No matching elements were found for the following include tag </source> <target state="translated"> Elemento corrispondente non trovato per il seguente tag di inclusione </target> <note /> </trans-unit> <trans-unit id="IDS_XMLMISSINGINCLUDEFILE"> <source>Missing file attribute</source> <target state="translated">Manca l'attributo file</target> <note /> </trans-unit> <trans-unit id="IDS_XMLMISSINGINCLUDEPATH"> <source>Missing path attribute</source> <target state="translated">Manca l'attributo path</target> <note /> </trans-unit> <trans-unit id="IDS_GlobalNamespace"> <source>&lt;global namespace&gt;</source> <target state="translated">&lt;spazio dei nomi globale&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGenerics"> <source>generics</source> <target state="translated">generics</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAnonDelegates"> <source>anonymous methods</source> <target state="translated">metodi anonimi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureModuleAttrLoc"> <source>module as an attribute target specifier</source> <target state="translated">modulo come un identificatore di destinazione dell'attributo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGlobalNamespace"> <source>namespace alias qualifier</source> <target state="translated">qualificatore di alias dello spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureFixedBuffer"> <source>fixed size buffers</source> <target state="translated">buffer a dimensione fissa</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePragma"> <source>#pragma</source> <target state="translated">#pragma</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticClasses"> <source>static classes</source> <target state="translated">classi statiche</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadOnlyStructs"> <source>readonly structs</source> <target state="translated">struct di sola lettura</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePartialTypes"> <source>partial types</source> <target state="translated">tipi parziali</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsync"> <source>async function</source> <target state="translated">funzione asincrona</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureSwitchOnBool"> <source>switch on boolean type</source> <target state="translated">opzione su tipo booleano</target> <note /> </trans-unit> <trans-unit id="IDS_MethodGroup"> <source>method group</source> <target state="translated">gruppo di metodi</target> <note /> </trans-unit> <trans-unit id="IDS_AnonMethod"> <source>anonymous method</source> <target state="translated">metodo anonimo</target> <note /> </trans-unit> <trans-unit id="IDS_Lambda"> <source>lambda expression</source> <target state="translated">espressione lambda</target> <note /> </trans-unit> <trans-unit id="IDS_Collection"> <source>collection</source> <target state="translated">raccolta</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePropertyAccessorMods"> <source>access modifiers on properties</source> <target state="translated">modificatori di accesso sulle proprietà</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExternAlias"> <source>extern alias</source> <target state="translated">alias extern</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureIterators"> <source>iterators</source> <target state="translated">iteratori</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDefault"> <source>default operator</source> <target state="translated">operatore predefinito</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDefaultLiteral"> <source>default literal</source> <target state="translated">valore letterale predefinito</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePrivateProtected"> <source>private protected</source> <target state="translated">private protected</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullable"> <source>nullable types</source> <target state="translated">tipi nullable</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePatternMatching"> <source>pattern matching</source> <target state="translated">criteri di ricerca</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedAccessor"> <source>expression body property accessor</source> <target state="translated">funzione di accesso alla proprietà del corpo dell'espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedDeOrConstructor"> <source>expression body constructor and destructor</source> <target state="translated">costruttore e decostruttore del corpo dell'espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureThrowExpression"> <source>throw expression</source> <target state="translated">espressione throw</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImplicitArray"> <source>implicitly typed array</source> <target state="translated">matrice tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImplicitLocal"> <source>implicitly typed local variable</source> <target state="translated">variabile locale tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAnonymousTypes"> <source>anonymous types</source> <target state="translated">tipi anonimi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAutoImplementedProperties"> <source>automatically implemented properties</source> <target state="translated">proprietà implementate automaticamente</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadonlyAutoImplementedProperties"> <source>readonly automatically implemented properties</source> <target state="translated">proprietà implementate automaticamente di sola lettura</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureObjectInitializer"> <source>object initializer</source> <target state="translated">inizializzatore di oggetto</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureCollectionInitializer"> <source>collection initializer</source> <target state="translated">inizializzatore di raccolta</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureQueryExpression"> <source>query expression</source> <target state="translated">espressione di query</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensionMethod"> <source>extension method</source> <target state="translated">metodo di estensione</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePartialMethod"> <source>partial method</source> <target state="translated">metodo parziale</target> <note /> </trans-unit> <trans-unit id="IDS_SK_METHOD"> <source>method</source> <target state="translated">metodo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_TYPE"> <source>type</source> <target state="translated">tipo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_NAMESPACE"> <source>namespace</source> <target state="translated">spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="IDS_SK_FIELD"> <source>field</source> <target state="translated">campo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_PROPERTY"> <source>property</source> <target state="translated">proprietà</target> <note /> </trans-unit> <trans-unit id="IDS_SK_UNKNOWN"> <source>element</source> <target state="translated">elemento</target> <note /> </trans-unit> <trans-unit id="IDS_SK_VARIABLE"> <source>variable</source> <target state="translated">variabile</target> <note /> </trans-unit> <trans-unit id="IDS_SK_LABEL"> <source>label</source> <target state="translated">etichetta</target> <note /> </trans-unit> <trans-unit id="IDS_SK_EVENT"> <source>event</source> <target state="translated">evento</target> <note /> </trans-unit> <trans-unit id="IDS_SK_TYVAR"> <source>type parameter</source> <target state="translated">parametro di tipo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_ALIAS"> <source>using alias</source> <target state="translated">Using Alias</target> <note /> </trans-unit> <trans-unit id="IDS_SK_EXTERNALIAS"> <source>extern alias</source> <target state="translated">alias extern</target> <note /> </trans-unit> <trans-unit id="IDS_SK_CONSTRUCTOR"> <source>constructor</source> <target state="translated">costruttore</target> <note /> </trans-unit> <trans-unit id="IDS_FOREACHLOCAL"> <source>foreach iteration variable</source> <target state="translated">variabile di iterazione foreach</target> <note /> </trans-unit> <trans-unit id="IDS_FIXEDLOCAL"> <source>fixed variable</source> <target state="translated">variabile fixed</target> <note /> </trans-unit> <trans-unit id="IDS_USINGLOCAL"> <source>using variable</source> <target state="translated">variabile using</target> <note /> </trans-unit> <trans-unit id="IDS_Contravariant"> <source>contravariant</source> <target state="translated">controvariante</target> <note /> </trans-unit> <trans-unit id="IDS_Contravariantly"> <source>contravariantly</source> <target state="translated">in controvarianza</target> <note /> </trans-unit> <trans-unit id="IDS_Covariant"> <source>covariant</source> <target state="translated">covariante</target> <note /> </trans-unit> <trans-unit id="IDS_Covariantly"> <source>covariantly</source> <target state="translated">in covarianza</target> <note /> </trans-unit> <trans-unit id="IDS_Invariantly"> <source>invariantly</source> <target state="translated">in invarianza</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDynamic"> <source>dynamic</source> <target state="translated">dinamico</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNamedArgument"> <source>named argument</source> <target state="translated">argomento denominato</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureOptionalParameter"> <source>optional parameter</source> <target state="translated">parametro facoltativo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExceptionFilter"> <source>exception filter</source> <target state="translated">filtro eccezioni</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTypeVariance"> <source>type variance</source> <target state="translated">varianza dei tipi</target> <note /> </trans-unit> <trans-unit id="NotSameNumberParameterTypesAndRefKinds"> <source>Given {0} parameter types and {1} parameter ref kinds. These arrays must have the same length.</source> <target state="translated">Sono stati specificati {0} tipi di parametro e {1} tipi di modificatore ref di parametro. Queste matrici devono avere la stessa lunghezza.</target> <note /> </trans-unit> <trans-unit id="OutIsNotValidForReturn"> <source>'RefKind.Out' is not a valid ref kind for a return type.</source> <target state="translated">'RefKind.Out' non è un tipo di modificatore ref valido per un tipo restituito.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFound"> <source>SyntaxTree is not part of the compilation</source> <target state="translated">L'elemento SyntaxTree non fa parte della compilazione</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFoundToRemove"> <source>SyntaxTree is not part of the compilation, so it cannot be removed</source> <target state="translated">L'elemento SyntaxTree non fa parte della compilazione, di conseguenza non può essere rimosso</target> <note /> </trans-unit> <trans-unit id="WRN_CaseConstantNamedUnderscore"> <source>The name '_' refers to the constant, not the discard pattern. Use 'var _' to discard the value, or '@_' to refer to a constant by that name.</source> <target state="translated">Il nome '_' fa riferimento alla costante e non al criterio di eliminazione. Usare 'var _' per eliminare il valore oppure '@_' per fare riferimento a una costante in base a tale nome.</target> <note /> </trans-unit> <trans-unit id="WRN_CaseConstantNamedUnderscore_Title"> <source>Do not use '_' for a case constant.</source> <target state="translated">Non usare '_' per una costante di case.</target> <note /> </trans-unit> <trans-unit id="WRN_ConstOutOfRangeChecked"> <source>Constant value '{0}' may overflow '{1}' at runtime (use 'unchecked' syntax to override)</source> <target state="translated">Con il valore di costante '{0}' può verificarsi un overflow di '{1}' in fase di esecuzione. Usare la sintassi 'unchecked' per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="WRN_ConstOutOfRangeChecked_Title"> <source>Constant value may overflow at runtime (use 'unchecked' syntax to override)</source> <target state="translated">Con il valore di costante può verificarsi un overflow in fase di esecuzione. Usare la sintassi 'unchecked' per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="WRN_ConvertingNullableToNonNullable"> <source>Converting null literal or possible null value to non-nullable type.</source> <target state="translated">Conversione del valore letterale Null o di un possibile valore Null in un tipo che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ConvertingNullableToNonNullable_Title"> <source>Converting null literal or possible null value to non-nullable type.</source> <target state="translated">Conversione del valore letterale Null o di un possibile valore Null in un tipo che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_DisallowNullAttributeForbidsMaybeNullAssignment"> <source>A possible null value may not be used for a type marked with [NotNull] or [DisallowNull]</source> <target state="translated">Un possibile valore Null non può essere usato per un tipo contrassegnato con [NotNull] o [DisallowNull]</target> <note /> </trans-unit> <trans-unit id="WRN_DisallowNullAttributeForbidsMaybeNullAssignment_Title"> <source>A possible null value may not be used for a type marked with [NotNull] or [DisallowNull]</source> <target state="translated">Un possibile valore Null non può essere usato per un tipo contrassegnato con [NotNull] o [DisallowNull]</target> <note /> </trans-unit> <trans-unit id="WRN_DoesNotReturnMismatch"> <source>Method '{0}' lacks `[DoesNotReturn]` annotation to match implemented or overridden member.</source> <target state="translated">Nel metodo '{0}' manca l'annotazione `[DoesNotReturn]` per la corrispondenza del membro implementato o di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_DoesNotReturnMismatch_Title"> <source>Method lacks `[DoesNotReturn]` annotation to match implemented or overridden member.</source> <target state="translated">Nel metodo manca l'annotazione `[DoesNotReturn]` per la corrispondenza del membro implementato o di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList"> <source>'{0}' is already listed in the interface list on type '{1}' with different nullability of reference types.</source> <target state="translated">'{0}' è già inclusa nell'elenco di interfacce nel tipo '{1}' con diverso supporto dei valori Null per i tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList_Title"> <source>Interface is already listed in the interface list with different nullability of reference types.</source> <target state="translated">L'interfaccia è già inclusa nell'elenco di interfacce con diverso supporto dei valori Null per i tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration"> <source>Generator '{0}' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Il generatore '{0}' non è riuscito a generare l'origine. Non verrà aggiunto come contributo all'output e potrebbero verificarsi errori di compilazione. Eccezione di tipo '{1}'. Messaggio '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Il generatore dell'analizzatore ha generato l'eccezione seguente: '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Title"> <source>Generator failed to generate source.</source> <target state="translated">Il generatore non è riuscito a generare l'origine.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization"> <source>Generator '{0}' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Non è stato possibile inizializzare il generatore '{0}'. Non verrà aggiunto come contributo all'output e potrebbero verificarsi errori di compilazione. Eccezione di tipo '{1}'. Messaggio '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Il generatore dell'analizzatore ha generato l'eccezione seguente: '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Title"> <source>Generator failed to initialize.</source> <target state="translated">Non è stato possibile inizializzare il generatore.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesConstant"> <source>The given expression always matches the provided constant.</source> <target state="translated">L'espressione specificata corrisponde sempre alla costante fornita.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesConstant_Title"> <source>The given expression always matches the provided constant.</source> <target state="translated">L'espressione specificata corrisponde sempre alla costante fornita.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesPattern"> <source>The given expression always matches the provided pattern.</source> <target state="translated">L'espressione specificata corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesPattern_Title"> <source>The given expression always matches the provided pattern.</source> <target state="translated">L'espressione specificata corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionNeverMatchesPattern"> <source>The given expression never matches the provided pattern.</source> <target state="translated">L'espressione specificata non corrisponde mai al criterio fornito.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionNeverMatchesPattern_Title"> <source>The given expression never matches the provided pattern.</source> <target state="translated">L'espressione specificata non corrisponde mai al criterio fornito.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitCopyInReadOnlyMember"> <source>Call to non-readonly member '{0}' from a 'readonly' member results in an implicit copy of '{1}'.</source> <target state="translated">La chiamata a un membro '{0}' non readonly da un membro 'readonly' comporta una copia esplicita di '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitCopyInReadOnlyMember_Title"> <source>Call to non-readonly member from a 'readonly' member results in an implicit copy.</source> <target state="translated">La chiamata a un membro non readonly da un membro 'readonly' comporta una copia esplicita.</target> <note /> </trans-unit> <trans-unit id="WRN_IsPatternAlways"> <source>An expression of type '{0}' always matches the provided pattern.</source> <target state="translated">Un'espressione di tipo '{0}' corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_IsPatternAlways_Title"> <source>The input always matches the provided pattern.</source> <target state="translated">L'input corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_IsTypeNamedUnderscore"> <source>The name '_' refers to the type '{0}', not the discard pattern. Use '@_' for the type, or 'var _' to discard.</source> <target state="translated">Il nome '_' fa riferimento al tipo '{0}' e non al criterio di eliminazione. Usare '@_' per il tipo oppure 'var _' per eliminare.</target> <note /> </trans-unit> <trans-unit id="WRN_IsTypeNamedUnderscore_Title"> <source>Do not use '_' to refer to the type in an is-type expression.</source> <target state="translated">Non usare '_' per fare riferimento al tipo in un'espressione is-type.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNull"> <source>Member '{0}' must have a non-null value when exiting.</source> <target state="translated">Il membro '{0}' deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullBadMember"> <source>Member '{0}' cannot be used in this attribute.</source> <target state="translated">Non è possibile usare il membro '{0}' in questo attributo.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullBadMember_Title"> <source>Member cannot be used in this attribute.</source> <target state="translated">Non è possibile usare il membro in questo attributo.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullWhen"> <source>Member '{0}' must have a non-null value when exiting with '{1}'.</source> <target state="translated">Il membro '{0}' deve avere un valore non Null quando viene terminato con '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullWhen_Title"> <source>Member must have a non-null value when exiting in some condition.</source> <target state="translated">Il membro deve avere un valore non Null quando viene terminato in determinate condizioni.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNull_Title"> <source>Member must have a non-null value when exiting.</source> <target state="translated">Il membro deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotation"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice in un contesto di annotations '#nullable'.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotationInGeneratedCode"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice all'interno di un contesto di annotazioni '#nullable'. Il codice generato automaticamente richiede una direttiva '#nullable' esplicita nell'origine.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotationInGeneratedCode_Title"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice all'interno di un contesto di annotazioni '#nullable'. Il codice generato automaticamente richiede una direttiva '#nullable' esplicita nell'origine.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotation_Title"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice in un contesto di annotations '#nullable'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullAsNonNullable"> <source>Cannot convert null literal to non-nullable reference type.</source> <target state="translated">Non è possibile convertire il valore letterale Null in tipo riferimento che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullAsNonNullable_Title"> <source>Cannot convert null literal to non-nullable reference type.</source> <target state="translated">Non è possibile convertire il valore letterale Null in tipo riferimento che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceArgument"> <source>Possible null reference argument for parameter '{0}' in '{1}'.</source> <target state="translated">Possibile argomento di riferimento Null per il parametro '{0}' in '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceArgument_Title"> <source>Possible null reference argument.</source> <target state="translated">Possibile argomento di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceAssignment"> <source>Possible null reference assignment.</source> <target state="translated">Possibile assegnazione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceAssignment_Title"> <source>Possible null reference assignment.</source> <target state="translated">Possibile assegnazione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceInitializer"> <source>Object or collection initializer implicitly dereferences possibly null member '{0}'.</source> <target state="translated">L'inizializzatore di oggetto o di raccolta dereferenzia in modo implicito il membro Null '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceInitializer_Title"> <source>Object or collection initializer implicitly dereferences possibly null member.</source> <target state="translated">L'inizializzatore di oggetto o di raccolta dereferenzia in modo implicito il membro Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReceiver"> <source>Dereference of a possibly null reference.</source> <target state="translated">Dereferenziamento di un possibile riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReceiver_Title"> <source>Dereference of a possibly null reference.</source> <target state="translated">Dereferenziamento di un possibile riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReturn"> <source>Possible null reference return.</source> <target state="translated">Possibile restituzione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReturn_Title"> <source>Possible null reference return.</source> <target state="translated">Possibile restituzione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgument"> <source>Argument of type '{0}' cannot be used for parameter '{2}' of type '{1}' in '{3}' due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento di tipo '{0}' per il parametro '{2}' di tipo '{1}' in '{3}' a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgumentForOutput"> <source>Argument of type '{0}' cannot be used as an output of type '{1}' for parameter '{2}' in '{3}' due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento di tipo '{0}' come output del tipo '{1}' per il parametro '{2}' in '{3}' a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgumentForOutput_Title"> <source>Argument cannot be used as an output for parameter due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento come output per il parametro a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgument_Title"> <source>Argument cannot be used for parameter due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento per il parametro a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInAssignment"> <source>Nullability of reference types in value of type '{0}' doesn't match target type '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel valore di tipo '{0}' non corrisponde al tipo di destinazione '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInAssignment_Title"> <source>Nullability of reference types in value doesn't match target type.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel valore non corrisponde al tipo di destinazione.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnImplicitImplementation"> <source>Nullability in constraints for type parameter '{0}' of method '{1}' doesn't match the constraints for type parameter '{2}' of interface method '{3}'. Consider using an explicit interface implementation instead.</source> <target state="translated">Il supporto dei valori Null nei vincoli per il parametro di tipo '{0}' del metodo '{1}' non corrisponde ai vincoli per il parametro di tipo '{2}' del metodo di interfaccia '{3}'. Provare a usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnImplicitImplementation_Title"> <source>Nullability in constraints for type parameter doesn't match the constraints for type parameter in implicitly implemented interface method'.</source> <target state="translated">Il supporto dei valori Null nei vincoli del parametro di tipo non corrisponde ai vincoli per il parametro di tipo nel metodo di interfaccia implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation"> <source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source> <target state="translated">Le dichiarazioni di metodo parziali di '{0}' contengono un supporto dei valori Null incoerente nei vincoli per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title"> <source>Partial method declarations have inconsistent nullability in constraints for type parameter</source> <target state="translated">Le dichiarazioni di metodo parziali contengono un supporto dei valori Null incoerente nei vincoli per il parametro di tipo</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface"> <source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nell'identificatore di interfaccia esplicito non corrisponde all'interfaccia implementata dal tipo.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface_Title"> <source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nell'identificatore di interfaccia esplicito non corrisponde all'interfaccia implementata dal tipo.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInInterfaceImplementedByBase"> <source>'{0}' does not implement interface member '{1}'. Nullability of reference types in interface implemented by the base type doesn't match.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. Il supporto dei valori Null dei tipi riferimento nell'interfaccia implementata dal tipo di base non corrisponde.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInInterfaceImplementedByBase_Title"> <source>Type does not implement interface member. Nullability of reference types in interface implemented by the base type doesn't match.</source> <target state="translated">Il tipo non implementa il membro di interfaccia. Il supporto dei valori Null dei tipi riferimento nell'interfaccia implementata dal tipo di base non corrisponde.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOfTargetDelegate"> <source>Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match the target delegate '{2}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' di '{1}' non corrisponde al delegato di destinazione '{2}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOfTargetDelegate_Title"> <source>Nullability of reference types in type of parameter doesn't match the target delegate (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al delegato di destinazione, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' doesn't match implemented member '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde al membro implementato '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match implicitly implemented member '{2}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' di '{1}' non corrisponde al membro implementato in modo implicito '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implicitly implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnOverride"> <source>Nullability of reference types in type of parameter '{0}' doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnOverride_Title"> <source>Nullability of reference types in type of parameter doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnPartial"> <source>Nullability of reference types in type of parameter '{0}' doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnPartial_Title"> <source>Nullability of reference types in type of parameter doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOfTargetDelegate"> <source>Nullability of reference types in return type of '{0}' doesn't match the target delegate '{1}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito di '{0}' non corrisponde al delegato di destinazione '{1}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOfTargetDelegate_Title"> <source>Nullability of reference types in return type doesn't match the target delegate (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al delegato di destinazione, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation"> <source>Nullability of reference types in return type doesn't match implemented member '{0}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation"> <source>Nullability of reference types in return type of '{0}' doesn't match implicitly implemented member '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito di '{0}' non corrisponde al membro implementato in modo implicito '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implicitly implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnOverride"> <source>Nullability of reference types in return type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnOverride_Title"> <source>Nullability of reference types in return type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnPartial"> <source>Nullability of reference types in return type doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnPartial_Title"> <source>Nullability of reference types in return type doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnExplicitImplementation"> <source>Nullability of reference types in type doesn't match implemented member '{0}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro implementato '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in type doesn't match implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro implementato.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnImplicitImplementation"> <source>Nullability of reference types in type of '{0}' doesn't match implicitly implemented member '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di '{0}' non corrisponde al membro implementato in modo implicito '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in type doesn't match implicitly implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnOverride"> <source>Nullability of reference types in type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnOverride_Title"> <source>Nullability of reference types in type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterConstraint"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. Nullability of type argument '{3}' doesn't match constraint type '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Il supporto dei valori Null dell'argomento di tipo '{3}' non corrisponde al tipo di vincolo '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterConstraint_Title"> <source>The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match constraint type.</source> <target state="translated">Non è possibile usare il tipo come parametro di tipo nel tipo generico o nel metodo. Il supporto dei valori Null dell'argomento tipo non corrisponde al tipo di vincolo.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterNotNullConstraint"> <source>The type '{2}' cannot be used as type parameter '{1}' in the generic type or method '{0}'. Nullability of type argument '{2}' doesn't match 'notnull' constraint.</source> <target state="translated">Non è possibile usare il tipo '{2}' come parametro di tipo '{1}' nel tipo generico o nel metodo '{0}'. Il supporto dei valori Null dell'argomento tipo '{2}' non corrisponde al vincolo 'notnull'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterNotNullConstraint_Title"> <source>The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'notnull' constraint.</source> <target state="translated">Non è possibile usare il tipo come parametro di tipo nel tipo generico o nel metodo. Il supporto dei valori Null dell'argomento tipo non corrisponde al vincolo 'notnull'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint"> <source>The type '{2}' cannot be used as type parameter '{1}' in the generic type or method '{0}'. Nullability of type argument '{2}' doesn't match 'class' constraint.</source> <target state="translated">Non è possibile usare il tipo '{2}' come parametro di tipo '{1}' nel tipo generico o nel metodo '{0}'. Il supporto dei valori Null dell'argomento tipo '{2}' non corrisponde al vincolo 'class'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint_Title"> <source>The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'class' constraint.</source> <target state="translated">Non è possibile usare il tipo come parametro di tipo nel tipo generico o nel metodo. Il supporto dei valori Null dell'argomento tipo non corrisponde al vincolo 'class'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullableValueTypeMayBeNull"> <source>Nullable value type may be null.</source> <target state="translated">Il tipo valore nullable non può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullableValueTypeMayBeNull_Title"> <source>Nullable value type may be null.</source> <target state="translated">Il tipo valore nullable non può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ParamUnassigned"> <source>The out parameter '{0}' must be assigned to before control leaves the current method</source> <target state="translated">Il parametro out '{0}' deve essere assegnato prima che il controllo lasci il metodo corrente</target> <note /> </trans-unit> <trans-unit id="WRN_ParamUnassigned_Title"> <source>An out parameter must be assigned to before control leaves the method</source> <target state="translated">È necessario assegnare un parametro out prima che il controllo esca dal metodo</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterConditionallyDisallowsNull"> <source>Parameter '{0}' must have a non-null value when exiting with '{1}'.</source> <target state="translated">Il parametro '{0}' deve avere un valore non Null quando viene terminato con '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterConditionallyDisallowsNull_Title"> <source>Parameter must have a non-null value when exiting in some condition.</source> <target state="translated">Il parametro deve avere un valore non Null quando viene terminato in determinate condizioni.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterDisallowsNull"> <source>Parameter '{0}' must have a non-null value when exiting.</source> <target state="translated">Il parametro '{0}' deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterDisallowsNull_Title"> <source>Parameter must have a non-null value when exiting.</source> <target state="translated">Il parametro deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterIsStaticClass"> <source>'{0}': static types cannot be used as parameters</source> <target state="translated">'{0}': i tipi statici non possono essere usati come parametri</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterIsStaticClass_Title"> <source>Static types cannot be used as parameters</source> <target state="translated">I tipi statici non possono essere usati come parametri</target> <note /> </trans-unit> <trans-unit id="WRN_PrecedenceInversion"> <source>Operator '{0}' cannot be used here due to precedence. Use parentheses to disambiguate.</source> <target state="translated">A causa della precedenza, non è possibile usare l'operatore '{0}' in questo punto. Usare le parentesi per evitare ambiguità.</target> <note /> </trans-unit> <trans-unit id="WRN_PrecedenceInversion_Title"> <source>Operator cannot be used here due to precedence.</source> <target state="translated">A causa della precedenza, non è possibile usare l'operatore in questo punto.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternNotPublicOrNotInstance"> <source>'{0}' does not implement the '{1}' pattern. '{2}' is not a public instance or extension method.</source> <target state="translated">'{0}' non implementa il criterio '{1}'. '{2}' non è un metodo di estensione o istanza pubblico.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternNotPublicOrNotInstance_Title"> <source>Type does not implement the collection pattern; member is is not a public instance or extension method.</source> <target state="translated">Il tipo non implementa il criterio di raccolta. Il membro non è un metodo di estensione o istanza pubblico.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeIsStaticClass"> <source>'{0}': static types cannot be used as return types</source> <target state="translated">'{0}': i tipi statici non possono essere usati come tipi restituiti</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeIsStaticClass_Title"> <source>Static types cannot be used as return types</source> <target state="translated">I tipi statici non possono essere usati come tipi restituiti</target> <note /> </trans-unit> <trans-unit id="WRN_ShouldNotReturn"> <source>A method marked [DoesNotReturn] should not return.</source> <target state="translated">Un metodo contrassegnato con [DoesNotReturn] non deve essere terminare normalmente.</target> <note /> </trans-unit> <trans-unit id="WRN_ShouldNotReturn_Title"> <source>A method marked [DoesNotReturn] should not return.</source> <target state="translated">Un metodo contrassegnato con [DoesNotReturn] non deve essere terminare normalmente.</target> <note /> </trans-unit> <trans-unit id="WRN_StaticInAsOrIs"> <source>The second operand of an 'is' or 'as' operator may not be static type '{0}'</source> <target state="translated">Il secondo operando di un operatore 'is' o 'as' non può essere di tipo statico '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_StaticInAsOrIs_Title"> <source>The second operand of an 'is' or 'as' operator may not be a static type</source> <target state="translated">Il secondo operando di un operatore 'is' o 'as' non può essere un tipo statico</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustive"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '{0}' is not covered.</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNull"> <source>The switch expression does not handle some null inputs (it is not exhaustive). For example, the pattern '{0}' is not covered.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNullWithWhen"> <source>The switch expression does not handle some null inputs (it is not exhaustive). For example, the pattern '{0}' is not covered. However, a pattern with a 'when' clause might successfully match this value.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto. Un criterio con una clausola 'when' potrebbe però corrispondere a questo valore.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNullWithWhen_Title"> <source>The switch expression does not handle some null inputs.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNull_Title"> <source>The switch expression does not handle some null inputs.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithWhen"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '{0}' is not covered. However, a pattern with a 'when' clause might successfully match this value.</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto. Un criterio con una clausola 'when' potrebbe però corrispondere a questo valore.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithWhen_Title"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive).</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva).</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustive_Title"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive).</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva).</target> <note /> </trans-unit> <trans-unit id="WRN_ThrowPossibleNull"> <source>Thrown value may be null.</source> <target state="translated">Il valore generato può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ThrowPossibleNull_Title"> <source>Thrown value may be null.</source> <target state="translated">Il valore generato può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' doesn't match implemented member '{1}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde al membro implementato '{1}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match implicitly implemented member '{2}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' di '{1}' non corrisponde al membro implementato in modo implicito '{2}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato in modo implicito, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride"> <source>Nullability of type of parameter '{0}' doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo del parametro '{0}' non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride_Title"> <source>Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo del parametro non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation"> <source>Nullability of reference types in return type doesn't match implemented member '{0}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato '{0}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation"> <source>Nullability of reference types in return type of '{0}' doesn't match implicitly implemented member '{1}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito di '{0}' non corrisponde al membro implementato in modo implicito '{1}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato in modo implicito, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride"> <source>Nullability of return type doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo restituito non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride_Title"> <source>Nullability of return type doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo restituito non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleBinopLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator.</source> <target state="translated">Il nome dell'elemento di tupla '{0}' viene ignorato perché nell'altra parte dell'operatore == o != di tupla è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleBinopLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator.</source> <target state="translated">Il nome dell'elemento di tupla viene ignorato perché nell'altra parte dell'operatore == o != di tupla è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterMethodTypeParameter"> <source>Type parameter '{0}' has the same name as the type parameter from outer method '{1}'</source> <target state="translated">Il nome del parametro di tipo '{0}' è uguale a quello del parametro di tipo del metodo esterno '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterMethodTypeParameter_Title"> <source>Type parameter has the same type as the type parameter from outer method.</source> <target state="translated">Il tipo del parametro di tipo è lo stesso del parametro di tipo del metodo esterno.</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThis"> <source>Field '{0}' must be fully assigned before control is returned to the caller</source> <target state="translated">Il campo '{0}' deve essere assegnato completamente prima che il controllo venga restituito al chiamante</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThisAutoProperty"> <source>Auto-implemented property '{0}' must be fully assigned before control is returned to the caller.</source> <target state="translated">La proprietà implementata automaticamente '{0}' deve essere completamente assegnata prima che il controllo venga restituito al chiamante.</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThisAutoProperty_Title"> <source>An auto-implemented property must be fully assigned before control is returned to the caller.</source> <target state="translated">È necessario assegnare completamente una proprietà implementata automaticamente prima che il controllo venga restituito al chiamante.</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThis_Title"> <source>Fields of a struct must be fully assigned in a constructor before control is returned to the caller</source> <target state="translated">È necessario assegnare completamente i campi di uno struct in un costruttore prima che il controllo venga restituito al chiamante</target> <note /> </trans-unit> <trans-unit id="WRN_UnboxPossibleNull"> <source>Unboxing a possibly null value.</source> <target state="translated">Conversione unboxing di un possibile valore Null.</target> <note /> </trans-unit> <trans-unit id="WRN_UnboxPossibleNull_Title"> <source>Unboxing a possibly null value.</source> <target state="translated">Conversione unboxing di un possibile valore Null.</target> <note /> </trans-unit> <trans-unit id="WRN_UnconsumedEnumeratorCancellationAttributeUsage"> <source>The EnumeratorCancellationAttribute applied to parameter '{0}' will have no effect. The attribute is only effective on a parameter of type CancellationToken in an async-iterator method returning IAsyncEnumerable</source> <target state="translated">L'attributo EnumeratorCancellationAttribute applicato al parametro '{0}' non avrà alcun effetto. L'attributo ha effetto solo su un parametro di tipo CancellationToken in un metodo di iteratore asincrono che restituisce IAsyncEnumerable</target> <note /> </trans-unit> <trans-unit id="WRN_UnconsumedEnumeratorCancellationAttributeUsage_Title"> <source>The EnumeratorCancellationAttribute will have no effect. The attribute is only effective on a parameter of type CancellationToken in an async-iterator method returning IAsyncEnumerable</source> <target state="translated">L'attributo EnumeratorCancellationAttribute non avrà alcun effetto. L'attributo ha effetto solo su un parametro di tipo CancellationToken in un metodo di iteratore asincrono che restituisce IAsyncEnumerable</target> <note /> </trans-unit> <trans-unit id="WRN_UndecoratedCancellationTokenParameter"> <source>Async-iterator '{0}' has one or more parameters of type 'CancellationToken' but none of them is decorated with the 'EnumeratorCancellation' attribute, so the cancellation token parameter from the generated 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' will be unconsumed</source> <target state="translated">L'elemento '{0}' di iteratore asincrono include uno o più parametri di tipo 'CancellationToken', ma nessuno di essi è decorato con l'attributo 'EnumeratorCancellation', di conseguenza il parametro del token di annullamento restituito dall'elemento 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' generato non verrà utilizzato</target> <note /> </trans-unit> <trans-unit id="WRN_UndecoratedCancellationTokenParameter_Title"> <source>Async-iterator member has one or more parameters of type 'CancellationToken' but none of them is decorated with the 'EnumeratorCancellation' attribute, so the cancellation token parameter from the generated 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' will be unconsumed</source> <target state="translated">Il membro di iteratore asincrono include uno o più parametri di tipo 'CancellationToken', ma nessuno di essi è decorato con l'attributo 'EnumeratorCancellation', di conseguenza il parametro del token di annullamento restituito dall'elemento 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' generato non verrà utilizzato</target> <note /> </trans-unit> <trans-unit id="WRN_UninitializedNonNullableField"> <source>Non-nullable {0} '{1}' must contain a non-null value when exiting constructor. Consider declaring the {0} as nullable.</source> <target state="translated">L'elemento {0} '{1}' non nullable deve contenere un valore non Null all'uscita dal costruttore. Provare a dichiarare {0} come nullable.</target> <note /> </trans-unit> <trans-unit id="WRN_UninitializedNonNullableField_Title"> <source>Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.</source> <target state="translated">Il campo non nullable deve contenere un valore non Null all'uscita dal costruttore. Provare a dichiararlo come nullable.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreadRecordParameter"> <source>Parameter '{0}' is unread. Did you forget to use it to initialize the property with that name?</source> <target state="translated">Il parametro '{0}' non è stato letto. Si è dimenticato di usarlo per inizializzare la proprietà con tale nome?</target> <note /> </trans-unit> <trans-unit id="WRN_UnreadRecordParameter_Title"> <source>Parameter is unread. Did you forget to use it to initialize the property with that name?</source> <target state="translated">Il parametro non è stato letto. Si è dimenticato di usarlo per inizializzare la proprietà con tale nome?</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolation"> <source>Use of unassigned local variable '{0}'</source> <target state="translated">Uso della variabile locale '{0}' non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationField"> <source>Use of possibly unassigned field '{0}'</source> <target state="translated">Uso del campo '{0}' probabilmente non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationField_Title"> <source>Use of possibly unassigned field</source> <target state="translated">Uso del campo probabilmente non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationOut"> <source>Use of unassigned out parameter '{0}'</source> <target state="translated">Uso del parametro out '{0}' non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationOut_Title"> <source>Use of unassigned out parameter</source> <target state="translated">Uso del parametro out non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationProperty"> <source>Use of possibly unassigned auto-implemented property '{0}'</source> <target state="translated">Uso della proprietà implementata automaticamente '{0}' probabilmente non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationProperty_Title"> <source>Use of possibly unassigned auto-implemented property</source> <target state="translated">Uso della proprietà implementata automaticamente probabilmente non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationThis"> <source>The 'this' object cannot be used before all of its fields have been assigned</source> <target state="translated">Non è possibile usare l'oggetto 'this' prima dell'assegnazione di tutti i relativi campi</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationThis_Title"> <source>The 'this' object cannot be used in a constructor before all of its fields have been assigned</source> <target state="translated">Non è possibile usare l'oggetto 'this' in un costruttore prima dell'assegnazione di tutti i relativi campi</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolation_Title"> <source>Use of unassigned local variable</source> <target state="translated">Uso della variabile locale non assegnata</target> <note /> </trans-unit> <trans-unit id="XML_InvalidToken"> <source>The character(s) '{0}' cannot be used at this location.</source> <target state="translated">Non è possibile usare il carattere o i caratteri '{0}' in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_IncorrectComment"> <source>Incorrect syntax was used in a comment.</source> <target state="translated">In un commento è stato usata sintassi errata.</target> <note /> </trans-unit> <trans-unit id="XML_InvalidCharEntity"> <source>An invalid character was found inside an entity reference.</source> <target state="translated">All'interno di un riferimento di entità è stato trovato un carattere non valido.</target> <note /> </trans-unit> <trans-unit id="XML_ExpectedEndOfTag"> <source>Expected '&gt;' or '/&gt;' to close tag '{0}'.</source> <target state="translated">È previsto '&gt;' o '/&gt;' come tag di chiusura '{0}'.</target> <note /> </trans-unit> <trans-unit id="XML_ExpectedIdentifier"> <source>An identifier was expected.</source> <target state="translated">Era previsto un identificatore.</target> <note /> </trans-unit> <trans-unit id="XML_InvalidUnicodeChar"> <source>Invalid unicode character.</source> <target state="translated">Il carattere Unicode non è valido.</target> <note /> </trans-unit> <trans-unit id="XML_InvalidWhitespace"> <source>Whitespace is not allowed at this location.</source> <target state="translated">Lo spazio vuoto non è consentito in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_LessThanInAttributeValue"> <source>The character '&lt;' cannot be used in an attribute value.</source> <target state="translated">Non è possibile usare il carattere '&lt;' in un valore di attributo.</target> <note /> </trans-unit> <trans-unit id="XML_MissingEqualsAttribute"> <source>Missing equals sign between attribute and attribute value.</source> <target state="translated">Manca il segno di uguale tra l'attributo e il valore di attributo.</target> <note /> </trans-unit> <trans-unit id="XML_RefUndefinedEntity_1"> <source>Reference to undefined entity '{0}'.</source> <target state="translated">Riferimento a un'entità '{0}' non definita.</target> <note /> </trans-unit> <trans-unit id="XML_StringLiteralNoStartQuote"> <source>A string literal was expected, but no opening quotation mark was found.</source> <target state="translated">Era previsto un valore letterale di tipo stringa, ma non sono state trovate virgolette inglesi aperte.</target> <note /> </trans-unit> <trans-unit id="XML_StringLiteralNoEndQuote"> <source>Missing closing quotation mark for string literal.</source> <target state="translated">Mancano le virgolette inglesi chiuse per il valore letterale di tipo stringa.</target> <note /> </trans-unit> <trans-unit id="XML_StringLiteralNonAsciiQuote"> <source>Non-ASCII quotations marks may not be used around string literals.</source> <target state="translated">Non è possibile usare virgolette non ASCII per racchiudere valori letterali di tipo stringa.</target> <note /> </trans-unit> <trans-unit id="XML_EndTagNotExpected"> <source>End tag was not expected at this location.</source> <target state="translated">Il tag finale non era previsto in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_ElementTypeMatch"> <source>End tag '{0}' does not match the start tag '{1}'.</source> <target state="translated">Il tag finale '{0}' non corrisponde al tag iniziale '{1}'.</target> <note /> </trans-unit> <trans-unit id="XML_EndTagExpected"> <source>Expected an end tag for element '{0}'.</source> <target state="translated">È previsto un tag finale per l'elemento '{0}'.</target> <note /> </trans-unit> <trans-unit id="XML_WhitespaceMissing"> <source>Required white space was missing.</source> <target state="translated">Manca lo spazio vuoto obbligatorio.</target> <note /> </trans-unit> <trans-unit id="XML_ExpectedEndOfXml"> <source>Unexpected character at this location.</source> <target state="translated">Il carattere non è previsto in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_CDataEndTagNotAllowed"> <source>The literal string ']]&gt;' is not allowed in element content.</source> <target state="translated">La stringa letterale ']]&gt;' non è consentita nel contenuto dell'elemento.</target> <note /> </trans-unit> <trans-unit id="XML_DuplicateAttribute"> <source>Duplicate '{0}' attribute</source> <target state="translated">L'attributo '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_NoMetadataFile"> <source>Metadata file '{0}' could not be found</source> <target state="translated">Il file di metadati '{0}' non è stato trovato</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataReferencesNotSupported"> <source>Metadata references are not supported.</source> <target state="translated">I riferimenti ai metadati non sono supportati.</target> <note /> </trans-unit> <trans-unit id="FTL_MetadataCantOpenFile"> <source>Metadata file '{0}' could not be opened -- {1}</source> <target state="translated">Non è possibile aprire il file di metadati '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeDef"> <source>The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'.</source> <target state="translated">Il tipo '{0}' è definito in un assembly di cui manca il riferimento. Aggiungere un riferimento all'assembly '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeDefFromModule"> <source>The type '{0}' is defined in a module that has not been added. You must add the module '{1}'.</source> <target state="translated">Il tipo '{0}' è definito in un modulo che non è stato ancora aggiunto. È necessario aggiungere il modulo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OutputWriteFailed"> <source>Could not write to output file '{0}' -- '{1}'</source> <target state="translated">Non è possibile scrivere nel file di output '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEntryPoints"> <source>Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.</source> <target state="translated">Nel programma è definito più di un punto di ingresso. Compilare con /main per specificare il tipo contenente il punto di ingresso.</target> <note /> </trans-unit> <trans-unit id="ERR_BadBinaryOps"> <source>Operator '{0}' cannot be applied to operands of type '{1}' and '{2}'</source> <target state="translated">Non è possibile applicare l'operatore '{0}' a operandi di tipo '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_IntDivByZero"> <source>Division by constant zero</source> <target state="translated">Divisione per la costante zero</target> <note /> </trans-unit> <trans-unit id="ERR_BadIndexLHS"> <source>Cannot apply indexing with [] to an expression of type '{0}'</source> <target state="translated">Non è possibile applicare l'indicizzazione con [] a un'espressione di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadIndexCount"> <source>Wrong number of indices inside []; expected {0}</source> <target state="translated">Il numero di indici in [] è errato. Il numero previsto è {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadUnaryOp"> <source>Operator '{0}' cannot be applied to operand of type '{1}'</source> <target state="translated">Non è possibile applicare l'operatore '{0}' all'operando di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ThisInStaticMeth"> <source>Keyword 'this' is not valid in a static property, static method, or static field initializer</source> <target state="translated">La parola chiave 'this' non può essere utilizzata in una proprietà statica, in un metodo statico o nell'inizializzatore di un campo statico</target> <note /> </trans-unit> <trans-unit id="ERR_ThisInBadContext"> <source>Keyword 'this' is not available in the current context</source> <target state="translated">La parola chiave 'this' non è disponibile nel contesto corrente</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidMainSig"> <source>'{0}' has the wrong signature to be an entry point</source> <target state="translated">'{0}' non può essere un punto di ingresso perché la firma è errata</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidMainSig_Title"> <source>Method has the wrong signature to be an entry point</source> <target state="translated">Il metodo non può essere un punto di ingresso perché la firma è errata</target> <note /> </trans-unit> <trans-unit id="ERR_NoImplicitConv"> <source>Cannot implicitly convert type '{0}' to '{1}'</source> <target state="translated">Non è possibile convertire in modo implicito il tipo '{0}' in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitConv"> <source>Cannot convert type '{0}' to '{1}'</source> <target state="translated">Non è possibile convertire il tipo '{0}' in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstOutOfRange"> <source>Constant value '{0}' cannot be converted to a '{1}'</source> <target state="translated">Non è possibile convertire il valore costante '{0}' in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigBinaryOps"> <source>Operator '{0}' is ambiguous on operands of type '{1}' and '{2}'</source> <target state="translated">L'operatore '{0}' è ambiguo su operandi di tipo '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigUnaryOp"> <source>Operator '{0}' is ambiguous on an operand of type '{1}'</source> <target state="translated">L'operatore '{0}' è ambiguo su un operando di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_InAttrOnOutParam"> <source>An out parameter cannot have the In attribute</source> <target state="translated">Un parametro out non può avere l'attributo In</target> <note /> </trans-unit> <trans-unit id="ERR_ValueCantBeNull"> <source>Cannot convert null to '{0}' because it is a non-nullable value type</source> <target state="translated">Non è possibile convertire Null in '{0}' perché è un tipo valore che non ammette i valori Null</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitBuiltinConv"> <source>Cannot convert type '{0}' to '{1}' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion</source> <target state="translated">Non è possibile convertire il tipo '{0}' in '{1}' tramite una conversione di riferimenti, una conversione boxing, una conversione unboxing, una conversione wrapping o una conversione del tipo Null</target> <note /> </trans-unit> <trans-unit id="FTL_DebugEmitFailure"> <source>Unexpected error writing debug information -- '{0}'</source> <target state="translated">Si è verificato un errore imprevisto durante la scrittura delle informazioni di debug - '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisReturnType"> <source>Inconsistent accessibility: return type '{1}' is less accessible than method '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo restituito '{1}' è meno accessibile del metodo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisParamType"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than method '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile del metodo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisFieldType"> <source>Inconsistent accessibility: field type '{1}' is less accessible than field '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di campo '{1}' è meno accessibile del campo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisPropertyType"> <source>Inconsistent accessibility: property type '{1}' is less accessible than property '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di proprietà '{1}' è meno accessibile della proprietà '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisIndexerReturn"> <source>Inconsistent accessibility: indexer return type '{1}' is less accessible than indexer '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di indicizzatore restituito '{1}' è meno accessibile dell'indicizzatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisIndexerParam"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than indexer '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile dell'indicizzatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisOpReturn"> <source>Inconsistent accessibility: return type '{1}' is less accessible than operator '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo restituito '{1}' è meno accessibile dell'operatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisOpParam"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than operator '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile dell'operatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisDelegateReturn"> <source>Inconsistent accessibility: return type '{1}' is less accessible than delegate '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo restituito '{1}' è meno accessibile del delegato '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisDelegateParam"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than delegate '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile del delegato '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisBaseClass"> <source>Inconsistent accessibility: base class '{1}' is less accessible than class '{0}'</source> <target state="translated">Accessibilità incoerente: la classe base '{1}' è meno accessibile della classe '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisBaseInterface"> <source>Inconsistent accessibility: base interface '{1}' is less accessible than interface '{0}'</source> <target state="translated">Accessibilità incoerente: l'interfaccia di base '{1}' è meno accessibile dell'interfaccia '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_EventNeedsBothAccessors"> <source>'{0}': event property must have both add and remove accessors</source> <target state="translated">'{0}': la proprietà dell'evento deve avere entrambe le funzioni di accesso add e remove</target> <note /> </trans-unit> <trans-unit id="ERR_EventNotDelegate"> <source>'{0}': event must be of a delegate type</source> <target state="translated">'{0}': l'evento deve essere di un tipo delegato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedEvent"> <source>The event '{0}' is never used</source> <target state="translated">L'evento '{0}' non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedEvent_Title"> <source>Event is never used</source> <target state="translated">L'evento non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceEventInitializer"> <source>'{0}': instance event in interface cannot have initializer</source> <target state="translated">'{0}': l'evento di istanza nell'interfaccia non può avere inizializzatori</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventUsage"> <source>The event '{0}' can only appear on the left hand side of += or -= (except when used from within the type '{1}')</source> <target state="translated">L'evento '{0}' può essere specificato solo sul lato sinistro di += o di -= (tranne quando è usato dall'interno del tipo '{1}')</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitEventFieldImpl"> <source>An explicit interface implementation of an event must use event accessor syntax</source> <target state="translated">Per l'implementazione esplicita dell'interfaccia di un evento è necessario utilizzare la sintassi della funzione di accesso agli eventi</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonEvent"> <source>'{0}': cannot override; '{1}' is not an event</source> <target state="translated">'{0}': non è possibile eseguire l'override. '{1}' non è un evento</target> <note /> </trans-unit> <trans-unit id="ERR_AddRemoveMustHaveBody"> <source>An add or remove accessor must have a body</source> <target state="translated">Una funzione di accesso add o remove deve avere un corpo</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractEventInitializer"> <source>'{0}': abstract event cannot have initializer</source> <target state="translated">'{0}': l'evento astratto non può avere inizializzatori</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedAssemblyName"> <source>The assembly name '{0}' is reserved and cannot be used as a reference in an interactive session</source> <target state="translated">Il nome di assembly '{0}' è riservato e non può essere usato come riferimento in una sessione interattiva</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedEnumerator"> <source>The enumerator name '{0}' is reserved and cannot be used</source> <target state="translated">Il nome dell'enumeratore '{0}' è riservato e non può essere usato</target> <note /> </trans-unit> <trans-unit id="ERR_AsMustHaveReferenceType"> <source>The as operator must be used with a reference type or nullable type ('{0}' is a non-nullable value type)</source> <target state="translated">L'operatore as deve essere usato con un tipo riferimento o con un tipo che ammette i valori Null ('{0}' è un tipo valore che non ammette i valori Null)</target> <note /> </trans-unit> <trans-unit id="WRN_LowercaseEllSuffix"> <source>The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity</source> <target state="translated">Il suffisso 'l' è facilmente confondibile con il numero '1': per maggiore chiarezza utilizzare 'L'</target> <note /> </trans-unit> <trans-unit id="WRN_LowercaseEllSuffix_Title"> <source>The 'l' suffix is easily confused with the digit '1'</source> <target state="translated">Il suffisso 'l' è facilmente confondibile con il numero '1'</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventUsageNoField"> <source>The event '{0}' can only appear on the left hand side of += or -=</source> <target state="translated">L'evento '{0}' può essere specificato solo sul lato sinistro di += o di -=</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintOnlyAllowedOnGenericDecl"> <source>Constraints are not allowed on non-generic declarations</source> <target state="translated">Vincoli non consentiti su dichiarazioni non generiche</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMustBeIdentifier"> <source>Type parameter declaration must be an identifier not a type</source> <target state="translated">La dichiarazione del parametro di tipo deve essere un identificatore anziché un tipo</target> <note /> </trans-unit> <trans-unit id="ERR_MemberReserved"> <source>Type '{1}' already reserves a member called '{0}' with the same parameter types</source> <target state="translated">Il tipo '{1}' riserva già un membro denominato '{0}' con gli stessi tipi di parametro</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParamName"> <source>The parameter name '{0}' is a duplicate</source> <target state="translated">Il nome di parametro '{0}' è un duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNameInNS"> <source>The namespace '{1}' already contains a definition for '{0}'</source> <target state="translated">Lo spazio dei nomi '{1}' contiene già una definizione per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNameInClass"> <source>The type '{0}' already contains a definition for '{1}'</source> <target state="translated">Il tipo '{0}' contiene già una definizione per '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotInContext"> <source>The name '{0}' does not exist in the current context</source> <target state="translated">Il nome '{0}' non esiste nel contesto corrente</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotInContextPossibleMissingReference"> <source>The name '{0}' does not exist in the current context (are you missing a reference to assembly '{1}'?)</source> <target state="translated">Il nome '{0}' non esiste nel contesto corrente. Probabilmente manca un riferimento all'assembly '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigContext"> <source>'{0}' is an ambiguous reference between '{1}' and '{2}'</source> <target state="translated">'{0}' è un riferimento ambiguo tra '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateUsing"> <source>The using directive for '{0}' appeared previously in this namespace</source> <target state="translated">La direttiva using per '{0}' è già presente in questo spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateUsing_Title"> <source>Using directive appeared previously in this namespace</source> <target state="translated">La direttiva using è già presente in questo spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="ERR_BadMemberFlag"> <source>The modifier '{0}' is not valid for this item</source> <target state="translated">Il modificatore '{0}' non è valido per questo elemento</target> <note /> </trans-unit> <trans-unit id="ERR_BadMemberProtection"> <source>More than one protection modifier</source> <target state="translated">Sono presenti più modificatori di protezione</target> <note /> </trans-unit> <trans-unit id="WRN_NewRequired"> <source>'{0}' hides inherited member '{1}'. Use the new keyword if hiding was intended.</source> <target state="translated">'{0}' nasconde il membro ereditato '{1}'. Se questo comportamento è intenzionale, usare la parola chiave new.</target> <note /> </trans-unit> <trans-unit id="WRN_NewRequired_Title"> <source>Member hides inherited member; missing new keyword</source> <target state="translated">Il membro nasconde il membro ereditato. Manca la parola chiave new</target> <note /> </trans-unit> <trans-unit id="WRN_NewRequired_Description"> <source>A variable was declared with the same name as a variable in a base type. However, the new keyword was not used. This warning informs you that you should use new; the variable is declared as if new had been used in the declaration.</source> <target state="translated">È stata dichiarata una variabile con lo stesso nome di una variabile in un tipo di base, tuttavia non è stata usata la parola chiave new. Questo avviso informa l'utente che è necessario usare new. La variabile viene dichiarata come se nella dichiarazione fosse stata usata la parola chiave new.</target> <note /> </trans-unit> <trans-unit id="WRN_NewNotRequired"> <source>The member '{0}' does not hide an accessible member. The new keyword is not required.</source> <target state="translated">Il membro '{0}' non nasconde un membro accessibile. La parola chiave new non è obbligatoria.</target> <note /> </trans-unit> <trans-unit id="WRN_NewNotRequired_Title"> <source>Member does not hide an inherited member; new keyword is not required</source> <target state="translated">Il membro non nasconde un membro ereditato. La parola chiave new non è obbligatoria</target> <note /> </trans-unit> <trans-unit id="ERR_CircConstValue"> <source>The evaluation of the constant value for '{0}' involves a circular definition</source> <target state="translated">La valutazione del valore della costante per '{0}' implica una definizione circolare</target> <note /> </trans-unit> <trans-unit id="ERR_MemberAlreadyExists"> <source>Type '{1}' already defines a member called '{0}' with the same parameter types</source> <target state="translated">Il tipo '{1}' definisce già un membro denominato '{0}' con gli stessi tipi di parametro</target> <note /> </trans-unit> <trans-unit id="ERR_StaticNotVirtual"> <source>A static member cannot be marked as '{0}'</source> <target state="needs-review-translation">Un membro statico '{0}' non può essere contrassegnato come override, virtual o abstract</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotNew"> <source>A member '{0}' marked as override cannot be marked as new or virtual</source> <target state="translated">Un membro '{0}' contrassegnato come override non può essere contrassegnato come new o virtual</target> <note /> </trans-unit> <trans-unit id="WRN_NewOrOverrideExpected"> <source>'{0}' hides inherited member '{1}'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.</source> <target state="translated">'{0}' nasconde il membro ereditato '{1}'. Per consentire al membro corrente di eseguire l'override di tale implementazione, aggiungere la parola chiave override; altrimenti aggiungere la parola chiave new.</target> <note /> </trans-unit> <trans-unit id="WRN_NewOrOverrideExpected_Title"> <source>Member hides inherited member; missing override keyword</source> <target state="translated">Il membro nasconde il membro ereditato. Manca la parola chiave override</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotExpected"> <source>'{0}': no suitable method found to override</source> <target state="translated">'{0}': non sono stati trovati metodi appropriati per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceUnexpected"> <source>A namespace cannot directly contain members such as fields, methods or statements</source> <target state="needs-review-translation">Uno spazio dei nomi non può contenere direttamente membri come campi o metodi</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuchMember"> <source>'{0}' does not contain a definition for '{1}'</source> <target state="translated">'{0}' non contiene una definizione per '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadSKknown"> <source>'{0}' is a {1} but is used like a {2}</source> <target state="translated">'{0}' è {1} ma è usato come {2}</target> <note /> </trans-unit> <trans-unit id="ERR_BadSKunknown"> <source>'{0}' is a {1}, which is not valid in the given context</source> <target state="translated">'{0}' è un '{1}', che non è un costrutto valido nel contesto specificato</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectRequired"> <source>An object reference is required for the non-static field, method, or property '{0}'</source> <target state="translated">È necessario un riferimento all'oggetto per la proprietà, il metodo o il campo non statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigCall"> <source>The call is ambiguous between the following methods or properties: '{0}' and '{1}'</source> <target state="translated">La chiamata è ambigua tra i seguenti metodi o proprietà: '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAccess"> <source>'{0}' is inaccessible due to its protection level</source> <target state="translated">'{0}' non è accessibile a causa del livello di protezione</target> <note /> </trans-unit> <trans-unit id="ERR_MethDelegateMismatch"> <source>No overload for '{0}' matches delegate '{1}'</source> <target state="translated">Nessun overload per '{0}' corrisponde al delegato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RetObjectRequired"> <source>An object of a type convertible to '{0}' is required</source> <target state="translated">È necessario un oggetto di un tipo convertibile in '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_RetNoObjectRequired"> <source>Since '{0}' returns void, a return keyword must not be followed by an object expression</source> <target state="translated">Poiché '{0}' restituisce un valore nullo, una parola chiave di restituzione non deve essere seguita da un'espressione di oggetto</target> <note /> </trans-unit> <trans-unit id="ERR_LocalDuplicate"> <source>A local variable or function named '{0}' is already defined in this scope</source> <target state="translated">In questo ambito è già definita una funzione o una variabile locale denominata '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AssgLvalueExpected"> <source>The left-hand side of an assignment must be a variable, property or indexer</source> <target state="translated">La parte sinistra di un'assegnazione deve essere una variabile, una proprietà o un indicizzatore</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstParam"> <source>'{0}': a static constructor must be parameterless</source> <target state="translated">'{0}': un costruttore statico non deve avere parametri</target> <note /> </trans-unit> <trans-unit id="ERR_NotConstantExpression"> <source>The expression being assigned to '{0}' must be constant</source> <target state="translated">L'espressione da assegnare a '{0}' deve essere costante</target> <note /> </trans-unit> <trans-unit id="ERR_NotNullConstRefField"> <source>'{0}' is of type '{1}'. A const field of a reference type other than string can only be initialized with null.</source> <target state="translated">'{0}' è di tipo '{1}'. Il campo const di un tipo riferimento diverso da stringa può essere inizializzato solo con Null.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalIllegallyOverrides"> <source>A local or parameter named '{0}' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter</source> <target state="translated">Non è possibile dichiarare in questo ambito una variabile locale o un parametro denominato '{0}' perché tale nome viene usato in un ambito locale di inclusione per definire una variabile locale o un parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadUsingNamespace"> <source>A 'using namespace' directive can only be applied to namespaces; '{0}' is a type not a namespace. Consider a 'using static' directive instead</source> <target state="translated">Una direttiva using dello spazio dei nomi può essere applicata solo a spazi dei nomi. '{0}' è un tipo, non uno spazio dei nomi. Provare a usare una direttiva 'using static'</target> <note /> </trans-unit> <trans-unit id="ERR_BadUsingType"> <source>A 'using static' directive can only be applied to types; '{0}' is a namespace not a type. Consider a 'using namespace' directive instead</source> <target state="translated">Una direttiva 'using static' può essere applicata solo a tipi. '{0}' è uno spazio dei nomi, non un tipo. Provare a usare una direttiva 'using namespace'</target> <note /> </trans-unit> <trans-unit id="ERR_NoAliasHere"> <source>A 'using static' directive cannot be used to declare an alias</source> <target state="translated">Non è possibile usare una direttiva 'using static' per dichiarare un alias</target> <note /> </trans-unit> <trans-unit id="ERR_NoBreakOrCont"> <source>No enclosing loop out of which to break or continue</source> <target state="translated">Non esiste alcun ciclo di inclusione all'esterno del quale interrompere o continuare</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLabel"> <source>The label '{0}' is a duplicate</source> <target state="translated">L'etichetta '{0}' è un duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstructors"> <source>The type '{0}' has no constructors defined</source> <target state="translated">Per il tipo '{0}' non sono definiti costruttori</target> <note /> </trans-unit> <trans-unit id="ERR_NoNewAbstract"> <source>Cannot create an instance of the abstract type or interface '{0}'</source> <target state="translated">Non è possibile creare un'istanza dell'interfaccia o del tipo astratto '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstValueRequired"> <source>A const field requires a value to be provided</source> <target state="translated">È necessario specificare un valore nel campo const</target> <note /> </trans-unit> <trans-unit id="ERR_CircularBase"> <source>Circular base type dependency involving '{0}' and '{1}'</source> <target state="translated">Dipendenza circolare del tipo di base che interessa '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateConstructor"> <source>The delegate '{0}' does not have a valid constructor</source> <target state="translated">Il delegato '{0}' non ha un costruttore valido</target> <note /> </trans-unit> <trans-unit id="ERR_MethodNameExpected"> <source>Method name expected</source> <target state="translated">È previsto il nome di un metodo</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantExpected"> <source>A constant value is expected</source> <target state="translated">È previsto un valore costante</target> <note /> </trans-unit> <trans-unit id="ERR_V6SwitchGoverningTypeValueExpected"> <source>A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type in C# 6 and earlier.</source> <target state="translated">L'espressione switch o l'etichetta case deve essere un tipo bool, char, string, integrale, enum o un tipo nullable corrispondente in C# 6 e versioni precedenti.</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralTypeValueExpected"> <source>A value of an integral type expected</source> <target state="translated">È previsto un valore di tipo integrale</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateCaseLabel"> <source>The switch statement contains multiple cases with the label value '{0}'</source> <target state="translated">L'istruzione switch contiene più usi di maiuscole/minuscole con il valore di etichetta '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidGotoCase"> <source>A goto case is only valid inside a switch statement</source> <target state="translated">La sintassi goto case è valida soltanto all'interno di un'istruzione switch</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyLacksGet"> <source>The property or indexer '{0}' cannot be used in this context because it lacks the get accessor</source> <target state="translated">Non è possibile usare la proprietà o l'indicizzatore '{0}' in questo contesto perché manca la funzione di accesso get</target> <note /> </trans-unit> <trans-unit id="ERR_BadExceptionType"> <source>The type caught or thrown must be derived from System.Exception</source> <target state="translated">Il tipo rilevato o generato deve derivare da System.Exception</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyThrow"> <source>A throw statement with no arguments is not allowed outside of a catch clause</source> <target state="translated">L'utilizzo dell'istruzione throw senza argomenti non è consentito all'esterno di una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadFinallyLeave"> <source>Control cannot leave the body of a finally clause</source> <target state="translated">Il controllo non può lasciare il corpo di una clausola finally</target> <note /> </trans-unit> <trans-unit id="ERR_LabelShadow"> <source>The label '{0}' shadows another label by the same name in a contained scope</source> <target state="translated">L'etichetta '{0}' è la replica di un'altra etichetta con lo stesso nome in un ambito contenuto</target> <note /> </trans-unit> <trans-unit id="ERR_LabelNotFound"> <source>No such label '{0}' within the scope of the goto statement</source> <target state="translated">L'etichetta '{0}' non esiste nell'ambito dell'istruzione goto</target> <note /> </trans-unit> <trans-unit id="ERR_UnreachableCatch"> <source>A previous catch clause already catches all exceptions of this or of a super type ('{0}')</source> <target state="translated">Una clausola catch precedente rileva già tutte le eccezioni del tipo this o super ('{0}')</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantTrue"> <source>Filter expression is a constant 'true', consider removing the filter</source> <target state="translated">L'espressione di filtro è una costante 'true'. Provare a rimuovere il filtro</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantTrue_Title"> <source>Filter expression is a constant 'true'</source> <target state="translated">L'espressione di filtro è una costante 'true'</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnExpected"> <source>'{0}': not all code paths return a value</source> <target state="translated">'{0}': non tutti i percorsi del codice restituiscono un valore</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode"> <source>Unreachable code detected</source> <target state="translated">È stato rilevato codice non raggiungibile</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode_Title"> <source>Unreachable code detected</source> <target state="translated">È stato rilevato codice non raggiungibile</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchFallThrough"> <source>Control cannot fall through from one case label ('{0}') to another</source> <target state="translated">Il controllo non può passare da un'etichetta case ('{0}') a un'altra</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLabel"> <source>This label has not been referenced</source> <target state="translated">Non è stato fatto riferimento a questa etichetta</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLabel_Title"> <source>This label has not been referenced</source> <target state="translated">Non è stato fatto riferimento a questa etichetta</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolation"> <source>Use of unassigned local variable '{0}'</source> <target state="translated">Uso della variabile locale '{0}' non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVar"> <source>The variable '{0}' is declared but never used</source> <target state="translated">La variabile '{0}' è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVar_Title"> <source>Variable is declared but never used</source> <target state="translated">La variabile è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedField"> <source>The field '{0}' is never used</source> <target state="translated">Il campo '{0}' non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedField_Title"> <source>Field is never used</source> <target state="translated">Il campo non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationField"> <source>Use of possibly unassigned field '{0}'</source> <target state="translated">Uso del campo '{0}' probabilmente non assegnato</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationProperty"> <source>Use of possibly unassigned auto-implemented property '{0}'</source> <target state="translated">Uso della proprietà implementata automaticamente '{0}' probabilmente non assegnata</target> <note /> </trans-unit> <trans-unit id="ERR_UnassignedThis"> <source>Field '{0}' must be fully assigned before control is returned to the caller</source> <target state="translated">Il campo '{0}' deve essere assegnato completamente prima che il controllo venga restituito al chiamante</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigQM"> <source>Type of conditional expression cannot be determined because '{0}' and '{1}' implicitly convert to one another</source> <target state="translated">Non è possibile determinare il tipo di espressione condizionale perché '{0}' e '{1}' sono reciprocamente convertibili in modo implicito</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidQM"> <source>Type of conditional expression cannot be determined because there is no implicit conversion between '{0}' and '{1}'</source> <target state="translated">Non è possibile determinare il tipo di espressione condizionale perché non esiste conversione implicita tra '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoBaseClass"> <source>A base class is required for a 'base' reference</source> <target state="translated">È necessaria una classe base per il riferimento 'base'</target> <note /> </trans-unit> <trans-unit id="ERR_BaseIllegal"> <source>Use of keyword 'base' is not valid in this context</source> <target state="translated">Utilizzo della parola chiave 'base' non valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectProhibited"> <source>Member '{0}' cannot be accessed with an instance reference; qualify it with a type name instead</source> <target state="translated">Non è possibile accedere al membro '{0}' con un riferimento all'istanza. Qualificarlo con un nome di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_ParamUnassigned"> <source>The out parameter '{0}' must be assigned to before control leaves the current method</source> <target state="translated">Il parametro out '{0}' deve essere assegnato prima che il controllo lasci il metodo corrente</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidArray"> <source>Invalid rank specifier: expected ',' or ']'</source> <target state="translated">L'identificatore del numero di dimensioni non è valido: è previsto ',' o ']'</target> <note /> </trans-unit> <trans-unit id="ERR_ExternHasBody"> <source>'{0}' cannot be extern and declare a body</source> <target state="translated">'{0}' non può essere di tipo extern e dichiarare un corpo</target> <note /> </trans-unit> <trans-unit id="ERR_ExternHasConstructorInitializer"> <source>'{0}' cannot be extern and have a constructor initializer</source> <target state="translated">'{0}' non può essere di tipo extern e contenere un inizializzatore di costruttore</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractAndExtern"> <source>'{0}' cannot be both extern and abstract</source> <target state="translated">'{0}' non può essere contemporaneamente di tipo extern e abstract</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeParamType"> <source>Attribute constructor parameter '{0}' has type '{1}', which is not a valid attribute parameter type</source> <target state="translated">Il tipo del parametro di costruttore di attributo '{0}' è '{1}' che però non è un tipo di parametro di attributo valido</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeArgument"> <source>An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type</source> <target state="translated">L'argomento di un attributo deve essere un'espressione costante, un'espressione typeof o un'espressione per la creazione di matrici di un tipo di parametro dell'attributo</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeParamDefaultArgument"> <source>Attribute constructor parameter '{0}' is optional, but no default parameter value was specified.</source> <target state="translated">Il parametro di costruttore di attributo '{0}' è facoltativo, ma non sono stati specificati valori di parametro predefiniti.</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysTrue"> <source>The given expression is always of the provided ('{0}') type</source> <target state="translated">L'espressione specificata è sempre del tipo fornito ('{0}')</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysTrue_Title"> <source>'is' expression's given expression is always of the provided type</source> <target state="translated">'L'espressione specificata dell'espressione 'is' è sempre del tipo fornito</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysFalse"> <source>The given expression is never of the provided ('{0}') type</source> <target state="translated">L'espressione specificata non è mai del tipo fornito ('{0}')</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysFalse_Title"> <source>'is' expression's given expression is never of the provided type</source> <target state="translated">'L'espressione specificata dell'espressione 'is' non è mai del tipo fornito</target> <note /> </trans-unit> <trans-unit id="ERR_LockNeedsReference"> <source>'{0}' is not a reference type as required by the lock statement</source> <target state="translated">'{0}' non è un tipo riferimento richiesto dall'istruzione lock</target> <note /> </trans-unit> <trans-unit id="ERR_NullNotValid"> <source>Use of null is not valid in this context</source> <target state="translated">L'utilizzo di null non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultLiteralNotValid"> <source>Use of default literal is not valid in this context</source> <target state="translated">In questo contesto non è possibile usare il valore letterale predefinito</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationThis"> <source>The 'this' object cannot be used before all of its fields have been assigned</source> <target state="translated">Non è possibile usare l'oggetto 'this' prima dell'assegnazione di tutti i relativi campi</target> <note /> </trans-unit> <trans-unit id="ERR_ArgsInvalid"> <source>The __arglist construct is valid only within a variable argument method</source> <target state="translated">Il costrutto __arglist è valido solo all'interno di un metodo con argomenti variabili</target> <note /> </trans-unit> <trans-unit id="ERR_PtrExpected"> <source>The * or -&gt; operator must be applied to a pointer</source> <target state="translated">L'operatore * o -&gt; deve essere applicato a un puntatore</target> <note /> </trans-unit> <trans-unit id="ERR_PtrIndexSingle"> <source>A pointer must be indexed by only one value</source> <target state="translated">Un puntatore deve essere indicizzato da un solo valore</target> <note /> </trans-unit> <trans-unit id="WRN_ByRefNonAgileField"> <source>Using '{0}' as a ref or out value or taking its address may cause a runtime exception because it is a field of a marshal-by-reference class</source> <target state="translated">Se si usa '{0}' come valore out o ref oppure se ne accetta l'indirizzo, potrebbe verificarsi un'eccezione in fase di esecuzione perché è un campo di una classe con marshalling per riferimento</target> <note /> </trans-unit> <trans-unit id="WRN_ByRefNonAgileField_Title"> <source>Using a field of a marshal-by-reference class as a ref or out value or taking its address may cause a runtime exception</source> <target state="translated">Se si usa come valore out o ref un campo di una classe con marshalling per riferimento oppure se ne accetta l'indirizzo, può verificarsi un'eccezione in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyStatic"> <source>A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)</source> <target state="translated">Impossibile effettuare un'assegnazione a un campo statico in sola lettura (tranne che in un costruttore statico o in un inizializzatore di variabile)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyStatic"> <source>A static readonly field cannot be used as a ref or out value (except in a static constructor)</source> <target state="translated">Non è possibile usare un campo di sola lettura statico come valore out o ref (tranne che in un costruttore statico)</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyProp"> <source>Property or indexer '{0}' cannot be assigned to -- it is read only</source> <target state="translated">Non è possibile assegnare un valore alla proprietà o all'indicizzatore '{0}' perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalStatement"> <source>Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement</source> <target state="translated">È possibile usare come istruzione solo le espressioni di assegnazione, chiamata, incremento, decremento, attesa e nuovo oggetto</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetEnumerator"> <source>foreach requires that the return type '{0}' of '{1}' must have a suitable public 'MoveNext' method and public 'Current' property</source> <target state="translated">Con foreach il tipo restituito '{0}' di '{1}' deve essere associato a un metodo 'MoveNext' pubblico e a una proprietà 'Current' pubblica appropriati</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyLocals"> <source>Only 65534 locals, including those generated by the compiler, are allowed</source> <target state="translated">Sono consentite solo 65534 variabili locali, incluse quelle generate dal compilatore</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractBaseCall"> <source>Cannot call an abstract base member: '{0}'</source> <target state="translated">Impossibile chiamare un membro di base astratto: '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefProperty"> <source>A property or indexer may not be passed as an out or ref parameter</source> <target state="translated">Una proprietà o un indicizzatore non può essere passato come parametro out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_ManagedAddr"> <source>Cannot take the address of, get the size of, or declare a pointer to a managed type ('{0}')</source> <target state="translated">Non è possibile accettare l'indirizzo di un tipo gestito ('{0}'), recuperarne la dimensione o dichiarare un puntatore a esso</target> <note /> </trans-unit> <trans-unit id="ERR_BadFixedInitType"> <source>The type of a local declared in a fixed statement must be a pointer type</source> <target state="translated">Il tipo di una variabile locale dichiarata in un'istruzione fixed deve essere un puntatore</target> <note /> </trans-unit> <trans-unit id="ERR_FixedMustInit"> <source>You must provide an initializer in a fixed or using statement declaration</source> <target state="translated">Occorre specificare un inizializzatore nella dichiarazione di un'istruzione fixed o using</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAddrOp"> <source>Cannot take the address of the given expression</source> <target state="translated">Non è possibile accettare l'indirizzo dell'espressione data</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNeeded"> <source>You can only take the address of an unfixed expression inside of a fixed statement initializer</source> <target state="translated">È possibile accettare l'indirizzo di un'espressione unfixed solo all'interno dell'inizializzatore di un'istruzione fixed</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNotNeeded"> <source>You cannot use the fixed statement to take the address of an already fixed expression</source> <target state="translated">Impossibile utilizzare l'istruzione fixed per accettare l'indirizzo di un'espressione già di tipo fixed</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeNeeded"> <source>Pointers and fixed size buffers may only be used in an unsafe context</source> <target state="translated">Puntatori e buffer a dimensione fissa possono essere usati solo in un contesto unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_OpTFRetType"> <source>The return type of operator True or False must be bool</source> <target state="translated">Il tipo restituito dell'operatore True o False deve essere booleano</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorNeedsMatch"> <source>The operator '{0}' requires a matching operator '{1}' to also be defined</source> <target state="translated">L'operatore '{0}' richiede che sia definito anche un operatore '{1}' corrispondente</target> <note /> </trans-unit> <trans-unit id="ERR_BadBoolOp"> <source>In order to be applicable as a short circuit operator a user-defined logical operator ('{0}') must have the same return type and parameter types</source> <target state="translated">Per essere usato come operatore di corto circuito, un operatore logico definito dall'utente ('{0}') deve avere lo stesso tipo restituito e gli stessi tipi di parametro</target> <note /> </trans-unit> <trans-unit id="ERR_MustHaveOpTF"> <source>In order for '{0}' to be applicable as a short circuit operator, its declaring type '{1}' must define operator true and operator false</source> <target state="translated">Per poter usare '{0}' come operatore di corto circuito, il tipo dichiarante '{1}' deve definire l'operatore True e l'operatore False</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVarAssg"> <source>The variable '{0}' is assigned but its value is never used</source> <target state="translated">La variabile '{0}' è assegnata, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVarAssg_Title"> <source>Variable is assigned but its value is never used</source> <target state="translated">La variabile è assegnata, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_CheckedOverflow"> <source>The operation overflows at compile time in checked mode</source> <target state="translated">Operazione in overflow in fase di compilazione in modalità checked</target> <note /> </trans-unit> <trans-unit id="ERR_ConstOutOfRangeChecked"> <source>Constant value '{0}' cannot be converted to a '{1}' (use 'unchecked' syntax to override)</source> <target state="translated">Il valore costante '{0}' non può essere convertito in '{1}'. Usare la sintassi 'unchecked' per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_BadVarargs"> <source>A method with vararg cannot be generic, be in a generic type, or have a params parameter</source> <target state="translated">Un metodo con vararg non può essere generico, non può essere in un tipo generico né contenere una matrice di parametri</target> <note /> </trans-unit> <trans-unit id="ERR_ParamsMustBeArray"> <source>The params parameter must be a single dimensional array</source> <target state="translated">Il parametro params deve essere una matrice unidimensionale</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalArglist"> <source>An __arglist expression may only appear inside of a call or new expression</source> <target state="translated">Un'espressione __arglist può trovarsi solo all'interno di una chiamata o di un'espressione new</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalUnsafe"> <source>Unsafe code may only appear if compiling with /unsafe</source> <target state="translated">Il codice di tipo unsafe è ammesso solo se si compila con /unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigMember"> <source>Ambiguity between '{0}' and '{1}'</source> <target state="translated">Ambiguità tra '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadForeachDecl"> <source>Type and identifier are both required in a foreach statement</source> <target state="translated">In un'istruzione foreach sono necessari sia il tipo che l'identificatore</target> <note /> </trans-unit> <trans-unit id="ERR_ParamsLast"> <source>A params parameter must be the last parameter in a formal parameter list</source> <target state="translated">Il parametro params deve essere l'ultimo in un elenco parametri formale</target> <note /> </trans-unit> <trans-unit id="ERR_SizeofUnsafe"> <source>'{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context</source> <target state="translated">'{0}' non ha una dimensione predefinita, quindi sizeof può essere usato solo in un contesto di tipo unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_DottedTypeNameNotFoundInNS"> <source>The type or namespace name '{0}' does not exist in the namespace '{1}' (are you missing an assembly reference?)</source> <target state="translated">Il tipo o il nome dello spazio dei nomi '{0}' non esiste nello spazio dei nomi '{1}'. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldInitRefNonstatic"> <source>A field initializer cannot reference the non-static field, method, or property '{0}'</source> <target state="translated">Un inizializzatore di campo non può fare riferimento alla proprietà, al metodo o al campo non statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_SealedNonOverride"> <source>'{0}' cannot be sealed because it is not an override</source> <target state="translated">'{0}' non può essere sealed perché non è un override</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideSealed"> <source>'{0}': cannot override inherited member '{1}' because it is sealed</source> <target state="translated">'{0}': non è possibile eseguire l'override del membro ereditato '{1}' perché è sealed</target> <note /> </trans-unit> <trans-unit id="ERR_VoidError"> <source>The operation in question is undefined on void pointers</source> <target state="translated">L'operazione è indefinita sui puntatori a void</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnOverride"> <source>The Conditional attribute is not valid on '{0}' because it is an override method</source> <target state="translated">L'attributo Conditional non è valido per '{0}' perché è un metodo di override</target> <note /> </trans-unit> <trans-unit id="ERR_PointerInAsOrIs"> <source>Neither 'is' nor 'as' is valid on pointer types</source> <target state="translated">is' o 'as' non valido per tipi puntatore</target> <note /> </trans-unit> <trans-unit id="ERR_CallingFinalizeDeprecated"> <source>Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available.</source> <target state="translated">Impossibile chiamare direttamente i distruttori e object.Finalize. Provare a chiamare IDisposable.Dispose se disponibile.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleTypeNameNotFound"> <source>The type or namespace name '{0}' could not be found (are you missing a using directive or an assembly reference?)</source> <target state="translated">Il nome di tipo o di spazio dei nomi '{0}' non è stato trovato. Probabilmente manca una direttiva using o un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeStackAllocSize"> <source>Cannot use a negative size with stackalloc</source> <target state="translated">Impossibile utilizzare dimensioni negative con stackalloc</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeArraySize"> <source>Cannot create an array with a negative size</source> <target state="translated">Non è possibile creare matrici con dimensioni negative</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideFinalizeDeprecated"> <source>Do not override object.Finalize. Instead, provide a destructor.</source> <target state="translated">Non eseguire l'override di object.Finalize. Fornire un distruttore.</target> <note /> </trans-unit> <trans-unit id="ERR_CallingBaseFinalizeDeprecated"> <source>Do not directly call your base type Finalize method. It is called automatically from your destructor.</source> <target state="translated">Non chiamare direttamente il metodo Finalize del tipo di base. Viene chiamato automaticamente dal distruttore.</target> <note /> </trans-unit> <trans-unit id="WRN_NegativeArrayIndex"> <source>Indexing an array with a negative index (array indices always start at zero)</source> <target state="translated">Indicizzazione di una matrice con indice negativo. Gli indici di matrice iniziano sempre da zero</target> <note /> </trans-unit> <trans-unit id="WRN_NegativeArrayIndex_Title"> <source>Indexing an array with a negative index</source> <target state="translated">Indicizzazione di una matrice con un indice negativo</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareLeft"> <source>Possible unintended reference comparison; to get a value comparison, cast the left hand side to type '{0}'</source> <target state="translated">È probabile che il confronto dei riferimenti non sia intenzionale. Per confrontare i valori, eseguire il cast dell'espressione di sinistra sul tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareLeft_Title"> <source>Possible unintended reference comparison; left hand side needs cast</source> <target state="translated">Possibile confronto non intenzionale dei riferimenti. Eseguire il cast del lato sinistro</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareRight"> <source>Possible unintended reference comparison; to get a value comparison, cast the right hand side to type '{0}'</source> <target state="translated">È probabile che il confronto dei riferimenti non sia intenzionale. Per confrontare i valori, eseguire il cast dell'espressione di destra sul tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareRight_Title"> <source>Possible unintended reference comparison; right hand side needs cast</source> <target state="translated">Possibile confronto non intenzionale dei riferimenti. Eseguire il cast del lato destro</target> <note /> </trans-unit> <trans-unit id="ERR_BadCastInFixed"> <source>The right hand side of a fixed statement assignment may not be a cast expression</source> <target state="translated">La parte destra dell'assegnazione di un'istruzione fixed non può essere un'espressione cast</target> <note /> </trans-unit> <trans-unit id="ERR_StackallocInCatchFinally"> <source>stackalloc may not be used in a catch or finally block</source> <target state="translated">stackalloc non può essere usato in un blocco catch o finally</target> <note /> </trans-unit> <trans-unit id="ERR_VarargsLast"> <source>An __arglist parameter must be the last parameter in a formal parameter list</source> <target state="translated">Il parametro __arglist deve essere l'ultimo nell'elenco di parametri formali</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPartial"> <source>Missing partial modifier on declaration of type '{0}'; another partial declaration of this type exists</source> <target state="translated">Manca il modificatore parziale nella dichiarazione di tipo '{0}'. È presente un'altra dichiarazione parziale di questo tipo</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeKindConflict"> <source>Partial declarations of '{0}' must be all classes, all record classes, all structs, all record structs, or all interfaces</source> <target state="needs-review-translation">Le dichiarazioni parziali di '{0}' devono essere costituite solo da classi, record, struct o interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_PartialModifierConflict"> <source>Partial declarations of '{0}' have conflicting accessibility modifiers</source> <target state="translated">Le dichiarazioni parziali di '{0}' contengono modificatori di accessibilità in conflitto</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMultipleBases"> <source>Partial declarations of '{0}' must not specify different base classes</source> <target state="translated">Le dichiarazioni parziali di '{0}' non devono specificare classi base diverse</target> <note /> </trans-unit> <trans-unit id="ERR_PartialWrongTypeParams"> <source>Partial declarations of '{0}' must have the same type parameter names in the same order</source> <target state="translated">Le dichiarazioni parziali di '{0}' devono avere gli stessi nomi di parametro di tipo nello stesso ordine</target> <note /> </trans-unit> <trans-unit id="ERR_PartialWrongConstraints"> <source>Partial declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source> <target state="translated">Le dichiarazioni parziali di '{0}' contengono vincoli incoerenti per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoImplicitConvCast"> <source>Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?)</source> <target state="translated">Non è possibile convertire in modo implicito il tipo '{0}' in '{1}'. È presente una conversione esplicita. Probabilmente manca un cast.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMisplaced"> <source>The 'partial' modifier can only appear immediately before 'class', 'record', 'struct', 'interface', or a method return type.</source> <target state="translated">Il modificatore 'partial' può trovarsi solo immediatamente prima di 'class', 'record', 'struct', 'interface' o il tipo restituito di un metodo.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportedCircularBase"> <source>Imported type '{0}' is invalid. It contains a circular base type dependency.</source> <target state="translated">Il tipo importato '{0}' non è valido perché contiene una dipendenza circolare del tipo di base.</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationOut"> <source>Use of unassigned out parameter '{0}'</source> <target state="translated">Uso del parametro out '{0}' non assegnato</target> <note /> </trans-unit> <trans-unit id="ERR_ArraySizeInDeclaration"> <source>Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)</source> <target state="translated">Impossibile specificare la dimensione della matrice in una dichiarazione di variabile. Provare a inizializzare con un'espressione 'new'</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleGetter"> <source>The property or indexer '{0}' cannot be used in this context because the get accessor is inaccessible</source> <target state="translated">Non è possibile usare la proprietà o l'indicizzatore '{0}' in questo contesto perché la funzione di accesso get non è accessibile</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleSetter"> <source>The property or indexer '{0}' cannot be used in this context because the set accessor is inaccessible</source> <target state="translated">Non è possibile usare la proprietà o l'indicizzatore '{0}' in questo contesto perché la funzione di accesso set è inaccessibile</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPropertyAccessMod"> <source>The accessibility modifier of the '{0}' accessor must be more restrictive than the property or indexer '{1}'</source> <target state="translated">Il modificatore di accessibilità della funzione di accesso '{0}' deve essere più restrittivo della proprietà o dell'indicizzatore '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyAccessMods"> <source>Cannot specify accessibility modifiers for both accessors of the property or indexer '{0}'</source> <target state="translated">Non è possibile specificare i modificatori di accessibilità per entrambe le funzioni di accesso della proprietà o dell'indicizzatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AccessModMissingAccessor"> <source>'{0}': accessibility modifiers on accessors may only be used if the property or indexer has both a get and a set accessor</source> <target state="translated">'{0}': i modificatori di accessibilità per le funzioni di accesso possono essere usati solo se la proprietà o l'indicizzatore ha entrambe le funzioni di accesso get e set</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedInterfaceAccessor"> <source>'{0}' does not implement interface member '{1}'. '{2}' is not public.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' è di tipo non pubblico</target> <note /> </trans-unit> <trans-unit id="WRN_PatternIsAmbiguous"> <source>'{0}' does not implement the '{1}' pattern. '{2}' is ambiguous with '{3}'.</source> <target state="translated">'{0}' non implementa il modello '{1}'. '{2}' è ambiguo con '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternIsAmbiguous_Title"> <source>Type does not implement the collection pattern; members are ambiguous</source> <target state="translated">Il tipo non implementa il modello di raccolta. I membri sono ambigui</target> <note /> </trans-unit> <trans-unit id="WRN_PatternBadSignature"> <source>'{0}' does not implement the '{1}' pattern. '{2}' has the wrong signature.</source> <target state="translated">'{0}' non implementa il modello '{1}'. La firma di '{2}' è errata.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternBadSignature_Title"> <source>Type does not implement the collection pattern; member has the wrong signature</source> <target state="translated">Il tipo non implementa il modello di raccolta. La firma del membro è errata</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefNotEqualToThis"> <source>Friend access was granted by '{0}', but the public key of the output assembly ('{1}') does not match that specified by the InternalsVisibleTo attribute in the granting assembly.</source> <target state="translated">L'accesso a Friend è stato concesso da '{0}', ma la chiave pubblica dell'assembly di output ('{1}') non corrisponde a quella specificata dall'attributo InternalsVisibleTo nell'assembly che ha concesso l'accesso.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefSigningMismatch"> <source>Friend access was granted by '{0}', but the strong name signing state of the output assembly does not match that of the granting assembly.</source> <target state="translated">L'accesso a Friend è stato concesso da '{0}', ma lo stato di firma del nome sicuro dell'assembly di output non corrisponde a quello dell'assembly che ha concesso l'accesso.</target> <note /> </trans-unit> <trans-unit id="WRN_SequentialOnPartialClass"> <source>There is no defined ordering between fields in multiple declarations of partial struct '{0}'. To specify an ordering, all instance fields must be in the same declaration.</source> <target state="translated">Non è stato definito nessun ordine tra i campi in più dichiarazioni di struct parziale '{0}'. Per specificare un ordine, tutti i campi dell'istanza devono essere inclusi nella stessa dichiarazione.</target> <note /> </trans-unit> <trans-unit id="WRN_SequentialOnPartialClass_Title"> <source>There is no defined ordering between fields in multiple declarations of partial struct</source> <target state="translated">In più dichiarazioni della struct parziale non è stato definito nessun ordinamento tra campi</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstType"> <source>The type '{0}' cannot be declared const</source> <target state="translated">Il tipo '{0}' non può essere dichiarato come const</target> <note /> </trans-unit> <trans-unit id="ERR_NoNewTyvar"> <source>Cannot create an instance of the variable type '{0}' because it does not have the new() constraint</source> <target state="translated">Non è possibile creare un'istanza del tipo di variabile '{0}' perché non include il vincolo new()</target> <note /> </trans-unit> <trans-unit id="ERR_BadArity"> <source>Using the generic {1} '{0}' requires {2} type arguments</source> <target state="translated">L'uso del tipo generico {1} '{0}' richiede argomenti di tipo {2}</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgument"> <source>The type '{0}' may not be used as a type argument</source> <target state="translated">Il tipo '{0}' non può essere usato come argomento di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_TypeArgsNotAllowed"> <source>The {1} '{0}' cannot be used with type arguments</source> <target state="translated">Non è possibile usare {1} '{0}' con argomenti di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_HasNoTypeVars"> <source>The non-generic {1} '{0}' cannot be used with type arguments</source> <target state="translated">{1} '{0}' non generico non può essere usato con argomenti di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_NewConstraintNotSatisfied"> <source>'{2}' must be a non-abstract type with a public parameterless constructor in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">'{2}' deve essere un tipo non astratto con un costruttore pubblico senza parametri per poter essere usato come parametro '{1}' nel tipo o nel metodo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedRefType"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no implicit reference conversion from '{3}' to '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Non esistono conversioni implicite di riferimenti da '{3}' a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedNullableEnum"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Il tipo nullable '{3}' non soddisfa il vincolo di '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedNullableInterface"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel tipo o metodo generico '{0}'. Il tipo nullable '{3}' non soddisfa il vincolo di '{1}'. I tipi nullable non soddisfano i vincoli di interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedTyVar"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Non esistono conversioni boxing o conversioni di parametri di tipo da '{3}' a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedValType"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Non esistono conversioni boxing da '{3}' a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateGeneratedName"> <source>The parameter name '{0}' conflicts with an automatically-generated parameter name</source> <target state="translated">Il nome di parametro '{0}' è in conflitto con un nome di parametro generato automaticamente</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalSingleTypeNameNotFound"> <source>The type or namespace name '{0}' could not be found in the global namespace (are you missing an assembly reference?)</source> <target state="translated">Il nome di tipo o di spazio dei nomi '{0}' non è stato trovato nello spazio dei nomi globale. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NewBoundMustBeLast"> <source>The new() constraint must be the last constraint specified</source> <target state="translated">Il vincolo new() deve essere l'ultimo vincolo specificato</target> <note /> </trans-unit> <trans-unit id="WRN_MainCantBeGeneric"> <source>'{0}': an entry point cannot be generic or in a generic type</source> <target state="translated">'{0}': un punto di ingresso non può essere generico o essere incluso in un tipo generico</target> <note /> </trans-unit> <trans-unit id="WRN_MainCantBeGeneric_Title"> <source>An entry point cannot be generic or in a generic type</source> <target state="translated">Un punto di ingresso non può essere generico o essere incluso in un tipo generico</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVarCantBeNull"> <source>Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead.</source> <target state="translated">Non è possibile convertire il valore Null nel parametro di tipo '{0}' perché potrebbe essere un tipo valore che non ammette i valori Null. Provare a usare 'default({0})'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateBound"> <source>Duplicate constraint '{0}' for type parameter '{1}'</source> <target state="translated">Il vincolo '{0}' è duplicato per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ClassBoundNotFirst"> <source>The class type constraint '{0}' must come before any other constraints</source> <target state="translated">Il vincolo di tipo classe '{0}' deve precedere gli altri vincoli</target> <note /> </trans-unit> <trans-unit id="ERR_BadRetType"> <source>'{1} {0}' has the wrong return type</source> <target state="translated">'Il tipo restituito di '{1} {0}' è errato</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateRefMismatch"> <source>Ref mismatch between '{0}' and delegate '{1}'</source> <target state="translated">Riferimenti non corrispondenti tra '{0}' e il delegato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConstraintClause"> <source>A constraint clause has already been specified for type parameter '{0}'. All of the constraints for a type parameter must be specified in a single where clause.</source> <target state="translated">È già stata specificata una clausola di vincolo per il parametro di tipo '{0}'. Tutti i vincoli per un parametro di tipo devono essere specificati in un'unica clausola where.</target> <note /> </trans-unit> <trans-unit id="ERR_CantInferMethTypeArgs"> <source>The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly.</source> <target state="translated">Non è possibile dedurre gli argomenti di tipo per il metodo '{0}' dall'utilizzo. Provare a specificare gli argomenti di tipo in modo esplicito.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalSameNameAsTypeParam"> <source>'{0}': a parameter, local variable, or local function cannot have the same name as a method type parameter</source> <target state="translated">'{0}': il nome di un parametro, di una variabile locale o di una funzione locale non può essere uguale a quello di un parametro di tipo del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_AsWithTypeVar"> <source>The type parameter '{0}' cannot be used with the 'as' operator because it does not have a class type constraint nor a 'class' constraint</source> <target state="translated">Non è possibile usare il parametro di tipo '{0}' con l'operatore 'as' perché non ha vincoli di tipo classe, né un vincolo 'class'</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedFieldAssg"> <source>The field '{0}' is assigned but its value is never used</source> <target state="translated">Il campo '{0}' è assegnato, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedFieldAssg_Title"> <source>Field is assigned but its value is never used</source> <target state="translated">Il campo è assegnato, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_BadIndexerNameAttr"> <source>The '{0}' attribute is valid only on an indexer that is not an explicit interface member declaration</source> <target state="translated">L'attributo '{0}' è valido solo in un indicizzatore che non sia una dichiarazione esplicita di un membro di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_AttrArgWithTypeVars"> <source>'{0}': an attribute argument cannot use type parameters</source> <target state="translated">'{0}': un argomento di attributo non può usare parametri di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_NewTyvarWithArgs"> <source>'{0}': cannot provide arguments when creating an instance of a variable type</source> <target state="translated">'{0}': non è possibile fornire argomenti quando si crea un'istanza di un tipo di variabile</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractSealedStatic"> <source>'{0}': an abstract type cannot be sealed or static</source> <target state="translated">'{0}': un tipo astratto non può essere sealed o static</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousXMLReference"> <source>Ambiguous reference in cref attribute: '{0}'. Assuming '{1}', but could have also matched other overloads including '{2}'.</source> <target state="translated">Riferimento ambiguo nell'attributo cref: '{0}'. Verrà usato '{1}', ma è anche possibile che corrisponda ad altri overload, tra cui '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousXMLReference_Title"> <source>Ambiguous reference in cref attribute</source> <target state="translated">Riferimento ambiguo nell'attributo cref</target> <note /> </trans-unit> <trans-unit id="WRN_VolatileByRef"> <source>'{0}': a reference to a volatile field will not be treated as volatile</source> <target state="translated">'{0}': un riferimento a un campo volatile non verrà considerato volatile</target> <note /> </trans-unit> <trans-unit id="WRN_VolatileByRef_Title"> <source>A reference to a volatile field will not be treated as volatile</source> <target state="translated">Un riferimento a un campo volatile non verrà considerato volatile</target> <note /> </trans-unit> <trans-unit id="WRN_VolatileByRef_Description"> <source>A volatile field should not normally be used as a ref or out value, since it will not be treated as volatile. There are exceptions to this, such as when calling an interlocked API.</source> <target state="translated">Un campo volatile non deve in genere essere usato come valore out o ref dal momento che non verrà considerato come volatile. Esistono eccezioni a questo comportamento, ad esempio quando si chiama un'API con interlock.</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithImpl"> <source>Since '{1}' has the ComImport attribute, '{0}' must be extern or abstract</source> <target state="translated">'{1}' ha l'attributo ComImport, pertanto '{0}' deve essere extern o abstract</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithBase"> <source>'{0}': a class with the ComImport attribute cannot specify a base class</source> <target state="translated">'{0}': una classe con l'attributo ComImport non può specificare una classe base</target> <note /> </trans-unit> <trans-unit id="ERR_ImplBadConstraints"> <source>The constraints for type parameter '{0}' of method '{1}' must match the constraints for type parameter '{2}' of interface method '{3}'. Consider using an explicit interface implementation instead.</source> <target state="translated">I vincoli per il parametro di tipo '{0}' del metodo '{1}' devono corrispondere ai vincoli per il parametro di tipo '{2}' del metodo di interfaccia '{3}'. Provare a usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplBadTupleNames"> <source>The tuple element names in the signature of method '{0}' must match the tuple element names of interface method '{1}' (including on the return type).</source> <target state="translated">I nomi di elementi di tupla nella firma del metodo '{0}' devono corrispondere a quelli del metodo di interfaccia '{1}' (incluso nel tipo restituito).</target> <note /> </trans-unit> <trans-unit id="ERR_DottedTypeNameNotFoundInAgg"> <source>The type name '{0}' does not exist in the type '{1}'</source> <target state="translated">Il nome di tipo '{0}' non esiste nel tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MethGrpToNonDel"> <source>Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method?</source> <target state="translated">Non è possibile convertire il gruppo di metodi '{0}' nel tipo non delegato '{1}'. Si intendeva richiamare il metodo?</target> <note /> </trans-unit> <trans-unit id="ERR_BadExternAlias"> <source>The extern alias '{0}' was not specified in a /reference option</source> <target state="translated">L'alias extern '{0}' non è stato specificato in un'opzione /reference</target> <note /> </trans-unit> <trans-unit id="ERR_ColColWithTypeAlias"> <source>Cannot use alias '{0}' with '::' since the alias references a type. Use '.' instead.</source> <target state="translated">Non è possibile usare l'alias '{0}' con '::' perché l'alias fa riferimento a un tipo. Usare '.'.</target> <note /> </trans-unit> <trans-unit id="ERR_AliasNotFound"> <source>Alias '{0}' not found</source> <target state="translated">L'alias '{0}' non è stato trovato</target> <note /> </trans-unit> <trans-unit id="ERR_SameFullNameAggAgg"> <source>The type '{1}' exists in both '{0}' and '{2}'</source> <target state="translated">Il tipo '{1}' esiste sia in '{0}' che in '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_SameFullNameNsAgg"> <source>The namespace '{1}' in '{0}' conflicts with the type '{3}' in '{2}'</source> <target state="translated">Lo spazio dei nomi '{1}' in '{0}' è in conflitto con il tipo '{3}' in '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisNsAgg"> <source>The namespace '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the namespace defined in '{0}'.</source> <target state="translated">Lo spazio dei nomi '{1}' in '{0}' è in conflitto con il tipo importato '{3}' in '{2}'. Verrà usato lo spazio dei nomi definito in '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisNsAgg_Title"> <source>Namespace conflicts with imported type</source> <target state="translated">Lo spazio dei nomi è in conflitto con il tipo importato</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggAgg"> <source>The type '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the type defined in '{0}'.</source> <target state="translated">Il tipo '{1}' in '{0}' è in conflitto con il tipo importato '{3}' in '{2}'. Verrà usato il tipo definito in '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggAgg_Title"> <source>Type conflicts with imported type</source> <target state="translated">Il tipo è in conflitto con il tipo importato</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggNs"> <source>The type '{1}' in '{0}' conflicts with the imported namespace '{3}' in '{2}'. Using the type defined in '{0}'.</source> <target state="translated">Il tipo '{1}' in '{0}' è in conflitto con lo spazio dei nomi importato '{3}' in '{2}'. Verrà usato il tipo definito in '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggNs_Title"> <source>Type conflicts with imported namespace</source> <target state="translated">Il tipo è in conflitto con lo spazio dei nomi importato</target> <note /> </trans-unit> <trans-unit id="ERR_SameFullNameThisAggThisNs"> <source>The type '{1}' in '{0}' conflicts with the namespace '{3}' in '{2}'</source> <target state="translated">Il tipo '{1}' in '{0}' è in conflitto con lo spazio dei nomi '{3}' in '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExternAfterElements"> <source>An extern alias declaration must precede all other elements defined in the namespace</source> <target state="translated">Una dichiarazione di alias extern deve precedere tutti gli altri elementi definiti nello spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="WRN_GlobalAliasDefn"> <source>Defining an alias named 'global' is ill-advised since 'global::' always references the global namespace and not an alias</source> <target state="translated">Si consiglia di non assegnare il nome 'global' a un alias perché 'global::' fa sempre riferimento allo spazio dei nomi globale e non a un alias</target> <note /> </trans-unit> <trans-unit id="WRN_GlobalAliasDefn_Title"> <source>Defining an alias named 'global' is ill-advised</source> <target state="translated">È consigliabile non assegnare il nome 'global' a un alias</target> <note /> </trans-unit> <trans-unit id="ERR_SealedStaticClass"> <source>'{0}': a type cannot be both static and sealed</source> <target state="translated">'{0}': un tipo non può essere sia statico che sealed</target> <note /> </trans-unit> <trans-unit id="ERR_PrivateAbstractAccessor"> <source>'{0}': abstract properties cannot have private accessors</source> <target state="translated">'{0}': le proprietà astratte non possono avere funzioni di accesso private</target> <note /> </trans-unit> <trans-unit id="ERR_ValueExpected"> <source>Syntax error; value expected</source> <target state="translated">Errore di sintassi: è previsto un valore</target> <note /> </trans-unit> <trans-unit id="ERR_UnboxNotLValue"> <source>Cannot modify the result of an unboxing conversion</source> <target state="translated">Non è possibile modificare il risultato di una conversione unboxing</target> <note /> </trans-unit> <trans-unit id="ERR_AnonMethGrpInForEach"> <source>Foreach cannot operate on a '{0}'. Did you intend to invoke the '{0}'?</source> <target state="translated">L'istruzione foreach non può funzionare con '{0}'. Si intendeva richiamare '{0}'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadIncDecRetType"> <source>The return type for ++ or -- operator must match the parameter type or be derived from the parameter type</source> <target state="translated">Il tipo restituito per l'operatore ++ o -- deve essere uguale o derivare dal tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_RefValBoundWithClass"> <source>'{0}': cannot specify both a constraint class and the 'class' or 'struct' constraint</source> <target state="translated">'{0}': non è possibile specificare sia una classe constraint che il vincolo 'class' o 'struct'</target> <note /> </trans-unit> <trans-unit id="ERR_NewBoundWithVal"> <source>The 'new()' constraint cannot be used with the 'struct' constraint</source> <target state="translated">Non è possibile usare il vincolo 'new()' con il vincolo 'struct'</target> <note /> </trans-unit> <trans-unit id="ERR_RefConstraintNotSatisfied"> <source>The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">Il tipo '{2}' deve essere un tipo riferimento per poter essere usato come parametro '{1}' nel metodo o nel tipo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ValConstraintNotSatisfied"> <source>The type '{2}' must be a non-nullable value type in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">Il tipo '{2}' deve essere un tipo valore che non ammette i valori Null per poter essere usato come parametro '{1}' nel metodo o nel tipo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_CircularConstraint"> <source>Circular constraint dependency involving '{0}' and '{1}'</source> <target state="translated">Dipendenza di vincolo circolare che interessa '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BaseConstraintConflict"> <source>Type parameter '{0}' inherits conflicting constraints '{1}' and '{2}'</source> <target state="translated">Il parametro di tipo '{0}' eredita i vincoli in conflitto '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConWithValCon"> <source>Type parameter '{1}' has the 'struct' constraint so '{1}' cannot be used as a constraint for '{0}'</source> <target state="translated">Il parametro di tipo '{1}' ha il vincolo 'struct'. Non è quindi possibile usare '{1}' come vincolo per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigUDConv"> <source>Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}'</source> <target state="translated">Le conversioni '{0}' e '{1}' definite dall'utente durante la conversione da '{2}' a '{3}' sono ambigue</target> <note /> </trans-unit> <trans-unit id="WRN_AlwaysNull"> <source>The result of the expression is always 'null' of type '{0}'</source> <target state="translated">Il risultato dell'espressione è sempre 'null' di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_AlwaysNull_Title"> <source>The result of the expression is always 'null'</source> <target state="translated">Il risultato dell'espressione è sempre 'null'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnThis"> <source>Cannot return 'this' by reference.</source> <target state="translated">Non è possibile restituire 'this' per riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeCtorInParameter"> <source>Cannot use attribute constructor '{0}' because it has 'in' parameters.</source> <target state="translated">Non è possibile usare il costruttore di attributo '{0}' perché contiene parametri 'in'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithConstraints"> <source>Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly, except for either a 'class', or a 'struct' constraint.</source> <target state="translated">I vincoli per i metodi di override e di implementazione esplicita dell'interfaccia sono ereditati dal metodo base, quindi non possono essere specificati direttamente, ad eccezione di un vincolo 'class' o 'struct'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigOverride"> <source>The inherited members '{0}' and '{1}' have the same signature in type '{2}', so they cannot be overridden</source> <target state="translated">I membri ereditati '{0}' e '{1}' hanno la stessa firma nel tipo '{2}', pertanto non possono essere sottoposti a override</target> <note /> </trans-unit> <trans-unit id="ERR_DecConstError"> <source>Evaluation of the decimal constant expression failed</source> <target state="translated">La valutazione dell'espressione costante decimale non è riuscita</target> <note /> </trans-unit> <trans-unit id="WRN_CmpAlwaysFalse"> <source>Comparing with null of type '{0}' always produces 'false'</source> <target state="translated">Il confronto con il valore Null di tipo '{0}' restituisce sempre 'false'</target> <note /> </trans-unit> <trans-unit id="WRN_CmpAlwaysFalse_Title"> <source>Comparing with null of struct type always produces 'false'</source> <target state="translated">Il confronto con il valore Null di tipo struct restituisce sempre 'false'</target> <note /> </trans-unit> <trans-unit id="WRN_FinalizeMethod"> <source>Introducing a 'Finalize' method can interfere with destructor invocation. Did you intend to declare a destructor?</source> <target state="translated">L'introduzione di un metodo 'Finalize' può interferire con la chiamata di un distruttore. Si desiderava dichiarare un distruttore?</target> <note /> </trans-unit> <trans-unit id="WRN_FinalizeMethod_Title"> <source>Introducing a 'Finalize' method can interfere with destructor invocation</source> <target state="translated">L'introduzione di un metodo 'Finalize' può interferire con la chiamata di un distruttore</target> <note /> </trans-unit> <trans-unit id="WRN_FinalizeMethod_Description"> <source>This warning occurs when you create a class with a method whose signature is public virtual void Finalize. If such a class is used as a base class and if the deriving class defines a destructor, the destructor will override the base class Finalize method, not Finalize.</source> <target state="translated">Questo avviso viene visualizzato quando si crea una classe con un metodo la cui firma è public virtual void Finalize. Se si usa tale classe come classe base e se la classe di derivazione definisce un distruttore, il distruttore eseguirà l'override del metodo Finalize della classe base e non di Finalize.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitImplParams"> <source>'{0}' should not have a params parameter since '{1}' does not</source> <target state="translated">'{0}' non deve contenere un parametro params perché '{1}' non ne ha</target> <note /> </trans-unit> <trans-unit id="WRN_GotoCaseShouldConvert"> <source>The 'goto case' value is not implicitly convertible to type '{0}'</source> <target state="translated">Il valore 'goto case' non è convertibile in modo implicito nel tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_GotoCaseShouldConvert_Title"> <source>The 'goto case' value is not implicitly convertible to the switch type</source> <target state="translated">Il valore 'goto case' non è convertibile in modo implicito nel tipo switch</target> <note /> </trans-unit> <trans-unit id="ERR_MethodImplementingAccessor"> <source>Method '{0}' cannot implement interface accessor '{1}' for type '{2}'. Use an explicit interface implementation.</source> <target state="translated">Il metodo '{0}' non può implementare la funzione di accesso di interfaccia '{1}' per il tipo '{2}'. Usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool"> <source>The result of the expression is always '{0}' since a value of type '{1}' is never equal to 'null' of type '{2}'</source> <target state="translated">Il risultato dell'espressione è sempre '{0}' perché un valore di tipo '{1}' non è mai uguale a 'null' di tipo '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool_Title"> <source>The result of the expression is always the same since a value of this type is never equal to 'null'</source> <target state="translated">Il risultato dell'espressione è sempre lo stesso perché un valore di questo tipo non è mai uguale a 'null'</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool2"> <source>The result of the expression is always '{0}' since a value of type '{1}' is never equal to 'null' of type '{2}'</source> <target state="translated">Il risultato dell'espressione è sempre '{0}' perché un valore di tipo '{1}' non è mai uguale a 'null' di tipo '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool2_Title"> <source>The result of the expression is always the same since a value of this type is never equal to 'null'</source> <target state="translated">Il risultato dell'espressione è sempre lo stesso perché un valore di questo tipo non è mai uguale a 'null'</target> <note /> </trans-unit> <trans-unit id="WRN_ExplicitImplCollision"> <source>Explicit interface implementation '{0}' matches more than one interface member. Which interface member is actually chosen is implementation-dependent. Consider using a non-explicit implementation instead.</source> <target state="translated">L'implementazione esplicita dell'interfaccia '{0}' corrisponde a più membri di interfaccia. Il membro di interfaccia scelto dipende dall'implementazione. Provare a usare un'implementazione non esplicita.</target> <note /> </trans-unit> <trans-unit id="WRN_ExplicitImplCollision_Title"> <source>Explicit interface implementation matches more than one interface member</source> <target state="translated">L'implementazione dell'interfaccia esplicita corrisponde a più di un membro di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractHasBody"> <source>'{0}' cannot declare a body because it is marked abstract</source> <target state="translated">'{0}' non può dichiarare un corpo perché è contrassegnato come abstract</target> <note /> </trans-unit> <trans-unit id="ERR_ConcreteMissingBody"> <source>'{0}' must declare a body because it is not marked abstract, extern, or partial</source> <target state="translated">'{0}' deve dichiarare un corpo perché non è contrassegnato come abstract, extern o partial</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractAndSealed"> <source>'{0}' cannot be both abstract and sealed</source> <target state="translated">'{0}' non può essere contemporaneamente di tipo abstract e sealed</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractNotVirtual"> <source>The abstract {0} '{1}' cannot be marked virtual</source> <target state="translated">L'elemento {0} astratto '{1}' non può essere contrassegnato come virtual</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstant"> <source>The constant '{0}' cannot be marked static</source> <target state="translated">La costante '{0}' non può essere contrassegnata come static</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonFunction"> <source>'{0}': cannot override because '{1}' is not a function</source> <target state="translated">'{0}': non è possibile eseguire l'override. '{1}' non è una funzione</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonVirtual"> <source>'{0}': cannot override inherited member '{1}' because it is not marked virtual, abstract, or override</source> <target state="translated">'{0}': non è possibile eseguire l'override del membro ereditato '{1}' perché non è contrassegnato come virtual, abstract o override</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeAccessOnOverride"> <source>'{0}': cannot change access modifiers when overriding '{1}' inherited member '{2}'</source> <target state="translated">'{0}': non è possibile cambiare i modificatori di accesso quando viene eseguito l'override di '{1}' del membro ereditato '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeTupleNamesOnOverride"> <source>'{0}': cannot change tuple element names when overriding inherited member '{1}'</source> <target state="translated">'{0}': non è possibile cambiare i nomi di elementi di tupla quando viene eseguito l'override del membro ereditato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeReturnTypeOnOverride"> <source>'{0}': return type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il tipo restituito deve essere '{2}' in modo che corrisponda al membro '{1}' sottoposto a override</target> <note /> </trans-unit> <trans-unit id="ERR_CantDeriveFromSealedType"> <source>'{0}': cannot derive from sealed type '{1}'</source> <target state="translated">'{0}' non può derivare dal tipo sealed '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractInConcreteClass"> <source>'{0}' is abstract but it is contained in non-abstract type '{1}'</source> <target state="translated">'{0}' è di tipo astratto ma è contenuto nel tipo non astratto '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstructorWithExplicitConstructorCall"> <source>'{0}': static constructor cannot have an explicit 'this' or 'base' constructor call</source> <target state="translated">'{0}': un costruttore statico non può avere una chiamata esplicita al costruttore 'this' o 'base'</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstructorWithAccessModifiers"> <source>'{0}': access modifiers are not allowed on static constructors</source> <target state="translated">'{0}': i modificatori di accesso non sono consentiti su costruttori statici</target> <note /> </trans-unit> <trans-unit id="ERR_RecursiveConstructorCall"> <source>Constructor '{0}' cannot call itself</source> <target state="translated">Il costruttore '{0}' non può chiamare se stesso</target> <note /> </trans-unit> <trans-unit id="ERR_IndirectRecursiveConstructorCall"> <source>Constructor '{0}' cannot call itself through another constructor</source> <target state="translated">Il costruttore '{0}' non può chiamare se stesso tramite un altro costruttore</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectCallingBaseConstructor"> <source>'{0}' has no base class and cannot call a base constructor</source> <target state="translated">'{0}' non ha una classe base e non può chiamare un costruttore base</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedTypeNotFound"> <source>Predefined type '{0}' is not defined or imported</source> <target state="translated">Il tipo predefinito '{0}' non è definito né importato</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeNotFound"> <source>Predefined type '{0}' is not defined or imported</source> <target state="translated">Il tipo predefinito '{0}' non è definito né importato</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeAmbiguous3"> <source>Predefined type '{0}' is declared in multiple referenced assemblies: '{1}' and '{2}'</source> <target state="translated">Il tipo predefinito '{0}' è dichiarato in più assembly di riferimento: '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_StructWithBaseConstructorCall"> <source>'{0}': structs cannot call base class constructors</source> <target state="translated">'{0}': le struct non possono chiamare costruttori della classe base</target> <note /> </trans-unit> <trans-unit id="ERR_StructLayoutCycle"> <source>Struct member '{0}' of type '{1}' causes a cycle in the struct layout</source> <target state="translated">Il membro struct '{0}' di tipo '{1}' causa un ciclo nel layout della struct</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacesCantContainFields"> <source>Interfaces cannot contain instance fields</source> <target state="translated">Le interfacce non possono contenere campi di istanza</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacesCantContainConstructors"> <source>Interfaces cannot contain instance constructors</source> <target state="translated">Le interfacce non possono contenere costruttori di istanza</target> <note /> </trans-unit> <trans-unit id="ERR_NonInterfaceInInterfaceList"> <source>Type '{0}' in interface list is not an interface</source> <target state="translated">Il tipo '{0}' nell'elenco di interfacce non è un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInterfaceInBaseList"> <source>'{0}' is already listed in interface list</source> <target state="translated">'{0}' è già presente nell'elenco delle interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInterfaceWithTupleNamesInBaseList"> <source>'{0}' is already listed in the interface list on type '{2}' with different tuple element names, as '{1}'.</source> <target state="translated">'{0}' è già incluso nell'elenco di interfacce nel tipo '{2}' con nomi di elementi di tupla diversi, come '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CycleInInterfaceInheritance"> <source>Inherited interface '{1}' causes a cycle in the interface hierarchy of '{0}'</source> <target state="translated">L'interfaccia ereditata '{1}' causa un ciclo nella gerarchia delle interfacce di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_HidingAbstractMethod"> <source>'{0}' hides inherited abstract member '{1}'</source> <target state="translated">'{0}' nasconde il membro astratto ereditato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedAbstractMethod"> <source>'{0}' does not implement inherited abstract member '{1}'</source> <target state="translated">'{0}' non implementa il membro astratto ereditato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedInterfaceMember"> <source>'{0}' does not implement interface member '{1}'</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectCantHaveBases"> <source>The class System.Object cannot have a base class or implement an interface</source> <target state="translated">La classe System.Object non può avere una classe base o implementare un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitInterfaceImplementationNotInterface"> <source>'{0}' in explicit interface declaration is not an interface</source> <target state="translated">'{0}' nella dichiarazione esplicita dell'interfaccia non è un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceMemberNotFound"> <source>'{0}' in explicit interface declaration is not found among members of the interface that can be implemented</source> <target state="translated">Nella dichiarazione di interfaccia esplicita '{0}' non è stato trovato tra i membri dell'interfaccia implementabili</target> <note /> </trans-unit> <trans-unit id="ERR_ClassDoesntImplementInterface"> <source>'{0}': containing type does not implement interface '{1}'</source> <target state="translated">'{0}': il tipo che lo contiene non implementa l'interfaccia '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitInterfaceImplementationInNonClassOrStruct"> <source>'{0}': explicit interface declaration can only be declared in a class, record, struct or interface</source> <target state="translated">'{0}': la dichiarazione esplicita dell'interfaccia può essere dichiarata sono in una classe, un record, uno struct o un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_MemberNameSameAsType"> <source>'{0}': member names cannot be the same as their enclosing type</source> <target state="translated">'{0}': i nomi dei membri non possono essere uguali a quelli del tipo di inclusione</target> <note /> </trans-unit> <trans-unit id="ERR_EnumeratorOverflow"> <source>'{0}': the enumerator value is too large to fit in its type</source> <target state="translated">'{0}': il valore dell'enumeratore è troppo grande per il tipo</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonProperty"> <source>'{0}': cannot override because '{1}' is not a property</source> <target state="translated">'{0}': non è possibile eseguire l'override. '{1}' non è una proprietà</target> <note /> </trans-unit> <trans-unit id="ERR_NoGetToOverride"> <source>'{0}': cannot override because '{1}' does not have an overridable get accessor</source> <target state="translated">'{0}': non è possibile eseguire l'override perché '{1}' non ha una funzione di accesso get di cui eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_NoSetToOverride"> <source>'{0}': cannot override because '{1}' does not have an overridable set accessor</source> <target state="translated">'{0}': non è possibile eseguire l'override perché '{1}' non ha di una funzione di accesso set di cui eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyCantHaveVoidType"> <source>'{0}': property or indexer cannot have void type</source> <target state="translated">'{0}': la proprietà o l'indicizzatore non può avere un tipo void</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyWithNoAccessors"> <source>'{0}': property or indexer must have at least one accessor</source> <target state="translated">'{0}': la proprietà o l'indicizzatore deve avere almeno una funzione di accesso</target> <note /> </trans-unit> <trans-unit id="ERR_NewVirtualInSealed"> <source>'{0}' is a new virtual member in sealed type '{1}'</source> <target state="translated">'{0}' è un nuovo membro virtuale nel tipo sealed '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitPropertyAddingAccessor"> <source>'{0}' adds an accessor not found in interface member '{1}'</source> <target state="translated">'{0}' aggiunge una funzione di accesso non trovata nel membro di interfaccia '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitPropertyMissingAccessor"> <source>Explicit interface implementation '{0}' is missing accessor '{1}'</source> <target state="translated">Nell'implementazione esplicita dell'interfaccia '{0}' manca la funzione di accesso '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionWithInterface"> <source>'{0}': user-defined conversions to or from an interface are not allowed</source> <target state="translated">'{0}': non sono consentite conversioni definite dall'utente da o verso un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionWithBase"> <source>'{0}': user-defined conversions to or from a base type are not allowed</source> <target state="translated">'{0}': le conversioni definite dall'utente da o verso un tipo di base non sono consentite</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionWithDerived"> <source>'{0}': user-defined conversions to or from a derived type are not allowed</source> <target state="translated">'{0}': le conversioni definite dall'utente da o verso un tipo derivato non sono consentite</target> <note /> </trans-unit> <trans-unit id="ERR_IdentityConversion"> <source>User-defined operator cannot convert a type to itself</source> <target state="needs-review-translation">L'operatore definito dall'utente non può accettare un oggetto del tipo di inclusione e convertirlo in un oggetto del tipo di inclusione</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionNotInvolvingContainedType"> <source>User-defined conversion must convert to or from the enclosing type</source> <target state="translated">La conversione definita dall'utente deve eseguire la conversione verso o da un tipo di inclusione</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConversionInClass"> <source>Duplicate user-defined conversion in type '{0}'</source> <target state="translated">Conversione definita dall'utente duplicata nel tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorsMustBeStatic"> <source>User-defined operator '{0}' must be declared static and public</source> <target state="translated">L'operatore definito dall'utente '{0}' deve essere dichiarato come static e public</target> <note /> </trans-unit> <trans-unit id="ERR_BadIncDecSignature"> <source>The parameter type for ++ or -- operator must be the containing type</source> <target state="translated">Il tipo di parametro per l'operatore ++ o -- deve essere il tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_BadUnaryOperatorSignature"> <source>The parameter of a unary operator must be the containing type</source> <target state="translated">Il parametro di un operatore unario deve essere il tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_BadBinaryOperatorSignature"> <source>One of the parameters of a binary operator must be the containing type</source> <target state="translated">Uno dei parametri di un operatore binario deve essere il tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_BadShiftOperatorSignature"> <source>The first operand of an overloaded shift operator must have the same type as the containing type, and the type of the second operand must be int</source> <target state="translated">Il primo operando di un operatore shift di overload deve essere dello stesso tipo del tipo che lo contiene, mentre il tipo del secondo operando deve essere int</target> <note /> </trans-unit> <trans-unit id="ERR_EnumsCantContainDefaultConstructor"> <source>Enums cannot contain explicit parameterless constructors</source> <target state="translated">Le enumerazioni non possono contenere costruttori espliciti senza parametri</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideBogusMethod"> <source>'{0}': cannot override '{1}' because it is not supported by the language</source> <target state="translated">'{0}': non è possibile eseguire l'override di '{1}' perché non è supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="ERR_BindToBogus"> <source>'{0}' is not supported by the language</source> <target state="translated">'{0}' non è supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="ERR_CantCallSpecialMethod"> <source>'{0}': cannot explicitly call operator or accessor</source> <target state="translated">'{0}': non è possibile chiamare in modo esplicito l'operatore o la funzione di accesso</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeReference"> <source>'{0}': cannot reference a type through an expression; try '{1}' instead</source> <target state="translated">'{0}': non è possibile fare riferimento a un tipo con un'espressione. Provare con '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadDestructorName"> <source>Name of destructor must match name of type</source> <target state="translated">Il nome del distruttore deve corrispondere al nome del tipo</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyClassesCanContainDestructors"> <source>Only class types can contain destructors</source> <target state="translated">Solo i tipi classe possono contenere distruttori</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictAliasAndMember"> <source>Namespace '{1}' contains a definition conflicting with alias '{0}'</source> <target state="translated">Lo spazio dei nomi '{1}' contiene una definizione in conflitto con l'alias '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingAliasAndDefinition"> <source>Alias '{0}' conflicts with {1} definition</source> <target state="translated">L'alias '{0}' è in conflitto con la definizione di {1}</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnSpecialMethod"> <source>The Conditional attribute is not valid on '{0}' because it is a constructor, destructor, operator, lambda expression, or explicit interface implementation</source> <target state="needs-review-translation">L'attributo Conditional non è valido per '{0}' perché è l'implementazione di un costruttore, un distruttore, un operatore o un'interfaccia esplicita</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalMustReturnVoid"> <source>The Conditional attribute is not valid on '{0}' because its return type is not void</source> <target state="translated">L'attributo Conditional non è valido per '{0}' perché il tipo restituito non è void</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAttribute"> <source>Duplicate '{0}' attribute</source> <target state="translated">L'attributo '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAttributeInNetModule"> <source>Duplicate '{0}' attribute in '{1}'</source> <target state="translated">L'attributo '{0}' è duplicato in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnInterfaceMethod"> <source>The Conditional attribute is not valid on interface members</source> <target state="translated">L'attributo Conditional non è valido per i membri di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorCantReturnVoid"> <source>User-defined operators cannot return void</source> <target state="translated">Gli operatori definiti dall'utente non possono restituire void</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicConversion"> <source>'{0}': user-defined conversions to or from the dynamic type are not allowed</source> <target state="translated">'{0}': le conversioni definite dall'utente nel o dal tipo dinamico non sono consentite</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeArgument"> <source>Invalid value for argument to '{0}' attribute</source> <target state="translated">Il valore specificato per l'argomento dell'attributo '{0}' non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterNotValidForType"> <source>Parameter not valid for the specified unmanaged type.</source> <target state="translated">Il parametro non è valido per il tipo non gestito specificato.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired1"> <source>Attribute parameter '{0}' must be specified.</source> <target state="translated">È necessario specificare il parametro di attributo '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired2"> <source>Attribute parameter '{0}' or '{1}' must be specified.</source> <target state="translated">È necessario specificare il parametro di attributo '{0}' o '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeNotValidForFields"> <source>Unmanaged type '{0}' not valid for fields.</source> <target state="translated">Il tipo non gestito '{0}' non è valido per i campi.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeOnlyValidForFields"> <source>Unmanaged type '{0}' is only valid for fields.</source> <target state="translated">Il tipo non gestito '{0}' è valido solo per i campi.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOnBadSymbolType"> <source>Attribute '{0}' is not valid on this declaration type. It is only valid on '{1}' declarations.</source> <target state="translated">L'attributo '{0}' non è valido in questo tipo di dichiarazione. È valido solo in dichiarazioni di '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FloatOverflow"> <source>Floating-point constant is outside the range of type '{0}'</source> <target state="translated">La costante a virgola mobile non è inclusa nell'intervallo di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithoutUuidAttribute"> <source>The Guid attribute must be specified with the ComImport attribute</source> <target state="translated">L'attributo Guid deve essere specificato con l'attributo ComImport</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNamedArgument"> <source>Invalid value for named attribute argument '{0}'</source> <target state="translated">Il valore dell'argomento di attributo denominato '{0}' non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInvalidMethod"> <source>The DllImport attribute must be specified on a method marked 'static' and 'extern'</source> <target state="translated">L'attributo DllImport deve essere specificato in un metodo contrassegnato come 'static' ed 'extern'</target> <note /> </trans-unit> <trans-unit id="ERR_EncUpdateFailedMissingAttribute"> <source>Cannot update '{0}'; attribute '{1}' is missing.</source> <target state="translated">Non è possibile aggiornare '{0}'. Manca l'attributo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnGenericMethod"> <source>The DllImport attribute cannot be applied to a method that is generic or contained in a generic method or type.</source> <target state="translated">Non è possibile applicare l'attributo DllImport a un metodo generico o contenuto in un tipo o un metodo generico.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldCantBeRefAny"> <source>Field or property cannot be of type '{0}'</source> <target state="translated">Il campo o la proprietà non può essere di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_FieldAutoPropCantBeByRefLike"> <source>Field or auto-implemented property cannot be of type '{0}' unless it is an instance member of a ref struct.</source> <target state="translated">La proprietà di campo o implementata automaticamente non può essere di tipo '{0}' a meno che non sia un membro di istanza di uno struct ref.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayElementCantBeRefAny"> <source>Array elements cannot be of type '{0}'</source> <target state="translated">Gli elementi di una matrice non possono essere di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbol"> <source>'{0}' is obsolete</source> <target state="translated">'{0}' è obsoleto</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbol_Title"> <source>Type or member is obsolete</source> <target state="translated">Il tipo o il membro è obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_NotAnAttributeClass"> <source>'{0}' is not an attribute class</source> <target state="translated">'{0}' non è una classe Attribute</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedAttributeArgument"> <source>'{0}' is not a valid named attribute argument. Named attribute arguments must be fields which are not readonly, static, or const, or read-write properties which are public and not static.</source> <target state="translated">'{0}' non è un argomento di attributo denominato valido. Gli argomenti di attributo denominati devono essere campi che non siano di sola lettura, statici o costanti oppure proprietà di lettura/scrittura che siano pubbliche e non statiche.</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbolStr"> <source>'{0}' is obsolete: '{1}'</source> <target state="translated">'{0}' è obsoleto: '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbolStr_Title"> <source>Type or member is obsolete</source> <target state="translated">Il tipo o il membro è obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_DeprecatedSymbolStr"> <source>'{0}' is obsolete: '{1}'</source> <target state="translated">'{0}' è obsoleto: '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_IndexerCantHaveVoidType"> <source>Indexers cannot have void type</source> <target state="translated">Gli indicizzatori non possono avere tipi void</target> <note /> </trans-unit> <trans-unit id="ERR_VirtualPrivate"> <source>'{0}': virtual or abstract members cannot be private</source> <target state="translated">'{0}': i membri virtuali o astratti non possono essere privati</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitToNonArrayType"> <source>Can only use array initializer expressions to assign to array types. Try using a new expression instead.</source> <target state="translated">Solo espressioni di inizializzazione di matrice possono essere utilizzate per assegnare a tipi matrice. Provare a utilizzare un'espressione new.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitInBadPlace"> <source>Array initializers can only be used in a variable or field initializer. Try using a new expression instead.</source> <target state="translated">Gli inizializzatori di matrice possono essere usati solo in un inizializzatore di campo o di variabile. Provare a usare un'espressione new.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingStructOffset"> <source>'{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute</source> <target state="translated">'{0}': il campo dell'istanza nei tipi contrassegnati con StructLayout(LayoutKind.Explicit) deve contenere un attributo FieldOffset</target> <note /> </trans-unit> <trans-unit id="WRN_ExternMethodNoImplementation"> <source>Method, operator, or accessor '{0}' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation.</source> <target state="translated">Il metodo, la funzione di accesso o l'operatore '{0}' è contrassegnato come esterno e non include attributi. Provare ad aggiungere un attributo DllImport per specificare l'implementazione esterna.</target> <note /> </trans-unit> <trans-unit id="WRN_ExternMethodNoImplementation_Title"> <source>Method, operator, or accessor is marked external and has no attributes on it</source> <target state="translated">Il metodo, la funzione di accesso o l'operatore è contrassegnato come esterno ed è privo di attributi</target> <note /> </trans-unit> <trans-unit id="WRN_ProtectedInSealed"> <source>'{0}': new protected member declared in sealed type</source> <target state="translated">'{0}': il nuovo membro protetto è stato dichiarato nel tipo sealed</target> <note /> </trans-unit> <trans-unit id="WRN_ProtectedInSealed_Title"> <source>New protected member declared in sealed type</source> <target state="translated">Il nuovo membro protetto è stato dichiarato nel tipo sealed</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedByConditional"> <source>Conditional member '{0}' cannot implement interface member '{1}' in type '{2}'</source> <target state="translated">Il membro condizionale '{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalRefParam"> <source>ref and out are not valid in this context</source> <target state="translated">ref e out non sono validi in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgumentToAttribute"> <source>The argument to the '{0}' attribute must be a valid identifier</source> <target state="translated">L'argomento dell'attributo '{0}' deve essere un identificatore valido</target> <note /> </trans-unit> <trans-unit id="ERR_StructOffsetOnBadStruct"> <source>The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)</source> <target state="translated">L'attributo FieldOffset può essere usato solo in membri di tipo contrassegnati con StructLayout(LayoutKind.Explicit)</target> <note /> </trans-unit> <trans-unit id="ERR_StructOffsetOnBadField"> <source>The FieldOffset attribute is not allowed on static or const fields</source> <target state="translated">L'uso dell'attributo FieldOffset non è consentito nei campi static o const</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeUsageOnNonAttributeClass"> <source>Attribute '{0}' is only valid on classes derived from System.Attribute</source> <target state="translated">L'attributo '{0}' è valido solo in classi derivate da System.Attribute</target> <note /> </trans-unit> <trans-unit id="WRN_PossibleMistakenNullStatement"> <source>Possible mistaken empty statement</source> <target state="translated">L'istruzione vuota è probabilmente errata</target> <note /> </trans-unit> <trans-unit id="WRN_PossibleMistakenNullStatement_Title"> <source>Possible mistaken empty statement</source> <target state="translated">L'istruzione vuota è probabilmente errata</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedAttributeArgument"> <source>'{0}' duplicate named attribute argument</source> <target state="translated">'L'argomento di attributo denominato '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DeriveFromEnumOrValueType"> <source>'{0}' cannot derive from special class '{1}'</source> <target state="translated">'{0}' non può derivare dalla classe speciale '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMemberOnIndexedType"> <source>Cannot specify the DefaultMember attribute on a type containing an indexer</source> <target state="translated">Impossibile specificare l'attributo DefaultMember in un tipo contenente un indicizzatore</target> <note /> </trans-unit> <trans-unit id="ERR_BogusType"> <source>'{0}' is a type not supported by the language</source> <target state="translated">'{0}' è un tipo non supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedInternalField"> <source>Field '{0}' is never assigned to, and will always have its default value {1}</source> <target state="translated">Non è possibile assegnare un valore diverso al campo '{0}'. Il valore predefinito è {1}</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedInternalField_Title"> <source>Field is never assigned to, and will always have its default value</source> <target state="translated">Non è possibile assegnare al campo un valore diverso da quello predefinito</target> <note /> </trans-unit> <trans-unit id="ERR_CStyleArray"> <source>Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.</source> <target state="translated">Il dichiaratore di matrice è errato: per dichiarare una matrice gestita, l'identificatore del numero di dimensioni deve precedere l'identificatore della variabile. Per dichiarare un campo buffer a dimensione fissa, usare la parola chiave fixed prima del tipo di campo.</target> <note /> </trans-unit> <trans-unit id="WRN_VacuousIntegralComp"> <source>Comparison to integral constant is useless; the constant is outside the range of type '{0}'</source> <target state="translated">Il confronto con la costante integrale è inutile. La costante non è inclusa nell'intervallo del tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_VacuousIntegralComp_Title"> <source>Comparison to integral constant is useless; the constant is outside the range of the type</source> <target state="translated">Il confronto con la costante integrale è inutile. La costante non è inclusa nell'intervallo del tipo</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractAttributeClass"> <source>Cannot apply attribute class '{0}' because it is abstract</source> <target state="translated">Non è possibile applicare la classe Attribute '{0}' perché è astratta</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedAttributeArgumentType"> <source>'{0}' is not a valid named attribute argument because it is not a valid attribute parameter type</source> <target state="translated">'{0}' non è un argomento di attributo denominato valido perché non è un tipo di parametro di attributo valido</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPredefinedMember"> <source>Missing compiler required member '{0}.{1}'</source> <target state="translated">Manca il membro '{0}.{1}', necessario per il compilatore</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeLocationOnBadDeclaration"> <source>'{0}' is not a valid attribute location for this declaration. Valid attribute locations for this declaration are '{1}'. All attributes in this block will be ignored.</source> <target state="translated">'{0}' non è una posizione valida dell'attributo per questa dichiarazione. Le posizioni valide degli attributi sono '{1}'. Tutti gli attributi in questo blocco verranno ignorati.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeLocationOnBadDeclaration_Title"> <source>Not a valid attribute location for this declaration</source> <target state="translated">Non è una posizione valida dell'attributo per questa dichiarazione</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAttributeLocation"> <source>'{0}' is not a recognized attribute location. Valid attribute locations for this declaration are '{1}'. All attributes in this block will be ignored.</source> <target state="translated">'{0}' non è una posizione riconosciuta dell'attributo. Le posizioni valide degli attributi sono '{1}'. Tutti gli attributi in questo blocco verranno ignorati.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAttributeLocation_Title"> <source>Not a recognized attribute location</source> <target state="translated">Non è una posizione di attributo riconosciuta</target> <note /> </trans-unit> <trans-unit id="WRN_EqualsWithoutGetHashCode"> <source>'{0}' overrides Object.Equals(object o) but does not override Object.GetHashCode()</source> <target state="translated">'{0}' esegue l'override di Object.Equals(object o) ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="WRN_EqualsWithoutGetHashCode_Title"> <source>Type overrides Object.Equals(object o) but does not override Object.GetHashCode()</source> <target state="translated">Il tipo esegue l'override di Object.Equals(object o) ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutEquals"> <source>'{0}' defines operator == or operator != but does not override Object.Equals(object o)</source> <target state="translated">'{0}' definisce l'operatore == o l'operatore != ma non esegue l'override di Object.Equals(object o)</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutEquals_Title"> <source>Type defines operator == or operator != but does not override Object.Equals(object o)</source> <target state="translated">Il tipo definisce l'operatore == o l'operatore != ma non esegue l'override di Object.Equals(object o)</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutGetHashCode"> <source>'{0}' defines operator == or operator != but does not override Object.GetHashCode()</source> <target state="translated">'{0}' definisce l'operatore == o l'operatore != ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutGetHashCode_Title"> <source>Type defines operator == or operator != but does not override Object.GetHashCode()</source> <target state="translated">Il tipo definisce l'operatore == o l'operatore != ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="ERR_OutAttrOnRefParam"> <source>Cannot specify the Out attribute on a ref parameter without also specifying the In attribute.</source> <target state="translated">Non è possibile specificare l'attributo Out in un parametro ref senza specificare anche l'attributo In.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadRefKind"> <source>'{0}' cannot define an overloaded {1} that differs only on parameter modifiers '{2}' and '{3}'</source> <target state="translated">'{0}' non può definire un elemento {1} in rapporto di overload che differisce solo per i modificatori di parametro '{2}' e '{3}'</target> <note /> </trans-unit> <trans-unit id="ERR_LiteralDoubleCast"> <source>Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type</source> <target state="translated">Non è possibile convertire in modo implicito il valore letterale di tipo double nel tipo '{1}'. Usare un suffisso '{0}' per creare un valore letterale di questo tipo</target> <note /> </trans-unit> <trans-unit id="WRN_IncorrectBooleanAssg"> <source>Assignment in conditional expression is always constant; did you mean to use == instead of = ?</source> <target state="translated">L'assegnazione nell'espressione condizionale è sempre costante. Si intendeva utilizzare == invece di = ?</target> <note /> </trans-unit> <trans-unit id="WRN_IncorrectBooleanAssg_Title"> <source>Assignment in conditional expression is always constant</source> <target state="translated">L'assegnazione nell'espressione condizionale è sempre costante</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedInStruct"> <source>'{0}': new protected member declared in struct</source> <target state="translated">'{0}': in struct è stato dichiarato il nuovo membro protetto</target> <note /> </trans-unit> <trans-unit id="ERR_InconsistentIndexerNames"> <source>Two indexers have different names; the IndexerName attribute must be used with the same name on every indexer within a type</source> <target state="translated">Due indicizzatori hanno nomi diversi. L'attributo IndexerName deve essere usato con lo stesso nome in ogni indicizzatore all'interno di un tipo</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithUserCtor"> <source>A class with the ComImport attribute cannot have a user-defined constructor</source> <target state="translated">Una classe con l'attributo ComImport non può avere un costruttore definito dall'utente</target> <note /> </trans-unit> <trans-unit id="ERR_FieldCantHaveVoidType"> <source>Field cannot have void type</source> <target state="translated">Il campo non può essere di tipo void</target> <note /> </trans-unit> <trans-unit id="WRN_NonObsoleteOverridingObsolete"> <source>Member '{0}' overrides obsolete member '{1}'. Add the Obsolete attribute to '{0}'.</source> <target state="translated">Il membro '{0}' esegue l'override del membro obsoleto '{1}'. Aggiungere l'attributo Obsolete a '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NonObsoleteOverridingObsolete_Title"> <source>Member overrides obsolete member</source> <target state="translated">Il membro esegue l'override del membro obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_SystemVoid"> <source>System.Void cannot be used from C# -- use typeof(void) to get the void type object</source> <target state="translated">Non è possibile usare System.Void da C#. Usare typeof(void) per ottenere l'oggetto di tipo void</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitParamArray"> <source>Do not use 'System.ParamArrayAttribute'. Use the 'params' keyword instead.</source> <target state="translated">Non usare 'System.ParamArrayAttribute'. Al suo posto, usare la parola chiave 'params'.</target> <note /> </trans-unit> <trans-unit id="WRN_BitwiseOrSignExtend"> <source>Bitwise-or operator used on a sign-extended operand; consider casting to a smaller unsigned type first</source> <target state="translated">L'operatore OR bit per bit viene usato su un operando con segno esteso. Prima di usarlo, provare a eseguire il cast su un tipo più piccolo e senza segno</target> <note /> </trans-unit> <trans-unit id="WRN_BitwiseOrSignExtend_Title"> <source>Bitwise-or operator used on a sign-extended operand</source> <target state="translated">Operatore OR bit per bit usato su un operando con segno esteso</target> <note /> </trans-unit> <trans-unit id="WRN_BitwiseOrSignExtend_Description"> <source>The compiler implicitly widened and sign-extended a variable, and then used the resulting value in a bitwise OR operation. This can result in unexpected behavior.</source> <target state="translated">Il compilatore ha ampliato ed esteso con segno in modo implicito una variabile, usando quindi il valore risultante in un'operazione OR bit per bit. Questa operazione potrebbe causare comportamenti imprevisti.</target> <note /> </trans-unit> <trans-unit id="ERR_VolatileStruct"> <source>'{0}': a volatile field cannot be of the type '{1}'</source> <target state="translated">'{0}': un campo volatile non può essere di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_VolatileAndReadonly"> <source>'{0}': a field cannot be both volatile and readonly</source> <target state="translated">'{0}': un campo non può essere sia volatile che di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractField"> <source>The modifier 'abstract' is not valid on fields. Try using a property instead.</source> <target state="translated">Il modificatore 'abstract' non è valido nei campi. Provare a utilizzare una proprietà.</target> <note /> </trans-unit> <trans-unit id="ERR_BogusExplicitImpl"> <source>'{0}' cannot implement '{1}' because it is not supported by the language</source> <target state="translated">'{0}' non può implementare '{1}' perché non è supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitMethodImplAccessor"> <source>'{0}' explicit method implementation cannot implement '{1}' because it is an accessor</source> <target state="translated">'L'implementazione esplicita del metodo '{0}' non può implementare '{1}' perché è una funzione di accesso</target> <note /> </trans-unit> <trans-unit id="WRN_CoClassWithoutComImport"> <source>'{0}' interface marked with 'CoClassAttribute' not marked with 'ComImportAttribute'</source> <target state="translated">'L'interfaccia '{0}' contrassegnata con 'CoClassAttribute' non è contrassegnata con 'ComImportAttribute'</target> <note /> </trans-unit> <trans-unit id="WRN_CoClassWithoutComImport_Title"> <source>Interface marked with 'CoClassAttribute' not marked with 'ComImportAttribute'</source> <target state="translated">L'interfaccia contrassegnata con 'CoClassAttribute' non è contrassegnata con 'ComImportAttribute'</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalWithOutParam"> <source>Conditional member '{0}' cannot have an out parameter</source> <target state="translated">Il membro condizionale '{0}' non può avere un parametro out</target> <note /> </trans-unit> <trans-unit id="ERR_AccessorImplementingMethod"> <source>Accessor '{0}' cannot implement interface member '{1}' for type '{2}'. Use an explicit interface implementation.</source> <target state="translated">La funzione di accesso '{0}' non può implementare il membro di interfaccia '{1}' per il tipo '{2}'. Usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_AliasQualAsExpression"> <source>The namespace alias qualifier '::' always resolves to a type or namespace so is illegal here. Consider using '.' instead.</source> <target state="translated">Il qualificatore di alias '::' dello spazio dei nomi viene sempre risolto in un tipo o in uno spazio dei nomi e non è pertanto valido in questa posizione. Si consiglia di utilizzare '.'.</target> <note /> </trans-unit> <trans-unit id="ERR_DerivingFromATyVar"> <source>Cannot derive from '{0}' because it is a type parameter</source> <target state="translated">Non è possibile derivare da '{0}' perché è un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeParameter"> <source>Duplicate type parameter '{0}'</source> <target state="translated">Parametro di tipo '{0}' duplicato</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterTypeParameter"> <source>Type parameter '{0}' has the same name as the type parameter from outer type '{1}'</source> <target state="translated">Il parametro di tipo '{0}' ha lo stesso nome del parametro del tipo outer '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterTypeParameter_Title"> <source>Type parameter has the same name as the type parameter from outer type</source> <target state="translated">Il parametro di tipo ha lo stesso nome del parametro del tipo outer</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVariableSameAsParent"> <source>Type parameter '{0}' has the same name as the containing type, or method</source> <target state="translated">Il parametro di tipo '{0}' ha lo stesso nome del tipo che lo contiene o del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_UnifyingInterfaceInstantiations"> <source>'{0}' cannot implement both '{1}' and '{2}' because they may unify for some type parameter substitutions</source> <target state="translated">'{0}' non può implementare sia '{1}' che '{2}' perché potrebbero unificarsi per alcune sostituzioni di parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_TyVarNotFoundInConstraint"> <source>'{1}' does not define type parameter '{0}'</source> <target state="translated">'{1}' non definisce il parametro di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadBoundType"> <source>'{0}' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.</source> <target state="translated">'{0}' non è un vincolo valido. Un tipo usato come vincolo deve essere un'interfaccia, una classe non sealed o un parametro di tipo.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecialTypeAsBound"> <source>Constraint cannot be special class '{0}'</source> <target state="translated">Il vincolo non può essere la classe speciale '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisBound"> <source>Inconsistent accessibility: constraint type '{1}' is less accessible than '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di vincolo '{1}' è meno accessibile di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_LookupInTypeVariable"> <source>Cannot do member lookup in '{0}' because it is a type parameter</source> <target state="translated">Non è possibile eseguire la ricerca di membri in '{0}' perché è un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstraintType"> <source>Invalid constraint type. A type used as a constraint must be an interface, a non-sealed class or a type parameter.</source> <target state="translated">Il tipo vincolo non è valido. Un tipo usato come vincolo deve essere un'interfaccia, una classe non sealed o un parametro di tipo.</target> <note /> </trans-unit> <trans-unit id="ERR_InstanceMemberInStaticClass"> <source>'{0}': cannot declare instance members in a static class</source> <target state="translated">'{0}': non è possibile dichiarare i membri di istanza in una classe statica</target> <note /> </trans-unit> <trans-unit id="ERR_StaticBaseClass"> <source>'{1}': cannot derive from static class '{0}'</source> <target state="translated">'{1}' non può derivare dalla classe statica '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorInStaticClass"> <source>Static classes cannot have instance constructors</source> <target state="translated">Le classi statiche non possono avere costruttori di istanze</target> <note /> </trans-unit> <trans-unit id="ERR_DestructorInStaticClass"> <source>Static classes cannot contain destructors</source> <target state="translated">Le classi statiche non possono contenere distruttori</target> <note /> </trans-unit> <trans-unit id="ERR_InstantiatingStaticClass"> <source>Cannot create an instance of the static class '{0}'</source> <target state="translated">Non è possibile creare un'istanza della classe statica '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_StaticDerivedFromNonObject"> <source>Static class '{0}' cannot derive from type '{1}'. Static classes must derive from object.</source> <target state="translated">La classe statica '{0}' non può derivare dal tipo '{1}'. Le classi statiche devono derivare dall'oggetto.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticClassInterfaceImpl"> <source>'{0}': static classes cannot implement interfaces</source> <target state="translated">'{0}': le classi statiche non possono implementare interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_RefStructInterfaceImpl"> <source>'{0}': ref structs cannot implement interfaces</source> <target state="translated">'{0}': gli struct ref non possono implementare interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorInStaticClass"> <source>'{0}': static classes cannot contain user-defined operators</source> <target state="translated">'{0}': le classi statiche non possono contenere operatori definiti dall'utente</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertToStaticClass"> <source>Cannot convert to static type '{0}'</source> <target state="translated">Non è possibile convertire nel tipo statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintIsStaticClass"> <source>'{0}': static classes cannot be used as constraints</source> <target state="translated">'{0}': non si possono usare classi statiche come vincoli</target> <note /> </trans-unit> <trans-unit id="ERR_GenericArgIsStaticClass"> <source>'{0}': static types cannot be used as type arguments</source> <target state="translated">'{0}': i tipi statici non possono essere usati come argomenti di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayOfStaticClass"> <source>'{0}': array elements cannot be of static type</source> <target state="translated">'{0}': gli elementi di matrice non possono essere di tipo statico</target> <note /> </trans-unit> <trans-unit id="ERR_IndexerInStaticClass"> <source>'{0}': cannot declare indexers in a static class</source> <target state="translated">'{0}': non è possibile dichiarare indicizzatori in una classe statica</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterIsStaticClass"> <source>'{0}': static types cannot be used as parameters</source> <target state="translated">'{0}': i tipi statici non possono essere usati come parametri</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnTypeIsStaticClass"> <source>'{0}': static types cannot be used as return types</source> <target state="translated">'{0}': i tipi statici non possono essere usati come tipi restituiti</target> <note /> </trans-unit> <trans-unit id="ERR_VarDeclIsStaticClass"> <source>Cannot declare a variable of static type '{0}'</source> <target state="translated">Non è possibile dichiarare una variabile di tipo statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyThrowInFinally"> <source>A throw statement with no arguments is not allowed in a finally clause that is nested inside the nearest enclosing catch clause</source> <target state="translated">L'utilizzo dell'istruzione throw senza argomenti non è consentito in una clausola finally annidata all'interno della clausola catch di inclusione più vicina</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSpecifier"> <source>'{0}' is not a valid format specifier</source> <target state="translated">'{0}' non è un identificatore di formato valido</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToLockOrDispose"> <source>Possibly incorrect assignment to local '{0}' which is the argument to a using or lock statement. The Dispose call or unlocking will happen on the original value of the local.</source> <target state="translated">È probabile che l'assegnazione all'elemento '{0}' locale, che rappresenta l'argomento di un'istruzione using o lock, non sia corretta. La chiamata Dispose o lo sblocco verrà eseguito sul valore originale dell'elemento locale.</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToLockOrDispose_Title"> <source>Possibly incorrect assignment to local which is the argument to a using or lock statement</source> <target state="translated">È probabile che l'assegnazione alla variabile locale, che rappresenta l'argomento di un'istruzione using o lock, non sia corretta</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeInThisAssembly"> <source>Type '{0}' is defined in this assembly, but a type forwarder is specified for it</source> <target state="translated">Il tipo '{0}' è definito in questo assembly, ma per esso è specificato un server d'inoltro dei tipi</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeIsNested"> <source>Cannot forward type '{0}' because it is a nested type of '{1}'</source> <target state="translated">Non è possibile inoltrare il tipo '{0}' perché è un tipo annidato di '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_CycleInTypeForwarder"> <source>The type forwarder for type '{0}' in assembly '{1}' causes a cycle</source> <target state="translated">Il server d'inoltro del tipo '{0}' nell'assembly '{1}' causa un ciclo</target> <note /> </trans-unit> <trans-unit id="ERR_AssemblyNameOnNonModule"> <source>The /moduleassemblyname option may only be specified when building a target type of 'module'</source> <target state="translated">L'opzione /moduleassemblyname può essere specificata solo durante la compilazione del tipo di destinazione di 'module'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved</source> <target state="translated">Il riferimento all'assembly '{0}' non è valido e non può essere risolto</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFwdType"> <source>Invalid type specified as an argument for TypeForwardedTo attribute</source> <target state="translated">Tipo non valido specificato come argomento dell'attributo TypeForwardedTo</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberStatic"> <source>'{0}' does not implement instance interface member '{1}'. '{2}' cannot implement the interface member because it is static.</source> <target state="needs-review-translation">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare un membro di interfaccia perché è di tipo statico.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberNotPublic"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement an interface member because it is not public.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare un membro di interfaccia perché non è pubblico.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberWrongReturnType"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}' because it does not have the matching return type of '{3}'.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare '{1}' perché non ha il tipo restituito corrispondente di '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeForwarder"> <source>'{0}' duplicate TypeForwardedToAttribute</source> <target state="translated">'TypeForwardedToAttribute è duplicato in '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSelectOrGroup"> <source>A query body must end with a select clause or a group clause</source> <target state="translated">Il corpo di una query deve terminare con una clausola select o group</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContextualKeywordOn"> <source>Expected contextual keyword 'on'</source> <target state="translated">È prevista la parola chiave contestuale 'on'</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContextualKeywordEquals"> <source>Expected contextual keyword 'equals'</source> <target state="translated">È prevista la parola chiave contestuale 'equals'</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContextualKeywordBy"> <source>Expected contextual keyword 'by'</source> <target state="translated">È prevista la parola chiave contestuale 'by'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAnonymousTypeMemberDeclarator"> <source>Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.</source> <target state="translated">Dichiaratore di membro di tipo anonimo non valido. I membri di tipo anonimo devono essere dichiarati con una assegnazione membro, nome semplice o accesso ai membri.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInitializerElementInitializer"> <source>Invalid initializer member declarator</source> <target state="translated">Dichiaratore di membro di inizializzatore non valido</target> <note /> </trans-unit> <trans-unit id="ERR_InconsistentLambdaParameterUsage"> <source>Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit</source> <target state="translated">Utilizzo non coerente dei parametri lambda: i parametri devono essere tutti di tipo esplicito o implicito</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInvalidModifier"> <source>A partial method cannot have the 'abstract' modifier</source> <target state="translated">Un metodo parziale non può contenere il modificatore 'abstract'</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodOnlyInPartialClass"> <source>A partial method must be declared within a partial type</source> <target state="translated">Un metodo parziale deve essere dichiarato in un tipo parziale</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodNotExplicit"> <source>A partial method may not explicitly implement an interface method</source> <target state="translated">Un metodo parziale non può implementare in modo esplicito un metodo di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodExtensionDifference"> <source>Both partial method declarations must be extension methods or neither may be an extension method</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono essere metodi di estensione, altrimenti nessuna delle due potrà esserlo</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodOnlyOneLatent"> <source>A partial method may not have multiple defining declarations</source> <target state="translated">Un metodo parziale non può avere più dichiarazioni di definizione</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodOnlyOneActual"> <source>A partial method may not have multiple implementing declarations</source> <target state="translated">Un metodo parziale non può avere più dichiarazioni di implementazione</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamsDifference"> <source>Both partial method declarations must use a params parameter or neither may use a params parameter</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono usare un parametro params, altrimenti nessuna delle due potrà usarla</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodMustHaveLatent"> <source>No defining declaration found for implementing declaration of partial method '{0}'</source> <target state="translated">Non sono state trovate dichiarazioni di definizione per la dichiarazione di implementazione del metodo parziale '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInconsistentTupleNames"> <source>Both partial method declarations, '{0}' and '{1}', must use the same tuple element names.</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale '{0}' e '{1}' devono usare gli stessi nomi di elementi di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInconsistentConstraints"> <source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source> <target state="translated">Le dichiarazioni di metodo parziali di '{0}' contengono vincoli incoerenti per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodToDelegate"> <source>Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration</source> <target state="translated">Non è possibile creare il delegato dal metodo '{0}' perché è un metodo parziale senza una dichiarazione di implementazione</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodStaticDifference"> <source>Both partial method declarations must be static or neither may be static</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono essere statiche, altrimenti nessuna delle due potrà esserlo</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodUnsafeDifference"> <source>Both partial method declarations must be unsafe or neither may be unsafe</source> <target state="translated">Nessuna o entrambe le dichiarazioni di metodi parziali devono essere di tipo unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInExpressionTree"> <source>Partial methods with only a defining declaration or removed conditional methods cannot be used in expression trees</source> <target state="translated">Non è possibile usare negli alberi delle espressioni metodi parziali contenenti solo una dichiarazione di definizione o metodi condizionali rimossi</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteOverridingNonObsolete"> <source>Obsolete member '{0}' overrides non-obsolete member '{1}'</source> <target state="translated">Il membro obsoleto '{0}' esegue l'override del membro non obsoleto '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteOverridingNonObsolete_Title"> <source>Obsolete member overrides non-obsolete member</source> <target state="translated">Il membro obsoleto esegue l'override del membro non obsoleto</target> <note /> </trans-unit> <trans-unit id="WRN_DebugFullNameTooLong"> <source>The fully qualified name for '{0}' is too long for debug information. Compile without '/debug' option.</source> <target state="translated">Il nome completo per '{0}' è troppo lungo per le informazioni di debug. Compilare senza l'opzione '/debug'.</target> <note /> </trans-unit> <trans-unit id="WRN_DebugFullNameTooLong_Title"> <source>Fully qualified name is too long for debug information</source> <target state="translated">Il nome completo è troppo lungo per le informazioni di debug</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableAssignedBadValue"> <source>Cannot assign {0} to an implicitly-typed variable</source> <target state="translated">Non è possibile assegnare {0} a una variabile tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableWithNoInitializer"> <source>Implicitly-typed variables must be initialized</source> <target state="translated">Le variabili tipizzate in modo implicito devono essere inizializzate</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableMultipleDeclarator"> <source>Implicitly-typed variables cannot have multiple declarators</source> <target state="translated">Le variabili tipizzate in modo implicito non possono avere più dichiaratori</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableAssignedArrayInitializer"> <source>Cannot initialize an implicitly-typed variable with an array initializer</source> <target state="translated">Non è possibile inizializzare una variabile locale tipizzata in modo implicito con un inizializzatore di matrici</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedLocalCannotBeFixed"> <source>Implicitly-typed local variables cannot be fixed</source> <target state="translated">Le variabili locali tipizzate in modo implicito non possono essere di tipo fisso</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableCannotBeConst"> <source>Implicitly-typed variables cannot be constant</source> <target state="translated">Le variabili tipizzate in modo implicito non possono essere costanti</target> <note /> </trans-unit> <trans-unit id="WRN_ExternCtorNoImplementation"> <source>Constructor '{0}' is marked external</source> <target state="translated">Il costruttore '{0}' è contrassegnato come esterno</target> <note /> </trans-unit> <trans-unit id="WRN_ExternCtorNoImplementation_Title"> <source>Constructor is marked external</source> <target state="translated">Il costruttore è contrassegnato come esterno</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVarNotFound"> <source>The contextual keyword 'var' may only appear within a local variable declaration or in script code</source> <target state="translated">La parola chiave contestuale 'var' può essere specificata solo all'interno di una dichiarazione di variabile locale o in codice script</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedArrayNoBestType"> <source>No best type found for implicitly-typed array</source> <target state="translated">Impossibile trovare il tipo migliore per la matrice tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypePropertyAssignedBadValue"> <source>Cannot assign '{0}' to anonymous type property</source> <target state="translated">Non è possibile assegnare '{0}' alla proprietà di tipo anonimo</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsBaseAccess"> <source>An expression tree may not contain a base access</source> <target state="translated">L'albero delle espressioni non può contenere un accesso di base</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsAssignment"> <source>An expression tree may not contain an assignment operator</source> <target state="translated">L'albero delle espressioni non può contenere un operatore di assegnazione</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeDuplicatePropertyName"> <source>An anonymous type cannot have multiple properties with the same name</source> <target state="translated">Un tipo anonimo non può avere più proprietà con lo stesso nome</target> <note /> </trans-unit> <trans-unit id="ERR_StatementLambdaToExpressionTree"> <source>A lambda expression with a statement body cannot be converted to an expression tree</source> <target state="translated">Non è possibile convertire un'espressione lambda con il corpo di un'istruzione in un albero delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeMustHaveDelegate"> <source>Cannot convert lambda to an expression tree whose type argument '{0}' is not a delegate type</source> <target state="translated">Non è possibile convertire un'espressione lambda in un albero delle espressioni in cui l'argomento '{0}' del tipo non è un tipo delegato</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNotAvailable"> <source>Cannot use anonymous type in a constant expression</source> <target state="translated">Impossibile utilizzare il tipo anonimo in un'espressione costante</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaInIsAs"> <source>The first operand of an 'is' or 'as' operator may not be a lambda expression, anonymous method, or method group.</source> <target state="translated">Il primo operando di un operatore 'is' o 'as' non può essere un'espressione lambda, un metodo anonimo o un gruppo di metodi.</target> <note /> </trans-unit> <trans-unit id="ERR_TypelessTupleInAs"> <source>The first operand of an 'as' operator may not be a tuple literal without a natural type.</source> <target state="translated">Il primo operando di un operatore 'as' non può essere un valore letterale di tupla senza un tipo naturale.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsMultiDimensionalArrayInitializer"> <source>An expression tree may not contain a multidimensional array initializer</source> <target state="translated">L'albero delle espressioni non può contenere un inizializzatore di matrici multidimensionali</target> <note /> </trans-unit> <trans-unit id="ERR_MissingArgument"> <source>Argument missing</source> <target state="translated">Manca l'argomento</target> <note /> </trans-unit> <trans-unit id="ERR_VariableUsedBeforeDeclaration"> <source>Cannot use local variable '{0}' before it is declared</source> <target state="translated">Non è possibile usare la variabile locale '{0}' prima che sia dichiarata</target> <note /> </trans-unit> <trans-unit id="ERR_RecursivelyTypedVariable"> <source>Type of '{0}' cannot be inferred since its initializer directly or indirectly refers to the definition.</source> <target state="translated">Il tipo di '{0}' non può essere dedotto perché il relativo inizializzatore fa riferimento in modo diretto o indiretto alla definizione.</target> <note /> </trans-unit> <trans-unit id="ERR_UnassignedThisAutoProperty"> <source>Auto-implemented property '{0}' must be fully assigned before control is returned to the caller.</source> <target state="translated">La proprietà implementata automaticamente '{0}' deve essere completamente assegnata prima che il controllo venga restituito al chiamante.</target> <note /> </trans-unit> <trans-unit id="ERR_VariableUsedBeforeDeclarationAndHidesField"> <source>Cannot use local variable '{0}' before it is declared. The declaration of the local variable hides the field '{1}'.</source> <target state="translated">Non è possibile usare la variabile locale '{0}' prima che sia dichiarata. La dichiarazione della variabile locale nasconde il campo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsBadCoalesce"> <source>An expression tree lambda may not contain a coalescing operator with a null or default literal left-hand side</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un operatore di coalescenza con un valore letterale Null o predefinito nella parte sinistra</target> <note /> </trans-unit> <trans-unit id="ERR_IdentifierExpected"> <source>Identifier expected</source> <target state="translated">È previsto un identificatore</target> <note /> </trans-unit> <trans-unit id="ERR_SemicolonExpected"> <source>; expected</source> <target state="translated">È previsto un punto e virgola (;)</target> <note /> </trans-unit> <trans-unit id="ERR_SyntaxError"> <source>Syntax error, '{0}' expected</source> <target state="translated">Errore di sintassi. È previsto '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateModifier"> <source>Duplicate '{0}' modifier</source> <target state="translated">Il modificatore '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAccessor"> <source>Property accessor already defined</source> <target state="translated">La funzione di accesso alla proprietà è già definita</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralTypeExpected"> <source>Type byte, sbyte, short, ushort, int, uint, long, or ulong expected</source> <target state="translated">È previsto il tipo byte, sbyte, short, ushort, int, uint, long o ulong</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalEscape"> <source>Unrecognized escape sequence</source> <target state="translated">Sequenza di escape non riconosciuta</target> <note /> </trans-unit> <trans-unit id="ERR_NewlineInConst"> <source>Newline in constant</source> <target state="translated">Nuova riga nella costante</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyCharConst"> <source>Empty character literal</source> <target state="translated">Il valore letterale carattere è vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyCharsInConst"> <source>Too many characters in character literal</source> <target state="translated">Troppi caratteri nel valore letterale carattere</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNumber"> <source>Invalid number</source> <target state="translated">Numero non valido</target> <note /> </trans-unit> <trans-unit id="ERR_GetOrSetExpected"> <source>A get or set accessor expected</source> <target state="translated">È prevista una funzione di accesso get o set</target> <note /> </trans-unit> <trans-unit id="ERR_ClassTypeExpected"> <source>An object, string, or class type expected</source> <target state="translated">È previsto un tipo oggetto, stringa o classe</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentExpected"> <source>Named attribute argument expected</source> <target state="translated">È previsto un argomento denominato dell'attributo</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyCatches"> <source>Catch clauses cannot follow the general catch clause of a try statement</source> <target state="translated">Le clausole catch non possono seguire la clausola catch generale di un'istruzione try</target> <note /> </trans-unit> <trans-unit id="ERR_ThisOrBaseExpected"> <source>Keyword 'this' or 'base' expected</source> <target state="translated">È prevista la parola chiave 'this' o 'base'</target> <note /> </trans-unit> <trans-unit id="ERR_OvlUnaryOperatorExpected"> <source>Overloadable unary operator expected</source> <target state="translated">È previsto un operatore unario che supporti l'overload</target> <note /> </trans-unit> <trans-unit id="ERR_OvlBinaryOperatorExpected"> <source>Overloadable binary operator expected</source> <target state="translated">È previsto un operatore binario che supporti l'overload</target> <note /> </trans-unit> <trans-unit id="ERR_IntOverflow"> <source>Integral constant is too large</source> <target state="translated">La costante integrale è troppo grande</target> <note /> </trans-unit> <trans-unit id="ERR_EOFExpected"> <source>Type or namespace definition, or end-of-file expected</source> <target state="translated">È prevista la definizione del tipo o dello spazio dei nomi oppure la fine del file</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalDefinitionOrStatementExpected"> <source>Member definition, statement, or end-of-file expected</source> <target state="translated">È prevista una definizione di membro, un'istruzione o la fine del file</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmbeddedStmt"> <source>Embedded statement cannot be a declaration or labeled statement</source> <target state="translated">Un'istruzione incorporata non può essere una dichiarazione o un'istruzione con etichetta</target> <note /> </trans-unit> <trans-unit id="ERR_PPDirectiveExpected"> <source>Preprocessor directive expected</source> <target state="translated">È prevista la direttiva per il preprocessore</target> <note /> </trans-unit> <trans-unit id="ERR_EndOfPPLineExpected"> <source>Single-line comment or end-of-line expected</source> <target state="translated">È previsto un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="ERR_CloseParenExpected"> <source>) expected</source> <target state="translated">È previsto il segno )</target> <note /> </trans-unit> <trans-unit id="ERR_EndifDirectiveExpected"> <source>#endif directive expected</source> <target state="translated">È prevista la direttiva #endif</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedDirective"> <source>Unexpected preprocessor directive</source> <target state="translated">La direttiva per il preprocessore è imprevista</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorDirective"> <source>#error: '{0}'</source> <target state="translated">#error: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_WarningDirective"> <source>#warning: '{0}'</source> <target state="translated">#warning: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_WarningDirective_Title"> <source>#warning directive</source> <target state="translated">direttiva #warning</target> <note /> </trans-unit> <trans-unit id="ERR_TypeExpected"> <source>Type expected</source> <target state="translated">È previsto un tipo</target> <note /> </trans-unit> <trans-unit id="ERR_PPDefFollowsToken"> <source>Cannot define/undefine preprocessor symbols after first token in file</source> <target state="translated">Impossibile definire o annullare la definizione dei simboli del preprocessore dopo il primo token nel file</target> <note /> </trans-unit> <trans-unit id="ERR_PPReferenceFollowsToken"> <source>Cannot use #r after first token in file</source> <target state="translated">Non è possibile usare #r dopo il primo token del file</target> <note /> </trans-unit> <trans-unit id="ERR_OpenEndedComment"> <source>End-of-file found, '*/' expected</source> <target state="translated">Trovata la fine del file, era previsto '*/'</target> <note /> </trans-unit> <trans-unit id="ERR_Merge_conflict_marker_encountered"> <source>Merge conflict marker encountered</source> <target state="translated">È stato rilevato un marcatore di conflitti di merge</target> <note /> </trans-unit> <trans-unit id="ERR_NoRefOutWhenRefOnly"> <source>Do not use refout when using refonly.</source> <target state="translated">Non usare refout quando si usa refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNetModuleOutputWhenRefOutOrRefOnly"> <source>Cannot compile net modules when using /refout or /refonly.</source> <target state="translated">Non è possibile compilare i moduli .NET quando si usa /refout o /refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_OvlOperatorExpected"> <source>Overloadable operator expected</source> <target state="translated">È previsto un operatore che supporti l'overload</target> <note /> </trans-unit> <trans-unit id="ERR_EndRegionDirectiveExpected"> <source>#endregion directive expected</source> <target state="translated">È prevista la direttiva #endregion</target> <note /> </trans-unit> <trans-unit id="ERR_UnterminatedStringLit"> <source>Unterminated string literal</source> <target state="translated">Valore letterale stringa non completo</target> <note /> </trans-unit> <trans-unit id="ERR_BadDirectivePlacement"> <source>Preprocessor directives must appear as the first non-whitespace character on a line</source> <target state="translated">Le direttive per il preprocessore devono trovarsi all'inizio di una riga</target> <note /> </trans-unit> <trans-unit id="ERR_IdentifierExpectedKW"> <source>Identifier expected; '{1}' is a keyword</source> <target state="translated">È previsto un identificatore, mentre '{1}' è una parola chiave</target> <note /> </trans-unit> <trans-unit id="ERR_SemiOrLBraceExpected"> <source>{ or ; expected</source> <target state="translated">È previsto il segno { o un punto e virgola (;)</target> <note /> </trans-unit> <trans-unit id="ERR_MultiTypeInDeclaration"> <source>Cannot use more than one type in a for, using, fixed, or declaration statement</source> <target state="translated">Impossibile utilizzare più di un tipo nelle istruzioni for, using, fixed e nelle dichiarazioni</target> <note /> </trans-unit> <trans-unit id="ERR_AddOrRemoveExpected"> <source>An add or remove accessor expected</source> <target state="translated">È prevista una funzione di accesso add o remove</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedCharacter"> <source>Unexpected character '{0}'</source> <target state="translated">Il carattere '{0}' è imprevisto</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedToken"> <source>Unexpected token '{0}'</source> <target state="translated">Token '{0}' imprevisto</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedInStatic"> <source>'{0}': static classes cannot contain protected members</source> <target state="translated">'{0}': le classi statiche non possono contenere membri protetti</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableGeneralCatch"> <source>A previous catch clause already catches all exceptions. All non-exceptions thrown will be wrapped in a System.Runtime.CompilerServices.RuntimeWrappedException.</source> <target state="translated">Una clausola catch precedente rileva già tutte le eccezioni. Verrà eseguito il wrapping di tutti gli oggetti generati diversi da un'eccezione in System.Runtime.CompilerServices.RuntimeWrappedException.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableGeneralCatch_Title"> <source>A previous catch clause already catches all exceptions</source> <target state="translated">Una clausola catch precedente rileva già tutte le eccezioni</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableGeneralCatch_Description"> <source>This warning is caused when a catch() block has no specified exception type after a catch (System.Exception e) block. The warning advises that the catch() block will not catch any exceptions. A catch() block after a catch (System.Exception e) block can catch non-CLS exceptions if the RuntimeCompatibilityAttribute is set to false in the AssemblyInfo.cs file: [assembly: RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)]. If this attribute is not set explicitly to false, all thrown non-CLS exceptions are wrapped as Exceptions and the catch (System.Exception e) block catches them.</source> <target state="translated">Questo avviso viene visualizzato quando per un blocco catch() non è stato specificato un tipo di eccezione dopo un blocco catch (System.Exception e). L'avviso indica che il blocco catch() non rileverà alcuna eccezione. Un blocco catch() dopo un blocco catch (System.Exception e) può rilevare eccezioni non CLS se RuntimeCompatibilityAttribute è impostato su false nel file AssemblyInfo.cs file: [assembly: RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)]. Se questo attributo non è impostato in modo esplicito su false, verrà eseguito il wrapping di tutte le eccezioni non CLS rilevate come Exception per consentire al blocco catch (System.Exception e) di rilevarle.</target> <note /> </trans-unit> <trans-unit id="ERR_IncrementLvalueExpected"> <source>The operand of an increment or decrement operator must be a variable, property or indexer</source> <target state="translated">L'operando di un operatore di incremento o decremento deve essere una variabile, una proprietà o un indicizzatore</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuchMemberOrExtension"> <source>'{0}' does not contain a definition for '{1}' and no accessible extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?)</source> <target state="translated">'{0}' non contiene una definizione di '{1}' e non è stato trovato alcun metodo di estensione accessibile '{1}' che accetta un primo argomento di tipo '{0}'. Probabilmente manca una direttiva using o un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuchMemberOrExtensionNeedUsing"> <source>'{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive for '{2}'?)</source> <target state="translated">'{0}' non contiene una definizione di '{1}' e non è stato trovato alcun metodo di estensione '{1}' che accetta un primo argomento di tipo '{0}'. Probabilmente manca una direttiva using per '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadThisParam"> <source>Method '{0}' has a parameter modifier 'this' which is not on the first parameter</source> <target state="translated">Il metodo '{0}' ha un modificatore di parametro 'this' che non si trova nel primo parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadParameterModifiers"> <source> The parameter modifier '{0}' cannot be used with '{1}'</source> <target state="translated"> Non è possibile usare il modificatore di parametro '{0}' con '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeforThis"> <source>The first parameter of an extension method cannot be of type '{0}'</source> <target state="translated">Il primo parametro di un metodo di estensione non può essere di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamModThis"> <source>A parameter array cannot be used with 'this' modifier on an extension method</source> <target state="translated">Non è possibile usare una matrice di parametri con il modificatore 'this' in un metodo di estensione</target> <note /> </trans-unit> <trans-unit id="ERR_BadExtensionMeth"> <source>Extension method must be static</source> <target state="translated">Il metodo di estensione deve essere statico</target> <note /> </trans-unit> <trans-unit id="ERR_BadExtensionAgg"> <source>Extension method must be defined in a non-generic static class</source> <target state="translated">Il metodo di estensione deve essere definito in una classe statica non generica</target> <note /> </trans-unit> <trans-unit id="ERR_DupParamMod"> <source>A parameter can only have one '{0}' modifier</source> <target state="translated">Un parametro può avere un solo modificatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodsDecl"> <source>Extension methods must be defined in a top level static class; {0} is a nested class</source> <target state="translated">I metodi di estensione devono essere definiti in una classe statica di primo livello, mentre {0} è una classe annidata</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionAttrNotFound"> <source>Cannot define a new extension method because the compiler required type '{0}' cannot be found. Are you missing a reference to System.Core.dll?</source> <target state="translated">Non è possibile definire un nuovo metodo di estensione perché non è stato trovato il tipo '{0}' richiesto dal compilatore. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitExtension"> <source>Do not use 'System.Runtime.CompilerServices.ExtensionAttribute'. Use the 'this' keyword instead.</source> <target state="translated">Non usare 'System.Runtime.CompilerServices.ExtensionAttribute'. Usare la parola chiave 'this'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitDynamicAttr"> <source>Do not use 'System.Runtime.CompilerServices.DynamicAttribute'. Use the 'dynamic' keyword instead.</source> <target state="translated">Non usare 'System.Runtime.CompilerServices.DynamicAttribute'. Usare la parola chiave 'dynamic'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDynamicPhantomOnBaseCtor"> <source>The constructor call needs to be dynamically dispatched, but cannot be because it is part of a constructor initializer. Consider casting the dynamic arguments.</source> <target state="translated">Non è possibile eseguire l'invio dinamico richiesto della chiamata al costruttore perché la chiamata fa parte di un inizializzatore del costruttore. Provare a eseguire il cast degli argomenti dinamici.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTypeExtDelegate"> <source>Extension method '{0}' defined on value type '{1}' cannot be used to create delegates</source> <target state="translated">Non è possibile usare il metodo di estensione '{0}' definito nel tipo di valore '{1}' per creare delegati</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgCount"> <source>No overload for method '{0}' takes {1} arguments</source> <target state="translated">Nessun overload del metodo '{0}' accetta {1} argomenti</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgType"> <source>Argument {0}: cannot convert from '{1}' to '{2}'</source> <target state="translated">Argomento {0}: non è possibile convertire da '{1}' a '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoSourceFile"> <source>Source file '{0}' could not be opened -- {1}</source> <target state="translated">Non è possibile aprire il file di origine '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantRefResource"> <source>Cannot link resource files when building a module</source> <target state="translated">Non è possibile collegare i file di risorse durante la compilazione di un modulo</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceNotUnique"> <source>Resource identifier '{0}' has already been used in this assembly</source> <target state="translated">L'identificatore di risorsa '{0}' è già stato usato in questo assembly</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceFileNameNotUnique"> <source>Each linked resource and module must have a unique filename. Filename '{0}' is specified more than once in this assembly</source> <target state="translated">Ogni risorsa e ogni modulo collegato devono avere un nome file univoco. Il nome file '{0}' è specificato più di una volta in questo assembly</target> <note /> </trans-unit> <trans-unit id="ERR_ImportNonAssembly"> <source>The referenced file '{0}' is not an assembly</source> <target state="translated">Il file di riferimento '{0}' non è un assembly</target> <note /> </trans-unit> <trans-unit id="ERR_RefLvalueExpected"> <source>A ref or out value must be an assignable variable</source> <target state="translated">Un valore out o ref deve essere una variabile assegnabile</target> <note /> </trans-unit> <trans-unit id="ERR_BaseInStaticMeth"> <source>Keyword 'base' is not available in a static method</source> <target state="translated">La parola chiave 'base' non è disponibile in un metodo statico</target> <note /> </trans-unit> <trans-unit id="ERR_BaseInBadContext"> <source>Keyword 'base' is not available in the current context</source> <target state="translated">La parola chiave 'base' non è disponibile nel contesto corrente</target> <note /> </trans-unit> <trans-unit id="ERR_RbraceExpected"> <source>} expected</source> <target state="translated">È previsto il segno }</target> <note /> </trans-unit> <trans-unit id="ERR_LbraceExpected"> <source>{ expected</source> <target state="translated">È previsto il segno {</target> <note /> </trans-unit> <trans-unit id="ERR_InExpected"> <source>'in' expected</source> <target state="translated">'È previsto 'in'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocExpr"> <source>Invalid preprocessor expression</source> <target state="translated">Espressione per il preprocessore non valida</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMemberDecl"> <source>Invalid token '{0}' in class, record, struct, or interface member declaration</source> <target state="translated">Il token '{0}' nella dichiarazione del membro di classe, record, struct o interfaccia non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_MemberNeedsType"> <source>Method must have a return type</source> <target state="translated">Il metodo deve avere un tipo restituito</target> <note /> </trans-unit> <trans-unit id="ERR_BadBaseType"> <source>Invalid base type</source> <target state="translated">Il tipo di base non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_EmptySwitch"> <source>Empty switch block</source> <target state="translated">Il blocco switch è vuoto</target> <note /> </trans-unit> <trans-unit id="WRN_EmptySwitch_Title"> <source>Empty switch block</source> <target state="translated">Il blocco switch è vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndTry"> <source>Expected catch or finally</source> <target state="translated">È previsto un blocco catch o finally</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidExprTerm"> <source>Invalid expression term '{0}'</source> <target state="translated">'{0}' non è un termine valido nell'espressione</target> <note /> </trans-unit> <trans-unit id="ERR_BadNewExpr"> <source>A new expression requires an argument list or (), [], or {} after type</source> <target state="translated">Un'espressione new richiede un elenco di argomenti oppure (), [] o {} dopo il tipo</target> <note /> </trans-unit> <trans-unit id="ERR_NoNamespacePrivate"> <source>Elements defined in a namespace cannot be explicitly declared as private, protected, protected internal, or private protected</source> <target state="translated">Gli elementi definiti in uno spazio dei nomi non possono essere dichiarati in modo esplicito come private, protected, protected internal o private protected</target> <note /> </trans-unit> <trans-unit id="ERR_BadVarDecl"> <source>Expected ; or = (cannot specify constructor arguments in declaration)</source> <target state="translated">È previsto il segno ; oppure = (non è possibile specificare gli argomenti del costruttore nella dichiarazione)</target> <note /> </trans-unit> <trans-unit id="ERR_UsingAfterElements"> <source>A using clause must precede all other elements defined in the namespace except extern alias declarations</source> <target state="translated">La clausola using deve precedere tutti gli altri elementi definiti nello spazio dei nomi ad eccezione delle dichiarazioni di alias extern</target> <note /> </trans-unit> <trans-unit id="ERR_BadBinOpArgs"> <source>Overloaded binary operator '{0}' takes two parameters</source> <target state="translated">L'operatore binario di overload '{0}' accetta due parametri</target> <note /> </trans-unit> <trans-unit id="ERR_BadUnOpArgs"> <source>Overloaded unary operator '{0}' takes one parameter</source> <target state="translated">L'operatore unario di overload '{0}' accetta un parametro</target> <note /> </trans-unit> <trans-unit id="ERR_NoVoidParameter"> <source>Invalid parameter type 'void'</source> <target state="translated">Tipo parametro 'void' non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAlias"> <source>The using alias '{0}' appeared previously in this namespace</source> <target state="translated">Using Alias '{0}' è già presente nello spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="ERR_BadProtectedAccess"> <source>Cannot access protected member '{0}' via a qualifier of type '{1}'; the qualifier must be of type '{2}' (or derived from it)</source> <target state="translated">Non è possibile accedere al membro protetto '{0}' tramite un qualificatore di tipo '{1}'. Il qualificatore deve essere di tipo '{2}' o derivato da esso</target> <note /> </trans-unit> <trans-unit id="ERR_AddModuleAssembly"> <source>'{0}' cannot be added to this assembly because it already is an assembly</source> <target state="translated">'Non è possibile aggiungere '{0}' a questo assembly perché è già un assembly</target> <note /> </trans-unit> <trans-unit id="ERR_BindToBogusProp2"> <source>Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor methods '{1}' or '{2}'</source> <target state="translated">La proprietà, l'indicizzatore o l'evento '{0}' non è supportato dal linguaggio. Provare a chiamare direttamente i metodi della funzione di accesso '{1}' o '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_BindToBogusProp1"> <source>Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor method '{1}'</source> <target state="translated">La proprietà, l'indicizzatore o l'evento '{0}' non è supportato dal linguaggio. Provare a chiamare direttamente il metodo della funzione di accesso '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoVoidHere"> <source>Keyword 'void' cannot be used in this context</source> <target state="translated">Non è possibile usare la parola chiave 'void' in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_IndexerNeedsParam"> <source>Indexers must have at least one parameter</source> <target state="translated">Gli indicizzatori devono avere almeno un parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadArraySyntax"> <source>Array type specifier, [], must appear before parameter name</source> <target state="translated">L'identificatore del tipo matrice, [], deve trovarsi prima del nome del parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadOperatorSyntax"> <source>Declaration is not valid; use '{0} operator &lt;dest-type&gt; (...' instead</source> <target state="translated">La dichiarazione non è valida. Usare '{0} operator &lt;tipo distruttore&gt; (...'</target> <note /> </trans-unit> <trans-unit id="ERR_MainClassNotFound"> <source>Could not find '{0}' specified for Main method</source> <target state="translated">Non è stato trovato l'elemento '{0}' specificato per il metodo Main</target> <note /> </trans-unit> <trans-unit id="ERR_MainClassNotClass"> <source>'{0}' specified for Main method must be a non-generic class, record, struct, or interface</source> <target state="translated">L'elemento '{0}' specificato per il metodo Main deve essere una classe, un record, un'interfaccia o uno struct non generico valido</target> <note /> </trans-unit> <trans-unit id="ERR_NoMainInClass"> <source>'{0}' does not have a suitable static 'Main' method</source> <target state="translated">'{0}' non contiene un metodo 'Main' statico appropriato</target> <note /> </trans-unit> <trans-unit id="ERR_MainClassIsImport"> <source>Cannot use '{0}' for Main method because it is imported</source> <target state="translated">Non è possibile usare '{0}' per il metodo Main perché è importato</target> <note /> </trans-unit> <trans-unit id="ERR_OutputNeedsName"> <source>Outputs without source must have the /out option specified</source> <target state="translated">Per gli output senza origine occorre specificare l'opzione /out</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndManifest"> <source>Conflicting options specified: Win32 resource file; Win32 manifest</source> <target state="translated">Sono state specificate opzioni in conflitto: file di risorse Win32; manifesto Win32</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndIcon"> <source>Conflicting options specified: Win32 resource file; Win32 icon</source> <target state="translated">Sono state specificate opzioni in conflitto: file di risorse Win32; icona Win32</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadResource"> <source>Error reading resource '{0}' -- '{1}'</source> <target state="translated">Si è verificato un errore durante la lettura della risorsa '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DocFileGen"> <source>Error writing to XML documentation file: {0}</source> <target state="translated">Si è verificato un errore durante la scrittura nel file di documentazione XML: {0}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseError"> <source>XML comment has badly formed XML -- '{0}'</source> <target state="translated">Il formato XML del commento XML è errato - '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseError_Title"> <source>XML comment has badly formed XML</source> <target state="translated">Il formato XML del commento XML è errato</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateParamTag"> <source>XML comment has a duplicate param tag for '{0}'</source> <target state="translated">Il commento XML contiene un tag param duplicato per '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateParamTag_Title"> <source>XML comment has a duplicate param tag</source> <target state="translated">Il commento XML contiene un tag param duplicato</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamTag"> <source>XML comment has a param tag for '{0}', but there is no parameter by that name</source> <target state="translated">Il commento XML ha un tag param per '{0}', ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamTag_Title"> <source>XML comment has a param tag, but there is no parameter by that name</source> <target state="translated">Il commento XML ha un tag param, ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamRefTag"> <source>XML comment on '{1}' has a paramref tag for '{0}', but there is no parameter by that name</source> <target state="translated">Il commento XML in '{1}' ha un tag paramref per '{0}', ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamRefTag_Title"> <source>XML comment has a paramref tag, but there is no parameter by that name</source> <target state="translated">Il commento XML ha un tag paramref, ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_MissingParamTag"> <source>Parameter '{0}' has no matching param tag in the XML comment for '{1}' (but other parameters do)</source> <target state="translated">Il parametro '{0}', diversamente da altri parametri, non contiene tag param corrispondenti nel commento XML per '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingParamTag_Title"> <source>Parameter has no matching param tag in the XML comment (but other parameters do)</source> <target state="translated">Il parametro, diversamente da altri parametri, non contiene tag param corrispondenti nel commento XML</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRef"> <source>XML comment has cref attribute '{0}' that could not be resolved</source> <target state="translated">Il commento XML contiene l'attributo cref '{0}' che non è stato possibile risolvere</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRef_Title"> <source>XML comment has cref attribute that could not be resolved</source> <target state="translated">Il commento XML contiene l'attributo cref che non è stato possibile risolvere</target> <note /> </trans-unit> <trans-unit id="ERR_BadStackAllocExpr"> <source>A stackalloc expression requires [] after type</source> <target state="translated">In un'espressione stackalloc occorre specificare [] dopo il tipo</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLineNumber"> <source>The line number specified for #line directive is missing or invalid</source> <target state="translated">Il numero di riga specificato per la direttiva #line manca o non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPPFile"> <source>Quoted file name, single-line comment or end-of-line expected</source> <target state="translated">È previsto un nome file tra virgolette, un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedPPFile"> <source>Quoted file name expected</source> <target state="translated">È previsto un nome file racchiuso tra virgolette</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceDirectiveOnlyAllowedInScripts"> <source>#r is only allowed in scripts</source> <target state="translated">#r è consentito solo negli script</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachMissingMember"> <source>foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'</source> <target state="translated">L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica per '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefParamType"> <source>Invalid type for parameter {0} in XML comment cref attribute: '{1}'</source> <target state="translated">Il tipo non è valido per il parametro {0} nell'attributo cref del commento XML: '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefParamType_Title"> <source>Invalid type for parameter in XML comment cref attribute</source> <target state="translated">Il tipo non è valido per il parametro nell'attributo cref del commento XML</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefReturnType"> <source>Invalid return type in XML comment cref attribute</source> <target state="translated">Tipo restituito non valido nell'attributo cref del commento XML</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefReturnType_Title"> <source>Invalid return type in XML comment cref attribute</source> <target state="translated">Tipo restituito non valido nell'attributo cref del commento XML</target> <note /> </trans-unit> <trans-unit id="ERR_BadWin32Res"> <source>Error reading Win32 resources -- {0}</source> <target state="translated">Si è verificato un errore durante la lettura delle risorse Win32 - {0}</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefSyntax"> <source>XML comment has syntactically incorrect cref attribute '{0}'</source> <target state="translated">Il commento XML contiene l'attributo cref '{0}' che è sintatticamente errato</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefSyntax_Title"> <source>XML comment has syntactically incorrect cref attribute</source> <target state="translated">Il commento XML contiene l'attributo cref che è sintatticamente errato</target> <note /> </trans-unit> <trans-unit id="ERR_BadModifierLocation"> <source>Member modifier '{0}' must precede the member type and name</source> <target state="translated">Il modificatore del membro '{0}' deve precedere il nome e il tipo del membro</target> <note /> </trans-unit> <trans-unit id="ERR_MissingArraySize"> <source>Array creation must have array size or array initializer</source> <target state="translated">Per la creazione della matrice occorre specificare la dimensione della matrice o l'inizializzatore della matrice</target> <note /> </trans-unit> <trans-unit id="WRN_UnprocessedXMLComment"> <source>XML comment is not placed on a valid language element</source> <target state="translated">Il commento XML non si trova in un elemento di linguaggio valido</target> <note /> </trans-unit> <trans-unit id="WRN_UnprocessedXMLComment_Title"> <source>XML comment is not placed on a valid language element</source> <target state="translated">Il commento XML non si trova in un elemento di linguaggio valido</target> <note /> </trans-unit> <trans-unit id="WRN_FailedInclude"> <source>Unable to include XML fragment '{1}' of file '{0}' -- {2}</source> <target state="translated">Non è possibile includere il frammento XML '{1}' del file '{0}' - {2}</target> <note /> </trans-unit> <trans-unit id="WRN_FailedInclude_Title"> <source>Unable to include XML fragment</source> <target state="translated">Non è possibile includere il frammento XML</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidInclude"> <source>Invalid XML include element -- {0}</source> <target state="translated">L'elemento di inclusione XML non è valido - {0}</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidInclude_Title"> <source>Invalid XML include element</source> <target state="translated">L'elemento di inclusione XML non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_MissingXMLComment"> <source>Missing XML comment for publicly visible type or member '{0}'</source> <target state="translated">Manca il commento XML per il tipo o il membro '{0}' visibile pubblicamente</target> <note /> </trans-unit> <trans-unit id="WRN_MissingXMLComment_Title"> <source>Missing XML comment for publicly visible type or member</source> <target state="translated">Manca il commento XML per il tipo o il membro visibile pubblicamente</target> <note /> </trans-unit> <trans-unit id="WRN_MissingXMLComment_Description"> <source>The /doc compiler option was specified, but one or more constructs did not have comments.</source> <target state="translated">È stata specificata l'opzione /doc del compilatore, ma per uno o più costrutti non sono disponibili commenti.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseIncludeError"> <source>Badly formed XML in included comments file -- '{0}'</source> <target state="translated">Nel file dei commenti incluso è presente codice XML in formato non corretto: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseIncludeError_Title"> <source>Badly formed XML in included comments file</source> <target state="translated">Nel file dei commenti incluso è presente codice XML in formato errato</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelArgCount"> <source>Delegate '{0}' does not take {1} arguments</source> <target state="translated">Il delegato '{0}' non accetta argomenti {1}</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedSemicolon"> <source>Semicolon after method or accessor block is not valid</source> <target state="translated">Non è possibile inserire un punto e virgola dopo un blocco di metodo o di funzione di accesso</target> <note /> </trans-unit> <trans-unit id="ERR_MethodReturnCantBeRefAny"> <source>The return type of a method, delegate, or function pointer cannot be '{0}'</source> <target state="translated">Il tipo restituito di un metodo, delegato o puntatore a funzione non può essere '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_CompileCancelled"> <source>Compilation cancelled by user</source> <target state="translated">Compilazione annullata dall'utente</target> <note /> </trans-unit> <trans-unit id="ERR_MethodArgCantBeRefAny"> <source>Cannot make reference to variable of type '{0}'</source> <target state="translated">Non è possibile creare il riferimento alla variabile di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyLocal"> <source>Cannot assign to '{0}' because it is read-only</source> <target state="translated">Non è possibile assegnare a '{0}' perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyLocal"> <source>Cannot use '{0}' as a ref or out value because it is read-only</source> <target state="translated">Non è possibile usare '{0}' come valore out o ref perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseRequiredAttribute"> <source>The RequiredAttribute attribute is not permitted on C# types</source> <target state="translated">L'attributo RequiredAttribute non è consentito per i tipi C#</target> <note /> </trans-unit> <trans-unit id="ERR_NoModifiersOnAccessor"> <source>Modifiers cannot be placed on event accessor declarations</source> <target state="translated">Non è possibile inserire modificatori nelle dichiarazioni delle funzioni di accesso agli eventi</target> <note /> </trans-unit> <trans-unit id="ERR_ParamsCantBeWithModifier"> <source>The params parameter cannot be declared as {0}</source> <target state="translated">Non è possibile dichiarare il parametro params come {0}</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnNotLValue"> <source>Cannot modify the return value of '{0}' because it is not a variable</source> <target state="translated">Non è possibile modificare il valore restituito di '{0}' perché non è una variabile</target> <note /> </trans-unit> <trans-unit id="ERR_MissingCoClass"> <source>The managed coclass wrapper class '{0}' for interface '{1}' cannot be found (are you missing an assembly reference?)</source> <target state="translated">La classe wrapper '{0}' della coclasse gestita per l'interfaccia '{1}' non è stata trovata. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousAttribute"> <source>'{0}' is ambiguous between '{1}' and '{2}'. Either use '@{0}' or explicitly include the 'Attribute' suffix.</source> <target state="needs-review-translation">'{0}' è ambiguo tra '{1}' e '{2}'. Usare '@{0}' o '{0}Attribute'</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgExtraRef"> <source>Argument {0} may not be passed with the '{1}' keyword</source> <target state="translated">Non è possibile passare l'argomento {0} con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CmdOptionConflictsSource"> <source>Option '{0}' overrides attribute '{1}' given in a source file or added module</source> <target state="translated">L'opzione '{0}' esegue l'override dell'attributo '{1}' specificato in un file di origine o in un modulo aggiunto</target> <note /> </trans-unit> <trans-unit id="WRN_CmdOptionConflictsSource_Title"> <source>Option overrides attribute given in a source file or added module</source> <target state="translated">L'opzione esegue l'override dell'attributo specificato in un file di origine o in un modulo aggiunto</target> <note /> </trans-unit> <trans-unit id="WRN_CmdOptionConflictsSource_Description"> <source>This warning occurs if the assembly attributes AssemblyKeyFileAttribute or AssemblyKeyNameAttribute found in source conflict with the /keyfile or /keycontainer command line option or key file name or key container specified in the Project Properties.</source> <target state="translated">Questo avviso viene visualizzato se gli attributi di assembly AssemblyKeyFileAttribute o AssemblyKeyNameAttribute rilevati nell'origine sono in conflitto con l'opzione della riga di comando /keyfile o /keycontainer oppure con il nome del file di chiave o con il contenitore di chiavi specificato in Proprietà progetto.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCompatMode"> <source>Invalid option '{0}' for /langversion. Use '/langversion:?' to list supported values.</source> <target state="translated">L'opzione '{0}' non è valida per /langversion. Usare '/langversion:?' per ottenere l'elenco dei valori supportati.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateOnConditional"> <source>Cannot create delegate with '{0}' because it or a method it overrides has a Conditional attribute</source> <target state="translated">Non è possibile creare il delegato con '{0}' perché il delegato o un metodo di cui esegue l'override ha un attributo Conditional</target> <note /> </trans-unit> <trans-unit id="ERR_CantMakeTempFile"> <source>Cannot create temporary file -- {0}</source> <target state="translated">Non è possibile creare il file temporaneo - {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgRef"> <source>Argument {0} must be passed with the '{1}' keyword</source> <target state="translated">L'argomento {0} deve essere passato con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_YieldInAnonMeth"> <source>The yield statement cannot be used inside an anonymous method or lambda expression</source> <target state="translated">Non è possibile usare l'istruzione yield all'interno di un metodo anonimo o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnInIterator"> <source>Cannot return a value from an iterator. Use the yield return statement to return a value, or yield break to end the iteration.</source> <target state="translated">Non è possibile restituire un valore da un iteratore. Usare l'istruzione yield return per restituire un valore o l'istruzione yield break per terminare l'iterazione.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorArgType"> <source>Iterators cannot have ref, in or out parameters</source> <target state="translated">Gli iteratori non possono avere parametri in, out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturn"> <source>The body of '{0}' cannot be an iterator block because '{1}' is not an iterator interface type</source> <target state="translated">Il corpo di '{0}' non può essere un blocco iteratore perché '{1}' non è un tipo interfaccia iteratore</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInFinally"> <source>Cannot yield in the body of a finally clause</source> <target state="translated">Impossibile eseguire la produzione nel corpo di una clausola finally</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInTryOfCatch"> <source>Cannot yield a value in the body of a try block with a catch clause</source> <target state="translated">Impossibile produrre un valore nel corpo di un blocco try con una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyYield"> <source>Expression expected after yield return</source> <target state="translated">Dopo yield return è prevista l'espressione</target> <note /> </trans-unit> <trans-unit id="ERR_AnonDelegateCantUse"> <source>Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function</source> <target state="translated">Non è possibile usare il parametro ref, out o in '{0}' all'interno di un metodo anonimo, di un'espressione lambda, di un'espressione di query o di una funzione locale</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalInnerUnsafe"> <source>Unsafe code may not appear in iterators</source> <target state="translated">Gli iteratori non possono contenere codice unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInCatch"> <source>Cannot yield a value in the body of a catch clause</source> <target state="translated">Impossibile produrre un valore nel corpo di una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateLeave"> <source>Control cannot leave the body of an anonymous method or lambda expression</source> <target state="translated">Il controllo non può lasciare il corpo di un metodo anonimo o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPragma"> <source>Unrecognized #pragma directive</source> <target state="translated">La direttiva #pragma non è stata riconosciuta</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPragma_Title"> <source>Unrecognized #pragma directive</source> <target state="translated">La direttiva #pragma non è stata riconosciuta</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPWarning"> <source>Expected 'disable' or 'restore'</source> <target state="translated">È previsto 'disable' o 'restore'</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPWarning_Title"> <source>Expected 'disable' or 'restore' after #pragma warning</source> <target state="translated">Dopo l'avviso della direttiva #pragma è previsto 'disable' o 'restore'</target> <note /> </trans-unit> <trans-unit id="WRN_BadRestoreNumber"> <source>Cannot restore warning 'CS{0}' because it was disabled globally</source> <target state="translated">Non è possibile ripristinare l'avviso 'CS{0}' perché è stato disabilitato a livello globale</target> <note /> </trans-unit> <trans-unit id="WRN_BadRestoreNumber_Title"> <source>Cannot restore warning because it was disabled globally</source> <target state="translated">Non è possibile ripristinare l'avviso perché è stato disabilitato a livello globale</target> <note /> </trans-unit> <trans-unit id="ERR_VarargsIterator"> <source>__arglist is not allowed in the parameter list of iterators</source> <target state="translated">__arglist non è consentito nell'elenco dei parametri degli iteratori</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeIteratorArgType"> <source>Iterators cannot have unsafe parameters or yield types</source> <target state="translated">Gli iteratori non possono avere parametri unsafe o tipi yield</target> <note /> </trans-unit> <trans-unit id="ERR_BadCoClassSig"> <source>The managed coclass wrapper class signature '{0}' for interface '{1}' is not a valid class name signature</source> <target state="translated">La firma della classe wrapper '{0}' della coclasse gestita per l'interfaccia '{1}' non è valida per il nome della classe</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleIEnumOfT"> <source>foreach statement cannot operate on variables of type '{0}' because it implements multiple instantiations of '{1}'; try casting to a specific interface instantiation</source> <target state="translated">L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché implementa più creazioni di un'istanza di '{1}'. Provare a eseguire il cast su una creazione di un'istanza di interfaccia specifica</target> <note /> </trans-unit> <trans-unit id="ERR_FixedDimsRequired"> <source>A fixed size buffer field must have the array size specifier after the field name</source> <target state="translated">In un campo buffer a dimensione fissa, l'identificatore della dimensione della matrice deve trovarsi dopo il nome del campo</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNotInStruct"> <source>Fixed size buffer fields may only be members of structs</source> <target state="translated">I campi buffer a dimensione fissa possono essere membri solo di struct</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousReturnExpected"> <source>Not all code paths return a value in {0} of type '{1}'</source> <target state="translated">Non tutti i percorsi del codice restituiscono un valore in {0} di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_NonECMAFeature"> <source>Feature '{0}' is not part of the standardized ISO C# language specification, and may not be accepted by other compilers</source> <target state="translated">La funzionalità '{0}' non fa parte della specifica del linguaggio C# standard ISO e potrebbe non essere accettata da altri compilatori</target> <note /> </trans-unit> <trans-unit id="WRN_NonECMAFeature_Title"> <source>Feature is not part of the standardized ISO C# language specification, and may not be accepted by other compilers</source> <target state="translated">La funzionalità non fa parte della specifica del linguaggio C# standard ISO e potrebbe non essere accettata da altri compilatori</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedVerbatimLiteral"> <source>Keyword, identifier, or string expected after verbatim specifier: @</source> <target state="translated">È prevista la parola chiave, l'identificatore o la stringa dopo l'identificatore verbatim: @</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonly"> <source>A readonly field cannot be used as a ref or out value (except in a constructor)</source> <target state="translated">Non è possibile usare un campo di sola lettura come valore out o ref (tranne che in un costruttore)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonly2"> <source>Members of readonly field '{0}' cannot be used as a ref or out value (except in a constructor)</source> <target state="translated">Non è possibile usare i membri del campo di sola lettura '{0}' come valore out o ref (tranne che in un costruttore)</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonly"> <source>A readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer)</source> <target state="translated">Non è possibile assegnare un valore a un campo di sola lettura, tranne che in un costruttore o un setter di sola inizializzazione del tipo in cui è definito il campo o in un inizializzatore di variabile</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonly2"> <source>Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer)</source> <target state="translated">Non è possibile modificare i membri del campo di sola lettura '{0}' (tranne che in un costruttore o in un inizializzatore di variabile)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyNotField"> <source>Cannot use {0} '{1}' as a ref or out value because it is a readonly variable</source> <target state="translated">Non è possibile usare {0} '{1}' come valore ref o out perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyNotField2"> <source>Members of {0} '{1}' cannot be used as a ref or out value because it is a readonly variable</source> <target state="translated">Non è possibile usare i membri di {0} '{1}' come valore ref o out perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AssignReadonlyNotField"> <source>Cannot assign to {0} '{1}' because it is a readonly variable</source> <target state="translated">Non è possibile assegnare a {0} '{1}' perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AssignReadonlyNotField2"> <source>Cannot assign to a member of {0} '{1}' because it is a readonly variable</source> <target state="translated">Non è possibile assegnare a un membro di {0} '{1}' perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyNotField"> <source>Cannot return {0} '{1}' by writable reference because it is a readonly variable</source> <target state="translated">Non è possibile restituire {0} '{1}' per riferimento scrivibile perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyNotField2"> <source>Members of {0} '{1}' cannot be returned by writable reference because it is a readonly variable</source> <target state="translated">Non è possibile restituire i membri di {0} '{1}' per riferimento scrivibile perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyStatic2"> <source>Fields of static readonly field '{0}' cannot be assigned to (except in a static constructor or a variable initializer)</source> <target state="translated">Non è possibile effettuare un'assegnazione a campi del campo statico di sola lettura '{0}' (tranne che in un costruttore statico o in un inizializzatore di variabile)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyStatic2"> <source>Fields of static readonly field '{0}' cannot be used as a ref or out value (except in a static constructor)</source> <target state="translated">Non è possibile usare i campi del campo di sola lettura statico '{0}' come valore out o ref (tranne che in un costruttore statico)</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyLocal2Cause"> <source>Cannot modify members of '{0}' because it is a '{1}'</source> <target state="translated">Non è possibile modificare i membri di '{0}' perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyLocal2Cause"> <source>Cannot use fields of '{0}' as a ref or out value because it is a '{1}'</source> <target state="translated">Non è possibile usare i campi di '{0}' come valore out o ref perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyLocalCause"> <source>Cannot assign to '{0}' because it is a '{1}'</source> <target state="translated">Non è possibile assegnare a '{0}' perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyLocalCause"> <source>Cannot use '{0}' as a ref or out value because it is a '{1}'</source> <target state="translated">Non è possibile usare '{0}' come valore out o ref perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_ErrorOverride"> <source>{0}. See also error CS{1}.</source> <target state="translated">{0}. Vedere anche l'errore CS{1}.</target> <note /> </trans-unit> <trans-unit id="WRN_ErrorOverride_Title"> <source>Warning is overriding an error</source> <target state="translated">Override di un errore con un avviso</target> <note /> </trans-unit> <trans-unit id="WRN_ErrorOverride_Description"> <source>The compiler emits this warning when it overrides an error with a warning. For information about the problem, search for the error code mentioned.</source> <target state="translated">Il compilatore genera questo avviso quando esegue l'override di un errore con un avviso. Per informazioni sul problema, cercare il codice errore indicato.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonMethToNonDel"> <source>Cannot convert {0} to type '{1}' because it is not a delegate type</source> <target state="translated">Non è possibile convertire {0} nel tipo '{1}' perché non è un tipo delegato</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethParams"> <source>Cannot convert {0} to type '{1}' because the parameter types do not match the delegate parameter types</source> <target state="translated">Non è possibile convertire {0} nel tipo '{1}' perché i tipi di parametro non corrispondono ai tipi di parametro del delegato</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethReturns"> <source>Cannot convert {0} to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type</source> <target state="translated">Non è possibile convertire '{0}' nel tipo delegato previsto perché alcuni dei tipi restituiti nel blocco non sono convertibili in modo implicito nel tipo restituito del delegato</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturnExpression"> <source>Since this is an async method, the return expression must be of type '{0}' rather than 'Task&lt;{0}&gt;'</source> <target state="translated">Poiché si tratta di un metodo asincrono, l'espressione restituita deve essere di tipo '{0}' e non 'Task&lt;{0}&gt;'</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAsyncAnonFuncReturns"> <source>Cannot convert async {0} to delegate type '{1}'. An async {0} may return void, Task or Task&lt;T&gt;, none of which are convertible to '{1}'.</source> <target state="translated">Non è possibile convertire il metodo async {0} nel tipo delegato '{1}'. Un metodo async {0} può restituire un valore nullo, Task o Task&lt;T&gt;, nessuno dei quali è convertibile in '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalFixedType"> <source>Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double</source> <target state="translated">Il tipo di buffer a dimensione fissa deve essere uno dei seguenti: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float o double</target> <note /> </trans-unit> <trans-unit id="ERR_FixedOverflow"> <source>Fixed size buffer of length {0} and type '{1}' is too big</source> <target state="translated">Il buffer a dimensione fissa di lunghezza {0} e di tipo '{1}' è troppo grande</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFixedArraySize"> <source>Fixed size buffers must have a length greater than zero</source> <target state="translated">La lunghezza dei buffer a dimensione fissa deve essere maggiore di zero</target> <note /> </trans-unit> <trans-unit id="ERR_FixedBufferNotFixed"> <source>You cannot use fixed size buffers contained in unfixed expressions. Try using the fixed statement.</source> <target state="translated">Impossibile utilizzare buffer a dimensione fissa contenuti in espressioni unfixed. Provare a utilizzare l'istruzione fixed.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeNotOnAccessor"> <source>Attribute '{0}' is not valid on property or event accessors. It is only valid on '{1}' declarations.</source> <target state="translated">L'attributo '{0}' non è valido nelle funzioni di accesso a proprietà o eventi. È valido solo nelle dichiarazioni di '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidSearchPathDir"> <source>Invalid search path '{0}' specified in '{1}' -- '{2}'</source> <target state="translated">Il percorso di ricerca '{0}' specificato in '{1}' non è valido - '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidSearchPathDir_Title"> <source>Invalid search path specified</source> <target state="translated">Il percorso di ricerca specificato non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalVarArgs"> <source>__arglist is not valid in this context</source> <target state="translated">__arglist non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalParams"> <source>params is not valid in this context</source> <target state="translated">params non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_BadModifiersOnNamespace"> <source>A namespace declaration cannot have modifiers or attributes</source> <target state="translated">Una dichiarazione di spazio dei nomi non può avere modificatori o attributi</target> <note /> </trans-unit> <trans-unit id="ERR_BadPlatformType"> <source>Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64</source> <target state="translated">L'opzione '{0}' non è valida per /platform. Specificare anycpu, x86, Itanium, arm, arm64 o x64</target> <note /> </trans-unit> <trans-unit id="ERR_ThisStructNotInAnonMeth"> <source>Anonymous methods, lambda expressions, query expressions, and local functions inside structs cannot access instance members of 'this'. Consider copying 'this' to a local variable outside the anonymous method, lambda expression, query expression, or local function and using the local instead.</source> <target state="translated">I metodi anonimi, le espressioni lambda, le espressioni di query e le funzioni locali all'interno delle strutture non possono accedere ai membri di istanza di 'this'. Provare a copiare 'this' in una variabile locale all'esterno del metodo anonimo, dell'espressione lambda, dell'espressione di query o della funzione locale e usare tale variabile locale.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIDisp"> <source>'{0}': type used in a using statement must be implicitly convertible to 'System.IDisposable'.</source> <target state="translated">'{0}': il tipo usato in un'istruzione using deve essere convertibile in modo implicito in 'System.IDisposable'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamRef"> <source>Parameter {0} must be declared with the '{1}' keyword</source> <target state="translated">Il parametro {0} deve essere dichiarato con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamExtraRef"> <source>Parameter {0} should not be declared with the '{1}' keyword</source> <target state="translated">Il parametro {0} non deve essere dichiarato con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamType"> <source>Parameter {0} is declared as type '{1}{2}' but should be '{3}{4}'</source> <target state="translated">Il parametro {0} è dichiarato come tipo '{1}{2}', ma deve essere '{3}{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadExternIdentifier"> <source>Invalid extern alias for '/reference'; '{0}' is not a valid identifier</source> <target state="translated">L'alias extern non è valido per '/reference'. '{0}' non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="ERR_AliasMissingFile"> <source>Invalid reference alias option: '{0}=' -- missing filename</source> <target state="translated">L'opzione dell'alias di riferimento non è valida: '{0}='. Manca il nome file</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalExternAlias"> <source>You cannot redefine the global extern alias</source> <target state="translated">Non è possibile ridefinire l'alias extern globale</target> <note /> </trans-unit> <trans-unit id="ERR_MissingTypeInSource"> <source>Reference to type '{0}' claims it is defined in this assembly, but it is not defined in source or any added modules</source> <target state="translated">Il riferimento al tipo '{0}' dichiara di essere definito in questo assembly, ma non è definito nell'origine né nei moduli aggiunti</target> <note /> </trans-unit> <trans-unit id="ERR_MissingTypeInAssembly"> <source>Reference to type '{0}' claims it is defined in '{1}', but it could not be found</source> <target state="translated">Il riferimento al tipo '{0}' dichiara di essere definito in '{1}', ma non è stato trovato</target> <note /> </trans-unit> <trans-unit id="WRN_MultiplePredefTypes"> <source>The predefined type '{0}' is defined in multiple assemblies in the global alias; using definition from '{1}'</source> <target state="translated">Il tipo predefinito '{0}' è definito in più assembly nell'alias globale. Verrà usata la definizione contenuta in '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_MultiplePredefTypes_Title"> <source>Predefined type is defined in multiple assemblies in the global alias</source> <target state="translated">Il tipo predefinito è definito in più assembly nell'alias globale</target> <note /> </trans-unit> <trans-unit id="WRN_MultiplePredefTypes_Description"> <source>This error occurs when a predefined system type such as System.Int32 is found in two assemblies. One way this can happen is if you are referencing mscorlib or System.Runtime.dll from two different places, such as trying to run two versions of the .NET Framework side-by-side.</source> <target state="translated">Questo errore si verifica quando in due assembly viene trovato un tipo di sistema predefinito, come System.Int32. Questa situazione può verificarsi, ad esempio, se si fa riferimento a mscorlib o a System.Runtime.dll da due punti diversi, nel tentativo di eseguire due versioni affiancate di .NET Framework.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalCantBeFixedAndHoisted"> <source>Local '{0}' or its members cannot have their address taken and be used inside an anonymous method or lambda expression</source> <target state="translated">Non è possibile accettare e usare gli indirizzi dell'elemento '{0}' locale o dei rispettivi membri all'interno di un metodo anonimo o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="WRN_TooManyLinesForDebugger"> <source>Source file has exceeded the limit of 16,707,565 lines representable in the PDB; debug information will be incorrect</source> <target state="translated">Limite di 16.707.565 righe rappresentabili nel PDB superato nel file di origine: le informazioni di debug non saranno corrette</target> <note /> </trans-unit> <trans-unit id="WRN_TooManyLinesForDebugger_Title"> <source>Source file has exceeded the limit of 16,707,565 lines representable in the PDB; debug information will be incorrect</source> <target state="translated">Limite di 16.707.565 righe rappresentabili nel PDB superato nel file di origine: le informazioni di debug non saranno corrette</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethNoParams"> <source>Cannot convert anonymous method block without a parameter list to delegate type '{0}' because it has one or more out parameters</source> <target state="translated">Non è possibile convertire il blocco di metodi anonimi senza elenco parametri nel tipo delegato '{0}' perché contiene uno o più parametri out</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnNonAttributeClass"> <source>Attribute '{0}' is only valid on methods or attribute classes</source> <target state="translated">L'attributo '{0}' è valido solo per metodi o classi Attribute</target> <note /> </trans-unit> <trans-unit id="WRN_CallOnNonAgileField"> <source>Accessing a member on '{0}' may cause a runtime exception because it is a field of a marshal-by-reference class</source> <target state="translated">L'accesso a un membro di '{0}' potrebbe causare un'eccezione in fase di esecuzione perché è un campo di una classe con marshalling per riferimento</target> <note /> </trans-unit> <trans-unit id="WRN_CallOnNonAgileField_Title"> <source>Accessing a member on a field of a marshal-by-reference class may cause a runtime exception</source> <target state="translated">L'accesso a un membro in un campo di una classe con marshalling per riferimento potrebbe causare un'eccezione in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="WRN_CallOnNonAgileField_Description"> <source>This warning occurs when you try to call a method, property, or indexer on a member of a class that derives from MarshalByRefObject, and the member is a value type. Objects that inherit from MarshalByRefObject are typically intended to be marshaled by reference across an application domain. If any code ever attempts to directly access the value-type member of such an object across an application domain, a runtime exception will occur. To resolve the warning, first copy the member into a local variable and call the method on that variable.</source> <target state="translated">Questo avviso viene visualizzato quando prova a chiamare un metodo, una proprietà o un indicizzatore su un membro di una classe derivante da MarshalByRefObject e tale membro è un tipo valore. Il marshalling degli oggetti che ereditano da MarshalByRefObject viene in genere effettuato per riferimento in un dominio applicazione. Qualora un codice provi ad accedere direttamente al membro di tipo valore di tale oggetto in un dominio applicazione, si verificherà un'eccezione in fase di esecuzione. Per risolvere il problema, copiare innanzitutto il membro in una variabile locale e chiamare il metodo su tale variabile.</target> <note /> </trans-unit> <trans-unit id="WRN_BadWarningNumber"> <source>'{0}' is not a valid warning number</source> <target state="translated">'{0}' non è un numero di avviso valido</target> <note /> </trans-unit> <trans-unit id="WRN_BadWarningNumber_Title"> <source>Not a valid warning number</source> <target state="translated">Non è un numero di avviso valido</target> <note /> </trans-unit> <trans-unit id="WRN_BadWarningNumber_Description"> <source>A number that was passed to the #pragma warning preprocessor directive was not a valid warning number. Verify that the number represents a warning, not an error.</source> <target state="translated">Un numero che è stato passato alla direttiva per il preprocessore di avvisi #pragma non corrisponde a un numero di avviso valido. Verificare che il numero rappresenti un avviso e non un errore.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidNumber"> <source>Invalid number</source> <target state="translated">Numero non valido</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidNumber_Title"> <source>Invalid number</source> <target state="translated">Numero non valido</target> <note /> </trans-unit> <trans-unit id="WRN_FileNameTooLong"> <source>Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename.</source> <target state="translated">Il nome di file specificato per la direttiva per il preprocessore non è valido. È troppo lungo o non è un nome di file valido.</target> <note /> </trans-unit> <trans-unit id="WRN_FileNameTooLong_Title"> <source>Invalid filename specified for preprocessor directive</source> <target state="translated">Il nome file specificato per la direttiva per il preprocessore non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPChecksum"> <source>Invalid #pragma checksum syntax; should be #pragma checksum "filename" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..."</source> <target state="translated">Sintassi #pragma checksum non valida: dovrebbe essere #pragma checksum "nomefile" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..."</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPChecksum_Title"> <source>Invalid #pragma checksum syntax</source> <target state="translated">La sintassi del checksum della direttiva #pragma non è valida</target> <note /> </trans-unit> <trans-unit id="WRN_EndOfPPLineExpected"> <source>Single-line comment or end-of-line expected</source> <target state="translated">È previsto un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="WRN_EndOfPPLineExpected_Title"> <source>Single-line comment or end-of-line expected after #pragma directive</source> <target state="translated">Dopo la direttiva #pragma è previsto un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingChecksum"> <source>Different checksum values given for '{0}'</source> <target state="translated">Sono stati specificati valori di checksum diversi per '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingChecksum_Title"> <source>Different #pragma checksum values given</source> <target state="translated">Sono stati assegnati valori di checksum diversi alla direttiva #pragma</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved</source> <target state="translated">Il riferimento all'assembly '{0}' non è valido e non può essere risolto</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Title"> <source>Assembly reference is invalid and cannot be resolved</source> <target state="translated">Il riferimento all'assembly non è valido e non può essere risolto</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Description"> <source>This warning indicates that an attribute, such as InternalsVisibleToAttribute, was not specified correctly.</source> <target state="translated">Questo avviso indica che un attributo, ad esempio InternalsVisibleToAttribute, non è stato specificato correttamente.</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceMajMin"> <source>Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy</source> <target state="translated">Se il riferimento all'assembly '{0}' usato da '{1}' corrisponde all'identità '{2}' di '{3}', potrebbe essere necessario fornire i criteri di runtime</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceMajMin_Title"> <source>Assuming assembly reference matches identity</source> <target state="translated">Il riferimento all'assembly verrà considerato come corrispondente all'identità</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceMajMin_Description"> <source>The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly.</source> <target state="translated">I due assembly differiscono per versione e/o numero di versione. Per consentire l'unifocazione, è necessario specificare le direttive nel file config dell'applicazione e specificare il nome sicuro corretto di un assembly.</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceBldRev"> <source>Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy</source> <target state="translated">Se il riferimento all'assembly '{0}' usato da '{1}' corrisponde all'identità '{2}' di '{3}', potrebbe essere necessario fornire i criteri di runtime</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceBldRev_Title"> <source>Assuming assembly reference matches identity</source> <target state="translated">Il riferimento all'assembly verrà considerato come corrispondente all'identità</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceBldRev_Description"> <source>The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly.</source> <target state="translated">I due assembly differiscono per versione e/o numero di versione. Per consentire l'unifocazione, è necessario specificare le direttive nel file config dell'applicazione e specificare il nome sicuro corretto di un assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImport"> <source>Multiple assemblies with equivalent identity have been imported: '{0}' and '{1}'. Remove one of the duplicate references.</source> <target state="translated">Sono stati importati più assembly con identità equivalenti: '{0}' e '{1}'. Rimuovere uno dei riferimenti duplicati.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImportSimple"> <source>An assembly with the same simple name '{0}' has already been imported. Try removing one of the references (e.g. '{1}') or sign them to enable side-by-side.</source> <target state="translated">Un assembly con lo stesso nome semplice '{0}' è già stato importato. Provare a rimuovere uno dei riferimenti, ad esempio '{1}', oppure firmarli per consentire l'affiancamento.</target> <note /> </trans-unit> <trans-unit id="ERR_AssemblyMatchBadVersion"> <source>Assembly '{0}' with identity '{1}' uses '{2}' which has a higher version than referenced assembly '{3}' with identity '{4}'</source> <target state="translated">L'assembly '{0}' con identità '{1}' usa '{2}' la cui versione è successiva a quella dell'assembly '{3}' a cui viene fatto riferimento con identità '{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNeedsLvalue"> <source>Fixed size buffers can only be accessed through locals or fields</source> <target state="translated">L'accesso ai buffer a dimensione fissa è consentito solo tramite variabili locali o campi</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateTypeParamTag"> <source>XML comment has a duplicate typeparam tag for '{0}'</source> <target state="translated">Il commento XML contiene un tag typeparam duplicato per '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateTypeParamTag_Title"> <source>XML comment has a duplicate typeparam tag</source> <target state="translated">Il commento XML contiene un tag typeparam duplicato</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamTag"> <source>XML comment has a typeparam tag for '{0}', but there is no type parameter by that name</source> <target state="translated">Il commento XML ha un tag typeparam per '{0}', ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamTag_Title"> <source>XML comment has a typeparam tag, but there is no type parameter by that name</source> <target state="translated">Il commento XML ha un tag typeparam, ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamRefTag"> <source>XML comment on '{1}' has a typeparamref tag for '{0}', but there is no type parameter by that name</source> <target state="translated">Il commento XML in '{1}' ha un tag typeparamref per '{0}', ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamRefTag_Title"> <source>XML comment has a typeparamref tag, but there is no type parameter by that name</source> <target state="translated">Il commento XML ha un tag paramref, ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_MissingTypeParamTag"> <source>Type parameter '{0}' has no matching typeparam tag in the XML comment on '{1}' (but other type parameters do)</source> <target state="translated">Il parametro di tipo '{0}', diversamente da altri parametri di tipo, non contiene tag typeparam corrispondenti nel commento XML per '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingTypeParamTag_Title"> <source>Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)</source> <target state="translated">Il parametro di tipo, diversamente da altri parametri di tipo, non contiene tag typeparam corrispondenti nel commento XML</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeTypeOnOverride"> <source>'{0}': type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il tipo deve essere '{2}' in modo che corrisponda al membro '{1}' sottoposto a override</target> <note /> </trans-unit> <trans-unit id="ERR_DoNotUseFixedBufferAttr"> <source>Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute. Use the 'fixed' field modifier instead.</source> <target state="translated">Non utilizzare l'attributo 'System.Runtime.CompilerServices.FixedBuffer'. Utilizzare il modificatore di campo 'fixed'.</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToSelf"> <source>Assignment made to same variable; did you mean to assign something else?</source> <target state="translated">Assegnazione fatta alla stessa variabile. Si intendeva assegnare qualcos'altro?</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToSelf_Title"> <source>Assignment made to same variable</source> <target state="translated">Assegnazione fatta alla stessa variabile</target> <note /> </trans-unit> <trans-unit id="WRN_ComparisonToSelf"> <source>Comparison made to same variable; did you mean to compare something else?</source> <target state="translated">Confronto effettuato con la stessa variabile. Si intendeva confrontare qualcos'altro?</target> <note /> </trans-unit> <trans-unit id="WRN_ComparisonToSelf_Title"> <source>Comparison made to same variable</source> <target state="translated">Confronto effettuato con la stessa variabile</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenWin32Res"> <source>Error opening Win32 resource file '{0}' -- '{1}'</source> <target state="translated">Si è verificato un errore durante l'apertura del file di risorse Win32 '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_DotOnDefault"> <source>Expression will always cause a System.NullReferenceException because the default value of '{0}' is null</source> <target state="translated">L'espressione determinerà sempre un'eccezione System.NullReferenceException perché il valore predefinito di '{0}' è Null.</target> <note /> </trans-unit> <trans-unit id="WRN_DotOnDefault_Title"> <source>Expression will always cause a System.NullReferenceException because the type's default value is null</source> <target state="translated">L'espressione determinerà sempre un'eccezione System.NullReferenceException perché il valore predefinito del tipo è Null.</target> <note /> </trans-unit> <trans-unit id="ERR_NoMultipleInheritance"> <source>Class '{0}' cannot have multiple base classes: '{1}' and '{2}'</source> <target state="translated">La classe '{0}' non può contenere più classi base: '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_BaseClassMustBeFirst"> <source>Base class '{0}' must come before any interfaces</source> <target state="translated">La classe base '{0}' deve precedere le interfacce</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefTypeVar"> <source>XML comment has cref attribute '{0}' that refers to a type parameter</source> <target state="translated">Il commento XML contiene l'attributo cref '{0}' che fa riferimento a un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefTypeVar_Title"> <source>XML comment has cref attribute that refers to a type parameter</source> <target state="translated">Il commento XML contiene l'attributo cref che fa riferimento a un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadArgs"> <source>Friend assembly reference '{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.</source> <target state="translated">Il riferimento all'assembly Friend {0} non è valido. Nelle dichiarazioni InternalsVisibleTo non è possibile specificare la versione, le impostazioni cultura, il token di chiave pubblica o l'architettura del processore.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblySNReq"> <source>Friend assembly reference '{0}' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.</source> <target state="translated">Il riferimento {0} all'assembly Friend non è valido. Gli assembly firmati con nome sicuro devono specificare una chiave pubblica nelle rispettive dichiarazioni InternalsVisibleTo.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateOnNullable"> <source>Cannot bind delegate to '{0}' because it is a member of 'System.Nullable&lt;T&gt;'</source> <target state="translated">Non è possibile associare il delegato a '{0}' perché è un membro di 'System.Nullable&lt;T&gt;'</target> <note /> </trans-unit> <trans-unit id="ERR_BadCtorArgCount"> <source>'{0}' does not contain a constructor that takes {1} arguments</source> <target state="translated">'{0}' non contiene un costruttore che accetta argomenti {1}</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalAttributesNotFirst"> <source>Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations</source> <target state="translated">Gli attributi di modulo e assembly devono precedere tutti gli altri elementi definiti in un file ad eccezione delle clausole using e delle dichiarazioni di alias extern</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionExpected"> <source>Expected expression</source> <target state="translated">È prevista l'espressione</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSubsystemVersion"> <source>Invalid version {0} for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise</source> <target state="translated">La versione {0} non è valida per /subsystemversion. La versione deve essere 6.02 o successiva per ARM o AppContainerExe e 4.00 o successiva negli altri casi</target> <note /> </trans-unit> <trans-unit id="ERR_InteropMethodWithBody"> <source>Embedded interop method '{0}' contains a body.</source> <target state="translated">Il metodo di interoperabilità incorporato '{0}' contiene un corpo.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWarningLevel"> <source>Warning level must be zero or greater</source> <target state="translated">Il livello di avviso deve essere maggiore o uguale a zero</target> <note /> </trans-unit> <trans-unit id="ERR_BadDebugType"> <source>Invalid option '{0}' for /debug; must be 'portable', 'embedded', 'full' or 'pdbonly'</source> <target state="translated">L'opzione '{0}' non è valida per /debug. Specificare 'portable', 'embedded', 'full' o 'pdbonly'</target> <note /> </trans-unit> <trans-unit id="ERR_BadResourceVis"> <source>Invalid option '{0}'; Resource visibility must be either 'public' or 'private'</source> <target state="translated">L'opzione '{0}' non è valida. La visibilità della risorsa deve essere 'public' o 'private'</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueTypeMustMatch"> <source>The type of the argument to the DefaultParameterValue attribute must match the parameter type</source> <target state="translated">Il tipo dell'argomento dell'attributo DefaultParameterValue deve corrispondere al tipo del parametro</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueBadValueType"> <source>Argument of type '{0}' is not applicable for the DefaultParameterValue attribute</source> <target state="translated">L'argomento di tipo '{0}' non è applicabile per l'attributo DefaultParameterValue</target> <note /> </trans-unit> <trans-unit id="ERR_MemberAlreadyInitialized"> <source>Duplicate initialization of member '{0}'</source> <target state="translated">Inizializzazione del membro '{0}' duplicata</target> <note /> </trans-unit> <trans-unit id="ERR_MemberCannotBeInitialized"> <source>Member '{0}' cannot be initialized. It is not a field or property.</source> <target state="translated">Non è possibile inizializzare il membro '{0}'. Non è un campo o una proprietà.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticMemberInObjectInitializer"> <source>Static field or property '{0}' cannot be assigned in an object initializer</source> <target state="translated">Non è possibile assegnare la proprietà o il campo statico '{0}' in un inizializzatore di oggetti</target> <note /> </trans-unit> <trans-unit id="ERR_ReadonlyValueTypeInObjectInitializer"> <source>Members of readonly field '{0}' of type '{1}' cannot be assigned with an object initializer because it is of a value type</source> <target state="translated">Non è possibile assegnare i membri del campo di sola lettura '{0}' di tipo '{1}' con un inizializzatore di oggetto perché è di un tipo di valore</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTypePropertyInObjectInitializer"> <source>Members of property '{0}' of type '{1}' cannot be assigned with an object initializer because it is of a value type</source> <target state="translated">Non è possibile assegnare i membri della proprietà '{0}' di tipo '{1}' con un inizializzatore di oggetto perché è di un tipo valore</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeTypeInObjectCreation"> <source>Unsafe type '{0}' cannot be used in object creation</source> <target state="translated">Non è possibile usare il tipo unsafe '{0}' nella creazione di oggetti</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyElementInitializer"> <source>Element initializer cannot be empty</source> <target state="translated">L'inizializzatore di elementi non può essere vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerAddHasWrongSignature"> <source>The best overloaded method match for '{0}' has wrong signature for the initializer element. The initializable Add must be an accessible instance method.</source> <target state="translated">La firma per l'elemento inizializzatore nella migliore corrispondenza del metodo di overload per '{0}' non è corretta. Il metodo Add inizializzabile deve essere un metodo di istanza accessibile.</target> <note /> </trans-unit> <trans-unit id="ERR_CollectionInitRequiresIEnumerable"> <source>Cannot initialize type '{0}' with a collection initializer because it does not implement 'System.Collections.IEnumerable'</source> <target state="translated">Non è possibile inizializzare il tipo '{0}' con un inizializzatore di raccolta perché non implementa 'System.Collections.IEnumerable'</target> <note /> </trans-unit> <trans-unit id="ERR_CantSetWin32Manifest"> <source>Error reading Win32 manifest file '{0}' -- '{1}'</source> <target state="translated">Si è verificato un errore durante la lettura del file manifesto Win32 '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CantHaveManifestForModule"> <source>Ignoring /win32manifest for module because it only applies to assemblies</source> <target state="translated">L'opzione /win32manifest per il modulo verrà ignorata perché si applica solo agli assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CantHaveManifestForModule_Title"> <source>Ignoring /win32manifest for module because it only applies to assemblies</source> <target state="translated">L'opzione /win32manifest per il modulo verrà ignorata perché si applica solo agli assembly</target> <note /> </trans-unit> <trans-unit id="ERR_BadInstanceArgType"> <source>'{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' requires a receiver of type '{3}'</source> <target state="translated">'{0}' non contiene una definizione per '{1}' e il miglior overload '{2}' del metodo di estensione richiede un ricevitore di tipo '{3}'</target> <note /> </trans-unit> <trans-unit id="ERR_QueryDuplicateRangeVariable"> <source>The range variable '{0}' has already been declared</source> <target state="translated">La variabile di intervallo '{0}' è già stata dichiarata</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableOverrides"> <source>The range variable '{0}' conflicts with a previous declaration of '{0}'</source> <target state="translated">La variabile di intervallo '{0}' è in conflitto con una dichiarazione precedente di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableAssignedBadValue"> <source>Cannot assign {0} to a range variable</source> <target state="translated">Non è possibile assegnare {0} a una variabile di intervallo</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNoProviderCastable"> <source>Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Consider explicitly specifying the type of the range variable '{2}'.</source> <target state="translated">Non è stata trovata un'implementazione del modello di query per il tipo di origine '{0}'. '{1}' non è presente. Provare a specificare in modo esplicito il tipo della variabile di intervallo '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNoProviderStandard"> <source>Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Are you missing required assembly references or a using directive for 'System.Linq'?</source> <target state="translated">Non è stata trovata alcuna implementazione del modello di query per il tipo di origine '{0}'. '{1}' non è presente. Mancano i riferimenti all'assembly richiesti oppure una direttiva using per 'System.Linq'?</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNoProvider"> <source>Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found.</source> <target state="translated">Non è stata trovata un'implementazione di un modello di query per il tipo di origine '{0}'. '{1}' non è presente.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOuterKey"> <source>The name '{0}' is not in scope on the left side of 'equals'. Consider swapping the expressions on either side of 'equals'.</source> <target state="translated">Il nome '{0}' non si trova nell'ambito a sinistra di 'equals'. Provare a invertire le espressioni ai lati di 'equals'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryInnerKey"> <source>The name '{0}' is not in scope on the right side of 'equals'. Consider swapping the expressions on either side of 'equals'.</source> <target state="translated">Il nome '{0}' non si trova nell'ambito a destra di 'equals'. Provare a invertire le espressioni ai lati di 'equals'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOutRefRangeVariable"> <source>Cannot pass the range variable '{0}' as an out or ref parameter</source> <target state="translated">Non è possibile passare la variabile di intervallo '{0}' come parametro out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_QueryMultipleProviders"> <source>Multiple implementations of the query pattern were found for source type '{0}'. Ambiguous call to '{1}'.</source> <target state="translated">Sono state trovate più implementazioni del modello di query per il tipo di origine '{0}'. Chiamata ambigua a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryTypeInferenceFailedMulti"> <source>The type of one of the expressions in the {0} clause is incorrect. Type inference failed in the call to '{1}'.</source> <target state="translated">Il tipo di una delle espressioni nella clausola {0} non è corretto. L'inferenza del tipo non è riuscita nella chiamata a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryTypeInferenceFailed"> <source>The type of the expression in the {0} clause is incorrect. Type inference failed in the call to '{1}'.</source> <target state="translated">Il tipo dell'espressione nella clausola {0} non è corretto. L'inferenza del tipo non è riuscita nella chiamata a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryTypeInferenceFailedSelectMany"> <source>An expression of type '{0}' is not allowed in a subsequent from clause in a query expression with source type '{1}'. Type inference failed in the call to '{2}'.</source> <target state="translated">Un'espressione di tipo '{0}' non è consentita in una clausola from successiva in un'espressione di query con tipo di origine '{1}'. L'inferenza del tipo non è riuscita nella chiamata a '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsPointerOp"> <source>An expression tree may not contain an unsafe pointer operation</source> <target state="translated">Un albero delle espressioni non può contenere un'operazione di puntatore unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsAnonymousMethod"> <source>An expression tree may not contain an anonymous method expression</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione di metodo anonimo</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousMethodToExpressionTree"> <source>An anonymous method expression cannot be converted to an expression tree</source> <target state="translated">Non è possibile convertire un'espressione di metodo anonimo in un albero delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableReadOnly"> <source>Range variable '{0}' cannot be assigned to -- it is read only</source> <target state="translated">Non è possibile assegnare la variabile di intervallo '{0}'. È di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableSameAsTypeParam"> <source>The range variable '{0}' cannot have the same name as a method type parameter</source> <target state="translated">La variabile di intervallo '{0}' non può avere lo stesso nome di un parametro di tipo del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVarNotFoundRangeVariable"> <source>The contextual keyword 'var' cannot be used in a range variable declaration</source> <target state="translated">Impossibile utilizzare la parola chiave contestuale 'var' in una dichiarazione di variabile di intervallo</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgTypesForCollectionAdd"> <source>The best overloaded Add method '{0}' for the collection initializer has some invalid arguments</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'inizializzatore di raccolta presenta alcuni argomenti non validi</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefParameterInExpressionTree"> <source>An expression tree lambda may not contain a ref, in or out parameter</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un parametro in, out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_VarArgsInExpressionTree"> <source>An expression tree lambda may not contain a method with variable arguments</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un metodo con argomenti variabili</target> <note /> </trans-unit> <trans-unit id="ERR_MemGroupInExpressionTree"> <source>An expression tree lambda may not contain a method group</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un gruppo di metodi</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerAddHasParamModifiers"> <source>The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters.</source> <target state="translated">Non è possibile usare la migliore corrispondenza '{0}' del metodo di overload per l'elemento inizializzatore di raccolta. I metodi 'Add' dell'inizializzatore di raccolta non possono avere parametri out o ref.</target> <note /> </trans-unit> <trans-unit id="ERR_NonInvocableMemberCalled"> <source>Non-invocable member '{0}' cannot be used like a method.</source> <target state="translated">Non è possibile usare come metodo il membro non richiamabile '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeImplementationMatches"> <source>Member '{0}' implements interface member '{1}' in type '{2}'. There are multiple matches for the interface member at run-time. It is implementation dependent which method will be called.</source> <target state="translated">Il membro '{0}' implementa il membro di interfaccia '{1}' nel tipo '{2}'. In fase di esecuzione sono presenti più corrispondenze del membro di interfaccia. Il metodo che verrà chiamato dipende dall'implementazione.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeImplementationMatches_Title"> <source>Member implements interface member with multiple matches at run-time</source> <target state="translated">Il membro implementa il membro di interfaccia con più corrispondenze in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeImplementationMatches_Description"> <source>This warning can be generated when two interface methods are differentiated only by whether a particular parameter is marked with ref or with out. It is best to change your code to avoid this warning because it is not obvious or guaranteed which method is called at runtime. Although C# distinguishes between out and ref, the CLR sees them as the same. When deciding which method implements the interface, the CLR just picks one. Give the compiler some way to differentiate the methods. For example, you can give them different names or provide an additional parameter on one of them.</source> <target state="translated">Questo avviso può essere visualizzato quando due metodi di interfaccia si differenziano solo per il fatto che un determinato parametro sia contrassegnato con ref o con out. È consigliabile modificare il codice per evitare la visualizzazione di questo avviso perché non è ovvio o garantito quale metodo venga effettivamente chiamato in fase di esecuzione. Anche in C# viene fatta distinzione tra out e ref, in CLR questi metodi sono considerati uguali. Quando si decide il metodo che implementa l'interfaccia, in CLR ne viene semplicemente scelto uno. Impostare il compilatore in modo tale da distinguere i metodi, ad esempio assegnando loro nomi diversi o specificando un parametro aggiuntivo per uno di essi.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeOverrideMatches"> <source>Member '{1}' overrides '{0}'. There are multiple override candidates at run-time. It is implementation dependent which method will be called. Please use a newer runtime.</source> <target state="translated">Il membro '{1}' esegue l'override di '{0}'. In fase di esecuzione sono presenti più candidati per l'override. Il metodo che verrà chiamato dipende dall'implementazione. Usare un runtime più recente.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeOverrideMatches_Title"> <source>Member overrides base member with multiple override candidates at run-time</source> <target state="translated">Il membro esegue l'override del membro di base con più candidati di override in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectOrCollectionInitializerWithDelegateCreation"> <source>Object and collection initializer expressions may not be applied to a delegate creation expression</source> <target state="translated">Le espressioni dell'inizializzatore di oggetto e di raccolta non possono essere applicate a un'espressione di creazione del delegato</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidConstantDeclarationType"> <source>'{0}' is of type '{1}'. The type specified in a constant declaration must be sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, string, an enum-type, or a reference-type.</source> <target state="translated">'{0}' è di tipo '{1}'. Il tipo specificato in una dichiarazione di costante deve essere sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, string, enum-type o reference-type.</target> <note /> </trans-unit> <trans-unit id="ERR_FileNotFound"> <source>Source file '{0}' could not be found.</source> <target state="translated">Il file di origine '{0}' non è stato trovato.</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded"> <source>Source file '{0}' specified multiple times</source> <target state="translated">Il file di origine '{0}' è specificato più volte</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded_Title"> <source>Source file specified multiple times</source> <target state="translated">Il file di origine è specificato più volte</target> <note /> </trans-unit> <trans-unit id="ERR_NoFileSpec"> <source>Missing file specification for '{0}' option</source> <target state="translated">Manca la specifica del file per l'opzione '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsString"> <source>Command-line syntax error: Missing '{0}' for '{1}' option</source> <target state="translated">Errore nella sintassi della riga di comando: manca '{0}' per l'opzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitch"> <source>Unrecognized option: '{0}'</source> <target state="translated">Opzione non riconosciuta: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_NoSources"> <source>No source files specified.</source> <target state="translated">Non sono stati specificati file di origine.</target> <note /> </trans-unit> <trans-unit id="WRN_NoSources_Title"> <source>No source files specified</source> <target state="translated">Non sono stati specificati file di origine</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSingleScript"> <source>Expected a script (.csx file) but none specified</source> <target state="translated">È previsto uno script (file con estensione csx) ma non ne è stato specificato nessuno</target> <note /> </trans-unit> <trans-unit id="ERR_OpenResponseFile"> <source>Error opening response file '{0}'</source> <target state="translated">Si è verificato un errore durante l'apertura del file di risposta '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenFileWrite"> <source>Cannot open '{0}' for writing -- '{1}'</source> <target state="translated">Non è possibile aprire '{0}' per la scrittura - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadBaseNumber"> <source>Invalid image base number '{0}'</source> <target state="translated">'{0}' non è un numero di base dell'immagine valido</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryFile"> <source>'{0}' is a binary file instead of a text file</source> <target state="translated">'{0}' è un file binario e non un file di testo</target> <note /> </trans-unit> <trans-unit id="FTL_BadCodepage"> <source>Code page '{0}' is invalid or not installed</source> <target state="translated">La tabella codici '{0}' non è valida o non è installata</target> <note /> </trans-unit> <trans-unit id="FTL_BadChecksumAlgorithm"> <source>Algorithm '{0}' is not supported</source> <target state="translated">L'algoritmo '{0}' non è supportato</target> <note /> </trans-unit> <trans-unit id="ERR_NoMainOnDLL"> <source>Cannot specify /main if building a module or library</source> <target state="translated">Non è possibile specificare /main se si compila un modulo o una libreria</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidTarget"> <source>Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'</source> <target state="translated">Il tipo di destinazione non è valido per /target. È necessario specificare 'exe', 'winexe', 'library' o 'module'</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigNotOnCommandLine"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">L'opzione /noconfig è stata ignorata perché è stata specificata in un file di risposta</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigNotOnCommandLine_Title"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">L'opzione /noconfig è stata ignorata perché è stata specificata in un file di risposta</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFileAlignment"> <source>Invalid file section alignment '{0}'</source> <target state="translated">L'allineamento '{0}' della sezione del file non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOutputName"> <source>Invalid output name: {0}</source> <target state="translated">Nome di output non valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInformationFormat"> <source>Invalid debug information format: {0}</source> <target state="translated">Formato delle informazioni di debug non valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_LegacyObjectIdSyntax"> <source>'id#' syntax is no longer supported. Use '$id' instead.</source> <target state="translated">'La sintassi 'id#' non è più supportata. Usare '$id'.</target> <note /> </trans-unit> <trans-unit id="WRN_DefineIdentifierRequired"> <source>Invalid name for a preprocessing symbol; '{0}' is not a valid identifier</source> <target state="translated">Nome non valido per un simbolo di pre-elaborazione. '{0}' non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="WRN_DefineIdentifierRequired_Title"> <source>Invalid name for a preprocessing symbol; not a valid identifier</source> <target state="translated">Nome non valido per un simbolo di pre-elaborazione. Non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="FTL_OutputFileExists"> <source>Cannot create short filename '{0}' when a long filename with the same short filename already exists</source> <target state="translated">Non è possibile creare il nome di file breve '{0}' se esiste già un nome di file lungo con lo stesso nome di file breve</target> <note /> </trans-unit> <trans-unit id="ERR_OneAliasPerReference"> <source>A /reference option that declares an extern alias can only have one filename. To specify multiple aliases or filenames, use multiple /reference options.</source> <target state="translated">Un'opzione /reference che dichiara un alias extern può avere un solo nome di file. Per specificare più alias o nomi di file, utilizzare più opzioni /reference.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsNumber"> <source>Command-line syntax error: Missing ':&lt;number&gt;' for '{0}' option</source> <target state="translated">Errore nella sintassi della riga di comando: manca ':&lt;numero&gt;' per l'opzione '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingDebugSwitch"> <source>The /pdb option requires that the /debug option also be used</source> <target state="translated">L'opzione /pdb richiede che venga specificata anche l'opzione /debug</target> <note /> </trans-unit> <trans-unit id="ERR_ComRefCallInExpressionTree"> <source>An expression tree lambda may not contain a COM call with ref omitted on arguments</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere una chiamata COM con argomenti privi di ref</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatForGuidForOption"> <source>Command-line syntax error: Invalid Guid format '{0}' for option '{1}'</source> <target state="translated">Errore nella sintassi della riga di comando: il formato del GUID '{0}' non è valido per l'opzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingGuidForOption"> <source>Command-line syntax error: Missing Guid for option '{1}'</source> <target state="translated">Errore nella sintassi della riga di comando: manca il GUID per l'opzione '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoVarArgs"> <source>Methods with variable arguments are not CLS-compliant</source> <target state="translated">I metodi con argomenti variabili non sono conformi alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoVarArgs_Title"> <source>Methods with variable arguments are not CLS-compliant</source> <target state="translated">I metodi con argomenti variabili non sono conformi alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadArgType"> <source>Argument type '{0}' is not CLS-compliant</source> <target state="translated">Il tipo dell'argomento '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadArgType_Title"> <source>Argument type is not CLS-compliant</source> <target state="translated">Il tipo dell'argomento non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadReturnType"> <source>Return type of '{0}' is not CLS-compliant</source> <target state="translated">Il tipo restituito di '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadReturnType_Title"> <source>Return type is not CLS-compliant</source> <target state="translated">Il tipo restituito non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadFieldPropType"> <source>Type of '{0}' is not CLS-compliant</source> <target state="translated">Il tipo '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadFieldPropType_Title"> <source>Type is not CLS-compliant</source> <target state="translated">Il tipo non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadFieldPropType_Description"> <source>A public, protected, or protected internal variable must be of a type that is compliant with the Common Language Specification (CLS).</source> <target state="translated">Una variabile public, protected o protected internal deve essere di tipo conforme a CLS (Common Language Specification).</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifierCase"> <source>Identifier '{0}' differing only in case is not CLS-compliant</source> <target state="translated">L'identificatore '{0}' che differisce solo per l'uso di caratteri maiuscoli o minuscoli non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifierCase_Title"> <source>Identifier differing only in case is not CLS-compliant</source> <target state="translated">L'identificatore che differisce solo per l'uso di caratteri maiuscoli o minuscoli non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadRefOut"> <source>Overloaded method '{0}' differing only in ref or out, or in array rank, is not CLS-compliant</source> <target state="translated">Il metodo di overload '{0}' che differisce solo per out o ref o per numero di dimensioni della matrice non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadRefOut_Title"> <source>Overloaded method differing only in ref or out, or in array rank, is not CLS-compliant</source> <target state="translated">Il metodo di overload, che differisce solo per out o ref o per numero di dimensioni della matrice, non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadUnnamed"> <source>Overloaded method '{0}' differing only by unnamed array types is not CLS-compliant</source> <target state="translated">Il metodo di overload '{0}' che differisce solo per i tipi matrice senza nome non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadUnnamed_Title"> <source>Overloaded method differing only by unnamed array types is not CLS-compliant</source> <target state="translated">Il metodo di overload, che differisce solo per i tipi matrice senza nome, non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadUnnamed_Description"> <source>This error occurs if you have an overloaded method that takes a jagged array and the only difference between the method signatures is the element type of the array. To avoid this error, consider using a rectangular array rather than a jagged array; use an additional parameter to disambiguate the function call; rename one or more of the overloaded methods; or, if CLS Compliance is not needed, remove the CLSCompliantAttribute attribute.</source> <target state="translated">Questo errore si verifica quando si usa un metodo di overload che accetta una matrice irregolare e le firme del metodo si differenziano solo per il tipo di elemento della matrice. Per evitare questo errore, provare a usare una matrice rettangolare invece di una irregolare, aggiungere un parametro in modo da evitare ambiguità nella chiamata della funzione oppure rinominare uno o più metodi di overload. In alternativa, se la compatibilità con CLS non è necessaria, rimuovere l'attributo CLSCompliantAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifier"> <source>Identifier '{0}' is not CLS-compliant</source> <target state="translated">L'identificatore '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifier_Title"> <source>Identifier is not CLS-compliant</source> <target state="translated">L'identificatore non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadBase"> <source>'{0}': base type '{1}' is not CLS-compliant</source> <target state="translated">'{0}': il tipo di base '{1}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadBase_Title"> <source>Base type is not CLS-compliant</source> <target state="translated">Il tipo di base non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadBase_Description"> <source>A base type was marked as not having to be compliant with the Common Language Specification (CLS) in an assembly that was marked as being CLS compliant. Either remove the attribute that specifies the assembly is CLS compliant or remove the attribute that indicates the type is not CLS compliant.</source> <target state="translated">In un assembly contrassegnato come conforme a CLS (Common Language Specification) è stato specificato un tipo di base non conforme a CLS. Rimuovere l'attributo che contrassegna l'assembly come conforme a CLS oppure l'attributo che indica il tipo come non conforme a CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterfaceMember"> <source>'{0}': CLS-compliant interfaces must have only CLS-compliant members</source> <target state="translated">'{0}': le interfacce compatibili con CLS devono avere solo membri conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterfaceMember_Title"> <source>CLS-compliant interfaces must have only CLS-compliant members</source> <target state="translated">Le interfacce compatibili con CLS devono contenere solo membri conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoAbstractMembers"> <source>'{0}': only CLS-compliant members can be abstract</source> <target state="translated">'{0}': solo i membri conformi a CLS possono essere di tipo abstract</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoAbstractMembers_Title"> <source>Only CLS-compliant members can be abstract</source> <target state="translated">Solo i membri conformi a CLS possono essere di tipo abstract</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules"> <source>You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking</source> <target state="translated">Per abilitare il controllo di conformità a CLS, è necessario specificare l'attributo CLSCompliant nell'assembly, non nel modulo</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules_Title"> <source>You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking</source> <target state="translated">Per abilitare il controllo di conformità a CLS, è necessario specificare l'attributo CLSCompliant nell'assembly, non nel modulo</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ModuleMissingCLS"> <source>Added modules must be marked with the CLSCompliant attribute to match the assembly</source> <target state="translated">I moduli aggiunti devono essere contrassegnati con l'attributo CLSCompliant per corrispondere all'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ModuleMissingCLS_Title"> <source>Added modules must be marked with the CLSCompliant attribute to match the assembly</source> <target state="translated">I moduli aggiunti devono essere contrassegnati con l'attributo CLSCompliant per corrispondere all'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS"> <source>'{0}' cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute</source> <target state="translated">'{0}' non può essere contrassegnato come conforme a CLS perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS_Title"> <source>Type or member cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute</source> <target state="translated">Il tipo o il membro non può essere contrassegnato come conforme a CLS perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadAttributeType"> <source>'{0}' has no accessible constructors which use only CLS-compliant types</source> <target state="translated">'{0}' non ha costruttori accessibili che usano solo tipi conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadAttributeType_Title"> <source>Type has no accessible constructors which use only CLS-compliant types</source> <target state="translated">Il tipo non contiene costruttori accessibili che usano solo tipi conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ArrayArgumentToAttribute"> <source>Arrays as attribute arguments is not CLS-compliant</source> <target state="translated">L'utilizzo di matrici come argomenti di attributi non è conforme alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ArrayArgumentToAttribute_Title"> <source>Arrays as attribute arguments is not CLS-compliant</source> <target state="translated">L'utilizzo di matrici come argomenti di attributi non è conforme alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules2"> <source>You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly</source> <target state="translated">Impossibile specificare l'attributo CLSCompliant su un modulo che differisce dall'attributo CLSCompliant sull'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules2_Title"> <source>You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly</source> <target state="translated">Impossibile specificare l'attributo CLSCompliant su un modulo che differisce dall'attributo CLSCompliant sull'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_IllegalTrueInFalse"> <source>'{0}' cannot be marked as CLS-compliant because it is a member of non-CLS-compliant type '{1}'</source> <target state="translated">'Non è possibile contrassegnare '{0}' come conforme a CLS perché è un membro del tipo non conforme a CLS '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_IllegalTrueInFalse_Title"> <source>Type cannot be marked as CLS-compliant because it is a member of non-CLS-compliant type</source> <target state="translated">Non è possibile contrassegnare il tipo come conforme a CLS perché è un membro del tipo non conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnPrivateType"> <source>CLS compliance checking will not be performed on '{0}' because it is not visible from outside this assembly</source> <target state="translated">Il controllo di conformità a CLS non verrà eseguito in '{0}' perché non è visibile all'esterno dell'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnPrivateType_Title"> <source>CLS compliance checking will not be performed because it is not visible from outside this assembly</source> <target state="translated">Il controllo di conformità a CLS non verrà eseguito perché non è visibile all'esterno dell'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS2"> <source>'{0}' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute</source> <target state="translated">'{0}' non necessita di un attributo CLSCompliant perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS2_Title"> <source>Type or member does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute</source> <target state="translated">Il tipo o il membro non necessita di un attributo CLSCompliant perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnParam"> <source>CLSCompliant attribute has no meaning when applied to parameters. Try putting it on the method instead.</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a parametri. Provare ad applicarlo al metodo.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnParam_Title"> <source>CLSCompliant attribute has no meaning when applied to parameters</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a parametri</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnReturn"> <source>CLSCompliant attribute has no meaning when applied to return types. Try putting it on the method instead.</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a tipi restituiti. Provare ad applicarlo al metodo.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnReturn_Title"> <source>CLSCompliant attribute has no meaning when applied to return types</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a tipi restituiti</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadTypeVar"> <source>Constraint type '{0}' is not CLS-compliant</source> <target state="translated">Il tipo di vincolo '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadTypeVar_Title"> <source>Constraint type is not CLS-compliant</source> <target state="translated">Il tipo di vincolo non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_VolatileField"> <source>CLS-compliant field '{0}' cannot be volatile</source> <target state="translated">Il campo conforme a CLS '{0}' non può essere volatile</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_VolatileField_Title"> <source>CLS-compliant field cannot be volatile</source> <target state="translated">Il campo conforme a CLS non può essere volatile</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterface"> <source>'{0}' is not CLS-compliant because base interface '{1}' is not CLS-compliant</source> <target state="translated">'{0}' non è conforme a CLS perché l'interfaccia di base '{1}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterface_Title"> <source>Type is not CLS-compliant because base interface is not CLS-compliant</source> <target state="translated">Il tipo non è conforme a CLS perché l'interfaccia di base non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArg"> <source>'await' requires that the type {0} have a suitable 'GetAwaiter' method</source> <target state="translated">Con 'await' il tipo {0} deve essere associato a un metodo 'GetAwaiter' appropriato</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArgIntrinsic"> <source>Cannot await '{0}'</source> <target state="translated">Non è possibile attendere '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaiterPattern"> <source>'await' requires that the return type '{0}' of '{1}.GetAwaiter()' have suitable 'IsCompleted', 'OnCompleted', and 'GetResult' members, and implement 'INotifyCompletion' or 'ICriticalNotifyCompletion'</source> <target state="translated">Con 'await' il tipo restituito '{0}' di '{1}.GetAwaiter()' deve essere associato a membri 'IsCompleted', 'OnCompleted' e 'GetResult' appropriati e implementare 'INotifyCompletion' o 'ICriticalNotifyCompletion'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArg_NeedSystem"> <source>'await' requires that the type '{0}' have a suitable 'GetAwaiter' method. Are you missing a using directive for 'System'?</source> <target state="translated">Con 'await' il tipo '{0}' deve essere associato a un metodo 'GetAwaiter' appropriato. Manca una direttiva using per 'System'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArgVoidCall"> <source>Cannot await 'void'</source> <target state="translated">Non è possibile attendere 'void'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitAsIdentifier"> <source>'await' cannot be used as an identifier within an async method or lambda expression</source> <target state="translated">'Non è possibile usare 'await' come identificatore all'interno di un metodo asincrono o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="ERR_DoesntImplementAwaitInterface"> <source>'{0}' does not implement '{1}'</source> <target state="translated">'{0}' non implementa '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_TaskRetNoObjectRequired"> <source>Since '{0}' is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task&lt;T&gt;'?</source> <target state="translated">Poiché '{0}' è un metodo asincrono che restituisce 'Task', una parola chiave restituita non deve essere seguita da un'espressione di oggetto. Si intendeva restituire 'Task&lt;T&gt;'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturn"> <source>The return type of an async method must be void, Task, Task&lt;T&gt;, a task-like type, IAsyncEnumerable&lt;T&gt;, or IAsyncEnumerator&lt;T&gt;</source> <target state="translated">Il tipo restituito di un metodo asincrono deve essere void, Task, Task&lt;T&gt;, un tipo simile a Task, IAsyncEnumerable&lt;T&gt; o IAsyncEnumerator&lt;T&gt;</target> <note /> </trans-unit> <trans-unit id="ERR_CantReturnVoid"> <source>Cannot return an expression of type 'void'</source> <target state="translated">Non è possibile restituire un'espressione di tipo 'void'</target> <note /> </trans-unit> <trans-unit id="ERR_VarargsAsync"> <source>__arglist is not allowed in the parameter list of async methods</source> <target state="translated">__arglist non è consentito nell'elenco di parametri di metodi asincroni</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefTypeAndAwait"> <source>'await' cannot be used in an expression containing the type '{0}'</source> <target state="translated">'non è possibile usare 'await' in un'espressione contenente il tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeAsyncArgType"> <source>Async methods cannot have unsafe parameters or return types</source> <target state="translated">I metodi asincroni non possono avere parametri non sicuri o tipi restituiti</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncArgType"> <source>Async methods cannot have ref, in or out parameters</source> <target state="translated">I metodi asincroni non possono avere parametri in, our o ref</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutAsync"> <source>The 'await' operator can only be used when contained within a method or lambda expression marked with the 'async' modifier</source> <target state="translated">L'operatore 'await' può essere usato solo quando è contenuto in un metodo o un'espressione lambda contrassegnata con il modificatore 'async'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutAsyncLambda"> <source>The 'await' operator can only be used within an async {0}. Consider marking this {0} with the 'async' modifier.</source> <target state="translated">L'operatore 'await' può essere usato solo all'interno di un {0} asincrono. Contrassegnare questo {0} con il modificatore 'async'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutAsyncMethod"> <source>The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task&lt;{0}&gt;'.</source> <target state="translated">L'operatore 'await' può essere usato solo all'interno di un metodo asincrono. Provare a contrassegnare questo metodo con il modificatore 'async' e modificare il tipo restituito su 'Task&lt;{0}&gt;'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutVoidAsyncMethod"> <source>The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.</source> <target state="translated">L'operatore 'await' può essere usato solo all'interno di un metodo asincrono. Provare a contrassegnare questo metodo con il modificatore 'async' e modificare il tipo restituito su 'Task'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInFinally"> <source>Cannot await in the body of a finally clause</source> <target state="translated">Non è possibile includere un elemento await nel corpo di una clausola finally</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInCatch"> <source>Cannot await in a catch clause</source> <target state="translated">Non è possibile includere un elemento await in una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInCatchFilter"> <source>Cannot await in the filter expression of a catch clause</source> <target state="translated">Non è possibile includere un elemento await nell'espressione di filtro di una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInLock"> <source>Cannot await in the body of a lock statement</source> <target state="translated">Non è possibile includere un elemento await nel corpo di un'istruzione lock</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInStaticVariableInitializer"> <source>The 'await' operator cannot be used in a static script variable initializer.</source> <target state="translated">Non è possibile usare l'operatore 'await' in un inizializzatore di variabile script statico.</target> <note /> </trans-unit> <trans-unit id="ERR_AwaitInUnsafeContext"> <source>Cannot await in an unsafe context</source> <target state="translated">Non è possibile attendere in un contesto non sicuro</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncLacksBody"> <source>The 'async' modifier can only be used in methods that have a body.</source> <target state="translated">Il modificatore 'async' può essere usato solo nei metodi con un corpo.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecialByRefLocal"> <source>Parameters or locals of type '{0}' cannot be declared in async methods or async lambda expressions.</source> <target state="translated">Non è possibile dichiarare parametri o variabili locali di tipo '{0}' in metodi asincroni o espressioni lambda asincrone.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecialByRefIterator"> <source>foreach statement cannot operate on enumerators of type '{0}' in async or iterator methods because '{0}' is a ref struct.</source> <target state="translated">L'istruzione foreach non può funzionare con enumeratori di tipo '{0}' in metodi async o iterator perché '{0}' è uno struct ref.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync"> <source>Security attribute '{0}' cannot be applied to an Async method.</source> <target state="translated">Non è possibile applicare l'attributo di sicurezza '{0}' a un metodo Async</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalOrSecuritySafeCriticalOnAsyncInClassOrStruct"> <source>Async methods are not allowed in an Interface, Class, or Structure which has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.</source> <target state="translated">I metodi asincroni non sono consentiti in un'interfaccia, una classe o una struttura che ha l'attributo 'SecurityCritical' o 'SecuritySafeCritical'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInQuery"> <source>The 'await' operator may only be used in a query expression within the first collection expression of the initial 'from' clause or within the collection expression of a 'join' clause</source> <target state="translated">È possibile usare l'operatore 'await' solo in espressioni di query all'interno della prima espressione di raccolta della clausola 'from' iniziale o all'interno dell'espressione di raccolta di una clausola 'join'</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits"> <source>This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.</source> <target state="translated">In questo metodo asincrono non sono presenti operatori 'await', pertanto verrà eseguito in modo sincrono. Provare a usare l'operatore 'await' per attendere chiamate ad API non di blocco oppure 'await Task.Run(...)' per effettuare elaborazioni basate sulla CPU in un thread in background.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits_Title"> <source>Async method lacks 'await' operators and will run synchronously</source> <target state="translated">Il metodo asincrono non contiene operatori 'await', pertanto verrà eseguito in modo sincrono</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression"> <source>Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.</source> <target state="translated">Non è possibile attendere la chiamata, pertanto l'esecuzione del metodo corrente continuerà prima del completamento della chiamata. Provare ad applicare l'operatore 'await' al risultato della chiamata.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Title"> <source>Because this call is not awaited, execution of the current method continues before the call is completed</source> <target state="translated">Non è possibile attendere la chiamata, pertanto l'esecuzione del metodo corrente continuerà prima del completamento della chiamata</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Description"> <source>The current method calls an async method that returns a Task or a Task&lt;TResult&gt; and doesn't apply the await operator to the result. The call to the async method starts an asynchronous task. However, because no await operator is applied, the program continues without waiting for the task to complete. In most cases, that behavior isn't what you expect. Usually other aspects of the calling method depend on the results of the call or, minimally, the called method is expected to complete before you return from the method that contains the call. An equally important issue is what happens to exceptions that are raised in the called async method. An exception that's raised in a method that returns a Task or Task&lt;TResult&gt; is stored in the returned task. If you don't await the task or explicitly check for exceptions, the exception is lost. If you await the task, its exception is rethrown. As a best practice, you should always await the call. You should consider suppressing the warning only if you're sure that you don't want to wait for the asynchronous call to complete and that the called method won't raise any exceptions. In that case, you can suppress the warning by assigning the task result of the call to a variable.</source> <target state="translated">Il metodo corrente chiama un metodo asincrono che restituisce un elemento Task o Task&lt;TResult&gt; e non applica l'operatore await al risultato. La chiamata al metodo asincrono avvia un'attività asincrona. Dal momento, però, che non viene applicato alcun operatore await, l'esecuzione del programma continua senza attendere il completamento dell'attività. Nella maggior parte dei casi questo non è il comportamento previsto. In genere, altri aspetti del metodo chiamante dipendono dai risultati della chiamata o è almeno previsto che il metodo chiamato venga completato prima del termine del metodo che contiene la chiamata. Un aspetto ugualmente importante è costituito dalla gestione delle eccezioni generate nel metodo asincrono chiamato. Un'eccezione generata in un metodo che restituisce un elemento Task o Task&lt;TResult&gt; viene archiviata nell'attività restituita. Se non si attende l'attività o si verifica esplicitamente la presenza di eccezioni, l'eccezione viene persa. Se si attende l'attività, l'eccezione viene nuovamente generata. Come procedura consigliata, è consigliabile attendere sempre la chiamata. È opportuno eliminare l'avviso solo se si è certi che non si vuole attendere il completamento della chiamata asincrona e che il metodo chiamato non genera alcuna eccezione. In tal caso, è possibile eliminare l'avviso assegnando il risultato dell'attività della chiamata a una variabile.</target> <note /> </trans-unit> <trans-unit id="ERR_SynchronizedAsyncMethod"> <source>'MethodImplOptions.Synchronized' cannot be applied to an async method</source> <target state="translated">'Non è possibile applicare 'MethodImplOptions.Synchronized' a un metodo asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerLineNumberParam"> <source>CallerLineNumberAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="translated">Non è possibile applicare CallerLineNumberAttribute perché non sono disponibili conversioni standard dal tipo '{0}' al tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerFilePathParam"> <source>CallerFilePathAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="translated">Non è possibile applicare CallerFilePathAttribute perché non sono presenti conversioni standard dal tipo '{0}' al tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerMemberNameParam"> <source>CallerMemberNameAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="translated">Non è possibile applicare CallerMemberNameAttribute perché non sono disponibili conversioni standard dal tipo '{0}' al tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerLineNumberParamWithoutDefaultValue"> <source>The CallerLineNumberAttribute may only be applied to parameters with default values</source> <target state="translated">CallerLineNumberAttribute può essere applicato solo a parametri con valori predefiniti</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerFilePathParamWithoutDefaultValue"> <source>The CallerFilePathAttribute may only be applied to parameters with default values</source> <target state="translated">CallerFilePathAttribute può essere applicato solo a parametri con valori predefiniti</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerMemberNameParamWithoutDefaultValue"> <source>The CallerMemberNameAttribute may only be applied to parameters with default values</source> <target state="translated">CallerMemberNameAttribute può essere applicato solo a parametri con valori predefiniti</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberParamForUnconsumedLocation"> <source>The CallerLineNumberAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerLineNumberAttribute applicato al parametro '{0}' non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberParamForUnconsumedLocation_Title"> <source>The CallerLineNumberAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerLineNumberAttribute non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathParamForUnconsumedLocation"> <source>The CallerFilePathAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">L'elemento CallerFilePathAttribute applicato al parametro '{0}' non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathParamForUnconsumedLocation_Title"> <source>The CallerFilePathAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">L'elemento CallerFilePathAttribute non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNameParamForUnconsumedLocation"> <source>The CallerMemberNameAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerMemberNameAttribute applicato al parametro '{0}' non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNameParamForUnconsumedLocation_Title"> <source>The CallerMemberNameAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerMemberNameAttribute non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_NoEntryPoint"> <source>Program does not contain a static 'Main' method suitable for an entry point</source> <target state="translated">Il programma non contiene un metodo 'Main' statico appropriato per un punto di ingresso</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerIncorrectLength"> <source>An array initializer of length '{0}' is expected</source> <target state="translated">È previsto un inizializzatore di matrice di lunghezza '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerExpected"> <source>A nested array initializer is expected</source> <target state="translated">È previsto un inizializzatore di matrice annidato</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalVarianceSyntax"> <source>Invalid variance modifier. Only interface and delegate type parameters can be specified as variant.</source> <target state="translated">Il modificatore di varianza non è valido. Si possono specificare come varianti solo i parametri di tipo interfaccia o delegato.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedAliasedName"> <source>Unexpected use of an aliased name</source> <target state="translated">Uso imprevisto di un nome con alias</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedGenericName"> <source>Unexpected use of a generic name</source> <target state="translated">Uso imprevisto di un nome generico</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedUnboundGenericName"> <source>Unexpected use of an unbound generic name</source> <target state="translated">Uso imprevisto di un nome generico non associato</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalStatement"> <source>Expressions and statements can only occur in a method body</source> <target state="translated">Espressioni e istruzioni possono essere usate solo in un corpo del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentForArray"> <source>An array access may not have a named argument specifier</source> <target state="translated">Un accesso a matrice non può includere un identificatore di argomento denominato</target> <note /> </trans-unit> <trans-unit id="ERR_NotYetImplementedInRoslyn"> <source>This language feature ('{0}') is not yet implemented.</source> <target state="translated">Questa funzionalità del linguaggio ('{0}') non è ancora implementata.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueNotAllowed"> <source>Default values are not valid in this context.</source> <target state="translated">I parametri predefiniti non sono validi in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenIcon"> <source>Error opening icon file {0} -- {1}</source> <target state="translated">Si è verificato un errore durante l'apertura del file icona {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenWin32Manifest"> <source>Error opening Win32 manifest file {0} -- {1}</source> <target state="translated">Si è verificato un errore durante l'apertura del file manifesto Win32 {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorBuildingWin32Resources"> <source>Error building Win32 resources -- {0}</source> <target state="translated">Si è verificato un errore durante la compilazione delle risorse Win32 - {0}</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueBeforeRequiredValue"> <source>Optional parameters must appear after all required parameters</source> <target state="translated">I parametri facoltativi devono trovarsi dopo tutti i parametri obbligatori</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitImplCollisionOnRefOut"> <source>Cannot inherit interface '{0}' with the specified type parameters because it causes method '{1}' to contain overloads which differ only on ref and out</source> <target state="translated">Non è possibile ereditare l'interfaccia '{0}' con i parametri di tipo specificato perché in tal caso il metodo '{1}' conterrebbe overload diversi solo in ref e out</target> <note /> </trans-unit> <trans-unit id="ERR_PartialWrongTypeParamsVariance"> <source>Partial declarations of '{0}' must have the same type parameter names and variance modifiers in the same order</source> <target state="translated">Le dichiarazioni parziali di '{0}' devono avere gli stessi nomi di parametro di tipo e modificatori di varianza nello stesso ordine</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedVariance"> <source>Invalid variance: The type parameter '{1}' must be {3} valid on '{0}'. '{1}' is {2}.</source> <target state="translated">Varianza non valida: il parametro di tipo '{1}' deve essere {3} valido in '{0}'. '{1}' è {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_DeriveFromDynamic"> <source>'{0}': cannot derive from the dynamic type</source> <target state="translated">'{0}': non è possibile derivare dal tipo dinamico</target> <note /> </trans-unit> <trans-unit id="ERR_DeriveFromConstructedDynamic"> <source>'{0}': cannot implement a dynamic interface '{1}'</source> <target state="translated">'{0}': non è possibile implementare un'interfaccia dinamica '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicTypeAsBound"> <source>Constraint cannot be the dynamic type</source> <target state="translated">Il vincolo non può essere il tipo dinamico</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructedDynamicTypeAsBound"> <source>Constraint cannot be a dynamic type '{0}'</source> <target state="translated">Il vincolo non può essere un tipo dinamico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicRequiredTypesMissing"> <source>One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?</source> <target state="translated">Non sono stati trovati uno o più tipi necessari per compilare un'espressione dinamica. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataNameTooLong"> <source>Name '{0}' exceeds the maximum length allowed in metadata.</source> <target state="translated">Il nome '{0}' supera la lunghezza massima consentita nei metadati.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributesNotAllowed"> <source>Attributes are not valid in this context.</source> <target state="translated">Gli attributi non sono validi in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_ExternAliasNotAllowed"> <source>'extern alias' is not valid in this context</source> <target state="translated">'extern alias' non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="WRN_IsDynamicIsConfusing"> <source>Using '{0}' to test compatibility with '{1}' is essentially identical to testing compatibility with '{2}' and will succeed for all non-null values</source> <target state="translated">L'uso di '{0}' per la verifica della compatibilità con '{1}' corrisponde in sostanza alla verifica della compatibilità con '{2}' e verrà completato per tutti i valori non Null</target> <note /> </trans-unit> <trans-unit id="WRN_IsDynamicIsConfusing_Title"> <source>Using 'is' to test compatibility with 'dynamic' is essentially identical to testing compatibility with 'Object'</source> <target state="translated">L'uso di 'is' per la verifica della compatibilità con 'dynamic' corrisponde in sostanza alla verifica della compatibilità con 'Object'</target> <note /> </trans-unit> <trans-unit id="ERR_YieldNotAllowedInScript"> <source>Cannot use 'yield' in top-level script code</source> <target state="translated">Non è possibile usare 'yield' nel codice script di primo livello</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAllowedInScript"> <source>Cannot declare namespace in script code</source> <target state="translated">Non è possibile dichiarare lo spazio dei nomi nel codice script</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalAttributesNotAllowed"> <source>Assembly and module attributes are not allowed in this context</source> <target state="translated">Gli attributi di assembly e modulo non sono consentiti in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDelegateType"> <source>Delegate '{0}' has no invoke method or an invoke method with a return type or parameter types that are not supported.</source> <target state="translated">Il delegato '{0}' non ha metodi Invoke oppure ha un metodo Invoke con un tipo restituito o tipi di parametro non supportati.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored"> <source>The entry point of the program is global code; ignoring '{0}' entry point.</source> <target state="translated">Il punto di ingresso del programma è codice globale. Il punto di ingresso '{0}' verrà ignorato.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored_Title"> <source>The entry point of the program is global code; ignoring entry point</source> <target state="translated">Il punto di ingresso del programma è codice globale. Il punto di ingresso verrà ignorato</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisEventType"> <source>Inconsistent accessibility: event type '{1}' is less accessible than event '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di evento '{1}' è meno accessibile di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgument"> <source>Named argument specifications must appear after all fixed arguments have been specified. Please use language version {0} or greater to allow non-trailing named arguments.</source> <target state="translated">Le specifiche di argomenti denominati devono trovarsi dopo tutti gli argomenti fissi specificati. Usare la versione {0} o versioni successive del linguaggio per consentire argomenti denominati non finali.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgumentInDynamicInvocation"> <source>Named argument specifications must appear after all fixed arguments have been specified in a dynamic invocation.</source> <target state="translated">In una chiamata dinamica le specifiche di argomenti denominati devono trovarsi dopo tutti gli argomenti fissi specificati.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedArgument"> <source>The best overload for '{0}' does not have a parameter named '{1}'</source> <target state="translated">Il miglior overload per '{0}' non ha un parametro denominato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedArgumentForDelegateInvoke"> <source>The delegate '{0}' does not have a parameter named '{1}'</source> <target state="translated">Il delegato '{0}' non ha un parametro denominato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedArgument"> <source>Named argument '{0}' cannot be specified multiple times</source> <target state="translated">Non è possibile specificare più volte l'argomento denominato '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentUsedInPositional"> <source>Named argument '{0}' specifies a parameter for which a positional argument has already been given</source> <target state="translated">L'argomento denominato '{0}' specifica un parametro per il quale è già stato fornito un argomento posizionale</target> <note /> </trans-unit> <trans-unit id="ERR_BadNonTrailingNamedArgument"> <source>Named argument '{0}' is used out-of-position but is followed by an unnamed argument</source> <target state="translated">L'argomento denominato '{0}' viene usato nella posizione errata ma è seguito da un argomento non denominato</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueUsedWithAttributes"> <source>Cannot specify default parameter value in conjunction with DefaultParameterAttribute or OptionalAttribute</source> <target state="translated">Impossibile specificare un valore di parametro predefinito insieme a DefaultParameterAttribute o OptionalAttribute</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueMustBeConstant"> <source>Default parameter value for '{0}' must be a compile-time constant</source> <target state="translated">Il valore di parametro predefinito per '{0}' deve essere una costante in fase di compilazione</target> <note /> </trans-unit> <trans-unit id="ERR_RefOutDefaultValue"> <source>A ref or out parameter cannot have a default value</source> <target state="translated">Un parametro out o ref non può avere un valore predefinito</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForExtensionParameter"> <source>Cannot specify a default value for the 'this' parameter</source> <target state="translated">Impossibile specificare un valore predefinito per il parametro 'this'</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForParamsParameter"> <source>Cannot specify a default value for a parameter array</source> <target state="translated">Impossibile specificare un valore predefinito per una matrice di parametri</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForDefaultParam"> <source>A value of type '{0}' cannot be used as a default parameter because there are no standard conversions to type '{1}'</source> <target state="translated">Non è possibile usare un valore di tipo '{0}' come parametro predefinito. Non sono disponibili conversioni standard nel tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForNubDefaultParam"> <source>A value of type '{0}' cannot be used as default parameter for nullable parameter '{1}' because '{0}' is not a simple type</source> <target state="translated">Non è possibile usare un valore di tipo '{0}' come parametro predefinito per il parametro nullable '{1}' perché '{0}' non è un tipo semplice</target> <note /> </trans-unit> <trans-unit id="ERR_NotNullRefDefaultParameter"> <source>'{0}' is of type '{1}'. A default parameter value of a reference type other than string can only be initialized with null</source> <target state="translated">'{0}' è di tipo '{1}'. Un valore di parametro predefinito di un tipo riferimento non stringa può essere inizializzato solo con Null.</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultValueForUnconsumedLocation"> <source>The default value specified for parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">Il valore predefinito specificato per il parametro '{0}' non avrà effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultValueForUnconsumedLocation_Title"> <source>The default value specified will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">Il valore predefinito specificato non avrà effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyFileFailure"> <source>Error signing output with public key from file '{0}' -- {1}</source> <target state="translated">Si è verificato un errore durante la firma dell'output con la chiave pubblica del file '{0}' - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyContainerFailure"> <source>Error signing output with public key from container '{0}' -- {1}</source> <target state="translated">Si è verificato un errore durante la firma dell'output con la chiave pubblica del contenitore '{0}' - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicTypeof"> <source>The typeof operator cannot be used on the dynamic type</source> <target state="translated">Non è possibile usare l'operatore typeof nel tipo dinamico</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsDynamicOperation"> <source>An expression tree may not contain a dynamic operation</source> <target state="translated">Un albero delle espressioni non può contenere un'operazione dinamica</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncExpressionTree"> <source>Async lambda expressions cannot be converted to expression trees</source> <target state="translated">Le espressioni lambda asincrone non possono essere convertite in alberi delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicAttributeMissing"> <source>Cannot define a class or member that utilizes 'dynamic' because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Non è possibile definire una classe o un membro che usa 'dynamic' perché non è stato trovato il tipo '{0}' richiesto dal compilatore. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotPassNullForFriendAssembly"> <source>Cannot pass null for friend assembly name</source> <target state="translated">Non è possibile passare Null per il nome assembly Friend</target> <note /> </trans-unit> <trans-unit id="ERR_SignButNoPrivateKey"> <source>Key file '{0}' is missing the private key needed for signing</source> <target state="translated">Nel file di chiave '{0}' manca la chiave privata necessaria per la firma</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignButNoKey"> <source>Public signing was specified and requires a public key, but no public key was specified.</source> <target state="translated">È stata specificata la firma pubblica per la quale è necessaria una chiave pubblica, che però non è stata specificata.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNetModule"> <source>Public signing is not supported for netmodules.</source> <target state="translated">La firma pubblica non è supportata per gli elementi netmodule.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">È stata specificata la firma ritardata per la quale è necessaria una chiave pubblica che però non è stata specificata</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey_Title"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">È stata specificata la firma ritardata per la quale è necessaria una chiave pubblica che però non è stata specificata</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat"> <source>The specified version string does not conform to the required format - major[.minor[.build[.revision]]]</source> <target state="translated">La stringa di versione specificata non è conforme al formato richiesto: principale[.secondaria[.build[.revisione]]]</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormatDeterministic"> <source>The specified version string contains wildcards, which are not compatible with determinism. Either remove wildcards from the version string, or disable determinism for this compilation</source> <target state="translated">La stringa di versione specificata contiene caratteri jolly e questo non è compatibile con il determinismo. Rimuovere i caratteri jolly dalla stringa di versione o disabilitare il determinismo per questa compilazione</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat2"> <source>The specified version string does not conform to the required format - major.minor.build.revision (without wildcards)</source> <target state="translated">La stringa di versione specificata non è conforme al formato richiesto: principale.secondaria.build.revisione (senza caratteri jolly)</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">La stringa di versione specificata non è conforme al formato consigliato: principale.secondaria.build.revisione</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat_Title"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">La stringa di versione specificata non è conforme al formato consigliato: principale.secondaria.build.revisione</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCultureForExe"> <source>Executables cannot be satellite assemblies; culture should always be empty</source> <target state="translated">I file eseguibili non possono essere assembly satellite. Il campo relativo alle impostazioni cultura deve essere sempre vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_NoCorrespondingArgument"> <source>There is no argument given that corresponds to the required formal parameter '{0}' of '{1}'</source> <target state="translated">Non sono stati specificati argomenti corrispondenti al parametro formale obbligatorio '{0}' di '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch"> <source>The command line switch '{0}' is not yet implemented and was ignored.</source> <target state="translated">L'opzione '{0}' della riga di comando non è ancora implementata ed è stata ignorata.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch_Title"> <source>Command line switch is not yet implemented</source> <target state="translated">L'opzione della riga di comando non è ancora implementata</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleEmitFailure"> <source>Failed to emit module '{0}': {1}</source> <target state="translated">Non è stato possibile creare il modulo '{0}': {1}</target> <note /> </trans-unit> <trans-unit id="ERR_FixedLocalInLambda"> <source>Cannot use fixed local '{0}' inside an anonymous method, lambda expression, or query expression</source> <target state="translated">Non è possibile usare la variabile locale fissa '{0}' in un metodo anonimo, in un'espressione lambda o in un'espressione di query</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsNamedArgument"> <source>An expression tree may not contain a named argument specification</source> <target state="translated">L'albero delle espressioni non può contenere una specifica di argomento denominato</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsOptionalArgument"> <source>An expression tree may not contain a call or invocation that uses optional arguments</source> <target state="translated">Un albero delle espressioni non può contenere una chiamata che usa argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsIndexedProperty"> <source>An expression tree may not contain an indexed property</source> <target state="translated">L'albero delle espressioni non può contenere una proprietà indicizzata</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedPropertyRequiresParams"> <source>Indexed property '{0}' has non-optional arguments which must be provided</source> <target state="translated">La proprietà indicizzata '{0}' include argomenti non facoltativi che devono essere specificati</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedPropertyMustHaveAllOptionalParams"> <source>Indexed property '{0}' must have all arguments optional</source> <target state="translated">La proprietà indicizzata '{0}' deve includere tutti argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_SpecialByRefInLambda"> <source>Instance of type '{0}' cannot be used inside a nested function, query expression, iterator block or async method</source> <target state="translated">L'istanza di tipo '{0}' non può essere usata all'interno di una funzione annidata, un'espressione di query, un blocco iteratore o un metodo asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeMissingAction"> <source>First argument to a security attribute must be a valid SecurityAction</source> <target state="translated">Il primo argomento di un attributo di sicurezza deve essere un elemento SecurityAction valido</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidAction"> <source>Security attribute '{0}' has an invalid SecurityAction value '{1}'</source> <target state="translated">L'attributo di sicurezza '{0}' ha un valore SecurityAction '{1}' non valido</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionAssembly"> <source>SecurityAction value '{0}' is invalid for security attributes applied to an assembly</source> <target state="translated">Il valore '{0}' di SecurityAction non è valido per gli attributi di sicurezza applicati a un assembly</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionTypeOrMethod"> <source>SecurityAction value '{0}' is invalid for security attributes applied to a type or a method</source> <target state="translated">Il valore '{0}' di SecurityAction non è valido per gli attributi di sicurezza applicati a un tipo o a un metodo</target> <note /> </trans-unit> <trans-unit id="ERR_PrincipalPermissionInvalidAction"> <source>SecurityAction value '{0}' is invalid for PrincipalPermission attribute</source> <target state="translated">Il valore '{0}' di SecurityAction non è valido per l'attributo PrincipalPermission</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotValidInExpressionTree"> <source>An expression tree may not contain '{0}'</source> <target state="translated">Un albero delle espressioni non può contenere '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeInvalidFile"> <source>Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute</source> <target state="translated">Non è possibile risolvere il percorso del file '{0}' specificato per l'argomento denominato '{1}' per l'attributo PermissionSet</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeFileReadError"> <source>Error reading file '{0}' specified for the named argument '{1}' for PermissionSet attribute: '{2}'</source> <target state="translated">Si è verificato un errore durante la lettura del file '{0}' specificato per l'argomento denominato '{1}' per l'attributo PermissionSet: '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalSingleTypeNameNotFoundFwd"> <source>The type name '{0}' could not be found in the global namespace. This type has been forwarded to assembly '{1}' Consider adding a reference to that assembly.</source> <target state="translated">Il nome di tipo '{0}' non è stato trovato nello spazio dei nomi globale. Il tipo è stato inoltrato all'assembly '{1}'. Provare ad aggiungere un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_DottedTypeNameNotFoundInNSFwd"> <source>The type name '{0}' could not be found in the namespace '{1}'. This type has been forwarded to assembly '{2}' Consider adding a reference to that assembly.</source> <target state="translated">Il nome di tipo '{0}' non è stato trovato nello spazio dei nomi '{1}'. Il tipo è stato inoltrato all'assembly '{2}'. Provare ad aggiungere un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleTypeNameNotFoundFwd"> <source>The type name '{0}' could not be found. This type has been forwarded to assembly '{1}'. Consider adding a reference to that assembly.</source> <target state="translated">Il nome di tipo '{0}' non è stato trovato. Il tipo è stato inoltrato all'assembly '{1}'. Provare ad aggiungere un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_AssemblySpecifiedForLinkAndRef"> <source>Assemblies '{0}' and '{1}' refer to the same metadata but only one is a linked reference (specified using /link option); consider removing one of the references.</source> <target state="translated">Gli assembly '{0}' e '{1}' fanno riferimento agli stessi metadati ma solo uno è un riferimento collegato (specificato con l'opzione /link). Provare a rimuovere uno dei riferimenti.</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAdd"> <source>The best overloaded Add method '{0}' for the collection initializer element is obsolete.</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'elemento inizializzatore di raccolta è obsoleto.</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAdd_Title"> <source>The best overloaded Add method for the collection initializer element is obsolete</source> <target state="translated">Il miglior metodo Add di overload per l'elemento inizializzatore di raccolta è obsoleto</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAddStr"> <source>The best overloaded Add method '{0}' for the collection initializer element is obsolete. {1}</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'elemento inizializzatore di raccolta è obsoleto. {1}</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAddStr_Title"> <source>The best overloaded Add method for the collection initializer element is obsolete</source> <target state="translated">Il miglior metodo Add di overload per l'elemento inizializzatore di raccolta è obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_DeprecatedCollectionInitAddStr"> <source>The best overloaded Add method '{0}' for the collection initializer element is obsolete. {1}</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'elemento inizializzatore di raccolta è obsoleto. {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidTarget"> <source>Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.</source> <target state="translated">L'attributo di sicurezza '{0}' non è valido in questo tipo di dichiarazione. Gli attributi di sicurezza sono validi solo in dichiarazioni di metodo, assembly e tipi.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicMethodArg"> <source>Cannot use an expression of type '{0}' as an argument to a dynamically dispatched operation.</source> <target state="translated">Non è possibile usare un'espressione di tipo '{0}' come argomento per un'operazione inviata dinamicamente.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicMethodArgLambda"> <source>Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type.</source> <target state="translated">Non è possibile usare un'espressione lambda come argomento per un'operazione inviata dinamicamente senza prima eseguire il cast a un tipo di albero delle espressioni o di delegato.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicMethodArgMemgrp"> <source>Cannot use a method group as an argument to a dynamically dispatched operation. Did you intend to invoke the method?</source> <target state="translated">Non è possibile usare un metodo di gruppo come argomento per un'operazione inviata dinamicamente. Si intendeva richiamare il metodo?</target> <note /> </trans-unit> <trans-unit id="ERR_NoDynamicPhantomOnBase"> <source>The call to method '{0}' needs to be dynamically dispatched, but cannot be because it is part of a base access expression. Consider casting the dynamic arguments or eliminating the base access.</source> <target state="translated">Non è possibile eseguire l'invio dinamico richiesto della chiamata al metodo '{0}' perché fa parte di un'espressione di accesso di base. Provare a eseguire il cast degli argomenti dinamici o a eliminare l'accesso di base.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicQuery"> <source>Query expressions over source type 'dynamic' or with a join sequence of type 'dynamic' are not allowed</source> <target state="translated">Non sono consentite espressioni di query sul tipo di origine 'dynamic' o con una sequenza di join di tipo 'dynamic'</target> <note /> </trans-unit> <trans-unit id="ERR_NoDynamicPhantomOnBaseIndexer"> <source>The indexer access needs to be dynamically dispatched, but cannot be because it is part of a base access expression. Consider casting the dynamic arguments or eliminating the base access.</source> <target state="translated">L'accesso all'indicizzatore deve essere inviato dinamicamente. Tuttavia, non è possibile perché fa parte di un'espressione di accesso di base. Provare a eseguire il cast degli argomenti dinamici o a eliminare l'accesso di base.</target> <note /> </trans-unit> <trans-unit id="WRN_DynamicDispatchToConditionalMethod"> <source>The dynamically dispatched call to method '{0}' may fail at runtime because one or more applicable overloads are conditional methods.</source> <target state="translated">La chiamata al metodo '{0}' inviata in modo dinamico potrebbe non riuscire in fase di esecuzione perché uno o più overload applicabili sono metodi condizionali.</target> <note /> </trans-unit> <trans-unit id="WRN_DynamicDispatchToConditionalMethod_Title"> <source>Dynamically dispatched call may fail at runtime because one or more applicable overloads are conditional methods</source> <target state="translated">La chiamata inviata in modo dinamico potrebbe non riuscire in fase di esecuzione perché uno o più overload applicabili sono metodi condizionali</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgTypeDynamicExtension"> <source>'{0}' has no applicable method named '{1}' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.</source> <target state="translated">'{0}' non contiene alcun metodo applicabile denominato '{1}' ma apparentemente include un metodo di estensione con tale nome. I metodi di estensione non possono essere inviati dinamicamente. Provare a eseguire il cast degli argomenti dinamici o a chiamare il metodo di estensione senza la relativa sintassi.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerMemberName"> <source>The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute.</source> <target state="translated">CallerMemberNameAttribute applicato al parametro '{0}' non avrà alcun effetto. CallerFilePathAttribute ne eseguirà l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerMemberName_Title"> <source>The CallerMemberNameAttribute will have no effect; it is overridden by the CallerFilePathAttribute</source> <target state="translated">CallerMemberNameAttribute non avrà alcun effetto. CallerFilePathAttribute ne eseguirà l'override</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerMemberName"> <source>The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</source> <target state="translated">CallerMemberNameAttribute applicato al parametro '{0}' non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerMemberName_Title"> <source>The CallerMemberNameAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</source> <target state="translated">CallerMemberNameAttribute non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerFilePath"> <source>The CallerFilePathAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</source> <target state="translated">CallerFilePathAttribute applicato al parametro '{0}' non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerFilePath_Title"> <source>The CallerFilePathAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</source> <target state="translated">CallerFilePathAttribute non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDynamicCondition"> <source>Expression must be implicitly convertible to Boolean or its type '{0}' must define operator '{1}'.</source> <target state="translated">L'espressione deve essere convertibile in modo implicito in un valore booleano oppure il relativo tipo '{0}' deve definire l'operatore '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MixingWinRTEventWithRegular"> <source>'{0}' cannot implement '{1}' because '{2}' is a Windows Runtime event and '{3}' is a regular .NET event.</source> <target state="translated">'{0}' non può implementare '{1}' perché '{2}' è un evento Windows Runtime e '{3}' è un evento .NET normale.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope1"> <source>Call System.IDisposable.Dispose() on allocated instance of {0} before all references to it are out of scope.</source> <target state="translated">Chiamare System.IDisposable.Dispose() sull'istanza allocata di {0} prima che tutti i relativi riferimenti siano esterni all'ambito.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope1_Title"> <source>Call System.IDisposable.Dispose() on allocated instance before all references to it are out of scope</source> <target state="translated">Chiamare System.IDisposable.Dispose() sull'istanza allocata prima che tutti i relativi riferimenti siano esterni all'ambito</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope2"> <source>Allocated instance of {0} is not disposed along all exception paths. Call System.IDisposable.Dispose() before all references to it are out of scope.</source> <target state="translated">L'istanza allocata di {0} non è stata eliminata in tutti i percorsi delle eccezioni. Chiamare System.IDisposable.Dispose() prima che tutti i relativi riferimenti siano esterni all'ambito.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope2_Title"> <source>Allocated instance is not disposed along all exception paths</source> <target state="translated">L'istanza allocata non è stata eliminata in tutti i percorsi delle eccezioni</target> <note /> </trans-unit> <trans-unit id="WRN_CA2202_DoNotDisposeObjectsMultipleTimes"> <source>Object '{0}' can be disposed more than once.</source> <target state="translated">L'oggetto '{0}' non può essere eliminato più di una volta.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2202_DoNotDisposeObjectsMultipleTimes_Title"> <source>Object can be disposed more than once</source> <target state="translated">L'oggetto non può essere eliminato più di una volta</target> <note /> </trans-unit> <trans-unit id="ERR_NewCoClassOnLink"> <source>Interop type '{0}' cannot be embedded. Use the applicable interface instead.</source> <target state="translated">Non è possibile incorporare il tipo di interoperabilità '{0}'. Usare l'interfaccia applicabile.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIANestedType"> <source>Type '{0}' cannot be embedded because it is a nested type. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché è un tipo annidato. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericsUsedInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a generic argument. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché contiene un argomento generico. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropStructContainsMethods"> <source>Embedded interop struct '{0}' can contain only public instance fields.</source> <target state="translated">Lo struct di interoperabilità incorporato '{0}' può contenere solo campi di istanza pubblici.</target> <note /> </trans-unit> <trans-unit id="ERR_WinRtEventPassedByRef"> <source>A Windows Runtime event may not be passed as an out or ref parameter.</source> <target state="translated">Un evento Windows Runtime non può essere passato come parametro out o ref.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingMethodOnSourceInterface"> <source>Source interface '{0}' is missing method '{1}' which is required to embed event '{2}'.</source> <target state="translated">Nell'interfaccia di origine '{0}' manca il metodo '{1}' necessario per incorporare l'evento '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingSourceInterface"> <source>Interface '{0}' has an invalid source interface which is required to embed event '{1}'.</source> <target state="translated">L'interfaccia '{0}' contiene un'interfaccia di origine non valida che è necessaria per incorporare l'evento '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropTypeMissingAttribute"> <source>Interop type '{0}' cannot be embedded because it is missing the required '{1}' attribute.</source> <target state="translated">Non è possibile incorporare il tipo di interoperabilità '{0}' perché manca l'attributo obbligatorio '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAssemblyMissingAttribute"> <source>Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute.</source> <target state="translated">Non è possibile incorporare i tipi di interoperabilità dall'assembly '{0}' perché manca l'attributo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAssemblyMissingAttributes"> <source>Cannot embed interop types from assembly '{0}' because it is missing either the '{1}' attribute or the '{2}' attribute.</source> <target state="translated">Non è possibile incorporare i tipi di interoperabilità dall'assembly '{0}' perché manca l'attributo '{1}' o '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropTypesWithSameNameAndGuid"> <source>Cannot embed interop type '{0}' found in both assembly '{1}' and '{2}'. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo di interoperabilità '{0}' trovato negli assembly '{1}' e '{2}'. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su False.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalTypeNameClash"> <source>Embedding the interop type '{0}' from assembly '{1}' causes a name clash in the current assembly. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">L'incorporamento del tipo di interoperabilità '{0}' dall'assembly '{1}' causa un conflitto di nomi nell'assembly corrente. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyReferencesLinkedPIA"> <source>A reference was created to embedded interop assembly '{0}' because of an indirect reference to that assembly created by assembly '{1}'. Consider changing the 'Embed Interop Types' property on either assembly.</source> <target state="translated">È stato creato un riferimento all'assembly di interoperabilità '{0}' incorporato a causa di un riferimento indiretto a tale assembly creato dall'assembly '{1}'. Provare a modificare la proprietà 'Incorpora tipi di interoperabilità' in uno degli assembly.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyReferencesLinkedPIA_Title"> <source>A reference was created to embedded interop assembly because of an indirect assembly reference</source> <target state="translated">È stato creato un riferimento all'assembly di interoperabilità incorporato a causa di un riferimento indiretto a tale assembly</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyReferencesLinkedPIA_Description"> <source>You have added a reference to an assembly using /link (Embed Interop Types property set to True). This instructs the compiler to embed interop type information from that assembly. However, the compiler cannot embed interop type information from that assembly because another assembly that you have referenced also references that assembly using /reference (Embed Interop Types property set to False). To embed interop type information for both assemblies, use /link for references to each assembly (set the Embed Interop Types property to True). To remove the warning, you can use /reference instead (set the Embed Interop Types property to False). In this case, a primary interop assembly (PIA) provides interop type information.</source> <target state="translated">Per aggiungere un riferimento a un assembly, è stato usato /link (proprietà Incorpora tipi di interoperabilità impostata su True). Questo parametro indica al compilatore di incorporare le informazioni sui tipi di interoperabilità da tale assembly. Il compilatore non è però in grado di incorporare tali informazioni dall'assembly perché anche un altro assembly a cui viene fatto riferimento fa riferimento a tale assembly tramite /reference (proprietà Incorpora tipi di interoperabilità impostata su False). Per incorporare le informazioni sui tipi di interoperabilità per entrambi gli assembly, usare /link per i riferimenti ai singoli assembly (impostare la proprietà Incorpora tipi di interoperabilità su True). Per rimuovere l'avviso, è invece possibile usare /reference (impostare la proprietà Incorpora tipi di interoperabilità su False). In questo caso, le informazioni sui tipi di interoperabilità verranno fornite da un assembly di interoperabilità primario.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericsUsedAcrossAssemblies"> <source>Type '{0}' from assembly '{1}' cannot be used across assembly boundaries because it has a generic type argument that is an embedded interop type.</source> <target state="translated">Non è possibile usare il tipo '{0}' dell'assembly '{1}' tra limiti di assembly perché contiene un argomento tipo generico che corrisponde a un tipo di interoperabilità incorporato.</target> <note /> </trans-unit> <trans-unit id="ERR_NoCanonicalView"> <source>Cannot find the interop type that matches the embedded interop type '{0}'. Are you missing an assembly reference?</source> <target state="translated">Il tipo di interoperabilità corrispondente al tipo di interoperabilità incorporato '{0}' non è stato trovato. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMismatch"> <source>Module name '{0}' stored in '{1}' must match its filename.</source> <target state="translated">Il nome modulo '{0}' memorizzato in '{1}' deve corrispondere al relativo nome di file.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleName"> <source>Invalid module name: {0}</source> <target state="translated">Nome di modulo non valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadCompilationOptionValue"> <source>Invalid '{0}' value: '{1}'.</source> <target state="translated">Il valore di '{0}' non è valido: '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAppConfigPath"> <source>AppConfigPath must be absolute.</source> <target state="translated">AppConfigPath deve essere assoluto.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden"> <source>Attribute '{0}' from module '{1}' will be ignored in favor of the instance appearing in source</source> <target state="translated">L'attributo '{0}' del modulo '{1}' verrà ignorato e verrà usata l'istanza presente nell'origine</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden_Title"> <source>Attribute will be ignored in favor of the instance appearing in source</source> <target state="translated">L'attributo verrà ignorato e verrà usata l'istanza presente nell'origine</target> <note /> </trans-unit> <trans-unit id="ERR_CmdOptionConflictsSource"> <source>Attribute '{0}' given in a source file conflicts with option '{1}'.</source> <target state="translated">L'attributo '{0}' specificato in un file di origine è in conflitto con l'opzione '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FixedBufferTooManyDimensions"> <source>A fixed buffer may only have one dimension.</source> <target state="translated">Un buffer fisso può avere una sola dimensione.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName"> <source>Referenced assembly '{0}' does not have a strong name.</source> <target state="translated">L'assembly '{0}' al quale si fa riferimento non ha un nome sicuro.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName_Title"> <source>Referenced assembly does not have a strong name</source> <target state="translated">L'assembly di riferimento non ha un nome sicuro</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSignaturePublicKey"> <source>Invalid signature public key specified in AssemblySignatureKeyAttribute.</source> <target state="translated">La chiave pubblica di firma specificata in AssemblySignatureKeyAttribute non è valida.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypeConflictsWithDeclaration"> <source>Type '{0}' exported from module '{1}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Il tipo '{0}' esportato dal modulo '{1}' è in conflitto con il tipo dichiarato nel modulo primario di questo assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypesConflict"> <source>Type '{0}' exported from module '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Il tipo '{0}' esportato dal modulo '{1}' è in conflitto con il tipo '{2}' esportato dal modulo '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithDeclaration"> <source>Forwarded type '{0}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Il tipo inoltrato '{0}' è in conflitto con il tipo dichiarato nel modulo primario di questo assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypesConflict"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' forwarded to assembly '{3}'.</source> <target state="translated">Il tipo '{0}' inoltrato all'assembly '{1}' è in conflitto con il tipo '{2}' inoltrato all'assembly '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithExportedType"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Il tipo '{0}' inoltrato all'assembly '{1}' è in conflitto con il tipo '{2}' esportato dal modulo '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch"> <source>Referenced assembly '{0}' has different culture setting of '{1}'.</source> <target state="translated">Le impostazioni cultura dell'assembly '{0}' al quale si fa riferimento sono diverse da '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch_Title"> <source>Referenced assembly has different culture setting</source> <target state="translated">Le impostazioni cultura dell'assembly di riferimento sono diverse</target> <note /> </trans-unit> <trans-unit id="ERR_AgnosticToMachineModule"> <source>Agnostic assembly cannot have a processor specific module '{0}'.</source> <target state="translated">Un assembly agnostico non può avere un modulo '{0}' specifico del processore.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingMachineModule"> <source>Assembly and module '{0}' cannot target different processors.</source> <target state="translated">L'assembly e il modulo '{0}' non possono essere destinati a processori diversi.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly"> <source>Referenced assembly '{0}' targets a different processor.</source> <target state="translated">L'assembly '{0}' a cui si fa riferimento ha come destinazione un processore diverso.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly_Title"> <source>Referenced assembly targets a different processor</source> <target state="translated">L'assembly di riferimento ha come destinazione un processore diverso</target> <note /> </trans-unit> <trans-unit id="ERR_CryptoHashFailed"> <source>Cryptographic failure while creating hashes.</source> <target state="translated">Si è verificato un errore di crittografia durante la creazione di hash.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNetModuleReference"> <source>Reference to '{0}' netmodule missing.</source> <target state="translated">Manca il riferimento al netmodule '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMustBeUnique"> <source>Module '{0}' is already defined in this assembly. Each module must have a unique filename.</source> <target state="translated">Il modulo '{0}' è già definito in questo assembly. Ogni modulo deve avere un nome di file univoco.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadConfigFile"> <source>Cannot read config file '{0}' -- '{1}'</source> <target state="translated">Non è possibile leggere il file di configurazione '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_EncNoPIAReference"> <source>Cannot continue since the edit includes a reference to an embedded type: '{0}'.</source> <target state="translated">Non è possibile continuare perché la modifica include un riferimento a un tipo incorporato: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EncReferenceToAddedMember"> <source>Member '{0}' added during the current debug session can only be accessed from within its declaring assembly '{1}'.</source> <target state="translated">Il membro '{0}' aggiunto durante la sessione di debug corrente è accessibile solo dall'interno dell'assembly '{1}' in cui viene dichiarato.</target> <note /> </trans-unit> <trans-unit id="ERR_MutuallyExclusiveOptions"> <source>Compilation options '{0}' and '{1}' can't both be specified at the same time.</source> <target state="translated">Non è possibile specificare contemporaneamente le opzioni di compilazione '{0}' e '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LinkedNetmoduleMetadataMustProvideFullPEImage"> <source>Linked netmodule metadata must provide a full PE image: '{0}'.</source> <target state="translated">I metadati del netmodule collegato devono fornire un'immagine PE completa: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPrefer32OnLib"> <source>/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe</source> <target state="translated">/platform:anycpu32bitpreferred può essere usato solo con /t:exe, /t:winexe e /t:appcontainerexe</target> <note /> </trans-unit> <trans-unit id="IDS_PathList"> <source>&lt;path list&gt;</source> <target state="translated">&lt;elenco percorsi&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_Text"> <source>&lt;text&gt;</source> <target state="translated">&lt;testo&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullPropagatingOperator"> <source>null propagating operator</source> <target state="translated">operatore di propagazione Null</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedMethod"> <source>expression-bodied method</source> <target state="translated">metodo con corpo di espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedProperty"> <source>expression-bodied property</source> <target state="translated">proprietà con corpo di espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedIndexer"> <source>expression-bodied indexer</source> <target state="translated">indicizzatore con corpo di espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAutoPropertyInitializer"> <source>auto property initializer</source> <target state="translated">inizializzatore di proprietà automatica</target> <note /> </trans-unit> <trans-unit id="IDS_Namespace1"> <source>&lt;namespace&gt;</source> <target state="translated">&lt;spazio dei nomi&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefLocalsReturns"> <source>byref locals and returns</source> <target state="translated">variabili locali e valori restituiti per riferimento</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadOnlyReferences"> <source>readonly references</source> <target state="translated">riferimenti di sola lettura</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefStructs"> <source>ref structs</source> <target state="translated">struct ref</target> <note /> </trans-unit> <trans-unit id="CompilationC"> <source>Compilation (C#): </source> <target state="translated">Compilazione (C#): </target> <note /> </trans-unit> <trans-unit id="SyntaxNodeIsNotWithinSynt"> <source>Syntax node is not within syntax tree</source> <target state="translated">Il nodo Syntax non è compreso nell'albero della sintassi</target> <note /> </trans-unit> <trans-unit id="LocationMustBeProvided"> <source>Location must be provided in order to provide minimal type qualification.</source> <target state="translated">Per offrire una qualifica minima del tipo, è necessario specificare Position.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeSemanticModelMust"> <source>SyntaxTreeSemanticModel must be provided in order to provide minimal type qualification.</source> <target state="translated">Per offrire una qualifica minima del tipo, è necessario specificare SyntaxTreeSemanticModel.</target> <note /> </trans-unit> <trans-unit id="CantReferenceCompilationOf"> <source>Can't reference compilation of type '{0}' from {1} compilation.</source> <target state="translated">Non è possibile fare riferimento alla compilazione di tipo '{0}' dalla compilazione di {1}.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeAlreadyPresent"> <source>Syntax tree already present</source> <target state="translated">L'albero della sintassi è già presente</target> <note /> </trans-unit> <trans-unit id="SubmissionCanOnlyInclude"> <source>Submission can only include script code.</source> <target state="translated">L'invio può includere solo codice script.</target> <note /> </trans-unit> <trans-unit id="SubmissionCanHaveAtMostOne"> <source>Submission can have at most one syntax tree.</source> <target state="translated">L'invio può avere al massimo un albero della sintassi.</target> <note /> </trans-unit> <trans-unit id="TreeMustHaveARootNodeWith"> <source>tree must have a root node with SyntaxKind.CompilationUnit</source> <target state="translated">l'albero deve avere un nodo radice con SyntaxKind.CompilationUnit</target> <note /> </trans-unit> <trans-unit id="TypeArgumentCannotBeNull"> <source>Type argument cannot be null</source> <target state="translated">L'argomento di tipo non può essere Null</target> <note /> </trans-unit> <trans-unit id="WrongNumberOfTypeArguments"> <source>Wrong number of type arguments</source> <target state="translated">Il numero di argomenti di tipo è errato</target> <note /> </trans-unit> <trans-unit id="NameConflictForName"> <source>Name conflict for name {0}</source> <target state="translated">Conflitto tra nomi per il nome {0}</target> <note /> </trans-unit> <trans-unit id="LookupOptionsHasInvalidCombo"> <source>LookupOptions has an invalid combination of options</source> <target state="translated">LookupOptions contiene una combinazione di opzioni non valida</target> <note /> </trans-unit> <trans-unit id="ItemsMustBeNonEmpty"> <source>items: must be non-empty</source> <target state="translated">elementi: non deve essere vuoto</target> <note /> </trans-unit> <trans-unit id="UseVerbatimIdentifier"> <source>Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Identifier or Microsoft.CodeAnalysis.CSharp.SyntaxFactory.VerbatimIdentifier to create identifier tokens.</source> <target state="translated">Usare Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Identifier o Microsoft.CodeAnalysis.CSharp.SyntaxFactory.VerbatimIdentifier per creare token di identificatore.</target> <note /> </trans-unit> <trans-unit id="UseLiteralForTokens"> <source>Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal to create character literal tokens.</source> <target state="translated">Usare Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal per creare token letterali di tipo carattere.</target> <note /> </trans-unit> <trans-unit id="UseLiteralForNumeric"> <source>Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal to create numeric literal tokens.</source> <target state="translated">Usare Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal per creare token letterali di tipo numerico.</target> <note /> </trans-unit> <trans-unit id="ThisMethodCanOnlyBeUsedToCreateTokens"> <source>This method can only be used to create tokens - {0} is not a token kind.</source> <target state="translated">Questo metodo può essere usato solo per creare token - {0} non è un tipo di token.</target> <note /> </trans-unit> <trans-unit id="GenericParameterDefinition"> <source>Generic parameter is definition when expected to be reference {0}</source> <target state="translated">Il parametro generico corrisponde alla definizione mentre dovrebbe essere il riferimento {0}</target> <note /> </trans-unit> <trans-unit id="InvalidGetDeclarationNameMultipleDeclarators"> <source>Called GetDeclarationName for a declaration node that can possibly contain multiple variable declarators.</source> <target state="translated">È stato chiamato GetDeclarationName per un nodo di dichiarazione che può contenere più dichiarazioni di variabile.</target> <note /> </trans-unit> <trans-unit id="TreeNotPartOfCompilation"> <source>tree not part of compilation</source> <target state="translated">l'albero non fa parte della compilazione</target> <note /> </trans-unit> <trans-unit id="PositionIsNotWithinSyntax"> <source>Position is not within syntax tree with full span {0}</source> <target state="translated">Position non è compreso nell'albero della sintassi con full span {0}</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang"> <source>The language name '{0}' is invalid.</source> <target state="translated">Il nome del linguaggio '{0}' non è valido.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang_Title"> <source>The language name is invalid</source> <target state="translated">Il nome del linguaggio non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedTransparentIdentifierAccess"> <source>Transparent identifier member access failed for field '{0}' of '{1}'. Does the data being queried implement the query pattern?</source> <target state="translated">L'accesso al membro identificatore trasparente non è riuscito per il campo '{0}' di '{1}'. I dati su cui eseguire la query implementano il modello di query?</target> <note /> </trans-unit> <trans-unit id="ERR_ParamDefaultValueDiffersFromAttribute"> <source>The parameter has multiple distinct default values.</source> <target state="translated">Il parametro ha più valori predefiniti distinct.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldHasMultipleDistinctConstantValues"> <source>The field has multiple distinct constant values.</source> <target state="translated">Il campo ha più valori costanti distinct.</target> <note /> </trans-unit> <trans-unit id="WRN_UnqualifiedNestedTypeInCref"> <source>Within cref attributes, nested types of generic types should be qualified.</source> <target state="translated">Negli attributi cref è necessario qualificare i tipi annidati di tipi generici.</target> <note /> </trans-unit> <trans-unit id="WRN_UnqualifiedNestedTypeInCref_Title"> <source>Within cref attributes, nested types of generic types should be qualified</source> <target state="translated">Negli attributi cref è necessario qualificare i tipi annidati di tipi generici</target> <note /> </trans-unit> <trans-unit id="NotACSharpSymbol"> <source>Not a C# symbol.</source> <target state="translated">Non è un simbolo di C#.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedUsingDirective"> <source>Unnecessary using directive.</source> <target state="translated">Direttiva Using non necessaria.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedExternAlias"> <source>Unused extern alias.</source> <target state="translated">Alias extern non usato.</target> <note /> </trans-unit> <trans-unit id="ElementsCannotBeNull"> <source>Elements cannot be null.</source> <target state="translated">Gli elementi non possono essere Null.</target> <note /> </trans-unit> <trans-unit id="IDS_LIB_ENV"> <source>LIB environment variable</source> <target state="translated">variabile di ambiente LIB</target> <note /> </trans-unit> <trans-unit id="IDS_LIB_OPTION"> <source>/LIB option</source> <target state="translated">opzione /LIB</target> <note /> </trans-unit> <trans-unit id="IDS_REFERENCEPATH_OPTION"> <source>/REFERENCEPATH option</source> <target state="translated">opzione /REFERENCEPATH</target> <note /> </trans-unit> <trans-unit id="IDS_DirectoryDoesNotExist"> <source>directory does not exist</source> <target state="translated">la directory non esiste</target> <note /> </trans-unit> <trans-unit id="IDS_DirectoryHasInvalidPath"> <source>path is too long or invalid</source> <target state="translated">il percorso è troppo lungo o non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_NoRuntimeMetadataVersion"> <source>No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.</source> <target state="translated">Non è stato trovato un valore per RuntimeMetadataVersion. Non è presente un assembly che contiene System.Object oppure tramite le opzioni non è stato specificato un valore per RuntimeMetadataVersion.</target> <note /> </trans-unit> <trans-unit id="WRN_NoRuntimeMetadataVersion_Title"> <source>No value for RuntimeMetadataVersion found</source> <target state="translated">Non sono stati trovati valori per RuntimeMetadataVersion</target> <note /> </trans-unit> <trans-unit id="WrongSemanticModelType"> <source>Expected a {0} SemanticModel.</source> <target state="translated">È previsto un elemento SemanticModel {0}.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambda"> <source>lambda expression</source> <target state="translated">espressione lambda</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion1"> <source>Feature '{0}' is not available in C# 1. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 1. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion2"> <source>Feature '{0}' is not available in C# 2. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 2. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion3"> <source>Feature '{0}' is not available in C# 3. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 3. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion4"> <source>Feature '{0}' is not available in C# 4. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 4. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion5"> <source>Feature '{0}' is not available in C# 5. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 5. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion6"> <source>Feature '{0}' is not available in C# 6. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 6. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7"> <source>Feature '{0}' is not available in C# 7.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 7.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="IDS_VersionExperimental"> <source>'experimental'</source> <target state="translated">'experimental'</target> <note /> </trans-unit> <trans-unit id="PositionNotWithinTree"> <source>Position must be within span of the syntax tree.</source> <target state="translated">La posizione deve essere inclusa nello span dell'albero della sintassi.</target> <note /> </trans-unit> <trans-unit id="SpeculatedSyntaxNodeCannotBelongToCurrentCompilation"> <source>Syntax node to be speculated cannot belong to a syntax tree from the current compilation.</source> <target state="translated">Il nodo della sintassi da prevedere non può appartenere a un albero della sintassi della compilazione corrente.</target> <note /> </trans-unit> <trans-unit id="ChainingSpeculativeModelIsNotSupported"> <source>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</source> <target state="translated">Il concatenamento del modello semantico speculativo non è supportato. È necessario creare un modello speculativo dal modello ParentModel non speculativo.</target> <note /> </trans-unit> <trans-unit id="IDS_ToolName"> <source>Microsoft (R) Visual C# Compiler</source> <target state="translated">Compilatore Microsoft (R) Visual C#</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine1"> <source>{0} version {1}</source> <target state="translated">{0} versione {1}</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.</target> <note /> </trans-unit> <trans-unit id="IDS_LangVersions"> <source>Supported language versions:</source> <target state="translated">Versioni del linguaggio supportate:</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithInitializers"> <source>'{0}': a class with the ComImport attribute cannot specify field initializers.</source> <target state="translated">'{0}': una classe con l'attributo ComImport non può specificare inizializzatori di campo.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong"> <source>Local name '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Il nome locale '{0}' è troppo lungo per for PDB. Provare ad abbreviarlo oppure a compilare senza /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong_Title"> <source>Local name is too long for PDB</source> <target state="translated">Il nome locale è troppo lungo per PDB</target> <note /> </trans-unit> <trans-unit id="ERR_RetNoObjectRequiredLambda"> <source>Anonymous function converted to a void returning delegate cannot return a value</source> <target state="translated">La funzione anonima convertita in un delegato che restituisce un valore nullo non può restituire un valore</target> <note /> </trans-unit> <trans-unit id="ERR_TaskRetNoObjectRequiredLambda"> <source>Async lambda expression converted to a 'Task' returning delegate cannot return a value. Did you intend to return 'Task&lt;T&gt;'?</source> <target state="translated">L'espressione lambda asincrona convertita in un elemento 'Task' che restituisce il delegato non può restituire un valore. Si intendeva restituire 'Task&lt;T&gt;'?</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated"> <source>An instance of analyzer {0} cannot be created from {1} : {2}.</source> <target state="translated">Non è possibile creare un'istanza dell'analizzatore {0} da {1} : {2}.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated_Title"> <source>An analyzer instance cannot be created</source> <target state="translated">Non è possibile creare un'istanza dell'analizzatore</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly"> <source>The assembly {0} does not contain any analyzers.</source> <target state="translated">L'assembly {0} non contiene analizzatori.</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly_Title"> <source>Assembly does not contain any analyzers</source> <target state="translated">L'assembly non contiene analizzatori</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer"> <source>Unable to load Analyzer assembly {0} : {1}</source> <target state="translated">Non è possibile caricare l'assembly dell'analizzatore {0}: {1}</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer_Title"> <source>Unable to load Analyzer assembly</source> <target state="translated">Non è possibile caricare l'assembly dell'analizzatore</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer"> <source>Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}.</source> <target state="translated">Alcuni tipi nell'assembly dell'analizzatore {0} verranno ignorati a causa di un'eccezione ReflectionTypeLoadException: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadRulesetFile"> <source>Error reading ruleset file {0} - {1}</source> <target state="translated">Si è verificato un errore durante la lettura del file del set di regole {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadPdbData"> <source>Error reading debug information for '{0}'</source> <target state="translated">Si è verificato un errore durante la lettura delle informazioni di debug per '{0}'</target> <note /> </trans-unit> <trans-unit id="IDS_OperationCausedStackOverflow"> <source>Operation caused a stack overflow.</source> <target state="translated">L'operazione ha causato un overflow dello stack.</target> <note /> </trans-unit> <trans-unit id="WRN_IdentifierOrNumericLiteralExpected"> <source>Expected identifier or numeric literal.</source> <target state="translated">È previsto un identificatore o un valore letterale.</target> <note /> </trans-unit> <trans-unit id="WRN_IdentifierOrNumericLiteralExpected_Title"> <source>Expected identifier or numeric literal</source> <target state="translated">È previsto un identificatore o un valore letterale</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerOnNonAutoProperty"> <source>Only auto-implemented properties can have initializers.</source> <target state="translated">Solo le proprietà implementate automaticamente possono avere inizializzatori.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyMustHaveGetAccessor"> <source>Auto-implemented properties must have get accessors.</source> <target state="translated">Le proprietà implementate automaticamente devono avere funzioni di accesso get.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyMustOverrideSet"> <source>Auto-implemented properties must override all accessors of the overridden property.</source> <target state="translated">Le proprietà implementate automaticamente devono sostituire tutte le funzioni di accesso della proprietà sostituita.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerInStructWithoutExplicitConstructor"> <source>Structs without explicit constructors cannot contain members with initializers.</source> <target state="translated">Le struct senza costruttori espliciti non possono contenere membri con inizializzatori.</target> <note /> </trans-unit> <trans-unit id="ERR_EncodinglessSyntaxTree"> <source>Cannot emit debug information for a source text without encoding.</source> <target state="translated">Non è possibile creare le informazioni di debug per un testo di origine senza codifica.</target> <note /> </trans-unit> <trans-unit id="ERR_BlockBodyAndExpressionBody"> <source>Block bodies and expression bodies cannot both be provided.</source> <target state="translated">Non è possibile specificare sia corpi di blocchi che corpi di espressioni.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchFallOut"> <source>Control cannot fall out of switch from final case label ('{0}')</source> <target state="translated">Control non può uscire dall'opzione dall'etichetta case finale ('{0}')</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedBoundGenericName"> <source>Type arguments are not allowed in the nameof operator.</source> <target state="translated">Gli argomenti di tipo non sono consentiti nell'operatore nameof.</target> <note /> </trans-unit> <trans-unit id="ERR_NullPropagatingOpInExpressionTree"> <source>An expression tree lambda may not contain a null propagating operator.</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un operatore di propagazione Null.</target> <note /> </trans-unit> <trans-unit id="ERR_DictionaryInitializerInExpressionTree"> <source>An expression tree lambda may not contain a dictionary initializer.</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un inizializzatore di dizionario.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionCollectionElementInitializerInExpressionTree"> <source>An extension Add method is not supported for a collection initializer in an expression lambda.</source> <target state="translated">Un metodo Add di estensione non è supportato per un inizializzatore di raccolta in un'espressione lambda.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNameof"> <source>nameof operator</source> <target state="translated">operatore nameof</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDictionaryInitializer"> <source>dictionary initializer</source> <target state="translated">inizializzatore di dizionario</target> <note /> </trans-unit> <trans-unit id="ERR_UnclosedExpressionHole"> <source>Missing close delimiter '}' for interpolated expression started with '{'.</source> <target state="translated">Manca il delimitatore '}' di chiusura per l'espressione interpolata che inizia con '{'.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleLineCommentInExpressionHole"> <source>A single-line comment may not be used in an interpolated string.</source> <target state="translated">Non è possibile usare un commento su una sola riga in una stringa interpolata.</target> <note /> </trans-unit> <trans-unit id="ERR_InsufficientStack"> <source>An expression is too long or complex to compile</source> <target state="translated">Espressione troppo lunga o complessa per essere compilata</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionHasNoName"> <source>Expression does not have a name.</source> <target state="translated">L'espressione non ha un nome.</target> <note /> </trans-unit> <trans-unit id="ERR_SubexpressionNotInNameof"> <source>Sub-expression cannot be used in an argument to nameof.</source> <target state="translated">Non è possibile usare l'espressione secondaria in un argomento di nameof.</target> <note /> </trans-unit> <trans-unit id="ERR_AliasQualifiedNameNotAnExpression"> <source>An alias-qualified name is not an expression.</source> <target state="translated">Un nome qualificato da alias non è un'espressione.</target> <note /> </trans-unit> <trans-unit id="ERR_NameofMethodGroupWithTypeParameters"> <source>Type parameters are not allowed on a method group as an argument to 'nameof'.</source> <target state="translated">In un gruppo di metodi non sono consentiti parametri di tipo usati come argomento di 'nameof'.</target> <note /> </trans-unit> <trans-unit id="NoNoneSearchCriteria"> <source>SearchCriteria is expected.</source> <target state="translated">È previsto SearchCriteria.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCulture"> <source>Assembly culture strings may not contain embedded NUL characters.</source> <target state="translated">Le stringhe delle impostazioni cultura dell'assembly potrebbero non contenere caratteri NUL incorporati.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUsingStatic"> <source>using static</source> <target state="translated">using static</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureInterpolatedStrings"> <source>interpolated strings</source> <target state="translated">stringhe interpolate</target> <note /> </trans-unit> <trans-unit id="IDS_AwaitInCatchAndFinally"> <source>await in catch blocks and finally blocks</source> <target state="translated">await in blocchi catch e blocchi finally</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureBinaryLiteral"> <source>binary literals</source> <target state="translated">valori letterali binari</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDigitSeparator"> <source>digit separators</source> <target state="translated">separatori di cifra</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLocalFunctions"> <source>local functions</source> <target state="translated">funzioni locali</target> <note /> </trans-unit> <trans-unit id="ERR_UnescapedCurly"> <source>A '{0}' character must be escaped (by doubling) in an interpolated string.</source> <target state="translated">In una stringa interpolata è necessario specificare il carattere di escape di un carattere '{0}' raddoppiandolo.</target> <note /> </trans-unit> <trans-unit id="ERR_EscapedCurly"> <source>A '{0}' character may only be escaped by doubling '{0}{0}' in an interpolated string.</source> <target state="translated">In una stringa interpolata è possibile specificare il carattere di escape di un carattere '{0}' raddoppiando '{0}{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TrailingWhitespaceInFormatSpecifier"> <source>A format specifier may not contain trailing whitespace.</source> <target state="translated">Un identificatore di formato non può contenere uno spazio vuoto finale.</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyFormatSpecifier"> <source>Empty format specifier.</source> <target state="translated">Identificatore di formato vuoto.</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorInReferencedAssembly"> <source>There is an error in a referenced assembly '{0}'.</source> <target state="translated">Un assembly di riferimento '{0}' contiene un errore.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionOrDeclarationExpected"> <source>Expression or declaration statement expected.</source> <target state="translated">È prevista l'istruzione di dichiarazione o l'espressione.</target> <note /> </trans-unit> <trans-unit id="ERR_NameofExtensionMethod"> <source>Extension method groups are not allowed as an argument to 'nameof'.</source> <target state="translated">Come argomento di 'nameof' non sono consentiti gruppi di metodi di estensione.</target> <note /> </trans-unit> <trans-unit id="WRN_AlignmentMagnitude"> <source>Alignment value {0} has a magnitude greater than {1} and may result in a large formatted string.</source> <target state="translated">La grandezza del valore di allineamento {0} è maggiore di {1} e può comportare la creazione di una stringa formattata di grandi dimensioni.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedExternAlias_Title"> <source>Unused extern alias</source> <target state="translated">Alias extern non usato</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedUsingDirective_Title"> <source>Unnecessary using directive</source> <target state="translated">Direttiva using non necessaria</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer_Title"> <source>Skip loading types in analyzer assembly that fail due to a ReflectionTypeLoadException</source> <target state="translated">Ignora il caricamento dei tipi nell'assembly dell'analizzatore che non riescono a causa di un'eccezione ReflectionTypeLoadException</target> <note /> </trans-unit> <trans-unit id="WRN_AlignmentMagnitude_Title"> <source>Alignment value has a magnitude that may result in a large formatted string</source> <target state="translated">La grandezza del valore di allineamento è tale da comportare la creazione di una stringa formattata di grandi dimensioni</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantStringTooLong"> <source>Length of String constant resulting from concatenation exceeds System.Int32.MaxValue. Try splitting the string into multiple constants.</source> <target state="translated">La lunghezza della costante di stringa risultante dalla concatenazione supera il valore di System.Int32.MaxValue. Provare a dividere la stringa in più costanti.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleTooFewElements"> <source>Tuple must contain at least two elements.</source> <target state="translated">La tupla deve contenere almeno due elementi.</target> <note /> </trans-unit> <trans-unit id="ERR_DebugEntryPointNotSourceMethodDefinition"> <source>Debug entry point must be a definition of a method declared in the current compilation.</source> <target state="translated">Il punto di ingresso del debug deve essere una definizione di un metodo nella compilazione corrente.</target> <note /> </trans-unit> <trans-unit id="ERR_LoadDirectiveOnlyAllowedInScripts"> <source>#load is only allowed in scripts</source> <target state="translated">#load è consentito solo negli script</target> <note /> </trans-unit> <trans-unit id="ERR_PPLoadFollowsToken"> <source>Cannot use #load after first token in file</source> <target state="translated">Non è possibile usare #load dopo il primo token del file</target> <note /> </trans-unit> <trans-unit id="CouldNotFindFile"> <source>Could not find file.</source> <target state="translated">Il file non è stato trovato.</target> <note>File path referenced in source (#load) could not be resolved.</note> </trans-unit> <trans-unit id="SyntaxTreeFromLoadNoRemoveReplace"> <source>SyntaxTree resulted from a #load directive and cannot be removed or replaced directly.</source> <target state="translated">L'elemento SyntaxTree deriva da una direttiva #load e non può essere rimosso o sostituito direttamente.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceFileReferencesNotSupported"> <source>Source file references are not supported.</source> <target state="translated">I riferimenti al file di origine non sono supportati.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPathMap"> <source>The pathmap option was incorrectly formatted.</source> <target state="translated">Il formato dell'opzione pathmap non è corretto.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidReal"> <source>Invalid real literal.</source> <target state="translated">Il valore letterale reale non è valido.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCannotBeRefReturning"> <source>Auto-implemented properties cannot return by reference</source> <target state="translated">Le proprietà implementate automaticamente non possono essere restituite per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefPropertyMustHaveGetAccessor"> <source>Properties which return by reference must have a get accessor</source> <target state="translated">Le proprietà che vengono restituite per riferimento devono contenere una funzione di accesso get</target> <note /> </trans-unit> <trans-unit id="ERR_RefPropertyCannotHaveSetAccessor"> <source>Properties which return by reference cannot have set accessors</source> <target state="translated">Le proprietà che vengono restituite per riferimento non possono contenere funzioni di accesso set</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeRefReturnOnOverride"> <source>'{0}' must match by reference return of overridden member '{1}'</source> <target state="translated">'{0}' deve corrispondere per riferimento al valore restituito del membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_MustNotHaveRefReturn"> <source>By-reference returns may only be used in methods that return by reference</source> <target state="translated">I valori restituiti per riferimento possono essere usati solo in metodi che vengono restituiti per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_MustHaveRefReturn"> <source>By-value returns may only be used in methods that return by value</source> <target state="translated">I valori restituiti per valore possono essere usati solo in metodi che vengono restituiti per valore</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnMustHaveIdentityConversion"> <source>The return expression must be of type '{0}' because this method returns by reference</source> <target state="translated">L'espressione restituita deve essere di tipo '{0}' perché questo metodo viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberWrongRefReturn"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}' because it does not have matching return by reference.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare '{1}' perché non contiene il valore restituito corrispondente per riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturnRef"> <source>The body of '{0}' cannot be an iterator block because '{0}' returns by reference</source> <target state="translated">Il corpo di '{0}' non può essere un blocco iteratore perché '{0}' viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_BadRefReturnExpressionTree"> <source>Lambda expressions that return by reference cannot be converted to expression trees</source> <target state="translated">Non è possibile convertire in alberi delle espressioni le espressioni lambda che vengono restituite per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallInExpressionTree"> <source>An expression tree lambda may not contain a call to a method, property, or indexer that returns by reference</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere una chiamata a un metodo, a una proprietà o a un indicizzatore che viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnLvalueExpected"> <source>An expression cannot be used in this context because it may not be passed or returned by reference</source> <target state="translated">Non è possibile usare un'espressione in questo contesto perché non può essere passata o restituita per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnNonreturnableLocal"> <source>Cannot return '{0}' by reference because it was initialized to a value that cannot be returned by reference</source> <target state="translated">Non è possibile restituire '{0}' per riferimento perché è stato inizializzato con un valore che non può essere restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnNonreturnableLocal2"> <source>Cannot return by reference a member of '{0}' because it was initialized to a value that cannot be returned by reference</source> <target state="translated">Non è possibile restituire un membro di '{0}' per riferimento perché è stato inizializzato con un valore che non può essere restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyLocal"> <source>Cannot return '{0}' by reference because it is read-only</source> <target state="translated">Non è possibile restituire '{0}' per riferimento perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnRangeVariable"> <source>Cannot return the range variable '{0}' by reference</source> <target state="translated">Non è possibile restituire la variabile di intervallo '{0}' per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyLocalCause"> <source>Cannot return '{0}' by reference because it is a '{1}'</source> <target state="translated">Non è possibile restituire '{0}' per riferimento perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyLocal2Cause"> <source>Cannot return fields of '{0}' by reference because it is a '{1}'</source> <target state="translated">Non è possibile restituire i campi di '{0}' per riferimento perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonly"> <source>A readonly field cannot be returned by writable reference</source> <target state="translated">Un campo di sola lettura non può restituito per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyStatic"> <source>A static readonly field cannot be returned by writable reference</source> <target state="translated">Non è possibile restituire un campo di sola lettura statico per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonly2"> <source>Members of readonly field '{0}' cannot be returned by writable reference</source> <target state="translated">I membri del campo di sola lettura '{0}' non possono essere restituiti per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyStatic2"> <source>Fields of static readonly field '{0}' cannot be returned by writable reference</source> <target state="translated">Non è possibile restituire i campi del campo di sola lettura statico '{0}' per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnParameter"> <source>Cannot return a parameter by reference '{0}' because it is not a ref or out parameter</source> <target state="translated">Non è possibile restituire un parametro '{0}' per riferimento perché non è un parametro out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnParameter2"> <source>Cannot return by reference a member of parameter '{0}' because it is not a ref or out parameter</source> <target state="translated">Non è possibile restituire per riferimento un membro del parametro '{0}' perché non è un parametro ref o out</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnLocal"> <source>Cannot return local '{0}' by reference because it is not a ref local</source> <target state="translated">Non è possibile restituire la variabile locale '{0}' per riferimento perché non è una variabile locale ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnLocal2"> <source>Cannot return a member of local '{0}' by reference because it is not a ref local</source> <target state="translated">Non è possibile restituire un membro della variabile locale '{0}' per riferimento perché non è una variabile locale ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnStructThis"> <source>Struct members cannot return 'this' or other instance members by reference</source> <target state="translated">I membri struct non possono restituire 'this' o altri membri di istanza per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeOther"> <source>Expression cannot be used in this context because it may indirectly expose variables outside of their declaration scope</source> <target state="translated">Non è possibile usare l'espressione in questo contesto perché potrebbe esporre indirettamente variabili all'esterno del relativo ambito di dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeLocal"> <source>Cannot use local '{0}' in this context because it may expose referenced variables outside of their declaration scope</source> <target state="translated">Non è possibile usare la variabile locale '{0}' in questo contesto perché potrebbe esporre variabili di riferimento all'esterno del relativo ambito di dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeCall"> <source>Cannot use a result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope</source> <target state="translated">Non è possibile usare un risultato di '{0}' in questo contesto perché potrebbe esporre variabili cui viene fatto riferimento dal parametro '{1}' all'esterno dell'ambito della dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeCall2"> <source>Cannot use a member of result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope</source> <target state="translated">Non è possibile usare un membro del risultato di '{0}' in questo contesto perché potrebbe esporre variabili cui viene fatto riferimento dal parametro '{1}' all'esterno dell'ambito di dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_CallArgMixing"> <source>This combination of arguments to '{0}' is disallowed because it may expose variables referenced by parameter '{1}' outside of their declaration scope</source> <target state="translated">Questa combinazione di argomenti di '{0}' non è consentita perché potrebbe esporre variabili cui viene fatto riferimento dal parametro '{1}' all'esterno dell'ambito della dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_MismatchedRefEscapeInTernary"> <source>Branches of a ref conditional operator cannot refer to variables with incompatible declaration scopes</source> <target state="translated">I rami di un operatore condizionale ref non possono fare riferimento a variabili con ambiti di dichiarazione incompatibili</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeStackAlloc"> <source>A result of a stackalloc expression of type '{0}' cannot be used in this context because it may be exposed outside of the containing method</source> <target state="translated">Non è possibile usare un risultato di un'espressione a stackalloc di tipo '{0}' in questo contesto perché potrebbe essere esposta all'esterno del metodo che la contiene</target> <note /> </trans-unit> <trans-unit id="ERR_InitializeByValueVariableWithReference"> <source>Cannot initialize a by-value variable with a reference</source> <target state="translated">Non è possibile inizializzare una variabile per valore con un riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_InitializeByReferenceVariableWithValue"> <source>Cannot initialize a by-reference variable with a value</source> <target state="translated">Non è possibile inizializzare una variabile per riferimento con un valore</target> <note /> </trans-unit> <trans-unit id="ERR_RefAssignmentMustHaveIdentityConversion"> <source>The expression must be of type '{0}' because it is being assigned by reference</source> <target state="translated">L'espressione deve essere di tipo '{0}' perché verrà assegnata per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_ByReferenceVariableMustBeInitialized"> <source>A declaration of a by-reference variable must have an initializer</source> <target state="translated">Una dichiarazione di una variabile per riferimento deve contenere un inizializzatore</target> <note /> </trans-unit> <trans-unit id="ERR_AnonDelegateCantUseLocal"> <source>Cannot use ref local '{0}' inside an anonymous method, lambda expression, or query expression</source> <target state="translated">Non è possibile usare la variabile locale ref '{0}' in un metodo anonimo, in un'espressione lambda o in un'espressione di query</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorLocalType"> <source>Iterators cannot have by-reference locals</source> <target state="translated">Gli iteratori non possono includere variabili locali per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncLocalType"> <source>Async methods cannot have by-reference locals</source> <target state="translated">I metodi Async non possono includere variabili locali per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallAndAwait"> <source>'await' cannot be used in an expression containing a call to '{0}' because it returns by reference</source> <target state="translated">'Non è possibile usare 'await' in un'espressione che contiene una chiamata a '{0}' perché viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefConditionalAndAwait"> <source>'await' cannot be used in an expression containing a ref conditional operator</source> <target state="translated">'Non è possibile usare 'await' in un'espressione contenente un operatore condizionale ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefConditionalNeedsTwoRefs"> <source>Both conditional operator values must be ref values or neither may be a ref value</source> <target state="translated">Entrambi i valori dell'operatore condizionale devono essere valori ref, altrimenti nessuno potrà esserlo</target> <note /> </trans-unit> <trans-unit id="ERR_RefConditionalDifferentTypes"> <source>The expression must be of type '{0}' to match the alternative ref value</source> <target state="translated">L'espressione deve essere di tipo '{0}' per essere uguale al valore ref alternativo</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsLocalFunction"> <source>An expression tree may not contain a reference to a local function</source> <target state="translated">Un albero delle espressioni non può contenere un riferimento a una funzione locale</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicLocalFunctionParamsParameter"> <source>Cannot pass argument with dynamic type to params parameter '{0}' of local function '{1}'.</source> <target state="translated">Non è possibile passare l'argomento con tipo dinamico al parametro params '{0}' della funzione locale '{1}'.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeIsNotASubmission"> <source>Syntax tree should be created from a submission.</source> <target state="translated">L'albero della sintassi deve essere creato da un invio.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyUserStrings"> <source>Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string literals.</source> <target state="translated">La lunghezza combinata delle stringhe utente usate dal programma supera il limite consentito. Provare a ridurre l'uso di valori letterali stringa.</target> <note /> </trans-unit> <trans-unit id="ERR_PatternNullableType"> <source>It is not legal to use nullable type '{0}?' in a pattern; use the underlying type '{0}' instead.</source> <target state="translated">Non è consentito usare il tipo nullable '{0}?' in un criterio. Usare il tipo sottostante '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PeWritingFailure"> <source>An error occurred while writing the output file: {0}.</source> <target state="translated">Si è verificato un errore durante la scrittura del file di output: {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleDuplicateElementName"> <source>Tuple element names must be unique.</source> <target state="translated">I nomi di elementi di tupla devono essere univoci.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementName"> <source>Tuple element name '{0}' is only allowed at position {1}.</source> <target state="translated">Il nome di elemento di tupla '{0}' è consentito solo alla posizione {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementNameAnyPosition"> <source>Tuple element name '{0}' is disallowed at any position.</source> <target state="translated">Il nome di elemento di tupla '{0}' non è consentito in nessuna posizione.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedTypeMemberNotFoundInAssembly"> <source>Member '{0}' was not found on type '{1}' from assembly '{2}'.</source> <target state="translated">Il membro '{0}' non è stato trovato nel tipo '{1}' dell'assembly '{2}'.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTuples"> <source>tuples</source> <target state="translated">tuple</target> <note /> </trans-unit> <trans-unit id="ERR_MissingDeconstruct"> <source>No suitable 'Deconstruct' instance or extension method was found for type '{0}', with {1} out parameters and a void return type.</source> <target state="translated">Non sono stati trovati metodi di estensione o istanze di 'Deconstruct' idonee per il tipo '{0}', con {1} parametri out e un tipo restituito void.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructRequiresExpression"> <source>Deconstruct assignment requires an expression with a type on the right-hand-side.</source> <target state="translated">L'assegnazione di decostruzione richiede un'espressione con un tipo sul lato destro.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchExpressionValueExpected"> <source>The switch expression must be a value; found '{0}'.</source> <target state="translated">L'espressione switch deve essere un valore. È stato trovato '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PatternWrongType"> <source>An expression of type '{0}' cannot be handled by a pattern of type '{1}'.</source> <target state="translated">Un'espressione di tipo '{0}' non può essere gestita da un criterio di tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning"> <source>Attribute '{0}' is ignored when public signing is specified.</source> <target state="translated">L'attributo '{0}' viene ignorato quando si specifica la firma pubblica.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning_Title"> <source>Attribute is ignored when public signing is specified.</source> <target state="translated">L'attributo viene ignorato quando si specifica la firma pubblica.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionMustBeAbsolutePath"> <source>Option '{0}' must be an absolute path.</source> <target state="translated">L'opzione '{0}' deve essere un percorso assoluto.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionNotTupleCompatible"> <source>Tuple with {0} elements cannot be converted to type '{1}'.</source> <target state="translated">Non è possibile convertire la tupla con {0} elementi nel tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureOutVar"> <source>out variable declaration</source> <target state="translated">dichiarazione di variabile out</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList"> <source>Reference to an implicitly-typed out variable '{0}' is not permitted in the same argument list.</source> <target state="translated">Nello stesso elenco di argomenti non è consentito il riferimento a una variabile out tipizzata in modo implicito '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailedForImplicitlyTypedOutVariable"> <source>Cannot infer the type of implicitly-typed out variable '{0}'.</source> <target state="translated">Non è possibile dedurre il tipo della variabile out '{0}' tipizzata in modo implicito.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable"> <source>Cannot infer the type of implicitly-typed deconstruction variable '{0}'.</source> <target state="translated">Non è possibile dedurre il tipo della variabile di decostruzione '{0}' tipizzata in modo implicito.</target> <note /> </trans-unit> <trans-unit id="ERR_DiscardTypeInferenceFailed"> <source>Cannot infer the type of implicitly-typed discard.</source> <target state="translated">Non è possibile dedurre il tipo della variabile discard tipizzata in modo implicito.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructWrongCardinality"> <source>Cannot deconstruct a tuple of '{0}' elements into '{1}' variables.</source> <target state="translated">Non è possibile decostruire una tupla di '{0}' elementi in '{1}' variabili.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotDeconstructDynamic"> <source>Cannot deconstruct dynamic objects.</source> <target state="translated">Non è possibile decostruire oggetti dinamici.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructTooFewElements"> <source>Deconstruction must contain at least two variables.</source> <target state="translated">La decostruzione deve contenere almeno due variabili.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</source> <target state="translated">Il nome dell'elemento di tupla '{0}' viene ignorato perché nel tipo di destinazione '{1}' è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified by the assignment target.</source> <target state="translated">Il nome dell'elemento di tupla viene ignorato perché nella destinazione di assegnazione è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeMustBeStruct"> <source>Predefined type '{0}' must be a struct.</source> <target state="translated">Il tipo predefinito '{0}' deve essere uno struct.</target> <note /> </trans-unit> <trans-unit id="ERR_NewWithTupleTypeSyntax"> <source>'new' cannot be used with tuple type. Use a tuple literal expression instead.</source> <target state="translated">'Non è possibile usare 'new' con il tipo tupla. Usare un'espressione letterale di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructionVarFormDisallowsSpecificType"> <source>Deconstruction 'var (...)' form disallows a specific type for 'var'.</source> <target state="translated">Nel form di decostruzione 'var (...)' non è consentito un tipo specifico per 'var'.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesAttributeMissing"> <source>Cannot define a class or member that utilizes tuples because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Non è possibile definire una classe o un membro che usa tuple perché non è stato trovato il tipo '{0}' richiesto dal compilatore. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitTupleElementNamesAttribute"> <source>Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.</source> <target state="translated">Non è possibile fare riferimento a 'System.Runtime.CompilerServices.TupleElementNamesAttribute' in modo esplicito. Usare la sintassi della tupla per definire i nomi di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsOutVariable"> <source>An expression tree may not contain an out argument variable declaration.</source> <target state="translated">Un albero delle espressioni non può contenere una dichiarazione di variabile argomento out.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsDiscard"> <source>An expression tree may not contain a discard.</source> <target state="translated">Un albero delle espressioni non può contenere una funzionalità discard.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsIsMatch"> <source>An expression tree may not contain an 'is' pattern-matching operator.</source> <target state="translated">Un albero delle espressioni non può contenere un operatore dei criteri di ricerca 'is'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsTupleLiteral"> <source>An expression tree may not contain a tuple literal.</source> <target state="translated">Un albero delle espressioni non può contenere un valore letterale di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsTupleConversion"> <source>An expression tree may not contain a tuple conversion.</source> <target state="translated">Un albero delle espressioni non può contenere una conversione di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceLinkRequiresPdb"> <source>/sourcelink switch is only supported when emitting PDB.</source> <target state="translated">L'opzione /sourcelink è supportata solo quando si crea il file PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedWithoutPdb"> <source>/embed switch is only supported when emitting a PDB.</source> <target state="translated">L'opzione /embed è supportata solo quando si crea un file PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInstrumentationKind"> <source>Invalid instrumentation kind: {0}</source> <target state="translated">Il tipo di strumentazione non è valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_VarInvocationLvalueReserved"> <source>The syntax 'var (...)' as an lvalue is reserved.</source> <target state="translated">La sintassi 'var (...)' come lvalue è riservata.</target> <note /> </trans-unit> <trans-unit id="ERR_SemiOrLBraceOrArrowExpected"> <source>{ or ; or =&gt; expected</source> <target state="translated">È previsto { oppure ; o =&gt;</target> <note /> </trans-unit> <trans-unit id="ERR_ThrowMisplaced"> <source>A throw expression is not allowed in this context.</source> <target state="translated">Un'espressione throw non è consentita in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_DeclarationExpressionNotPermitted"> <source>A declaration is not allowed in this context.</source> <target state="translated">Una dichiarazione non è consentita in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_MustDeclareForeachIteration"> <source>A foreach loop must declare its iteration variables.</source> <target state="translated">Un ciclo foreach deve dichiarare le relative variabili di iterazione.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesInDeconstruction"> <source>Tuple element names are not permitted on the left of a deconstruction.</source> <target state="translated">Nella parte sinistra di una decostruzione non sono consentiti nomi di elemento di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_PossibleBadNegCast"> <source>To cast a negative value, you must enclose the value in parentheses.</source> <target state="translated">Per eseguire il cast di un valore negativo, è necessario racchiuderlo tra parentesi.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsThrowExpression"> <source>An expression tree may not contain a throw-expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione throw.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAssemblyName"> <source>Invalid assembly name: {0}</source> <target state="translated">Il nome di assembly {0} non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncMethodBuilderTaskProperty"> <source>For type '{0}' to be used as an AsyncMethodBuilder for type '{1}', its Task property should return type '{1}' instead of type '{2}'.</source> <target state="translated">La proprietà Task del tipo '{0}' da usare come elemento AsyncMethodBuilder per il tipo '{1}' deve restituire il tipo '{1}' invece di '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeForwardedToMultipleAssemblies"> <source>Module '{0}' in assembly '{1}' is forwarding the type '{2}' to multiple assemblies: '{3}' and '{4}'.</source> <target state="translated">Il modulo '{0}' nell'assembly '{1}' inoltra il tipo '{2}' a più assembly '{3}' e '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PatternDynamicType"> <source>It is not legal to use the type 'dynamic' in a pattern.</source> <target state="translated">Non è consentito usare il tipo 'dynamic' in un criterio.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDocumentationMode"> <source>Provided documentation mode is unsupported or invalid: '{0}'.</source> <target state="translated">La modalità di documentazione specificata non è supportata o non è valida: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSourceCodeKind"> <source>Provided source code kind is unsupported or invalid: '{0}'</source> <target state="translated">Il tipo del codice sorgente specificato non è supportato o non è valido: '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadLanguageVersion"> <source>Provided language version is unsupported or invalid: '{0}'.</source> <target state="translated">La versione del linguaggio specificata non è supportata o non è valida: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocessingSymbol"> <source>Invalid name for a preprocessing symbol; '{0}' is not a valid identifier</source> <target state="translated">Nome non valido per un simbolo di pre-elaborazione. '{0}' non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7_1"> <source>Feature '{0}' is not available in C# 7.1. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 7.1. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7_2"> <source>Feature '{0}' is not available in C# 7.2. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 7.2. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersionCannotHaveLeadingZeroes"> <source>Specified language version '{0}' cannot have leading zeroes</source> <target state="translated">La versione specificata '{0}' del linguaggio non può contenere zeri iniziali</target> <note /> </trans-unit> <trans-unit id="ERR_VoidAssignment"> <source>A value of type 'void' may not be assigned.</source> <target state="translated">Non è possibile assegnare un valore di tipo 'void'.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental"> <source>'{0}' is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">'{0}' viene usato solo a scopo di valutazione e potrebbe essere modificato o rimosso in aggiornamenti futuri.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental_Title"> <source>Type is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">Type viene usato solo a scopo di valutazione e potrebbe essere modificato o rimosso in aggiornamenti futuri.</target> <note /> </trans-unit> <trans-unit id="ERR_CompilerAndLanguageVersion"> <source>Compiler version: '{0}'. Language version: {1}.</source> <target state="translated">Versione del compilatore: '{0}'. Versione del linguaggio: {1}.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsyncMain"> <source>async main</source> <target state="translated">principale asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_TupleInferredNamesNotAvailable"> <source>Tuple element name '{0}' is inferred. Please use language version {1} or greater to access an element by its inferred name.</source> <target state="translated">Il nome '{0}' dell'elemento di tupla è dedotto. Usare la versione {1} o una versione successiva del linguaggio per accedere a un elemento in base al relativo nome dedotto.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidInTuple"> <source>A tuple may not contain a value of type 'void'.</source> <target state="translated">Una tupla non può contenere un valore di tipo 'void'.</target> <note /> </trans-unit> <trans-unit id="ERR_NonTaskMainCantBeAsync"> <source>A void or int returning entry point cannot be async</source> <target state="translated">Un punto di ingresso che restituisce void o int non può essere asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_PatternWrongGenericTypeInVersion"> <source>An expression of type '{0}' cannot be handled by a pattern of type '{1}' in C# {2}. Please use language version {3} or greater.</source> <target state="translated">Un'espressione di tipo '{0}' non può essere gestita da un criterio di tipo '{1}' in C# {2}. Usare la versione {3} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLocalFunction"> <source>The local function '{0}' is declared but never used</source> <target state="translated">La funzione locale '{0}' è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLocalFunction_Title"> <source>Local function is declared but never used</source> <target state="translated">La funzione locale è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="ERR_LocalFunctionMissingBody"> <source>Local function '{0}' must declare a body because it is not marked 'static extern'.</source> <target state="translated">La funzione locale '{0}' deve dichiarare un corpo perché non è contrassegnata come 'static extern'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInfo"> <source>Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}'</source> <target state="translated">Non è possibile leggere le informazione di debug del metodo '{0}' (token 0x{1:X8}) dall'assembly '{2}'</target> <note /> </trans-unit> <trans-unit id="IConversionExpressionIsNotCSharpConversion"> <source>{0} is not a valid C# conversion expression</source> <target state="translated">{0} non è un'espressione di conversione C# valida</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicLocalFunctionTypeParameter"> <source>Cannot pass argument with dynamic type to generic local function '{0}' with inferred type arguments.</source> <target state="translated">Non è possibile passare l'argomento di tipo dinamico alla funzione locale generica '{0}' con argomenti di tipo dedotti.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLeadingDigitSeparator"> <source>leading digit separator</source> <target state="translated">separatore di cifra iniziale</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitReservedAttr"> <source>Do not use '{0}'. This is reserved for compiler usage.</source> <target state="translated">Non usare '{0}' perché è riservato al compilatore.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeReserved"> <source>The type name '{0}' is reserved to be used by the compiler.</source> <target state="translated">Il nome di tipo '{0}' è riservato al compilatore.</target> <note /> </trans-unit> <trans-unit id="ERR_InExtensionMustBeValueType"> <source>The first parameter of the 'in' extension method '{0}' must be a concrete (non-generic) value type.</source> <target state="translated">Il primo parametro del metodo di estensione 'in' '{0}' deve essere un tipo valore concreto (non generico).</target> <note /> </trans-unit> <trans-unit id="ERR_FieldsInRoStruct"> <source>Instance fields of readonly structs must be readonly.</source> <target state="translated">I campi di istanza di struct di sola lettura devono essere di sola lettura.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropsInRoStruct"> <source>Auto-implemented instance properties in readonly structs must be readonly.</source> <target state="translated">Tutte le proprietà di istanza implementate automaticamente in struct di sola lettura devono essere di sola lettura.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldlikeEventsInRoStruct"> <source>Field-like events are not allowed in readonly structs.</source> <target state="translated">Nelle struct di sola lettura non sono consentiti eventi simili a campi.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefExtensionMethods"> <source>ref extension methods</source> <target state="translated">metodi di estensione ref</target> <note /> </trans-unit> <trans-unit id="ERR_StackAllocConversionNotPossible"> <source>Conversion of a stackalloc expression of type '{0}' to type '{1}' is not possible.</source> <target state="translated">Non è possibile eseguire la conversione di un'espressione stackalloc di tipo '{0}' nel tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RefExtensionMustBeValueTypeOrConstrainedToOne"> <source>The first parameter of a 'ref' extension method '{0}' must be a value type or a generic type constrained to struct.</source> <target state="translated">Il primo parametro di un metodo di estensione 'ref' '{0}' deve essere un tipo valore o un tipo generico vincolato a struct.</target> <note /> </trans-unit> <trans-unit id="ERR_OutAttrOnInParam"> <source>An in parameter cannot have the Out attribute.</source> <target state="translated">Un parametro in non può avere l'attributo Out.</target> <note /> </trans-unit> <trans-unit id="ICompoundAssignmentOperationIsNotCSharpCompoundAssignment"> <source>{0} is not a valid C# compound assignment operation</source> <target state="translated">{0} non è un'operazione valida di assegnazione composta C#</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalse"> <source>Filter expression is a constant 'false', consider removing the catch clause</source> <target state="translated">L'espressione di filtro è una costante 'false'. Provare a rimuovere la clausola catch</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalse_Title"> <source>Filter expression is a constant 'false'</source> <target state="translated">L'espressione di filtro è una costante 'false'</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalseRedundantTryCatch"> <source>Filter expression is a constant 'false', consider removing the try-catch block</source> <target state="translated">L'espressione di filtro è una costante 'false'. Provare a rimuovere il blocco try-catch</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalseRedundantTryCatch_Title"> <source>Filter expression is a constant 'false'. </source> <target state="translated">L'espressione di filtro è una costante 'false'. </target> <note /> </trans-unit> <trans-unit id="ERR_CantUseVoidInArglist"> <source>__arglist cannot have an argument of void type</source> <target state="translated">__arglist non può contenere un argomento di tipo void</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalInInterpolation"> <source>A conditional expression cannot be used directly in a string interpolation because the ':' ends the interpolation. Parenthesize the conditional expression.</source> <target state="translated">Non è possibile usare un'espressione condizionale in un'interpolazione di stringa perché l'interpolazione termina con ':'. Racchiudere tra parentesi l'espressione condizionale.</target> <note /> </trans-unit> <trans-unit id="ERR_DoNotUseFixedBufferAttrOnProperty"> <source>Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property</source> <target state="translated">Non usare l'attributo 'System.Runtime.CompilerServices.FixedBuffer' su una proprietà</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7_3"> <source>Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 7.3. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributesOnBackingFieldsNotAvailable"> <source>Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater.</source> <target state="translated">Gli attributi destinati a campi su proprietà automatiche non sono supportati nella versione {0} del linguaggio. Usare la versione {1} o superiore.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributesOnBackingFieldsNotAvailable_Title"> <source>Field-targeted attributes on auto-properties are not supported in this version of the language.</source> <target state="translated">Gli attributi destinati a campi su proprietà automatiche non sono supportati in questa versione del linguaggio.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsyncStreams"> <source>async streams</source> <target state="translated">flussi asincroni</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIAsyncDisp"> <source>'{0}': type used in an asynchronous using statement must be implicitly convertible to 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method.</source> <target state="translated">'{0}': il tipo usato in un'istruzione using asincrona deve essere convertibile in modo implicito in 'System.IAsyncDisposable' o implementare un metodo 'DisposeAsync' adatto.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetAsyncEnumerator"> <source>Asynchronous foreach requires that the return type '{0}' of '{1}' must have a suitable public 'MoveNextAsync' method and public 'Current' property</source> <target state="translated">Con l'istruzione foreach asincrona il tipo restituito '{0}' di '{1}' deve essere associato a un metodo 'MoveNextAsync' pubblico e a una proprietà 'Current' pubblica appropriati</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleIAsyncEnumOfT"> <source>Asynchronous foreach statement cannot operate on variables of type '{0}' because it implements multiple instantiations of '{1}'; try casting to a specific interface instantiation</source> <target state="translated">L'istruzione foreach asincrona non può funzionare con variabili di tipo '{0}' perché implementa più creazioni di un'istanza di '{1}'. Provare a eseguire il cast su una creazione di un'istanza di interfaccia specifica</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacesCantContainConversionOrEqualityOperators"> <source>Conversion, equality, or inequality operators declared in interfaces must be abstract</source> <target state="needs-review-translation">Le interfacce non possono contenere operatori di conversione, uguaglianza o disuguaglianza</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation"> <source>Target runtime doesn't support default interface implementation.</source> <target state="translated">Il runtime di destinazione non supporta l'implementazione di interfaccia predefinita.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementationForMember"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support default interface implementation.</source> <target state="translated">'{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}' perché il runtime di destinazione non supporta l'implementazione di interfaccia predefinita.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitImplementationOfNonPublicInterfaceMember"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement a non-public member in C# {3}. Please use language version '{4}' or greater.</source> <target state="new">'{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement a non-public member in C# {3}. Please use language version '{4}' or greater.</target> <note /> </trans-unit> <trans-unit id="ERR_MostSpecificImplementationIsNotFound"> <source>Interface member '{0}' does not have a most specific implementation. Neither '{1}', nor '{2}' are most specific.</source> <target state="translated">Il membro di interfaccia '{0}' non contiene un'implementazione più specifica. Né '{1}' né '{2}' sono più specifiche.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersionDoesNotSupportDefaultInterfaceImplementationForMember"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because feature '{3}' is not available in C# {4}. Please use language version '{5}' or greater.</source> <target state="translated">'{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}' perché la funzionalità '{3}' non è disponibile in C# {4}. Usare la versione '{5}' o versioni successive del linguaggio.</target> <note /> </trans-unit> </body> </file> </xliff>
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="it" original="../CSharpResources.resx"> <body> <trans-unit id="CallingConventionTypeIsInvalid"> <source>Cannot use '{0}' as a calling convention modifier.</source> <target state="translated">Non è possibile usare '{0}' come modificatore di convenzione di chiamata.</target> <note /> </trans-unit> <trans-unit id="CallingConventionTypesRequireUnmanaged"> <source>Passing '{0}' is not valid unless '{1}' is 'SignatureCallingConvention.Unmanaged'.</source> <target state="translated">Non è possibile '{0}' a meno che '{1}' non sia 'SignatureCallingConvention.Unmanaged'.</target> <note /> </trans-unit> <trans-unit id="CannotCreateConstructedFromConstructed"> <source>Cannot create constructed generic type from another constructed generic type.</source> <target state="translated">Non è possibile creare un tipo generico costruito a partire da un altro tipo generico costruito.</target> <note /> </trans-unit> <trans-unit id="CannotCreateConstructedFromNongeneric"> <source>Cannot create constructed generic type from non-generic type.</source> <target state="translated">Non è possibile creare un tipo generico costruito a partire da un tipo non generico.</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractConversionNotInvolvingContainedType"> <source>User-defined conversion in an interface must convert to or from a type parameter on the enclosing type constrained to the enclosing type</source> <target state="new">User-defined conversion in an interface must convert to or from a type parameter on the enclosing type constrained to the enclosing type</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractEventHasAccessors"> <source>'{0}': abstract event cannot use event accessor syntax</source> <target state="translated">'{0}': l'evento astratto non può usare la sintassi della funzione di accesso agli eventi</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfMethodGroupInExpressionTree"> <source>'&amp;' on method groups cannot be used in expression trees</source> <target state="translated">Non è possibile usare '&amp;' su gruppi di metodi in alberi delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfToNonFunctionPointer"> <source>Cannot convert &amp;method group '{0}' to non-function pointer type '{1}'.</source> <target state="translated">Non è possibile convertire il gruppo di &amp;metodi '{0}' nel tipo di puntatore non a funzione '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AltInterpolatedVerbatimStringsNotAvailable"> <source>To use '@$' instead of '$@' for an interpolated verbatim string, please use language version '{0}' or greater.</source> <target state="translated">Per usare '@$' invece di '$@' per una stringa verbatim interpolata, usare la versione '{0}' o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigBinaryOpsOnDefault"> <source>Operator '{0}' is ambiguous on operands '{1}' and '{2}'</source> <target state="translated">L'operatore '{0}' è ambiguo sugli operandi '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigBinaryOpsOnUnconstrainedDefault"> <source>Operator '{0}' cannot be applied to 'default' and operand of type '{1}' because it is a type parameter that is not known to be a reference type</source> <target state="translated">Non è possibile applicare l'operatore '{0}' a 'default ' e all'operando di tipo '{1}' perché è un parametro di tipo non noto come tipo riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_AnnotationDisallowedInObjectCreation"> <source>Cannot use a nullable reference type in object creation.</source> <target state="translated">Non è possibile usare un tipo riferimento nullable durante la creazione di oggetti.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNameInITuplePattern"> <source>Element names are not permitted when pattern-matching via 'System.Runtime.CompilerServices.ITuple'.</source> <target state="translated">I nomi di elemento non sono consentiti quando si definiscono criteri di ricerca tramite 'System.Runtime.CompilerServices.ITuple'.</target> <note /> </trans-unit> <trans-unit id="ERR_AsNullableType"> <source>It is not legal to use nullable reference type '{0}?' in an as expression; use the underlying type '{0}' instead.</source> <target state="translated">Non è consentito usare il tipo riferimento nullable '{0}?' in un'espressione as. Usare il tipo sottostante '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AssignmentInitOnly"> <source>Init-only property or indexer '{0}' can only be assigned in an object initializer, or on 'this' or 'base' in an instance constructor or an 'init' accessor.</source> <target state="translated">L'indicizzatore o la proprietà di sola inizializzazione '{0}' può essere assegnata solo in un inizializzatore di oggetto oppure in 'this' o 'base' in un costruttore di istanza o una funzione di accesso 'init'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrDependentTypeNotAllowed"> <source>Type '{0}' cannot be used in this context because it cannot be represented in metadata.</source> <target state="new">Type '{0}' cannot be used in this context because it cannot be represented in metadata.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrTypeArgCannotBeTypeVar"> <source>'{0}': an attribute type argument cannot use type parameters</source> <target state="new">'{0}': an attribute type argument cannot use type parameters</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeNotOnEventAccessor"> <source>Attribute '{0}' is not valid on event accessors. It is only valid on '{1}' declarations.</source> <target state="translated">L'attributo '{0}' non è valido nelle funzioni di accesso a eventi. È valido solo nelle dichiarazioni di '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributesRequireParenthesizedLambdaExpression"> <source>Attributes on lambda expressions require a parenthesized parameter list.</source> <target state="new">Attributes on lambda expressions require a parenthesized parameter list.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyWithSetterCantBeReadOnly"> <source>Auto-implemented property '{0}' cannot be marked 'readonly' because it has a 'set' accessor.</source> <target state="translated">La proprietà implementata automaticamente '{0}' non può essere contrassegnata come 'readonly' perché include una funzione di accesso 'set'.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoSetterCantBeReadOnly"> <source>Auto-implemented 'set' accessor '{0}' cannot be marked 'readonly'.</source> <target state="translated">La funzione di accesso 'set' '{0}' implementata automaticamente non può essere contrassegnata come 'readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_AwaitForEachMissingMember"> <source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a suitable public instance or extension definition for '{1}'</source> <target state="translated">L'istruzione foreach asincrona non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica idonea per '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AwaitForEachMissingMemberWrongAsync"> <source>Asynchronous foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'. Did you mean 'foreach' rather than 'await foreach'?</source> <target state="translated">L'istruzione foreach asincrona non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica per '{1}'. Si intendeva 'foreach' invece di 'await foreach'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractBinaryOperatorSignature"> <source>One of the parameters of a binary operator must be the containing type, or its type parameter constrained to it.</source> <target state="new">One of the parameters of a binary operator must be the containing type, or its type parameter constrained to it.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractIncDecRetType"> <source>The return type for ++ or -- operator must either match the parameter type, or be derived from the parameter type, or be the containing type's type parameter constrained to it unless the parameter type is a different type parameter.</source> <target state="new">The return type for ++ or -- operator must either match the parameter type, or be derived from the parameter type, or be the containing type's type parameter constrained to it unless the parameter type is a different type parameter.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractIncDecSignature"> <source>The parameter type for ++ or -- operator must be the containing type, or its type parameter constrained to it.</source> <target state="new">The parameter type for ++ or -- operator must be the containing type, or its type parameter constrained to it.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractShiftOperatorSignature"> <source>The first operand of an overloaded shift operator must have the same type as the containing type or its type parameter constrained to it, and the type of the second operand must be int</source> <target state="new">The first operand of an overloaded shift operator must have the same type as the containing type or its type parameter constrained to it, and the type of the second operand must be int</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractStaticMemberAccess"> <source>A static abstract interface member can be accessed only on a type parameter.</source> <target state="new">A static abstract interface member can be accessed only on a type parameter.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAbstractUnaryOperatorSignature"> <source>The parameter of a unary operator must be the containing type, or its type parameter constrained to it.</source> <target state="new">The parameter of a unary operator must be the containing type, or its type parameter constrained to it.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerArgumentExpressionParamWithoutDefaultValue"> <source>The CallerArgumentExpressionAttribute may only be applied to parameters with default values</source> <target state="new">The CallerArgumentExpressionAttribute may only be applied to parameters with default values</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicAwaitForEach"> <source>Cannot use a collection of dynamic type in an asynchronous foreach</source> <target state="translated">Non è possibile usare una raccolta di tipo dinamico in un'istruzione foreach asincrona</target> <note /> </trans-unit> <trans-unit id="ERR_BadFieldTypeInRecord"> <source>The type '{0}' may not be used for a field of a record.</source> <target state="translated">Il tipo '{0}' non può essere usato per un campo di un record.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFuncPointerArgCount"> <source>Function pointer '{0}' does not take {1} arguments</source> <target state="translated">Il puntatore a funzione '{0}' non accetta {1} argomenti</target> <note /> </trans-unit> <trans-unit id="ERR_BadFuncPointerParamModifier"> <source>'{0}' cannot be used as a modifier on a function pointer parameter.</source> <target state="translated">Non è possibile usare '{0}' come modificatore in un parametro di puntatore a funzione.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInheritanceFromRecord"> <source>Only records may inherit from records.</source> <target state="translated">Solo i record possono ereditare dai record.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInitAccessor"> <source>The 'init' accessor is not valid on static members</source> <target state="translated">La funzione di accesso 'init' non è valida nei membri statici</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullableContextOption"> <source>Invalid option '{0}' for /nullable; must be 'disable', 'enable', 'warnings' or 'annotations'</source> <target state="translated">L'opzione '{0}' non è valida per /nullable. Deve essere 'disable', 'enable', 'warnings' o 'annotations'</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullableTypeof"> <source>The typeof operator cannot be used on a nullable reference type</source> <target state="translated">Non è possibile usare l'operatore typeof nel tipo riferimento nullable</target> <note /> </trans-unit> <trans-unit id="ERR_BadOpOnNullOrDefaultOrNew"> <source>Operator '{0}' cannot be applied to operand '{1}'</source> <target state="translated">Non è possibile applicare l'operatore '{0}' all'operando '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadPatternExpression"> <source>Invalid operand for pattern match; value required, but found '{0}'.</source> <target state="translated">L'operando non è valido per i criteri di ricerca. È richiesto un valore ma è stato trovato '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordBase"> <source>Records may only inherit from object or another record</source> <target state="translated">I record possono ereditare solo dall'oggetto o da un altro record</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordMemberForPositionalParameter"> <source>Record member '{0}' must be a readable instance property or field of type '{1}' to match positional parameter '{2}'.</source> <target state="needs-review-translation">Il membro di record '{0}' deve essere una proprietà di istanza leggibile di tipo '{1}' per corrispondere al parametro posizionale '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitchValue"> <source>Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'.</source> <target state="translated">Errore di sintassi della riga di comando: '{0}' non è un valore valido per l'opzione '{1}'. Il valore deve essere espresso nel formato '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BuilderAttributeDisallowed"> <source>The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.</source> <target state="new">The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotClone"> <source>The receiver type '{0}' is not a valid record type and is not a struct type.</source> <target state="new">The receiver type '{0}' is not a valid record type and is not a struct type.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotConvertAddressOfToDelegate"> <source>Cannot convert &amp;method group '{0}' to delegate type '{0}'.</source> <target state="translated">Non è possibile convertire il gruppo di &amp;metodi '{0}' nel tipo delegato '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotInferDelegateType"> <source>The delegate type could not be inferred.</source> <target state="new">The delegate type could not be inferred.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotSpecifyManagedWithUnmanagedSpecifiers"> <source>'managed' calling convention cannot be combined with unmanaged calling convention specifiers.</source> <target state="translated">Non è possibile combinare la convenzione di chiamata 'managed' con identificatori di convenzione di chiamata non gestita.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseFunctionPointerAsFixedLocal"> <source>The type of a local declared in a fixed statement cannot be a function pointer type.</source> <target state="translated">Il tipo di una variabile locale dichiarata in un'istruzione fixed non può essere un tipo di puntatore a funzione.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseManagedTypeInUnmanagedCallersOnly"> <source>Cannot use '{0}' as a {1} type on a method attributed with 'UnmanagedCallersOnly'.</source> <target state="translated">Non è possibile usare '{0}' come tipo {1} in un metodo con attributo 'UnmanagedCallersOnly'.</target> <note>1 is the localized word for 'parameter' or 'return'. UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_CannotUseReducedExtensionMethodInAddressOf"> <source>Cannot use an extension method with a receiver as the target of a '&amp;' operator.</source> <target state="translated">Non è possibile usare un metodo di estensione con un ricevitore come destinazione di un operatore '&amp;'.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseSelfAsInterpolatedStringHandlerArgument"> <source>InterpolatedStringHandlerArgumentAttribute arguments cannot refer to the parameter the attribute is used on.</source> <target state="new">InterpolatedStringHandlerArgumentAttribute arguments cannot refer to the parameter the attribute is used on.</target> <note>InterpolatedStringHandlerArgumentAttribute is a type name and should not be translated.</note> </trans-unit> <trans-unit id="ERR_CantChangeInitOnlyOnOverride"> <source>'{0}' must match by init-only of overridden member '{1}'</source> <target state="translated">'{0}' deve corrispondere per sola inizializzazione del membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethReturnType"> <source>Cannot convert {0} to type '{1}' because the return type does not match the delegate return type</source> <target state="new">Cannot convert {0} to type '{1}' because the return type does not match the delegate return type</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseInOrOutInArglist"> <source>__arglist cannot have an argument passed by 'in' or 'out'</source> <target state="translated">__arglist non può contenere un argomento passato da 'in' o 'out'</target> <note /> </trans-unit> <trans-unit id="ERR_CloneDisallowedInRecord"> <source>Members named 'Clone' are disallowed in records.</source> <target state="translated">Nei record non sono consentiti membri denominati 'Clone'.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberNotStatic"> <source>'{0}' does not implement static interface member '{1}'. '{2}' cannot implement the interface member because it is not static.</source> <target state="new">'{0}' does not implement static interface member '{1}'. '{2}' cannot implement the interface member because it is not static.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberWrongInitOnly"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}'.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConWithUnmanagedCon"> <source>Type parameter '{1}' has the 'unmanaged' constraint so '{1}' cannot be used as a constraint for '{0}'</source> <target state="translated">Il parametro di tipo '{1}' ha il vincolo 'managed'. Non è quindi possibile usare '{1}' come vincolo per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnLocalFunction"> <source>Local function '{0}' must be 'static' in order to use the Conditional attribute</source> <target state="translated">Per usare l'attributo Conditional, la funzione locale '{0}' deve essere 'static'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantPatternVsOpenType"> <source>An expression of type '{0}' cannot be handled by a pattern of type '{1}'. Please use language version '{2}' or greater to match an open type with a constant pattern.</source> <target state="translated">Un'espressione di tipo '{0}' non può essere gestita da un criterio di tipo '{1}'. Usare la versione '{2}' o versioni successive del linguaggio per abbinare un tipo aperto a un criterio costante.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyConstructorMustInvokeBaseCopyConstructor"> <source>A copy constructor in a record must call a copy constructor of the base, or a parameterless object constructor if the record inherits from object.</source> <target state="translated">Un costruttore di copia in un record deve chiamare un costruttore di copia della base o un costruttore di oggetto senza parametri se il record eredita dall'oggetto.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyConstructorWrongAccessibility"> <source>A copy constructor '{0}' must be public or protected because the record is not sealed.</source> <target state="translated">Un costruttore di copia '{0}' deve essere pubblico o protetto perché il record non è sealed.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructParameterNameMismatch"> <source>The name '{0}' does not match the corresponding 'Deconstruct' parameter '{1}'.</source> <target state="translated">Il nome '{0}' non corrisponde al parametro '{1}' di 'Deconstruct' corrispondente.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultConstraintOverrideOnly"> <source>The 'default' constraint is valid on override and explicit interface implementation methods only.</source> <target state="translated">Il vincolo 'default' è valido solo in metodi di override e di implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultInterfaceImplementationInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché contiene un membro non astratto. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultLiteralNoTargetType"> <source>There is no target type for the default literal.</source> <target state="translated">Non esiste alcun tipo di destinazione per il valore letterale predefinito.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPattern"> <source>A default literal 'default' is not valid as a pattern. Use another literal (e.g. '0' or 'null') as appropriate. To match everything, use a discard pattern '_'.</source> <target state="translated">Non è possibile usare un valore letterale predefinito 'default' come criterio. Usare un altro valore letterale, ad esempio '0' o 'null'. Per abbinare tutto, usare un criterio di rimozione '_'.</target> <note /> </trans-unit> <trans-unit id="ERR_DesignatorBeneathPatternCombinator"> <source>A variable may not be declared within a 'not' or 'or' pattern.</source> <target state="translated">Non è possibile dichiarare una variabile all'interno di un criterio 'not' o 'or'.</target> <note /> </trans-unit> <trans-unit id="ERR_DiscardPatternInSwitchStatement"> <source>The discard pattern is not permitted as a case label in a switch statement. Use 'case var _:' for a discard pattern, or 'case @_:' for a constant named '_'.</source> <target state="translated">Il criterio di rimozione non è consentito come etichetta case in un'istruzione switch. Usare 'case var _:' per un criterio di rimozione oppure 'case @_:' per una costante denominata '_'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesNotOverrideBaseEqualityContract"> <source>'{0}' does not override expected property from '{1}'.</source> <target state="translated">'{0}' non esegue l'override della proprietà prevista da '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesNotOverrideBaseMethod"> <source>'{0}' does not override expected method from '{1}'.</source> <target state="translated">'{0}' non esegue l'override del metodo previsto da '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesNotOverrideMethodFromObject"> <source>'{0}' does not override expected method from 'object'.</source> <target state="translated">'{0}' non esegue l'override del metodo previsto da 'object'.</target> <note /> </trans-unit> <trans-unit id="ERR_DupReturnTypeMod"> <source>A return type can only have one '{0}' modifier.</source> <target state="translated">Un tipo restituito può avere un solo modificatore '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateExplicitImpl"> <source>'{0}' is explicitly implemented more than once.</source> <target state="translated">'{0}' è implementato più di una volta in modo esplicito.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInterfaceWithDifferencesInBaseList"> <source>'{0}' is already listed in the interface list on type '{2}' as '{1}'.</source> <target state="translated">'{0}' è già incluso nell'elenco di interfacce nel tipo '{2}' come '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNullSuppression"> <source>Duplicate null suppression operator ('!')</source> <target state="translated">Operatore di eliminazione Null duplicato ('!')</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyReadOnlyMods"> <source>Cannot specify 'readonly' modifiers on both accessors of property or indexer '{0}'. Instead, put a 'readonly' modifier on the property itself.</source> <target state="translated">Non è possibile specificare i modificatori 'readonly' in entrambe le funzioni di accesso della proprietà o dell'indicizzatore '{0}'. Inserire invece un modificatore 'readonly' nella proprietà stessa.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseCannotStartStatement"> <source>'else' cannot start a statement.</source> <target state="translated">Un'istruzione non può iniziare con 'else'.</target> <note /> </trans-unit> <trans-unit id="ERR_EntryPointCannotBeUnmanagedCallersOnly"> <source>Application entry points cannot be attributed with 'UnmanagedCallersOnly'.</source> <target state="translated">Non è possibile aggiungere ai punti di ingresso dell'applicazione l'attributo 'UnmanagedCallersOnly'.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_EqualityContractRequiresGetter"> <source>Record equality contract property '{0}' must have a get accessor.</source> <target state="translated">La proprietà '{0}' del contratto di uguaglianza record deve contenere una funzione di accesso get.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitImplementationOfOperatorsMustBeStatic"> <source>Explicit implementation of a user-defined operator '{0}' must be declared static</source> <target state="new">Explicit implementation of a user-defined operator '{0}' must be declared static</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitNullableAttribute"> <source>Explicit application of 'System.Runtime.CompilerServices.NullableAttribute' is not allowed.</source> <target state="translated">L'applicazione esplicita di 'System.Runtime.CompilerServices.NullableAttribute' non è consentita.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitPropertyMismatchInitOnly"> <source>Accessors '{0}' and '{1}' should both be init-only or neither</source> <target state="translated">Il tipo di sola inizializzazione può essere specificato per entrambe le funzioni di accesso '{0}' e '{1}' o per nessuna di esse</target> <note /> </trans-unit> <trans-unit id="ERR_ExprCannotBeFixed"> <source>The given expression cannot be used in a fixed statement</source> <target state="translated">Non è possibile usare l'espressione specificata in un'istruzione fixed</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeCantContainNullCoalescingAssignment"> <source>An expression tree may not contain a null coalescing assignment</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione Null di coalescenza</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeCantContainRefStruct"> <source>Expression tree cannot contain value of ref struct or restricted type '{0}'.</source> <target state="translated">L'albero delle espressioni non può contenere il valore '{0}' per lo struct ref o il tipo limitato.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsAbstractStaticMemberAccess"> <source>An expression tree may not contain an access of static abstract interface member</source> <target state="new">An expression tree may not contain an access of static abstract interface member</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression"> <source>An expression tree may not contain a from-end index ('^') expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione di indice from end ('^').</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsInterpolatedStringHandlerConversion"> <source>An expression tree may not contain an interpolated string handler conversion.</source> <target state="new">An expression tree may not contain an interpolated string handler conversion.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer"> <source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source> <target state="translated">Un albero delle espressioni non può contenere un accesso a indicizzatore System.Index o System.Range di criterio</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsRangeExpression"> <source>An expression tree may not contain a range ('..') expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione ('..').</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsSwitchExpression"> <source>An expression tree may not contain a switch expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione switch.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsTupleBinOp"> <source>An expression tree may not contain a tuple == or != operator</source> <target state="translated">Un albero delle espressioni non può contenere un operatore == o != di tupla</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsWithExpression"> <source>An expression tree may not contain a with-expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione with.</target> <note /> </trans-unit> <trans-unit id="ERR_ExternEventInitializer"> <source>'{0}': extern event cannot have initializer</source> <target state="translated">'{0}': l'evento extern non può avere inizializzatori</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureInPreview"> <source>The feature '{0}' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.</source> <target state="translated">La funzionalità '{0}' è attualmente disponibile in anteprima e *non è supportata*. Per usare funzionalità in anteprima, scegliere la versione del linguaggio 'preview'.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureIsExperimental"> <source>Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable.</source> <target state="translated">La funzionalità '{0}' è sperimentale e non è supportata. Per abilitare, usare '/features:{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion10"> <source>Feature '{0}' is not available in C# 10.0. Please use language version {1} or greater.</source> <target state="new">Feature '{0}' is not available in C# 10.0. Please use language version {1} or greater.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion8"> <source>Feature '{0}' is not available in C# 8.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 8.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion8_0"> <source>Feature '{0}' is not available in C# 8.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 8.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion9"> <source>Feature '{0}' is not available in C# 9.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 9.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldLikeEventCantBeReadOnly"> <source>Field-like event '{0}' cannot be 'readonly'.</source> <target state="translated">L'evento simile a campo '{0}' non può essere 'readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_FileScopedAndNormalNamespace"> <source>Source file can not contain both file-scoped and normal namespace declarations.</source> <target state="new">Source file can not contain both file-scoped and normal namespace declarations.</target> <note /> </trans-unit> <trans-unit id="ERR_FileScopedNamespaceNotBeforeAllMembers"> <source>File-scoped namespace must precede all other members in a file.</source> <target state="new">File-scoped namespace must precede all other members in a file.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachMissingMemberWrongAsync"> <source>foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'. Did you mean 'await foreach' rather than 'foreach'?</source> <target state="translated">L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica per '{1}'. Si intendeva 'await foreach' invece di 'foreach'?</target> <note /> </trans-unit> <trans-unit id="ERR_FuncPtrMethMustBeStatic"> <source>Cannot create a function pointer for '{0}' because it is not a static method</source> <target state="translated">Non è possibile creare un puntatore a funzione per '{0}' perché non è un metodo statico</target> <note /> </trans-unit> <trans-unit id="ERR_FuncPtrRefMismatch"> <source>Ref mismatch between '{0}' and function pointer '{1}'</source> <target state="translated">Modificatore di riferimento non corrispondente tra '{0}' e il puntatore a funzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionPointerTypesInAttributeNotSupported"> <source>Using a function pointer type in a 'typeof' in an attribute is not supported.</source> <target state="needs-review-translation">L'uso di un tipo di puntatore a funzione in un elemento 'typeof' di un attributo non è supportato.</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionPointersCannotBeCalledWithNamedArguments"> <source>A function pointer cannot be called with named arguments.</source> <target state="translated">Non è possibile chiamare un puntatore a funzione con argomenti denominati.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers"> <source>The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract members.</source> <target state="new">The interface '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The constraint interface '{1}' or its base interface has static abstract members.</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalUsingInNamespace"> <source>A global using directive cannot be used in a namespace declaration.</source> <target state="new">A global using directive cannot be used in a namespace declaration.</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalUsingOutOfOrder"> <source>A global using directive must precede all non-global using directives.</source> <target state="new">A global using directive must precede all non-global using directives.</target> <note /> </trans-unit> <trans-unit id="ERR_GoToBackwardJumpOverUsingVar"> <source>A goto cannot jump to a location before a using declaration within the same block.</source> <target state="translated">Un'istruzione goto non può passare a una posizione che precede una dichiarazione using all'interno dello stesso blocco.</target> <note /> </trans-unit> <trans-unit id="ERR_GoToForwardJumpOverUsingVar"> <source>A goto cannot jump to a location after a using declaration.</source> <target state="translated">Un'istruzione goto non può passare a una posizione successiva a una dichiarazione using.</target> <note /> </trans-unit> <trans-unit id="ERR_HiddenPositionalMember"> <source>The positional member '{0}' found corresponding to this parameter is hidden.</source> <target state="translated">Il membro posizionale '{0}' trovato e corrispondente a questo parametro è nascosto.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalSuppression"> <source>The suppression operator is not allowed in this context</source> <target state="translated">L'operatore di eliminazione non è consentito in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitIndexIndexerWithName"> <source>Invocation of implicit Index Indexer cannot name the argument.</source> <target state="translated">La chiamata dell'indicizzatore di indice implicito non può assegnare un nome all'argomento.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitObjectCreationIllegalTargetType"> <source>The type '{0}' may not be used as the target type of new()</source> <target state="translated">Non è possibile usare il tipo '{0}' come tipo di destinazione di new()</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitObjectCreationNoTargetType"> <source>There is no target type for '{0}'</source> <target state="translated">Non esiste alcun tipo di destinazione per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitObjectCreationNotValid"> <source>Use of new() is not valid in this context</source> <target state="translated">Non è possibile usare new() in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitRangeIndexerWithName"> <source>Invocation of implicit Range Indexer cannot name the argument.</source> <target state="translated">La chiamata dell'indicizzatore di intervallo implicito non può assegnare un nome all'argomento.</target> <note /> </trans-unit> <trans-unit id="ERR_InDynamicMethodArg"> <source>Arguments with 'in' modifier cannot be used in dynamically dispatched expressions.</source> <target state="translated">Non è possibile usare argomenti con il modificatore 'in' nelle espressioni inviate in modo dinamico.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritingFromRecordWithSealedToString"> <source>Inheriting from a record with a sealed 'Object.ToString' is not supported in C# {0}. Please use language version '{1}' or greater.</source> <target state="translated">L'ereditarietà da un record con un 'Object.ToString' di tipo sealed non è supportata in C# {0}. Usare la versione '{1}' o successiva del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_InitCannotBeReadonly"> <source>'init' accessors cannot be marked 'readonly'. Mark '{0}' readonly instead.</source> <target state="translated">Non è possibile contrassegnare le funzioni di accesso 'init' come 'readonly'. Contrassegnare '{0}' come readonly.</target> <note /> </trans-unit> <trans-unit id="ERR_InstancePropertyInitializerInInterface"> <source>Instance properties in interfaces cannot have initializers.</source> <target state="translated">Le proprietà di istanza nelle interfacce non possono avere inizializzatori.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedByUnmanagedCallersOnlyMethod"> <source>'UnmanagedCallersOnly' method '{0}' cannot implement interface member '{1}' in type '{2}'</source> <target state="new">'UnmanagedCallersOnly' method '{0}' cannot implement interface member '{1}' in type '{2}'</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_InterfaceImplementedImplicitlyByVariadic"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because it has an __arglist parameter</source> <target state="translated">'{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}' perché contiene un parametro __arglist</target> <note /> </trans-unit> <trans-unit id="ERR_InternalError"> <source>Internal error in the C# compiler.</source> <target state="translated">Si è verificato un errore interno nel compilatore C#.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerArgumentAttributeMalformed"> <source>The InterpolatedStringHandlerArgumentAttribute applied to parameter '{0}' is malformed and cannot be interpreted. Construct an instance of '{1}' manually.</source> <target state="new">The InterpolatedStringHandlerArgumentAttribute applied to parameter '{0}' is malformed and cannot be interpreted. Construct an instance of '{1}' manually.</target> <note>InterpolatedStringHandlerArgumentAttribute is a type name and should not be translated.</note> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerArgumentLocatedAfterInterpolatedString"> <source>Parameter '{0}' is an argument to the interpolated string handler conversion on parameter '{1}', but the corresponding argument is specified after the interpolated string expression. Reorder the arguments to move '{0}' before '{1}'.</source> <target state="new">Parameter '{0}' is an argument to the interpolated string handler conversion on parameter '{1}', but the corresponding argument is specified after the interpolated string expression. Reorder the arguments to move '{0}' before '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerArgumentOptionalNotSpecified"> <source>Parameter '{0}' is not explicitly provided, but is used as an argument to the interpolated string handler conversion on parameter '{1}'. Specify the value of '{0}' before '{1}'.</source> <target state="new">Parameter '{0}' is not explicitly provided, but is used as an argument to the interpolated string handler conversion on parameter '{1}'. Specify the value of '{0}' before '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerCreationCannotUseDynamic"> <source>An interpolated string handler construction cannot use dynamic. Manually construct an instance of '{0}'.</source> <target state="new">An interpolated string handler construction cannot use dynamic. Manually construct an instance of '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerMethodReturnInconsistent"> <source>Interpolated string handler method '{0}' has inconsistent return type. Expected to return '{1}'.</source> <target state="new">Interpolated string handler method '{0}' has inconsistent return type. Expected to return '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringHandlerMethodReturnMalformed"> <source>Interpolated string handler method '{0}' is malformed. It does not return 'void' or 'bool'.</source> <target state="new">Interpolated string handler method '{0}' is malformed. It does not return 'void' or 'bool'.</target> <note>void and bool are keywords</note> </trans-unit> <trans-unit id="ERR_InvalidFuncPointerReturnTypeModifier"> <source>'{0}' is not a valid function pointer return type modifier. Valid modifiers are 'ref' and 'ref readonly'.</source> <target state="translated">'{0}' non è un modificatore di tipo restituito di puntatore a funzione valido. I modificatori validi sono 'ref' e 'ref readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFunctionPointerCallingConvention"> <source>'{0}' is not a valid calling convention specifier for a function pointer.</source> <target state="translated">'{0}' non è un identificatore di convenzione di chiamata valido per un puntatore a funzione.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHashAlgorithmName"> <source>Invalid hash algorithm name: '{0}'</source> <target state="translated">Il nome dell'algoritmo hash non è valido: '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInterpolatedStringHandlerArgumentName"> <source>'{0}' is not a valid parameter name from '{1}'.</source> <target state="new">'{0}' is not a valid parameter name from '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidModifierForLanguageVersion"> <source>The modifier '{0}' is not valid for this item in C# {1}. Please use language version '{2}' or greater.</source> <target state="translated">Il modificatore '{0}' non è valido per questo elemento in C# {1}. Usare la versione '{2}' o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNameInSubpattern"> <source>Identifier or a simple member access expected.</source> <target state="new">Identifier or a simple member access expected.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidObjectCreation"> <source>Invalid object creation</source> <target state="translated">Creazione oggetto non valida</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPropertyReadOnlyMods"> <source>Cannot specify 'readonly' modifiers on both property or indexer '{0}' and its accessor. Remove one of them.</source> <target state="translated">Non è possibile specificare i modificatori 'readonly' nella proprietà o nell'indicizzatore '{0}' e nella relativa funzione di accesso. Rimuoverne uno.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidStackAllocArray"> <source>"Invalid rank specifier: expected ']'</source> <target state="translated">"L'identificatore del numero di dimensioni non è valido: è previsto ']'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUnmanagedCallersOnlyCallConv"> <source>'{0}' is not a valid calling convention type for 'UnmanagedCallersOnly'.</source> <target state="translated">'{0}' non è un tipo di convenzione di chiamata valido per 'UnmanagedCallersOnly'.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_InvalidWithReceiverType"> <source>The receiver of a `with` expression must have a non-void type.</source> <target state="translated">Il ricevitore di un'espressione `with` deve avere un tipo non void.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNullableType"> <source>It is not legal to use nullable reference type '{0}?' in an is-type expression; use the underlying type '{0}' instead.</source> <target state="translated">Non è consentito usare il tipo riferimento nullable '{0}?' in un'espressione is-type. Usare il tipo sottostante '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsPatternImpossible"> <source>An expression of type '{0}' can never match the provided pattern.</source> <target state="translated">Un'espressione di tipo '{0}' non può mai corrispondere al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="ERR_IteratorMustBeAsync"> <source>Method '{0}' with an iterator block must be 'async' to return '{1}'</source> <target state="translated">Il metodo '{0}' con un blocco iteratore deve essere 'async' per restituire '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_LineSpanDirectiveEndLessThanStart"> <source>The #line directive end position must be greater than or equal to the start position</source> <target state="new">The #line directive end position must be greater than or equal to the start position</target> <note /> </trans-unit> <trans-unit id="ERR_LineSpanDirectiveInvalidValue"> <source>The #line directive value is missing or out of range</source> <target state="new">The #line directive value is missing or out of range</target> <note /> </trans-unit> <trans-unit id="ERR_MethFuncPtrMismatch"> <source>No overload for '{0}' matches function pointer '{1}'</source> <target state="translated">Nessun overload per '{0}' corrisponde al puntatore a funzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingAddressOf"> <source>Cannot convert method group to function pointer (Are you missing a '&amp;'?)</source> <target state="translated">Non è possibile convertire il gruppo di metodi nel puntatore a funzione. Manca un operatore '&amp;'?</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPattern"> <source>Pattern missing</source> <target state="translated">Criterio mancante</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerCannotBeUnmanagedCallersOnly"> <source>Module initializer cannot be attributed with 'UnmanagedCallersOnly'.</source> <target state="translated">Non è possibile aggiungere all'inizializzatore di modulo l'attributo 'UnmanagedCallersOnly'.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric"> <source>Module initializer method '{0}' must not be generic and must not be contained in a generic type</source> <target state="translated">Il metodo '{0}' dell'inizializzatore di modulo non deve essere generico e non deve essere contenuto in un tipo generico</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodMustBeAccessibleOutsideTopLevelType"> <source>Module initializer method '{0}' must be accessible at the module level</source> <target state="translated">Il metodo '{0}' dell'inizializzatore di modulo deve essere accessibile a livello di modulo</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodMustBeOrdinary"> <source>A module initializer must be an ordinary member method</source> <target state="translated">Un inizializzatore di modulo deve essere un metodo membro normale</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleInitializerMethodMustBeStaticParameterlessVoid"> <source>Module initializer method '{0}' must be static, must have no parameters, and must return 'void'</source> <target state="translated">Il metodo '{0}' dell'inizializzatore di modulo deve essere statico, non deve contenere parametri e deve restituire 'void'</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleAnalyzerConfigsInSameDir"> <source>Multiple analyzer config files cannot be in the same directory ('{0}').</source> <target state="translated">La stessa directory ('{0}') non può contenere più file di configurazione dell'analizzatore.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEnumeratorCancellationAttributes"> <source>The attribute [EnumeratorCancellation] cannot be used on multiple parameters</source> <target state="translated">Non è possibile usare l'attributo [EnumeratorCancellation] in più parametri</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleFileScopedNamespace"> <source>Source file can only contain one file-scoped namespace declaration.</source> <target state="new">Source file can only contain one file-scoped namespace declaration.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleRecordParameterLists"> <source>Only a single record partial declaration may have a parameter list</source> <target state="translated">Solo una dichiarazione parziale di singolo record può includere un elenco di parametri</target> <note /> </trans-unit> <trans-unit id="ERR_NewBoundWithUnmanaged"> <source>The 'new()' constraint cannot be used with the 'unmanaged' constraint</source> <target state="translated">Non è possibile usare il vincolo 'new()' con il vincolo 'unmanaged'</target> <note /> </trans-unit> <trans-unit id="ERR_NewlinesAreNotAllowedInsideANonVerbatimInterpolatedString"> <source>Newlines are not allowed inside a non-verbatim interpolated string</source> <target state="new">Newlines are not allowed inside a non-verbatim interpolated string</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIAsyncDispWrongAsync"> <source>'{0}': type used in an asynchronous using statement must be implicitly convertible to 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method. Did you mean 'using' rather than 'await using'?</source> <target state="translated">'{0}': il tipo usato in un'istruzione using asincrona deve essere convertibile in modo implicito in 'System.IAsyncDisposable' o implementare un metodo 'DisposeAsync' adatto. Si intendeva 'using' invece di 'await using'?</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIDispWrongAsync"> <source>'{0}': type used in a using statement must be implicitly convertible to 'System.IDisposable'. Did you mean 'await using' rather than 'using'?</source> <target state="translated">'{0}': il tipo usato in un'istruzione using deve essere convertibile in modo implicito in 'System.IDisposable'. Si intendeva 'await using' invece di 'using'?</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerArgumentExpressionParam"> <source>CallerArgumentExpressionAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="new">CallerArgumentExpressionAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoCopyConstructorInBaseType"> <source>No accessible copy constructor found in base type '{0}'.</source> <target state="translated">Non è stato trovato alcun costruttore di copia accessibile nel tipo di base '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoImplicitConvTargetTypedConditional"> <source>Conditional expression is not valid in language version {0} because a common type was not found between '{1}' and '{2}'. To use a target-typed conversion, upgrade to language version {3} or greater.</source> <target state="new">Conditional expression is not valid in language version {0} because a common type was not found between '{1}' and '{2}'. To use a target-typed conversion, upgrade to language version {3} or greater.</target> <note /> </trans-unit> <trans-unit id="ERR_NoOutputDirectory"> <source>Output directory could not be determined</source> <target state="translated">Non è stato possibile individuare la directory di output</target> <note /> </trans-unit> <trans-unit id="ERR_NonPrivateAPIInRecord"> <source>Record member '{0}' must be private.</source> <target state="translated">Il membro del record '{0}' deve essere privato.</target> <note /> </trans-unit> <trans-unit id="ERR_NonProtectedAPIInRecord"> <source>Record member '{0}' must be protected.</source> <target state="translated">Il membro del record '{0}' deve essere protetto.</target> <note /> </trans-unit> <trans-unit id="ERR_NonPublicAPIInRecord"> <source>Record member '{0}' must be public.</source> <target state="translated">Il membro del record '{0}' deve essere pubblico.</target> <note /> </trans-unit> <trans-unit id="ERR_NonPublicParameterlessStructConstructor"> <source>The parameterless struct constructor must be 'public'.</source> <target state="new">The parameterless struct constructor must be 'public'.</target> <note /> </trans-unit> <trans-unit id="ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName"> <source>'{0}' is not an instance method, the receiver cannot be an interpolated string handler argument.</source> <target state="new">'{0}' is not an instance method, the receiver cannot be an interpolated string handler argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NotOverridableAPIInRecord"> <source>'{0}' must allow overriding because the containing record is not sealed.</source> <target state="translated">'{0}' deve consentire l'override perché il record contenitore non è sealed.</target> <note /> </trans-unit> <trans-unit id="ERR_NullInvalidInterpolatedStringHandlerArgumentName"> <source>null is not a valid parameter name. To get access to the receiver of an instance method, use the empty string as the parameter name.</source> <target state="new">null is not a valid parameter name. To get access to the receiver of an instance method, use the empty string as the parameter name.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDirectiveQualifierExpected"> <source>Expected 'enable', 'disable', or 'restore'</source> <target state="translated">È previsto 'enable', 'disable' o 'restore'</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDirectiveTargetExpected"> <source>Expected 'warnings', 'annotations', or end of directive</source> <target state="translated">È previsto 'warnings', 'annotations' o la fine della direttiva</target> <note /> </trans-unit> <trans-unit id="ERR_NullableOptionNotAvailable"> <source>Invalid '{0}' value: '{1}' for C# {2}. Please use language version '{3}' or greater.</source> <target state="translated">Valore '{1}' di '{0}' non valido per C# {2}. Usare la versione {3} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableUnconstrainedTypeParameter"> <source>A nullable type parameter must be known to be a value type or non-nullable reference type unless language version '{0}' or greater is used. Consider changing the language version or adding a 'class', 'struct', or type constraint.</source> <target state="translated">Un parametro di tipo nullable deve essere noto per essere un tipo valore o un tipo riferimento non nullable, a meno che non venga usata la versione '{0}' o successiva del linguaggio. Provare a cambiare la versione del linguaggio o ad aggiungere un vincolo di tipo, 'class' o 'struct'.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedTypeArgument"> <source>Omitting the type argument is not allowed in the current context</source> <target state="translated">Nel contesto corrente non è possibile omettere l'argomento tipo</target> <note /> </trans-unit> <trans-unit id="ERR_OutVariableCannotBeByRef"> <source>An out variable cannot be declared as a ref local</source> <target state="translated">Non è possibile dichiarare una variabile out come variabile locale ref</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideDefaultConstraintNotSatisfied"> <source>Method '{0}' specifies a 'default' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is constrained to a reference type or a value type.</source> <target state="translated">Il metodo '{0}' specifica un vincolo 'default' per il parametro di tipo '{1}', ma il parametro di tipo corrispondente '{2}' del metodo '{3}' sottoposto a override o implementato in modo esplicito è vincolato a un tipo riferimento a un tipo valore.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideRefConstraintNotSatisfied"> <source>Method '{0}' specifies a 'class' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is not a reference type.</source> <target state="translated">Il metodo '{0}' specifica un vincolo 'class' per il parametro di tipo '{1}', ma il parametro di tipo corrispondente '{2}' del metodo '{3}' sottoposto a override o implementato in modo esplicito non è un tipo riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideValConstraintNotSatisfied"> <source>Method '{0}' specifies a 'struct' constraint for type parameter '{1}', but corresponding type parameter '{2}' of overridden or explicitly implemented method '{3}' is not a non-nullable value type.</source> <target state="translated">Il metodo '{0}' specifica un vincolo 'struct' per il parametro di tipo '{1}', ma il parametro di tipo corrispondente '{2}' del metodo '{3}' sottoposto a override o implementato in modo esplicito non è un tipo valore che non ammette valori Null.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodAccessibilityDifference"> <source>Both partial method declarations must have identical accessibility modifiers.</source> <target state="translated">I modificatori di accessibilità devono essere identici in entrambe le dichiarazioni di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodExtendedModDifference"> <source>Both partial method declarations must have identical combinations of 'virtual', 'override', 'sealed', and 'new' modifiers.</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono contenere combinazioni identiche di modificatori 'virtual', 'override', 'sealed' e 'new'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodReadOnlyDifference"> <source>Both partial method declarations must be readonly or neither may be readonly</source> <target state="translated">Nessuna o entrambe le dichiarazioni di metodi parziali devono essere di tipo readonly</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodRefReturnDifference"> <source>Partial method declarations must have matching ref return values.</source> <target state="translated">Le dichiarazioni di metodo parziale devono contenere valori restituiti di riferimento corrispondenti.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodReturnTypeDifference"> <source>Both partial method declarations must have the same return type.</source> <target state="translated">Il tipo restituito deve essere identico in entrambe le dichiarazioni di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithAccessibilityModsMustHaveImplementation"> <source>Partial method '{0}' must have an implementation part because it has accessibility modifiers.</source> <target state="translated">Il metodo parziale '{0}' deve contenere una parte di implementazione perché include modificatori di accessibilità.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithExtendedModMustHaveAccessMods"> <source>Partial method '{0}' must have accessibility modifiers because it has a 'virtual', 'override', 'sealed', 'new', or 'extern' modifier.</source> <target state="translated">Il metodo parziale '{0}' deve contenere modificatori di accessibilità perché include un modificatore 'virtual', 'override', 'sealed', 'new' o 'extern'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithNonVoidReturnMustHaveAccessMods"> <source>Partial method '{0}' must have accessibility modifiers because it has a non-void return type.</source> <target state="translated">Il metodo parziale '{0}' deve contenere modificatori di accessibilità perché include un tipo restituito non void.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodWithOutParamMustHaveAccessMods"> <source>Partial method '{0}' must have accessibility modifiers because it has 'out' parameters.</source> <target state="translated">Il metodo parziale '{0}' deve contenere modificatori di accessibilità perché include parametri 'out'.</target> <note /> </trans-unit> <trans-unit id="ERR_PointerTypeInPatternMatching"> <source>Pattern-matching is not permitted for pointer types.</source> <target state="translated">I criteri di ricerca non sono consentiti per i tipi di puntatore.</target> <note /> </trans-unit> <trans-unit id="ERR_PossibleAsyncIteratorWithoutYield"> <source>The body of an async-iterator method must contain a 'yield' statement.</source> <target state="translated">Il corpo di un metodo di iteratore asincrono deve contenere un'istruzione 'yield'.</target> <note /> </trans-unit> <trans-unit id="ERR_PossibleAsyncIteratorWithoutYieldOrAwait"> <source>The body of an async-iterator method must contain a 'yield' statement. Consider removing 'async' from the method declaration or adding a 'yield' statement.</source> <target state="translated">Il corpo di un metodo di iteratore asincrono deve contenere un'istruzione 'yield'. Provare a rimuovere 'async' dalla dichiarazione del metodo o ad aggiungere un'istruzione 'yield'.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyPatternNameMissing"> <source>A property subpattern requires a reference to the property or field to be matched, e.g. '{{ Name: {0} }}'</source> <target state="translated">Con un criterio secondario di proprietà è richiesto un riferimento alla proprietà o al campo da abbinare, ad esempio '{{ Name: {0} }}'</target> <note /> </trans-unit> <trans-unit id="ERR_ReAbstractionInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché contiene una nuova astrazione di un membro dell'interfaccia di base. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyModMissingAccessor"> <source>'{0}': 'readonly' can only be used on accessors if the property or indexer has both a get and a set accessor</source> <target state="translated">'{0}': 'readonly' può essere usato su funzioni di accesso solo se la proprietà o l'indicizzatore include entrambi le funzioni di accesso get e set</target> <note /> </trans-unit> <trans-unit id="ERR_RecordAmbigCtor"> <source>The primary constructor conflicts with the synthesized copy constructor.</source> <target state="translated">Il costruttore primario è in conflitto con il costruttore di copia sintetizzato.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAssignNarrower"> <source>Cannot ref-assign '{1}' to '{0}' because '{1}' has a narrower escape scope than '{0}'.</source> <target state="translated">Non è possibile assegnare '{1}' a '{0}' come ref perché l'ambito di escape di '{1}' è ridotto rispetto a quello di '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RefLocalOrParamExpected"> <source>The left-hand side of a ref assignment must be a ref local or parameter.</source> <target state="translated">La parte sinistra di un'assegnazione ref deve essere un parametro o una variabile locale ref.</target> <note /> </trans-unit> <trans-unit id="ERR_RelationalPatternWithNaN"> <source>Relational patterns may not be used for a floating-point NaN.</source> <target state="translated">Non è possibile usare i criteri relazionali per un valore NaN a virgola mobile.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportCovariantPropertiesOfClasses"> <source>'{0}': Target runtime doesn't support covariant types in overrides. Type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il runtime di destinazione non supporta tipi covarianti negli override. Il tipo deve essere '{2}' in modo da corrispondere al membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportCovariantReturnsOfClasses"> <source>'{0}': Target runtime doesn't support covariant return types in overrides. Return type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il runtime di destinazione non supporta tipi restituiti covarianti negli override. Il tipo restituito deve essere '{2}' in modo da corrispondere al membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember"> <source>Target runtime doesn't support 'protected', 'protected internal', or 'private protected' accessibility for a member of an interface.</source> <target state="translated">Il runtime di destinazione non supporta l'accessibilità 'protected', 'protected internal' o 'private protected' per un membro di un'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces"> <source>Target runtime doesn't support static abstract members in interfaces.</source> <target state="new">Target runtime doesn't support static abstract members in interfaces.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfacesForMember"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support static abstract members in interfaces.</source> <target state="new">'{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support static abstract members in interfaces.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportUnmanagedDefaultCallConv"> <source>The target runtime doesn't support extensible or runtime-environment default calling conventions.</source> <target state="translated">Il runtime di destinazione non supporta convenzioni di chiamata predefinite estendibili o dell'ambiente di runtime.</target> <note /> </trans-unit> <trans-unit id="ERR_SealedAPIInRecord"> <source>'{0}' cannot be sealed because containing record is not sealed.</source> <target state="translated">'{0}' non può essere sealed perché il record contenitore non è sealed.</target> <note /> </trans-unit> <trans-unit id="ERR_SignatureMismatchInRecord"> <source>Record member '{0}' must return '{1}'.</source> <target state="translated">Il membro di record '{0}' deve restituire '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramDisallowsMainType"> <source>Cannot specify /main if there is a compilation unit with top-level statements.</source> <target state="translated">Non è possibile specificare /main se è presente un'unità di compilazione con istruzioni di primo livello.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramIsEmpty"> <source>At least one top-level statement must be non-empty.</source> <target state="new">At least one top-level statement must be non-empty.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramLocalIsReferencedOutsideOfTopLevelStatement"> <source>Cannot use local variable or local function '{0}' declared in a top-level statement in this context.</source> <target state="translated">In questo contesto non è possibile usare la variabile locale o la funzione locale '{0}' dichiarata in un'istruzione di primo livello.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramMultipleUnitsWithTopLevelStatements"> <source>Only one compilation unit can have top-level statements.</source> <target state="translated">Le istruzioni di primo livello possono essere presenti solo in un'unica unità di compilazione.</target> <note /> </trans-unit> <trans-unit id="ERR_SimpleProgramNotAnExecutable"> <source>Program using top-level statements must be an executable.</source> <target state="translated">Il programma che usa istruzioni di primo livello deve essere un eseguibile.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleElementPositionalPatternRequiresDisambiguation"> <source>A single-element deconstruct pattern requires some other syntax for disambiguation. It is recommended to add a discard designator '_' after the close paren ')'.</source> <target state="translated">Per risolvere le ambiguità, è necessario usare una sintassi diversa per il criterio di decostruzione di singoli elementi. È consigliabile aggiungere un indicatore di rimozione '_' dopo la parentesi di chiusura ')'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticAPIInRecord"> <source>Record member '{0}' may not be static.</source> <target state="translated">Il membro di record '{0}' non può essere statico.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticAnonymousFunctionCannotCaptureThis"> <source>A static anonymous function cannot contain a reference to 'this' or 'base'.</source> <target state="translated">Una funzione anonima statica non può contenere un riferimento a 'this' o 'base'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticAnonymousFunctionCannotCaptureVariable"> <source>A static anonymous function cannot contain a reference to '{0}'.</source> <target state="translated">Una funzione anonima statica non può contenere un riferimento a '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticLocalFunctionCannotCaptureThis"> <source>A static local function cannot contain a reference to 'this' or 'base'.</source> <target state="translated">Una funzione locale statica non può contenere un riferimento a 'this' o 'base'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticLocalFunctionCannotCaptureVariable"> <source>A static local function cannot contain a reference to '{0}'.</source> <target state="translated">Una funzione locale statica non può contenere un riferimento a '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticMemberCantBeReadOnly"> <source>Static member '{0}' cannot be marked 'readonly'.</source> <target state="translated">Il membro statico '{0}' non può essere contrassegnato come 'readonly'.</target> <note /> </trans-unit> <trans-unit id="ERR_StdInOptionProvidedButConsoleInputIsNotRedirected"> <source>stdin argument '-' is specified, but input has not been redirected from the standard input stream.</source> <target state="translated">è stato specificato l'argomento stdin '-', ma l'input non è stato reindirizzato dal flusso di input standard.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchArmSubsumed"> <source>The pattern is unreachable. It has already been handled by a previous arm of the switch expression or it is impossible to match.</source> <target state="translated">Il criterio non è raggiungibile. È già stato gestito da un elemento precedente dell'espressione switch oppure non è possibile trovare una corrispondenza.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchCaseSubsumed"> <source>The switch case is unreachable. It has already been handled by a previous case or it is impossible to match.</source> <target state="translated">Lo switch case on è raggiungibile. È già stato gestito da un case precedente oppure non è possibile trovare una corrispondenza.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchExpressionNoBestType"> <source>No best type was found for the switch expression.</source> <target state="translated">Non è stato trovato alcun tipo ottimale per l'espressione switch.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchGoverningExpressionRequiresParens"> <source>Parentheses are required around the switch governing expression.</source> <target state="translated">L'espressione che gestisce lo switch deve essere racchiusa tra parentesi.</target> <note /> </trans-unit> <trans-unit id="ERR_TopLevelStatementAfterNamespaceOrType"> <source>Top-level statements must precede namespace and type declarations.</source> <target state="translated">Le istruzioni di primo livello devono precedere le dichiarazioni di tipo e di spazio dei nomi.</target> <note /> </trans-unit> <trans-unit id="ERR_TripleDotNotAllowed"> <source>Unexpected character sequence '...'</source> <target state="translated">La sequenza di caratteri '...' è imprevista</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNameMismatch"> <source>The name '{0}' does not identify tuple element '{1}'.</source> <target state="translated">Il nome '{0}' non identifica l'elemento di tupla '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleSizesMismatchForBinOps"> <source>Tuple types used as operands of an == or != operator must have matching cardinalities. But this operator has tuple types of cardinality {0} on the left and {1} on the right.</source> <target state="translated">Le cardinalità dei tipi di tupla usati come operandi di un operatore == o != devono essere uguali, ma questo operatore presenta tipi di tupla con cardinalità {0} sulla sinistra e {1} sulla destra.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeConstraintsMustBeUniqueAndFirst"> <source>The 'class', 'struct', 'unmanaged', 'notnull', and 'default' constraints cannot be combined or duplicated, and must be specified first in the constraints list.</source> <target state="translated">I vincoli 'class', 'struct', 'unmanaged', 'notnull' e 'default' non possono essere combinati o duplicati e devono essere specificati per primi nell'elenco di vincoli.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeIsNotAnInterpolatedStringHandlerType"> <source>'{0}' is not an interpolated string handler type.</source> <target state="new">'{0}' is not an interpolated string handler type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMustBePublic"> <source>Type '{0}' must be public to be used as a calling convention.</source> <target state="translated">Il tipo '{0}' deve essere pubblico per poterlo usare come convenzione di chiamata.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyMethodsCannotBeCalledDirectly"> <source>'{0}' is attributed with 'UnmanagedCallersOnly' and cannot be called directly. Obtain a function pointer to this method.</source> <target state="translated">'{0}', a cui è assegnato l'attributo 'UnmanagedCallersOnly', non può essere chiamato direttamente. Ottenere un puntatore a funzione per questo metodo.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyMethodsCannotBeConvertedToDelegate"> <source>'{0}' is attributed with 'UnmanagedCallersOnly' and cannot be converted to a delegate type. Obtain a function pointer to this method.</source> <target state="translated">'{0}', a cui è assegnato l'attributo 'UnmanagedCallersOnly', non può essere convertito in un tipo delegato. Ottenere un puntatore a funzione per questo metodo.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_WrongArityAsyncReturn"> <source>A generic task-like return type was expected, but the type '{0}' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.</source> <target state="new">A generic task-like return type was expected, but the type '{0}' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.</target> <note /> </trans-unit> <trans-unit id="HDN_DuplicateWithGlobalUsing"> <source>The using directive for '{0}' appeared previously as global using</source> <target state="new">The using directive for '{0}' appeared previously as global using</target> <note /> </trans-unit> <trans-unit id="HDN_DuplicateWithGlobalUsing_Title"> <source>The using directive appeared previously as global using</source> <target state="new">The using directive appeared previously as global using</target> <note /> </trans-unit> <trans-unit id="IDS_AsyncMethodBuilderOverride"> <source>async method builder override</source> <target state="new">async method builder override</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureCovariantReturnsForOverrides"> <source>covariant returns</source> <target state="translated">tipi restituiti covarianti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDiscards"> <source>discards</source> <target state="translated">rimozioni</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtendedPropertyPatterns"> <source>extended property patterns</source> <target state="new">extended property patterns</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureFileScopedNamespace"> <source>file-scoped namespace</source> <target state="new">file-scoped namespace</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGenericAttributes"> <source>generic attributes</source> <target state="new">generic attributes</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGlobalUsing"> <source>global using directive</source> <target state="new">global using directive</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImplicitObjectCreation"> <source>target-typed object creation</source> <target state="translated">creazione di oggetti con tipo di destinazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImprovedInterpolatedStrings"> <source>interpolated string handlers</source> <target state="new">interpolated string handlers</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureInferredDelegateType"> <source>inferred delegate type</source> <target state="new">inferred delegate type</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambdaAttributes"> <source>lambda attributes</source> <target state="new">lambda attributes</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambdaReturnType"> <source>lambda return type</source> <target state="new">lambda return type</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLineSpanDirective"> <source>line span directive</source> <target state="new">line span directive</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureParameterlessStructConstructors"> <source>parameterless struct constructors</source> <target state="new">parameterless struct constructors</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePositionalFieldsInRecords"> <source>positional fields in records</source> <target state="new">positional fields in records</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRecordStructs"> <source>record structs</source> <target state="new">record structs</target> <note>'record structs' is not localizable.</note> </trans-unit> <trans-unit id="IDS_FeatureSealedToStringInRecord"> <source>sealed ToString in record</source> <target state="translated">ToString sealed nel record</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStructFieldInitializers"> <source>struct field initializers</source> <target state="new">struct field initializers</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureWithOnAnonymousTypes"> <source>with on anonymous types</source> <target state="new">with on anonymous types</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticAbstractMembersInInterfaces"> <source>static abstract members in interfaces</source> <target state="new">static abstract members in interfaces</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureWithOnStructs"> <source>with on structs</source> <target state="new">with on structs</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework"> <source>The assembly '{0}' containing type '{1}' references .NET Framework, which is not supported.</source> <target state="translated">L'assembly '{0}' che contiene il tipo '{1}' fa riferimento a .NET Framework, che non è supportato.</target> <note>{1} is the type that was loaded, {0} is the containing assembly.</note> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework_Title"> <source>The loaded assembly references .NET Framework, which is not supported.</source> <target state="translated">L'assembly caricato fa riferimento a .NET Framework, che non è supportato.</target> <note /> </trans-unit> <trans-unit id="WRN_AttrDependentTypeNotAllowed"> <source>Type '{0}' cannot be used in this context because it cannot be represented in metadata.</source> <target state="new">Type '{0}' cannot be used in this context because it cannot be represented in metadata.</target> <note /> </trans-unit> <trans-unit id="WRN_AttrDependentTypeNotAllowed_Title"> <source>Type cannot be used in this context because it cannot be represented in metadata.</source> <target state="new">Type cannot be used in this context because it cannot be represented in metadata.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName_Title"> <source>The CallerArgumentExpressionAttribute is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-refential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-refential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionParamForUnconsumedLocation"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionParamForUnconsumedLocation_Title"> <source>The CallerArgumentExpressionAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerArgumentExpression"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerArgumentExpression_Title"> <source>The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerFilePathAttribute</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerFilePathAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerArgumentExpression"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerArgumentExpression_Title"> <source>The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNamePreferredOverCallerArgumentExpression"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerMemberNameAttribute.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerMemberNameAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNamePreferredOverCallerArgumentExpression_Title"> <source>The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerMemberNameAttribute</source> <target state="new">The CallerArgumentExpressionAttribute will have no effect; it is overridden by the CallerMemberNameAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_DoNotCompareFunctionPointers"> <source>Comparison of function pointers might yield an unexpected result, since pointers to the same function may be distinct.</source> <target state="translated">Il confronto dei puntatori a funzione potrebbe produrre un risultato imprevisto perché i puntatori alla stessa funzione possono essere distinti.</target> <note /> </trans-unit> <trans-unit id="WRN_DoNotCompareFunctionPointers_Title"> <source>Do not compare function pointer values</source> <target state="translated">Non confrontare valori del puntatore a funzione</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterNotNullIfNotNull"> <source>Parameter '{0}' must have a non-null value when exiting because parameter '{1}' is non-null.</source> <target state="translated">Il parametro '{0}' deve avere un valore non Null quando viene terminato perché il parametro '{1}' è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterNotNullIfNotNull_Title"> <source>Parameter must have a non-null value when exiting because parameter referenced by NotNullIfNotNull is non-null.</source> <target state="translated">Il parametro deve avere un valore non Null quando viene terminato perché il parametro a cui fa riferimento NotNullIfNotNull è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterOccursAfterInterpolatedStringHandlerParameter"> <source>Parameter {0} occurs after {1} in the parameter list, but is used as an argument for interpolated string handler conversions. This will require the caller to reorder parameters with named arguments at the call site. Consider putting the interpolated string handler parameter after all arguments involved.</source> <target state="new">Parameter {0} occurs after {1} in the parameter list, but is used as an argument for interpolated string handler conversions. This will require the caller to reorder parameters with named arguments at the call site. Consider putting the interpolated string handler parameter after all arguments involved.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterOccursAfterInterpolatedStringHandlerParameter_Title"> <source>Parameter to interpolated string handler conversion occurs after handler parameter</source> <target state="new">Parameter to interpolated string handler conversion occurs after handler parameter</target> <note /> </trans-unit> <trans-unit id="WRN_RecordEqualsWithoutGetHashCode"> <source>'{0}' defines 'Equals' but not 'GetHashCode'</source> <target state="translated">'{0}' definisce 'Equals' ma non 'GetHashCode'</target> <note>'GetHashCode' and 'Equals' are not localizable.</note> </trans-unit> <trans-unit id="WRN_RecordEqualsWithoutGetHashCode_Title"> <source>Record defines 'Equals' but not 'GetHashCode'.</source> <target state="translated">Il record definisce 'Equals' ma non 'GetHashCode'.</target> <note>'GetHashCode' and 'Equals' are not localizable.</note> </trans-unit> <trans-unit id="IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction"> <source>Mixed declarations and expressions in deconstruction</source> <target state="translated">Dichiarazioni ed espressioni miste nella decostruzione</target> <note /> </trans-unit> <trans-unit id="WRN_PartialMethodTypeDifference"> <source>Partial method declarations '{0}' and '{1}' have signature differences.</source> <target state="new">Partial method declarations '{0}' and '{1}' have signature differences.</target> <note /> </trans-unit> <trans-unit id="WRN_PartialMethodTypeDifference_Title"> <source>Partial method declarations have signature differences.</source> <target state="new">Partial method declarations have signature differences.</target> <note /> </trans-unit> <trans-unit id="WRN_RecordNamedDisallowed"> <source>Types and aliases should not be named 'record'.</source> <target state="translated">Il nome di tipi e alias non deve essere 'record'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecordNamedDisallowed_Title"> <source>Types and aliases should not be named 'record'.</source> <target state="translated">Il nome di tipi e alias non deve essere 'record'.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnNotNullIfNotNull"> <source>Return value must be non-null because parameter '{0}' is non-null.</source> <target state="translated">Il valore restituito deve essere non Null perché il parametro '{0}' è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnNotNullIfNotNull_Title"> <source>Return value must be non-null because parameter is non-null.</source> <target state="translated">Il valore restituito deve essere non Null perché il parametro è non Null.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithUnnamedEnumValue"> <source>The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value. For example, the pattern '{0}' is not covered.</source> <target state="translated">L'espressione switch non gestisce alcuni valori del relativo tipo di input (non è esaustiva) che interessa un valore di enumerazione senza nome. Ad esempio, il criterio '{0}' non è coperto.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithUnnamedEnumValue_Title"> <source>The switch expression does not handle some values of its input type (it is not exhaustive) involving an unnamed enum value.</source> <target state="translated">L'espressione switch non gestisce alcuni valori del relativo tipo di input (non è esaustiva) che interessa un valore di enumerazione senza nome.</target> <note /> </trans-unit> <trans-unit id="WRN_SyncAndAsyncEntryPoints"> <source>Method '{0}' will not be used as an entry point because a synchronous entry point '{1}' was found.</source> <target state="translated">Il metodo '{0}' non verrà usato come punto di ingresso perché è stato trovato un punto di ingresso sincrono '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeNotFound"> <source>Type '{0}' is not defined.</source> <target state="translated">Il tipo '{0}' non è definito.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedArgumentList"> <source>Unexpected argument list.</source> <target state="translated">Elenco di argomenti imprevisto.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedOrMissingConstructorInitializerInRecord"> <source>A constructor declared in a record with parameter list must have 'this' constructor initializer.</source> <target state="translated">Un costruttore dichiarato in un record con elenco di parametri deve includere l'inizializzatore di costruttore 'this'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedVarianceStaticMember"> <source>Invalid variance: The type parameter '{1}' must be {3} valid on '{0}' unless language version '{4}' or greater is used. '{1}' is {2}.</source> <target state="translated">Varianza non valida: il parametro di tipo '{1}' deve essere {3} valido in '{0}' a meno che non venga usata la versione '{4}' o successiva del linguaggio. '{1}' è {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedBoundWithClass"> <source>'{0}': cannot specify both a constraint class and the 'unmanaged' constraint</source> <target state="translated">'{0}': non è possibile specificare sia una classe constraint che il vincolo 'unmanaged'</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyMethodOrTypeCannotBeGeneric"> <source>Methods attributed with 'UnmanagedCallersOnly' cannot have generic type parameters and cannot be declared in a generic type.</source> <target state="translated">I metodi attribuiti con 'UnmanagedCallersOnly' non possono avere parametri di tipo generico e non possono essere dichiarati in un tipo generico.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyRequiresStatic"> <source>'UnmanagedCallersOnly' can only be applied to ordinary static non-abstract methods or static local functions.</source> <target state="needs-review-translation">'UnmanagedCallersOnly' può essere applicato solo a metodi statici normali o funzioni locali statiche.</target> <note>UnmanagedCallersOnly is not localizable.</note> </trans-unit> <trans-unit id="ERR_UnmanagedConstraintNotSatisfied"> <source>The type '{2}' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">Il tipo '{2}' deve essere un tipo valore che non ammette i valori Null, unitamente a tutti i campi a ogni livello di annidamento, per poter essere usato come parametro '{1}' nel tipo o metodo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedCallingConvention"> <source>The calling convention of '{0}' is not supported by the language.</source> <target state="translated">La convenzione di chiamata di '{0}' non è supportata dal linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedTypeForRelationalPattern"> <source>Relational patterns may not be used for a value of type '{0}'.</source> <target state="translated">Non è possibile usare i criteri relazionali per un valore di tipo '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingVarInSwitchCase"> <source>A using variable cannot be used directly within a switch section (consider using braces). </source> <target state="translated">Non è possibile usare una variabile using direttamente in una sezione di switch; provare a usare le parentesi graffe. </target> <note /> </trans-unit> <trans-unit id="ERR_VarMayNotBindToType"> <source>The syntax 'var' for a pattern is not permitted to refer to a type, but '{0}' is in scope here.</source> <target state="translated">Per fare riferimento a un tipo, non è consentito usare la sintassi 'var' per un criterio, ma in questo '{0}' è incluso nell'ambito.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInterfaceNesting"> <source>Enums, classes, and structures cannot be declared in an interface that has an 'in' or 'out' type parameter.</source> <target state="translated">Non è possibile dichiarare enumerazioni, classi e strutture in un'interfaccia che contiene un parametro di tipo 'in' o 'out'.</target> <note /> </trans-unit> <trans-unit id="ERR_WrongFuncPtrCallingConvention"> <source>Calling convention of '{0}' is not compatible with '{1}'.</source> <target state="translated">La convenzione di chiamata di '{0}' non è compatibile con '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_WrongNumberOfSubpatterns"> <source>Matching the tuple type '{0}' requires '{1}' subpatterns, but '{2}' subpatterns are present.</source> <target state="translated">Per la corrispondenza del tipo di tupla '{0}' sono richiesti '{1}' criteri secondari, ma ne sono presenti '{2}'.</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidInputFileName"> <source>File name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long</source> <target state="translated">Il nome file '{0}' è vuoto, contiene caratteri non validi, include una specifica di unità senza percorso assoluto oppure è troppo lungo</target> <note /> </trans-unit> <trans-unit id="IDS_AddressOfMethodGroup"> <source>&amp;method group</source> <target state="translated">gruppo di &amp;metodi</target> <note /> </trans-unit> <trans-unit id="IDS_CSCHelp"> <source> Visual C# Compiler Options - OUTPUT FILES - -out:&lt;file&gt; Specify output file name (default: base name of file with main class or first file) -target:exe Build a console executable (default) (Short form: -t:exe) -target:winexe Build a Windows executable (Short form: -t:winexe) -target:library Build a library (Short form: -t:library) -target:module Build a module that can be added to another assembly (Short form: -t:module) -target:appcontainerexe Build an Appcontainer executable (Short form: -t:appcontainerexe) -target:winmdobj Build a Windows Runtime intermediate file that is consumed by WinMDExp (Short form: -t:winmdobj) -doc:&lt;file&gt; XML Documentation file to generate -refout:&lt;file&gt; Reference assembly output to generate -platform:&lt;string&gt; Limit which platforms this code can run on: x86, Itanium, x64, arm, arm64, anycpu32bitpreferred, or anycpu. The default is anycpu. - INPUT FILES - -recurse:&lt;wildcard&gt; Include all files in the current directory and subdirectories according to the wildcard specifications -reference:&lt;alias&gt;=&lt;file&gt; Reference metadata from the specified assembly file using the given alias (Short form: -r) -reference:&lt;file list&gt; Reference metadata from the specified assembly files (Short form: -r) -addmodule:&lt;file list&gt; Link the specified modules into this assembly -link:&lt;file list&gt; Embed metadata from the specified interop assembly files (Short form: -l) -analyzer:&lt;file list&gt; Run the analyzers from this assembly (Short form: -a) -additionalfile:&lt;file list&gt; Additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings. -embed Embed all source files in the PDB. -embed:&lt;file list&gt; Embed specific files in the PDB. - RESOURCES - -win32res:&lt;file&gt; Specify a Win32 resource file (.res) -win32icon:&lt;file&gt; Use this icon for the output -win32manifest:&lt;file&gt; Specify a Win32 manifest file (.xml) -nowin32manifest Do not include the default Win32 manifest -resource:&lt;resinfo&gt; Embed the specified resource (Short form: -res) -linkresource:&lt;resinfo&gt; Link the specified resource to this assembly (Short form: -linkres) Where the resinfo format is &lt;file&gt;[,&lt;string name&gt;[,public|private]] - CODE GENERATION - -debug[+|-] Emit debugging information -debug:{full|pdbonly|portable|embedded} Specify debugging type ('full' is default, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the target .dll or .exe) -optimize[+|-] Enable optimizations (Short form: -o) -deterministic Produce a deterministic assembly (including module version GUID and timestamp) -refonly Produce a reference assembly in place of the main output -instrument:TestCoverage Produce an assembly instrumented to collect coverage information -sourcelink:&lt;file&gt; Source link info to embed into PDB. - ERRORS AND WARNINGS - -warnaserror[+|-] Report all warnings as errors -warnaserror[+|-]:&lt;warn list&gt; Report specific warnings as errors (use "nullable" for all nullability warnings) -warn:&lt;n&gt; Set warning level (0 or higher) (Short form: -w) -nowarn:&lt;warn list&gt; Disable specific warning messages (use "nullable" for all nullability warnings) -ruleset:&lt;file&gt; Specify a ruleset file that disables specific diagnostics. -errorlog:&lt;file&gt;[,version=&lt;sarif_version&gt;] Specify a file to log all compiler and analyzer diagnostics. sarif_version:{1|2|2.1} Default is 1. 2 and 2.1 both mean SARIF version 2.1.0. -reportanalyzer Report additional analyzer information, such as execution time. -skipanalyzers[+|-] Skip execution of diagnostic analyzers. - LANGUAGE - -checked[+|-] Generate overflow checks -unsafe[+|-] Allow 'unsafe' code -define:&lt;symbol list&gt; Define conditional compilation symbol(s) (Short form: -d) -langversion:? Display the allowed values for language version -langversion:&lt;string&gt; Specify language version such as `latest` (latest version, including minor versions), `default` (same as `latest`), `latestmajor` (latest version, excluding minor versions), `preview` (latest version, including features in unsupported preview), or specific versions like `6` or `7.1` -nullable[+|-] Specify nullable context option enable|disable. -nullable:{enable|disable|warnings|annotations} Specify nullable context option enable|disable|warnings|annotations. - SECURITY - -delaysign[+|-] Delay-sign the assembly using only the public portion of the strong name key -publicsign[+|-] Public-sign the assembly using only the public portion of the strong name key -keyfile:&lt;file&gt; Specify a strong name key file -keycontainer:&lt;string&gt; Specify a strong name key container -highentropyva[+|-] Enable high-entropy ASLR - MISCELLANEOUS - @&lt;file&gt; Read response file for more options -help Display this usage message (Short form: -?) -nologo Suppress compiler copyright message -noconfig Do not auto include CSC.RSP file -parallel[+|-] Concurrent build. -version Display the compiler version number and exit. - ADVANCED - -baseaddress:&lt;address&gt; Base address for the library to be built -checksumalgorithm:&lt;alg&gt; Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default). -codepage:&lt;n&gt; Specify the codepage to use when opening source files -utf8output Output compiler messages in UTF-8 encoding -main:&lt;type&gt; Specify the type that contains the entry point (ignore all other possible entry points) (Short form: -m) -fullpaths Compiler generates fully qualified paths -filealign:&lt;n&gt; Specify the alignment used for output file sections -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Specify a mapping for source path names output by the compiler. -pdb:&lt;file&gt; Specify debug information file name (default: output file name with .pdb extension) -errorendlocation Output line and column of the end location of each error -preferreduilang Specify the preferred output language name. -nosdkpath Disable searching the default SDK path for standard library assemblies. -nostdlib[+|-] Do not reference standard library (mscorlib.dll) -subsystemversion:&lt;string&gt; Specify subsystem version of this assembly -lib:&lt;file list&gt; Specify additional directories to search in for references -errorreport:&lt;string&gt; Specify how to handle internal compiler errors: prompt, send, queue, or none. The default is queue. -appconfig:&lt;file&gt; Specify an application configuration file containing assembly binding settings -moduleassemblyname:&lt;string&gt; Name of the assembly which this module will be a part of -modulename:&lt;string&gt; Specify the name of the source module -generatedfilesout:&lt;dir&gt; Place files generated during compilation in the specified directory. </source> <target state="translated"> Opzioni del compilatore Visual C# - FILE DI OUTPUT - -out:&lt;file&gt; Consente di specificare il nome del file di output (impostazione predefinita: nome di base del file con la classe principale o primo file) -target:exe Compila un file eseguibile da console (impostazione predefinita). Forma breve: -t:exe -target:winexe Compila un eseguibile Windows. Forma breve: -t:winexe -target:library Compila una libreria. Forma breve: -t:library -target:module Compila un modulo che può essere aggiunto a un altro assembly. Forma breve: -t:module -target:appcontainerexe Compila un file eseguibile Appcontainer. Forma breve: -t:appcontainerexe -target:winmdobj Compila un file Windows Runtime intermedio usato da WinMDExp. Forma breve: -t:winmdobj -doc:&lt;file&gt; File di documentazione XML da generare -refout:&lt;file&gt; Output dell'assembly di riferimento da generare -platform:&lt;stringa&gt; Limita le piattaforme in cui è possibile eseguire il codice: x86, Itanium, x64, arm, arm64, anycpu32bitpreferred o anycpu. Il valore predefinito è anycpu. - FILE DI INPUT - -recurse:&lt;caratteri_jolly&gt; Include tutti i file presenti nella directory corrente e nelle relative sottodirectory in base ai caratteri jolly specificati -reference:&lt;alias&gt;=&lt;file&gt; Crea un riferimento ai metadati dal file di assembly specificato usando l'alias indicato. Forma breve: -r -reference:&lt;elenco file&gt; Crea un riferimento ai metadati dai file di assembly specificati. Forma breve: -r -addmodule:&lt;elenco file&gt; Collega i moduli specificati in questo assembly -link:&lt;elenco file&gt; Incorpora metadati dai file di assembly di interoperabilità specificati. Forma breve: -l -analyzer:&lt;elenco file&gt; Esegue gli analizzatori dall'assembly. Forma breve: -a -additionalfile:&lt;elenco file&gt; File aggiuntivi che non influiscono direttamente sulla generazione del codice ma possono essere usati dagli analizzatori per produrre errori o avvisi. -embed Incorpora tutti i file di origine nel file PDB. -embed:&lt;elenco file&gt; Incorpora file specifici nel file PDB. - RISORSE - -win32res:&lt;file&gt; Consente di specificare un file di risorse Win32 (.res) -win32icon:&lt;file&gt; Usa questa icona per l'output -win32manifest:&lt;file&gt; Consente di specificare un file manifesto Win32 (.xml) -nowin32manifest Non include il manifesto Win32 predefinito -resource:&lt;info_risorsa&gt; Incorpora la risorsa specificata. Forma breve: -res -linkresource:&lt;info_risorsa&gt; Collega la risorsa specificata all'assembly. Forma breve: -linkres. Il formato di info_risorsa è &lt;file&gt;[,&lt;nome stringa&gt;[,public|private]] - GENERAZIONE DEL CODICE - -debug[+|-] Crea le informazioni di debug -debug:{full|pdbonly|portable|embedded} Specifica il tipo di debug ('full' è l'impostazione predefinita, 'portable' è un formato multipiattaforma, 'embedded' è un formato multipiattaforma incorporato nel file DLL o EXE di destinazione) -optimize[+|-] Abilita le ottimizzazioni. Forma breve: -o -deterministic Produce un assembly deterministico (che include GUID e timestamp della versione del modulo) -refonly Produce un assembly di riferimento al posto dell'output principale -instrument:TestCoverage Produce un assembly instrumentato per raccogliere informazioni sul code coverage -sourcelink:&lt;file&gt; Informazioni sul collegamento all'origine da incorporare nel file PDB. - ERRORI E AVVISI - -warnaserror[+|-] Segnala tutti gli avvisi come errori -warnaserror[+|-]:&lt;elenco avvisi&gt; Segnala determinati avvisi come errori (usare "nullable" per tutti gli avvisi di supporto dei valori Null) -warn:&lt;n&gt; Imposta il livello di avviso (0 o valore superiore). Forma breve: -w -nowarn:&lt;elenco avvisi&gt; Disabilita messaggi di avviso specifici (usare "nullable" per tutti gli avvisi di supporto dei valori Null) -ruleset:&lt;file&gt; Consente di specificare un file di set di regole che disabilita diagnostica specifica. -errorlog:&lt;file&gt;[,version=&lt;versione _SARIF&gt;] Consente di specificare un file in cui registrare tutte le diagnostiche del compilatore e dell'analizzatore. versione_SARIF:{1|2|2.1} L'impostazione predefinita è 1. 2 e 2.1 si riferiscono entrambi a SARIF versione 2.1.0. -reportanalyzer Restituisce informazioni aggiuntive dell'analizzatore, ad esempio il tempo di esecuzione. -skipanalyzers[+|-] Ignora l'esecuzione degli analizzatori diagnostici. - LINGUAGGIO - -checked[+|-] Genera controlli dell'overflow -unsafe[+|-] Consente codice 'unsafe' -define:&lt;elenco simboli&gt; Consente di definire simboli di compilazione condizionale. Forma breve: -d -langversion:? Visualizza i valori consentiti per la versione del linguaggio -langversion:&lt;stringa&gt; Consente di specificare la versione del linguaggio, ad esempio `latest` (ultima versione che include versioni secondarie), `default` (uguale a `latest`), `latestmajor` (ultima versione, escluse le versioni secondarie), `preview` (ultima versione, incluse le funzionalità nell'anteprima non supportata), o versioni specifiche come `6` o `7.1` -nullable[+|-] Consente di specificare l'opzione di contesto nullable enable|disable. -nullable:{enable|disable|warnings|annotations} Consente di specificare l'opzione di contesto nullable enable|disable|warnings|annotations. - SICUREZZA - -delaysign[+|-] Ritarda la firma dell'assembly usando solo la parte pubblica della chiave con nome sicuro -publicsign[+|-] Firma pubblicamente l'assembly usando solo la parte pubblica della chiave con nome sicuro -keyfile:&lt;file&gt; Consente di specificare un file di chiave con nome sicuro -keycontainer:&lt;stringa&gt; Consente di specificare un contenitore di chiavi con nome sicuro -highentropyva[+|-] Abilita ASLR a entropia elevata - VARIE - @&lt;file&gt; Legge il file di risposta per altre opzioni -help Visualizza questo messaggio relativo all'utilizzo. Forma breve: -? -nologo Non visualizza il messaggio di copyright del compilatore -noconfig Non include automaticamente il file CSC.RSP -parallel[+|-] Compilazione simultanea. -version Visualizza il numero di versione del compilatore ed esce. - AVANZATE - -baseaddress:&lt;indirizzo&gt; Indirizzo di base della libreria da compilare -checksumalgorithm:&lt;alg&gt; Consente di specificare l'algoritmo per calcolare il checksum del file di origine archiviato nel file PDB. I valori supportati sono: SHA1 o SHA256 (impostazione predefinita). -codepage:&lt;n&gt; Consente di specificare la tabella codici da usare all'apertura dei file di origine -utf8output Restituisce i messaggi del compilatore usando la codifica UTF-8 -main:&lt;tipo&gt; Consente di specificare il tipo che contiene il punto di ingresso, ignorando tutti gli altri punti di ingresso possibili. Forma breve: -m -fullpaths Il compilatore genera percorsi completi -filealign:&lt;n&gt; Consente di specificare l'allineamento usato per le sezioni del file di output -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Consente di specificare un mapping per i nomi di percorso di origine visualizzati dal compilatore. -pdb:&lt;file&gt; Consente di specificare il nome del file di informazioni di debug (impostazione predefinita: nome del file di output con estensione pdb) -errorendlocation Riga e colonna di output della posizione finale di ogni errore -preferreduilang Consente di specificare il nome del linguaggio di output preferito. -nosdkpath Disabilita la ricerca di assembly di librerie standard nel percorso predefinito dell'SDK. -nostdlib[+|-] Omette i riferimenti alla libreria standard (mscorlib.dll) -subsystemversion:&lt;stringa&gt; Consente di specificare la versione del sottosistema di questo assembly -lib:&lt;elenco file&gt; Consente di specificare le directory aggiuntive in cui cercare i riferimenti -errorreport:&lt;stringa&gt; Consente di specificare la modalità di gestione degli errori interni del compilatore: prompt, send, queue o none. L'impostazione predefinita è queue. -appconfig:&lt;file&gt; Consente di specificare un file di configurazione dell'applicazione contenente le impostazioni di binding dell'assembly -moduleassemblyname:&lt;stringa&gt; Nome dell'assembly di cui farà parte questo modulo -modulename:&lt;stringa&gt; Consente di specificare il nome del modulo di origine -generatedfilesout:&lt;dir&gt; Inserisce i file generati durante la compilazione nella directory specificata. </target> <note>Visual C# Compiler Options</note> </trans-unit> <trans-unit id="IDS_DefaultInterfaceImplementation"> <source>default interface implementation</source> <target state="translated">implementazione di interfaccia predefinita</target> <note /> </trans-unit> <trans-unit id="IDS_Disposable"> <source>disposable</source> <target state="translated">disposable</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAltInterpolatedVerbatimStrings"> <source>alternative interpolated verbatim strings</source> <target state="translated">stringhe verbatim interpolate alternative</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAndPattern"> <source>and pattern</source> <target state="translated">criterio and</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsyncUsing"> <source>asynchronous using</source> <target state="translated">using asincrono</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureCoalesceAssignmentExpression"> <source>coalescing assignment</source> <target state="translated">assegnazione di coalescenza</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureConstantInterpolatedStrings"> <source>constant interpolated strings</source> <target state="translated">stringhe interpolate costanti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDefaultTypeParameterConstraint"> <source>default type parameter constraints</source> <target state="translated">vincoli di parametro di tipo predefiniti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDelegateGenericTypeConstraint"> <source>delegate generic type constraints</source> <target state="translated">vincoli di tipo generico delegato</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureEnumGenericTypeConstraint"> <source>enum generic type constraints</source> <target state="translated">vincoli di tipo generico enumerazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionVariablesInQueriesAndInitializers"> <source>declaration of expression variables in member initializers and queries</source> <target state="translated">dichiarazione di variabili di espressione in query e inizializzatori di membri</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtendedPartialMethods"> <source>extended partial methods</source> <target state="translated">metodi parziali estesi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensibleFixedStatement"> <source>extensible fixed statement</source> <target state="translated">istruzione fixed estendibile</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensionGetAsyncEnumerator"> <source>extension GetAsyncEnumerator</source> <target state="translated">GetAsyncEnumerator dell'estensione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensionGetEnumerator"> <source>extension GetEnumerator</source> <target state="translated">GetEnumerator dell'estensione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExternLocalFunctions"> <source>extern local functions</source> <target state="translated">funzioni locali extern</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureFunctionPointers"> <source>function pointers</source> <target state="translated">puntatori a funzione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureIndexOperator"> <source>index operator</source> <target state="translated">operatore di indice</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureIndexingMovableFixedBuffers"> <source>indexing movable fixed buffers</source> <target state="translated">indicizzazione di buffer fissi mobili</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureInitOnlySetters"> <source>init-only setters</source> <target state="translated">setter di sola inizializzazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLocalFunctionAttributes"> <source>local function attributes</source> <target state="translated">attributi di funzione locale</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambdaDiscardParameters"> <source>lambda discard parameters</source> <target state="translated">parametri di rimozione lambda</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureMemberNotNull"> <source>MemberNotNull attribute</source> <target state="translated">Attributo MemberNotNull</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureModuleInitializers"> <source>module initializers</source> <target state="translated">inizializzatori di modulo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNameShadowingInNestedFunctions"> <source>name shadowing in nested functions</source> <target state="translated">shadowing dei nomi nelle funzioni annidate</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNativeInt"> <source>native-sized integers</source> <target state="translated">Integer di dimensioni native</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNestedStackalloc"> <source>stackalloc in nested expressions</source> <target state="translated">stackalloc in espressioni annidate</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNotNullGenericTypeConstraint"> <source>notnull generic type constraint</source> <target state="translated">vincolo di tipo generico notnull</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNotPattern"> <source>not pattern</source> <target state="translated">criterio not</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullPointerConstantPattern"> <source>null pointer constant pattern</source> <target state="translated">criterio per costante puntatore Null</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullableReferenceTypes"> <source>nullable reference types</source> <target state="translated">tipi riferimento nullable</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureObsoleteOnPropertyAccessor"> <source>obsolete on property accessor</source> <target state="translated">funzionalità obsoleta nella funzione di accesso proprietà</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureOrPattern"> <source>or pattern</source> <target state="translated">criterio or</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureParenthesizedPattern"> <source>parenthesized pattern</source> <target state="translated">criterio tra parentesi</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePragmaWarningEnable"> <source>warning action enable</source> <target state="translated">azione di avviso enable</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRangeOperator"> <source>range operator</source> <target state="translated">operatore di intervallo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadOnlyMembers"> <source>readonly members</source> <target state="translated">membri readonly</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRecords"> <source>records</source> <target state="translated">record</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRecursivePatterns"> <source>recursive patterns</source> <target state="translated">criteri ricorsivi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefConditional"> <source>ref conditional expression</source> <target state="translated">espressione condizionale ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefFor"> <source>ref for-loop variables</source> <target state="translated">variabili ciclo for ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefForEach"> <source>ref foreach iteration variables</source> <target state="translated">variabili di iterazione foreach ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefReassignment"> <source>ref reassignment</source> <target state="translated">riassegnazione ref</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRelationalPattern"> <source>relational pattern</source> <target state="translated">criterio relazionale</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStackAllocInitializer"> <source>stackalloc initializer</source> <target state="translated">inizializzatore stackalloc</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticAnonymousFunction"> <source>static anonymous function</source> <target state="translated">funzione anonima statica</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticLocalFunctions"> <source>static local functions</source> <target state="translated">funzioni locali statiche</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureSwitchExpression"> <source>&lt;switch expression&gt;</source> <target state="translated">&lt;espressione switch&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTargetTypedConditional"> <source>target-typed conditional expression</source> <target state="translated">espressione condizionale con tipo di destinazione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTupleEquality"> <source>tuple equality</source> <target state="translated">uguaglianza tuple</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTypePattern"> <source>type pattern</source> <target state="translated">criterio di tipo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator"> <source>unconstrained type parameters in null coalescing operator</source> <target state="translated">parametri di tipo senza vincoli nell'operatore Null di coalescenza</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUnmanagedConstructedTypes"> <source>unmanaged constructed types</source> <target state="translated">tipi costruiti non gestiti</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUnmanagedGenericTypeConstraint"> <source>unmanaged generic type constraints</source> <target state="translated">vincoli di tipo generico unmanaged</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUsingDeclarations"> <source>using declarations</source> <target state="translated">dichiarazioni using</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureVarianceSafetyForStaticInterfaceMembers"> <source>variance safety for static interface members</source> <target state="translated">sicurezza della varianza per i membri di interfaccia statici</target> <note /> </trans-unit> <trans-unit id="IDS_NULL"> <source>&lt;null&gt;</source> <target state="translated">&lt;Null&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_OverrideWithConstraints"> <source>constraints for override and explicit interface implementation methods</source> <target state="translated">vincoli per i metodi di override e di implementazione esplicita dell'interfaccia</target> <note /> </trans-unit> <trans-unit id="IDS_Parameter"> <source>parameter</source> <target state="translated">parametro</target> <note /> </trans-unit> <trans-unit id="IDS_Return"> <source>return</source> <target state="translated">restituito</target> <note /> </trans-unit> <trans-unit id="IDS_ThrowExpression"> <source>&lt;throw expression&gt;</source> <target state="translated">&lt;espressione throw&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_RELATEDERROR"> <source>(Location of symbol related to previous error)</source> <target state="translated">(Posizione del simbolo relativo all'errore precedente)</target> <note /> </trans-unit> <trans-unit id="IDS_RELATEDWARNING"> <source>(Location of symbol related to previous warning)</source> <target state="translated">(Posizione del simbolo relativo all'avviso precedente)</target> <note /> </trans-unit> <trans-unit id="IDS_TopLevelStatements"> <source>top-level statements</source> <target state="translated">istruzioni di primo livello</target> <note /> </trans-unit> <trans-unit id="IDS_XMLIGNORED"> <source>&lt;!-- Badly formed XML comment ignored for member "{0}" --&gt;</source> <target state="translated">&lt;!-- Badly formed XML comment ignored for member "{0}" --&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_XMLIGNORED2"> <source> Badly formed XML file "{0}" cannot be included </source> <target state="translated"> Il formato XML non è valido. Non è possibile includere il file "{0}" </target> <note /> </trans-unit> <trans-unit id="IDS_XMLFAILEDINCLUDE"> <source> Failed to insert some or all of included XML </source> <target state="translated"> Non è stato possibile inserire alcuni o tutti gli XML inclusi </target> <note /> </trans-unit> <trans-unit id="IDS_XMLBADINCLUDE"> <source> Include tag is invalid </source> <target state="translated"> Il tag di inclusione non è valido </target> <note /> </trans-unit> <trans-unit id="IDS_XMLNOINCLUDE"> <source> No matching elements were found for the following include tag </source> <target state="translated"> Elemento corrispondente non trovato per il seguente tag di inclusione </target> <note /> </trans-unit> <trans-unit id="IDS_XMLMISSINGINCLUDEFILE"> <source>Missing file attribute</source> <target state="translated">Manca l'attributo file</target> <note /> </trans-unit> <trans-unit id="IDS_XMLMISSINGINCLUDEPATH"> <source>Missing path attribute</source> <target state="translated">Manca l'attributo path</target> <note /> </trans-unit> <trans-unit id="IDS_GlobalNamespace"> <source>&lt;global namespace&gt;</source> <target state="translated">&lt;spazio dei nomi globale&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGenerics"> <source>generics</source> <target state="translated">generics</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAnonDelegates"> <source>anonymous methods</source> <target state="translated">metodi anonimi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureModuleAttrLoc"> <source>module as an attribute target specifier</source> <target state="translated">modulo come un identificatore di destinazione dell'attributo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureGlobalNamespace"> <source>namespace alias qualifier</source> <target state="translated">qualificatore di alias dello spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureFixedBuffer"> <source>fixed size buffers</source> <target state="translated">buffer a dimensione fissa</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePragma"> <source>#pragma</source> <target state="translated">#pragma</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureStaticClasses"> <source>static classes</source> <target state="translated">classi statiche</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadOnlyStructs"> <source>readonly structs</source> <target state="translated">struct di sola lettura</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePartialTypes"> <source>partial types</source> <target state="translated">tipi parziali</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsync"> <source>async function</source> <target state="translated">funzione asincrona</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureSwitchOnBool"> <source>switch on boolean type</source> <target state="translated">opzione su tipo booleano</target> <note /> </trans-unit> <trans-unit id="IDS_MethodGroup"> <source>method group</source> <target state="translated">gruppo di metodi</target> <note /> </trans-unit> <trans-unit id="IDS_AnonMethod"> <source>anonymous method</source> <target state="translated">metodo anonimo</target> <note /> </trans-unit> <trans-unit id="IDS_Lambda"> <source>lambda expression</source> <target state="translated">espressione lambda</target> <note /> </trans-unit> <trans-unit id="IDS_Collection"> <source>collection</source> <target state="translated">raccolta</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePropertyAccessorMods"> <source>access modifiers on properties</source> <target state="translated">modificatori di accesso sulle proprietà</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExternAlias"> <source>extern alias</source> <target state="translated">alias extern</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureIterators"> <source>iterators</source> <target state="translated">iteratori</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDefault"> <source>default operator</source> <target state="translated">operatore predefinito</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDefaultLiteral"> <source>default literal</source> <target state="translated">valore letterale predefinito</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePrivateProtected"> <source>private protected</source> <target state="translated">private protected</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullable"> <source>nullable types</source> <target state="translated">tipi nullable</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePatternMatching"> <source>pattern matching</source> <target state="translated">criteri di ricerca</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedAccessor"> <source>expression body property accessor</source> <target state="translated">funzione di accesso alla proprietà del corpo dell'espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedDeOrConstructor"> <source>expression body constructor and destructor</source> <target state="translated">costruttore e decostruttore del corpo dell'espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureThrowExpression"> <source>throw expression</source> <target state="translated">espressione throw</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImplicitArray"> <source>implicitly typed array</source> <target state="translated">matrice tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureImplicitLocal"> <source>implicitly typed local variable</source> <target state="translated">variabile locale tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAnonymousTypes"> <source>anonymous types</source> <target state="translated">tipi anonimi</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAutoImplementedProperties"> <source>automatically implemented properties</source> <target state="translated">proprietà implementate automaticamente</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadonlyAutoImplementedProperties"> <source>readonly automatically implemented properties</source> <target state="translated">proprietà implementate automaticamente di sola lettura</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureObjectInitializer"> <source>object initializer</source> <target state="translated">inizializzatore di oggetto</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureCollectionInitializer"> <source>collection initializer</source> <target state="translated">inizializzatore di raccolta</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureQueryExpression"> <source>query expression</source> <target state="translated">espressione di query</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExtensionMethod"> <source>extension method</source> <target state="translated">metodo di estensione</target> <note /> </trans-unit> <trans-unit id="IDS_FeaturePartialMethod"> <source>partial method</source> <target state="translated">metodo parziale</target> <note /> </trans-unit> <trans-unit id="IDS_SK_METHOD"> <source>method</source> <target state="translated">metodo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_TYPE"> <source>type</source> <target state="translated">tipo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_NAMESPACE"> <source>namespace</source> <target state="translated">spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="IDS_SK_FIELD"> <source>field</source> <target state="translated">campo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_PROPERTY"> <source>property</source> <target state="translated">proprietà</target> <note /> </trans-unit> <trans-unit id="IDS_SK_UNKNOWN"> <source>element</source> <target state="translated">elemento</target> <note /> </trans-unit> <trans-unit id="IDS_SK_VARIABLE"> <source>variable</source> <target state="translated">variabile</target> <note /> </trans-unit> <trans-unit id="IDS_SK_LABEL"> <source>label</source> <target state="translated">etichetta</target> <note /> </trans-unit> <trans-unit id="IDS_SK_EVENT"> <source>event</source> <target state="translated">evento</target> <note /> </trans-unit> <trans-unit id="IDS_SK_TYVAR"> <source>type parameter</source> <target state="translated">parametro di tipo</target> <note /> </trans-unit> <trans-unit id="IDS_SK_ALIAS"> <source>using alias</source> <target state="translated">Using Alias</target> <note /> </trans-unit> <trans-unit id="IDS_SK_EXTERNALIAS"> <source>extern alias</source> <target state="translated">alias extern</target> <note /> </trans-unit> <trans-unit id="IDS_SK_CONSTRUCTOR"> <source>constructor</source> <target state="translated">costruttore</target> <note /> </trans-unit> <trans-unit id="IDS_FOREACHLOCAL"> <source>foreach iteration variable</source> <target state="translated">variabile di iterazione foreach</target> <note /> </trans-unit> <trans-unit id="IDS_FIXEDLOCAL"> <source>fixed variable</source> <target state="translated">variabile fixed</target> <note /> </trans-unit> <trans-unit id="IDS_USINGLOCAL"> <source>using variable</source> <target state="translated">variabile using</target> <note /> </trans-unit> <trans-unit id="IDS_Contravariant"> <source>contravariant</source> <target state="translated">controvariante</target> <note /> </trans-unit> <trans-unit id="IDS_Contravariantly"> <source>contravariantly</source> <target state="translated">in controvarianza</target> <note /> </trans-unit> <trans-unit id="IDS_Covariant"> <source>covariant</source> <target state="translated">covariante</target> <note /> </trans-unit> <trans-unit id="IDS_Covariantly"> <source>covariantly</source> <target state="translated">in covarianza</target> <note /> </trans-unit> <trans-unit id="IDS_Invariantly"> <source>invariantly</source> <target state="translated">in invarianza</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDynamic"> <source>dynamic</source> <target state="translated">dinamico</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNamedArgument"> <source>named argument</source> <target state="translated">argomento denominato</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureOptionalParameter"> <source>optional parameter</source> <target state="translated">parametro facoltativo</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExceptionFilter"> <source>exception filter</source> <target state="translated">filtro eccezioni</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTypeVariance"> <source>type variance</source> <target state="translated">varianza dei tipi</target> <note /> </trans-unit> <trans-unit id="NotSameNumberParameterTypesAndRefKinds"> <source>Given {0} parameter types and {1} parameter ref kinds. These arrays must have the same length.</source> <target state="translated">Sono stati specificati {0} tipi di parametro e {1} tipi di modificatore ref di parametro. Queste matrici devono avere la stessa lunghezza.</target> <note /> </trans-unit> <trans-unit id="OutIsNotValidForReturn"> <source>'RefKind.Out' is not a valid ref kind for a return type.</source> <target state="translated">'RefKind.Out' non è un tipo di modificatore ref valido per un tipo restituito.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFound"> <source>SyntaxTree is not part of the compilation</source> <target state="translated">L'elemento SyntaxTree non fa parte della compilazione</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFoundToRemove"> <source>SyntaxTree is not part of the compilation, so it cannot be removed</source> <target state="translated">L'elemento SyntaxTree non fa parte della compilazione, di conseguenza non può essere rimosso</target> <note /> </trans-unit> <trans-unit id="WRN_CaseConstantNamedUnderscore"> <source>The name '_' refers to the constant, not the discard pattern. Use 'var _' to discard the value, or '@_' to refer to a constant by that name.</source> <target state="translated">Il nome '_' fa riferimento alla costante e non al criterio di eliminazione. Usare 'var _' per eliminare il valore oppure '@_' per fare riferimento a una costante in base a tale nome.</target> <note /> </trans-unit> <trans-unit id="WRN_CaseConstantNamedUnderscore_Title"> <source>Do not use '_' for a case constant.</source> <target state="translated">Non usare '_' per una costante di case.</target> <note /> </trans-unit> <trans-unit id="WRN_ConstOutOfRangeChecked"> <source>Constant value '{0}' may overflow '{1}' at runtime (use 'unchecked' syntax to override)</source> <target state="translated">Con il valore di costante '{0}' può verificarsi un overflow di '{1}' in fase di esecuzione. Usare la sintassi 'unchecked' per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="WRN_ConstOutOfRangeChecked_Title"> <source>Constant value may overflow at runtime (use 'unchecked' syntax to override)</source> <target state="translated">Con il valore di costante può verificarsi un overflow in fase di esecuzione. Usare la sintassi 'unchecked' per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="WRN_ConvertingNullableToNonNullable"> <source>Converting null literal or possible null value to non-nullable type.</source> <target state="translated">Conversione del valore letterale Null o di un possibile valore Null in un tipo che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ConvertingNullableToNonNullable_Title"> <source>Converting null literal or possible null value to non-nullable type.</source> <target state="translated">Conversione del valore letterale Null o di un possibile valore Null in un tipo che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_DisallowNullAttributeForbidsMaybeNullAssignment"> <source>A possible null value may not be used for a type marked with [NotNull] or [DisallowNull]</source> <target state="translated">Un possibile valore Null non può essere usato per un tipo contrassegnato con [NotNull] o [DisallowNull]</target> <note /> </trans-unit> <trans-unit id="WRN_DisallowNullAttributeForbidsMaybeNullAssignment_Title"> <source>A possible null value may not be used for a type marked with [NotNull] or [DisallowNull]</source> <target state="translated">Un possibile valore Null non può essere usato per un tipo contrassegnato con [NotNull] o [DisallowNull]</target> <note /> </trans-unit> <trans-unit id="WRN_DoesNotReturnMismatch"> <source>Method '{0}' lacks `[DoesNotReturn]` annotation to match implemented or overridden member.</source> <target state="translated">Nel metodo '{0}' manca l'annotazione `[DoesNotReturn]` per la corrispondenza del membro implementato o di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_DoesNotReturnMismatch_Title"> <source>Method lacks `[DoesNotReturn]` annotation to match implemented or overridden member.</source> <target state="translated">Nel metodo manca l'annotazione `[DoesNotReturn]` per la corrispondenza del membro implementato o di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList"> <source>'{0}' is already listed in the interface list on type '{1}' with different nullability of reference types.</source> <target state="translated">'{0}' è già inclusa nell'elenco di interfacce nel tipo '{1}' con diverso supporto dei valori Null per i tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList_Title"> <source>Interface is already listed in the interface list with different nullability of reference types.</source> <target state="translated">L'interfaccia è già inclusa nell'elenco di interfacce con diverso supporto dei valori Null per i tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration"> <source>Generator '{0}' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Il generatore '{0}' non è riuscito a generare l'origine. Non verrà aggiunto come contributo all'output e potrebbero verificarsi errori di compilazione. Eccezione di tipo '{1}'. Messaggio '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Il generatore dell'analizzatore ha generato l'eccezione seguente: '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Title"> <source>Generator failed to generate source.</source> <target state="translated">Il generatore non è riuscito a generare l'origine.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization"> <source>Generator '{0}' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Non è stato possibile inizializzare il generatore '{0}'. Non verrà aggiunto come contributo all'output e potrebbero verificarsi errori di compilazione. Eccezione di tipo '{1}'. Messaggio '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Il generatore dell'analizzatore ha generato l'eccezione seguente: '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Title"> <source>Generator failed to initialize.</source> <target state="translated">Non è stato possibile inizializzare il generatore.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesConstant"> <source>The given expression always matches the provided constant.</source> <target state="translated">L'espressione specificata corrisponde sempre alla costante fornita.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesConstant_Title"> <source>The given expression always matches the provided constant.</source> <target state="translated">L'espressione specificata corrisponde sempre alla costante fornita.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesPattern"> <source>The given expression always matches the provided pattern.</source> <target state="translated">L'espressione specificata corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionAlwaysMatchesPattern_Title"> <source>The given expression always matches the provided pattern.</source> <target state="translated">L'espressione specificata corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionNeverMatchesPattern"> <source>The given expression never matches the provided pattern.</source> <target state="translated">L'espressione specificata non corrisponde mai al criterio fornito.</target> <note /> </trans-unit> <trans-unit id="WRN_GivenExpressionNeverMatchesPattern_Title"> <source>The given expression never matches the provided pattern.</source> <target state="translated">L'espressione specificata non corrisponde mai al criterio fornito.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitCopyInReadOnlyMember"> <source>Call to non-readonly member '{0}' from a 'readonly' member results in an implicit copy of '{1}'.</source> <target state="translated">La chiamata a un membro '{0}' non readonly da un membro 'readonly' comporta una copia esplicita di '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitCopyInReadOnlyMember_Title"> <source>Call to non-readonly member from a 'readonly' member results in an implicit copy.</source> <target state="translated">La chiamata a un membro non readonly da un membro 'readonly' comporta una copia esplicita.</target> <note /> </trans-unit> <trans-unit id="WRN_IsPatternAlways"> <source>An expression of type '{0}' always matches the provided pattern.</source> <target state="translated">Un'espressione di tipo '{0}' corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_IsPatternAlways_Title"> <source>The input always matches the provided pattern.</source> <target state="translated">L'input corrisponde sempre al criterio specificato.</target> <note /> </trans-unit> <trans-unit id="WRN_IsTypeNamedUnderscore"> <source>The name '_' refers to the type '{0}', not the discard pattern. Use '@_' for the type, or 'var _' to discard.</source> <target state="translated">Il nome '_' fa riferimento al tipo '{0}' e non al criterio di eliminazione. Usare '@_' per il tipo oppure 'var _' per eliminare.</target> <note /> </trans-unit> <trans-unit id="WRN_IsTypeNamedUnderscore_Title"> <source>Do not use '_' to refer to the type in an is-type expression.</source> <target state="translated">Non usare '_' per fare riferimento al tipo in un'espressione is-type.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNull"> <source>Member '{0}' must have a non-null value when exiting.</source> <target state="translated">Il membro '{0}' deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullBadMember"> <source>Member '{0}' cannot be used in this attribute.</source> <target state="translated">Non è possibile usare il membro '{0}' in questo attributo.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullBadMember_Title"> <source>Member cannot be used in this attribute.</source> <target state="translated">Non è possibile usare il membro in questo attributo.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullWhen"> <source>Member '{0}' must have a non-null value when exiting with '{1}'.</source> <target state="translated">Il membro '{0}' deve avere un valore non Null quando viene terminato con '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNullWhen_Title"> <source>Member must have a non-null value when exiting in some condition.</source> <target state="translated">Il membro deve avere un valore non Null quando viene terminato in determinate condizioni.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberNotNull_Title"> <source>Member must have a non-null value when exiting.</source> <target state="translated">Il membro deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotation"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice in un contesto di annotations '#nullable'.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotationInGeneratedCode"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice all'interno di un contesto di annotazioni '#nullable'. Il codice generato automaticamente richiede una direttiva '#nullable' esplicita nell'origine.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotationInGeneratedCode_Title"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice all'interno di un contesto di annotazioni '#nullable'. Il codice generato automaticamente richiede una direttiva '#nullable' esplicita nell'origine.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingNonNullTypesContextForAnnotation_Title"> <source>The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.</source> <target state="translated">L'annotazione per i tipi riferimento nullable deve essere usata solo nel codice in un contesto di annotations '#nullable'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullAsNonNullable"> <source>Cannot convert null literal to non-nullable reference type.</source> <target state="translated">Non è possibile convertire il valore letterale Null in tipo riferimento che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullAsNonNullable_Title"> <source>Cannot convert null literal to non-nullable reference type.</source> <target state="translated">Non è possibile convertire il valore letterale Null in tipo riferimento che non ammette i valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceArgument"> <source>Possible null reference argument for parameter '{0}' in '{1}'.</source> <target state="translated">Possibile argomento di riferimento Null per il parametro '{0}' in '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceArgument_Title"> <source>Possible null reference argument.</source> <target state="translated">Possibile argomento di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceAssignment"> <source>Possible null reference assignment.</source> <target state="translated">Possibile assegnazione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceAssignment_Title"> <source>Possible null reference assignment.</source> <target state="translated">Possibile assegnazione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceInitializer"> <source>Object or collection initializer implicitly dereferences possibly null member '{0}'.</source> <target state="translated">L'inizializzatore di oggetto o di raccolta dereferenzia in modo implicito il membro Null '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceInitializer_Title"> <source>Object or collection initializer implicitly dereferences possibly null member.</source> <target state="translated">L'inizializzatore di oggetto o di raccolta dereferenzia in modo implicito il membro Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReceiver"> <source>Dereference of a possibly null reference.</source> <target state="translated">Dereferenziamento di un possibile riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReceiver_Title"> <source>Dereference of a possibly null reference.</source> <target state="translated">Dereferenziamento di un possibile riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReturn"> <source>Possible null reference return.</source> <target state="translated">Possibile restituzione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullReferenceReturn_Title"> <source>Possible null reference return.</source> <target state="translated">Possibile restituzione di riferimento Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgument"> <source>Argument of type '{0}' cannot be used for parameter '{2}' of type '{1}' in '{3}' due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento di tipo '{0}' per il parametro '{2}' di tipo '{1}' in '{3}' a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgumentForOutput"> <source>Argument of type '{0}' cannot be used as an output of type '{1}' for parameter '{2}' in '{3}' due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento di tipo '{0}' come output del tipo '{1}' per il parametro '{2}' in '{3}' a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgumentForOutput_Title"> <source>Argument cannot be used as an output for parameter due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento come output per il parametro a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInArgument_Title"> <source>Argument cannot be used for parameter due to differences in the nullability of reference types.</source> <target state="translated">Non è possibile usare l'argomento per il parametro a causa delle differenze nel supporto dei valori Null dei tipi riferimento.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInAssignment"> <source>Nullability of reference types in value of type '{0}' doesn't match target type '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel valore di tipo '{0}' non corrisponde al tipo di destinazione '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInAssignment_Title"> <source>Nullability of reference types in value doesn't match target type.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel valore non corrisponde al tipo di destinazione.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnImplicitImplementation"> <source>Nullability in constraints for type parameter '{0}' of method '{1}' doesn't match the constraints for type parameter '{2}' of interface method '{3}'. Consider using an explicit interface implementation instead.</source> <target state="translated">Il supporto dei valori Null nei vincoli per il parametro di tipo '{0}' del metodo '{1}' non corrisponde ai vincoli per il parametro di tipo '{2}' del metodo di interfaccia '{3}'. Provare a usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnImplicitImplementation_Title"> <source>Nullability in constraints for type parameter doesn't match the constraints for type parameter in implicitly implemented interface method'.</source> <target state="translated">Il supporto dei valori Null nei vincoli del parametro di tipo non corrisponde ai vincoli per il parametro di tipo nel metodo di interfaccia implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation"> <source>Partial method declarations of '{0}' have inconsistent nullability in constraints for type parameter '{1}'</source> <target state="translated">Le dichiarazioni di metodo parziali di '{0}' contengono un supporto dei valori Null incoerente nei vincoli per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInConstraintsOnPartialImplementation_Title"> <source>Partial method declarations have inconsistent nullability in constraints for type parameter</source> <target state="translated">Le dichiarazioni di metodo parziali contengono un supporto dei valori Null incoerente nei vincoli per il parametro di tipo</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface"> <source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nell'identificatore di interfaccia esplicito non corrisponde all'interfaccia implementata dal tipo.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInExplicitlyImplementedInterface_Title"> <source>Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nell'identificatore di interfaccia esplicito non corrisponde all'interfaccia implementata dal tipo.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInInterfaceImplementedByBase"> <source>'{0}' does not implement interface member '{1}'. Nullability of reference types in interface implemented by the base type doesn't match.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. Il supporto dei valori Null dei tipi riferimento nell'interfaccia implementata dal tipo di base non corrisponde.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInInterfaceImplementedByBase_Title"> <source>Type does not implement interface member. Nullability of reference types in interface implemented by the base type doesn't match.</source> <target state="translated">Il tipo non implementa il membro di interfaccia. Il supporto dei valori Null dei tipi riferimento nell'interfaccia implementata dal tipo di base non corrisponde.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOfTargetDelegate"> <source>Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match the target delegate '{2}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' di '{1}' non corrisponde al delegato di destinazione '{2}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOfTargetDelegate_Title"> <source>Nullability of reference types in type of parameter doesn't match the target delegate (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al delegato di destinazione, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' doesn't match implemented member '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde al membro implementato '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match implicitly implemented member '{2}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' di '{1}' non corrisponde al membro implementato in modo implicito '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implicitly implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnOverride"> <source>Nullability of reference types in type of parameter '{0}' doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnOverride_Title"> <source>Nullability of reference types in type of parameter doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnPartial"> <source>Nullability of reference types in type of parameter '{0}' doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInParameterTypeOnPartial_Title"> <source>Nullability of reference types in type of parameter doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOfTargetDelegate"> <source>Nullability of reference types in return type of '{0}' doesn't match the target delegate '{1}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito di '{0}' non corrisponde al delegato di destinazione '{1}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOfTargetDelegate_Title"> <source>Nullability of reference types in return type doesn't match the target delegate (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al delegato di destinazione, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation"> <source>Nullability of reference types in return type doesn't match implemented member '{0}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation"> <source>Nullability of reference types in return type of '{0}' doesn't match implicitly implemented member '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito di '{0}' non corrisponde al membro implementato in modo implicito '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implicitly implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnOverride"> <source>Nullability of reference types in return type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnOverride_Title"> <source>Nullability of reference types in return type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnPartial"> <source>Nullability of reference types in return type doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInReturnTypeOnPartial_Title"> <source>Nullability of reference types in return type doesn't match partial method declaration.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde alla dichiarazione di metodo parziale.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnExplicitImplementation"> <source>Nullability of reference types in type doesn't match implemented member '{0}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro implementato '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in type doesn't match implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro implementato.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnImplicitImplementation"> <source>Nullability of reference types in type of '{0}' doesn't match implicitly implemented member '{1}'.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di '{0}' non corrisponde al membro implementato in modo implicito '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in type doesn't match implicitly implemented member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro implementato in modo implicito.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnOverride"> <source>Nullability of reference types in type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeOnOverride_Title"> <source>Nullability of reference types in type doesn't match overridden member.</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo non corrisponde al membro di cui è stato eseguito l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterConstraint"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. Nullability of type argument '{3}' doesn't match constraint type '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Il supporto dei valori Null dell'argomento di tipo '{3}' non corrisponde al tipo di vincolo '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterConstraint_Title"> <source>The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match constraint type.</source> <target state="translated">Non è possibile usare il tipo come parametro di tipo nel tipo generico o nel metodo. Il supporto dei valori Null dell'argomento tipo non corrisponde al tipo di vincolo.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterNotNullConstraint"> <source>The type '{2}' cannot be used as type parameter '{1}' in the generic type or method '{0}'. Nullability of type argument '{2}' doesn't match 'notnull' constraint.</source> <target state="translated">Non è possibile usare il tipo '{2}' come parametro di tipo '{1}' nel tipo generico o nel metodo '{0}'. Il supporto dei valori Null dell'argomento tipo '{2}' non corrisponde al vincolo 'notnull'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterNotNullConstraint_Title"> <source>The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'notnull' constraint.</source> <target state="translated">Non è possibile usare il tipo come parametro di tipo nel tipo generico o nel metodo. Il supporto dei valori Null dell'argomento tipo non corrisponde al vincolo 'notnull'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint"> <source>The type '{2}' cannot be used as type parameter '{1}' in the generic type or method '{0}'. Nullability of type argument '{2}' doesn't match 'class' constraint.</source> <target state="translated">Non è possibile usare il tipo '{2}' come parametro di tipo '{1}' nel tipo generico o nel metodo '{0}'. Il supporto dei valori Null dell'argomento tipo '{2}' non corrisponde al vincolo 'class'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint_Title"> <source>The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'class' constraint.</source> <target state="translated">Non è possibile usare il tipo come parametro di tipo nel tipo generico o nel metodo. Il supporto dei valori Null dell'argomento tipo non corrisponde al vincolo 'class'.</target> <note /> </trans-unit> <trans-unit id="WRN_NullableValueTypeMayBeNull"> <source>Nullable value type may be null.</source> <target state="translated">Il tipo valore nullable non può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_NullableValueTypeMayBeNull_Title"> <source>Nullable value type may be null.</source> <target state="translated">Il tipo valore nullable non può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ParamUnassigned"> <source>The out parameter '{0}' must be assigned to before control leaves the current method</source> <target state="translated">Il parametro out '{0}' deve essere assegnato prima che il controllo lasci il metodo corrente</target> <note /> </trans-unit> <trans-unit id="WRN_ParamUnassigned_Title"> <source>An out parameter must be assigned to before control leaves the method</source> <target state="translated">È necessario assegnare un parametro out prima che il controllo esca dal metodo</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterConditionallyDisallowsNull"> <source>Parameter '{0}' must have a non-null value when exiting with '{1}'.</source> <target state="translated">Il parametro '{0}' deve avere un valore non Null quando viene terminato con '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterConditionallyDisallowsNull_Title"> <source>Parameter must have a non-null value when exiting in some condition.</source> <target state="translated">Il parametro deve avere un valore non Null quando viene terminato in determinate condizioni.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterDisallowsNull"> <source>Parameter '{0}' must have a non-null value when exiting.</source> <target state="translated">Il parametro '{0}' deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterDisallowsNull_Title"> <source>Parameter must have a non-null value when exiting.</source> <target state="translated">Il parametro deve avere un valore non Null quando viene terminato.</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterIsStaticClass"> <source>'{0}': static types cannot be used as parameters</source> <target state="translated">'{0}': i tipi statici non possono essere usati come parametri</target> <note /> </trans-unit> <trans-unit id="WRN_ParameterIsStaticClass_Title"> <source>Static types cannot be used as parameters</source> <target state="translated">I tipi statici non possono essere usati come parametri</target> <note /> </trans-unit> <trans-unit id="WRN_PrecedenceInversion"> <source>Operator '{0}' cannot be used here due to precedence. Use parentheses to disambiguate.</source> <target state="translated">A causa della precedenza, non è possibile usare l'operatore '{0}' in questo punto. Usare le parentesi per evitare ambiguità.</target> <note /> </trans-unit> <trans-unit id="WRN_PrecedenceInversion_Title"> <source>Operator cannot be used here due to precedence.</source> <target state="translated">A causa della precedenza, non è possibile usare l'operatore in questo punto.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternNotPublicOrNotInstance"> <source>'{0}' does not implement the '{1}' pattern. '{2}' is not a public instance or extension method.</source> <target state="translated">'{0}' non implementa il criterio '{1}'. '{2}' non è un metodo di estensione o istanza pubblico.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternNotPublicOrNotInstance_Title"> <source>Type does not implement the collection pattern; member is is not a public instance or extension method.</source> <target state="translated">Il tipo non implementa il criterio di raccolta. Il membro non è un metodo di estensione o istanza pubblico.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeIsStaticClass"> <source>'{0}': static types cannot be used as return types</source> <target state="translated">'{0}': i tipi statici non possono essere usati come tipi restituiti</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeIsStaticClass_Title"> <source>Static types cannot be used as return types</source> <target state="translated">I tipi statici non possono essere usati come tipi restituiti</target> <note /> </trans-unit> <trans-unit id="WRN_ShouldNotReturn"> <source>A method marked [DoesNotReturn] should not return.</source> <target state="translated">Un metodo contrassegnato con [DoesNotReturn] non deve essere terminare normalmente.</target> <note /> </trans-unit> <trans-unit id="WRN_ShouldNotReturn_Title"> <source>A method marked [DoesNotReturn] should not return.</source> <target state="translated">Un metodo contrassegnato con [DoesNotReturn] non deve essere terminare normalmente.</target> <note /> </trans-unit> <trans-unit id="WRN_StaticInAsOrIs"> <source>The second operand of an 'is' or 'as' operator may not be static type '{0}'</source> <target state="translated">Il secondo operando di un operatore 'is' o 'as' non può essere di tipo statico '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_StaticInAsOrIs_Title"> <source>The second operand of an 'is' or 'as' operator may not be a static type</source> <target state="translated">Il secondo operando di un operatore 'is' o 'as' non può essere un tipo statico</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustive"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '{0}' is not covered.</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNull"> <source>The switch expression does not handle some null inputs (it is not exhaustive). For example, the pattern '{0}' is not covered.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNullWithWhen"> <source>The switch expression does not handle some null inputs (it is not exhaustive). For example, the pattern '{0}' is not covered. However, a pattern with a 'when' clause might successfully match this value.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto. Un criterio con una clausola 'when' potrebbe però corrispondere a questo valore.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNullWithWhen_Title"> <source>The switch expression does not handle some null inputs.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveForNull_Title"> <source>The switch expression does not handle some null inputs.</source> <target state="translated">L'espressione switch non gestisce alcuni input Null.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithWhen"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '{0}' is not covered. However, a pattern with a 'when' clause might successfully match this value.</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva). Ad esempio, il criterio '{0}' non è coperto. Un criterio con una clausola 'when' potrebbe però corrispondere a questo valore.</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustiveWithWhen_Title"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive).</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva).</target> <note /> </trans-unit> <trans-unit id="WRN_SwitchExpressionNotExhaustive_Title"> <source>The switch expression does not handle all possible values of its input type (it is not exhaustive).</source> <target state="translated">L'espressione switch non gestisce tutti i possibili valori del relativo tipo di input (non è esaustiva).</target> <note /> </trans-unit> <trans-unit id="WRN_ThrowPossibleNull"> <source>Thrown value may be null.</source> <target state="translated">Il valore generato può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_ThrowPossibleNull_Title"> <source>Thrown value may be null.</source> <target state="translated">Il valore generato può essere Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' doesn't match implemented member '{1}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' non corrisponde al membro implementato '{1}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation"> <source>Nullability of reference types in type of parameter '{0}' of '{1}' doesn't match implicitly implemented member '{2}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro '{0}' di '{1}' non corrisponde al membro implementato in modo implicito '{2}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo di parametro non corrisponde al membro implementato in modo implicito, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride"> <source>Nullability of type of parameter '{0}' doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo del parametro '{0}' non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride_Title"> <source>Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo del parametro non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation"> <source>Nullability of reference types in return type doesn't match implemented member '{0}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato '{0}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation"> <source>Nullability of reference types in return type of '{0}' doesn't match implicitly implemented member '{1}' (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito di '{0}' non corrisponde al membro implementato in modo implicito '{1}', probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation_Title"> <source>Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null dei tipi riferimento nel tipo restituito non corrisponde al membro implementato in modo implicito, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride"> <source>Nullability of return type doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo restituito non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride_Title"> <source>Nullability of return type doesn't match overridden member (possibly because of nullability attributes).</source> <target state="translated">Il supporto dei valori Null del tipo restituito non corrisponde al membro di cui è stato eseguito l'override, probabilmente a causa degli attributi del supporto dei valori Null.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleBinopLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified on the other side of the tuple == or != operator.</source> <target state="translated">Il nome dell'elemento di tupla '{0}' viene ignorato perché nell'altra parte dell'operatore == o != di tupla è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleBinopLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator.</source> <target state="translated">Il nome dell'elemento di tupla viene ignorato perché nell'altra parte dell'operatore == o != di tupla è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterMethodTypeParameter"> <source>Type parameter '{0}' has the same name as the type parameter from outer method '{1}'</source> <target state="translated">Il nome del parametro di tipo '{0}' è uguale a quello del parametro di tipo del metodo esterno '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterMethodTypeParameter_Title"> <source>Type parameter has the same type as the type parameter from outer method.</source> <target state="translated">Il tipo del parametro di tipo è lo stesso del parametro di tipo del metodo esterno.</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThis"> <source>Field '{0}' must be fully assigned before control is returned to the caller</source> <target state="translated">Il campo '{0}' deve essere assegnato completamente prima che il controllo venga restituito al chiamante</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThisAutoProperty"> <source>Auto-implemented property '{0}' must be fully assigned before control is returned to the caller.</source> <target state="translated">La proprietà implementata automaticamente '{0}' deve essere completamente assegnata prima che il controllo venga restituito al chiamante.</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThisAutoProperty_Title"> <source>An auto-implemented property must be fully assigned before control is returned to the caller.</source> <target state="translated">È necessario assegnare completamente una proprietà implementata automaticamente prima che il controllo venga restituito al chiamante.</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedThis_Title"> <source>Fields of a struct must be fully assigned in a constructor before control is returned to the caller</source> <target state="translated">È necessario assegnare completamente i campi di uno struct in un costruttore prima che il controllo venga restituito al chiamante</target> <note /> </trans-unit> <trans-unit id="WRN_UnboxPossibleNull"> <source>Unboxing a possibly null value.</source> <target state="translated">Conversione unboxing di un possibile valore Null.</target> <note /> </trans-unit> <trans-unit id="WRN_UnboxPossibleNull_Title"> <source>Unboxing a possibly null value.</source> <target state="translated">Conversione unboxing di un possibile valore Null.</target> <note /> </trans-unit> <trans-unit id="WRN_UnconsumedEnumeratorCancellationAttributeUsage"> <source>The EnumeratorCancellationAttribute applied to parameter '{0}' will have no effect. The attribute is only effective on a parameter of type CancellationToken in an async-iterator method returning IAsyncEnumerable</source> <target state="translated">L'attributo EnumeratorCancellationAttribute applicato al parametro '{0}' non avrà alcun effetto. L'attributo ha effetto solo su un parametro di tipo CancellationToken in un metodo di iteratore asincrono che restituisce IAsyncEnumerable</target> <note /> </trans-unit> <trans-unit id="WRN_UnconsumedEnumeratorCancellationAttributeUsage_Title"> <source>The EnumeratorCancellationAttribute will have no effect. The attribute is only effective on a parameter of type CancellationToken in an async-iterator method returning IAsyncEnumerable</source> <target state="translated">L'attributo EnumeratorCancellationAttribute non avrà alcun effetto. L'attributo ha effetto solo su un parametro di tipo CancellationToken in un metodo di iteratore asincrono che restituisce IAsyncEnumerable</target> <note /> </trans-unit> <trans-unit id="WRN_UndecoratedCancellationTokenParameter"> <source>Async-iterator '{0}' has one or more parameters of type 'CancellationToken' but none of them is decorated with the 'EnumeratorCancellation' attribute, so the cancellation token parameter from the generated 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' will be unconsumed</source> <target state="translated">L'elemento '{0}' di iteratore asincrono include uno o più parametri di tipo 'CancellationToken', ma nessuno di essi è decorato con l'attributo 'EnumeratorCancellation', di conseguenza il parametro del token di annullamento restituito dall'elemento 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' generato non verrà utilizzato</target> <note /> </trans-unit> <trans-unit id="WRN_UndecoratedCancellationTokenParameter_Title"> <source>Async-iterator member has one or more parameters of type 'CancellationToken' but none of them is decorated with the 'EnumeratorCancellation' attribute, so the cancellation token parameter from the generated 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' will be unconsumed</source> <target state="translated">Il membro di iteratore asincrono include uno o più parametri di tipo 'CancellationToken', ma nessuno di essi è decorato con l'attributo 'EnumeratorCancellation', di conseguenza il parametro del token di annullamento restituito dall'elemento 'IAsyncEnumerable&lt;&gt;.GetAsyncEnumerator' generato non verrà utilizzato</target> <note /> </trans-unit> <trans-unit id="WRN_UninitializedNonNullableField"> <source>Non-nullable {0} '{1}' must contain a non-null value when exiting constructor. Consider declaring the {0} as nullable.</source> <target state="translated">L'elemento {0} '{1}' non nullable deve contenere un valore non Null all'uscita dal costruttore. Provare a dichiarare {0} come nullable.</target> <note /> </trans-unit> <trans-unit id="WRN_UninitializedNonNullableField_Title"> <source>Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.</source> <target state="translated">Il campo non nullable deve contenere un valore non Null all'uscita dal costruttore. Provare a dichiararlo come nullable.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreadRecordParameter"> <source>Parameter '{0}' is unread. Did you forget to use it to initialize the property with that name?</source> <target state="translated">Il parametro '{0}' non è stato letto. Si è dimenticato di usarlo per inizializzare la proprietà con tale nome?</target> <note /> </trans-unit> <trans-unit id="WRN_UnreadRecordParameter_Title"> <source>Parameter is unread. Did you forget to use it to initialize the property with that name?</source> <target state="translated">Il parametro non è stato letto. Si è dimenticato di usarlo per inizializzare la proprietà con tale nome?</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolation"> <source>Use of unassigned local variable '{0}'</source> <target state="translated">Uso della variabile locale '{0}' non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationField"> <source>Use of possibly unassigned field '{0}'</source> <target state="translated">Uso del campo '{0}' probabilmente non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationField_Title"> <source>Use of possibly unassigned field</source> <target state="translated">Uso del campo probabilmente non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationOut"> <source>Use of unassigned out parameter '{0}'</source> <target state="translated">Uso del parametro out '{0}' non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationOut_Title"> <source>Use of unassigned out parameter</source> <target state="translated">Uso del parametro out non assegnato</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationProperty"> <source>Use of possibly unassigned auto-implemented property '{0}'</source> <target state="translated">Uso della proprietà implementata automaticamente '{0}' probabilmente non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationProperty_Title"> <source>Use of possibly unassigned auto-implemented property</source> <target state="translated">Uso della proprietà implementata automaticamente probabilmente non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationThis"> <source>The 'this' object cannot be used before all of its fields have been assigned</source> <target state="translated">Non è possibile usare l'oggetto 'this' prima dell'assegnazione di tutti i relativi campi</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolationThis_Title"> <source>The 'this' object cannot be used in a constructor before all of its fields have been assigned</source> <target state="translated">Non è possibile usare l'oggetto 'this' in un costruttore prima dell'assegnazione di tutti i relativi campi</target> <note /> </trans-unit> <trans-unit id="WRN_UseDefViolation_Title"> <source>Use of unassigned local variable</source> <target state="translated">Uso della variabile locale non assegnata</target> <note /> </trans-unit> <trans-unit id="XML_InvalidToken"> <source>The character(s) '{0}' cannot be used at this location.</source> <target state="translated">Non è possibile usare il carattere o i caratteri '{0}' in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_IncorrectComment"> <source>Incorrect syntax was used in a comment.</source> <target state="translated">In un commento è stato usata sintassi errata.</target> <note /> </trans-unit> <trans-unit id="XML_InvalidCharEntity"> <source>An invalid character was found inside an entity reference.</source> <target state="translated">All'interno di un riferimento di entità è stato trovato un carattere non valido.</target> <note /> </trans-unit> <trans-unit id="XML_ExpectedEndOfTag"> <source>Expected '&gt;' or '/&gt;' to close tag '{0}'.</source> <target state="translated">È previsto '&gt;' o '/&gt;' come tag di chiusura '{0}'.</target> <note /> </trans-unit> <trans-unit id="XML_ExpectedIdentifier"> <source>An identifier was expected.</source> <target state="translated">Era previsto un identificatore.</target> <note /> </trans-unit> <trans-unit id="XML_InvalidUnicodeChar"> <source>Invalid unicode character.</source> <target state="translated">Il carattere Unicode non è valido.</target> <note /> </trans-unit> <trans-unit id="XML_InvalidWhitespace"> <source>Whitespace is not allowed at this location.</source> <target state="translated">Lo spazio vuoto non è consentito in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_LessThanInAttributeValue"> <source>The character '&lt;' cannot be used in an attribute value.</source> <target state="translated">Non è possibile usare il carattere '&lt;' in un valore di attributo.</target> <note /> </trans-unit> <trans-unit id="XML_MissingEqualsAttribute"> <source>Missing equals sign between attribute and attribute value.</source> <target state="translated">Manca il segno di uguale tra l'attributo e il valore di attributo.</target> <note /> </trans-unit> <trans-unit id="XML_RefUndefinedEntity_1"> <source>Reference to undefined entity '{0}'.</source> <target state="translated">Riferimento a un'entità '{0}' non definita.</target> <note /> </trans-unit> <trans-unit id="XML_StringLiteralNoStartQuote"> <source>A string literal was expected, but no opening quotation mark was found.</source> <target state="translated">Era previsto un valore letterale di tipo stringa, ma non sono state trovate virgolette inglesi aperte.</target> <note /> </trans-unit> <trans-unit id="XML_StringLiteralNoEndQuote"> <source>Missing closing quotation mark for string literal.</source> <target state="translated">Mancano le virgolette inglesi chiuse per il valore letterale di tipo stringa.</target> <note /> </trans-unit> <trans-unit id="XML_StringLiteralNonAsciiQuote"> <source>Non-ASCII quotations marks may not be used around string literals.</source> <target state="translated">Non è possibile usare virgolette non ASCII per racchiudere valori letterali di tipo stringa.</target> <note /> </trans-unit> <trans-unit id="XML_EndTagNotExpected"> <source>End tag was not expected at this location.</source> <target state="translated">Il tag finale non era previsto in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_ElementTypeMatch"> <source>End tag '{0}' does not match the start tag '{1}'.</source> <target state="translated">Il tag finale '{0}' non corrisponde al tag iniziale '{1}'.</target> <note /> </trans-unit> <trans-unit id="XML_EndTagExpected"> <source>Expected an end tag for element '{0}'.</source> <target state="translated">È previsto un tag finale per l'elemento '{0}'.</target> <note /> </trans-unit> <trans-unit id="XML_WhitespaceMissing"> <source>Required white space was missing.</source> <target state="translated">Manca lo spazio vuoto obbligatorio.</target> <note /> </trans-unit> <trans-unit id="XML_ExpectedEndOfXml"> <source>Unexpected character at this location.</source> <target state="translated">Il carattere non è previsto in questa posizione.</target> <note /> </trans-unit> <trans-unit id="XML_CDataEndTagNotAllowed"> <source>The literal string ']]&gt;' is not allowed in element content.</source> <target state="translated">La stringa letterale ']]&gt;' non è consentita nel contenuto dell'elemento.</target> <note /> </trans-unit> <trans-unit id="XML_DuplicateAttribute"> <source>Duplicate '{0}' attribute</source> <target state="translated">L'attributo '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_NoMetadataFile"> <source>Metadata file '{0}' could not be found</source> <target state="translated">Il file di metadati '{0}' non è stato trovato</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataReferencesNotSupported"> <source>Metadata references are not supported.</source> <target state="translated">I riferimenti ai metadati non sono supportati.</target> <note /> </trans-unit> <trans-unit id="FTL_MetadataCantOpenFile"> <source>Metadata file '{0}' could not be opened -- {1}</source> <target state="translated">Non è possibile aprire il file di metadati '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeDef"> <source>The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'.</source> <target state="translated">Il tipo '{0}' è definito in un assembly di cui manca il riferimento. Aggiungere un riferimento all'assembly '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeDefFromModule"> <source>The type '{0}' is defined in a module that has not been added. You must add the module '{1}'.</source> <target state="translated">Il tipo '{0}' è definito in un modulo che non è stato ancora aggiunto. È necessario aggiungere il modulo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OutputWriteFailed"> <source>Could not write to output file '{0}' -- '{1}'</source> <target state="translated">Non è possibile scrivere nel file di output '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEntryPoints"> <source>Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.</source> <target state="translated">Nel programma è definito più di un punto di ingresso. Compilare con /main per specificare il tipo contenente il punto di ingresso.</target> <note /> </trans-unit> <trans-unit id="ERR_BadBinaryOps"> <source>Operator '{0}' cannot be applied to operands of type '{1}' and '{2}'</source> <target state="translated">Non è possibile applicare l'operatore '{0}' a operandi di tipo '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_IntDivByZero"> <source>Division by constant zero</source> <target state="translated">Divisione per la costante zero</target> <note /> </trans-unit> <trans-unit id="ERR_BadIndexLHS"> <source>Cannot apply indexing with [] to an expression of type '{0}'</source> <target state="translated">Non è possibile applicare l'indicizzazione con [] a un'espressione di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadIndexCount"> <source>Wrong number of indices inside []; expected {0}</source> <target state="translated">Il numero di indici in [] è errato. Il numero previsto è {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadUnaryOp"> <source>Operator '{0}' cannot be applied to operand of type '{1}'</source> <target state="translated">Non è possibile applicare l'operatore '{0}' all'operando di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ThisInStaticMeth"> <source>Keyword 'this' is not valid in a static property, static method, or static field initializer</source> <target state="translated">La parola chiave 'this' non può essere utilizzata in una proprietà statica, in un metodo statico o nell'inizializzatore di un campo statico</target> <note /> </trans-unit> <trans-unit id="ERR_ThisInBadContext"> <source>Keyword 'this' is not available in the current context</source> <target state="translated">La parola chiave 'this' non è disponibile nel contesto corrente</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidMainSig"> <source>'{0}' has the wrong signature to be an entry point</source> <target state="translated">'{0}' non può essere un punto di ingresso perché la firma è errata</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidMainSig_Title"> <source>Method has the wrong signature to be an entry point</source> <target state="translated">Il metodo non può essere un punto di ingresso perché la firma è errata</target> <note /> </trans-unit> <trans-unit id="ERR_NoImplicitConv"> <source>Cannot implicitly convert type '{0}' to '{1}'</source> <target state="translated">Non è possibile convertire in modo implicito il tipo '{0}' in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitConv"> <source>Cannot convert type '{0}' to '{1}'</source> <target state="translated">Non è possibile convertire il tipo '{0}' in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstOutOfRange"> <source>Constant value '{0}' cannot be converted to a '{1}'</source> <target state="translated">Non è possibile convertire il valore costante '{0}' in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigBinaryOps"> <source>Operator '{0}' is ambiguous on operands of type '{1}' and '{2}'</source> <target state="translated">L'operatore '{0}' è ambiguo su operandi di tipo '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigUnaryOp"> <source>Operator '{0}' is ambiguous on an operand of type '{1}'</source> <target state="translated">L'operatore '{0}' è ambiguo su un operando di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_InAttrOnOutParam"> <source>An out parameter cannot have the In attribute</source> <target state="translated">Un parametro out non può avere l'attributo In</target> <note /> </trans-unit> <trans-unit id="ERR_ValueCantBeNull"> <source>Cannot convert null to '{0}' because it is a non-nullable value type</source> <target state="translated">Non è possibile convertire Null in '{0}' perché è un tipo valore che non ammette i valori Null</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitBuiltinConv"> <source>Cannot convert type '{0}' to '{1}' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion</source> <target state="translated">Non è possibile convertire il tipo '{0}' in '{1}' tramite una conversione di riferimenti, una conversione boxing, una conversione unboxing, una conversione wrapping o una conversione del tipo Null</target> <note /> </trans-unit> <trans-unit id="FTL_DebugEmitFailure"> <source>Unexpected error writing debug information -- '{0}'</source> <target state="translated">Si è verificato un errore imprevisto durante la scrittura delle informazioni di debug - '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisReturnType"> <source>Inconsistent accessibility: return type '{1}' is less accessible than method '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo restituito '{1}' è meno accessibile del metodo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisParamType"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than method '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile del metodo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisFieldType"> <source>Inconsistent accessibility: field type '{1}' is less accessible than field '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di campo '{1}' è meno accessibile del campo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisPropertyType"> <source>Inconsistent accessibility: property type '{1}' is less accessible than property '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di proprietà '{1}' è meno accessibile della proprietà '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisIndexerReturn"> <source>Inconsistent accessibility: indexer return type '{1}' is less accessible than indexer '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di indicizzatore restituito '{1}' è meno accessibile dell'indicizzatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisIndexerParam"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than indexer '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile dell'indicizzatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisOpReturn"> <source>Inconsistent accessibility: return type '{1}' is less accessible than operator '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo restituito '{1}' è meno accessibile dell'operatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisOpParam"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than operator '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile dell'operatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisDelegateReturn"> <source>Inconsistent accessibility: return type '{1}' is less accessible than delegate '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo restituito '{1}' è meno accessibile del delegato '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisDelegateParam"> <source>Inconsistent accessibility: parameter type '{1}' is less accessible than delegate '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo parametro '{1}' è meno accessibile del delegato '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisBaseClass"> <source>Inconsistent accessibility: base class '{1}' is less accessible than class '{0}'</source> <target state="translated">Accessibilità incoerente: la classe base '{1}' è meno accessibile della classe '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisBaseInterface"> <source>Inconsistent accessibility: base interface '{1}' is less accessible than interface '{0}'</source> <target state="translated">Accessibilità incoerente: l'interfaccia di base '{1}' è meno accessibile dell'interfaccia '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_EventNeedsBothAccessors"> <source>'{0}': event property must have both add and remove accessors</source> <target state="translated">'{0}': la proprietà dell'evento deve avere entrambe le funzioni di accesso add e remove</target> <note /> </trans-unit> <trans-unit id="ERR_EventNotDelegate"> <source>'{0}': event must be of a delegate type</source> <target state="translated">'{0}': l'evento deve essere di un tipo delegato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedEvent"> <source>The event '{0}' is never used</source> <target state="translated">L'evento '{0}' non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedEvent_Title"> <source>Event is never used</source> <target state="translated">L'evento non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceEventInitializer"> <source>'{0}': instance event in interface cannot have initializer</source> <target state="translated">'{0}': l'evento di istanza nell'interfaccia non può avere inizializzatori</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventUsage"> <source>The event '{0}' can only appear on the left hand side of += or -= (except when used from within the type '{1}')</source> <target state="translated">L'evento '{0}' può essere specificato solo sul lato sinistro di += o di -= (tranne quando è usato dall'interno del tipo '{1}')</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitEventFieldImpl"> <source>An explicit interface implementation of an event must use event accessor syntax</source> <target state="translated">Per l'implementazione esplicita dell'interfaccia di un evento è necessario utilizzare la sintassi della funzione di accesso agli eventi</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonEvent"> <source>'{0}': cannot override; '{1}' is not an event</source> <target state="translated">'{0}': non è possibile eseguire l'override. '{1}' non è un evento</target> <note /> </trans-unit> <trans-unit id="ERR_AddRemoveMustHaveBody"> <source>An add or remove accessor must have a body</source> <target state="translated">Una funzione di accesso add o remove deve avere un corpo</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractEventInitializer"> <source>'{0}': abstract event cannot have initializer</source> <target state="translated">'{0}': l'evento astratto non può avere inizializzatori</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedAssemblyName"> <source>The assembly name '{0}' is reserved and cannot be used as a reference in an interactive session</source> <target state="translated">Il nome di assembly '{0}' è riservato e non può essere usato come riferimento in una sessione interattiva</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedEnumerator"> <source>The enumerator name '{0}' is reserved and cannot be used</source> <target state="translated">Il nome dell'enumeratore '{0}' è riservato e non può essere usato</target> <note /> </trans-unit> <trans-unit id="ERR_AsMustHaveReferenceType"> <source>The as operator must be used with a reference type or nullable type ('{0}' is a non-nullable value type)</source> <target state="translated">L'operatore as deve essere usato con un tipo riferimento o con un tipo che ammette i valori Null ('{0}' è un tipo valore che non ammette i valori Null)</target> <note /> </trans-unit> <trans-unit id="WRN_LowercaseEllSuffix"> <source>The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity</source> <target state="translated">Il suffisso 'l' è facilmente confondibile con il numero '1': per maggiore chiarezza utilizzare 'L'</target> <note /> </trans-unit> <trans-unit id="WRN_LowercaseEllSuffix_Title"> <source>The 'l' suffix is easily confused with the digit '1'</source> <target state="translated">Il suffisso 'l' è facilmente confondibile con il numero '1'</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventUsageNoField"> <source>The event '{0}' can only appear on the left hand side of += or -=</source> <target state="translated">L'evento '{0}' può essere specificato solo sul lato sinistro di += o di -=</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintOnlyAllowedOnGenericDecl"> <source>Constraints are not allowed on non-generic declarations</source> <target state="translated">Vincoli non consentiti su dichiarazioni non generiche</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMustBeIdentifier"> <source>Type parameter declaration must be an identifier not a type</source> <target state="translated">La dichiarazione del parametro di tipo deve essere un identificatore anziché un tipo</target> <note /> </trans-unit> <trans-unit id="ERR_MemberReserved"> <source>Type '{1}' already reserves a member called '{0}' with the same parameter types</source> <target state="translated">Il tipo '{1}' riserva già un membro denominato '{0}' con gli stessi tipi di parametro</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParamName"> <source>The parameter name '{0}' is a duplicate</source> <target state="translated">Il nome di parametro '{0}' è un duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNameInNS"> <source>The namespace '{1}' already contains a definition for '{0}'</source> <target state="translated">Lo spazio dei nomi '{1}' contiene già una definizione per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNameInClass"> <source>The type '{0}' already contains a definition for '{1}'</source> <target state="translated">Il tipo '{0}' contiene già una definizione per '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotInContext"> <source>The name '{0}' does not exist in the current context</source> <target state="translated">Il nome '{0}' non esiste nel contesto corrente</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotInContextPossibleMissingReference"> <source>The name '{0}' does not exist in the current context (are you missing a reference to assembly '{1}'?)</source> <target state="translated">Il nome '{0}' non esiste nel contesto corrente. Probabilmente manca un riferimento all'assembly '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigContext"> <source>'{0}' is an ambiguous reference between '{1}' and '{2}'</source> <target state="translated">'{0}' è un riferimento ambiguo tra '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateUsing"> <source>The using directive for '{0}' appeared previously in this namespace</source> <target state="translated">La direttiva using per '{0}' è già presente in questo spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateUsing_Title"> <source>Using directive appeared previously in this namespace</source> <target state="translated">La direttiva using è già presente in questo spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="ERR_BadMemberFlag"> <source>The modifier '{0}' is not valid for this item</source> <target state="translated">Il modificatore '{0}' non è valido per questo elemento</target> <note /> </trans-unit> <trans-unit id="ERR_BadMemberProtection"> <source>More than one protection modifier</source> <target state="translated">Sono presenti più modificatori di protezione</target> <note /> </trans-unit> <trans-unit id="WRN_NewRequired"> <source>'{0}' hides inherited member '{1}'. Use the new keyword if hiding was intended.</source> <target state="translated">'{0}' nasconde il membro ereditato '{1}'. Se questo comportamento è intenzionale, usare la parola chiave new.</target> <note /> </trans-unit> <trans-unit id="WRN_NewRequired_Title"> <source>Member hides inherited member; missing new keyword</source> <target state="translated">Il membro nasconde il membro ereditato. Manca la parola chiave new</target> <note /> </trans-unit> <trans-unit id="WRN_NewRequired_Description"> <source>A variable was declared with the same name as a variable in a base type. However, the new keyword was not used. This warning informs you that you should use new; the variable is declared as if new had been used in the declaration.</source> <target state="translated">È stata dichiarata una variabile con lo stesso nome di una variabile in un tipo di base, tuttavia non è stata usata la parola chiave new. Questo avviso informa l'utente che è necessario usare new. La variabile viene dichiarata come se nella dichiarazione fosse stata usata la parola chiave new.</target> <note /> </trans-unit> <trans-unit id="WRN_NewNotRequired"> <source>The member '{0}' does not hide an accessible member. The new keyword is not required.</source> <target state="translated">Il membro '{0}' non nasconde un membro accessibile. La parola chiave new non è obbligatoria.</target> <note /> </trans-unit> <trans-unit id="WRN_NewNotRequired_Title"> <source>Member does not hide an inherited member; new keyword is not required</source> <target state="translated">Il membro non nasconde un membro ereditato. La parola chiave new non è obbligatoria</target> <note /> </trans-unit> <trans-unit id="ERR_CircConstValue"> <source>The evaluation of the constant value for '{0}' involves a circular definition</source> <target state="translated">La valutazione del valore della costante per '{0}' implica una definizione circolare</target> <note /> </trans-unit> <trans-unit id="ERR_MemberAlreadyExists"> <source>Type '{1}' already defines a member called '{0}' with the same parameter types</source> <target state="translated">Il tipo '{1}' definisce già un membro denominato '{0}' con gli stessi tipi di parametro</target> <note /> </trans-unit> <trans-unit id="ERR_StaticNotVirtual"> <source>A static member cannot be marked as '{0}'</source> <target state="needs-review-translation">Un membro statico '{0}' non può essere contrassegnato come override, virtual o abstract</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotNew"> <source>A member '{0}' marked as override cannot be marked as new or virtual</source> <target state="translated">Un membro '{0}' contrassegnato come override non può essere contrassegnato come new o virtual</target> <note /> </trans-unit> <trans-unit id="WRN_NewOrOverrideExpected"> <source>'{0}' hides inherited member '{1}'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.</source> <target state="translated">'{0}' nasconde il membro ereditato '{1}'. Per consentire al membro corrente di eseguire l'override di tale implementazione, aggiungere la parola chiave override; altrimenti aggiungere la parola chiave new.</target> <note /> </trans-unit> <trans-unit id="WRN_NewOrOverrideExpected_Title"> <source>Member hides inherited member; missing override keyword</source> <target state="translated">Il membro nasconde il membro ereditato. Manca la parola chiave override</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotExpected"> <source>'{0}': no suitable method found to override</source> <target state="translated">'{0}': non sono stati trovati metodi appropriati per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceUnexpected"> <source>A namespace cannot directly contain members such as fields, methods or statements</source> <target state="needs-review-translation">Uno spazio dei nomi non può contenere direttamente membri come campi o metodi</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuchMember"> <source>'{0}' does not contain a definition for '{1}'</source> <target state="translated">'{0}' non contiene una definizione per '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadSKknown"> <source>'{0}' is a {1} but is used like a {2}</source> <target state="translated">'{0}' è {1} ma è usato come {2}</target> <note /> </trans-unit> <trans-unit id="ERR_BadSKunknown"> <source>'{0}' is a {1}, which is not valid in the given context</source> <target state="translated">'{0}' è un '{1}', che non è un costrutto valido nel contesto specificato</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectRequired"> <source>An object reference is required for the non-static field, method, or property '{0}'</source> <target state="translated">È necessario un riferimento all'oggetto per la proprietà, il metodo o il campo non statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigCall"> <source>The call is ambiguous between the following methods or properties: '{0}' and '{1}'</source> <target state="translated">La chiamata è ambigua tra i seguenti metodi o proprietà: '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAccess"> <source>'{0}' is inaccessible due to its protection level</source> <target state="translated">'{0}' non è accessibile a causa del livello di protezione</target> <note /> </trans-unit> <trans-unit id="ERR_MethDelegateMismatch"> <source>No overload for '{0}' matches delegate '{1}'</source> <target state="translated">Nessun overload per '{0}' corrisponde al delegato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RetObjectRequired"> <source>An object of a type convertible to '{0}' is required</source> <target state="translated">È necessario un oggetto di un tipo convertibile in '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_RetNoObjectRequired"> <source>Since '{0}' returns void, a return keyword must not be followed by an object expression</source> <target state="translated">Poiché '{0}' restituisce un valore nullo, una parola chiave di restituzione non deve essere seguita da un'espressione di oggetto</target> <note /> </trans-unit> <trans-unit id="ERR_LocalDuplicate"> <source>A local variable or function named '{0}' is already defined in this scope</source> <target state="translated">In questo ambito è già definita una funzione o una variabile locale denominata '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AssgLvalueExpected"> <source>The left-hand side of an assignment must be a variable, property or indexer</source> <target state="translated">La parte sinistra di un'assegnazione deve essere una variabile, una proprietà o un indicizzatore</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstParam"> <source>'{0}': a static constructor must be parameterless</source> <target state="translated">'{0}': un costruttore statico non deve avere parametri</target> <note /> </trans-unit> <trans-unit id="ERR_NotConstantExpression"> <source>The expression being assigned to '{0}' must be constant</source> <target state="translated">L'espressione da assegnare a '{0}' deve essere costante</target> <note /> </trans-unit> <trans-unit id="ERR_NotNullConstRefField"> <source>'{0}' is of type '{1}'. A const field of a reference type other than string can only be initialized with null.</source> <target state="translated">'{0}' è di tipo '{1}'. Il campo const di un tipo riferimento diverso da stringa può essere inizializzato solo con Null.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalIllegallyOverrides"> <source>A local or parameter named '{0}' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter</source> <target state="translated">Non è possibile dichiarare in questo ambito una variabile locale o un parametro denominato '{0}' perché tale nome viene usato in un ambito locale di inclusione per definire una variabile locale o un parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadUsingNamespace"> <source>A 'using namespace' directive can only be applied to namespaces; '{0}' is a type not a namespace. Consider a 'using static' directive instead</source> <target state="translated">Una direttiva using dello spazio dei nomi può essere applicata solo a spazi dei nomi. '{0}' è un tipo, non uno spazio dei nomi. Provare a usare una direttiva 'using static'</target> <note /> </trans-unit> <trans-unit id="ERR_BadUsingType"> <source>A 'using static' directive can only be applied to types; '{0}' is a namespace not a type. Consider a 'using namespace' directive instead</source> <target state="translated">Una direttiva 'using static' può essere applicata solo a tipi. '{0}' è uno spazio dei nomi, non un tipo. Provare a usare una direttiva 'using namespace'</target> <note /> </trans-unit> <trans-unit id="ERR_NoAliasHere"> <source>A 'using static' directive cannot be used to declare an alias</source> <target state="translated">Non è possibile usare una direttiva 'using static' per dichiarare un alias</target> <note /> </trans-unit> <trans-unit id="ERR_NoBreakOrCont"> <source>No enclosing loop out of which to break or continue</source> <target state="translated">Non esiste alcun ciclo di inclusione all'esterno del quale interrompere o continuare</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLabel"> <source>The label '{0}' is a duplicate</source> <target state="translated">L'etichetta '{0}' è un duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstructors"> <source>The type '{0}' has no constructors defined</source> <target state="translated">Per il tipo '{0}' non sono definiti costruttori</target> <note /> </trans-unit> <trans-unit id="ERR_NoNewAbstract"> <source>Cannot create an instance of the abstract type or interface '{0}'</source> <target state="translated">Non è possibile creare un'istanza dell'interfaccia o del tipo astratto '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstValueRequired"> <source>A const field requires a value to be provided</source> <target state="translated">È necessario specificare un valore nel campo const</target> <note /> </trans-unit> <trans-unit id="ERR_CircularBase"> <source>Circular base type dependency involving '{0}' and '{1}'</source> <target state="translated">Dipendenza circolare del tipo di base che interessa '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateConstructor"> <source>The delegate '{0}' does not have a valid constructor</source> <target state="translated">Il delegato '{0}' non ha un costruttore valido</target> <note /> </trans-unit> <trans-unit id="ERR_MethodNameExpected"> <source>Method name expected</source> <target state="translated">È previsto il nome di un metodo</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantExpected"> <source>A constant value is expected</source> <target state="translated">È previsto un valore costante</target> <note /> </trans-unit> <trans-unit id="ERR_V6SwitchGoverningTypeValueExpected"> <source>A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type in C# 6 and earlier.</source> <target state="translated">L'espressione switch o l'etichetta case deve essere un tipo bool, char, string, integrale, enum o un tipo nullable corrispondente in C# 6 e versioni precedenti.</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralTypeValueExpected"> <source>A value of an integral type expected</source> <target state="translated">È previsto un valore di tipo integrale</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateCaseLabel"> <source>The switch statement contains multiple cases with the label value '{0}'</source> <target state="translated">L'istruzione switch contiene più usi di maiuscole/minuscole con il valore di etichetta '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidGotoCase"> <source>A goto case is only valid inside a switch statement</source> <target state="translated">La sintassi goto case è valida soltanto all'interno di un'istruzione switch</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyLacksGet"> <source>The property or indexer '{0}' cannot be used in this context because it lacks the get accessor</source> <target state="translated">Non è possibile usare la proprietà o l'indicizzatore '{0}' in questo contesto perché manca la funzione di accesso get</target> <note /> </trans-unit> <trans-unit id="ERR_BadExceptionType"> <source>The type caught or thrown must be derived from System.Exception</source> <target state="translated">Il tipo rilevato o generato deve derivare da System.Exception</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyThrow"> <source>A throw statement with no arguments is not allowed outside of a catch clause</source> <target state="translated">L'utilizzo dell'istruzione throw senza argomenti non è consentito all'esterno di una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadFinallyLeave"> <source>Control cannot leave the body of a finally clause</source> <target state="translated">Il controllo non può lasciare il corpo di una clausola finally</target> <note /> </trans-unit> <trans-unit id="ERR_LabelShadow"> <source>The label '{0}' shadows another label by the same name in a contained scope</source> <target state="translated">L'etichetta '{0}' è la replica di un'altra etichetta con lo stesso nome in un ambito contenuto</target> <note /> </trans-unit> <trans-unit id="ERR_LabelNotFound"> <source>No such label '{0}' within the scope of the goto statement</source> <target state="translated">L'etichetta '{0}' non esiste nell'ambito dell'istruzione goto</target> <note /> </trans-unit> <trans-unit id="ERR_UnreachableCatch"> <source>A previous catch clause already catches all exceptions of this or of a super type ('{0}')</source> <target state="translated">Una clausola catch precedente rileva già tutte le eccezioni del tipo this o super ('{0}')</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantTrue"> <source>Filter expression is a constant 'true', consider removing the filter</source> <target state="translated">L'espressione di filtro è una costante 'true'. Provare a rimuovere il filtro</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantTrue_Title"> <source>Filter expression is a constant 'true'</source> <target state="translated">L'espressione di filtro è una costante 'true'</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnExpected"> <source>'{0}': not all code paths return a value</source> <target state="translated">'{0}': non tutti i percorsi del codice restituiscono un valore</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode"> <source>Unreachable code detected</source> <target state="translated">È stato rilevato codice non raggiungibile</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode_Title"> <source>Unreachable code detected</source> <target state="translated">È stato rilevato codice non raggiungibile</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchFallThrough"> <source>Control cannot fall through from one case label ('{0}') to another</source> <target state="translated">Il controllo non può passare da un'etichetta case ('{0}') a un'altra</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLabel"> <source>This label has not been referenced</source> <target state="translated">Non è stato fatto riferimento a questa etichetta</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLabel_Title"> <source>This label has not been referenced</source> <target state="translated">Non è stato fatto riferimento a questa etichetta</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolation"> <source>Use of unassigned local variable '{0}'</source> <target state="translated">Uso della variabile locale '{0}' non assegnata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVar"> <source>The variable '{0}' is declared but never used</source> <target state="translated">La variabile '{0}' è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVar_Title"> <source>Variable is declared but never used</source> <target state="translated">La variabile è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedField"> <source>The field '{0}' is never used</source> <target state="translated">Il campo '{0}' non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedField_Title"> <source>Field is never used</source> <target state="translated">Il campo non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationField"> <source>Use of possibly unassigned field '{0}'</source> <target state="translated">Uso del campo '{0}' probabilmente non assegnato</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationProperty"> <source>Use of possibly unassigned auto-implemented property '{0}'</source> <target state="translated">Uso della proprietà implementata automaticamente '{0}' probabilmente non assegnata</target> <note /> </trans-unit> <trans-unit id="ERR_UnassignedThis"> <source>Field '{0}' must be fully assigned before control is returned to the caller</source> <target state="translated">Il campo '{0}' deve essere assegnato completamente prima che il controllo venga restituito al chiamante</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigQM"> <source>Type of conditional expression cannot be determined because '{0}' and '{1}' implicitly convert to one another</source> <target state="translated">Non è possibile determinare il tipo di espressione condizionale perché '{0}' e '{1}' sono reciprocamente convertibili in modo implicito</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidQM"> <source>Type of conditional expression cannot be determined because there is no implicit conversion between '{0}' and '{1}'</source> <target state="translated">Non è possibile determinare il tipo di espressione condizionale perché non esiste conversione implicita tra '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoBaseClass"> <source>A base class is required for a 'base' reference</source> <target state="translated">È necessaria una classe base per il riferimento 'base'</target> <note /> </trans-unit> <trans-unit id="ERR_BaseIllegal"> <source>Use of keyword 'base' is not valid in this context</source> <target state="translated">Utilizzo della parola chiave 'base' non valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectProhibited"> <source>Member '{0}' cannot be accessed with an instance reference; qualify it with a type name instead</source> <target state="translated">Non è possibile accedere al membro '{0}' con un riferimento all'istanza. Qualificarlo con un nome di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_ParamUnassigned"> <source>The out parameter '{0}' must be assigned to before control leaves the current method</source> <target state="translated">Il parametro out '{0}' deve essere assegnato prima che il controllo lasci il metodo corrente</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidArray"> <source>Invalid rank specifier: expected ',' or ']'</source> <target state="translated">L'identificatore del numero di dimensioni non è valido: è previsto ',' o ']'</target> <note /> </trans-unit> <trans-unit id="ERR_ExternHasBody"> <source>'{0}' cannot be extern and declare a body</source> <target state="translated">'{0}' non può essere di tipo extern e dichiarare un corpo</target> <note /> </trans-unit> <trans-unit id="ERR_ExternHasConstructorInitializer"> <source>'{0}' cannot be extern and have a constructor initializer</source> <target state="translated">'{0}' non può essere di tipo extern e contenere un inizializzatore di costruttore</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractAndExtern"> <source>'{0}' cannot be both extern and abstract</source> <target state="translated">'{0}' non può essere contemporaneamente di tipo extern e abstract</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeParamType"> <source>Attribute constructor parameter '{0}' has type '{1}', which is not a valid attribute parameter type</source> <target state="translated">Il tipo del parametro di costruttore di attributo '{0}' è '{1}' che però non è un tipo di parametro di attributo valido</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeArgument"> <source>An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type</source> <target state="translated">L'argomento di un attributo deve essere un'espressione costante, un'espressione typeof o un'espressione per la creazione di matrici di un tipo di parametro dell'attributo</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeParamDefaultArgument"> <source>Attribute constructor parameter '{0}' is optional, but no default parameter value was specified.</source> <target state="translated">Il parametro di costruttore di attributo '{0}' è facoltativo, ma non sono stati specificati valori di parametro predefiniti.</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysTrue"> <source>The given expression is always of the provided ('{0}') type</source> <target state="translated">L'espressione specificata è sempre del tipo fornito ('{0}')</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysTrue_Title"> <source>'is' expression's given expression is always of the provided type</source> <target state="translated">'L'espressione specificata dell'espressione 'is' è sempre del tipo fornito</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysFalse"> <source>The given expression is never of the provided ('{0}') type</source> <target state="translated">L'espressione specificata non è mai del tipo fornito ('{0}')</target> <note /> </trans-unit> <trans-unit id="WRN_IsAlwaysFalse_Title"> <source>'is' expression's given expression is never of the provided type</source> <target state="translated">'L'espressione specificata dell'espressione 'is' non è mai del tipo fornito</target> <note /> </trans-unit> <trans-unit id="ERR_LockNeedsReference"> <source>'{0}' is not a reference type as required by the lock statement</source> <target state="translated">'{0}' non è un tipo riferimento richiesto dall'istruzione lock</target> <note /> </trans-unit> <trans-unit id="ERR_NullNotValid"> <source>Use of null is not valid in this context</source> <target state="translated">L'utilizzo di null non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultLiteralNotValid"> <source>Use of default literal is not valid in this context</source> <target state="translated">In questo contesto non è possibile usare il valore letterale predefinito</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationThis"> <source>The 'this' object cannot be used before all of its fields have been assigned</source> <target state="translated">Non è possibile usare l'oggetto 'this' prima dell'assegnazione di tutti i relativi campi</target> <note /> </trans-unit> <trans-unit id="ERR_ArgsInvalid"> <source>The __arglist construct is valid only within a variable argument method</source> <target state="translated">Il costrutto __arglist è valido solo all'interno di un metodo con argomenti variabili</target> <note /> </trans-unit> <trans-unit id="ERR_PtrExpected"> <source>The * or -&gt; operator must be applied to a pointer</source> <target state="translated">L'operatore * o -&gt; deve essere applicato a un puntatore</target> <note /> </trans-unit> <trans-unit id="ERR_PtrIndexSingle"> <source>A pointer must be indexed by only one value</source> <target state="translated">Un puntatore deve essere indicizzato da un solo valore</target> <note /> </trans-unit> <trans-unit id="WRN_ByRefNonAgileField"> <source>Using '{0}' as a ref or out value or taking its address may cause a runtime exception because it is a field of a marshal-by-reference class</source> <target state="translated">Se si usa '{0}' come valore out o ref oppure se ne accetta l'indirizzo, potrebbe verificarsi un'eccezione in fase di esecuzione perché è un campo di una classe con marshalling per riferimento</target> <note /> </trans-unit> <trans-unit id="WRN_ByRefNonAgileField_Title"> <source>Using a field of a marshal-by-reference class as a ref or out value or taking its address may cause a runtime exception</source> <target state="translated">Se si usa come valore out o ref un campo di una classe con marshalling per riferimento oppure se ne accetta l'indirizzo, può verificarsi un'eccezione in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyStatic"> <source>A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)</source> <target state="translated">Impossibile effettuare un'assegnazione a un campo statico in sola lettura (tranne che in un costruttore statico o in un inizializzatore di variabile)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyStatic"> <source>A static readonly field cannot be used as a ref or out value (except in a static constructor)</source> <target state="translated">Non è possibile usare un campo di sola lettura statico come valore out o ref (tranne che in un costruttore statico)</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyProp"> <source>Property or indexer '{0}' cannot be assigned to -- it is read only</source> <target state="translated">Non è possibile assegnare un valore alla proprietà o all'indicizzatore '{0}' perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalStatement"> <source>Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement</source> <target state="translated">È possibile usare come istruzione solo le espressioni di assegnazione, chiamata, incremento, decremento, attesa e nuovo oggetto</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetEnumerator"> <source>foreach requires that the return type '{0}' of '{1}' must have a suitable public 'MoveNext' method and public 'Current' property</source> <target state="translated">Con foreach il tipo restituito '{0}' di '{1}' deve essere associato a un metodo 'MoveNext' pubblico e a una proprietà 'Current' pubblica appropriati</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyLocals"> <source>Only 65534 locals, including those generated by the compiler, are allowed</source> <target state="translated">Sono consentite solo 65534 variabili locali, incluse quelle generate dal compilatore</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractBaseCall"> <source>Cannot call an abstract base member: '{0}'</source> <target state="translated">Impossibile chiamare un membro di base astratto: '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefProperty"> <source>A property or indexer may not be passed as an out or ref parameter</source> <target state="translated">Una proprietà o un indicizzatore non può essere passato come parametro out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_ManagedAddr"> <source>Cannot take the address of, get the size of, or declare a pointer to a managed type ('{0}')</source> <target state="translated">Non è possibile accettare l'indirizzo di un tipo gestito ('{0}'), recuperarne la dimensione o dichiarare un puntatore a esso</target> <note /> </trans-unit> <trans-unit id="ERR_BadFixedInitType"> <source>The type of a local declared in a fixed statement must be a pointer type</source> <target state="translated">Il tipo di una variabile locale dichiarata in un'istruzione fixed deve essere un puntatore</target> <note /> </trans-unit> <trans-unit id="ERR_FixedMustInit"> <source>You must provide an initializer in a fixed or using statement declaration</source> <target state="translated">Occorre specificare un inizializzatore nella dichiarazione di un'istruzione fixed o using</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAddrOp"> <source>Cannot take the address of the given expression</source> <target state="translated">Non è possibile accettare l'indirizzo dell'espressione data</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNeeded"> <source>You can only take the address of an unfixed expression inside of a fixed statement initializer</source> <target state="translated">È possibile accettare l'indirizzo di un'espressione unfixed solo all'interno dell'inizializzatore di un'istruzione fixed</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNotNeeded"> <source>You cannot use the fixed statement to take the address of an already fixed expression</source> <target state="translated">Impossibile utilizzare l'istruzione fixed per accettare l'indirizzo di un'espressione già di tipo fixed</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeNeeded"> <source>Pointers and fixed size buffers may only be used in an unsafe context</source> <target state="translated">Puntatori e buffer a dimensione fissa possono essere usati solo in un contesto unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_OpTFRetType"> <source>The return type of operator True or False must be bool</source> <target state="translated">Il tipo restituito dell'operatore True o False deve essere booleano</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorNeedsMatch"> <source>The operator '{0}' requires a matching operator '{1}' to also be defined</source> <target state="translated">L'operatore '{0}' richiede che sia definito anche un operatore '{1}' corrispondente</target> <note /> </trans-unit> <trans-unit id="ERR_BadBoolOp"> <source>In order to be applicable as a short circuit operator a user-defined logical operator ('{0}') must have the same return type and parameter types</source> <target state="translated">Per essere usato come operatore di corto circuito, un operatore logico definito dall'utente ('{0}') deve avere lo stesso tipo restituito e gli stessi tipi di parametro</target> <note /> </trans-unit> <trans-unit id="ERR_MustHaveOpTF"> <source>In order for '{0}' to be applicable as a short circuit operator, its declaring type '{1}' must define operator true and operator false</source> <target state="translated">Per poter usare '{0}' come operatore di corto circuito, il tipo dichiarante '{1}' deve definire l'operatore True e l'operatore False</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVarAssg"> <source>The variable '{0}' is assigned but its value is never used</source> <target state="translated">La variabile '{0}' è assegnata, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedVarAssg_Title"> <source>Variable is assigned but its value is never used</source> <target state="translated">La variabile è assegnata, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_CheckedOverflow"> <source>The operation overflows at compile time in checked mode</source> <target state="translated">Operazione in overflow in fase di compilazione in modalità checked</target> <note /> </trans-unit> <trans-unit id="ERR_ConstOutOfRangeChecked"> <source>Constant value '{0}' cannot be converted to a '{1}' (use 'unchecked' syntax to override)</source> <target state="translated">Il valore costante '{0}' non può essere convertito in '{1}'. Usare la sintassi 'unchecked' per eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_BadVarargs"> <source>A method with vararg cannot be generic, be in a generic type, or have a params parameter</source> <target state="translated">Un metodo con vararg non può essere generico, non può essere in un tipo generico né contenere una matrice di parametri</target> <note /> </trans-unit> <trans-unit id="ERR_ParamsMustBeArray"> <source>The params parameter must be a single dimensional array</source> <target state="translated">Il parametro params deve essere una matrice unidimensionale</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalArglist"> <source>An __arglist expression may only appear inside of a call or new expression</source> <target state="translated">Un'espressione __arglist può trovarsi solo all'interno di una chiamata o di un'espressione new</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalUnsafe"> <source>Unsafe code may only appear if compiling with /unsafe</source> <target state="translated">Il codice di tipo unsafe è ammesso solo se si compila con /unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigMember"> <source>Ambiguity between '{0}' and '{1}'</source> <target state="translated">Ambiguità tra '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadForeachDecl"> <source>Type and identifier are both required in a foreach statement</source> <target state="translated">In un'istruzione foreach sono necessari sia il tipo che l'identificatore</target> <note /> </trans-unit> <trans-unit id="ERR_ParamsLast"> <source>A params parameter must be the last parameter in a formal parameter list</source> <target state="translated">Il parametro params deve essere l'ultimo in un elenco parametri formale</target> <note /> </trans-unit> <trans-unit id="ERR_SizeofUnsafe"> <source>'{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context</source> <target state="translated">'{0}' non ha una dimensione predefinita, quindi sizeof può essere usato solo in un contesto di tipo unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_DottedTypeNameNotFoundInNS"> <source>The type or namespace name '{0}' does not exist in the namespace '{1}' (are you missing an assembly reference?)</source> <target state="translated">Il tipo o il nome dello spazio dei nomi '{0}' non esiste nello spazio dei nomi '{1}'. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldInitRefNonstatic"> <source>A field initializer cannot reference the non-static field, method, or property '{0}'</source> <target state="translated">Un inizializzatore di campo non può fare riferimento alla proprietà, al metodo o al campo non statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_SealedNonOverride"> <source>'{0}' cannot be sealed because it is not an override</source> <target state="translated">'{0}' non può essere sealed perché non è un override</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideSealed"> <source>'{0}': cannot override inherited member '{1}' because it is sealed</source> <target state="translated">'{0}': non è possibile eseguire l'override del membro ereditato '{1}' perché è sealed</target> <note /> </trans-unit> <trans-unit id="ERR_VoidError"> <source>The operation in question is undefined on void pointers</source> <target state="translated">L'operazione è indefinita sui puntatori a void</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnOverride"> <source>The Conditional attribute is not valid on '{0}' because it is an override method</source> <target state="translated">L'attributo Conditional non è valido per '{0}' perché è un metodo di override</target> <note /> </trans-unit> <trans-unit id="ERR_PointerInAsOrIs"> <source>Neither 'is' nor 'as' is valid on pointer types</source> <target state="translated">is' o 'as' non valido per tipi puntatore</target> <note /> </trans-unit> <trans-unit id="ERR_CallingFinalizeDeprecated"> <source>Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available.</source> <target state="translated">Impossibile chiamare direttamente i distruttori e object.Finalize. Provare a chiamare IDisposable.Dispose se disponibile.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleTypeNameNotFound"> <source>The type or namespace name '{0}' could not be found (are you missing a using directive or an assembly reference?)</source> <target state="translated">Il nome di tipo o di spazio dei nomi '{0}' non è stato trovato. Probabilmente manca una direttiva using o un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeStackAllocSize"> <source>Cannot use a negative size with stackalloc</source> <target state="translated">Impossibile utilizzare dimensioni negative con stackalloc</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeArraySize"> <source>Cannot create an array with a negative size</source> <target state="translated">Non è possibile creare matrici con dimensioni negative</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideFinalizeDeprecated"> <source>Do not override object.Finalize. Instead, provide a destructor.</source> <target state="translated">Non eseguire l'override di object.Finalize. Fornire un distruttore.</target> <note /> </trans-unit> <trans-unit id="ERR_CallingBaseFinalizeDeprecated"> <source>Do not directly call your base type Finalize method. It is called automatically from your destructor.</source> <target state="translated">Non chiamare direttamente il metodo Finalize del tipo di base. Viene chiamato automaticamente dal distruttore.</target> <note /> </trans-unit> <trans-unit id="WRN_NegativeArrayIndex"> <source>Indexing an array with a negative index (array indices always start at zero)</source> <target state="translated">Indicizzazione di una matrice con indice negativo. Gli indici di matrice iniziano sempre da zero</target> <note /> </trans-unit> <trans-unit id="WRN_NegativeArrayIndex_Title"> <source>Indexing an array with a negative index</source> <target state="translated">Indicizzazione di una matrice con un indice negativo</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareLeft"> <source>Possible unintended reference comparison; to get a value comparison, cast the left hand side to type '{0}'</source> <target state="translated">È probabile che il confronto dei riferimenti non sia intenzionale. Per confrontare i valori, eseguire il cast dell'espressione di sinistra sul tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareLeft_Title"> <source>Possible unintended reference comparison; left hand side needs cast</source> <target state="translated">Possibile confronto non intenzionale dei riferimenti. Eseguire il cast del lato sinistro</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareRight"> <source>Possible unintended reference comparison; to get a value comparison, cast the right hand side to type '{0}'</source> <target state="translated">È probabile che il confronto dei riferimenti non sia intenzionale. Per confrontare i valori, eseguire il cast dell'espressione di destra sul tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadRefCompareRight_Title"> <source>Possible unintended reference comparison; right hand side needs cast</source> <target state="translated">Possibile confronto non intenzionale dei riferimenti. Eseguire il cast del lato destro</target> <note /> </trans-unit> <trans-unit id="ERR_BadCastInFixed"> <source>The right hand side of a fixed statement assignment may not be a cast expression</source> <target state="translated">La parte destra dell'assegnazione di un'istruzione fixed non può essere un'espressione cast</target> <note /> </trans-unit> <trans-unit id="ERR_StackallocInCatchFinally"> <source>stackalloc may not be used in a catch or finally block</source> <target state="translated">stackalloc non può essere usato in un blocco catch o finally</target> <note /> </trans-unit> <trans-unit id="ERR_VarargsLast"> <source>An __arglist parameter must be the last parameter in a formal parameter list</source> <target state="translated">Il parametro __arglist deve essere l'ultimo nell'elenco di parametri formali</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPartial"> <source>Missing partial modifier on declaration of type '{0}'; another partial declaration of this type exists</source> <target state="translated">Manca il modificatore parziale nella dichiarazione di tipo '{0}'. È presente un'altra dichiarazione parziale di questo tipo</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeKindConflict"> <source>Partial declarations of '{0}' must be all classes, all record classes, all structs, all record structs, or all interfaces</source> <target state="needs-review-translation">Le dichiarazioni parziali di '{0}' devono essere costituite solo da classi, record, struct o interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_PartialModifierConflict"> <source>Partial declarations of '{0}' have conflicting accessibility modifiers</source> <target state="translated">Le dichiarazioni parziali di '{0}' contengono modificatori di accessibilità in conflitto</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMultipleBases"> <source>Partial declarations of '{0}' must not specify different base classes</source> <target state="translated">Le dichiarazioni parziali di '{0}' non devono specificare classi base diverse</target> <note /> </trans-unit> <trans-unit id="ERR_PartialWrongTypeParams"> <source>Partial declarations of '{0}' must have the same type parameter names in the same order</source> <target state="translated">Le dichiarazioni parziali di '{0}' devono avere gli stessi nomi di parametro di tipo nello stesso ordine</target> <note /> </trans-unit> <trans-unit id="ERR_PartialWrongConstraints"> <source>Partial declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source> <target state="translated">Le dichiarazioni parziali di '{0}' contengono vincoli incoerenti per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoImplicitConvCast"> <source>Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?)</source> <target state="translated">Non è possibile convertire in modo implicito il tipo '{0}' in '{1}'. È presente una conversione esplicita. Probabilmente manca un cast.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMisplaced"> <source>The 'partial' modifier can only appear immediately before 'class', 'record', 'struct', 'interface', or a method return type.</source> <target state="translated">Il modificatore 'partial' può trovarsi solo immediatamente prima di 'class', 'record', 'struct', 'interface' o il tipo restituito di un metodo.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportedCircularBase"> <source>Imported type '{0}' is invalid. It contains a circular base type dependency.</source> <target state="translated">Il tipo importato '{0}' non è valido perché contiene una dipendenza circolare del tipo di base.</target> <note /> </trans-unit> <trans-unit id="ERR_UseDefViolationOut"> <source>Use of unassigned out parameter '{0}'</source> <target state="translated">Uso del parametro out '{0}' non assegnato</target> <note /> </trans-unit> <trans-unit id="ERR_ArraySizeInDeclaration"> <source>Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)</source> <target state="translated">Impossibile specificare la dimensione della matrice in una dichiarazione di variabile. Provare a inizializzare con un'espressione 'new'</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleGetter"> <source>The property or indexer '{0}' cannot be used in this context because the get accessor is inaccessible</source> <target state="translated">Non è possibile usare la proprietà o l'indicizzatore '{0}' in questo contesto perché la funzione di accesso get non è accessibile</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleSetter"> <source>The property or indexer '{0}' cannot be used in this context because the set accessor is inaccessible</source> <target state="translated">Non è possibile usare la proprietà o l'indicizzatore '{0}' in questo contesto perché la funzione di accesso set è inaccessibile</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPropertyAccessMod"> <source>The accessibility modifier of the '{0}' accessor must be more restrictive than the property or indexer '{1}'</source> <target state="translated">Il modificatore di accessibilità della funzione di accesso '{0}' deve essere più restrittivo della proprietà o dell'indicizzatore '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyAccessMods"> <source>Cannot specify accessibility modifiers for both accessors of the property or indexer '{0}'</source> <target state="translated">Non è possibile specificare i modificatori di accessibilità per entrambe le funzioni di accesso della proprietà o dell'indicizzatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AccessModMissingAccessor"> <source>'{0}': accessibility modifiers on accessors may only be used if the property or indexer has both a get and a set accessor</source> <target state="translated">'{0}': i modificatori di accessibilità per le funzioni di accesso possono essere usati solo se la proprietà o l'indicizzatore ha entrambe le funzioni di accesso get e set</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedInterfaceAccessor"> <source>'{0}' does not implement interface member '{1}'. '{2}' is not public.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' è di tipo non pubblico</target> <note /> </trans-unit> <trans-unit id="WRN_PatternIsAmbiguous"> <source>'{0}' does not implement the '{1}' pattern. '{2}' is ambiguous with '{3}'.</source> <target state="translated">'{0}' non implementa il modello '{1}'. '{2}' è ambiguo con '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternIsAmbiguous_Title"> <source>Type does not implement the collection pattern; members are ambiguous</source> <target state="translated">Il tipo non implementa il modello di raccolta. I membri sono ambigui</target> <note /> </trans-unit> <trans-unit id="WRN_PatternBadSignature"> <source>'{0}' does not implement the '{1}' pattern. '{2}' has the wrong signature.</source> <target state="translated">'{0}' non implementa il modello '{1}'. La firma di '{2}' è errata.</target> <note /> </trans-unit> <trans-unit id="WRN_PatternBadSignature_Title"> <source>Type does not implement the collection pattern; member has the wrong signature</source> <target state="translated">Il tipo non implementa il modello di raccolta. La firma del membro è errata</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefNotEqualToThis"> <source>Friend access was granted by '{0}', but the public key of the output assembly ('{1}') does not match that specified by the InternalsVisibleTo attribute in the granting assembly.</source> <target state="translated">L'accesso a Friend è stato concesso da '{0}', ma la chiave pubblica dell'assembly di output ('{1}') non corrisponde a quella specificata dall'attributo InternalsVisibleTo nell'assembly che ha concesso l'accesso.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefSigningMismatch"> <source>Friend access was granted by '{0}', but the strong name signing state of the output assembly does not match that of the granting assembly.</source> <target state="translated">L'accesso a Friend è stato concesso da '{0}', ma lo stato di firma del nome sicuro dell'assembly di output non corrisponde a quello dell'assembly che ha concesso l'accesso.</target> <note /> </trans-unit> <trans-unit id="WRN_SequentialOnPartialClass"> <source>There is no defined ordering between fields in multiple declarations of partial struct '{0}'. To specify an ordering, all instance fields must be in the same declaration.</source> <target state="translated">Non è stato definito nessun ordine tra i campi in più dichiarazioni di struct parziale '{0}'. Per specificare un ordine, tutti i campi dell'istanza devono essere inclusi nella stessa dichiarazione.</target> <note /> </trans-unit> <trans-unit id="WRN_SequentialOnPartialClass_Title"> <source>There is no defined ordering between fields in multiple declarations of partial struct</source> <target state="translated">In più dichiarazioni della struct parziale non è stato definito nessun ordinamento tra campi</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstType"> <source>The type '{0}' cannot be declared const</source> <target state="translated">Il tipo '{0}' non può essere dichiarato come const</target> <note /> </trans-unit> <trans-unit id="ERR_NoNewTyvar"> <source>Cannot create an instance of the variable type '{0}' because it does not have the new() constraint</source> <target state="translated">Non è possibile creare un'istanza del tipo di variabile '{0}' perché non include il vincolo new()</target> <note /> </trans-unit> <trans-unit id="ERR_BadArity"> <source>Using the generic {1} '{0}' requires {2} type arguments</source> <target state="translated">L'uso del tipo generico {1} '{0}' richiede argomenti di tipo {2}</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgument"> <source>The type '{0}' may not be used as a type argument</source> <target state="translated">Il tipo '{0}' non può essere usato come argomento di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_TypeArgsNotAllowed"> <source>The {1} '{0}' cannot be used with type arguments</source> <target state="translated">Non è possibile usare {1} '{0}' con argomenti di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_HasNoTypeVars"> <source>The non-generic {1} '{0}' cannot be used with type arguments</source> <target state="translated">{1} '{0}' non generico non può essere usato con argomenti di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_NewConstraintNotSatisfied"> <source>'{2}' must be a non-abstract type with a public parameterless constructor in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">'{2}' deve essere un tipo non astratto con un costruttore pubblico senza parametri per poter essere usato come parametro '{1}' nel tipo o nel metodo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedRefType"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no implicit reference conversion from '{3}' to '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Non esistono conversioni implicite di riferimenti da '{3}' a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedNullableEnum"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Il tipo nullable '{3}' non soddisfa il vincolo di '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedNullableInterface"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel tipo o metodo generico '{0}'. Il tipo nullable '{3}' non soddisfa il vincolo di '{1}'. I tipi nullable non soddisfano i vincoli di interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedTyVar"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Non esistono conversioni boxing o conversioni di parametri di tipo da '{3}' a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfiedValType"> <source>The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'.</source> <target state="translated">Non è possibile usare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Non esistono conversioni boxing da '{3}' a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateGeneratedName"> <source>The parameter name '{0}' conflicts with an automatically-generated parameter name</source> <target state="translated">Il nome di parametro '{0}' è in conflitto con un nome di parametro generato automaticamente</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalSingleTypeNameNotFound"> <source>The type or namespace name '{0}' could not be found in the global namespace (are you missing an assembly reference?)</source> <target state="translated">Il nome di tipo o di spazio dei nomi '{0}' non è stato trovato nello spazio dei nomi globale. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NewBoundMustBeLast"> <source>The new() constraint must be the last constraint specified</source> <target state="translated">Il vincolo new() deve essere l'ultimo vincolo specificato</target> <note /> </trans-unit> <trans-unit id="WRN_MainCantBeGeneric"> <source>'{0}': an entry point cannot be generic or in a generic type</source> <target state="translated">'{0}': un punto di ingresso non può essere generico o essere incluso in un tipo generico</target> <note /> </trans-unit> <trans-unit id="WRN_MainCantBeGeneric_Title"> <source>An entry point cannot be generic or in a generic type</source> <target state="translated">Un punto di ingresso non può essere generico o essere incluso in un tipo generico</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVarCantBeNull"> <source>Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead.</source> <target state="translated">Non è possibile convertire il valore Null nel parametro di tipo '{0}' perché potrebbe essere un tipo valore che non ammette i valori Null. Provare a usare 'default({0})'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateBound"> <source>Duplicate constraint '{0}' for type parameter '{1}'</source> <target state="translated">Il vincolo '{0}' è duplicato per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ClassBoundNotFirst"> <source>The class type constraint '{0}' must come before any other constraints</source> <target state="translated">Il vincolo di tipo classe '{0}' deve precedere gli altri vincoli</target> <note /> </trans-unit> <trans-unit id="ERR_BadRetType"> <source>'{1} {0}' has the wrong return type</source> <target state="translated">'Il tipo restituito di '{1} {0}' è errato</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateRefMismatch"> <source>Ref mismatch between '{0}' and delegate '{1}'</source> <target state="translated">Riferimenti non corrispondenti tra '{0}' e il delegato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConstraintClause"> <source>A constraint clause has already been specified for type parameter '{0}'. All of the constraints for a type parameter must be specified in a single where clause.</source> <target state="translated">È già stata specificata una clausola di vincolo per il parametro di tipo '{0}'. Tutti i vincoli per un parametro di tipo devono essere specificati in un'unica clausola where.</target> <note /> </trans-unit> <trans-unit id="ERR_CantInferMethTypeArgs"> <source>The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly.</source> <target state="translated">Non è possibile dedurre gli argomenti di tipo per il metodo '{0}' dall'utilizzo. Provare a specificare gli argomenti di tipo in modo esplicito.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalSameNameAsTypeParam"> <source>'{0}': a parameter, local variable, or local function cannot have the same name as a method type parameter</source> <target state="translated">'{0}': il nome di un parametro, di una variabile locale o di una funzione locale non può essere uguale a quello di un parametro di tipo del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_AsWithTypeVar"> <source>The type parameter '{0}' cannot be used with the 'as' operator because it does not have a class type constraint nor a 'class' constraint</source> <target state="translated">Non è possibile usare il parametro di tipo '{0}' con l'operatore 'as' perché non ha vincoli di tipo classe, né un vincolo 'class'</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedFieldAssg"> <source>The field '{0}' is assigned but its value is never used</source> <target state="translated">Il campo '{0}' è assegnato, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedFieldAssg_Title"> <source>Field is assigned but its value is never used</source> <target state="translated">Il campo è assegnato, ma il suo valore non viene mai usato</target> <note /> </trans-unit> <trans-unit id="ERR_BadIndexerNameAttr"> <source>The '{0}' attribute is valid only on an indexer that is not an explicit interface member declaration</source> <target state="translated">L'attributo '{0}' è valido solo in un indicizzatore che non sia una dichiarazione esplicita di un membro di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_AttrArgWithTypeVars"> <source>'{0}': an attribute argument cannot use type parameters</source> <target state="translated">'{0}': un argomento di attributo non può usare parametri di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_NewTyvarWithArgs"> <source>'{0}': cannot provide arguments when creating an instance of a variable type</source> <target state="translated">'{0}': non è possibile fornire argomenti quando si crea un'istanza di un tipo di variabile</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractSealedStatic"> <source>'{0}': an abstract type cannot be sealed or static</source> <target state="translated">'{0}': un tipo astratto non può essere sealed o static</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousXMLReference"> <source>Ambiguous reference in cref attribute: '{0}'. Assuming '{1}', but could have also matched other overloads including '{2}'.</source> <target state="translated">Riferimento ambiguo nell'attributo cref: '{0}'. Verrà usato '{1}', ma è anche possibile che corrisponda ad altri overload, tra cui '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousXMLReference_Title"> <source>Ambiguous reference in cref attribute</source> <target state="translated">Riferimento ambiguo nell'attributo cref</target> <note /> </trans-unit> <trans-unit id="WRN_VolatileByRef"> <source>'{0}': a reference to a volatile field will not be treated as volatile</source> <target state="translated">'{0}': un riferimento a un campo volatile non verrà considerato volatile</target> <note /> </trans-unit> <trans-unit id="WRN_VolatileByRef_Title"> <source>A reference to a volatile field will not be treated as volatile</source> <target state="translated">Un riferimento a un campo volatile non verrà considerato volatile</target> <note /> </trans-unit> <trans-unit id="WRN_VolatileByRef_Description"> <source>A volatile field should not normally be used as a ref or out value, since it will not be treated as volatile. There are exceptions to this, such as when calling an interlocked API.</source> <target state="translated">Un campo volatile non deve in genere essere usato come valore out o ref dal momento che non verrà considerato come volatile. Esistono eccezioni a questo comportamento, ad esempio quando si chiama un'API con interlock.</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithImpl"> <source>Since '{1}' has the ComImport attribute, '{0}' must be extern or abstract</source> <target state="translated">'{1}' ha l'attributo ComImport, pertanto '{0}' deve essere extern o abstract</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithBase"> <source>'{0}': a class with the ComImport attribute cannot specify a base class</source> <target state="translated">'{0}': una classe con l'attributo ComImport non può specificare una classe base</target> <note /> </trans-unit> <trans-unit id="ERR_ImplBadConstraints"> <source>The constraints for type parameter '{0}' of method '{1}' must match the constraints for type parameter '{2}' of interface method '{3}'. Consider using an explicit interface implementation instead.</source> <target state="translated">I vincoli per il parametro di tipo '{0}' del metodo '{1}' devono corrispondere ai vincoli per il parametro di tipo '{2}' del metodo di interfaccia '{3}'. Provare a usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplBadTupleNames"> <source>The tuple element names in the signature of method '{0}' must match the tuple element names of interface method '{1}' (including on the return type).</source> <target state="translated">I nomi di elementi di tupla nella firma del metodo '{0}' devono corrispondere a quelli del metodo di interfaccia '{1}' (incluso nel tipo restituito).</target> <note /> </trans-unit> <trans-unit id="ERR_DottedTypeNameNotFoundInAgg"> <source>The type name '{0}' does not exist in the type '{1}'</source> <target state="translated">Il nome di tipo '{0}' non esiste nel tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MethGrpToNonDel"> <source>Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method?</source> <target state="translated">Non è possibile convertire il gruppo di metodi '{0}' nel tipo non delegato '{1}'. Si intendeva richiamare il metodo?</target> <note /> </trans-unit> <trans-unit id="ERR_BadExternAlias"> <source>The extern alias '{0}' was not specified in a /reference option</source> <target state="translated">L'alias extern '{0}' non è stato specificato in un'opzione /reference</target> <note /> </trans-unit> <trans-unit id="ERR_ColColWithTypeAlias"> <source>Cannot use alias '{0}' with '::' since the alias references a type. Use '.' instead.</source> <target state="translated">Non è possibile usare l'alias '{0}' con '::' perché l'alias fa riferimento a un tipo. Usare '.'.</target> <note /> </trans-unit> <trans-unit id="ERR_AliasNotFound"> <source>Alias '{0}' not found</source> <target state="translated">L'alias '{0}' non è stato trovato</target> <note /> </trans-unit> <trans-unit id="ERR_SameFullNameAggAgg"> <source>The type '{1}' exists in both '{0}' and '{2}'</source> <target state="translated">Il tipo '{1}' esiste sia in '{0}' che in '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_SameFullNameNsAgg"> <source>The namespace '{1}' in '{0}' conflicts with the type '{3}' in '{2}'</source> <target state="translated">Lo spazio dei nomi '{1}' in '{0}' è in conflitto con il tipo '{3}' in '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisNsAgg"> <source>The namespace '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the namespace defined in '{0}'.</source> <target state="translated">Lo spazio dei nomi '{1}' in '{0}' è in conflitto con il tipo importato '{3}' in '{2}'. Verrà usato lo spazio dei nomi definito in '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisNsAgg_Title"> <source>Namespace conflicts with imported type</source> <target state="translated">Lo spazio dei nomi è in conflitto con il tipo importato</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggAgg"> <source>The type '{1}' in '{0}' conflicts with the imported type '{3}' in '{2}'. Using the type defined in '{0}'.</source> <target state="translated">Il tipo '{1}' in '{0}' è in conflitto con il tipo importato '{3}' in '{2}'. Verrà usato il tipo definito in '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggAgg_Title"> <source>Type conflicts with imported type</source> <target state="translated">Il tipo è in conflitto con il tipo importato</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggNs"> <source>The type '{1}' in '{0}' conflicts with the imported namespace '{3}' in '{2}'. Using the type defined in '{0}'.</source> <target state="translated">Il tipo '{1}' in '{0}' è in conflitto con lo spazio dei nomi importato '{3}' in '{2}'. Verrà usato il tipo definito in '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_SameFullNameThisAggNs_Title"> <source>Type conflicts with imported namespace</source> <target state="translated">Il tipo è in conflitto con lo spazio dei nomi importato</target> <note /> </trans-unit> <trans-unit id="ERR_SameFullNameThisAggThisNs"> <source>The type '{1}' in '{0}' conflicts with the namespace '{3}' in '{2}'</source> <target state="translated">Il tipo '{1}' in '{0}' è in conflitto con lo spazio dei nomi '{3}' in '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExternAfterElements"> <source>An extern alias declaration must precede all other elements defined in the namespace</source> <target state="translated">Una dichiarazione di alias extern deve precedere tutti gli altri elementi definiti nello spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="WRN_GlobalAliasDefn"> <source>Defining an alias named 'global' is ill-advised since 'global::' always references the global namespace and not an alias</source> <target state="translated">Si consiglia di non assegnare il nome 'global' a un alias perché 'global::' fa sempre riferimento allo spazio dei nomi globale e non a un alias</target> <note /> </trans-unit> <trans-unit id="WRN_GlobalAliasDefn_Title"> <source>Defining an alias named 'global' is ill-advised</source> <target state="translated">È consigliabile non assegnare il nome 'global' a un alias</target> <note /> </trans-unit> <trans-unit id="ERR_SealedStaticClass"> <source>'{0}': a type cannot be both static and sealed</source> <target state="translated">'{0}': un tipo non può essere sia statico che sealed</target> <note /> </trans-unit> <trans-unit id="ERR_PrivateAbstractAccessor"> <source>'{0}': abstract properties cannot have private accessors</source> <target state="translated">'{0}': le proprietà astratte non possono avere funzioni di accesso private</target> <note /> </trans-unit> <trans-unit id="ERR_ValueExpected"> <source>Syntax error; value expected</source> <target state="translated">Errore di sintassi: è previsto un valore</target> <note /> </trans-unit> <trans-unit id="ERR_UnboxNotLValue"> <source>Cannot modify the result of an unboxing conversion</source> <target state="translated">Non è possibile modificare il risultato di una conversione unboxing</target> <note /> </trans-unit> <trans-unit id="ERR_AnonMethGrpInForEach"> <source>Foreach cannot operate on a '{0}'. Did you intend to invoke the '{0}'?</source> <target state="translated">L'istruzione foreach non può funzionare con '{0}'. Si intendeva richiamare '{0}'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadIncDecRetType"> <source>The return type for ++ or -- operator must match the parameter type or be derived from the parameter type</source> <target state="translated">Il tipo restituito per l'operatore ++ o -- deve essere uguale o derivare dal tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_RefValBoundWithClass"> <source>'{0}': cannot specify both a constraint class and the 'class' or 'struct' constraint</source> <target state="translated">'{0}': non è possibile specificare sia una classe constraint che il vincolo 'class' o 'struct'</target> <note /> </trans-unit> <trans-unit id="ERR_NewBoundWithVal"> <source>The 'new()' constraint cannot be used with the 'struct' constraint</source> <target state="translated">Non è possibile usare il vincolo 'new()' con il vincolo 'struct'</target> <note /> </trans-unit> <trans-unit id="ERR_RefConstraintNotSatisfied"> <source>The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">Il tipo '{2}' deve essere un tipo riferimento per poter essere usato come parametro '{1}' nel metodo o nel tipo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ValConstraintNotSatisfied"> <source>The type '{2}' must be a non-nullable value type in order to use it as parameter '{1}' in the generic type or method '{0}'</source> <target state="translated">Il tipo '{2}' deve essere un tipo valore che non ammette i valori Null per poter essere usato come parametro '{1}' nel metodo o nel tipo generico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_CircularConstraint"> <source>Circular constraint dependency involving '{0}' and '{1}'</source> <target state="translated">Dipendenza di vincolo circolare che interessa '{0}' e '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BaseConstraintConflict"> <source>Type parameter '{0}' inherits conflicting constraints '{1}' and '{2}'</source> <target state="translated">Il parametro di tipo '{0}' eredita i vincoli in conflitto '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConWithValCon"> <source>Type parameter '{1}' has the 'struct' constraint so '{1}' cannot be used as a constraint for '{0}'</source> <target state="translated">Il parametro di tipo '{1}' ha il vincolo 'struct'. Non è quindi possibile usare '{1}' come vincolo per '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigUDConv"> <source>Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}'</source> <target state="translated">Le conversioni '{0}' e '{1}' definite dall'utente durante la conversione da '{2}' a '{3}' sono ambigue</target> <note /> </trans-unit> <trans-unit id="WRN_AlwaysNull"> <source>The result of the expression is always 'null' of type '{0}'</source> <target state="translated">Il risultato dell'espressione è sempre 'null' di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_AlwaysNull_Title"> <source>The result of the expression is always 'null'</source> <target state="translated">Il risultato dell'espressione è sempre 'null'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnThis"> <source>Cannot return 'this' by reference.</source> <target state="translated">Non è possibile restituire 'this' per riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeCtorInParameter"> <source>Cannot use attribute constructor '{0}' because it has 'in' parameters.</source> <target state="translated">Non è possibile usare il costruttore di attributo '{0}' perché contiene parametri 'in'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithConstraints"> <source>Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly, except for either a 'class', or a 'struct' constraint.</source> <target state="translated">I vincoli per i metodi di override e di implementazione esplicita dell'interfaccia sono ereditati dal metodo base, quindi non possono essere specificati direttamente, ad eccezione di un vincolo 'class' o 'struct'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbigOverride"> <source>The inherited members '{0}' and '{1}' have the same signature in type '{2}', so they cannot be overridden</source> <target state="translated">I membri ereditati '{0}' e '{1}' hanno la stessa firma nel tipo '{2}', pertanto non possono essere sottoposti a override</target> <note /> </trans-unit> <trans-unit id="ERR_DecConstError"> <source>Evaluation of the decimal constant expression failed</source> <target state="translated">La valutazione dell'espressione costante decimale non è riuscita</target> <note /> </trans-unit> <trans-unit id="WRN_CmpAlwaysFalse"> <source>Comparing with null of type '{0}' always produces 'false'</source> <target state="translated">Il confronto con il valore Null di tipo '{0}' restituisce sempre 'false'</target> <note /> </trans-unit> <trans-unit id="WRN_CmpAlwaysFalse_Title"> <source>Comparing with null of struct type always produces 'false'</source> <target state="translated">Il confronto con il valore Null di tipo struct restituisce sempre 'false'</target> <note /> </trans-unit> <trans-unit id="WRN_FinalizeMethod"> <source>Introducing a 'Finalize' method can interfere with destructor invocation. Did you intend to declare a destructor?</source> <target state="translated">L'introduzione di un metodo 'Finalize' può interferire con la chiamata di un distruttore. Si desiderava dichiarare un distruttore?</target> <note /> </trans-unit> <trans-unit id="WRN_FinalizeMethod_Title"> <source>Introducing a 'Finalize' method can interfere with destructor invocation</source> <target state="translated">L'introduzione di un metodo 'Finalize' può interferire con la chiamata di un distruttore</target> <note /> </trans-unit> <trans-unit id="WRN_FinalizeMethod_Description"> <source>This warning occurs when you create a class with a method whose signature is public virtual void Finalize. If such a class is used as a base class and if the deriving class defines a destructor, the destructor will override the base class Finalize method, not Finalize.</source> <target state="translated">Questo avviso viene visualizzato quando si crea una classe con un metodo la cui firma è public virtual void Finalize. Se si usa tale classe come classe base e se la classe di derivazione definisce un distruttore, il distruttore eseguirà l'override del metodo Finalize della classe base e non di Finalize.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitImplParams"> <source>'{0}' should not have a params parameter since '{1}' does not</source> <target state="translated">'{0}' non deve contenere un parametro params perché '{1}' non ne ha</target> <note /> </trans-unit> <trans-unit id="WRN_GotoCaseShouldConvert"> <source>The 'goto case' value is not implicitly convertible to type '{0}'</source> <target state="translated">Il valore 'goto case' non è convertibile in modo implicito nel tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_GotoCaseShouldConvert_Title"> <source>The 'goto case' value is not implicitly convertible to the switch type</source> <target state="translated">Il valore 'goto case' non è convertibile in modo implicito nel tipo switch</target> <note /> </trans-unit> <trans-unit id="ERR_MethodImplementingAccessor"> <source>Method '{0}' cannot implement interface accessor '{1}' for type '{2}'. Use an explicit interface implementation.</source> <target state="translated">Il metodo '{0}' non può implementare la funzione di accesso di interfaccia '{1}' per il tipo '{2}'. Usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool"> <source>The result of the expression is always '{0}' since a value of type '{1}' is never equal to 'null' of type '{2}'</source> <target state="translated">Il risultato dell'espressione è sempre '{0}' perché un valore di tipo '{1}' non è mai uguale a 'null' di tipo '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool_Title"> <source>The result of the expression is always the same since a value of this type is never equal to 'null'</source> <target state="translated">Il risultato dell'espressione è sempre lo stesso perché un valore di questo tipo non è mai uguale a 'null'</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool2"> <source>The result of the expression is always '{0}' since a value of type '{1}' is never equal to 'null' of type '{2}'</source> <target state="translated">Il risultato dell'espressione è sempre '{0}' perché un valore di tipo '{1}' non è mai uguale a 'null' di tipo '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_NubExprIsConstBool2_Title"> <source>The result of the expression is always the same since a value of this type is never equal to 'null'</source> <target state="translated">Il risultato dell'espressione è sempre lo stesso perché un valore di questo tipo non è mai uguale a 'null'</target> <note /> </trans-unit> <trans-unit id="WRN_ExplicitImplCollision"> <source>Explicit interface implementation '{0}' matches more than one interface member. Which interface member is actually chosen is implementation-dependent. Consider using a non-explicit implementation instead.</source> <target state="translated">L'implementazione esplicita dell'interfaccia '{0}' corrisponde a più membri di interfaccia. Il membro di interfaccia scelto dipende dall'implementazione. Provare a usare un'implementazione non esplicita.</target> <note /> </trans-unit> <trans-unit id="WRN_ExplicitImplCollision_Title"> <source>Explicit interface implementation matches more than one interface member</source> <target state="translated">L'implementazione dell'interfaccia esplicita corrisponde a più di un membro di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractHasBody"> <source>'{0}' cannot declare a body because it is marked abstract</source> <target state="translated">'{0}' non può dichiarare un corpo perché è contrassegnato come abstract</target> <note /> </trans-unit> <trans-unit id="ERR_ConcreteMissingBody"> <source>'{0}' must declare a body because it is not marked abstract, extern, or partial</source> <target state="translated">'{0}' deve dichiarare un corpo perché non è contrassegnato come abstract, extern o partial</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractAndSealed"> <source>'{0}' cannot be both abstract and sealed</source> <target state="translated">'{0}' non può essere contemporaneamente di tipo abstract e sealed</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractNotVirtual"> <source>The abstract {0} '{1}' cannot be marked virtual</source> <target state="translated">L'elemento {0} astratto '{1}' non può essere contrassegnato come virtual</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstant"> <source>The constant '{0}' cannot be marked static</source> <target state="translated">La costante '{0}' non può essere contrassegnata come static</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonFunction"> <source>'{0}': cannot override because '{1}' is not a function</source> <target state="translated">'{0}': non è possibile eseguire l'override. '{1}' non è una funzione</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonVirtual"> <source>'{0}': cannot override inherited member '{1}' because it is not marked virtual, abstract, or override</source> <target state="translated">'{0}': non è possibile eseguire l'override del membro ereditato '{1}' perché non è contrassegnato come virtual, abstract o override</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeAccessOnOverride"> <source>'{0}': cannot change access modifiers when overriding '{1}' inherited member '{2}'</source> <target state="translated">'{0}': non è possibile cambiare i modificatori di accesso quando viene eseguito l'override di '{1}' del membro ereditato '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeTupleNamesOnOverride"> <source>'{0}': cannot change tuple element names when overriding inherited member '{1}'</source> <target state="translated">'{0}': non è possibile cambiare i nomi di elementi di tupla quando viene eseguito l'override del membro ereditato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeReturnTypeOnOverride"> <source>'{0}': return type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il tipo restituito deve essere '{2}' in modo che corrisponda al membro '{1}' sottoposto a override</target> <note /> </trans-unit> <trans-unit id="ERR_CantDeriveFromSealedType"> <source>'{0}': cannot derive from sealed type '{1}'</source> <target state="translated">'{0}' non può derivare dal tipo sealed '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractInConcreteClass"> <source>'{0}' is abstract but it is contained in non-abstract type '{1}'</source> <target state="translated">'{0}' è di tipo astratto ma è contenuto nel tipo non astratto '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstructorWithExplicitConstructorCall"> <source>'{0}': static constructor cannot have an explicit 'this' or 'base' constructor call</source> <target state="translated">'{0}': un costruttore statico non può avere una chiamata esplicita al costruttore 'this' o 'base'</target> <note /> </trans-unit> <trans-unit id="ERR_StaticConstructorWithAccessModifiers"> <source>'{0}': access modifiers are not allowed on static constructors</source> <target state="translated">'{0}': i modificatori di accesso non sono consentiti su costruttori statici</target> <note /> </trans-unit> <trans-unit id="ERR_RecursiveConstructorCall"> <source>Constructor '{0}' cannot call itself</source> <target state="translated">Il costruttore '{0}' non può chiamare se stesso</target> <note /> </trans-unit> <trans-unit id="ERR_IndirectRecursiveConstructorCall"> <source>Constructor '{0}' cannot call itself through another constructor</source> <target state="translated">Il costruttore '{0}' non può chiamare se stesso tramite un altro costruttore</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectCallingBaseConstructor"> <source>'{0}' has no base class and cannot call a base constructor</source> <target state="translated">'{0}' non ha una classe base e non può chiamare un costruttore base</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedTypeNotFound"> <source>Predefined type '{0}' is not defined or imported</source> <target state="translated">Il tipo predefinito '{0}' non è definito né importato</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeNotFound"> <source>Predefined type '{0}' is not defined or imported</source> <target state="translated">Il tipo predefinito '{0}' non è definito né importato</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeAmbiguous3"> <source>Predefined type '{0}' is declared in multiple referenced assemblies: '{1}' and '{2}'</source> <target state="translated">Il tipo predefinito '{0}' è dichiarato in più assembly di riferimento: '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_StructWithBaseConstructorCall"> <source>'{0}': structs cannot call base class constructors</source> <target state="translated">'{0}': le struct non possono chiamare costruttori della classe base</target> <note /> </trans-unit> <trans-unit id="ERR_StructLayoutCycle"> <source>Struct member '{0}' of type '{1}' causes a cycle in the struct layout</source> <target state="translated">Il membro struct '{0}' di tipo '{1}' causa un ciclo nel layout della struct</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacesCantContainFields"> <source>Interfaces cannot contain instance fields</source> <target state="translated">Le interfacce non possono contenere campi di istanza</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacesCantContainConstructors"> <source>Interfaces cannot contain instance constructors</source> <target state="translated">Le interfacce non possono contenere costruttori di istanza</target> <note /> </trans-unit> <trans-unit id="ERR_NonInterfaceInInterfaceList"> <source>Type '{0}' in interface list is not an interface</source> <target state="translated">Il tipo '{0}' nell'elenco di interfacce non è un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInterfaceInBaseList"> <source>'{0}' is already listed in interface list</source> <target state="translated">'{0}' è già presente nell'elenco delle interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInterfaceWithTupleNamesInBaseList"> <source>'{0}' is already listed in the interface list on type '{2}' with different tuple element names, as '{1}'.</source> <target state="translated">'{0}' è già incluso nell'elenco di interfacce nel tipo '{2}' con nomi di elementi di tupla diversi, come '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CycleInInterfaceInheritance"> <source>Inherited interface '{1}' causes a cycle in the interface hierarchy of '{0}'</source> <target state="translated">L'interfaccia ereditata '{1}' causa un ciclo nella gerarchia delle interfacce di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_HidingAbstractMethod"> <source>'{0}' hides inherited abstract member '{1}'</source> <target state="translated">'{0}' nasconde il membro astratto ereditato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedAbstractMethod"> <source>'{0}' does not implement inherited abstract member '{1}'</source> <target state="translated">'{0}' non implementa il membro astratto ereditato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedInterfaceMember"> <source>'{0}' does not implement interface member '{1}'</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectCantHaveBases"> <source>The class System.Object cannot have a base class or implement an interface</source> <target state="translated">La classe System.Object non può avere una classe base o implementare un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitInterfaceImplementationNotInterface"> <source>'{0}' in explicit interface declaration is not an interface</source> <target state="translated">'{0}' nella dichiarazione esplicita dell'interfaccia non è un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceMemberNotFound"> <source>'{0}' in explicit interface declaration is not found among members of the interface that can be implemented</source> <target state="translated">Nella dichiarazione di interfaccia esplicita '{0}' non è stato trovato tra i membri dell'interfaccia implementabili</target> <note /> </trans-unit> <trans-unit id="ERR_ClassDoesntImplementInterface"> <source>'{0}': containing type does not implement interface '{1}'</source> <target state="translated">'{0}': il tipo che lo contiene non implementa l'interfaccia '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitInterfaceImplementationInNonClassOrStruct"> <source>'{0}': explicit interface declaration can only be declared in a class, record, struct or interface</source> <target state="translated">'{0}': la dichiarazione esplicita dell'interfaccia può essere dichiarata sono in una classe, un record, uno struct o un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_MemberNameSameAsType"> <source>'{0}': member names cannot be the same as their enclosing type</source> <target state="translated">'{0}': i nomi dei membri non possono essere uguali a quelli del tipo di inclusione</target> <note /> </trans-unit> <trans-unit id="ERR_EnumeratorOverflow"> <source>'{0}': the enumerator value is too large to fit in its type</source> <target state="translated">'{0}': il valore dell'enumeratore è troppo grande per il tipo</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNonProperty"> <source>'{0}': cannot override because '{1}' is not a property</source> <target state="translated">'{0}': non è possibile eseguire l'override. '{1}' non è una proprietà</target> <note /> </trans-unit> <trans-unit id="ERR_NoGetToOverride"> <source>'{0}': cannot override because '{1}' does not have an overridable get accessor</source> <target state="translated">'{0}': non è possibile eseguire l'override perché '{1}' non ha una funzione di accesso get di cui eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_NoSetToOverride"> <source>'{0}': cannot override because '{1}' does not have an overridable set accessor</source> <target state="translated">'{0}': non è possibile eseguire l'override perché '{1}' non ha di una funzione di accesso set di cui eseguire l'override</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyCantHaveVoidType"> <source>'{0}': property or indexer cannot have void type</source> <target state="translated">'{0}': la proprietà o l'indicizzatore non può avere un tipo void</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyWithNoAccessors"> <source>'{0}': property or indexer must have at least one accessor</source> <target state="translated">'{0}': la proprietà o l'indicizzatore deve avere almeno una funzione di accesso</target> <note /> </trans-unit> <trans-unit id="ERR_NewVirtualInSealed"> <source>'{0}' is a new virtual member in sealed type '{1}'</source> <target state="translated">'{0}' è un nuovo membro virtuale nel tipo sealed '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitPropertyAddingAccessor"> <source>'{0}' adds an accessor not found in interface member '{1}'</source> <target state="translated">'{0}' aggiunge una funzione di accesso non trovata nel membro di interfaccia '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitPropertyMissingAccessor"> <source>Explicit interface implementation '{0}' is missing accessor '{1}'</source> <target state="translated">Nell'implementazione esplicita dell'interfaccia '{0}' manca la funzione di accesso '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionWithInterface"> <source>'{0}': user-defined conversions to or from an interface are not allowed</source> <target state="translated">'{0}': non sono consentite conversioni definite dall'utente da o verso un'interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionWithBase"> <source>'{0}': user-defined conversions to or from a base type are not allowed</source> <target state="translated">'{0}': le conversioni definite dall'utente da o verso un tipo di base non sono consentite</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionWithDerived"> <source>'{0}': user-defined conversions to or from a derived type are not allowed</source> <target state="translated">'{0}': le conversioni definite dall'utente da o verso un tipo derivato non sono consentite</target> <note /> </trans-unit> <trans-unit id="ERR_IdentityConversion"> <source>User-defined operator cannot convert a type to itself</source> <target state="needs-review-translation">L'operatore definito dall'utente non può accettare un oggetto del tipo di inclusione e convertirlo in un oggetto del tipo di inclusione</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionNotInvolvingContainedType"> <source>User-defined conversion must convert to or from the enclosing type</source> <target state="translated">La conversione definita dall'utente deve eseguire la conversione verso o da un tipo di inclusione</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConversionInClass"> <source>Duplicate user-defined conversion in type '{0}'</source> <target state="translated">Conversione definita dall'utente duplicata nel tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorsMustBeStatic"> <source>User-defined operator '{0}' must be declared static and public</source> <target state="translated">L'operatore definito dall'utente '{0}' deve essere dichiarato come static e public</target> <note /> </trans-unit> <trans-unit id="ERR_BadIncDecSignature"> <source>The parameter type for ++ or -- operator must be the containing type</source> <target state="translated">Il tipo di parametro per l'operatore ++ o -- deve essere il tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_BadUnaryOperatorSignature"> <source>The parameter of a unary operator must be the containing type</source> <target state="translated">Il parametro di un operatore unario deve essere il tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_BadBinaryOperatorSignature"> <source>One of the parameters of a binary operator must be the containing type</source> <target state="translated">Uno dei parametri di un operatore binario deve essere il tipo che lo contiene</target> <note /> </trans-unit> <trans-unit id="ERR_BadShiftOperatorSignature"> <source>The first operand of an overloaded shift operator must have the same type as the containing type, and the type of the second operand must be int</source> <target state="translated">Il primo operando di un operatore shift di overload deve essere dello stesso tipo del tipo che lo contiene, mentre il tipo del secondo operando deve essere int</target> <note /> </trans-unit> <trans-unit id="ERR_EnumsCantContainDefaultConstructor"> <source>Enums cannot contain explicit parameterless constructors</source> <target state="translated">Le enumerazioni non possono contenere costruttori espliciti senza parametri</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideBogusMethod"> <source>'{0}': cannot override '{1}' because it is not supported by the language</source> <target state="translated">'{0}': non è possibile eseguire l'override di '{1}' perché non è supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="ERR_BindToBogus"> <source>'{0}' is not supported by the language</source> <target state="translated">'{0}' non è supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="ERR_CantCallSpecialMethod"> <source>'{0}': cannot explicitly call operator or accessor</source> <target state="translated">'{0}': non è possibile chiamare in modo esplicito l'operatore o la funzione di accesso</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeReference"> <source>'{0}': cannot reference a type through an expression; try '{1}' instead</source> <target state="translated">'{0}': non è possibile fare riferimento a un tipo con un'espressione. Provare con '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadDestructorName"> <source>Name of destructor must match name of type</source> <target state="translated">Il nome del distruttore deve corrispondere al nome del tipo</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyClassesCanContainDestructors"> <source>Only class types can contain destructors</source> <target state="translated">Solo i tipi classe possono contenere distruttori</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictAliasAndMember"> <source>Namespace '{1}' contains a definition conflicting with alias '{0}'</source> <target state="translated">Lo spazio dei nomi '{1}' contiene una definizione in conflitto con l'alias '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingAliasAndDefinition"> <source>Alias '{0}' conflicts with {1} definition</source> <target state="translated">L'alias '{0}' è in conflitto con la definizione di {1}</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnSpecialMethod"> <source>The Conditional attribute is not valid on '{0}' because it is a constructor, destructor, operator, lambda expression, or explicit interface implementation</source> <target state="needs-review-translation">L'attributo Conditional non è valido per '{0}' perché è l'implementazione di un costruttore, un distruttore, un operatore o un'interfaccia esplicita</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalMustReturnVoid"> <source>The Conditional attribute is not valid on '{0}' because its return type is not void</source> <target state="translated">L'attributo Conditional non è valido per '{0}' perché il tipo restituito non è void</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAttribute"> <source>Duplicate '{0}' attribute</source> <target state="translated">L'attributo '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAttributeInNetModule"> <source>Duplicate '{0}' attribute in '{1}'</source> <target state="translated">L'attributo '{0}' è duplicato in '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnInterfaceMethod"> <source>The Conditional attribute is not valid on interface members</source> <target state="translated">L'attributo Conditional non è valido per i membri di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorCantReturnVoid"> <source>User-defined operators cannot return void</source> <target state="translated">Gli operatori definiti dall'utente non possono restituire void</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicConversion"> <source>'{0}': user-defined conversions to or from the dynamic type are not allowed</source> <target state="translated">'{0}': le conversioni definite dall'utente nel o dal tipo dinamico non sono consentite</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeArgument"> <source>Invalid value for argument to '{0}' attribute</source> <target state="translated">Il valore specificato per l'argomento dell'attributo '{0}' non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterNotValidForType"> <source>Parameter not valid for the specified unmanaged type.</source> <target state="translated">Il parametro non è valido per il tipo non gestito specificato.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired1"> <source>Attribute parameter '{0}' must be specified.</source> <target state="translated">È necessario specificare il parametro di attributo '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired2"> <source>Attribute parameter '{0}' or '{1}' must be specified.</source> <target state="translated">È necessario specificare il parametro di attributo '{0}' o '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeNotValidForFields"> <source>Unmanaged type '{0}' not valid for fields.</source> <target state="translated">Il tipo non gestito '{0}' non è valido per i campi.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeOnlyValidForFields"> <source>Unmanaged type '{0}' is only valid for fields.</source> <target state="translated">Il tipo non gestito '{0}' è valido solo per i campi.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOnBadSymbolType"> <source>Attribute '{0}' is not valid on this declaration type. It is only valid on '{1}' declarations.</source> <target state="translated">L'attributo '{0}' non è valido in questo tipo di dichiarazione. È valido solo in dichiarazioni di '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FloatOverflow"> <source>Floating-point constant is outside the range of type '{0}'</source> <target state="translated">La costante a virgola mobile non è inclusa nell'intervallo di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithoutUuidAttribute"> <source>The Guid attribute must be specified with the ComImport attribute</source> <target state="translated">L'attributo Guid deve essere specificato con l'attributo ComImport</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNamedArgument"> <source>Invalid value for named attribute argument '{0}'</source> <target state="translated">Il valore dell'argomento di attributo denominato '{0}' non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInvalidMethod"> <source>The DllImport attribute must be specified on a method marked 'static' and 'extern'</source> <target state="translated">L'attributo DllImport deve essere specificato in un metodo contrassegnato come 'static' ed 'extern'</target> <note /> </trans-unit> <trans-unit id="ERR_EncUpdateFailedMissingAttribute"> <source>Cannot update '{0}'; attribute '{1}' is missing.</source> <target state="translated">Non è possibile aggiornare '{0}'. Manca l'attributo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnGenericMethod"> <source>The DllImport attribute cannot be applied to a method that is generic or contained in a generic method or type.</source> <target state="translated">Non è possibile applicare l'attributo DllImport a un metodo generico o contenuto in un tipo o un metodo generico.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldCantBeRefAny"> <source>Field or property cannot be of type '{0}'</source> <target state="translated">Il campo o la proprietà non può essere di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_FieldAutoPropCantBeByRefLike"> <source>Field or auto-implemented property cannot be of type '{0}' unless it is an instance member of a ref struct.</source> <target state="translated">La proprietà di campo o implementata automaticamente non può essere di tipo '{0}' a meno che non sia un membro di istanza di uno struct ref.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayElementCantBeRefAny"> <source>Array elements cannot be of type '{0}'</source> <target state="translated">Gli elementi di una matrice non possono essere di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbol"> <source>'{0}' is obsolete</source> <target state="translated">'{0}' è obsoleto</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbol_Title"> <source>Type or member is obsolete</source> <target state="translated">Il tipo o il membro è obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_NotAnAttributeClass"> <source>'{0}' is not an attribute class</source> <target state="translated">'{0}' non è una classe Attribute</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedAttributeArgument"> <source>'{0}' is not a valid named attribute argument. Named attribute arguments must be fields which are not readonly, static, or const, or read-write properties which are public and not static.</source> <target state="translated">'{0}' non è un argomento di attributo denominato valido. Gli argomenti di attributo denominati devono essere campi che non siano di sola lettura, statici o costanti oppure proprietà di lettura/scrittura che siano pubbliche e non statiche.</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbolStr"> <source>'{0}' is obsolete: '{1}'</source> <target state="translated">'{0}' è obsoleto: '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedSymbolStr_Title"> <source>Type or member is obsolete</source> <target state="translated">Il tipo o il membro è obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_DeprecatedSymbolStr"> <source>'{0}' is obsolete: '{1}'</source> <target state="translated">'{0}' è obsoleto: '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_IndexerCantHaveVoidType"> <source>Indexers cannot have void type</source> <target state="translated">Gli indicizzatori non possono avere tipi void</target> <note /> </trans-unit> <trans-unit id="ERR_VirtualPrivate"> <source>'{0}': virtual or abstract members cannot be private</source> <target state="translated">'{0}': i membri virtuali o astratti non possono essere privati</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitToNonArrayType"> <source>Can only use array initializer expressions to assign to array types. Try using a new expression instead.</source> <target state="translated">Solo espressioni di inizializzazione di matrice possono essere utilizzate per assegnare a tipi matrice. Provare a utilizzare un'espressione new.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitInBadPlace"> <source>Array initializers can only be used in a variable or field initializer. Try using a new expression instead.</source> <target state="translated">Gli inizializzatori di matrice possono essere usati solo in un inizializzatore di campo o di variabile. Provare a usare un'espressione new.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingStructOffset"> <source>'{0}': instance field in types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute</source> <target state="translated">'{0}': il campo dell'istanza nei tipi contrassegnati con StructLayout(LayoutKind.Explicit) deve contenere un attributo FieldOffset</target> <note /> </trans-unit> <trans-unit id="WRN_ExternMethodNoImplementation"> <source>Method, operator, or accessor '{0}' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation.</source> <target state="translated">Il metodo, la funzione di accesso o l'operatore '{0}' è contrassegnato come esterno e non include attributi. Provare ad aggiungere un attributo DllImport per specificare l'implementazione esterna.</target> <note /> </trans-unit> <trans-unit id="WRN_ExternMethodNoImplementation_Title"> <source>Method, operator, or accessor is marked external and has no attributes on it</source> <target state="translated">Il metodo, la funzione di accesso o l'operatore è contrassegnato come esterno ed è privo di attributi</target> <note /> </trans-unit> <trans-unit id="WRN_ProtectedInSealed"> <source>'{0}': new protected member declared in sealed type</source> <target state="translated">'{0}': il nuovo membro protetto è stato dichiarato nel tipo sealed</target> <note /> </trans-unit> <trans-unit id="WRN_ProtectedInSealed_Title"> <source>New protected member declared in sealed type</source> <target state="translated">Il nuovo membro protetto è stato dichiarato nel tipo sealed</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedByConditional"> <source>Conditional member '{0}' cannot implement interface member '{1}' in type '{2}'</source> <target state="translated">Il membro condizionale '{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalRefParam"> <source>ref and out are not valid in this context</source> <target state="translated">ref e out non sono validi in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgumentToAttribute"> <source>The argument to the '{0}' attribute must be a valid identifier</source> <target state="translated">L'argomento dell'attributo '{0}' deve essere un identificatore valido</target> <note /> </trans-unit> <trans-unit id="ERR_StructOffsetOnBadStruct"> <source>The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)</source> <target state="translated">L'attributo FieldOffset può essere usato solo in membri di tipo contrassegnati con StructLayout(LayoutKind.Explicit)</target> <note /> </trans-unit> <trans-unit id="ERR_StructOffsetOnBadField"> <source>The FieldOffset attribute is not allowed on static or const fields</source> <target state="translated">L'uso dell'attributo FieldOffset non è consentito nei campi static o const</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeUsageOnNonAttributeClass"> <source>Attribute '{0}' is only valid on classes derived from System.Attribute</source> <target state="translated">L'attributo '{0}' è valido solo in classi derivate da System.Attribute</target> <note /> </trans-unit> <trans-unit id="WRN_PossibleMistakenNullStatement"> <source>Possible mistaken empty statement</source> <target state="translated">L'istruzione vuota è probabilmente errata</target> <note /> </trans-unit> <trans-unit id="WRN_PossibleMistakenNullStatement_Title"> <source>Possible mistaken empty statement</source> <target state="translated">L'istruzione vuota è probabilmente errata</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedAttributeArgument"> <source>'{0}' duplicate named attribute argument</source> <target state="translated">'L'argomento di attributo denominato '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DeriveFromEnumOrValueType"> <source>'{0}' cannot derive from special class '{1}'</source> <target state="translated">'{0}' non può derivare dalla classe speciale '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMemberOnIndexedType"> <source>Cannot specify the DefaultMember attribute on a type containing an indexer</source> <target state="translated">Impossibile specificare l'attributo DefaultMember in un tipo contenente un indicizzatore</target> <note /> </trans-unit> <trans-unit id="ERR_BogusType"> <source>'{0}' is a type not supported by the language</source> <target state="translated">'{0}' è un tipo non supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedInternalField"> <source>Field '{0}' is never assigned to, and will always have its default value {1}</source> <target state="translated">Non è possibile assegnare un valore diverso al campo '{0}'. Il valore predefinito è {1}</target> <note /> </trans-unit> <trans-unit id="WRN_UnassignedInternalField_Title"> <source>Field is never assigned to, and will always have its default value</source> <target state="translated">Non è possibile assegnare al campo un valore diverso da quello predefinito</target> <note /> </trans-unit> <trans-unit id="ERR_CStyleArray"> <source>Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.</source> <target state="translated">Il dichiaratore di matrice è errato: per dichiarare una matrice gestita, l'identificatore del numero di dimensioni deve precedere l'identificatore della variabile. Per dichiarare un campo buffer a dimensione fissa, usare la parola chiave fixed prima del tipo di campo.</target> <note /> </trans-unit> <trans-unit id="WRN_VacuousIntegralComp"> <source>Comparison to integral constant is useless; the constant is outside the range of type '{0}'</source> <target state="translated">Il confronto con la costante integrale è inutile. La costante non è inclusa nell'intervallo del tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_VacuousIntegralComp_Title"> <source>Comparison to integral constant is useless; the constant is outside the range of the type</source> <target state="translated">Il confronto con la costante integrale è inutile. La costante non è inclusa nell'intervallo del tipo</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractAttributeClass"> <source>Cannot apply attribute class '{0}' because it is abstract</source> <target state="translated">Non è possibile applicare la classe Attribute '{0}' perché è astratta</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedAttributeArgumentType"> <source>'{0}' is not a valid named attribute argument because it is not a valid attribute parameter type</source> <target state="translated">'{0}' non è un argomento di attributo denominato valido perché non è un tipo di parametro di attributo valido</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPredefinedMember"> <source>Missing compiler required member '{0}.{1}'</source> <target state="translated">Manca il membro '{0}.{1}', necessario per il compilatore</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeLocationOnBadDeclaration"> <source>'{0}' is not a valid attribute location for this declaration. Valid attribute locations for this declaration are '{1}'. All attributes in this block will be ignored.</source> <target state="translated">'{0}' non è una posizione valida dell'attributo per questa dichiarazione. Le posizioni valide degli attributi sono '{1}'. Tutti gli attributi in questo blocco verranno ignorati.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeLocationOnBadDeclaration_Title"> <source>Not a valid attribute location for this declaration</source> <target state="translated">Non è una posizione valida dell'attributo per questa dichiarazione</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAttributeLocation"> <source>'{0}' is not a recognized attribute location. Valid attribute locations for this declaration are '{1}'. All attributes in this block will be ignored.</source> <target state="translated">'{0}' non è una posizione riconosciuta dell'attributo. Le posizioni valide degli attributi sono '{1}'. Tutti gli attributi in questo blocco verranno ignorati.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAttributeLocation_Title"> <source>Not a recognized attribute location</source> <target state="translated">Non è una posizione di attributo riconosciuta</target> <note /> </trans-unit> <trans-unit id="WRN_EqualsWithoutGetHashCode"> <source>'{0}' overrides Object.Equals(object o) but does not override Object.GetHashCode()</source> <target state="translated">'{0}' esegue l'override di Object.Equals(object o) ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="WRN_EqualsWithoutGetHashCode_Title"> <source>Type overrides Object.Equals(object o) but does not override Object.GetHashCode()</source> <target state="translated">Il tipo esegue l'override di Object.Equals(object o) ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutEquals"> <source>'{0}' defines operator == or operator != but does not override Object.Equals(object o)</source> <target state="translated">'{0}' definisce l'operatore == o l'operatore != ma non esegue l'override di Object.Equals(object o)</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutEquals_Title"> <source>Type defines operator == or operator != but does not override Object.Equals(object o)</source> <target state="translated">Il tipo definisce l'operatore == o l'operatore != ma non esegue l'override di Object.Equals(object o)</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutGetHashCode"> <source>'{0}' defines operator == or operator != but does not override Object.GetHashCode()</source> <target state="translated">'{0}' definisce l'operatore == o l'operatore != ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="WRN_EqualityOpWithoutGetHashCode_Title"> <source>Type defines operator == or operator != but does not override Object.GetHashCode()</source> <target state="translated">Il tipo definisce l'operatore == o l'operatore != ma non esegue l'override di Object.GetHashCode()</target> <note /> </trans-unit> <trans-unit id="ERR_OutAttrOnRefParam"> <source>Cannot specify the Out attribute on a ref parameter without also specifying the In attribute.</source> <target state="translated">Non è possibile specificare l'attributo Out in un parametro ref senza specificare anche l'attributo In.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadRefKind"> <source>'{0}' cannot define an overloaded {1} that differs only on parameter modifiers '{2}' and '{3}'</source> <target state="translated">'{0}' non può definire un elemento {1} in rapporto di overload che differisce solo per i modificatori di parametro '{2}' e '{3}'</target> <note /> </trans-unit> <trans-unit id="ERR_LiteralDoubleCast"> <source>Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type</source> <target state="translated">Non è possibile convertire in modo implicito il valore letterale di tipo double nel tipo '{1}'. Usare un suffisso '{0}' per creare un valore letterale di questo tipo</target> <note /> </trans-unit> <trans-unit id="WRN_IncorrectBooleanAssg"> <source>Assignment in conditional expression is always constant; did you mean to use == instead of = ?</source> <target state="translated">L'assegnazione nell'espressione condizionale è sempre costante. Si intendeva utilizzare == invece di = ?</target> <note /> </trans-unit> <trans-unit id="WRN_IncorrectBooleanAssg_Title"> <source>Assignment in conditional expression is always constant</source> <target state="translated">L'assegnazione nell'espressione condizionale è sempre costante</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedInStruct"> <source>'{0}': new protected member declared in struct</source> <target state="translated">'{0}': in struct è stato dichiarato il nuovo membro protetto</target> <note /> </trans-unit> <trans-unit id="ERR_InconsistentIndexerNames"> <source>Two indexers have different names; the IndexerName attribute must be used with the same name on every indexer within a type</source> <target state="translated">Due indicizzatori hanno nomi diversi. L'attributo IndexerName deve essere usato con lo stesso nome in ogni indicizzatore all'interno di un tipo</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithUserCtor"> <source>A class with the ComImport attribute cannot have a user-defined constructor</source> <target state="translated">Una classe con l'attributo ComImport non può avere un costruttore definito dall'utente</target> <note /> </trans-unit> <trans-unit id="ERR_FieldCantHaveVoidType"> <source>Field cannot have void type</source> <target state="translated">Il campo non può essere di tipo void</target> <note /> </trans-unit> <trans-unit id="WRN_NonObsoleteOverridingObsolete"> <source>Member '{0}' overrides obsolete member '{1}'. Add the Obsolete attribute to '{0}'.</source> <target state="translated">Il membro '{0}' esegue l'override del membro obsoleto '{1}'. Aggiungere l'attributo Obsolete a '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NonObsoleteOverridingObsolete_Title"> <source>Member overrides obsolete member</source> <target state="translated">Il membro esegue l'override del membro obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_SystemVoid"> <source>System.Void cannot be used from C# -- use typeof(void) to get the void type object</source> <target state="translated">Non è possibile usare System.Void da C#. Usare typeof(void) per ottenere l'oggetto di tipo void</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitParamArray"> <source>Do not use 'System.ParamArrayAttribute'. Use the 'params' keyword instead.</source> <target state="translated">Non usare 'System.ParamArrayAttribute'. Al suo posto, usare la parola chiave 'params'.</target> <note /> </trans-unit> <trans-unit id="WRN_BitwiseOrSignExtend"> <source>Bitwise-or operator used on a sign-extended operand; consider casting to a smaller unsigned type first</source> <target state="translated">L'operatore OR bit per bit viene usato su un operando con segno esteso. Prima di usarlo, provare a eseguire il cast su un tipo più piccolo e senza segno</target> <note /> </trans-unit> <trans-unit id="WRN_BitwiseOrSignExtend_Title"> <source>Bitwise-or operator used on a sign-extended operand</source> <target state="translated">Operatore OR bit per bit usato su un operando con segno esteso</target> <note /> </trans-unit> <trans-unit id="WRN_BitwiseOrSignExtend_Description"> <source>The compiler implicitly widened and sign-extended a variable, and then used the resulting value in a bitwise OR operation. This can result in unexpected behavior.</source> <target state="translated">Il compilatore ha ampliato ed esteso con segno in modo implicito una variabile, usando quindi il valore risultante in un'operazione OR bit per bit. Questa operazione potrebbe causare comportamenti imprevisti.</target> <note /> </trans-unit> <trans-unit id="ERR_VolatileStruct"> <source>'{0}': a volatile field cannot be of the type '{1}'</source> <target state="translated">'{0}': un campo volatile non può essere di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_VolatileAndReadonly"> <source>'{0}': a field cannot be both volatile and readonly</source> <target state="translated">'{0}': un campo non può essere sia volatile che di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AbstractField"> <source>The modifier 'abstract' is not valid on fields. Try using a property instead.</source> <target state="translated">Il modificatore 'abstract' non è valido nei campi. Provare a utilizzare una proprietà.</target> <note /> </trans-unit> <trans-unit id="ERR_BogusExplicitImpl"> <source>'{0}' cannot implement '{1}' because it is not supported by the language</source> <target state="translated">'{0}' non può implementare '{1}' perché non è supportato dal linguaggio</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitMethodImplAccessor"> <source>'{0}' explicit method implementation cannot implement '{1}' because it is an accessor</source> <target state="translated">'L'implementazione esplicita del metodo '{0}' non può implementare '{1}' perché è una funzione di accesso</target> <note /> </trans-unit> <trans-unit id="WRN_CoClassWithoutComImport"> <source>'{0}' interface marked with 'CoClassAttribute' not marked with 'ComImportAttribute'</source> <target state="translated">'L'interfaccia '{0}' contrassegnata con 'CoClassAttribute' non è contrassegnata con 'ComImportAttribute'</target> <note /> </trans-unit> <trans-unit id="WRN_CoClassWithoutComImport_Title"> <source>Interface marked with 'CoClassAttribute' not marked with 'ComImportAttribute'</source> <target state="translated">L'interfaccia contrassegnata con 'CoClassAttribute' non è contrassegnata con 'ComImportAttribute'</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalWithOutParam"> <source>Conditional member '{0}' cannot have an out parameter</source> <target state="translated">Il membro condizionale '{0}' non può avere un parametro out</target> <note /> </trans-unit> <trans-unit id="ERR_AccessorImplementingMethod"> <source>Accessor '{0}' cannot implement interface member '{1}' for type '{2}'. Use an explicit interface implementation.</source> <target state="translated">La funzione di accesso '{0}' non può implementare il membro di interfaccia '{1}' per il tipo '{2}'. Usare un'implementazione esplicita dell'interfaccia.</target> <note /> </trans-unit> <trans-unit id="ERR_AliasQualAsExpression"> <source>The namespace alias qualifier '::' always resolves to a type or namespace so is illegal here. Consider using '.' instead.</source> <target state="translated">Il qualificatore di alias '::' dello spazio dei nomi viene sempre risolto in un tipo o in uno spazio dei nomi e non è pertanto valido in questa posizione. Si consiglia di utilizzare '.'.</target> <note /> </trans-unit> <trans-unit id="ERR_DerivingFromATyVar"> <source>Cannot derive from '{0}' because it is a type parameter</source> <target state="translated">Non è possibile derivare da '{0}' perché è un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeParameter"> <source>Duplicate type parameter '{0}'</source> <target state="translated">Parametro di tipo '{0}' duplicato</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterTypeParameter"> <source>Type parameter '{0}' has the same name as the type parameter from outer type '{1}'</source> <target state="translated">Il parametro di tipo '{0}' ha lo stesso nome del parametro del tipo outer '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_TypeParameterSameAsOuterTypeParameter_Title"> <source>Type parameter has the same name as the type parameter from outer type</source> <target state="translated">Il parametro di tipo ha lo stesso nome del parametro del tipo outer</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVariableSameAsParent"> <source>Type parameter '{0}' has the same name as the containing type, or method</source> <target state="translated">Il parametro di tipo '{0}' ha lo stesso nome del tipo che lo contiene o del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_UnifyingInterfaceInstantiations"> <source>'{0}' cannot implement both '{1}' and '{2}' because they may unify for some type parameter substitutions</source> <target state="translated">'{0}' non può implementare sia '{1}' che '{2}' perché potrebbero unificarsi per alcune sostituzioni di parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_TyVarNotFoundInConstraint"> <source>'{1}' does not define type parameter '{0}'</source> <target state="translated">'{1}' non definisce il parametro di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadBoundType"> <source>'{0}' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.</source> <target state="translated">'{0}' non è un vincolo valido. Un tipo usato come vincolo deve essere un'interfaccia, una classe non sealed o un parametro di tipo.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecialTypeAsBound"> <source>Constraint cannot be special class '{0}'</source> <target state="translated">Il vincolo non può essere la classe speciale '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisBound"> <source>Inconsistent accessibility: constraint type '{1}' is less accessible than '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di vincolo '{1}' è meno accessibile di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_LookupInTypeVariable"> <source>Cannot do member lookup in '{0}' because it is a type parameter</source> <target state="translated">Non è possibile eseguire la ricerca di membri in '{0}' perché è un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstraintType"> <source>Invalid constraint type. A type used as a constraint must be an interface, a non-sealed class or a type parameter.</source> <target state="translated">Il tipo vincolo non è valido. Un tipo usato come vincolo deve essere un'interfaccia, una classe non sealed o un parametro di tipo.</target> <note /> </trans-unit> <trans-unit id="ERR_InstanceMemberInStaticClass"> <source>'{0}': cannot declare instance members in a static class</source> <target state="translated">'{0}': non è possibile dichiarare i membri di istanza in una classe statica</target> <note /> </trans-unit> <trans-unit id="ERR_StaticBaseClass"> <source>'{1}': cannot derive from static class '{0}'</source> <target state="translated">'{1}' non può derivare dalla classe statica '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorInStaticClass"> <source>Static classes cannot have instance constructors</source> <target state="translated">Le classi statiche non possono avere costruttori di istanze</target> <note /> </trans-unit> <trans-unit id="ERR_DestructorInStaticClass"> <source>Static classes cannot contain destructors</source> <target state="translated">Le classi statiche non possono contenere distruttori</target> <note /> </trans-unit> <trans-unit id="ERR_InstantiatingStaticClass"> <source>Cannot create an instance of the static class '{0}'</source> <target state="translated">Non è possibile creare un'istanza della classe statica '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_StaticDerivedFromNonObject"> <source>Static class '{0}' cannot derive from type '{1}'. Static classes must derive from object.</source> <target state="translated">La classe statica '{0}' non può derivare dal tipo '{1}'. Le classi statiche devono derivare dall'oggetto.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticClassInterfaceImpl"> <source>'{0}': static classes cannot implement interfaces</source> <target state="translated">'{0}': le classi statiche non possono implementare interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_RefStructInterfaceImpl"> <source>'{0}': ref structs cannot implement interfaces</source> <target state="translated">'{0}': gli struct ref non possono implementare interfacce</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorInStaticClass"> <source>'{0}': static classes cannot contain user-defined operators</source> <target state="translated">'{0}': le classi statiche non possono contenere operatori definiti dall'utente</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertToStaticClass"> <source>Cannot convert to static type '{0}'</source> <target state="translated">Non è possibile convertire nel tipo statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintIsStaticClass"> <source>'{0}': static classes cannot be used as constraints</source> <target state="translated">'{0}': non si possono usare classi statiche come vincoli</target> <note /> </trans-unit> <trans-unit id="ERR_GenericArgIsStaticClass"> <source>'{0}': static types cannot be used as type arguments</source> <target state="translated">'{0}': i tipi statici non possono essere usati come argomenti di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayOfStaticClass"> <source>'{0}': array elements cannot be of static type</source> <target state="translated">'{0}': gli elementi di matrice non possono essere di tipo statico</target> <note /> </trans-unit> <trans-unit id="ERR_IndexerInStaticClass"> <source>'{0}': cannot declare indexers in a static class</source> <target state="translated">'{0}': non è possibile dichiarare indicizzatori in una classe statica</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterIsStaticClass"> <source>'{0}': static types cannot be used as parameters</source> <target state="translated">'{0}': i tipi statici non possono essere usati come parametri</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnTypeIsStaticClass"> <source>'{0}': static types cannot be used as return types</source> <target state="translated">'{0}': i tipi statici non possono essere usati come tipi restituiti</target> <note /> </trans-unit> <trans-unit id="ERR_VarDeclIsStaticClass"> <source>Cannot declare a variable of static type '{0}'</source> <target state="translated">Non è possibile dichiarare una variabile di tipo statico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyThrowInFinally"> <source>A throw statement with no arguments is not allowed in a finally clause that is nested inside the nearest enclosing catch clause</source> <target state="translated">L'utilizzo dell'istruzione throw senza argomenti non è consentito in una clausola finally annidata all'interno della clausola catch di inclusione più vicina</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSpecifier"> <source>'{0}' is not a valid format specifier</source> <target state="translated">'{0}' non è un identificatore di formato valido</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToLockOrDispose"> <source>Possibly incorrect assignment to local '{0}' which is the argument to a using or lock statement. The Dispose call or unlocking will happen on the original value of the local.</source> <target state="translated">È probabile che l'assegnazione all'elemento '{0}' locale, che rappresenta l'argomento di un'istruzione using o lock, non sia corretta. La chiamata Dispose o lo sblocco verrà eseguito sul valore originale dell'elemento locale.</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToLockOrDispose_Title"> <source>Possibly incorrect assignment to local which is the argument to a using or lock statement</source> <target state="translated">È probabile che l'assegnazione alla variabile locale, che rappresenta l'argomento di un'istruzione using o lock, non sia corretta</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeInThisAssembly"> <source>Type '{0}' is defined in this assembly, but a type forwarder is specified for it</source> <target state="translated">Il tipo '{0}' è definito in questo assembly, ma per esso è specificato un server d'inoltro dei tipi</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeIsNested"> <source>Cannot forward type '{0}' because it is a nested type of '{1}'</source> <target state="translated">Non è possibile inoltrare il tipo '{0}' perché è un tipo annidato di '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_CycleInTypeForwarder"> <source>The type forwarder for type '{0}' in assembly '{1}' causes a cycle</source> <target state="translated">Il server d'inoltro del tipo '{0}' nell'assembly '{1}' causa un ciclo</target> <note /> </trans-unit> <trans-unit id="ERR_AssemblyNameOnNonModule"> <source>The /moduleassemblyname option may only be specified when building a target type of 'module'</source> <target state="translated">L'opzione /moduleassemblyname può essere specificata solo durante la compilazione del tipo di destinazione di 'module'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved</source> <target state="translated">Il riferimento all'assembly '{0}' non è valido e non può essere risolto</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFwdType"> <source>Invalid type specified as an argument for TypeForwardedTo attribute</source> <target state="translated">Tipo non valido specificato come argomento dell'attributo TypeForwardedTo</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberStatic"> <source>'{0}' does not implement instance interface member '{1}'. '{2}' cannot implement the interface member because it is static.</source> <target state="needs-review-translation">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare un membro di interfaccia perché è di tipo statico.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberNotPublic"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement an interface member because it is not public.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare un membro di interfaccia perché non è pubblico.</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberWrongReturnType"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}' because it does not have the matching return type of '{3}'.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare '{1}' perché non ha il tipo restituito corrispondente di '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeForwarder"> <source>'{0}' duplicate TypeForwardedToAttribute</source> <target state="translated">'TypeForwardedToAttribute è duplicato in '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSelectOrGroup"> <source>A query body must end with a select clause or a group clause</source> <target state="translated">Il corpo di una query deve terminare con una clausola select o group</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContextualKeywordOn"> <source>Expected contextual keyword 'on'</source> <target state="translated">È prevista la parola chiave contestuale 'on'</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContextualKeywordEquals"> <source>Expected contextual keyword 'equals'</source> <target state="translated">È prevista la parola chiave contestuale 'equals'</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContextualKeywordBy"> <source>Expected contextual keyword 'by'</source> <target state="translated">È prevista la parola chiave contestuale 'by'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAnonymousTypeMemberDeclarator"> <source>Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.</source> <target state="translated">Dichiaratore di membro di tipo anonimo non valido. I membri di tipo anonimo devono essere dichiarati con una assegnazione membro, nome semplice o accesso ai membri.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInitializerElementInitializer"> <source>Invalid initializer member declarator</source> <target state="translated">Dichiaratore di membro di inizializzatore non valido</target> <note /> </trans-unit> <trans-unit id="ERR_InconsistentLambdaParameterUsage"> <source>Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit</source> <target state="translated">Utilizzo non coerente dei parametri lambda: i parametri devono essere tutti di tipo esplicito o implicito</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInvalidModifier"> <source>A partial method cannot have the 'abstract' modifier</source> <target state="translated">Un metodo parziale non può contenere il modificatore 'abstract'</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodOnlyInPartialClass"> <source>A partial method must be declared within a partial type</source> <target state="translated">Un metodo parziale deve essere dichiarato in un tipo parziale</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodNotExplicit"> <source>A partial method may not explicitly implement an interface method</source> <target state="translated">Un metodo parziale non può implementare in modo esplicito un metodo di interfaccia</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodExtensionDifference"> <source>Both partial method declarations must be extension methods or neither may be an extension method</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono essere metodi di estensione, altrimenti nessuna delle due potrà esserlo</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodOnlyOneLatent"> <source>A partial method may not have multiple defining declarations</source> <target state="translated">Un metodo parziale non può avere più dichiarazioni di definizione</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodOnlyOneActual"> <source>A partial method may not have multiple implementing declarations</source> <target state="translated">Un metodo parziale non può avere più dichiarazioni di implementazione</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamsDifference"> <source>Both partial method declarations must use a params parameter or neither may use a params parameter</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono usare un parametro params, altrimenti nessuna delle due potrà usarla</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodMustHaveLatent"> <source>No defining declaration found for implementing declaration of partial method '{0}'</source> <target state="translated">Non sono state trovate dichiarazioni di definizione per la dichiarazione di implementazione del metodo parziale '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInconsistentTupleNames"> <source>Both partial method declarations, '{0}' and '{1}', must use the same tuple element names.</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale '{0}' e '{1}' devono usare gli stessi nomi di elementi di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInconsistentConstraints"> <source>Partial method declarations of '{0}' have inconsistent constraints for type parameter '{1}'</source> <target state="translated">Le dichiarazioni di metodo parziali di '{0}' contengono vincoli incoerenti per il parametro di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodToDelegate"> <source>Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration</source> <target state="translated">Non è possibile creare il delegato dal metodo '{0}' perché è un metodo parziale senza una dichiarazione di implementazione</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodStaticDifference"> <source>Both partial method declarations must be static or neither may be static</source> <target state="translated">Entrambe le dichiarazioni di metodo parziale devono essere statiche, altrimenti nessuna delle due potrà esserlo</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodUnsafeDifference"> <source>Both partial method declarations must be unsafe or neither may be unsafe</source> <target state="translated">Nessuna o entrambe le dichiarazioni di metodi parziali devono essere di tipo unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodInExpressionTree"> <source>Partial methods with only a defining declaration or removed conditional methods cannot be used in expression trees</source> <target state="translated">Non è possibile usare negli alberi delle espressioni metodi parziali contenenti solo una dichiarazione di definizione o metodi condizionali rimossi</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteOverridingNonObsolete"> <source>Obsolete member '{0}' overrides non-obsolete member '{1}'</source> <target state="translated">Il membro obsoleto '{0}' esegue l'override del membro non obsoleto '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteOverridingNonObsolete_Title"> <source>Obsolete member overrides non-obsolete member</source> <target state="translated">Il membro obsoleto esegue l'override del membro non obsoleto</target> <note /> </trans-unit> <trans-unit id="WRN_DebugFullNameTooLong"> <source>The fully qualified name for '{0}' is too long for debug information. Compile without '/debug' option.</source> <target state="translated">Il nome completo per '{0}' è troppo lungo per le informazioni di debug. Compilare senza l'opzione '/debug'.</target> <note /> </trans-unit> <trans-unit id="WRN_DebugFullNameTooLong_Title"> <source>Fully qualified name is too long for debug information</source> <target state="translated">Il nome completo è troppo lungo per le informazioni di debug</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableAssignedBadValue"> <source>Cannot assign {0} to an implicitly-typed variable</source> <target state="translated">Non è possibile assegnare {0} a una variabile tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableWithNoInitializer"> <source>Implicitly-typed variables must be initialized</source> <target state="translated">Le variabili tipizzate in modo implicito devono essere inizializzate</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableMultipleDeclarator"> <source>Implicitly-typed variables cannot have multiple declarators</source> <target state="translated">Le variabili tipizzate in modo implicito non possono avere più dichiaratori</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableAssignedArrayInitializer"> <source>Cannot initialize an implicitly-typed variable with an array initializer</source> <target state="translated">Non è possibile inizializzare una variabile locale tipizzata in modo implicito con un inizializzatore di matrici</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedLocalCannotBeFixed"> <source>Implicitly-typed local variables cannot be fixed</source> <target state="translated">Le variabili locali tipizzate in modo implicito non possono essere di tipo fisso</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedVariableCannotBeConst"> <source>Implicitly-typed variables cannot be constant</source> <target state="translated">Le variabili tipizzate in modo implicito non possono essere costanti</target> <note /> </trans-unit> <trans-unit id="WRN_ExternCtorNoImplementation"> <source>Constructor '{0}' is marked external</source> <target state="translated">Il costruttore '{0}' è contrassegnato come esterno</target> <note /> </trans-unit> <trans-unit id="WRN_ExternCtorNoImplementation_Title"> <source>Constructor is marked external</source> <target state="translated">Il costruttore è contrassegnato come esterno</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVarNotFound"> <source>The contextual keyword 'var' may only appear within a local variable declaration or in script code</source> <target state="translated">La parola chiave contestuale 'var' può essere specificata solo all'interno di una dichiarazione di variabile locale o in codice script</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedArrayNoBestType"> <source>No best type found for implicitly-typed array</source> <target state="translated">Impossibile trovare il tipo migliore per la matrice tipizzata in modo implicito</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypePropertyAssignedBadValue"> <source>Cannot assign '{0}' to anonymous type property</source> <target state="translated">Non è possibile assegnare '{0}' alla proprietà di tipo anonimo</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsBaseAccess"> <source>An expression tree may not contain a base access</source> <target state="translated">L'albero delle espressioni non può contenere un accesso di base</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsAssignment"> <source>An expression tree may not contain an assignment operator</source> <target state="translated">L'albero delle espressioni non può contenere un operatore di assegnazione</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeDuplicatePropertyName"> <source>An anonymous type cannot have multiple properties with the same name</source> <target state="translated">Un tipo anonimo non può avere più proprietà con lo stesso nome</target> <note /> </trans-unit> <trans-unit id="ERR_StatementLambdaToExpressionTree"> <source>A lambda expression with a statement body cannot be converted to an expression tree</source> <target state="translated">Non è possibile convertire un'espressione lambda con il corpo di un'istruzione in un albero delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeMustHaveDelegate"> <source>Cannot convert lambda to an expression tree whose type argument '{0}' is not a delegate type</source> <target state="translated">Non è possibile convertire un'espressione lambda in un albero delle espressioni in cui l'argomento '{0}' del tipo non è un tipo delegato</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNotAvailable"> <source>Cannot use anonymous type in a constant expression</source> <target state="translated">Impossibile utilizzare il tipo anonimo in un'espressione costante</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaInIsAs"> <source>The first operand of an 'is' or 'as' operator may not be a lambda expression, anonymous method, or method group.</source> <target state="translated">Il primo operando di un operatore 'is' o 'as' non può essere un'espressione lambda, un metodo anonimo o un gruppo di metodi.</target> <note /> </trans-unit> <trans-unit id="ERR_TypelessTupleInAs"> <source>The first operand of an 'as' operator may not be a tuple literal without a natural type.</source> <target state="translated">Il primo operando di un operatore 'as' non può essere un valore letterale di tupla senza un tipo naturale.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsMultiDimensionalArrayInitializer"> <source>An expression tree may not contain a multidimensional array initializer</source> <target state="translated">L'albero delle espressioni non può contenere un inizializzatore di matrici multidimensionali</target> <note /> </trans-unit> <trans-unit id="ERR_MissingArgument"> <source>Argument missing</source> <target state="translated">Manca l'argomento</target> <note /> </trans-unit> <trans-unit id="ERR_VariableUsedBeforeDeclaration"> <source>Cannot use local variable '{0}' before it is declared</source> <target state="translated">Non è possibile usare la variabile locale '{0}' prima che sia dichiarata</target> <note /> </trans-unit> <trans-unit id="ERR_RecursivelyTypedVariable"> <source>Type of '{0}' cannot be inferred since its initializer directly or indirectly refers to the definition.</source> <target state="translated">Il tipo di '{0}' non può essere dedotto perché il relativo inizializzatore fa riferimento in modo diretto o indiretto alla definizione.</target> <note /> </trans-unit> <trans-unit id="ERR_UnassignedThisAutoProperty"> <source>Auto-implemented property '{0}' must be fully assigned before control is returned to the caller.</source> <target state="translated">La proprietà implementata automaticamente '{0}' deve essere completamente assegnata prima che il controllo venga restituito al chiamante.</target> <note /> </trans-unit> <trans-unit id="ERR_VariableUsedBeforeDeclarationAndHidesField"> <source>Cannot use local variable '{0}' before it is declared. The declaration of the local variable hides the field '{1}'.</source> <target state="translated">Non è possibile usare la variabile locale '{0}' prima che sia dichiarata. La dichiarazione della variabile locale nasconde il campo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsBadCoalesce"> <source>An expression tree lambda may not contain a coalescing operator with a null or default literal left-hand side</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un operatore di coalescenza con un valore letterale Null o predefinito nella parte sinistra</target> <note /> </trans-unit> <trans-unit id="ERR_IdentifierExpected"> <source>Identifier expected</source> <target state="translated">È previsto un identificatore</target> <note /> </trans-unit> <trans-unit id="ERR_SemicolonExpected"> <source>; expected</source> <target state="translated">È previsto un punto e virgola (;)</target> <note /> </trans-unit> <trans-unit id="ERR_SyntaxError"> <source>Syntax error, '{0}' expected</source> <target state="translated">Errore di sintassi. È previsto '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateModifier"> <source>Duplicate '{0}' modifier</source> <target state="translated">Il modificatore '{0}' è duplicato</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAccessor"> <source>Property accessor already defined</source> <target state="translated">La funzione di accesso alla proprietà è già definita</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralTypeExpected"> <source>Type byte, sbyte, short, ushort, int, uint, long, or ulong expected</source> <target state="translated">È previsto il tipo byte, sbyte, short, ushort, int, uint, long o ulong</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalEscape"> <source>Unrecognized escape sequence</source> <target state="translated">Sequenza di escape non riconosciuta</target> <note /> </trans-unit> <trans-unit id="ERR_NewlineInConst"> <source>Newline in constant</source> <target state="translated">Nuova riga nella costante</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyCharConst"> <source>Empty character literal</source> <target state="translated">Il valore letterale carattere è vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyCharsInConst"> <source>Too many characters in character literal</source> <target state="translated">Troppi caratteri nel valore letterale carattere</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNumber"> <source>Invalid number</source> <target state="translated">Numero non valido</target> <note /> </trans-unit> <trans-unit id="ERR_GetOrSetExpected"> <source>A get or set accessor expected</source> <target state="translated">È prevista una funzione di accesso get o set</target> <note /> </trans-unit> <trans-unit id="ERR_ClassTypeExpected"> <source>An object, string, or class type expected</source> <target state="translated">È previsto un tipo oggetto, stringa o classe</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentExpected"> <source>Named attribute argument expected</source> <target state="translated">È previsto un argomento denominato dell'attributo</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyCatches"> <source>Catch clauses cannot follow the general catch clause of a try statement</source> <target state="translated">Le clausole catch non possono seguire la clausola catch generale di un'istruzione try</target> <note /> </trans-unit> <trans-unit id="ERR_ThisOrBaseExpected"> <source>Keyword 'this' or 'base' expected</source> <target state="translated">È prevista la parola chiave 'this' o 'base'</target> <note /> </trans-unit> <trans-unit id="ERR_OvlUnaryOperatorExpected"> <source>Overloadable unary operator expected</source> <target state="translated">È previsto un operatore unario che supporti l'overload</target> <note /> </trans-unit> <trans-unit id="ERR_OvlBinaryOperatorExpected"> <source>Overloadable binary operator expected</source> <target state="translated">È previsto un operatore binario che supporti l'overload</target> <note /> </trans-unit> <trans-unit id="ERR_IntOverflow"> <source>Integral constant is too large</source> <target state="translated">La costante integrale è troppo grande</target> <note /> </trans-unit> <trans-unit id="ERR_EOFExpected"> <source>Type or namespace definition, or end-of-file expected</source> <target state="translated">È prevista la definizione del tipo o dello spazio dei nomi oppure la fine del file</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalDefinitionOrStatementExpected"> <source>Member definition, statement, or end-of-file expected</source> <target state="translated">È prevista una definizione di membro, un'istruzione o la fine del file</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmbeddedStmt"> <source>Embedded statement cannot be a declaration or labeled statement</source> <target state="translated">Un'istruzione incorporata non può essere una dichiarazione o un'istruzione con etichetta</target> <note /> </trans-unit> <trans-unit id="ERR_PPDirectiveExpected"> <source>Preprocessor directive expected</source> <target state="translated">È prevista la direttiva per il preprocessore</target> <note /> </trans-unit> <trans-unit id="ERR_EndOfPPLineExpected"> <source>Single-line comment or end-of-line expected</source> <target state="translated">È previsto un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="ERR_CloseParenExpected"> <source>) expected</source> <target state="translated">È previsto il segno )</target> <note /> </trans-unit> <trans-unit id="ERR_EndifDirectiveExpected"> <source>#endif directive expected</source> <target state="translated">È prevista la direttiva #endif</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedDirective"> <source>Unexpected preprocessor directive</source> <target state="translated">La direttiva per il preprocessore è imprevista</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorDirective"> <source>#error: '{0}'</source> <target state="translated">#error: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_WarningDirective"> <source>#warning: '{0}'</source> <target state="translated">#warning: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_WarningDirective_Title"> <source>#warning directive</source> <target state="translated">direttiva #warning</target> <note /> </trans-unit> <trans-unit id="ERR_TypeExpected"> <source>Type expected</source> <target state="translated">È previsto un tipo</target> <note /> </trans-unit> <trans-unit id="ERR_PPDefFollowsToken"> <source>Cannot define/undefine preprocessor symbols after first token in file</source> <target state="translated">Impossibile definire o annullare la definizione dei simboli del preprocessore dopo il primo token nel file</target> <note /> </trans-unit> <trans-unit id="ERR_PPReferenceFollowsToken"> <source>Cannot use #r after first token in file</source> <target state="translated">Non è possibile usare #r dopo il primo token del file</target> <note /> </trans-unit> <trans-unit id="ERR_OpenEndedComment"> <source>End-of-file found, '*/' expected</source> <target state="translated">Trovata la fine del file, era previsto '*/'</target> <note /> </trans-unit> <trans-unit id="ERR_Merge_conflict_marker_encountered"> <source>Merge conflict marker encountered</source> <target state="translated">È stato rilevato un marcatore di conflitti di merge</target> <note /> </trans-unit> <trans-unit id="ERR_NoRefOutWhenRefOnly"> <source>Do not use refout when using refonly.</source> <target state="translated">Non usare refout quando si usa refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNetModuleOutputWhenRefOutOrRefOnly"> <source>Cannot compile net modules when using /refout or /refonly.</source> <target state="translated">Non è possibile compilare i moduli .NET quando si usa /refout o /refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_OvlOperatorExpected"> <source>Overloadable operator expected</source> <target state="translated">È previsto un operatore che supporti l'overload</target> <note /> </trans-unit> <trans-unit id="ERR_EndRegionDirectiveExpected"> <source>#endregion directive expected</source> <target state="translated">È prevista la direttiva #endregion</target> <note /> </trans-unit> <trans-unit id="ERR_UnterminatedStringLit"> <source>Unterminated string literal</source> <target state="translated">Valore letterale stringa non completo</target> <note /> </trans-unit> <trans-unit id="ERR_BadDirectivePlacement"> <source>Preprocessor directives must appear as the first non-whitespace character on a line</source> <target state="translated">Le direttive per il preprocessore devono trovarsi all'inizio di una riga</target> <note /> </trans-unit> <trans-unit id="ERR_IdentifierExpectedKW"> <source>Identifier expected; '{1}' is a keyword</source> <target state="translated">È previsto un identificatore, mentre '{1}' è una parola chiave</target> <note /> </trans-unit> <trans-unit id="ERR_SemiOrLBraceExpected"> <source>{ or ; expected</source> <target state="translated">È previsto il segno { o un punto e virgola (;)</target> <note /> </trans-unit> <trans-unit id="ERR_MultiTypeInDeclaration"> <source>Cannot use more than one type in a for, using, fixed, or declaration statement</source> <target state="translated">Impossibile utilizzare più di un tipo nelle istruzioni for, using, fixed e nelle dichiarazioni</target> <note /> </trans-unit> <trans-unit id="ERR_AddOrRemoveExpected"> <source>An add or remove accessor expected</source> <target state="translated">È prevista una funzione di accesso add o remove</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedCharacter"> <source>Unexpected character '{0}'</source> <target state="translated">Il carattere '{0}' è imprevisto</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedToken"> <source>Unexpected token '{0}'</source> <target state="translated">Token '{0}' imprevisto</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedInStatic"> <source>'{0}': static classes cannot contain protected members</source> <target state="translated">'{0}': le classi statiche non possono contenere membri protetti</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableGeneralCatch"> <source>A previous catch clause already catches all exceptions. All non-exceptions thrown will be wrapped in a System.Runtime.CompilerServices.RuntimeWrappedException.</source> <target state="translated">Una clausola catch precedente rileva già tutte le eccezioni. Verrà eseguito il wrapping di tutti gli oggetti generati diversi da un'eccezione in System.Runtime.CompilerServices.RuntimeWrappedException.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableGeneralCatch_Title"> <source>A previous catch clause already catches all exceptions</source> <target state="translated">Una clausola catch precedente rileva già tutte le eccezioni</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableGeneralCatch_Description"> <source>This warning is caused when a catch() block has no specified exception type after a catch (System.Exception e) block. The warning advises that the catch() block will not catch any exceptions. A catch() block after a catch (System.Exception e) block can catch non-CLS exceptions if the RuntimeCompatibilityAttribute is set to false in the AssemblyInfo.cs file: [assembly: RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)]. If this attribute is not set explicitly to false, all thrown non-CLS exceptions are wrapped as Exceptions and the catch (System.Exception e) block catches them.</source> <target state="translated">Questo avviso viene visualizzato quando per un blocco catch() non è stato specificato un tipo di eccezione dopo un blocco catch (System.Exception e). L'avviso indica che il blocco catch() non rileverà alcuna eccezione. Un blocco catch() dopo un blocco catch (System.Exception e) può rilevare eccezioni non CLS se RuntimeCompatibilityAttribute è impostato su false nel file AssemblyInfo.cs file: [assembly: RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)]. Se questo attributo non è impostato in modo esplicito su false, verrà eseguito il wrapping di tutte le eccezioni non CLS rilevate come Exception per consentire al blocco catch (System.Exception e) di rilevarle.</target> <note /> </trans-unit> <trans-unit id="ERR_IncrementLvalueExpected"> <source>The operand of an increment or decrement operator must be a variable, property or indexer</source> <target state="translated">L'operando di un operatore di incremento o decremento deve essere una variabile, una proprietà o un indicizzatore</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuchMemberOrExtension"> <source>'{0}' does not contain a definition for '{1}' and no accessible extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?)</source> <target state="translated">'{0}' non contiene una definizione di '{1}' e non è stato trovato alcun metodo di estensione accessibile '{1}' che accetta un primo argomento di tipo '{0}'. Probabilmente manca una direttiva using o un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuchMemberOrExtensionNeedUsing"> <source>'{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive for '{2}'?)</source> <target state="translated">'{0}' non contiene una definizione di '{1}' e non è stato trovato alcun metodo di estensione '{1}' che accetta un primo argomento di tipo '{0}'. Probabilmente manca una direttiva using per '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadThisParam"> <source>Method '{0}' has a parameter modifier 'this' which is not on the first parameter</source> <target state="translated">Il metodo '{0}' ha un modificatore di parametro 'this' che non si trova nel primo parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadParameterModifiers"> <source> The parameter modifier '{0}' cannot be used with '{1}'</source> <target state="translated"> Non è possibile usare il modificatore di parametro '{0}' con '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeforThis"> <source>The first parameter of an extension method cannot be of type '{0}'</source> <target state="translated">Il primo parametro di un metodo di estensione non può essere di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamModThis"> <source>A parameter array cannot be used with 'this' modifier on an extension method</source> <target state="translated">Non è possibile usare una matrice di parametri con il modificatore 'this' in un metodo di estensione</target> <note /> </trans-unit> <trans-unit id="ERR_BadExtensionMeth"> <source>Extension method must be static</source> <target state="translated">Il metodo di estensione deve essere statico</target> <note /> </trans-unit> <trans-unit id="ERR_BadExtensionAgg"> <source>Extension method must be defined in a non-generic static class</source> <target state="translated">Il metodo di estensione deve essere definito in una classe statica non generica</target> <note /> </trans-unit> <trans-unit id="ERR_DupParamMod"> <source>A parameter can only have one '{0}' modifier</source> <target state="translated">Un parametro può avere un solo modificatore '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodsDecl"> <source>Extension methods must be defined in a top level static class; {0} is a nested class</source> <target state="translated">I metodi di estensione devono essere definiti in una classe statica di primo livello, mentre {0} è una classe annidata</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionAttrNotFound"> <source>Cannot define a new extension method because the compiler required type '{0}' cannot be found. Are you missing a reference to System.Core.dll?</source> <target state="translated">Non è possibile definire un nuovo metodo di estensione perché non è stato trovato il tipo '{0}' richiesto dal compilatore. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitExtension"> <source>Do not use 'System.Runtime.CompilerServices.ExtensionAttribute'. Use the 'this' keyword instead.</source> <target state="translated">Non usare 'System.Runtime.CompilerServices.ExtensionAttribute'. Usare la parola chiave 'this'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitDynamicAttr"> <source>Do not use 'System.Runtime.CompilerServices.DynamicAttribute'. Use the 'dynamic' keyword instead.</source> <target state="translated">Non usare 'System.Runtime.CompilerServices.DynamicAttribute'. Usare la parola chiave 'dynamic'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDynamicPhantomOnBaseCtor"> <source>The constructor call needs to be dynamically dispatched, but cannot be because it is part of a constructor initializer. Consider casting the dynamic arguments.</source> <target state="translated">Non è possibile eseguire l'invio dinamico richiesto della chiamata al costruttore perché la chiamata fa parte di un inizializzatore del costruttore. Provare a eseguire il cast degli argomenti dinamici.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTypeExtDelegate"> <source>Extension method '{0}' defined on value type '{1}' cannot be used to create delegates</source> <target state="translated">Non è possibile usare il metodo di estensione '{0}' definito nel tipo di valore '{1}' per creare delegati</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgCount"> <source>No overload for method '{0}' takes {1} arguments</source> <target state="translated">Nessun overload del metodo '{0}' accetta {1} argomenti</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgType"> <source>Argument {0}: cannot convert from '{1}' to '{2}'</source> <target state="translated">Argomento {0}: non è possibile convertire da '{1}' a '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoSourceFile"> <source>Source file '{0}' could not be opened -- {1}</source> <target state="translated">Non è possibile aprire il file di origine '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantRefResource"> <source>Cannot link resource files when building a module</source> <target state="translated">Non è possibile collegare i file di risorse durante la compilazione di un modulo</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceNotUnique"> <source>Resource identifier '{0}' has already been used in this assembly</source> <target state="translated">L'identificatore di risorsa '{0}' è già stato usato in questo assembly</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceFileNameNotUnique"> <source>Each linked resource and module must have a unique filename. Filename '{0}' is specified more than once in this assembly</source> <target state="translated">Ogni risorsa e ogni modulo collegato devono avere un nome file univoco. Il nome file '{0}' è specificato più di una volta in questo assembly</target> <note /> </trans-unit> <trans-unit id="ERR_ImportNonAssembly"> <source>The referenced file '{0}' is not an assembly</source> <target state="translated">Il file di riferimento '{0}' non è un assembly</target> <note /> </trans-unit> <trans-unit id="ERR_RefLvalueExpected"> <source>A ref or out value must be an assignable variable</source> <target state="translated">Un valore out o ref deve essere una variabile assegnabile</target> <note /> </trans-unit> <trans-unit id="ERR_BaseInStaticMeth"> <source>Keyword 'base' is not available in a static method</source> <target state="translated">La parola chiave 'base' non è disponibile in un metodo statico</target> <note /> </trans-unit> <trans-unit id="ERR_BaseInBadContext"> <source>Keyword 'base' is not available in the current context</source> <target state="translated">La parola chiave 'base' non è disponibile nel contesto corrente</target> <note /> </trans-unit> <trans-unit id="ERR_RbraceExpected"> <source>} expected</source> <target state="translated">È previsto il segno }</target> <note /> </trans-unit> <trans-unit id="ERR_LbraceExpected"> <source>{ expected</source> <target state="translated">È previsto il segno {</target> <note /> </trans-unit> <trans-unit id="ERR_InExpected"> <source>'in' expected</source> <target state="translated">'È previsto 'in'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocExpr"> <source>Invalid preprocessor expression</source> <target state="translated">Espressione per il preprocessore non valida</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMemberDecl"> <source>Invalid token '{0}' in class, record, struct, or interface member declaration</source> <target state="translated">Il token '{0}' nella dichiarazione del membro di classe, record, struct o interfaccia non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_MemberNeedsType"> <source>Method must have a return type</source> <target state="translated">Il metodo deve avere un tipo restituito</target> <note /> </trans-unit> <trans-unit id="ERR_BadBaseType"> <source>Invalid base type</source> <target state="translated">Il tipo di base non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_EmptySwitch"> <source>Empty switch block</source> <target state="translated">Il blocco switch è vuoto</target> <note /> </trans-unit> <trans-unit id="WRN_EmptySwitch_Title"> <source>Empty switch block</source> <target state="translated">Il blocco switch è vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndTry"> <source>Expected catch or finally</source> <target state="translated">È previsto un blocco catch o finally</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidExprTerm"> <source>Invalid expression term '{0}'</source> <target state="translated">'{0}' non è un termine valido nell'espressione</target> <note /> </trans-unit> <trans-unit id="ERR_BadNewExpr"> <source>A new expression requires an argument list or (), [], or {} after type</source> <target state="translated">Un'espressione new richiede un elenco di argomenti oppure (), [] o {} dopo il tipo</target> <note /> </trans-unit> <trans-unit id="ERR_NoNamespacePrivate"> <source>Elements defined in a namespace cannot be explicitly declared as private, protected, protected internal, or private protected</source> <target state="translated">Gli elementi definiti in uno spazio dei nomi non possono essere dichiarati in modo esplicito come private, protected, protected internal o private protected</target> <note /> </trans-unit> <trans-unit id="ERR_BadVarDecl"> <source>Expected ; or = (cannot specify constructor arguments in declaration)</source> <target state="translated">È previsto il segno ; oppure = (non è possibile specificare gli argomenti del costruttore nella dichiarazione)</target> <note /> </trans-unit> <trans-unit id="ERR_UsingAfterElements"> <source>A using clause must precede all other elements defined in the namespace except extern alias declarations</source> <target state="translated">La clausola using deve precedere tutti gli altri elementi definiti nello spazio dei nomi ad eccezione delle dichiarazioni di alias extern</target> <note /> </trans-unit> <trans-unit id="ERR_BadBinOpArgs"> <source>Overloaded binary operator '{0}' takes two parameters</source> <target state="translated">L'operatore binario di overload '{0}' accetta due parametri</target> <note /> </trans-unit> <trans-unit id="ERR_BadUnOpArgs"> <source>Overloaded unary operator '{0}' takes one parameter</source> <target state="translated">L'operatore unario di overload '{0}' accetta un parametro</target> <note /> </trans-unit> <trans-unit id="ERR_NoVoidParameter"> <source>Invalid parameter type 'void'</source> <target state="translated">Tipo parametro 'void' non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAlias"> <source>The using alias '{0}' appeared previously in this namespace</source> <target state="translated">Using Alias '{0}' è già presente nello spazio dei nomi</target> <note /> </trans-unit> <trans-unit id="ERR_BadProtectedAccess"> <source>Cannot access protected member '{0}' via a qualifier of type '{1}'; the qualifier must be of type '{2}' (or derived from it)</source> <target state="translated">Non è possibile accedere al membro protetto '{0}' tramite un qualificatore di tipo '{1}'. Il qualificatore deve essere di tipo '{2}' o derivato da esso</target> <note /> </trans-unit> <trans-unit id="ERR_AddModuleAssembly"> <source>'{0}' cannot be added to this assembly because it already is an assembly</source> <target state="translated">'Non è possibile aggiungere '{0}' a questo assembly perché è già un assembly</target> <note /> </trans-unit> <trans-unit id="ERR_BindToBogusProp2"> <source>Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor methods '{1}' or '{2}'</source> <target state="translated">La proprietà, l'indicizzatore o l'evento '{0}' non è supportato dal linguaggio. Provare a chiamare direttamente i metodi della funzione di accesso '{1}' o '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_BindToBogusProp1"> <source>Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor method '{1}'</source> <target state="translated">La proprietà, l'indicizzatore o l'evento '{0}' non è supportato dal linguaggio. Provare a chiamare direttamente il metodo della funzione di accesso '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoVoidHere"> <source>Keyword 'void' cannot be used in this context</source> <target state="translated">Non è possibile usare la parola chiave 'void' in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_IndexerNeedsParam"> <source>Indexers must have at least one parameter</source> <target state="translated">Gli indicizzatori devono avere almeno un parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadArraySyntax"> <source>Array type specifier, [], must appear before parameter name</source> <target state="translated">L'identificatore del tipo matrice, [], deve trovarsi prima del nome del parametro</target> <note /> </trans-unit> <trans-unit id="ERR_BadOperatorSyntax"> <source>Declaration is not valid; use '{0} operator &lt;dest-type&gt; (...' instead</source> <target state="translated">La dichiarazione non è valida. Usare '{0} operator &lt;tipo distruttore&gt; (...'</target> <note /> </trans-unit> <trans-unit id="ERR_MainClassNotFound"> <source>Could not find '{0}' specified for Main method</source> <target state="translated">Non è stato trovato l'elemento '{0}' specificato per il metodo Main</target> <note /> </trans-unit> <trans-unit id="ERR_MainClassNotClass"> <source>'{0}' specified for Main method must be a non-generic class, record, struct, or interface</source> <target state="translated">L'elemento '{0}' specificato per il metodo Main deve essere una classe, un record, un'interfaccia o uno struct non generico valido</target> <note /> </trans-unit> <trans-unit id="ERR_NoMainInClass"> <source>'{0}' does not have a suitable static 'Main' method</source> <target state="translated">'{0}' non contiene un metodo 'Main' statico appropriato</target> <note /> </trans-unit> <trans-unit id="ERR_MainClassIsImport"> <source>Cannot use '{0}' for Main method because it is imported</source> <target state="translated">Non è possibile usare '{0}' per il metodo Main perché è importato</target> <note /> </trans-unit> <trans-unit id="ERR_OutputNeedsName"> <source>Outputs without source must have the /out option specified</source> <target state="translated">Per gli output senza origine occorre specificare l'opzione /out</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndManifest"> <source>Conflicting options specified: Win32 resource file; Win32 manifest</source> <target state="translated">Sono state specificate opzioni in conflitto: file di risorse Win32; manifesto Win32</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndIcon"> <source>Conflicting options specified: Win32 resource file; Win32 icon</source> <target state="translated">Sono state specificate opzioni in conflitto: file di risorse Win32; icona Win32</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadResource"> <source>Error reading resource '{0}' -- '{1}'</source> <target state="translated">Si è verificato un errore durante la lettura della risorsa '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DocFileGen"> <source>Error writing to XML documentation file: {0}</source> <target state="translated">Si è verificato un errore durante la scrittura nel file di documentazione XML: {0}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseError"> <source>XML comment has badly formed XML -- '{0}'</source> <target state="translated">Il formato XML del commento XML è errato - '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseError_Title"> <source>XML comment has badly formed XML</source> <target state="translated">Il formato XML del commento XML è errato</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateParamTag"> <source>XML comment has a duplicate param tag for '{0}'</source> <target state="translated">Il commento XML contiene un tag param duplicato per '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateParamTag_Title"> <source>XML comment has a duplicate param tag</source> <target state="translated">Il commento XML contiene un tag param duplicato</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamTag"> <source>XML comment has a param tag for '{0}', but there is no parameter by that name</source> <target state="translated">Il commento XML ha un tag param per '{0}', ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamTag_Title"> <source>XML comment has a param tag, but there is no parameter by that name</source> <target state="translated">Il commento XML ha un tag param, ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamRefTag"> <source>XML comment on '{1}' has a paramref tag for '{0}', but there is no parameter by that name</source> <target state="translated">Il commento XML in '{1}' ha un tag paramref per '{0}', ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedParamRefTag_Title"> <source>XML comment has a paramref tag, but there is no parameter by that name</source> <target state="translated">Il commento XML ha un tag paramref, ma non esiste nessun parametro con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_MissingParamTag"> <source>Parameter '{0}' has no matching param tag in the XML comment for '{1}' (but other parameters do)</source> <target state="translated">Il parametro '{0}', diversamente da altri parametri, non contiene tag param corrispondenti nel commento XML per '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingParamTag_Title"> <source>Parameter has no matching param tag in the XML comment (but other parameters do)</source> <target state="translated">Il parametro, diversamente da altri parametri, non contiene tag param corrispondenti nel commento XML</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRef"> <source>XML comment has cref attribute '{0}' that could not be resolved</source> <target state="translated">Il commento XML contiene l'attributo cref '{0}' che non è stato possibile risolvere</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRef_Title"> <source>XML comment has cref attribute that could not be resolved</source> <target state="translated">Il commento XML contiene l'attributo cref che non è stato possibile risolvere</target> <note /> </trans-unit> <trans-unit id="ERR_BadStackAllocExpr"> <source>A stackalloc expression requires [] after type</source> <target state="translated">In un'espressione stackalloc occorre specificare [] dopo il tipo</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLineNumber"> <source>The line number specified for #line directive is missing or invalid</source> <target state="translated">Il numero di riga specificato per la direttiva #line manca o non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_MissingPPFile"> <source>Quoted file name, single-line comment or end-of-line expected</source> <target state="translated">È previsto un nome file tra virgolette, un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedPPFile"> <source>Quoted file name expected</source> <target state="translated">È previsto un nome file racchiuso tra virgolette</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceDirectiveOnlyAllowedInScripts"> <source>#r is only allowed in scripts</source> <target state="translated">#r è consentito solo negli script</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachMissingMember"> <source>foreach statement cannot operate on variables of type '{0}' because '{0}' does not contain a public instance or extension definition for '{1}'</source> <target state="translated">L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché '{0}' non contiene una definizione di istanza o estensione pubblica per '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefParamType"> <source>Invalid type for parameter {0} in XML comment cref attribute: '{1}'</source> <target state="translated">Il tipo non è valido per il parametro {0} nell'attributo cref del commento XML: '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefParamType_Title"> <source>Invalid type for parameter in XML comment cref attribute</source> <target state="translated">Il tipo non è valido per il parametro nell'attributo cref del commento XML</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefReturnType"> <source>Invalid return type in XML comment cref attribute</source> <target state="translated">Tipo restituito non valido nell'attributo cref del commento XML</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefReturnType_Title"> <source>Invalid return type in XML comment cref attribute</source> <target state="translated">Tipo restituito non valido nell'attributo cref del commento XML</target> <note /> </trans-unit> <trans-unit id="ERR_BadWin32Res"> <source>Error reading Win32 resources -- {0}</source> <target state="translated">Si è verificato un errore durante la lettura delle risorse Win32 - {0}</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefSyntax"> <source>XML comment has syntactically incorrect cref attribute '{0}'</source> <target state="translated">Il commento XML contiene l'attributo cref '{0}' che è sintatticamente errato</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefSyntax_Title"> <source>XML comment has syntactically incorrect cref attribute</source> <target state="translated">Il commento XML contiene l'attributo cref che è sintatticamente errato</target> <note /> </trans-unit> <trans-unit id="ERR_BadModifierLocation"> <source>Member modifier '{0}' must precede the member type and name</source> <target state="translated">Il modificatore del membro '{0}' deve precedere il nome e il tipo del membro</target> <note /> </trans-unit> <trans-unit id="ERR_MissingArraySize"> <source>Array creation must have array size or array initializer</source> <target state="translated">Per la creazione della matrice occorre specificare la dimensione della matrice o l'inizializzatore della matrice</target> <note /> </trans-unit> <trans-unit id="WRN_UnprocessedXMLComment"> <source>XML comment is not placed on a valid language element</source> <target state="translated">Il commento XML non si trova in un elemento di linguaggio valido</target> <note /> </trans-unit> <trans-unit id="WRN_UnprocessedXMLComment_Title"> <source>XML comment is not placed on a valid language element</source> <target state="translated">Il commento XML non si trova in un elemento di linguaggio valido</target> <note /> </trans-unit> <trans-unit id="WRN_FailedInclude"> <source>Unable to include XML fragment '{1}' of file '{0}' -- {2}</source> <target state="translated">Non è possibile includere il frammento XML '{1}' del file '{0}' - {2}</target> <note /> </trans-unit> <trans-unit id="WRN_FailedInclude_Title"> <source>Unable to include XML fragment</source> <target state="translated">Non è possibile includere il frammento XML</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidInclude"> <source>Invalid XML include element -- {0}</source> <target state="translated">L'elemento di inclusione XML non è valido - {0}</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidInclude_Title"> <source>Invalid XML include element</source> <target state="translated">L'elemento di inclusione XML non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_MissingXMLComment"> <source>Missing XML comment for publicly visible type or member '{0}'</source> <target state="translated">Manca il commento XML per il tipo o il membro '{0}' visibile pubblicamente</target> <note /> </trans-unit> <trans-unit id="WRN_MissingXMLComment_Title"> <source>Missing XML comment for publicly visible type or member</source> <target state="translated">Manca il commento XML per il tipo o il membro visibile pubblicamente</target> <note /> </trans-unit> <trans-unit id="WRN_MissingXMLComment_Description"> <source>The /doc compiler option was specified, but one or more constructs did not have comments.</source> <target state="translated">È stata specificata l'opzione /doc del compilatore, ma per uno o più costrutti non sono disponibili commenti.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseIncludeError"> <source>Badly formed XML in included comments file -- '{0}'</source> <target state="translated">Nel file dei commenti incluso è presente codice XML in formato non corretto: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLParseIncludeError_Title"> <source>Badly formed XML in included comments file</source> <target state="translated">Nel file dei commenti incluso è presente codice XML in formato errato</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelArgCount"> <source>Delegate '{0}' does not take {1} arguments</source> <target state="translated">Il delegato '{0}' non accetta argomenti {1}</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedSemicolon"> <source>Semicolon after method or accessor block is not valid</source> <target state="translated">Non è possibile inserire un punto e virgola dopo un blocco di metodo o di funzione di accesso</target> <note /> </trans-unit> <trans-unit id="ERR_MethodReturnCantBeRefAny"> <source>The return type of a method, delegate, or function pointer cannot be '{0}'</source> <target state="translated">Il tipo restituito di un metodo, delegato o puntatore a funzione non può essere '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_CompileCancelled"> <source>Compilation cancelled by user</source> <target state="translated">Compilazione annullata dall'utente</target> <note /> </trans-unit> <trans-unit id="ERR_MethodArgCantBeRefAny"> <source>Cannot make reference to variable of type '{0}'</source> <target state="translated">Non è possibile creare il riferimento alla variabile di tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyLocal"> <source>Cannot assign to '{0}' because it is read-only</source> <target state="translated">Non è possibile assegnare a '{0}' perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyLocal"> <source>Cannot use '{0}' as a ref or out value because it is read-only</source> <target state="translated">Non è possibile usare '{0}' come valore out o ref perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseRequiredAttribute"> <source>The RequiredAttribute attribute is not permitted on C# types</source> <target state="translated">L'attributo RequiredAttribute non è consentito per i tipi C#</target> <note /> </trans-unit> <trans-unit id="ERR_NoModifiersOnAccessor"> <source>Modifiers cannot be placed on event accessor declarations</source> <target state="translated">Non è possibile inserire modificatori nelle dichiarazioni delle funzioni di accesso agli eventi</target> <note /> </trans-unit> <trans-unit id="ERR_ParamsCantBeWithModifier"> <source>The params parameter cannot be declared as {0}</source> <target state="translated">Non è possibile dichiarare il parametro params come {0}</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnNotLValue"> <source>Cannot modify the return value of '{0}' because it is not a variable</source> <target state="translated">Non è possibile modificare il valore restituito di '{0}' perché non è una variabile</target> <note /> </trans-unit> <trans-unit id="ERR_MissingCoClass"> <source>The managed coclass wrapper class '{0}' for interface '{1}' cannot be found (are you missing an assembly reference?)</source> <target state="translated">La classe wrapper '{0}' della coclasse gestita per l'interfaccia '{1}' non è stata trovata. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousAttribute"> <source>'{0}' is ambiguous between '{1}' and '{2}'. Either use '@{0}' or explicitly include the 'Attribute' suffix.</source> <target state="needs-review-translation">'{0}' è ambiguo tra '{1}' e '{2}'. Usare '@{0}' o '{0}Attribute'</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgExtraRef"> <source>Argument {0} may not be passed with the '{1}' keyword</source> <target state="translated">Non è possibile passare l'argomento {0} con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CmdOptionConflictsSource"> <source>Option '{0}' overrides attribute '{1}' given in a source file or added module</source> <target state="translated">L'opzione '{0}' esegue l'override dell'attributo '{1}' specificato in un file di origine o in un modulo aggiunto</target> <note /> </trans-unit> <trans-unit id="WRN_CmdOptionConflictsSource_Title"> <source>Option overrides attribute given in a source file or added module</source> <target state="translated">L'opzione esegue l'override dell'attributo specificato in un file di origine o in un modulo aggiunto</target> <note /> </trans-unit> <trans-unit id="WRN_CmdOptionConflictsSource_Description"> <source>This warning occurs if the assembly attributes AssemblyKeyFileAttribute or AssemblyKeyNameAttribute found in source conflict with the /keyfile or /keycontainer command line option or key file name or key container specified in the Project Properties.</source> <target state="translated">Questo avviso viene visualizzato se gli attributi di assembly AssemblyKeyFileAttribute o AssemblyKeyNameAttribute rilevati nell'origine sono in conflitto con l'opzione della riga di comando /keyfile o /keycontainer oppure con il nome del file di chiave o con il contenitore di chiavi specificato in Proprietà progetto.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCompatMode"> <source>Invalid option '{0}' for /langversion. Use '/langversion:?' to list supported values.</source> <target state="translated">L'opzione '{0}' non è valida per /langversion. Usare '/langversion:?' per ottenere l'elenco dei valori supportati.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateOnConditional"> <source>Cannot create delegate with '{0}' because it or a method it overrides has a Conditional attribute</source> <target state="translated">Non è possibile creare il delegato con '{0}' perché il delegato o un metodo di cui esegue l'override ha un attributo Conditional</target> <note /> </trans-unit> <trans-unit id="ERR_CantMakeTempFile"> <source>Cannot create temporary file -- {0}</source> <target state="translated">Non è possibile creare il file temporaneo - {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgRef"> <source>Argument {0} must be passed with the '{1}' keyword</source> <target state="translated">L'argomento {0} deve essere passato con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_YieldInAnonMeth"> <source>The yield statement cannot be used inside an anonymous method or lambda expression</source> <target state="translated">Non è possibile usare l'istruzione yield all'interno di un metodo anonimo o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnInIterator"> <source>Cannot return a value from an iterator. Use the yield return statement to return a value, or yield break to end the iteration.</source> <target state="translated">Non è possibile restituire un valore da un iteratore. Usare l'istruzione yield return per restituire un valore o l'istruzione yield break per terminare l'iterazione.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorArgType"> <source>Iterators cannot have ref, in or out parameters</source> <target state="translated">Gli iteratori non possono avere parametri in, out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturn"> <source>The body of '{0}' cannot be an iterator block because '{1}' is not an iterator interface type</source> <target state="translated">Il corpo di '{0}' non può essere un blocco iteratore perché '{1}' non è un tipo interfaccia iteratore</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInFinally"> <source>Cannot yield in the body of a finally clause</source> <target state="translated">Impossibile eseguire la produzione nel corpo di una clausola finally</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInTryOfCatch"> <source>Cannot yield a value in the body of a try block with a catch clause</source> <target state="translated">Impossibile produrre un valore nel corpo di un blocco try con una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyYield"> <source>Expression expected after yield return</source> <target state="translated">Dopo yield return è prevista l'espressione</target> <note /> </trans-unit> <trans-unit id="ERR_AnonDelegateCantUse"> <source>Cannot use ref, out, or in parameter '{0}' inside an anonymous method, lambda expression, query expression, or local function</source> <target state="translated">Non è possibile usare il parametro ref, out o in '{0}' all'interno di un metodo anonimo, di un'espressione lambda, di un'espressione di query o di una funzione locale</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalInnerUnsafe"> <source>Unsafe code may not appear in iterators</source> <target state="translated">Gli iteratori non possono contenere codice unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInCatch"> <source>Cannot yield a value in the body of a catch clause</source> <target state="translated">Impossibile produrre un valore nel corpo di una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateLeave"> <source>Control cannot leave the body of an anonymous method or lambda expression</source> <target state="translated">Il controllo non può lasciare il corpo di un metodo anonimo o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPragma"> <source>Unrecognized #pragma directive</source> <target state="translated">La direttiva #pragma non è stata riconosciuta</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPragma_Title"> <source>Unrecognized #pragma directive</source> <target state="translated">La direttiva #pragma non è stata riconosciuta</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPWarning"> <source>Expected 'disable' or 'restore'</source> <target state="translated">È previsto 'disable' o 'restore'</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPWarning_Title"> <source>Expected 'disable' or 'restore' after #pragma warning</source> <target state="translated">Dopo l'avviso della direttiva #pragma è previsto 'disable' o 'restore'</target> <note /> </trans-unit> <trans-unit id="WRN_BadRestoreNumber"> <source>Cannot restore warning 'CS{0}' because it was disabled globally</source> <target state="translated">Non è possibile ripristinare l'avviso 'CS{0}' perché è stato disabilitato a livello globale</target> <note /> </trans-unit> <trans-unit id="WRN_BadRestoreNumber_Title"> <source>Cannot restore warning because it was disabled globally</source> <target state="translated">Non è possibile ripristinare l'avviso perché è stato disabilitato a livello globale</target> <note /> </trans-unit> <trans-unit id="ERR_VarargsIterator"> <source>__arglist is not allowed in the parameter list of iterators</source> <target state="translated">__arglist non è consentito nell'elenco dei parametri degli iteratori</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeIteratorArgType"> <source>Iterators cannot have unsafe parameters or yield types</source> <target state="translated">Gli iteratori non possono avere parametri unsafe o tipi yield</target> <note /> </trans-unit> <trans-unit id="ERR_BadCoClassSig"> <source>The managed coclass wrapper class signature '{0}' for interface '{1}' is not a valid class name signature</source> <target state="translated">La firma della classe wrapper '{0}' della coclasse gestita per l'interfaccia '{1}' non è valida per il nome della classe</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleIEnumOfT"> <source>foreach statement cannot operate on variables of type '{0}' because it implements multiple instantiations of '{1}'; try casting to a specific interface instantiation</source> <target state="translated">L'istruzione foreach non può funzionare con variabili di tipo '{0}' perché implementa più creazioni di un'istanza di '{1}'. Provare a eseguire il cast su una creazione di un'istanza di interfaccia specifica</target> <note /> </trans-unit> <trans-unit id="ERR_FixedDimsRequired"> <source>A fixed size buffer field must have the array size specifier after the field name</source> <target state="translated">In un campo buffer a dimensione fissa, l'identificatore della dimensione della matrice deve trovarsi dopo il nome del campo</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNotInStruct"> <source>Fixed size buffer fields may only be members of structs</source> <target state="translated">I campi buffer a dimensione fissa possono essere membri solo di struct</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousReturnExpected"> <source>Not all code paths return a value in {0} of type '{1}'</source> <target state="translated">Non tutti i percorsi del codice restituiscono un valore in {0} di tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_NonECMAFeature"> <source>Feature '{0}' is not part of the standardized ISO C# language specification, and may not be accepted by other compilers</source> <target state="translated">La funzionalità '{0}' non fa parte della specifica del linguaggio C# standard ISO e potrebbe non essere accettata da altri compilatori</target> <note /> </trans-unit> <trans-unit id="WRN_NonECMAFeature_Title"> <source>Feature is not part of the standardized ISO C# language specification, and may not be accepted by other compilers</source> <target state="translated">La funzionalità non fa parte della specifica del linguaggio C# standard ISO e potrebbe non essere accettata da altri compilatori</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedVerbatimLiteral"> <source>Keyword, identifier, or string expected after verbatim specifier: @</source> <target state="translated">È prevista la parola chiave, l'identificatore o la stringa dopo l'identificatore verbatim: @</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonly"> <source>A readonly field cannot be used as a ref or out value (except in a constructor)</source> <target state="translated">Non è possibile usare un campo di sola lettura come valore out o ref (tranne che in un costruttore)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonly2"> <source>Members of readonly field '{0}' cannot be used as a ref or out value (except in a constructor)</source> <target state="translated">Non è possibile usare i membri del campo di sola lettura '{0}' come valore out o ref (tranne che in un costruttore)</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonly"> <source>A readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer)</source> <target state="translated">Non è possibile assegnare un valore a un campo di sola lettura, tranne che in un costruttore o un setter di sola inizializzazione del tipo in cui è definito il campo o in un inizializzatore di variabile</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonly2"> <source>Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer)</source> <target state="translated">Non è possibile modificare i membri del campo di sola lettura '{0}' (tranne che in un costruttore o in un inizializzatore di variabile)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyNotField"> <source>Cannot use {0} '{1}' as a ref or out value because it is a readonly variable</source> <target state="translated">Non è possibile usare {0} '{1}' come valore ref o out perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyNotField2"> <source>Members of {0} '{1}' cannot be used as a ref or out value because it is a readonly variable</source> <target state="translated">Non è possibile usare i membri di {0} '{1}' come valore ref o out perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AssignReadonlyNotField"> <source>Cannot assign to {0} '{1}' because it is a readonly variable</source> <target state="translated">Non è possibile assegnare a {0} '{1}' perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AssignReadonlyNotField2"> <source>Cannot assign to a member of {0} '{1}' because it is a readonly variable</source> <target state="translated">Non è possibile assegnare a un membro di {0} '{1}' perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyNotField"> <source>Cannot return {0} '{1}' by writable reference because it is a readonly variable</source> <target state="translated">Non è possibile restituire {0} '{1}' per riferimento scrivibile perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyNotField2"> <source>Members of {0} '{1}' cannot be returned by writable reference because it is a readonly variable</source> <target state="translated">Non è possibile restituire i membri di {0} '{1}' per riferimento scrivibile perché è una variabile di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyStatic2"> <source>Fields of static readonly field '{0}' cannot be assigned to (except in a static constructor or a variable initializer)</source> <target state="translated">Non è possibile effettuare un'assegnazione a campi del campo statico di sola lettura '{0}' (tranne che in un costruttore statico o in un inizializzatore di variabile)</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyStatic2"> <source>Fields of static readonly field '{0}' cannot be used as a ref or out value (except in a static constructor)</source> <target state="translated">Non è possibile usare i campi del campo di sola lettura statico '{0}' come valore out o ref (tranne che in un costruttore statico)</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyLocal2Cause"> <source>Cannot modify members of '{0}' because it is a '{1}'</source> <target state="translated">Non è possibile modificare i membri di '{0}' perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyLocal2Cause"> <source>Cannot use fields of '{0}' as a ref or out value because it is a '{1}'</source> <target state="translated">Non è possibile usare i campi di '{0}' come valore out o ref perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_AssgReadonlyLocalCause"> <source>Cannot assign to '{0}' because it is a '{1}'</source> <target state="translated">Non è possibile assegnare a '{0}' perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReadonlyLocalCause"> <source>Cannot use '{0}' as a ref or out value because it is a '{1}'</source> <target state="translated">Non è possibile usare '{0}' come valore out o ref perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_ErrorOverride"> <source>{0}. See also error CS{1}.</source> <target state="translated">{0}. Vedere anche l'errore CS{1}.</target> <note /> </trans-unit> <trans-unit id="WRN_ErrorOverride_Title"> <source>Warning is overriding an error</source> <target state="translated">Override di un errore con un avviso</target> <note /> </trans-unit> <trans-unit id="WRN_ErrorOverride_Description"> <source>The compiler emits this warning when it overrides an error with a warning. For information about the problem, search for the error code mentioned.</source> <target state="translated">Il compilatore genera questo avviso quando esegue l'override di un errore con un avviso. Per informazioni sul problema, cercare il codice errore indicato.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonMethToNonDel"> <source>Cannot convert {0} to type '{1}' because it is not a delegate type</source> <target state="translated">Non è possibile convertire {0} nel tipo '{1}' perché non è un tipo delegato</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethParams"> <source>Cannot convert {0} to type '{1}' because the parameter types do not match the delegate parameter types</source> <target state="translated">Non è possibile convertire {0} nel tipo '{1}' perché i tipi di parametro non corrispondono ai tipi di parametro del delegato</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethReturns"> <source>Cannot convert {0} to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type</source> <target state="translated">Non è possibile convertire '{0}' nel tipo delegato previsto perché alcuni dei tipi restituiti nel blocco non sono convertibili in modo implicito nel tipo restituito del delegato</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturnExpression"> <source>Since this is an async method, the return expression must be of type '{0}' rather than 'Task&lt;{0}&gt;'</source> <target state="translated">Poiché si tratta di un metodo asincrono, l'espressione restituita deve essere di tipo '{0}' e non 'Task&lt;{0}&gt;'</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAsyncAnonFuncReturns"> <source>Cannot convert async {0} to delegate type '{1}'. An async {0} may return void, Task or Task&lt;T&gt;, none of which are convertible to '{1}'.</source> <target state="translated">Non è possibile convertire il metodo async {0} nel tipo delegato '{1}'. Un metodo async {0} può restituire un valore nullo, Task o Task&lt;T&gt;, nessuno dei quali è convertibile in '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalFixedType"> <source>Fixed size buffer type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double</source> <target state="translated">Il tipo di buffer a dimensione fissa deve essere uno dei seguenti: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float o double</target> <note /> </trans-unit> <trans-unit id="ERR_FixedOverflow"> <source>Fixed size buffer of length {0} and type '{1}' is too big</source> <target state="translated">Il buffer a dimensione fissa di lunghezza {0} e di tipo '{1}' è troppo grande</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFixedArraySize"> <source>Fixed size buffers must have a length greater than zero</source> <target state="translated">La lunghezza dei buffer a dimensione fissa deve essere maggiore di zero</target> <note /> </trans-unit> <trans-unit id="ERR_FixedBufferNotFixed"> <source>You cannot use fixed size buffers contained in unfixed expressions. Try using the fixed statement.</source> <target state="translated">Impossibile utilizzare buffer a dimensione fissa contenuti in espressioni unfixed. Provare a utilizzare l'istruzione fixed.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeNotOnAccessor"> <source>Attribute '{0}' is not valid on property or event accessors. It is only valid on '{1}' declarations.</source> <target state="translated">L'attributo '{0}' non è valido nelle funzioni di accesso a proprietà o eventi. È valido solo nelle dichiarazioni di '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidSearchPathDir"> <source>Invalid search path '{0}' specified in '{1}' -- '{2}'</source> <target state="translated">Il percorso di ricerca '{0}' specificato in '{1}' non è valido - '{2}'</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidSearchPathDir_Title"> <source>Invalid search path specified</source> <target state="translated">Il percorso di ricerca specificato non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalVarArgs"> <source>__arglist is not valid in this context</source> <target state="translated">__arglist non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalParams"> <source>params is not valid in this context</source> <target state="translated">params non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_BadModifiersOnNamespace"> <source>A namespace declaration cannot have modifiers or attributes</source> <target state="translated">Una dichiarazione di spazio dei nomi non può avere modificatori o attributi</target> <note /> </trans-unit> <trans-unit id="ERR_BadPlatformType"> <source>Invalid option '{0}' for /platform; must be anycpu, x86, Itanium, arm, arm64 or x64</source> <target state="translated">L'opzione '{0}' non è valida per /platform. Specificare anycpu, x86, Itanium, arm, arm64 o x64</target> <note /> </trans-unit> <trans-unit id="ERR_ThisStructNotInAnonMeth"> <source>Anonymous methods, lambda expressions, query expressions, and local functions inside structs cannot access instance members of 'this'. Consider copying 'this' to a local variable outside the anonymous method, lambda expression, query expression, or local function and using the local instead.</source> <target state="translated">I metodi anonimi, le espressioni lambda, le espressioni di query e le funzioni locali all'interno delle strutture non possono accedere ai membri di istanza di 'this'. Provare a copiare 'this' in una variabile locale all'esterno del metodo anonimo, dell'espressione lambda, dell'espressione di query o della funzione locale e usare tale variabile locale.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIDisp"> <source>'{0}': type used in a using statement must be implicitly convertible to 'System.IDisposable'.</source> <target state="translated">'{0}': il tipo usato in un'istruzione using deve essere convertibile in modo implicito in 'System.IDisposable'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamRef"> <source>Parameter {0} must be declared with the '{1}' keyword</source> <target state="translated">Il parametro {0} deve essere dichiarato con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamExtraRef"> <source>Parameter {0} should not be declared with the '{1}' keyword</source> <target state="translated">Il parametro {0} non deve essere dichiarato con la parola chiave '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadParamType"> <source>Parameter {0} is declared as type '{1}{2}' but should be '{3}{4}'</source> <target state="translated">Il parametro {0} è dichiarato come tipo '{1}{2}', ma deve essere '{3}{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadExternIdentifier"> <source>Invalid extern alias for '/reference'; '{0}' is not a valid identifier</source> <target state="translated">L'alias extern non è valido per '/reference'. '{0}' non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="ERR_AliasMissingFile"> <source>Invalid reference alias option: '{0}=' -- missing filename</source> <target state="translated">L'opzione dell'alias di riferimento non è valida: '{0}='. Manca il nome file</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalExternAlias"> <source>You cannot redefine the global extern alias</source> <target state="translated">Non è possibile ridefinire l'alias extern globale</target> <note /> </trans-unit> <trans-unit id="ERR_MissingTypeInSource"> <source>Reference to type '{0}' claims it is defined in this assembly, but it is not defined in source or any added modules</source> <target state="translated">Il riferimento al tipo '{0}' dichiara di essere definito in questo assembly, ma non è definito nell'origine né nei moduli aggiunti</target> <note /> </trans-unit> <trans-unit id="ERR_MissingTypeInAssembly"> <source>Reference to type '{0}' claims it is defined in '{1}', but it could not be found</source> <target state="translated">Il riferimento al tipo '{0}' dichiara di essere definito in '{1}', ma non è stato trovato</target> <note /> </trans-unit> <trans-unit id="WRN_MultiplePredefTypes"> <source>The predefined type '{0}' is defined in multiple assemblies in the global alias; using definition from '{1}'</source> <target state="translated">Il tipo predefinito '{0}' è definito in più assembly nell'alias globale. Verrà usata la definizione contenuta in '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_MultiplePredefTypes_Title"> <source>Predefined type is defined in multiple assemblies in the global alias</source> <target state="translated">Il tipo predefinito è definito in più assembly nell'alias globale</target> <note /> </trans-unit> <trans-unit id="WRN_MultiplePredefTypes_Description"> <source>This error occurs when a predefined system type such as System.Int32 is found in two assemblies. One way this can happen is if you are referencing mscorlib or System.Runtime.dll from two different places, such as trying to run two versions of the .NET Framework side-by-side.</source> <target state="translated">Questo errore si verifica quando in due assembly viene trovato un tipo di sistema predefinito, come System.Int32. Questa situazione può verificarsi, ad esempio, se si fa riferimento a mscorlib o a System.Runtime.dll da due punti diversi, nel tentativo di eseguire due versioni affiancate di .NET Framework.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalCantBeFixedAndHoisted"> <source>Local '{0}' or its members cannot have their address taken and be used inside an anonymous method or lambda expression</source> <target state="translated">Non è possibile accettare e usare gli indirizzi dell'elemento '{0}' locale o dei rispettivi membri all'interno di un metodo anonimo o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="WRN_TooManyLinesForDebugger"> <source>Source file has exceeded the limit of 16,707,565 lines representable in the PDB; debug information will be incorrect</source> <target state="translated">Limite di 16.707.565 righe rappresentabili nel PDB superato nel file di origine: le informazioni di debug non saranno corrette</target> <note /> </trans-unit> <trans-unit id="WRN_TooManyLinesForDebugger_Title"> <source>Source file has exceeded the limit of 16,707,565 lines representable in the PDB; debug information will be incorrect</source> <target state="translated">Limite di 16.707.565 righe rappresentabili nel PDB superato nel file di origine: le informazioni di debug non saranno corrette</target> <note /> </trans-unit> <trans-unit id="ERR_CantConvAnonMethNoParams"> <source>Cannot convert anonymous method block without a parameter list to delegate type '{0}' because it has one or more out parameters</source> <target state="translated">Non è possibile convertire il blocco di metodi anonimi senza elenco parametri nel tipo delegato '{0}' perché contiene uno o più parametri out</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalOnNonAttributeClass"> <source>Attribute '{0}' is only valid on methods or attribute classes</source> <target state="translated">L'attributo '{0}' è valido solo per metodi o classi Attribute</target> <note /> </trans-unit> <trans-unit id="WRN_CallOnNonAgileField"> <source>Accessing a member on '{0}' may cause a runtime exception because it is a field of a marshal-by-reference class</source> <target state="translated">L'accesso a un membro di '{0}' potrebbe causare un'eccezione in fase di esecuzione perché è un campo di una classe con marshalling per riferimento</target> <note /> </trans-unit> <trans-unit id="WRN_CallOnNonAgileField_Title"> <source>Accessing a member on a field of a marshal-by-reference class may cause a runtime exception</source> <target state="translated">L'accesso a un membro in un campo di una classe con marshalling per riferimento potrebbe causare un'eccezione in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="WRN_CallOnNonAgileField_Description"> <source>This warning occurs when you try to call a method, property, or indexer on a member of a class that derives from MarshalByRefObject, and the member is a value type. Objects that inherit from MarshalByRefObject are typically intended to be marshaled by reference across an application domain. If any code ever attempts to directly access the value-type member of such an object across an application domain, a runtime exception will occur. To resolve the warning, first copy the member into a local variable and call the method on that variable.</source> <target state="translated">Questo avviso viene visualizzato quando prova a chiamare un metodo, una proprietà o un indicizzatore su un membro di una classe derivante da MarshalByRefObject e tale membro è un tipo valore. Il marshalling degli oggetti che ereditano da MarshalByRefObject viene in genere effettuato per riferimento in un dominio applicazione. Qualora un codice provi ad accedere direttamente al membro di tipo valore di tale oggetto in un dominio applicazione, si verificherà un'eccezione in fase di esecuzione. Per risolvere il problema, copiare innanzitutto il membro in una variabile locale e chiamare il metodo su tale variabile.</target> <note /> </trans-unit> <trans-unit id="WRN_BadWarningNumber"> <source>'{0}' is not a valid warning number</source> <target state="translated">'{0}' non è un numero di avviso valido</target> <note /> </trans-unit> <trans-unit id="WRN_BadWarningNumber_Title"> <source>Not a valid warning number</source> <target state="translated">Non è un numero di avviso valido</target> <note /> </trans-unit> <trans-unit id="WRN_BadWarningNumber_Description"> <source>A number that was passed to the #pragma warning preprocessor directive was not a valid warning number. Verify that the number represents a warning, not an error.</source> <target state="translated">Un numero che è stato passato alla direttiva per il preprocessore di avvisi #pragma non corrisponde a un numero di avviso valido. Verificare che il numero rappresenti un avviso e non un errore.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidNumber"> <source>Invalid number</source> <target state="translated">Numero non valido</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidNumber_Title"> <source>Invalid number</source> <target state="translated">Numero non valido</target> <note /> </trans-unit> <trans-unit id="WRN_FileNameTooLong"> <source>Invalid filename specified for preprocessor directive. Filename is too long or not a valid filename.</source> <target state="translated">Il nome di file specificato per la direttiva per il preprocessore non è valido. È troppo lungo o non è un nome di file valido.</target> <note /> </trans-unit> <trans-unit id="WRN_FileNameTooLong_Title"> <source>Invalid filename specified for preprocessor directive</source> <target state="translated">Il nome file specificato per la direttiva per il preprocessore non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPChecksum"> <source>Invalid #pragma checksum syntax; should be #pragma checksum "filename" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..."</source> <target state="translated">Sintassi #pragma checksum non valida: dovrebbe essere #pragma checksum "nomefile" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX..."</target> <note /> </trans-unit> <trans-unit id="WRN_IllegalPPChecksum_Title"> <source>Invalid #pragma checksum syntax</source> <target state="translated">La sintassi del checksum della direttiva #pragma non è valida</target> <note /> </trans-unit> <trans-unit id="WRN_EndOfPPLineExpected"> <source>Single-line comment or end-of-line expected</source> <target state="translated">È previsto un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="WRN_EndOfPPLineExpected_Title"> <source>Single-line comment or end-of-line expected after #pragma directive</source> <target state="translated">Dopo la direttiva #pragma è previsto un commento su una sola riga o la fine riga</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingChecksum"> <source>Different checksum values given for '{0}'</source> <target state="translated">Sono stati specificati valori di checksum diversi per '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingChecksum_Title"> <source>Different #pragma checksum values given</source> <target state="translated">Sono stati assegnati valori di checksum diversi alla direttiva #pragma</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved</source> <target state="translated">Il riferimento all'assembly '{0}' non è valido e non può essere risolto</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Title"> <source>Assembly reference is invalid and cannot be resolved</source> <target state="translated">Il riferimento all'assembly non è valido e non può essere risolto</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Description"> <source>This warning indicates that an attribute, such as InternalsVisibleToAttribute, was not specified correctly.</source> <target state="translated">Questo avviso indica che un attributo, ad esempio InternalsVisibleToAttribute, non è stato specificato correttamente.</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceMajMin"> <source>Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy</source> <target state="translated">Se il riferimento all'assembly '{0}' usato da '{1}' corrisponde all'identità '{2}' di '{3}', potrebbe essere necessario fornire i criteri di runtime</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceMajMin_Title"> <source>Assuming assembly reference matches identity</source> <target state="translated">Il riferimento all'assembly verrà considerato come corrispondente all'identità</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceMajMin_Description"> <source>The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly.</source> <target state="translated">I due assembly differiscono per versione e/o numero di versione. Per consentire l'unifocazione, è necessario specificare le direttive nel file config dell'applicazione e specificare il nome sicuro corretto di un assembly.</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceBldRev"> <source>Assuming assembly reference '{0}' used by '{1}' matches identity '{2}' of '{3}', you may need to supply runtime policy</source> <target state="translated">Se il riferimento all'assembly '{0}' usato da '{1}' corrisponde all'identità '{2}' di '{3}', potrebbe essere necessario fornire i criteri di runtime</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceBldRev_Title"> <source>Assuming assembly reference matches identity</source> <target state="translated">Il riferimento all'assembly verrà considerato come corrispondente all'identità</target> <note /> </trans-unit> <trans-unit id="WRN_UnifyReferenceBldRev_Description"> <source>The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly.</source> <target state="translated">I due assembly differiscono per versione e/o numero di versione. Per consentire l'unifocazione, è necessario specificare le direttive nel file config dell'applicazione e specificare il nome sicuro corretto di un assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImport"> <source>Multiple assemblies with equivalent identity have been imported: '{0}' and '{1}'. Remove one of the duplicate references.</source> <target state="translated">Sono stati importati più assembly con identità equivalenti: '{0}' e '{1}'. Rimuovere uno dei riferimenti duplicati.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImportSimple"> <source>An assembly with the same simple name '{0}' has already been imported. Try removing one of the references (e.g. '{1}') or sign them to enable side-by-side.</source> <target state="translated">Un assembly con lo stesso nome semplice '{0}' è già stato importato. Provare a rimuovere uno dei riferimenti, ad esempio '{1}', oppure firmarli per consentire l'affiancamento.</target> <note /> </trans-unit> <trans-unit id="ERR_AssemblyMatchBadVersion"> <source>Assembly '{0}' with identity '{1}' uses '{2}' which has a higher version than referenced assembly '{3}' with identity '{4}'</source> <target state="translated">L'assembly '{0}' con identità '{1}' usa '{2}' la cui versione è successiva a quella dell'assembly '{3}' a cui viene fatto riferimento con identità '{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_FixedNeedsLvalue"> <source>Fixed size buffers can only be accessed through locals or fields</source> <target state="translated">L'accesso ai buffer a dimensione fissa è consentito solo tramite variabili locali o campi</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateTypeParamTag"> <source>XML comment has a duplicate typeparam tag for '{0}'</source> <target state="translated">Il commento XML contiene un tag typeparam duplicato per '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateTypeParamTag_Title"> <source>XML comment has a duplicate typeparam tag</source> <target state="translated">Il commento XML contiene un tag typeparam duplicato</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamTag"> <source>XML comment has a typeparam tag for '{0}', but there is no type parameter by that name</source> <target state="translated">Il commento XML ha un tag typeparam per '{0}', ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamTag_Title"> <source>XML comment has a typeparam tag, but there is no type parameter by that name</source> <target state="translated">Il commento XML ha un tag typeparam, ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamRefTag"> <source>XML comment on '{1}' has a typeparamref tag for '{0}', but there is no type parameter by that name</source> <target state="translated">Il commento XML in '{1}' ha un tag typeparamref per '{0}', ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_UnmatchedTypeParamRefTag_Title"> <source>XML comment has a typeparamref tag, but there is no type parameter by that name</source> <target state="translated">Il commento XML ha un tag paramref, ma non esiste nessun parametro di tipo con questo nome</target> <note /> </trans-unit> <trans-unit id="WRN_MissingTypeParamTag"> <source>Type parameter '{0}' has no matching typeparam tag in the XML comment on '{1}' (but other type parameters do)</source> <target state="translated">Il parametro di tipo '{0}', diversamente da altri parametri di tipo, non contiene tag typeparam corrispondenti nel commento XML per '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingTypeParamTag_Title"> <source>Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)</source> <target state="translated">Il parametro di tipo, diversamente da altri parametri di tipo, non contiene tag typeparam corrispondenti nel commento XML</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeTypeOnOverride"> <source>'{0}': type must be '{2}' to match overridden member '{1}'</source> <target state="translated">'{0}': il tipo deve essere '{2}' in modo che corrisponda al membro '{1}' sottoposto a override</target> <note /> </trans-unit> <trans-unit id="ERR_DoNotUseFixedBufferAttr"> <source>Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute. Use the 'fixed' field modifier instead.</source> <target state="translated">Non utilizzare l'attributo 'System.Runtime.CompilerServices.FixedBuffer'. Utilizzare il modificatore di campo 'fixed'.</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToSelf"> <source>Assignment made to same variable; did you mean to assign something else?</source> <target state="translated">Assegnazione fatta alla stessa variabile. Si intendeva assegnare qualcos'altro?</target> <note /> </trans-unit> <trans-unit id="WRN_AssignmentToSelf_Title"> <source>Assignment made to same variable</source> <target state="translated">Assegnazione fatta alla stessa variabile</target> <note /> </trans-unit> <trans-unit id="WRN_ComparisonToSelf"> <source>Comparison made to same variable; did you mean to compare something else?</source> <target state="translated">Confronto effettuato con la stessa variabile. Si intendeva confrontare qualcos'altro?</target> <note /> </trans-unit> <trans-unit id="WRN_ComparisonToSelf_Title"> <source>Comparison made to same variable</source> <target state="translated">Confronto effettuato con la stessa variabile</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenWin32Res"> <source>Error opening Win32 resource file '{0}' -- '{1}'</source> <target state="translated">Si è verificato un errore durante l'apertura del file di risorse Win32 '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_DotOnDefault"> <source>Expression will always cause a System.NullReferenceException because the default value of '{0}' is null</source> <target state="translated">L'espressione determinerà sempre un'eccezione System.NullReferenceException perché il valore predefinito di '{0}' è Null.</target> <note /> </trans-unit> <trans-unit id="WRN_DotOnDefault_Title"> <source>Expression will always cause a System.NullReferenceException because the type's default value is null</source> <target state="translated">L'espressione determinerà sempre un'eccezione System.NullReferenceException perché il valore predefinito del tipo è Null.</target> <note /> </trans-unit> <trans-unit id="ERR_NoMultipleInheritance"> <source>Class '{0}' cannot have multiple base classes: '{1}' and '{2}'</source> <target state="translated">La classe '{0}' non può contenere più classi base: '{1}' e '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_BaseClassMustBeFirst"> <source>Base class '{0}' must come before any interfaces</source> <target state="translated">La classe base '{0}' deve precedere le interfacce</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefTypeVar"> <source>XML comment has cref attribute '{0}' that refers to a type parameter</source> <target state="translated">Il commento XML contiene l'attributo cref '{0}' che fa riferimento a un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="WRN_BadXMLRefTypeVar_Title"> <source>XML comment has cref attribute that refers to a type parameter</source> <target state="translated">Il commento XML contiene l'attributo cref che fa riferimento a un parametro di tipo</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadArgs"> <source>Friend assembly reference '{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.</source> <target state="translated">Il riferimento all'assembly Friend {0} non è valido. Nelle dichiarazioni InternalsVisibleTo non è possibile specificare la versione, le impostazioni cultura, il token di chiave pubblica o l'architettura del processore.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblySNReq"> <source>Friend assembly reference '{0}' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.</source> <target state="translated">Il riferimento {0} all'assembly Friend non è valido. Gli assembly firmati con nome sicuro devono specificare una chiave pubblica nelle rispettive dichiarazioni InternalsVisibleTo.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateOnNullable"> <source>Cannot bind delegate to '{0}' because it is a member of 'System.Nullable&lt;T&gt;'</source> <target state="translated">Non è possibile associare il delegato a '{0}' perché è un membro di 'System.Nullable&lt;T&gt;'</target> <note /> </trans-unit> <trans-unit id="ERR_BadCtorArgCount"> <source>'{0}' does not contain a constructor that takes {1} arguments</source> <target state="translated">'{0}' non contiene un costruttore che accetta argomenti {1}</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalAttributesNotFirst"> <source>Assembly and module attributes must precede all other elements defined in a file except using clauses and extern alias declarations</source> <target state="translated">Gli attributi di modulo e assembly devono precedere tutti gli altri elementi definiti in un file ad eccezione delle clausole using e delle dichiarazioni di alias extern</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionExpected"> <source>Expected expression</source> <target state="translated">È prevista l'espressione</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSubsystemVersion"> <source>Invalid version {0} for /subsystemversion. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise</source> <target state="translated">La versione {0} non è valida per /subsystemversion. La versione deve essere 6.02 o successiva per ARM o AppContainerExe e 4.00 o successiva negli altri casi</target> <note /> </trans-unit> <trans-unit id="ERR_InteropMethodWithBody"> <source>Embedded interop method '{0}' contains a body.</source> <target state="translated">Il metodo di interoperabilità incorporato '{0}' contiene un corpo.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWarningLevel"> <source>Warning level must be zero or greater</source> <target state="translated">Il livello di avviso deve essere maggiore o uguale a zero</target> <note /> </trans-unit> <trans-unit id="ERR_BadDebugType"> <source>Invalid option '{0}' for /debug; must be 'portable', 'embedded', 'full' or 'pdbonly'</source> <target state="translated">L'opzione '{0}' non è valida per /debug. Specificare 'portable', 'embedded', 'full' o 'pdbonly'</target> <note /> </trans-unit> <trans-unit id="ERR_BadResourceVis"> <source>Invalid option '{0}'; Resource visibility must be either 'public' or 'private'</source> <target state="translated">L'opzione '{0}' non è valida. La visibilità della risorsa deve essere 'public' o 'private'</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueTypeMustMatch"> <source>The type of the argument to the DefaultParameterValue attribute must match the parameter type</source> <target state="translated">Il tipo dell'argomento dell'attributo DefaultParameterValue deve corrispondere al tipo del parametro</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueBadValueType"> <source>Argument of type '{0}' is not applicable for the DefaultParameterValue attribute</source> <target state="translated">L'argomento di tipo '{0}' non è applicabile per l'attributo DefaultParameterValue</target> <note /> </trans-unit> <trans-unit id="ERR_MemberAlreadyInitialized"> <source>Duplicate initialization of member '{0}'</source> <target state="translated">Inizializzazione del membro '{0}' duplicata</target> <note /> </trans-unit> <trans-unit id="ERR_MemberCannotBeInitialized"> <source>Member '{0}' cannot be initialized. It is not a field or property.</source> <target state="translated">Non è possibile inizializzare il membro '{0}'. Non è un campo o una proprietà.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticMemberInObjectInitializer"> <source>Static field or property '{0}' cannot be assigned in an object initializer</source> <target state="translated">Non è possibile assegnare la proprietà o il campo statico '{0}' in un inizializzatore di oggetti</target> <note /> </trans-unit> <trans-unit id="ERR_ReadonlyValueTypeInObjectInitializer"> <source>Members of readonly field '{0}' of type '{1}' cannot be assigned with an object initializer because it is of a value type</source> <target state="translated">Non è possibile assegnare i membri del campo di sola lettura '{0}' di tipo '{1}' con un inizializzatore di oggetto perché è di un tipo di valore</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTypePropertyInObjectInitializer"> <source>Members of property '{0}' of type '{1}' cannot be assigned with an object initializer because it is of a value type</source> <target state="translated">Non è possibile assegnare i membri della proprietà '{0}' di tipo '{1}' con un inizializzatore di oggetto perché è di un tipo valore</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeTypeInObjectCreation"> <source>Unsafe type '{0}' cannot be used in object creation</source> <target state="translated">Non è possibile usare il tipo unsafe '{0}' nella creazione di oggetti</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyElementInitializer"> <source>Element initializer cannot be empty</source> <target state="translated">L'inizializzatore di elementi non può essere vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerAddHasWrongSignature"> <source>The best overloaded method match for '{0}' has wrong signature for the initializer element. The initializable Add must be an accessible instance method.</source> <target state="translated">La firma per l'elemento inizializzatore nella migliore corrispondenza del metodo di overload per '{0}' non è corretta. Il metodo Add inizializzabile deve essere un metodo di istanza accessibile.</target> <note /> </trans-unit> <trans-unit id="ERR_CollectionInitRequiresIEnumerable"> <source>Cannot initialize type '{0}' with a collection initializer because it does not implement 'System.Collections.IEnumerable'</source> <target state="translated">Non è possibile inizializzare il tipo '{0}' con un inizializzatore di raccolta perché non implementa 'System.Collections.IEnumerable'</target> <note /> </trans-unit> <trans-unit id="ERR_CantSetWin32Manifest"> <source>Error reading Win32 manifest file '{0}' -- '{1}'</source> <target state="translated">Si è verificato un errore durante la lettura del file manifesto Win32 '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CantHaveManifestForModule"> <source>Ignoring /win32manifest for module because it only applies to assemblies</source> <target state="translated">L'opzione /win32manifest per il modulo verrà ignorata perché si applica solo agli assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CantHaveManifestForModule_Title"> <source>Ignoring /win32manifest for module because it only applies to assemblies</source> <target state="translated">L'opzione /win32manifest per il modulo verrà ignorata perché si applica solo agli assembly</target> <note /> </trans-unit> <trans-unit id="ERR_BadInstanceArgType"> <source>'{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' requires a receiver of type '{3}'</source> <target state="translated">'{0}' non contiene una definizione per '{1}' e il miglior overload '{2}' del metodo di estensione richiede un ricevitore di tipo '{3}'</target> <note /> </trans-unit> <trans-unit id="ERR_QueryDuplicateRangeVariable"> <source>The range variable '{0}' has already been declared</source> <target state="translated">La variabile di intervallo '{0}' è già stata dichiarata</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableOverrides"> <source>The range variable '{0}' conflicts with a previous declaration of '{0}'</source> <target state="translated">La variabile di intervallo '{0}' è in conflitto con una dichiarazione precedente di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableAssignedBadValue"> <source>Cannot assign {0} to a range variable</source> <target state="translated">Non è possibile assegnare {0} a una variabile di intervallo</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNoProviderCastable"> <source>Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Consider explicitly specifying the type of the range variable '{2}'.</source> <target state="translated">Non è stata trovata un'implementazione del modello di query per il tipo di origine '{0}'. '{1}' non è presente. Provare a specificare in modo esplicito il tipo della variabile di intervallo '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNoProviderStandard"> <source>Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Are you missing required assembly references or a using directive for 'System.Linq'?</source> <target state="translated">Non è stata trovata alcuna implementazione del modello di query per il tipo di origine '{0}'. '{1}' non è presente. Mancano i riferimenti all'assembly richiesti oppure una direttiva using per 'System.Linq'?</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNoProvider"> <source>Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found.</source> <target state="translated">Non è stata trovata un'implementazione di un modello di query per il tipo di origine '{0}'. '{1}' non è presente.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOuterKey"> <source>The name '{0}' is not in scope on the left side of 'equals'. Consider swapping the expressions on either side of 'equals'.</source> <target state="translated">Il nome '{0}' non si trova nell'ambito a sinistra di 'equals'. Provare a invertire le espressioni ai lati di 'equals'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryInnerKey"> <source>The name '{0}' is not in scope on the right side of 'equals'. Consider swapping the expressions on either side of 'equals'.</source> <target state="translated">Il nome '{0}' non si trova nell'ambito a destra di 'equals'. Provare a invertire le espressioni ai lati di 'equals'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOutRefRangeVariable"> <source>Cannot pass the range variable '{0}' as an out or ref parameter</source> <target state="translated">Non è possibile passare la variabile di intervallo '{0}' come parametro out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_QueryMultipleProviders"> <source>Multiple implementations of the query pattern were found for source type '{0}'. Ambiguous call to '{1}'.</source> <target state="translated">Sono state trovate più implementazioni del modello di query per il tipo di origine '{0}'. Chiamata ambigua a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryTypeInferenceFailedMulti"> <source>The type of one of the expressions in the {0} clause is incorrect. Type inference failed in the call to '{1}'.</source> <target state="translated">Il tipo di una delle espressioni nella clausola {0} non è corretto. L'inferenza del tipo non è riuscita nella chiamata a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryTypeInferenceFailed"> <source>The type of the expression in the {0} clause is incorrect. Type inference failed in the call to '{1}'.</source> <target state="translated">Il tipo dell'espressione nella clausola {0} non è corretto. L'inferenza del tipo non è riuscita nella chiamata a '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryTypeInferenceFailedSelectMany"> <source>An expression of type '{0}' is not allowed in a subsequent from clause in a query expression with source type '{1}'. Type inference failed in the call to '{2}'.</source> <target state="translated">Un'espressione di tipo '{0}' non è consentita in una clausola from successiva in un'espressione di query con tipo di origine '{1}'. L'inferenza del tipo non è riuscita nella chiamata a '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsPointerOp"> <source>An expression tree may not contain an unsafe pointer operation</source> <target state="translated">Un albero delle espressioni non può contenere un'operazione di puntatore unsafe</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsAnonymousMethod"> <source>An expression tree may not contain an anonymous method expression</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione di metodo anonimo</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousMethodToExpressionTree"> <source>An anonymous method expression cannot be converted to an expression tree</source> <target state="translated">Non è possibile convertire un'espressione di metodo anonimo in un albero delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableReadOnly"> <source>Range variable '{0}' cannot be assigned to -- it is read only</source> <target state="translated">Non è possibile assegnare la variabile di intervallo '{0}'. È di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_QueryRangeVariableSameAsTypeParam"> <source>The range variable '{0}' cannot have the same name as a method type parameter</source> <target state="translated">La variabile di intervallo '{0}' non può avere lo stesso nome di un parametro di tipo del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_TypeVarNotFoundRangeVariable"> <source>The contextual keyword 'var' cannot be used in a range variable declaration</source> <target state="translated">Impossibile utilizzare la parola chiave contestuale 'var' in una dichiarazione di variabile di intervallo</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgTypesForCollectionAdd"> <source>The best overloaded Add method '{0}' for the collection initializer has some invalid arguments</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'inizializzatore di raccolta presenta alcuni argomenti non validi</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefParameterInExpressionTree"> <source>An expression tree lambda may not contain a ref, in or out parameter</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un parametro in, out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_VarArgsInExpressionTree"> <source>An expression tree lambda may not contain a method with variable arguments</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un metodo con argomenti variabili</target> <note /> </trans-unit> <trans-unit id="ERR_MemGroupInExpressionTree"> <source>An expression tree lambda may not contain a method group</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un gruppo di metodi</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerAddHasParamModifiers"> <source>The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters.</source> <target state="translated">Non è possibile usare la migliore corrispondenza '{0}' del metodo di overload per l'elemento inizializzatore di raccolta. I metodi 'Add' dell'inizializzatore di raccolta non possono avere parametri out o ref.</target> <note /> </trans-unit> <trans-unit id="ERR_NonInvocableMemberCalled"> <source>Non-invocable member '{0}' cannot be used like a method.</source> <target state="translated">Non è possibile usare come metodo il membro non richiamabile '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeImplementationMatches"> <source>Member '{0}' implements interface member '{1}' in type '{2}'. There are multiple matches for the interface member at run-time. It is implementation dependent which method will be called.</source> <target state="translated">Il membro '{0}' implementa il membro di interfaccia '{1}' nel tipo '{2}'. In fase di esecuzione sono presenti più corrispondenze del membro di interfaccia. Il metodo che verrà chiamato dipende dall'implementazione.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeImplementationMatches_Title"> <source>Member implements interface member with multiple matches at run-time</source> <target state="translated">Il membro implementa il membro di interfaccia con più corrispondenze in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeImplementationMatches_Description"> <source>This warning can be generated when two interface methods are differentiated only by whether a particular parameter is marked with ref or with out. It is best to change your code to avoid this warning because it is not obvious or guaranteed which method is called at runtime. Although C# distinguishes between out and ref, the CLR sees them as the same. When deciding which method implements the interface, the CLR just picks one. Give the compiler some way to differentiate the methods. For example, you can give them different names or provide an additional parameter on one of them.</source> <target state="translated">Questo avviso può essere visualizzato quando due metodi di interfaccia si differenziano solo per il fatto che un determinato parametro sia contrassegnato con ref o con out. È consigliabile modificare il codice per evitare la visualizzazione di questo avviso perché non è ovvio o garantito quale metodo venga effettivamente chiamato in fase di esecuzione. Anche in C# viene fatta distinzione tra out e ref, in CLR questi metodi sono considerati uguali. Quando si decide il metodo che implementa l'interfaccia, in CLR ne viene semplicemente scelto uno. Impostare il compilatore in modo tale da distinguere i metodi, ad esempio assegnando loro nomi diversi o specificando un parametro aggiuntivo per uno di essi.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeOverrideMatches"> <source>Member '{1}' overrides '{0}'. There are multiple override candidates at run-time. It is implementation dependent which method will be called. Please use a newer runtime.</source> <target state="translated">Il membro '{1}' esegue l'override di '{0}'. In fase di esecuzione sono presenti più candidati per l'override. Il metodo che verrà chiamato dipende dall'implementazione. Usare un runtime più recente.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleRuntimeOverrideMatches_Title"> <source>Member overrides base member with multiple override candidates at run-time</source> <target state="translated">Il membro esegue l'override del membro di base con più candidati di override in fase di esecuzione</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectOrCollectionInitializerWithDelegateCreation"> <source>Object and collection initializer expressions may not be applied to a delegate creation expression</source> <target state="translated">Le espressioni dell'inizializzatore di oggetto e di raccolta non possono essere applicate a un'espressione di creazione del delegato</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidConstantDeclarationType"> <source>'{0}' is of type '{1}'. The type specified in a constant declaration must be sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, string, an enum-type, or a reference-type.</source> <target state="translated">'{0}' è di tipo '{1}'. Il tipo specificato in una dichiarazione di costante deve essere sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, string, enum-type o reference-type.</target> <note /> </trans-unit> <trans-unit id="ERR_FileNotFound"> <source>Source file '{0}' could not be found.</source> <target state="translated">Il file di origine '{0}' non è stato trovato.</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded"> <source>Source file '{0}' specified multiple times</source> <target state="translated">Il file di origine '{0}' è specificato più volte</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded_Title"> <source>Source file specified multiple times</source> <target state="translated">Il file di origine è specificato più volte</target> <note /> </trans-unit> <trans-unit id="ERR_NoFileSpec"> <source>Missing file specification for '{0}' option</source> <target state="translated">Manca la specifica del file per l'opzione '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsString"> <source>Command-line syntax error: Missing '{0}' for '{1}' option</source> <target state="translated">Errore nella sintassi della riga di comando: manca '{0}' per l'opzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitch"> <source>Unrecognized option: '{0}'</source> <target state="translated">Opzione non riconosciuta: '{0}'</target> <note /> </trans-unit> <trans-unit id="WRN_NoSources"> <source>No source files specified.</source> <target state="translated">Non sono stati specificati file di origine.</target> <note /> </trans-unit> <trans-unit id="WRN_NoSources_Title"> <source>No source files specified</source> <target state="translated">Non sono stati specificati file di origine</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSingleScript"> <source>Expected a script (.csx file) but none specified</source> <target state="translated">È previsto uno script (file con estensione csx) ma non ne è stato specificato nessuno</target> <note /> </trans-unit> <trans-unit id="ERR_OpenResponseFile"> <source>Error opening response file '{0}'</source> <target state="translated">Si è verificato un errore durante l'apertura del file di risposta '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenFileWrite"> <source>Cannot open '{0}' for writing -- '{1}'</source> <target state="translated">Non è possibile aprire '{0}' per la scrittura - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadBaseNumber"> <source>Invalid image base number '{0}'</source> <target state="translated">'{0}' non è un numero di base dell'immagine valido</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryFile"> <source>'{0}' is a binary file instead of a text file</source> <target state="translated">'{0}' è un file binario e non un file di testo</target> <note /> </trans-unit> <trans-unit id="FTL_BadCodepage"> <source>Code page '{0}' is invalid or not installed</source> <target state="translated">La tabella codici '{0}' non è valida o non è installata</target> <note /> </trans-unit> <trans-unit id="FTL_BadChecksumAlgorithm"> <source>Algorithm '{0}' is not supported</source> <target state="translated">L'algoritmo '{0}' non è supportato</target> <note /> </trans-unit> <trans-unit id="ERR_NoMainOnDLL"> <source>Cannot specify /main if building a module or library</source> <target state="translated">Non è possibile specificare /main se si compila un modulo o una libreria</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidTarget"> <source>Invalid target type for /target: must specify 'exe', 'winexe', 'library', or 'module'</source> <target state="translated">Il tipo di destinazione non è valido per /target. È necessario specificare 'exe', 'winexe', 'library' o 'module'</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigNotOnCommandLine"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">L'opzione /noconfig è stata ignorata perché è stata specificata in un file di risposta</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigNotOnCommandLine_Title"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">L'opzione /noconfig è stata ignorata perché è stata specificata in un file di risposta</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFileAlignment"> <source>Invalid file section alignment '{0}'</source> <target state="translated">L'allineamento '{0}' della sezione del file non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOutputName"> <source>Invalid output name: {0}</source> <target state="translated">Nome di output non valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInformationFormat"> <source>Invalid debug information format: {0}</source> <target state="translated">Formato delle informazioni di debug non valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_LegacyObjectIdSyntax"> <source>'id#' syntax is no longer supported. Use '$id' instead.</source> <target state="translated">'La sintassi 'id#' non è più supportata. Usare '$id'.</target> <note /> </trans-unit> <trans-unit id="WRN_DefineIdentifierRequired"> <source>Invalid name for a preprocessing symbol; '{0}' is not a valid identifier</source> <target state="translated">Nome non valido per un simbolo di pre-elaborazione. '{0}' non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="WRN_DefineIdentifierRequired_Title"> <source>Invalid name for a preprocessing symbol; not a valid identifier</source> <target state="translated">Nome non valido per un simbolo di pre-elaborazione. Non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="FTL_OutputFileExists"> <source>Cannot create short filename '{0}' when a long filename with the same short filename already exists</source> <target state="translated">Non è possibile creare il nome di file breve '{0}' se esiste già un nome di file lungo con lo stesso nome di file breve</target> <note /> </trans-unit> <trans-unit id="ERR_OneAliasPerReference"> <source>A /reference option that declares an extern alias can only have one filename. To specify multiple aliases or filenames, use multiple /reference options.</source> <target state="translated">Un'opzione /reference che dichiara un alias extern può avere un solo nome di file. Per specificare più alias o nomi di file, utilizzare più opzioni /reference.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsNumber"> <source>Command-line syntax error: Missing ':&lt;number&gt;' for '{0}' option</source> <target state="translated">Errore nella sintassi della riga di comando: manca ':&lt;numero&gt;' per l'opzione '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingDebugSwitch"> <source>The /pdb option requires that the /debug option also be used</source> <target state="translated">L'opzione /pdb richiede che venga specificata anche l'opzione /debug</target> <note /> </trans-unit> <trans-unit id="ERR_ComRefCallInExpressionTree"> <source>An expression tree lambda may not contain a COM call with ref omitted on arguments</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere una chiamata COM con argomenti privi di ref</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatForGuidForOption"> <source>Command-line syntax error: Invalid Guid format '{0}' for option '{1}'</source> <target state="translated">Errore nella sintassi della riga di comando: il formato del GUID '{0}' non è valido per l'opzione '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingGuidForOption"> <source>Command-line syntax error: Missing Guid for option '{1}'</source> <target state="translated">Errore nella sintassi della riga di comando: manca il GUID per l'opzione '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoVarArgs"> <source>Methods with variable arguments are not CLS-compliant</source> <target state="translated">I metodi con argomenti variabili non sono conformi alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoVarArgs_Title"> <source>Methods with variable arguments are not CLS-compliant</source> <target state="translated">I metodi con argomenti variabili non sono conformi alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadArgType"> <source>Argument type '{0}' is not CLS-compliant</source> <target state="translated">Il tipo dell'argomento '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadArgType_Title"> <source>Argument type is not CLS-compliant</source> <target state="translated">Il tipo dell'argomento non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadReturnType"> <source>Return type of '{0}' is not CLS-compliant</source> <target state="translated">Il tipo restituito di '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadReturnType_Title"> <source>Return type is not CLS-compliant</source> <target state="translated">Il tipo restituito non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadFieldPropType"> <source>Type of '{0}' is not CLS-compliant</source> <target state="translated">Il tipo '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadFieldPropType_Title"> <source>Type is not CLS-compliant</source> <target state="translated">Il tipo non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadFieldPropType_Description"> <source>A public, protected, or protected internal variable must be of a type that is compliant with the Common Language Specification (CLS).</source> <target state="translated">Una variabile public, protected o protected internal deve essere di tipo conforme a CLS (Common Language Specification).</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifierCase"> <source>Identifier '{0}' differing only in case is not CLS-compliant</source> <target state="translated">L'identificatore '{0}' che differisce solo per l'uso di caratteri maiuscoli o minuscoli non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifierCase_Title"> <source>Identifier differing only in case is not CLS-compliant</source> <target state="translated">L'identificatore che differisce solo per l'uso di caratteri maiuscoli o minuscoli non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadRefOut"> <source>Overloaded method '{0}' differing only in ref or out, or in array rank, is not CLS-compliant</source> <target state="translated">Il metodo di overload '{0}' che differisce solo per out o ref o per numero di dimensioni della matrice non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadRefOut_Title"> <source>Overloaded method differing only in ref or out, or in array rank, is not CLS-compliant</source> <target state="translated">Il metodo di overload, che differisce solo per out o ref o per numero di dimensioni della matrice, non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadUnnamed"> <source>Overloaded method '{0}' differing only by unnamed array types is not CLS-compliant</source> <target state="translated">Il metodo di overload '{0}' che differisce solo per i tipi matrice senza nome non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadUnnamed_Title"> <source>Overloaded method differing only by unnamed array types is not CLS-compliant</source> <target state="translated">Il metodo di overload, che differisce solo per i tipi matrice senza nome, non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_OverloadUnnamed_Description"> <source>This error occurs if you have an overloaded method that takes a jagged array and the only difference between the method signatures is the element type of the array. To avoid this error, consider using a rectangular array rather than a jagged array; use an additional parameter to disambiguate the function call; rename one or more of the overloaded methods; or, if CLS Compliance is not needed, remove the CLSCompliantAttribute attribute.</source> <target state="translated">Questo errore si verifica quando si usa un metodo di overload che accetta una matrice irregolare e le firme del metodo si differenziano solo per il tipo di elemento della matrice. Per evitare questo errore, provare a usare una matrice rettangolare invece di una irregolare, aggiungere un parametro in modo da evitare ambiguità nella chiamata della funzione oppure rinominare uno o più metodi di overload. In alternativa, se la compatibilità con CLS non è necessaria, rimuovere l'attributo CLSCompliantAttribute.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifier"> <source>Identifier '{0}' is not CLS-compliant</source> <target state="translated">L'identificatore '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadIdentifier_Title"> <source>Identifier is not CLS-compliant</source> <target state="translated">L'identificatore non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadBase"> <source>'{0}': base type '{1}' is not CLS-compliant</source> <target state="translated">'{0}': il tipo di base '{1}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadBase_Title"> <source>Base type is not CLS-compliant</source> <target state="translated">Il tipo di base non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadBase_Description"> <source>A base type was marked as not having to be compliant with the Common Language Specification (CLS) in an assembly that was marked as being CLS compliant. Either remove the attribute that specifies the assembly is CLS compliant or remove the attribute that indicates the type is not CLS compliant.</source> <target state="translated">In un assembly contrassegnato come conforme a CLS (Common Language Specification) è stato specificato un tipo di base non conforme a CLS. Rimuovere l'attributo che contrassegna l'assembly come conforme a CLS oppure l'attributo che indica il tipo come non conforme a CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterfaceMember"> <source>'{0}': CLS-compliant interfaces must have only CLS-compliant members</source> <target state="translated">'{0}': le interfacce compatibili con CLS devono avere solo membri conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterfaceMember_Title"> <source>CLS-compliant interfaces must have only CLS-compliant members</source> <target state="translated">Le interfacce compatibili con CLS devono contenere solo membri conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoAbstractMembers"> <source>'{0}': only CLS-compliant members can be abstract</source> <target state="translated">'{0}': solo i membri conformi a CLS possono essere di tipo abstract</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NoAbstractMembers_Title"> <source>Only CLS-compliant members can be abstract</source> <target state="translated">Solo i membri conformi a CLS possono essere di tipo abstract</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules"> <source>You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking</source> <target state="translated">Per abilitare il controllo di conformità a CLS, è necessario specificare l'attributo CLSCompliant nell'assembly, non nel modulo</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules_Title"> <source>You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking</source> <target state="translated">Per abilitare il controllo di conformità a CLS, è necessario specificare l'attributo CLSCompliant nell'assembly, non nel modulo</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ModuleMissingCLS"> <source>Added modules must be marked with the CLSCompliant attribute to match the assembly</source> <target state="translated">I moduli aggiunti devono essere contrassegnati con l'attributo CLSCompliant per corrispondere all'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ModuleMissingCLS_Title"> <source>Added modules must be marked with the CLSCompliant attribute to match the assembly</source> <target state="translated">I moduli aggiunti devono essere contrassegnati con l'attributo CLSCompliant per corrispondere all'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS"> <source>'{0}' cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute</source> <target state="translated">'{0}' non può essere contrassegnato come conforme a CLS perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS_Title"> <source>Type or member cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute</source> <target state="translated">Il tipo o il membro non può essere contrassegnato come conforme a CLS perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadAttributeType"> <source>'{0}' has no accessible constructors which use only CLS-compliant types</source> <target state="translated">'{0}' non ha costruttori accessibili che usano solo tipi conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadAttributeType_Title"> <source>Type has no accessible constructors which use only CLS-compliant types</source> <target state="translated">Il tipo non contiene costruttori accessibili che usano solo tipi conformi a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ArrayArgumentToAttribute"> <source>Arrays as attribute arguments is not CLS-compliant</source> <target state="translated">L'utilizzo di matrici come argomenti di attributi non è conforme alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_ArrayArgumentToAttribute_Title"> <source>Arrays as attribute arguments is not CLS-compliant</source> <target state="translated">L'utilizzo di matrici come argomenti di attributi non è conforme alle specifiche CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules2"> <source>You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly</source> <target state="translated">Impossibile specificare l'attributo CLSCompliant su un modulo che differisce dall'attributo CLSCompliant sull'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_NotOnModules2_Title"> <source>You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly</source> <target state="translated">Impossibile specificare l'attributo CLSCompliant su un modulo che differisce dall'attributo CLSCompliant sull'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_IllegalTrueInFalse"> <source>'{0}' cannot be marked as CLS-compliant because it is a member of non-CLS-compliant type '{1}'</source> <target state="translated">'Non è possibile contrassegnare '{0}' come conforme a CLS perché è un membro del tipo non conforme a CLS '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_IllegalTrueInFalse_Title"> <source>Type cannot be marked as CLS-compliant because it is a member of non-CLS-compliant type</source> <target state="translated">Non è possibile contrassegnare il tipo come conforme a CLS perché è un membro del tipo non conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnPrivateType"> <source>CLS compliance checking will not be performed on '{0}' because it is not visible from outside this assembly</source> <target state="translated">Il controllo di conformità a CLS non verrà eseguito in '{0}' perché non è visibile all'esterno dell'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnPrivateType_Title"> <source>CLS compliance checking will not be performed because it is not visible from outside this assembly</source> <target state="translated">Il controllo di conformità a CLS non verrà eseguito perché non è visibile all'esterno dell'assembly</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS2"> <source>'{0}' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute</source> <target state="translated">'{0}' non necessita di un attributo CLSCompliant perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_AssemblyNotCLS2_Title"> <source>Type or member does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute</source> <target state="translated">Il tipo o il membro non necessita di un attributo CLSCompliant perché l'assembly non ha un attributo CLSCompliant</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnParam"> <source>CLSCompliant attribute has no meaning when applied to parameters. Try putting it on the method instead.</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a parametri. Provare ad applicarlo al metodo.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnParam_Title"> <source>CLSCompliant attribute has no meaning when applied to parameters</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a parametri</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnReturn"> <source>CLSCompliant attribute has no meaning when applied to return types. Try putting it on the method instead.</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a tipi restituiti. Provare ad applicarlo al metodo.</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_MeaninglessOnReturn_Title"> <source>CLSCompliant attribute has no meaning when applied to return types</source> <target state="translated">L'attributo CLSCompliant non ha significato quando applicato a tipi restituiti</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadTypeVar"> <source>Constraint type '{0}' is not CLS-compliant</source> <target state="translated">Il tipo di vincolo '{0}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadTypeVar_Title"> <source>Constraint type is not CLS-compliant</source> <target state="translated">Il tipo di vincolo non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_VolatileField"> <source>CLS-compliant field '{0}' cannot be volatile</source> <target state="translated">Il campo conforme a CLS '{0}' non può essere volatile</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_VolatileField_Title"> <source>CLS-compliant field cannot be volatile</source> <target state="translated">Il campo conforme a CLS non può essere volatile</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterface"> <source>'{0}' is not CLS-compliant because base interface '{1}' is not CLS-compliant</source> <target state="translated">'{0}' non è conforme a CLS perché l'interfaccia di base '{1}' non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLS_BadInterface_Title"> <source>Type is not CLS-compliant because base interface is not CLS-compliant</source> <target state="translated">Il tipo non è conforme a CLS perché l'interfaccia di base non è conforme a CLS</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArg"> <source>'await' requires that the type {0} have a suitable 'GetAwaiter' method</source> <target state="translated">Con 'await' il tipo {0} deve essere associato a un metodo 'GetAwaiter' appropriato</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArgIntrinsic"> <source>Cannot await '{0}'</source> <target state="translated">Non è possibile attendere '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaiterPattern"> <source>'await' requires that the return type '{0}' of '{1}.GetAwaiter()' have suitable 'IsCompleted', 'OnCompleted', and 'GetResult' members, and implement 'INotifyCompletion' or 'ICriticalNotifyCompletion'</source> <target state="translated">Con 'await' il tipo restituito '{0}' di '{1}.GetAwaiter()' deve essere associato a membri 'IsCompleted', 'OnCompleted' e 'GetResult' appropriati e implementare 'INotifyCompletion' o 'ICriticalNotifyCompletion'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArg_NeedSystem"> <source>'await' requires that the type '{0}' have a suitable 'GetAwaiter' method. Are you missing a using directive for 'System'?</source> <target state="translated">Con 'await' il tipo '{0}' deve essere associato a un metodo 'GetAwaiter' appropriato. Manca una direttiva using per 'System'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitArgVoidCall"> <source>Cannot await 'void'</source> <target state="translated">Non è possibile attendere 'void'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitAsIdentifier"> <source>'await' cannot be used as an identifier within an async method or lambda expression</source> <target state="translated">'Non è possibile usare 'await' come identificatore all'interno di un metodo asincrono o di un'espressione lambda</target> <note /> </trans-unit> <trans-unit id="ERR_DoesntImplementAwaitInterface"> <source>'{0}' does not implement '{1}'</source> <target state="translated">'{0}' non implementa '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_TaskRetNoObjectRequired"> <source>Since '{0}' is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task&lt;T&gt;'?</source> <target state="translated">Poiché '{0}' è un metodo asincrono che restituisce 'Task', una parola chiave restituita non deve essere seguita da un'espressione di oggetto. Si intendeva restituire 'Task&lt;T&gt;'?</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturn"> <source>The return type of an async method must be void, Task, Task&lt;T&gt;, a task-like type, IAsyncEnumerable&lt;T&gt;, or IAsyncEnumerator&lt;T&gt;</source> <target state="translated">Il tipo restituito di un metodo asincrono deve essere void, Task, Task&lt;T&gt;, un tipo simile a Task, IAsyncEnumerable&lt;T&gt; o IAsyncEnumerator&lt;T&gt;</target> <note /> </trans-unit> <trans-unit id="ERR_CantReturnVoid"> <source>Cannot return an expression of type 'void'</source> <target state="translated">Non è possibile restituire un'espressione di tipo 'void'</target> <note /> </trans-unit> <trans-unit id="ERR_VarargsAsync"> <source>__arglist is not allowed in the parameter list of async methods</source> <target state="translated">__arglist non è consentito nell'elenco di parametri di metodi asincroni</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefTypeAndAwait"> <source>'await' cannot be used in an expression containing the type '{0}'</source> <target state="translated">'non è possibile usare 'await' in un'espressione contenente il tipo '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_UnsafeAsyncArgType"> <source>Async methods cannot have unsafe parameters or return types</source> <target state="translated">I metodi asincroni non possono avere parametri non sicuri o tipi restituiti</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncArgType"> <source>Async methods cannot have ref, in or out parameters</source> <target state="translated">I metodi asincroni non possono avere parametri in, our o ref</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutAsync"> <source>The 'await' operator can only be used when contained within a method or lambda expression marked with the 'async' modifier</source> <target state="translated">L'operatore 'await' può essere usato solo quando è contenuto in un metodo o un'espressione lambda contrassegnata con il modificatore 'async'</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutAsyncLambda"> <source>The 'await' operator can only be used within an async {0}. Consider marking this {0} with the 'async' modifier.</source> <target state="translated">L'operatore 'await' può essere usato solo all'interno di un {0} asincrono. Contrassegnare questo {0} con il modificatore 'async'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutAsyncMethod"> <source>The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task&lt;{0}&gt;'.</source> <target state="translated">L'operatore 'await' può essere usato solo all'interno di un metodo asincrono. Provare a contrassegnare questo metodo con il modificatore 'async' e modificare il tipo restituito su 'Task&lt;{0}&gt;'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitWithoutVoidAsyncMethod"> <source>The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.</source> <target state="translated">L'operatore 'await' può essere usato solo all'interno di un metodo asincrono. Provare a contrassegnare questo metodo con il modificatore 'async' e modificare il tipo restituito su 'Task'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInFinally"> <source>Cannot await in the body of a finally clause</source> <target state="translated">Non è possibile includere un elemento await nel corpo di una clausola finally</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInCatch"> <source>Cannot await in a catch clause</source> <target state="translated">Non è possibile includere un elemento await in una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInCatchFilter"> <source>Cannot await in the filter expression of a catch clause</source> <target state="translated">Non è possibile includere un elemento await nell'espressione di filtro di una clausola catch</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInLock"> <source>Cannot await in the body of a lock statement</source> <target state="translated">Non è possibile includere un elemento await nel corpo di un'istruzione lock</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInStaticVariableInitializer"> <source>The 'await' operator cannot be used in a static script variable initializer.</source> <target state="translated">Non è possibile usare l'operatore 'await' in un inizializzatore di variabile script statico.</target> <note /> </trans-unit> <trans-unit id="ERR_AwaitInUnsafeContext"> <source>Cannot await in an unsafe context</source> <target state="translated">Non è possibile attendere in un contesto non sicuro</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncLacksBody"> <source>The 'async' modifier can only be used in methods that have a body.</source> <target state="translated">Il modificatore 'async' può essere usato solo nei metodi con un corpo.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecialByRefLocal"> <source>Parameters or locals of type '{0}' cannot be declared in async methods or async lambda expressions.</source> <target state="translated">Non è possibile dichiarare parametri o variabili locali di tipo '{0}' in metodi asincroni o espressioni lambda asincrone.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecialByRefIterator"> <source>foreach statement cannot operate on enumerators of type '{0}' in async or iterator methods because '{0}' is a ref struct.</source> <target state="translated">L'istruzione foreach non può funzionare con enumeratori di tipo '{0}' in metodi async o iterator perché '{0}' è uno struct ref.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync"> <source>Security attribute '{0}' cannot be applied to an Async method.</source> <target state="translated">Non è possibile applicare l'attributo di sicurezza '{0}' a un metodo Async</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalOrSecuritySafeCriticalOnAsyncInClassOrStruct"> <source>Async methods are not allowed in an Interface, Class, or Structure which has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.</source> <target state="translated">I metodi asincroni non sono consentiti in un'interfaccia, una classe o una struttura che ha l'attributo 'SecurityCritical' o 'SecuritySafeCritical'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInQuery"> <source>The 'await' operator may only be used in a query expression within the first collection expression of the initial 'from' clause or within the collection expression of a 'join' clause</source> <target state="translated">È possibile usare l'operatore 'await' solo in espressioni di query all'interno della prima espressione di raccolta della clausola 'from' iniziale o all'interno dell'espressione di raccolta di una clausola 'join'</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits"> <source>This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.</source> <target state="translated">In questo metodo asincrono non sono presenti operatori 'await', pertanto verrà eseguito in modo sincrono. Provare a usare l'operatore 'await' per attendere chiamate ad API non di blocco oppure 'await Task.Run(...)' per effettuare elaborazioni basate sulla CPU in un thread in background.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits_Title"> <source>Async method lacks 'await' operators and will run synchronously</source> <target state="translated">Il metodo asincrono non contiene operatori 'await', pertanto verrà eseguito in modo sincrono</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression"> <source>Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.</source> <target state="translated">Non è possibile attendere la chiamata, pertanto l'esecuzione del metodo corrente continuerà prima del completamento della chiamata. Provare ad applicare l'operatore 'await' al risultato della chiamata.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Title"> <source>Because this call is not awaited, execution of the current method continues before the call is completed</source> <target state="translated">Non è possibile attendere la chiamata, pertanto l'esecuzione del metodo corrente continuerà prima del completamento della chiamata</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Description"> <source>The current method calls an async method that returns a Task or a Task&lt;TResult&gt; and doesn't apply the await operator to the result. The call to the async method starts an asynchronous task. However, because no await operator is applied, the program continues without waiting for the task to complete. In most cases, that behavior isn't what you expect. Usually other aspects of the calling method depend on the results of the call or, minimally, the called method is expected to complete before you return from the method that contains the call. An equally important issue is what happens to exceptions that are raised in the called async method. An exception that's raised in a method that returns a Task or Task&lt;TResult&gt; is stored in the returned task. If you don't await the task or explicitly check for exceptions, the exception is lost. If you await the task, its exception is rethrown. As a best practice, you should always await the call. You should consider suppressing the warning only if you're sure that you don't want to wait for the asynchronous call to complete and that the called method won't raise any exceptions. In that case, you can suppress the warning by assigning the task result of the call to a variable.</source> <target state="translated">Il metodo corrente chiama un metodo asincrono che restituisce un elemento Task o Task&lt;TResult&gt; e non applica l'operatore await al risultato. La chiamata al metodo asincrono avvia un'attività asincrona. Dal momento, però, che non viene applicato alcun operatore await, l'esecuzione del programma continua senza attendere il completamento dell'attività. Nella maggior parte dei casi questo non è il comportamento previsto. In genere, altri aspetti del metodo chiamante dipendono dai risultati della chiamata o è almeno previsto che il metodo chiamato venga completato prima del termine del metodo che contiene la chiamata. Un aspetto ugualmente importante è costituito dalla gestione delle eccezioni generate nel metodo asincrono chiamato. Un'eccezione generata in un metodo che restituisce un elemento Task o Task&lt;TResult&gt; viene archiviata nell'attività restituita. Se non si attende l'attività o si verifica esplicitamente la presenza di eccezioni, l'eccezione viene persa. Se si attende l'attività, l'eccezione viene nuovamente generata. Come procedura consigliata, è consigliabile attendere sempre la chiamata. È opportuno eliminare l'avviso solo se si è certi che non si vuole attendere il completamento della chiamata asincrona e che il metodo chiamato non genera alcuna eccezione. In tal caso, è possibile eliminare l'avviso assegnando il risultato dell'attività della chiamata a una variabile.</target> <note /> </trans-unit> <trans-unit id="ERR_SynchronizedAsyncMethod"> <source>'MethodImplOptions.Synchronized' cannot be applied to an async method</source> <target state="translated">'Non è possibile applicare 'MethodImplOptions.Synchronized' a un metodo asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerLineNumberParam"> <source>CallerLineNumberAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="translated">Non è possibile applicare CallerLineNumberAttribute perché non sono disponibili conversioni standard dal tipo '{0}' al tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerFilePathParam"> <source>CallerFilePathAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="translated">Non è possibile applicare CallerFilePathAttribute perché non sono presenti conversioni standard dal tipo '{0}' al tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForCallerMemberNameParam"> <source>CallerMemberNameAttribute cannot be applied because there are no standard conversions from type '{0}' to type '{1}'</source> <target state="translated">Non è possibile applicare CallerMemberNameAttribute perché non sono disponibili conversioni standard dal tipo '{0}' al tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerLineNumberParamWithoutDefaultValue"> <source>The CallerLineNumberAttribute may only be applied to parameters with default values</source> <target state="translated">CallerLineNumberAttribute può essere applicato solo a parametri con valori predefiniti</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerFilePathParamWithoutDefaultValue"> <source>The CallerFilePathAttribute may only be applied to parameters with default values</source> <target state="translated">CallerFilePathAttribute può essere applicato solo a parametri con valori predefiniti</target> <note /> </trans-unit> <trans-unit id="ERR_BadCallerMemberNameParamWithoutDefaultValue"> <source>The CallerMemberNameAttribute may only be applied to parameters with default values</source> <target state="translated">CallerMemberNameAttribute può essere applicato solo a parametri con valori predefiniti</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberParamForUnconsumedLocation"> <source>The CallerLineNumberAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerLineNumberAttribute applicato al parametro '{0}' non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberParamForUnconsumedLocation_Title"> <source>The CallerLineNumberAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerLineNumberAttribute non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathParamForUnconsumedLocation"> <source>The CallerFilePathAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">L'elemento CallerFilePathAttribute applicato al parametro '{0}' non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathParamForUnconsumedLocation_Title"> <source>The CallerFilePathAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">L'elemento CallerFilePathAttribute non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNameParamForUnconsumedLocation"> <source>The CallerMemberNameAttribute applied to parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerMemberNameAttribute applicato al parametro '{0}' non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_CallerMemberNameParamForUnconsumedLocation_Title"> <source>The CallerMemberNameAttribute will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">CallerMemberNameAttribute non avrà alcun effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_NoEntryPoint"> <source>Program does not contain a static 'Main' method suitable for an entry point</source> <target state="translated">Il programma non contiene un metodo 'Main' statico appropriato per un punto di ingresso</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerIncorrectLength"> <source>An array initializer of length '{0}' is expected</source> <target state="translated">È previsto un inizializzatore di matrice di lunghezza '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerExpected"> <source>A nested array initializer is expected</source> <target state="translated">È previsto un inizializzatore di matrice annidato</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalVarianceSyntax"> <source>Invalid variance modifier. Only interface and delegate type parameters can be specified as variant.</source> <target state="translated">Il modificatore di varianza non è valido. Si possono specificare come varianti solo i parametri di tipo interfaccia o delegato.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedAliasedName"> <source>Unexpected use of an aliased name</source> <target state="translated">Uso imprevisto di un nome con alias</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedGenericName"> <source>Unexpected use of a generic name</source> <target state="translated">Uso imprevisto di un nome generico</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedUnboundGenericName"> <source>Unexpected use of an unbound generic name</source> <target state="translated">Uso imprevisto di un nome generico non associato</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalStatement"> <source>Expressions and statements can only occur in a method body</source> <target state="translated">Espressioni e istruzioni possono essere usate solo in un corpo del metodo</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentForArray"> <source>An array access may not have a named argument specifier</source> <target state="translated">Un accesso a matrice non può includere un identificatore di argomento denominato</target> <note /> </trans-unit> <trans-unit id="ERR_NotYetImplementedInRoslyn"> <source>This language feature ('{0}') is not yet implemented.</source> <target state="translated">Questa funzionalità del linguaggio ('{0}') non è ancora implementata.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueNotAllowed"> <source>Default values are not valid in this context.</source> <target state="translated">I parametri predefiniti non sono validi in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenIcon"> <source>Error opening icon file {0} -- {1}</source> <target state="translated">Si è verificato un errore durante l'apertura del file icona {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenWin32Manifest"> <source>Error opening Win32 manifest file {0} -- {1}</source> <target state="translated">Si è verificato un errore durante l'apertura del file manifesto Win32 {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorBuildingWin32Resources"> <source>Error building Win32 resources -- {0}</source> <target state="translated">Si è verificato un errore durante la compilazione delle risorse Win32 - {0}</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueBeforeRequiredValue"> <source>Optional parameters must appear after all required parameters</source> <target state="translated">I parametri facoltativi devono trovarsi dopo tutti i parametri obbligatori</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitImplCollisionOnRefOut"> <source>Cannot inherit interface '{0}' with the specified type parameters because it causes method '{1}' to contain overloads which differ only on ref and out</source> <target state="translated">Non è possibile ereditare l'interfaccia '{0}' con i parametri di tipo specificato perché in tal caso il metodo '{1}' conterrebbe overload diversi solo in ref e out</target> <note /> </trans-unit> <trans-unit id="ERR_PartialWrongTypeParamsVariance"> <source>Partial declarations of '{0}' must have the same type parameter names and variance modifiers in the same order</source> <target state="translated">Le dichiarazioni parziali di '{0}' devono avere gli stessi nomi di parametro di tipo e modificatori di varianza nello stesso ordine</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedVariance"> <source>Invalid variance: The type parameter '{1}' must be {3} valid on '{0}'. '{1}' is {2}.</source> <target state="translated">Varianza non valida: il parametro di tipo '{1}' deve essere {3} valido in '{0}'. '{1}' è {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_DeriveFromDynamic"> <source>'{0}': cannot derive from the dynamic type</source> <target state="translated">'{0}': non è possibile derivare dal tipo dinamico</target> <note /> </trans-unit> <trans-unit id="ERR_DeriveFromConstructedDynamic"> <source>'{0}': cannot implement a dynamic interface '{1}'</source> <target state="translated">'{0}': non è possibile implementare un'interfaccia dinamica '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicTypeAsBound"> <source>Constraint cannot be the dynamic type</source> <target state="translated">Il vincolo non può essere il tipo dinamico</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructedDynamicTypeAsBound"> <source>Constraint cannot be a dynamic type '{0}'</source> <target state="translated">Il vincolo non può essere un tipo dinamico '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicRequiredTypesMissing"> <source>One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?</source> <target state="translated">Non sono stati trovati uno o più tipi necessari per compilare un'espressione dinamica. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataNameTooLong"> <source>Name '{0}' exceeds the maximum length allowed in metadata.</source> <target state="translated">Il nome '{0}' supera la lunghezza massima consentita nei metadati.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributesNotAllowed"> <source>Attributes are not valid in this context.</source> <target state="translated">Gli attributi non sono validi in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_ExternAliasNotAllowed"> <source>'extern alias' is not valid in this context</source> <target state="translated">'extern alias' non è valido in questo contesto</target> <note /> </trans-unit> <trans-unit id="WRN_IsDynamicIsConfusing"> <source>Using '{0}' to test compatibility with '{1}' is essentially identical to testing compatibility with '{2}' and will succeed for all non-null values</source> <target state="translated">L'uso di '{0}' per la verifica della compatibilità con '{1}' corrisponde in sostanza alla verifica della compatibilità con '{2}' e verrà completato per tutti i valori non Null</target> <note /> </trans-unit> <trans-unit id="WRN_IsDynamicIsConfusing_Title"> <source>Using 'is' to test compatibility with 'dynamic' is essentially identical to testing compatibility with 'Object'</source> <target state="translated">L'uso di 'is' per la verifica della compatibilità con 'dynamic' corrisponde in sostanza alla verifica della compatibilità con 'Object'</target> <note /> </trans-unit> <trans-unit id="ERR_YieldNotAllowedInScript"> <source>Cannot use 'yield' in top-level script code</source> <target state="translated">Non è possibile usare 'yield' nel codice script di primo livello</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAllowedInScript"> <source>Cannot declare namespace in script code</source> <target state="translated">Non è possibile dichiarare lo spazio dei nomi nel codice script</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalAttributesNotAllowed"> <source>Assembly and module attributes are not allowed in this context</source> <target state="translated">Gli attributi di assembly e modulo non sono consentiti in questo contesto</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDelegateType"> <source>Delegate '{0}' has no invoke method or an invoke method with a return type or parameter types that are not supported.</source> <target state="translated">Il delegato '{0}' non ha metodi Invoke oppure ha un metodo Invoke con un tipo restituito o tipi di parametro non supportati.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored"> <source>The entry point of the program is global code; ignoring '{0}' entry point.</source> <target state="translated">Il punto di ingresso del programma è codice globale. Il punto di ingresso '{0}' verrà ignorato.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored_Title"> <source>The entry point of the program is global code; ignoring entry point</source> <target state="translated">Il punto di ingresso del programma è codice globale. Il punto di ingresso verrà ignorato</target> <note /> </trans-unit> <trans-unit id="ERR_BadVisEventType"> <source>Inconsistent accessibility: event type '{1}' is less accessible than event '{0}'</source> <target state="translated">Accessibilità incoerente: il tipo di evento '{1}' è meno accessibile di '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgument"> <source>Named argument specifications must appear after all fixed arguments have been specified. Please use language version {0} or greater to allow non-trailing named arguments.</source> <target state="translated">Le specifiche di argomenti denominati devono trovarsi dopo tutti gli argomenti fissi specificati. Usare la versione {0} o versioni successive del linguaggio per consentire argomenti denominati non finali.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgumentInDynamicInvocation"> <source>Named argument specifications must appear after all fixed arguments have been specified in a dynamic invocation.</source> <target state="translated">In una chiamata dinamica le specifiche di argomenti denominati devono trovarsi dopo tutti gli argomenti fissi specificati.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedArgument"> <source>The best overload for '{0}' does not have a parameter named '{1}'</source> <target state="translated">Il miglior overload per '{0}' non ha un parametro denominato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamedArgumentForDelegateInvoke"> <source>The delegate '{0}' does not have a parameter named '{1}'</source> <target state="translated">Il delegato '{0}' non ha un parametro denominato '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedArgument"> <source>Named argument '{0}' cannot be specified multiple times</source> <target state="translated">Non è possibile specificare più volte l'argomento denominato '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentUsedInPositional"> <source>Named argument '{0}' specifies a parameter for which a positional argument has already been given</source> <target state="translated">L'argomento denominato '{0}' specifica un parametro per il quale è già stato fornito un argomento posizionale</target> <note /> </trans-unit> <trans-unit id="ERR_BadNonTrailingNamedArgument"> <source>Named argument '{0}' is used out-of-position but is followed by an unnamed argument</source> <target state="translated">L'argomento denominato '{0}' viene usato nella posizione errata ma è seguito da un argomento non denominato</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueUsedWithAttributes"> <source>Cannot specify default parameter value in conjunction with DefaultParameterAttribute or OptionalAttribute</source> <target state="translated">Impossibile specificare un valore di parametro predefinito insieme a DefaultParameterAttribute o OptionalAttribute</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueMustBeConstant"> <source>Default parameter value for '{0}' must be a compile-time constant</source> <target state="translated">Il valore di parametro predefinito per '{0}' deve essere una costante in fase di compilazione</target> <note /> </trans-unit> <trans-unit id="ERR_RefOutDefaultValue"> <source>A ref or out parameter cannot have a default value</source> <target state="translated">Un parametro out o ref non può avere un valore predefinito</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForExtensionParameter"> <source>Cannot specify a default value for the 'this' parameter</source> <target state="translated">Impossibile specificare un valore predefinito per il parametro 'this'</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForParamsParameter"> <source>Cannot specify a default value for a parameter array</source> <target state="translated">Impossibile specificare un valore predefinito per una matrice di parametri</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForDefaultParam"> <source>A value of type '{0}' cannot be used as a default parameter because there are no standard conversions to type '{1}'</source> <target state="translated">Non è possibile usare un valore di tipo '{0}' come parametro predefinito. Non sono disponibili conversioni standard nel tipo '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_NoConversionForNubDefaultParam"> <source>A value of type '{0}' cannot be used as default parameter for nullable parameter '{1}' because '{0}' is not a simple type</source> <target state="translated">Non è possibile usare un valore di tipo '{0}' come parametro predefinito per il parametro nullable '{1}' perché '{0}' non è un tipo semplice</target> <note /> </trans-unit> <trans-unit id="ERR_NotNullRefDefaultParameter"> <source>'{0}' is of type '{1}'. A default parameter value of a reference type other than string can only be initialized with null</source> <target state="translated">'{0}' è di tipo '{1}'. Un valore di parametro predefinito di un tipo riferimento non stringa può essere inizializzato solo con Null.</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultValueForUnconsumedLocation"> <source>The default value specified for parameter '{0}' will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">Il valore predefinito specificato per il parametro '{0}' non avrà effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultValueForUnconsumedLocation_Title"> <source>The default value specified will have no effect because it applies to a member that is used in contexts that do not allow optional arguments</source> <target state="translated">Il valore predefinito specificato non avrà effetto perché si applica a un membro usato in contesti che non consentono argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyFileFailure"> <source>Error signing output with public key from file '{0}' -- {1}</source> <target state="translated">Si è verificato un errore durante la firma dell'output con la chiave pubblica del file '{0}' - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyContainerFailure"> <source>Error signing output with public key from container '{0}' -- {1}</source> <target state="translated">Si è verificato un errore durante la firma dell'output con la chiave pubblica del contenitore '{0}' - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicTypeof"> <source>The typeof operator cannot be used on the dynamic type</source> <target state="translated">Non è possibile usare l'operatore typeof nel tipo dinamico</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsDynamicOperation"> <source>An expression tree may not contain a dynamic operation</source> <target state="translated">Un albero delle espressioni non può contenere un'operazione dinamica</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncExpressionTree"> <source>Async lambda expressions cannot be converted to expression trees</source> <target state="translated">Le espressioni lambda asincrone non possono essere convertite in alberi delle espressioni</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicAttributeMissing"> <source>Cannot define a class or member that utilizes 'dynamic' because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Non è possibile definire una classe o un membro che usa 'dynamic' perché non è stato trovato il tipo '{0}' richiesto dal compilatore. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotPassNullForFriendAssembly"> <source>Cannot pass null for friend assembly name</source> <target state="translated">Non è possibile passare Null per il nome assembly Friend</target> <note /> </trans-unit> <trans-unit id="ERR_SignButNoPrivateKey"> <source>Key file '{0}' is missing the private key needed for signing</source> <target state="translated">Nel file di chiave '{0}' manca la chiave privata necessaria per la firma</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignButNoKey"> <source>Public signing was specified and requires a public key, but no public key was specified.</source> <target state="translated">È stata specificata la firma pubblica per la quale è necessaria una chiave pubblica, che però non è stata specificata.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNetModule"> <source>Public signing is not supported for netmodules.</source> <target state="translated">La firma pubblica non è supportata per gli elementi netmodule.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">È stata specificata la firma ritardata per la quale è necessaria una chiave pubblica che però non è stata specificata</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey_Title"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">È stata specificata la firma ritardata per la quale è necessaria una chiave pubblica che però non è stata specificata</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat"> <source>The specified version string does not conform to the required format - major[.minor[.build[.revision]]]</source> <target state="translated">La stringa di versione specificata non è conforme al formato richiesto: principale[.secondaria[.build[.revisione]]]</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormatDeterministic"> <source>The specified version string contains wildcards, which are not compatible with determinism. Either remove wildcards from the version string, or disable determinism for this compilation</source> <target state="translated">La stringa di versione specificata contiene caratteri jolly e questo non è compatibile con il determinismo. Rimuovere i caratteri jolly dalla stringa di versione o disabilitare il determinismo per questa compilazione</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat2"> <source>The specified version string does not conform to the required format - major.minor.build.revision (without wildcards)</source> <target state="translated">La stringa di versione specificata non è conforme al formato richiesto: principale.secondaria.build.revisione (senza caratteri jolly)</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">La stringa di versione specificata non è conforme al formato consigliato: principale.secondaria.build.revisione</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat_Title"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">La stringa di versione specificata non è conforme al formato consigliato: principale.secondaria.build.revisione</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCultureForExe"> <source>Executables cannot be satellite assemblies; culture should always be empty</source> <target state="translated">I file eseguibili non possono essere assembly satellite. Il campo relativo alle impostazioni cultura deve essere sempre vuoto</target> <note /> </trans-unit> <trans-unit id="ERR_NoCorrespondingArgument"> <source>There is no argument given that corresponds to the required formal parameter '{0}' of '{1}'</source> <target state="translated">Non sono stati specificati argomenti corrispondenti al parametro formale obbligatorio '{0}' di '{1}'</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch"> <source>The command line switch '{0}' is not yet implemented and was ignored.</source> <target state="translated">L'opzione '{0}' della riga di comando non è ancora implementata ed è stata ignorata.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch_Title"> <source>Command line switch is not yet implemented</source> <target state="translated">L'opzione della riga di comando non è ancora implementata</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleEmitFailure"> <source>Failed to emit module '{0}': {1}</source> <target state="translated">Non è stato possibile creare il modulo '{0}': {1}</target> <note /> </trans-unit> <trans-unit id="ERR_FixedLocalInLambda"> <source>Cannot use fixed local '{0}' inside an anonymous method, lambda expression, or query expression</source> <target state="translated">Non è possibile usare la variabile locale fissa '{0}' in un metodo anonimo, in un'espressione lambda o in un'espressione di query</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsNamedArgument"> <source>An expression tree may not contain a named argument specification</source> <target state="translated">L'albero delle espressioni non può contenere una specifica di argomento denominato</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsOptionalArgument"> <source>An expression tree may not contain a call or invocation that uses optional arguments</source> <target state="translated">Un albero delle espressioni non può contenere una chiamata che usa argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsIndexedProperty"> <source>An expression tree may not contain an indexed property</source> <target state="translated">L'albero delle espressioni non può contenere una proprietà indicizzata</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedPropertyRequiresParams"> <source>Indexed property '{0}' has non-optional arguments which must be provided</source> <target state="translated">La proprietà indicizzata '{0}' include argomenti non facoltativi che devono essere specificati</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedPropertyMustHaveAllOptionalParams"> <source>Indexed property '{0}' must have all arguments optional</source> <target state="translated">La proprietà indicizzata '{0}' deve includere tutti argomenti facoltativi</target> <note /> </trans-unit> <trans-unit id="ERR_SpecialByRefInLambda"> <source>Instance of type '{0}' cannot be used inside a nested function, query expression, iterator block or async method</source> <target state="translated">L'istanza di tipo '{0}' non può essere usata all'interno di una funzione annidata, un'espressione di query, un blocco iteratore o un metodo asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeMissingAction"> <source>First argument to a security attribute must be a valid SecurityAction</source> <target state="translated">Il primo argomento di un attributo di sicurezza deve essere un elemento SecurityAction valido</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidAction"> <source>Security attribute '{0}' has an invalid SecurityAction value '{1}'</source> <target state="translated">L'attributo di sicurezza '{0}' ha un valore SecurityAction '{1}' non valido</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionAssembly"> <source>SecurityAction value '{0}' is invalid for security attributes applied to an assembly</source> <target state="translated">Il valore '{0}' di SecurityAction non è valido per gli attributi di sicurezza applicati a un assembly</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionTypeOrMethod"> <source>SecurityAction value '{0}' is invalid for security attributes applied to a type or a method</source> <target state="translated">Il valore '{0}' di SecurityAction non è valido per gli attributi di sicurezza applicati a un tipo o a un metodo</target> <note /> </trans-unit> <trans-unit id="ERR_PrincipalPermissionInvalidAction"> <source>SecurityAction value '{0}' is invalid for PrincipalPermission attribute</source> <target state="translated">Il valore '{0}' di SecurityAction non è valido per l'attributo PrincipalPermission</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotValidInExpressionTree"> <source>An expression tree may not contain '{0}'</source> <target state="translated">Un albero delle espressioni non può contenere '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeInvalidFile"> <source>Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute</source> <target state="translated">Non è possibile risolvere il percorso del file '{0}' specificato per l'argomento denominato '{1}' per l'attributo PermissionSet</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeFileReadError"> <source>Error reading file '{0}' specified for the named argument '{1}' for PermissionSet attribute: '{2}'</source> <target state="translated">Si è verificato un errore durante la lettura del file '{0}' specificato per l'argomento denominato '{1}' per l'attributo PermissionSet: '{2}'</target> <note /> </trans-unit> <trans-unit id="ERR_GlobalSingleTypeNameNotFoundFwd"> <source>The type name '{0}' could not be found in the global namespace. This type has been forwarded to assembly '{1}' Consider adding a reference to that assembly.</source> <target state="translated">Il nome di tipo '{0}' non è stato trovato nello spazio dei nomi globale. Il tipo è stato inoltrato all'assembly '{1}'. Provare ad aggiungere un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_DottedTypeNameNotFoundInNSFwd"> <source>The type name '{0}' could not be found in the namespace '{1}'. This type has been forwarded to assembly '{2}' Consider adding a reference to that assembly.</source> <target state="translated">Il nome di tipo '{0}' non è stato trovato nello spazio dei nomi '{1}'. Il tipo è stato inoltrato all'assembly '{2}'. Provare ad aggiungere un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleTypeNameNotFoundFwd"> <source>The type name '{0}' could not be found. This type has been forwarded to assembly '{1}'. Consider adding a reference to that assembly.</source> <target state="translated">Il nome di tipo '{0}' non è stato trovato. Il tipo è stato inoltrato all'assembly '{1}'. Provare ad aggiungere un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_AssemblySpecifiedForLinkAndRef"> <source>Assemblies '{0}' and '{1}' refer to the same metadata but only one is a linked reference (specified using /link option); consider removing one of the references.</source> <target state="translated">Gli assembly '{0}' e '{1}' fanno riferimento agli stessi metadati ma solo uno è un riferimento collegato (specificato con l'opzione /link). Provare a rimuovere uno dei riferimenti.</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAdd"> <source>The best overloaded Add method '{0}' for the collection initializer element is obsolete.</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'elemento inizializzatore di raccolta è obsoleto.</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAdd_Title"> <source>The best overloaded Add method for the collection initializer element is obsolete</source> <target state="translated">Il miglior metodo Add di overload per l'elemento inizializzatore di raccolta è obsoleto</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAddStr"> <source>The best overloaded Add method '{0}' for the collection initializer element is obsolete. {1}</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'elemento inizializzatore di raccolta è obsoleto. {1}</target> <note /> </trans-unit> <trans-unit id="WRN_DeprecatedCollectionInitAddStr_Title"> <source>The best overloaded Add method for the collection initializer element is obsolete</source> <target state="translated">Il miglior metodo Add di overload per l'elemento inizializzatore di raccolta è obsoleto</target> <note /> </trans-unit> <trans-unit id="ERR_DeprecatedCollectionInitAddStr"> <source>The best overloaded Add method '{0}' for the collection initializer element is obsolete. {1}</source> <target state="translated">Il miglior metodo Add di overload '{0}' per l'elemento inizializzatore di raccolta è obsoleto. {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidTarget"> <source>Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.</source> <target state="translated">L'attributo di sicurezza '{0}' non è valido in questo tipo di dichiarazione. Gli attributi di sicurezza sono validi solo in dichiarazioni di metodo, assembly e tipi.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicMethodArg"> <source>Cannot use an expression of type '{0}' as an argument to a dynamically dispatched operation.</source> <target state="translated">Non è possibile usare un'espressione di tipo '{0}' come argomento per un'operazione inviata dinamicamente.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicMethodArgLambda"> <source>Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type.</source> <target state="translated">Non è possibile usare un'espressione lambda come argomento per un'operazione inviata dinamicamente senza prima eseguire il cast a un tipo di albero delle espressioni o di delegato.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicMethodArgMemgrp"> <source>Cannot use a method group as an argument to a dynamically dispatched operation. Did you intend to invoke the method?</source> <target state="translated">Non è possibile usare un metodo di gruppo come argomento per un'operazione inviata dinamicamente. Si intendeva richiamare il metodo?</target> <note /> </trans-unit> <trans-unit id="ERR_NoDynamicPhantomOnBase"> <source>The call to method '{0}' needs to be dynamically dispatched, but cannot be because it is part of a base access expression. Consider casting the dynamic arguments or eliminating the base access.</source> <target state="translated">Non è possibile eseguire l'invio dinamico richiesto della chiamata al metodo '{0}' perché fa parte di un'espressione di accesso di base. Provare a eseguire il cast degli argomenti dinamici o a eliminare l'accesso di base.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDynamicQuery"> <source>Query expressions over source type 'dynamic' or with a join sequence of type 'dynamic' are not allowed</source> <target state="translated">Non sono consentite espressioni di query sul tipo di origine 'dynamic' o con una sequenza di join di tipo 'dynamic'</target> <note /> </trans-unit> <trans-unit id="ERR_NoDynamicPhantomOnBaseIndexer"> <source>The indexer access needs to be dynamically dispatched, but cannot be because it is part of a base access expression. Consider casting the dynamic arguments or eliminating the base access.</source> <target state="translated">L'accesso all'indicizzatore deve essere inviato dinamicamente. Tuttavia, non è possibile perché fa parte di un'espressione di accesso di base. Provare a eseguire il cast degli argomenti dinamici o a eliminare l'accesso di base.</target> <note /> </trans-unit> <trans-unit id="WRN_DynamicDispatchToConditionalMethod"> <source>The dynamically dispatched call to method '{0}' may fail at runtime because one or more applicable overloads are conditional methods.</source> <target state="translated">La chiamata al metodo '{0}' inviata in modo dinamico potrebbe non riuscire in fase di esecuzione perché uno o più overload applicabili sono metodi condizionali.</target> <note /> </trans-unit> <trans-unit id="WRN_DynamicDispatchToConditionalMethod_Title"> <source>Dynamically dispatched call may fail at runtime because one or more applicable overloads are conditional methods</source> <target state="translated">La chiamata inviata in modo dinamico potrebbe non riuscire in fase di esecuzione perché uno o più overload applicabili sono metodi condizionali</target> <note /> </trans-unit> <trans-unit id="ERR_BadArgTypeDynamicExtension"> <source>'{0}' has no applicable method named '{1}' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.</source> <target state="translated">'{0}' non contiene alcun metodo applicabile denominato '{1}' ma apparentemente include un metodo di estensione con tale nome. I metodi di estensione non possono essere inviati dinamicamente. Provare a eseguire il cast degli argomenti dinamici o a chiamare il metodo di estensione senza la relativa sintassi.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerMemberName"> <source>The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerFilePathAttribute.</source> <target state="translated">CallerMemberNameAttribute applicato al parametro '{0}' non avrà alcun effetto. CallerFilePathAttribute ne eseguirà l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerFilePathPreferredOverCallerMemberName_Title"> <source>The CallerMemberNameAttribute will have no effect; it is overridden by the CallerFilePathAttribute</source> <target state="translated">CallerMemberNameAttribute non avrà alcun effetto. CallerFilePathAttribute ne eseguirà l'override</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerMemberName"> <source>The CallerMemberNameAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</source> <target state="translated">CallerMemberNameAttribute applicato al parametro '{0}' non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerMemberName_Title"> <source>The CallerMemberNameAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</source> <target state="translated">CallerMemberNameAttribute non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerFilePath"> <source>The CallerFilePathAttribute applied to parameter '{0}' will have no effect. It is overridden by the CallerLineNumberAttribute.</source> <target state="translated">CallerFilePathAttribute applicato al parametro '{0}' non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerLineNumberPreferredOverCallerFilePath_Title"> <source>The CallerFilePathAttribute will have no effect; it is overridden by the CallerLineNumberAttribute</source> <target state="translated">CallerFilePathAttribute non avrà alcun effetto. CallerLineNumberAttribute ne eseguirà l'override</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDynamicCondition"> <source>Expression must be implicitly convertible to Boolean or its type '{0}' must define operator '{1}'.</source> <target state="translated">L'espressione deve essere convertibile in modo implicito in un valore booleano oppure il relativo tipo '{0}' deve definire l'operatore '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MixingWinRTEventWithRegular"> <source>'{0}' cannot implement '{1}' because '{2}' is a Windows Runtime event and '{3}' is a regular .NET event.</source> <target state="translated">'{0}' non può implementare '{1}' perché '{2}' è un evento Windows Runtime e '{3}' è un evento .NET normale.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope1"> <source>Call System.IDisposable.Dispose() on allocated instance of {0} before all references to it are out of scope.</source> <target state="translated">Chiamare System.IDisposable.Dispose() sull'istanza allocata di {0} prima che tutti i relativi riferimenti siano esterni all'ambito.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope1_Title"> <source>Call System.IDisposable.Dispose() on allocated instance before all references to it are out of scope</source> <target state="translated">Chiamare System.IDisposable.Dispose() sull'istanza allocata prima che tutti i relativi riferimenti siano esterni all'ambito</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope2"> <source>Allocated instance of {0} is not disposed along all exception paths. Call System.IDisposable.Dispose() before all references to it are out of scope.</source> <target state="translated">L'istanza allocata di {0} non è stata eliminata in tutti i percorsi delle eccezioni. Chiamare System.IDisposable.Dispose() prima che tutti i relativi riferimenti siano esterni all'ambito.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2000_DisposeObjectsBeforeLosingScope2_Title"> <source>Allocated instance is not disposed along all exception paths</source> <target state="translated">L'istanza allocata non è stata eliminata in tutti i percorsi delle eccezioni</target> <note /> </trans-unit> <trans-unit id="WRN_CA2202_DoNotDisposeObjectsMultipleTimes"> <source>Object '{0}' can be disposed more than once.</source> <target state="translated">L'oggetto '{0}' non può essere eliminato più di una volta.</target> <note /> </trans-unit> <trans-unit id="WRN_CA2202_DoNotDisposeObjectsMultipleTimes_Title"> <source>Object can be disposed more than once</source> <target state="translated">L'oggetto non può essere eliminato più di una volta</target> <note /> </trans-unit> <trans-unit id="ERR_NewCoClassOnLink"> <source>Interop type '{0}' cannot be embedded. Use the applicable interface instead.</source> <target state="translated">Non è possibile incorporare il tipo di interoperabilità '{0}'. Usare l'interfaccia applicabile.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIANestedType"> <source>Type '{0}' cannot be embedded because it is a nested type. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché è un tipo annidato. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericsUsedInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a generic argument. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo '{0}' perché contiene un argomento generico. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropStructContainsMethods"> <source>Embedded interop struct '{0}' can contain only public instance fields.</source> <target state="translated">Lo struct di interoperabilità incorporato '{0}' può contenere solo campi di istanza pubblici.</target> <note /> </trans-unit> <trans-unit id="ERR_WinRtEventPassedByRef"> <source>A Windows Runtime event may not be passed as an out or ref parameter.</source> <target state="translated">Un evento Windows Runtime non può essere passato come parametro out o ref.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingMethodOnSourceInterface"> <source>Source interface '{0}' is missing method '{1}' which is required to embed event '{2}'.</source> <target state="translated">Nell'interfaccia di origine '{0}' manca il metodo '{1}' necessario per incorporare l'evento '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingSourceInterface"> <source>Interface '{0}' has an invalid source interface which is required to embed event '{1}'.</source> <target state="translated">L'interfaccia '{0}' contiene un'interfaccia di origine non valida che è necessaria per incorporare l'evento '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropTypeMissingAttribute"> <source>Interop type '{0}' cannot be embedded because it is missing the required '{1}' attribute.</source> <target state="translated">Non è possibile incorporare il tipo di interoperabilità '{0}' perché manca l'attributo obbligatorio '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAssemblyMissingAttribute"> <source>Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute.</source> <target state="translated">Non è possibile incorporare i tipi di interoperabilità dall'assembly '{0}' perché manca l'attributo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAssemblyMissingAttributes"> <source>Cannot embed interop types from assembly '{0}' because it is missing either the '{1}' attribute or the '{2}' attribute.</source> <target state="translated">Non è possibile incorporare i tipi di interoperabilità dall'assembly '{0}' perché manca l'attributo '{1}' o '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropTypesWithSameNameAndGuid"> <source>Cannot embed interop type '{0}' found in both assembly '{1}' and '{2}'. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Non è possibile incorporare il tipo di interoperabilità '{0}' trovato negli assembly '{1}' e '{2}'. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su False.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalTypeNameClash"> <source>Embedding the interop type '{0}' from assembly '{1}' causes a name clash in the current assembly. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">L'incorporamento del tipo di interoperabilità '{0}' dall'assembly '{1}' causa un conflitto di nomi nell'assembly corrente. Provare a impostare la proprietà 'Incorpora tipi di interoperabilità' su false.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyReferencesLinkedPIA"> <source>A reference was created to embedded interop assembly '{0}' because of an indirect reference to that assembly created by assembly '{1}'. Consider changing the 'Embed Interop Types' property on either assembly.</source> <target state="translated">È stato creato un riferimento all'assembly di interoperabilità '{0}' incorporato a causa di un riferimento indiretto a tale assembly creato dall'assembly '{1}'. Provare a modificare la proprietà 'Incorpora tipi di interoperabilità' in uno degli assembly.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyReferencesLinkedPIA_Title"> <source>A reference was created to embedded interop assembly because of an indirect assembly reference</source> <target state="translated">È stato creato un riferimento all'assembly di interoperabilità incorporato a causa di un riferimento indiretto a tale assembly</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyReferencesLinkedPIA_Description"> <source>You have added a reference to an assembly using /link (Embed Interop Types property set to True). This instructs the compiler to embed interop type information from that assembly. However, the compiler cannot embed interop type information from that assembly because another assembly that you have referenced also references that assembly using /reference (Embed Interop Types property set to False). To embed interop type information for both assemblies, use /link for references to each assembly (set the Embed Interop Types property to True). To remove the warning, you can use /reference instead (set the Embed Interop Types property to False). In this case, a primary interop assembly (PIA) provides interop type information.</source> <target state="translated">Per aggiungere un riferimento a un assembly, è stato usato /link (proprietà Incorpora tipi di interoperabilità impostata su True). Questo parametro indica al compilatore di incorporare le informazioni sui tipi di interoperabilità da tale assembly. Il compilatore non è però in grado di incorporare tali informazioni dall'assembly perché anche un altro assembly a cui viene fatto riferimento fa riferimento a tale assembly tramite /reference (proprietà Incorpora tipi di interoperabilità impostata su False). Per incorporare le informazioni sui tipi di interoperabilità per entrambi gli assembly, usare /link per i riferimenti ai singoli assembly (impostare la proprietà Incorpora tipi di interoperabilità su True). Per rimuovere l'avviso, è invece possibile usare /reference (impostare la proprietà Incorpora tipi di interoperabilità su False). In questo caso, le informazioni sui tipi di interoperabilità verranno fornite da un assembly di interoperabilità primario.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericsUsedAcrossAssemblies"> <source>Type '{0}' from assembly '{1}' cannot be used across assembly boundaries because it has a generic type argument that is an embedded interop type.</source> <target state="translated">Non è possibile usare il tipo '{0}' dell'assembly '{1}' tra limiti di assembly perché contiene un argomento tipo generico che corrisponde a un tipo di interoperabilità incorporato.</target> <note /> </trans-unit> <trans-unit id="ERR_NoCanonicalView"> <source>Cannot find the interop type that matches the embedded interop type '{0}'. Are you missing an assembly reference?</source> <target state="translated">Il tipo di interoperabilità corrispondente al tipo di interoperabilità incorporato '{0}' non è stato trovato. Probabilmente manca un riferimento all'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMismatch"> <source>Module name '{0}' stored in '{1}' must match its filename.</source> <target state="translated">Il nome modulo '{0}' memorizzato in '{1}' deve corrispondere al relativo nome di file.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleName"> <source>Invalid module name: {0}</source> <target state="translated">Nome di modulo non valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadCompilationOptionValue"> <source>Invalid '{0}' value: '{1}'.</source> <target state="translated">Il valore di '{0}' non è valido: '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAppConfigPath"> <source>AppConfigPath must be absolute.</source> <target state="translated">AppConfigPath deve essere assoluto.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden"> <source>Attribute '{0}' from module '{1}' will be ignored in favor of the instance appearing in source</source> <target state="translated">L'attributo '{0}' del modulo '{1}' verrà ignorato e verrà usata l'istanza presente nell'origine</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden_Title"> <source>Attribute will be ignored in favor of the instance appearing in source</source> <target state="translated">L'attributo verrà ignorato e verrà usata l'istanza presente nell'origine</target> <note /> </trans-unit> <trans-unit id="ERR_CmdOptionConflictsSource"> <source>Attribute '{0}' given in a source file conflicts with option '{1}'.</source> <target state="translated">L'attributo '{0}' specificato in un file di origine è in conflitto con l'opzione '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FixedBufferTooManyDimensions"> <source>A fixed buffer may only have one dimension.</source> <target state="translated">Un buffer fisso può avere una sola dimensione.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName"> <source>Referenced assembly '{0}' does not have a strong name.</source> <target state="translated">L'assembly '{0}' al quale si fa riferimento non ha un nome sicuro.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName_Title"> <source>Referenced assembly does not have a strong name</source> <target state="translated">L'assembly di riferimento non ha un nome sicuro</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSignaturePublicKey"> <source>Invalid signature public key specified in AssemblySignatureKeyAttribute.</source> <target state="translated">La chiave pubblica di firma specificata in AssemblySignatureKeyAttribute non è valida.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypeConflictsWithDeclaration"> <source>Type '{0}' exported from module '{1}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Il tipo '{0}' esportato dal modulo '{1}' è in conflitto con il tipo dichiarato nel modulo primario di questo assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypesConflict"> <source>Type '{0}' exported from module '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Il tipo '{0}' esportato dal modulo '{1}' è in conflitto con il tipo '{2}' esportato dal modulo '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithDeclaration"> <source>Forwarded type '{0}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Il tipo inoltrato '{0}' è in conflitto con il tipo dichiarato nel modulo primario di questo assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypesConflict"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' forwarded to assembly '{3}'.</source> <target state="translated">Il tipo '{0}' inoltrato all'assembly '{1}' è in conflitto con il tipo '{2}' inoltrato all'assembly '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithExportedType"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Il tipo '{0}' inoltrato all'assembly '{1}' è in conflitto con il tipo '{2}' esportato dal modulo '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch"> <source>Referenced assembly '{0}' has different culture setting of '{1}'.</source> <target state="translated">Le impostazioni cultura dell'assembly '{0}' al quale si fa riferimento sono diverse da '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch_Title"> <source>Referenced assembly has different culture setting</source> <target state="translated">Le impostazioni cultura dell'assembly di riferimento sono diverse</target> <note /> </trans-unit> <trans-unit id="ERR_AgnosticToMachineModule"> <source>Agnostic assembly cannot have a processor specific module '{0}'.</source> <target state="translated">Un assembly agnostico non può avere un modulo '{0}' specifico del processore.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingMachineModule"> <source>Assembly and module '{0}' cannot target different processors.</source> <target state="translated">L'assembly e il modulo '{0}' non possono essere destinati a processori diversi.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly"> <source>Referenced assembly '{0}' targets a different processor.</source> <target state="translated">L'assembly '{0}' a cui si fa riferimento ha come destinazione un processore diverso.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly_Title"> <source>Referenced assembly targets a different processor</source> <target state="translated">L'assembly di riferimento ha come destinazione un processore diverso</target> <note /> </trans-unit> <trans-unit id="ERR_CryptoHashFailed"> <source>Cryptographic failure while creating hashes.</source> <target state="translated">Si è verificato un errore di crittografia durante la creazione di hash.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNetModuleReference"> <source>Reference to '{0}' netmodule missing.</source> <target state="translated">Manca il riferimento al netmodule '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMustBeUnique"> <source>Module '{0}' is already defined in this assembly. Each module must have a unique filename.</source> <target state="translated">Il modulo '{0}' è già definito in questo assembly. Ogni modulo deve avere un nome di file univoco.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadConfigFile"> <source>Cannot read config file '{0}' -- '{1}'</source> <target state="translated">Non è possibile leggere il file di configurazione '{0}' - '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_EncNoPIAReference"> <source>Cannot continue since the edit includes a reference to an embedded type: '{0}'.</source> <target state="translated">Non è possibile continuare perché la modifica include un riferimento a un tipo incorporato: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EncReferenceToAddedMember"> <source>Member '{0}' added during the current debug session can only be accessed from within its declaring assembly '{1}'.</source> <target state="translated">Il membro '{0}' aggiunto durante la sessione di debug corrente è accessibile solo dall'interno dell'assembly '{1}' in cui viene dichiarato.</target> <note /> </trans-unit> <trans-unit id="ERR_MutuallyExclusiveOptions"> <source>Compilation options '{0}' and '{1}' can't both be specified at the same time.</source> <target state="translated">Non è possibile specificare contemporaneamente le opzioni di compilazione '{0}' e '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LinkedNetmoduleMetadataMustProvideFullPEImage"> <source>Linked netmodule metadata must provide a full PE image: '{0}'.</source> <target state="translated">I metadati del netmodule collegato devono fornire un'immagine PE completa: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPrefer32OnLib"> <source>/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe</source> <target state="translated">/platform:anycpu32bitpreferred può essere usato solo con /t:exe, /t:winexe e /t:appcontainerexe</target> <note /> </trans-unit> <trans-unit id="IDS_PathList"> <source>&lt;path list&gt;</source> <target state="translated">&lt;elenco percorsi&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_Text"> <source>&lt;text&gt;</source> <target state="translated">&lt;testo&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNullPropagatingOperator"> <source>null propagating operator</source> <target state="translated">operatore di propagazione Null</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedMethod"> <source>expression-bodied method</source> <target state="translated">metodo con corpo di espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedProperty"> <source>expression-bodied property</source> <target state="translated">proprietà con corpo di espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureExpressionBodiedIndexer"> <source>expression-bodied indexer</source> <target state="translated">indicizzatore con corpo di espressione</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAutoPropertyInitializer"> <source>auto property initializer</source> <target state="translated">inizializzatore di proprietà automatica</target> <note /> </trans-unit> <trans-unit id="IDS_Namespace1"> <source>&lt;namespace&gt;</source> <target state="translated">&lt;spazio dei nomi&gt;</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefLocalsReturns"> <source>byref locals and returns</source> <target state="translated">variabili locali e valori restituiti per riferimento</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureReadOnlyReferences"> <source>readonly references</source> <target state="translated">riferimenti di sola lettura</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefStructs"> <source>ref structs</source> <target state="translated">struct ref</target> <note /> </trans-unit> <trans-unit id="CompilationC"> <source>Compilation (C#): </source> <target state="translated">Compilazione (C#): </target> <note /> </trans-unit> <trans-unit id="SyntaxNodeIsNotWithinSynt"> <source>Syntax node is not within syntax tree</source> <target state="translated">Il nodo Syntax non è compreso nell'albero della sintassi</target> <note /> </trans-unit> <trans-unit id="LocationMustBeProvided"> <source>Location must be provided in order to provide minimal type qualification.</source> <target state="translated">Per offrire una qualifica minima del tipo, è necessario specificare Position.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeSemanticModelMust"> <source>SyntaxTreeSemanticModel must be provided in order to provide minimal type qualification.</source> <target state="translated">Per offrire una qualifica minima del tipo, è necessario specificare SyntaxTreeSemanticModel.</target> <note /> </trans-unit> <trans-unit id="CantReferenceCompilationOf"> <source>Can't reference compilation of type '{0}' from {1} compilation.</source> <target state="translated">Non è possibile fare riferimento alla compilazione di tipo '{0}' dalla compilazione di {1}.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeAlreadyPresent"> <source>Syntax tree already present</source> <target state="translated">L'albero della sintassi è già presente</target> <note /> </trans-unit> <trans-unit id="SubmissionCanOnlyInclude"> <source>Submission can only include script code.</source> <target state="translated">L'invio può includere solo codice script.</target> <note /> </trans-unit> <trans-unit id="SubmissionCanHaveAtMostOne"> <source>Submission can have at most one syntax tree.</source> <target state="translated">L'invio può avere al massimo un albero della sintassi.</target> <note /> </trans-unit> <trans-unit id="TreeMustHaveARootNodeWith"> <source>tree must have a root node with SyntaxKind.CompilationUnit</source> <target state="translated">l'albero deve avere un nodo radice con SyntaxKind.CompilationUnit</target> <note /> </trans-unit> <trans-unit id="TypeArgumentCannotBeNull"> <source>Type argument cannot be null</source> <target state="translated">L'argomento di tipo non può essere Null</target> <note /> </trans-unit> <trans-unit id="WrongNumberOfTypeArguments"> <source>Wrong number of type arguments</source> <target state="translated">Il numero di argomenti di tipo è errato</target> <note /> </trans-unit> <trans-unit id="NameConflictForName"> <source>Name conflict for name {0}</source> <target state="translated">Conflitto tra nomi per il nome {0}</target> <note /> </trans-unit> <trans-unit id="LookupOptionsHasInvalidCombo"> <source>LookupOptions has an invalid combination of options</source> <target state="translated">LookupOptions contiene una combinazione di opzioni non valida</target> <note /> </trans-unit> <trans-unit id="ItemsMustBeNonEmpty"> <source>items: must be non-empty</source> <target state="translated">elementi: non deve essere vuoto</target> <note /> </trans-unit> <trans-unit id="UseVerbatimIdentifier"> <source>Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Identifier or Microsoft.CodeAnalysis.CSharp.SyntaxFactory.VerbatimIdentifier to create identifier tokens.</source> <target state="translated">Usare Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Identifier o Microsoft.CodeAnalysis.CSharp.SyntaxFactory.VerbatimIdentifier per creare token di identificatore.</target> <note /> </trans-unit> <trans-unit id="UseLiteralForTokens"> <source>Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal to create character literal tokens.</source> <target state="translated">Usare Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal per creare token letterali di tipo carattere.</target> <note /> </trans-unit> <trans-unit id="UseLiteralForNumeric"> <source>Use Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal to create numeric literal tokens.</source> <target state="translated">Usare Microsoft.CodeAnalysis.CSharp.SyntaxFactory.Literal per creare token letterali di tipo numerico.</target> <note /> </trans-unit> <trans-unit id="ThisMethodCanOnlyBeUsedToCreateTokens"> <source>This method can only be used to create tokens - {0} is not a token kind.</source> <target state="translated">Questo metodo può essere usato solo per creare token - {0} non è un tipo di token.</target> <note /> </trans-unit> <trans-unit id="GenericParameterDefinition"> <source>Generic parameter is definition when expected to be reference {0}</source> <target state="translated">Il parametro generico corrisponde alla definizione mentre dovrebbe essere il riferimento {0}</target> <note /> </trans-unit> <trans-unit id="InvalidGetDeclarationNameMultipleDeclarators"> <source>Called GetDeclarationName for a declaration node that can possibly contain multiple variable declarators.</source> <target state="translated">È stato chiamato GetDeclarationName per un nodo di dichiarazione che può contenere più dichiarazioni di variabile.</target> <note /> </trans-unit> <trans-unit id="TreeNotPartOfCompilation"> <source>tree not part of compilation</source> <target state="translated">l'albero non fa parte della compilazione</target> <note /> </trans-unit> <trans-unit id="PositionIsNotWithinSyntax"> <source>Position is not within syntax tree with full span {0}</source> <target state="translated">Position non è compreso nell'albero della sintassi con full span {0}</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang"> <source>The language name '{0}' is invalid.</source> <target state="translated">Il nome del linguaggio '{0}' non è valido.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang_Title"> <source>The language name is invalid</source> <target state="translated">Il nome del linguaggio non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedTransparentIdentifierAccess"> <source>Transparent identifier member access failed for field '{0}' of '{1}'. Does the data being queried implement the query pattern?</source> <target state="translated">L'accesso al membro identificatore trasparente non è riuscito per il campo '{0}' di '{1}'. I dati su cui eseguire la query implementano il modello di query?</target> <note /> </trans-unit> <trans-unit id="ERR_ParamDefaultValueDiffersFromAttribute"> <source>The parameter has multiple distinct default values.</source> <target state="translated">Il parametro ha più valori predefiniti distinct.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldHasMultipleDistinctConstantValues"> <source>The field has multiple distinct constant values.</source> <target state="translated">Il campo ha più valori costanti distinct.</target> <note /> </trans-unit> <trans-unit id="WRN_UnqualifiedNestedTypeInCref"> <source>Within cref attributes, nested types of generic types should be qualified.</source> <target state="translated">Negli attributi cref è necessario qualificare i tipi annidati di tipi generici.</target> <note /> </trans-unit> <trans-unit id="WRN_UnqualifiedNestedTypeInCref_Title"> <source>Within cref attributes, nested types of generic types should be qualified</source> <target state="translated">Negli attributi cref è necessario qualificare i tipi annidati di tipi generici</target> <note /> </trans-unit> <trans-unit id="NotACSharpSymbol"> <source>Not a C# symbol.</source> <target state="translated">Non è un simbolo di C#.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedUsingDirective"> <source>Unnecessary using directive.</source> <target state="translated">Direttiva Using non necessaria.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedExternAlias"> <source>Unused extern alias.</source> <target state="translated">Alias extern non usato.</target> <note /> </trans-unit> <trans-unit id="ElementsCannotBeNull"> <source>Elements cannot be null.</source> <target state="translated">Gli elementi non possono essere Null.</target> <note /> </trans-unit> <trans-unit id="IDS_LIB_ENV"> <source>LIB environment variable</source> <target state="translated">variabile di ambiente LIB</target> <note /> </trans-unit> <trans-unit id="IDS_LIB_OPTION"> <source>/LIB option</source> <target state="translated">opzione /LIB</target> <note /> </trans-unit> <trans-unit id="IDS_REFERENCEPATH_OPTION"> <source>/REFERENCEPATH option</source> <target state="translated">opzione /REFERENCEPATH</target> <note /> </trans-unit> <trans-unit id="IDS_DirectoryDoesNotExist"> <source>directory does not exist</source> <target state="translated">la directory non esiste</target> <note /> </trans-unit> <trans-unit id="IDS_DirectoryHasInvalidPath"> <source>path is too long or invalid</source> <target state="translated">il percorso è troppo lungo o non è valido</target> <note /> </trans-unit> <trans-unit id="WRN_NoRuntimeMetadataVersion"> <source>No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.</source> <target state="translated">Non è stato trovato un valore per RuntimeMetadataVersion. Non è presente un assembly che contiene System.Object oppure tramite le opzioni non è stato specificato un valore per RuntimeMetadataVersion.</target> <note /> </trans-unit> <trans-unit id="WRN_NoRuntimeMetadataVersion_Title"> <source>No value for RuntimeMetadataVersion found</source> <target state="translated">Non sono stati trovati valori per RuntimeMetadataVersion</target> <note /> </trans-unit> <trans-unit id="WrongSemanticModelType"> <source>Expected a {0} SemanticModel.</source> <target state="translated">È previsto un elemento SemanticModel {0}.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLambda"> <source>lambda expression</source> <target state="translated">espressione lambda</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion1"> <source>Feature '{0}' is not available in C# 1. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 1. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion2"> <source>Feature '{0}' is not available in C# 2. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 2. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion3"> <source>Feature '{0}' is not available in C# 3. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 3. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion4"> <source>Feature '{0}' is not available in C# 4. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 4. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion5"> <source>Feature '{0}' is not available in C# 5. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 5. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion6"> <source>Feature '{0}' is not available in C# 6. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 6. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7"> <source>Feature '{0}' is not available in C# 7.0. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 7.0. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="IDS_VersionExperimental"> <source>'experimental'</source> <target state="translated">'experimental'</target> <note /> </trans-unit> <trans-unit id="PositionNotWithinTree"> <source>Position must be within span of the syntax tree.</source> <target state="translated">La posizione deve essere inclusa nello span dell'albero della sintassi.</target> <note /> </trans-unit> <trans-unit id="SpeculatedSyntaxNodeCannotBelongToCurrentCompilation"> <source>Syntax node to be speculated cannot belong to a syntax tree from the current compilation.</source> <target state="translated">Il nodo della sintassi da prevedere non può appartenere a un albero della sintassi della compilazione corrente.</target> <note /> </trans-unit> <trans-unit id="ChainingSpeculativeModelIsNotSupported"> <source>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</source> <target state="translated">Il concatenamento del modello semantico speculativo non è supportato. È necessario creare un modello speculativo dal modello ParentModel non speculativo.</target> <note /> </trans-unit> <trans-unit id="IDS_ToolName"> <source>Microsoft (R) Visual C# Compiler</source> <target state="translated">Compilatore Microsoft (R) Visual C#</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine1"> <source>{0} version {1}</source> <target state="translated">{0} versione {1}</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.</target> <note /> </trans-unit> <trans-unit id="IDS_LangVersions"> <source>Supported language versions:</source> <target state="translated">Versioni del linguaggio supportate:</target> <note /> </trans-unit> <trans-unit id="ERR_ComImportWithInitializers"> <source>'{0}': a class with the ComImport attribute cannot specify field initializers.</source> <target state="translated">'{0}': una classe con l'attributo ComImport non può specificare inizializzatori di campo.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong"> <source>Local name '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Il nome locale '{0}' è troppo lungo per for PDB. Provare ad abbreviarlo oppure a compilare senza /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong_Title"> <source>Local name is too long for PDB</source> <target state="translated">Il nome locale è troppo lungo per PDB</target> <note /> </trans-unit> <trans-unit id="ERR_RetNoObjectRequiredLambda"> <source>Anonymous function converted to a void returning delegate cannot return a value</source> <target state="translated">La funzione anonima convertita in un delegato che restituisce un valore nullo non può restituire un valore</target> <note /> </trans-unit> <trans-unit id="ERR_TaskRetNoObjectRequiredLambda"> <source>Async lambda expression converted to a 'Task' returning delegate cannot return a value. Did you intend to return 'Task&lt;T&gt;'?</source> <target state="translated">L'espressione lambda asincrona convertita in un elemento 'Task' che restituisce il delegato non può restituire un valore. Si intendeva restituire 'Task&lt;T&gt;'?</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated"> <source>An instance of analyzer {0} cannot be created from {1} : {2}.</source> <target state="translated">Non è possibile creare un'istanza dell'analizzatore {0} da {1} : {2}.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated_Title"> <source>An analyzer instance cannot be created</source> <target state="translated">Non è possibile creare un'istanza dell'analizzatore</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly"> <source>The assembly {0} does not contain any analyzers.</source> <target state="translated">L'assembly {0} non contiene analizzatori.</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly_Title"> <source>Assembly does not contain any analyzers</source> <target state="translated">L'assembly non contiene analizzatori</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer"> <source>Unable to load Analyzer assembly {0} : {1}</source> <target state="translated">Non è possibile caricare l'assembly dell'analizzatore {0}: {1}</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer_Title"> <source>Unable to load Analyzer assembly</source> <target state="translated">Non è possibile caricare l'assembly dell'analizzatore</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer"> <source>Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}.</source> <target state="translated">Alcuni tipi nell'assembly dell'analizzatore {0} verranno ignorati a causa di un'eccezione ReflectionTypeLoadException: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadRulesetFile"> <source>Error reading ruleset file {0} - {1}</source> <target state="translated">Si è verificato un errore durante la lettura del file del set di regole {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadPdbData"> <source>Error reading debug information for '{0}'</source> <target state="translated">Si è verificato un errore durante la lettura delle informazioni di debug per '{0}'</target> <note /> </trans-unit> <trans-unit id="IDS_OperationCausedStackOverflow"> <source>Operation caused a stack overflow.</source> <target state="translated">L'operazione ha causato un overflow dello stack.</target> <note /> </trans-unit> <trans-unit id="WRN_IdentifierOrNumericLiteralExpected"> <source>Expected identifier or numeric literal.</source> <target state="translated">È previsto un identificatore o un valore letterale.</target> <note /> </trans-unit> <trans-unit id="WRN_IdentifierOrNumericLiteralExpected_Title"> <source>Expected identifier or numeric literal</source> <target state="translated">È previsto un identificatore o un valore letterale</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerOnNonAutoProperty"> <source>Only auto-implemented properties can have initializers.</source> <target state="translated">Solo le proprietà implementate automaticamente possono avere inizializzatori.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyMustHaveGetAccessor"> <source>Auto-implemented properties must have get accessors.</source> <target state="translated">Le proprietà implementate automaticamente devono avere funzioni di accesso get.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyMustOverrideSet"> <source>Auto-implemented properties must override all accessors of the overridden property.</source> <target state="translated">Le proprietà implementate automaticamente devono sostituire tutte le funzioni di accesso della proprietà sostituita.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerInStructWithoutExplicitConstructor"> <source>Structs without explicit constructors cannot contain members with initializers.</source> <target state="translated">Le struct senza costruttori espliciti non possono contenere membri con inizializzatori.</target> <note /> </trans-unit> <trans-unit id="ERR_EncodinglessSyntaxTree"> <source>Cannot emit debug information for a source text without encoding.</source> <target state="translated">Non è possibile creare le informazioni di debug per un testo di origine senza codifica.</target> <note /> </trans-unit> <trans-unit id="ERR_BlockBodyAndExpressionBody"> <source>Block bodies and expression bodies cannot both be provided.</source> <target state="translated">Non è possibile specificare sia corpi di blocchi che corpi di espressioni.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchFallOut"> <source>Control cannot fall out of switch from final case label ('{0}')</source> <target state="translated">Control non può uscire dall'opzione dall'etichetta case finale ('{0}')</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedBoundGenericName"> <source>Type arguments are not allowed in the nameof operator.</source> <target state="translated">Gli argomenti di tipo non sono consentiti nell'operatore nameof.</target> <note /> </trans-unit> <trans-unit id="ERR_NullPropagatingOpInExpressionTree"> <source>An expression tree lambda may not contain a null propagating operator.</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un operatore di propagazione Null.</target> <note /> </trans-unit> <trans-unit id="ERR_DictionaryInitializerInExpressionTree"> <source>An expression tree lambda may not contain a dictionary initializer.</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere un inizializzatore di dizionario.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionCollectionElementInitializerInExpressionTree"> <source>An extension Add method is not supported for a collection initializer in an expression lambda.</source> <target state="translated">Un metodo Add di estensione non è supportato per un inizializzatore di raccolta in un'espressione lambda.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureNameof"> <source>nameof operator</source> <target state="translated">operatore nameof</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDictionaryInitializer"> <source>dictionary initializer</source> <target state="translated">inizializzatore di dizionario</target> <note /> </trans-unit> <trans-unit id="ERR_UnclosedExpressionHole"> <source>Missing close delimiter '}' for interpolated expression started with '{'.</source> <target state="translated">Manca il delimitatore '}' di chiusura per l'espressione interpolata che inizia con '{'.</target> <note /> </trans-unit> <trans-unit id="ERR_SingleLineCommentInExpressionHole"> <source>A single-line comment may not be used in an interpolated string.</source> <target state="translated">Non è possibile usare un commento su una sola riga in una stringa interpolata.</target> <note /> </trans-unit> <trans-unit id="ERR_InsufficientStack"> <source>An expression is too long or complex to compile</source> <target state="translated">Espressione troppo lunga o complessa per essere compilata</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionHasNoName"> <source>Expression does not have a name.</source> <target state="translated">L'espressione non ha un nome.</target> <note /> </trans-unit> <trans-unit id="ERR_SubexpressionNotInNameof"> <source>Sub-expression cannot be used in an argument to nameof.</source> <target state="translated">Non è possibile usare l'espressione secondaria in un argomento di nameof.</target> <note /> </trans-unit> <trans-unit id="ERR_AliasQualifiedNameNotAnExpression"> <source>An alias-qualified name is not an expression.</source> <target state="translated">Un nome qualificato da alias non è un'espressione.</target> <note /> </trans-unit> <trans-unit id="ERR_NameofMethodGroupWithTypeParameters"> <source>Type parameters are not allowed on a method group as an argument to 'nameof'.</source> <target state="translated">In un gruppo di metodi non sono consentiti parametri di tipo usati come argomento di 'nameof'.</target> <note /> </trans-unit> <trans-unit id="NoNoneSearchCriteria"> <source>SearchCriteria is expected.</source> <target state="translated">È previsto SearchCriteria.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCulture"> <source>Assembly culture strings may not contain embedded NUL characters.</source> <target state="translated">Le stringhe delle impostazioni cultura dell'assembly potrebbero non contenere caratteri NUL incorporati.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureUsingStatic"> <source>using static</source> <target state="translated">using static</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureInterpolatedStrings"> <source>interpolated strings</source> <target state="translated">stringhe interpolate</target> <note /> </trans-unit> <trans-unit id="IDS_AwaitInCatchAndFinally"> <source>await in catch blocks and finally blocks</source> <target state="translated">await in blocchi catch e blocchi finally</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureBinaryLiteral"> <source>binary literals</source> <target state="translated">valori letterali binari</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureDigitSeparator"> <source>digit separators</source> <target state="translated">separatori di cifra</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLocalFunctions"> <source>local functions</source> <target state="translated">funzioni locali</target> <note /> </trans-unit> <trans-unit id="ERR_UnescapedCurly"> <source>A '{0}' character must be escaped (by doubling) in an interpolated string.</source> <target state="translated">In una stringa interpolata è necessario specificare il carattere di escape di un carattere '{0}' raddoppiandolo.</target> <note /> </trans-unit> <trans-unit id="ERR_EscapedCurly"> <source>A '{0}' character may only be escaped by doubling '{0}{0}' in an interpolated string.</source> <target state="translated">In una stringa interpolata è possibile specificare il carattere di escape di un carattere '{0}' raddoppiando '{0}{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TrailingWhitespaceInFormatSpecifier"> <source>A format specifier may not contain trailing whitespace.</source> <target state="translated">Un identificatore di formato non può contenere uno spazio vuoto finale.</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyFormatSpecifier"> <source>Empty format specifier.</source> <target state="translated">Identificatore di formato vuoto.</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorInReferencedAssembly"> <source>There is an error in a referenced assembly '{0}'.</source> <target state="translated">Un assembly di riferimento '{0}' contiene un errore.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionOrDeclarationExpected"> <source>Expression or declaration statement expected.</source> <target state="translated">È prevista l'istruzione di dichiarazione o l'espressione.</target> <note /> </trans-unit> <trans-unit id="ERR_NameofExtensionMethod"> <source>Extension method groups are not allowed as an argument to 'nameof'.</source> <target state="translated">Come argomento di 'nameof' non sono consentiti gruppi di metodi di estensione.</target> <note /> </trans-unit> <trans-unit id="WRN_AlignmentMagnitude"> <source>Alignment value {0} has a magnitude greater than {1} and may result in a large formatted string.</source> <target state="translated">La grandezza del valore di allineamento {0} è maggiore di {1} e può comportare la creazione di una stringa formattata di grandi dimensioni.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedExternAlias_Title"> <source>Unused extern alias</source> <target state="translated">Alias extern non usato</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedUsingDirective_Title"> <source>Unnecessary using directive</source> <target state="translated">Direttiva using non necessaria</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer_Title"> <source>Skip loading types in analyzer assembly that fail due to a ReflectionTypeLoadException</source> <target state="translated">Ignora il caricamento dei tipi nell'assembly dell'analizzatore che non riescono a causa di un'eccezione ReflectionTypeLoadException</target> <note /> </trans-unit> <trans-unit id="WRN_AlignmentMagnitude_Title"> <source>Alignment value has a magnitude that may result in a large formatted string</source> <target state="translated">La grandezza del valore di allineamento è tale da comportare la creazione di una stringa formattata di grandi dimensioni</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantStringTooLong"> <source>Length of String constant resulting from concatenation exceeds System.Int32.MaxValue. Try splitting the string into multiple constants.</source> <target state="translated">La lunghezza della costante di stringa risultante dalla concatenazione supera il valore di System.Int32.MaxValue. Provare a dividere la stringa in più costanti.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleTooFewElements"> <source>Tuple must contain at least two elements.</source> <target state="translated">La tupla deve contenere almeno due elementi.</target> <note /> </trans-unit> <trans-unit id="ERR_DebugEntryPointNotSourceMethodDefinition"> <source>Debug entry point must be a definition of a method declared in the current compilation.</source> <target state="translated">Il punto di ingresso del debug deve essere una definizione di un metodo nella compilazione corrente.</target> <note /> </trans-unit> <trans-unit id="ERR_LoadDirectiveOnlyAllowedInScripts"> <source>#load is only allowed in scripts</source> <target state="translated">#load è consentito solo negli script</target> <note /> </trans-unit> <trans-unit id="ERR_PPLoadFollowsToken"> <source>Cannot use #load after first token in file</source> <target state="translated">Non è possibile usare #load dopo il primo token del file</target> <note /> </trans-unit> <trans-unit id="CouldNotFindFile"> <source>Could not find file.</source> <target state="translated">Il file non è stato trovato.</target> <note>File path referenced in source (#load) could not be resolved.</note> </trans-unit> <trans-unit id="SyntaxTreeFromLoadNoRemoveReplace"> <source>SyntaxTree resulted from a #load directive and cannot be removed or replaced directly.</source> <target state="translated">L'elemento SyntaxTree deriva da una direttiva #load e non può essere rimosso o sostituito direttamente.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceFileReferencesNotSupported"> <source>Source file references are not supported.</source> <target state="translated">I riferimenti al file di origine non sono supportati.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPathMap"> <source>The pathmap option was incorrectly formatted.</source> <target state="translated">Il formato dell'opzione pathmap non è corretto.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidReal"> <source>Invalid real literal.</source> <target state="translated">Il valore letterale reale non è valido.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCannotBeRefReturning"> <source>Auto-implemented properties cannot return by reference</source> <target state="translated">Le proprietà implementate automaticamente non possono essere restituite per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefPropertyMustHaveGetAccessor"> <source>Properties which return by reference must have a get accessor</source> <target state="translated">Le proprietà che vengono restituite per riferimento devono contenere una funzione di accesso get</target> <note /> </trans-unit> <trans-unit id="ERR_RefPropertyCannotHaveSetAccessor"> <source>Properties which return by reference cannot have set accessors</source> <target state="translated">Le proprietà che vengono restituite per riferimento non possono contenere funzioni di accesso set</target> <note /> </trans-unit> <trans-unit id="ERR_CantChangeRefReturnOnOverride"> <source>'{0}' must match by reference return of overridden member '{1}'</source> <target state="translated">'{0}' deve corrispondere per riferimento al valore restituito del membro '{1}' di cui è stato eseguito l'override</target> <note /> </trans-unit> <trans-unit id="ERR_MustNotHaveRefReturn"> <source>By-reference returns may only be used in methods that return by reference</source> <target state="translated">I valori restituiti per riferimento possono essere usati solo in metodi che vengono restituiti per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_MustHaveRefReturn"> <source>By-value returns may only be used in methods that return by value</source> <target state="translated">I valori restituiti per valore possono essere usati solo in metodi che vengono restituiti per valore</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnMustHaveIdentityConversion"> <source>The return expression must be of type '{0}' because this method returns by reference</source> <target state="translated">L'espressione restituita deve essere di tipo '{0}' perché questo metodo viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_CloseUnimplementedInterfaceMemberWrongRefReturn"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implement '{1}' because it does not have matching return by reference.</source> <target state="translated">'{0}' non implementa il membro di interfaccia '{1}'. '{2}' non può implementare '{1}' perché non contiene il valore restituito corrispondente per riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturnRef"> <source>The body of '{0}' cannot be an iterator block because '{0}' returns by reference</source> <target state="translated">Il corpo di '{0}' non può essere un blocco iteratore perché '{0}' viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_BadRefReturnExpressionTree"> <source>Lambda expressions that return by reference cannot be converted to expression trees</source> <target state="translated">Non è possibile convertire in alberi delle espressioni le espressioni lambda che vengono restituite per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallInExpressionTree"> <source>An expression tree lambda may not contain a call to a method, property, or indexer that returns by reference</source> <target state="translated">Un'espressione lambda dell'albero delle espressioni non può contenere una chiamata a un metodo, a una proprietà o a un indicizzatore che viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnLvalueExpected"> <source>An expression cannot be used in this context because it may not be passed or returned by reference</source> <target state="translated">Non è possibile usare un'espressione in questo contesto perché non può essere passata o restituita per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnNonreturnableLocal"> <source>Cannot return '{0}' by reference because it was initialized to a value that cannot be returned by reference</source> <target state="translated">Non è possibile restituire '{0}' per riferimento perché è stato inizializzato con un valore che non può essere restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnNonreturnableLocal2"> <source>Cannot return by reference a member of '{0}' because it was initialized to a value that cannot be returned by reference</source> <target state="translated">Non è possibile restituire un membro di '{0}' per riferimento perché è stato inizializzato con un valore che non può essere restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyLocal"> <source>Cannot return '{0}' by reference because it is read-only</source> <target state="translated">Non è possibile restituire '{0}' per riferimento perché è di sola lettura</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnRangeVariable"> <source>Cannot return the range variable '{0}' by reference</source> <target state="translated">Non è possibile restituire la variabile di intervallo '{0}' per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyLocalCause"> <source>Cannot return '{0}' by reference because it is a '{1}'</source> <target state="translated">Non è possibile restituire '{0}' per riferimento perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyLocal2Cause"> <source>Cannot return fields of '{0}' by reference because it is a '{1}'</source> <target state="translated">Non è possibile restituire i campi di '{0}' per riferimento perché è '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonly"> <source>A readonly field cannot be returned by writable reference</source> <target state="translated">Un campo di sola lettura non può restituito per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyStatic"> <source>A static readonly field cannot be returned by writable reference</source> <target state="translated">Non è possibile restituire un campo di sola lettura statico per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonly2"> <source>Members of readonly field '{0}' cannot be returned by writable reference</source> <target state="translated">I membri del campo di sola lettura '{0}' non possono essere restituiti per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnReadonlyStatic2"> <source>Fields of static readonly field '{0}' cannot be returned by writable reference</source> <target state="translated">Non è possibile restituire i campi del campo di sola lettura statico '{0}' per riferimento scrivibile</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnParameter"> <source>Cannot return a parameter by reference '{0}' because it is not a ref or out parameter</source> <target state="translated">Non è possibile restituire un parametro '{0}' per riferimento perché non è un parametro out o ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnParameter2"> <source>Cannot return by reference a member of parameter '{0}' because it is not a ref or out parameter</source> <target state="translated">Non è possibile restituire per riferimento un membro del parametro '{0}' perché non è un parametro ref o out</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnLocal"> <source>Cannot return local '{0}' by reference because it is not a ref local</source> <target state="translated">Non è possibile restituire la variabile locale '{0}' per riferimento perché non è una variabile locale ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnLocal2"> <source>Cannot return a member of local '{0}' by reference because it is not a ref local</source> <target state="translated">Non è possibile restituire un membro della variabile locale '{0}' per riferimento perché non è una variabile locale ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturnStructThis"> <source>Struct members cannot return 'this' or other instance members by reference</source> <target state="translated">I membri struct non possono restituire 'this' o altri membri di istanza per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeOther"> <source>Expression cannot be used in this context because it may indirectly expose variables outside of their declaration scope</source> <target state="translated">Non è possibile usare l'espressione in questo contesto perché potrebbe esporre indirettamente variabili all'esterno del relativo ambito di dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeLocal"> <source>Cannot use local '{0}' in this context because it may expose referenced variables outside of their declaration scope</source> <target state="translated">Non è possibile usare la variabile locale '{0}' in questo contesto perché potrebbe esporre variabili di riferimento all'esterno del relativo ambito di dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeCall"> <source>Cannot use a result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope</source> <target state="translated">Non è possibile usare un risultato di '{0}' in questo contesto perché potrebbe esporre variabili cui viene fatto riferimento dal parametro '{1}' all'esterno dell'ambito della dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeCall2"> <source>Cannot use a member of result of '{0}' in this context because it may expose variables referenced by parameter '{1}' outside of their declaration scope</source> <target state="translated">Non è possibile usare un membro del risultato di '{0}' in questo contesto perché potrebbe esporre variabili cui viene fatto riferimento dal parametro '{1}' all'esterno dell'ambito di dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_CallArgMixing"> <source>This combination of arguments to '{0}' is disallowed because it may expose variables referenced by parameter '{1}' outside of their declaration scope</source> <target state="translated">Questa combinazione di argomenti di '{0}' non è consentita perché potrebbe esporre variabili cui viene fatto riferimento dal parametro '{1}' all'esterno dell'ambito della dichiarazione</target> <note /> </trans-unit> <trans-unit id="ERR_MismatchedRefEscapeInTernary"> <source>Branches of a ref conditional operator cannot refer to variables with incompatible declaration scopes</source> <target state="translated">I rami di un operatore condizionale ref non possono fare riferimento a variabili con ambiti di dichiarazione incompatibili</target> <note /> </trans-unit> <trans-unit id="ERR_EscapeStackAlloc"> <source>A result of a stackalloc expression of type '{0}' cannot be used in this context because it may be exposed outside of the containing method</source> <target state="translated">Non è possibile usare un risultato di un'espressione a stackalloc di tipo '{0}' in questo contesto perché potrebbe essere esposta all'esterno del metodo che la contiene</target> <note /> </trans-unit> <trans-unit id="ERR_InitializeByValueVariableWithReference"> <source>Cannot initialize a by-value variable with a reference</source> <target state="translated">Non è possibile inizializzare una variabile per valore con un riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_InitializeByReferenceVariableWithValue"> <source>Cannot initialize a by-reference variable with a value</source> <target state="translated">Non è possibile inizializzare una variabile per riferimento con un valore</target> <note /> </trans-unit> <trans-unit id="ERR_RefAssignmentMustHaveIdentityConversion"> <source>The expression must be of type '{0}' because it is being assigned by reference</source> <target state="translated">L'espressione deve essere di tipo '{0}' perché verrà assegnata per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_ByReferenceVariableMustBeInitialized"> <source>A declaration of a by-reference variable must have an initializer</source> <target state="translated">Una dichiarazione di una variabile per riferimento deve contenere un inizializzatore</target> <note /> </trans-unit> <trans-unit id="ERR_AnonDelegateCantUseLocal"> <source>Cannot use ref local '{0}' inside an anonymous method, lambda expression, or query expression</source> <target state="translated">Non è possibile usare la variabile locale ref '{0}' in un metodo anonimo, in un'espressione lambda o in un'espressione di query</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorLocalType"> <source>Iterators cannot have by-reference locals</source> <target state="translated">Gli iteratori non possono includere variabili locali per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncLocalType"> <source>Async methods cannot have by-reference locals</source> <target state="translated">I metodi Async non possono includere variabili locali per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallAndAwait"> <source>'await' cannot be used in an expression containing a call to '{0}' because it returns by reference</source> <target state="translated">'Non è possibile usare 'await' in un'espressione che contiene una chiamata a '{0}' perché viene restituito per riferimento</target> <note /> </trans-unit> <trans-unit id="ERR_RefConditionalAndAwait"> <source>'await' cannot be used in an expression containing a ref conditional operator</source> <target state="translated">'Non è possibile usare 'await' in un'espressione contenente un operatore condizionale ref</target> <note /> </trans-unit> <trans-unit id="ERR_RefConditionalNeedsTwoRefs"> <source>Both conditional operator values must be ref values or neither may be a ref value</source> <target state="translated">Entrambi i valori dell'operatore condizionale devono essere valori ref, altrimenti nessuno potrà esserlo</target> <note /> </trans-unit> <trans-unit id="ERR_RefConditionalDifferentTypes"> <source>The expression must be of type '{0}' to match the alternative ref value</source> <target state="translated">L'espressione deve essere di tipo '{0}' per essere uguale al valore ref alternativo</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsLocalFunction"> <source>An expression tree may not contain a reference to a local function</source> <target state="translated">Un albero delle espressioni non può contenere un riferimento a una funzione locale</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicLocalFunctionParamsParameter"> <source>Cannot pass argument with dynamic type to params parameter '{0}' of local function '{1}'.</source> <target state="translated">Non è possibile passare l'argomento con tipo dinamico al parametro params '{0}' della funzione locale '{1}'.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeIsNotASubmission"> <source>Syntax tree should be created from a submission.</source> <target state="translated">L'albero della sintassi deve essere creato da un invio.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyUserStrings"> <source>Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string literals.</source> <target state="translated">La lunghezza combinata delle stringhe utente usate dal programma supera il limite consentito. Provare a ridurre l'uso di valori letterali stringa.</target> <note /> </trans-unit> <trans-unit id="ERR_PatternNullableType"> <source>It is not legal to use nullable type '{0}?' in a pattern; use the underlying type '{0}' instead.</source> <target state="translated">Non è consentito usare il tipo nullable '{0}?' in un criterio. Usare il tipo sottostante '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PeWritingFailure"> <source>An error occurred while writing the output file: {0}.</source> <target state="translated">Si è verificato un errore durante la scrittura del file di output: {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleDuplicateElementName"> <source>Tuple element names must be unique.</source> <target state="translated">I nomi di elementi di tupla devono essere univoci.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementName"> <source>Tuple element name '{0}' is only allowed at position {1}.</source> <target state="translated">Il nome di elemento di tupla '{0}' è consentito solo alla posizione {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementNameAnyPosition"> <source>Tuple element name '{0}' is disallowed at any position.</source> <target state="translated">Il nome di elemento di tupla '{0}' non è consentito in nessuna posizione.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedTypeMemberNotFoundInAssembly"> <source>Member '{0}' was not found on type '{1}' from assembly '{2}'.</source> <target state="translated">Il membro '{0}' non è stato trovato nel tipo '{1}' dell'assembly '{2}'.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureTuples"> <source>tuples</source> <target state="translated">tuple</target> <note /> </trans-unit> <trans-unit id="ERR_MissingDeconstruct"> <source>No suitable 'Deconstruct' instance or extension method was found for type '{0}', with {1} out parameters and a void return type.</source> <target state="translated">Non sono stati trovati metodi di estensione o istanze di 'Deconstruct' idonee per il tipo '{0}', con {1} parametri out e un tipo restituito void.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructRequiresExpression"> <source>Deconstruct assignment requires an expression with a type on the right-hand-side.</source> <target state="translated">L'assegnazione di decostruzione richiede un'espressione con un tipo sul lato destro.</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchExpressionValueExpected"> <source>The switch expression must be a value; found '{0}'.</source> <target state="translated">L'espressione switch deve essere un valore. È stato trovato '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PatternWrongType"> <source>An expression of type '{0}' cannot be handled by a pattern of type '{1}'.</source> <target state="translated">Un'espressione di tipo '{0}' non può essere gestita da un criterio di tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning"> <source>Attribute '{0}' is ignored when public signing is specified.</source> <target state="translated">L'attributo '{0}' viene ignorato quando si specifica la firma pubblica.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning_Title"> <source>Attribute is ignored when public signing is specified.</source> <target state="translated">L'attributo viene ignorato quando si specifica la firma pubblica.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionMustBeAbsolutePath"> <source>Option '{0}' must be an absolute path.</source> <target state="translated">L'opzione '{0}' deve essere un percorso assoluto.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionNotTupleCompatible"> <source>Tuple with {0} elements cannot be converted to type '{1}'.</source> <target state="translated">Non è possibile convertire la tupla con {0} elementi nel tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureOutVar"> <source>out variable declaration</source> <target state="translated">dichiarazione di variabile out</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList"> <source>Reference to an implicitly-typed out variable '{0}' is not permitted in the same argument list.</source> <target state="translated">Nello stesso elenco di argomenti non è consentito il riferimento a una variabile out tipizzata in modo implicito '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailedForImplicitlyTypedOutVariable"> <source>Cannot infer the type of implicitly-typed out variable '{0}'.</source> <target state="translated">Non è possibile dedurre il tipo della variabile out '{0}' tipizzata in modo implicito.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable"> <source>Cannot infer the type of implicitly-typed deconstruction variable '{0}'.</source> <target state="translated">Non è possibile dedurre il tipo della variabile di decostruzione '{0}' tipizzata in modo implicito.</target> <note /> </trans-unit> <trans-unit id="ERR_DiscardTypeInferenceFailed"> <source>Cannot infer the type of implicitly-typed discard.</source> <target state="translated">Non è possibile dedurre il tipo della variabile discard tipizzata in modo implicito.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructWrongCardinality"> <source>Cannot deconstruct a tuple of '{0}' elements into '{1}' variables.</source> <target state="translated">Non è possibile decostruire una tupla di '{0}' elementi in '{1}' variabili.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotDeconstructDynamic"> <source>Cannot deconstruct dynamic objects.</source> <target state="translated">Non è possibile decostruire oggetti dinamici.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructTooFewElements"> <source>Deconstruction must contain at least two variables.</source> <target state="translated">La decostruzione deve contenere almeno due variabili.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</source> <target state="translated">Il nome dell'elemento di tupla '{0}' viene ignorato perché nel tipo di destinazione '{1}' è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified by the assignment target.</source> <target state="translated">Il nome dell'elemento di tupla viene ignorato perché nella destinazione di assegnazione è specificato un nome diverso o non è specificato alcun nome.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeMustBeStruct"> <source>Predefined type '{0}' must be a struct.</source> <target state="translated">Il tipo predefinito '{0}' deve essere uno struct.</target> <note /> </trans-unit> <trans-unit id="ERR_NewWithTupleTypeSyntax"> <source>'new' cannot be used with tuple type. Use a tuple literal expression instead.</source> <target state="translated">'Non è possibile usare 'new' con il tipo tupla. Usare un'espressione letterale di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_DeconstructionVarFormDisallowsSpecificType"> <source>Deconstruction 'var (...)' form disallows a specific type for 'var'.</source> <target state="translated">Nel form di decostruzione 'var (...)' non è consentito un tipo specifico per 'var'.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesAttributeMissing"> <source>Cannot define a class or member that utilizes tuples because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Non è possibile definire una classe o un membro che usa tuple perché non è stato trovato il tipo '{0}' richiesto dal compilatore. Probabilmente manca un riferimento.</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitTupleElementNamesAttribute"> <source>Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.</source> <target state="translated">Non è possibile fare riferimento a 'System.Runtime.CompilerServices.TupleElementNamesAttribute' in modo esplicito. Usare la sintassi della tupla per definire i nomi di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsOutVariable"> <source>An expression tree may not contain an out argument variable declaration.</source> <target state="translated">Un albero delle espressioni non può contenere una dichiarazione di variabile argomento out.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsDiscard"> <source>An expression tree may not contain a discard.</source> <target state="translated">Un albero delle espressioni non può contenere una funzionalità discard.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsIsMatch"> <source>An expression tree may not contain an 'is' pattern-matching operator.</source> <target state="translated">Un albero delle espressioni non può contenere un operatore dei criteri di ricerca 'is'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsTupleLiteral"> <source>An expression tree may not contain a tuple literal.</source> <target state="translated">Un albero delle espressioni non può contenere un valore letterale di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsTupleConversion"> <source>An expression tree may not contain a tuple conversion.</source> <target state="translated">Un albero delle espressioni non può contenere una conversione di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceLinkRequiresPdb"> <source>/sourcelink switch is only supported when emitting PDB.</source> <target state="translated">L'opzione /sourcelink è supportata solo quando si crea il file PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedWithoutPdb"> <source>/embed switch is only supported when emitting a PDB.</source> <target state="translated">L'opzione /embed è supportata solo quando si crea un file PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInstrumentationKind"> <source>Invalid instrumentation kind: {0}</source> <target state="translated">Il tipo di strumentazione non è valido: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_VarInvocationLvalueReserved"> <source>The syntax 'var (...)' as an lvalue is reserved.</source> <target state="translated">La sintassi 'var (...)' come lvalue è riservata.</target> <note /> </trans-unit> <trans-unit id="ERR_SemiOrLBraceOrArrowExpected"> <source>{ or ; or =&gt; expected</source> <target state="translated">È previsto { oppure ; o =&gt;</target> <note /> </trans-unit> <trans-unit id="ERR_ThrowMisplaced"> <source>A throw expression is not allowed in this context.</source> <target state="translated">Un'espressione throw non è consentita in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_DeclarationExpressionNotPermitted"> <source>A declaration is not allowed in this context.</source> <target state="translated">Una dichiarazione non è consentita in questo contesto.</target> <note /> </trans-unit> <trans-unit id="ERR_MustDeclareForeachIteration"> <source>A foreach loop must declare its iteration variables.</source> <target state="translated">Un ciclo foreach deve dichiarare le relative variabili di iterazione.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesInDeconstruction"> <source>Tuple element names are not permitted on the left of a deconstruction.</source> <target state="translated">Nella parte sinistra di una decostruzione non sono consentiti nomi di elemento di tupla.</target> <note /> </trans-unit> <trans-unit id="ERR_PossibleBadNegCast"> <source>To cast a negative value, you must enclose the value in parentheses.</source> <target state="translated">Per eseguire il cast di un valore negativo, è necessario racchiuderlo tra parentesi.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeContainsThrowExpression"> <source>An expression tree may not contain a throw-expression.</source> <target state="translated">Un albero delle espressioni non può contenere un'espressione throw.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAssemblyName"> <source>Invalid assembly name: {0}</source> <target state="translated">Il nome di assembly {0} non è valido</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncMethodBuilderTaskProperty"> <source>For type '{0}' to be used as an AsyncMethodBuilder for type '{1}', its Task property should return type '{1}' instead of type '{2}'.</source> <target state="translated">La proprietà Task del tipo '{0}' da usare come elemento AsyncMethodBuilder per il tipo '{1}' deve restituire il tipo '{1}' invece di '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeForwardedToMultipleAssemblies"> <source>Module '{0}' in assembly '{1}' is forwarding the type '{2}' to multiple assemblies: '{3}' and '{4}'.</source> <target state="translated">Il modulo '{0}' nell'assembly '{1}' inoltra il tipo '{2}' a più assembly '{3}' e '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PatternDynamicType"> <source>It is not legal to use the type 'dynamic' in a pattern.</source> <target state="translated">Non è consentito usare il tipo 'dynamic' in un criterio.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDocumentationMode"> <source>Provided documentation mode is unsupported or invalid: '{0}'.</source> <target state="translated">La modalità di documentazione specificata non è supportata o non è valida: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSourceCodeKind"> <source>Provided source code kind is unsupported or invalid: '{0}'</source> <target state="translated">Il tipo del codice sorgente specificato non è supportato o non è valido: '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadLanguageVersion"> <source>Provided language version is unsupported or invalid: '{0}'.</source> <target state="translated">La versione del linguaggio specificata non è supportata o non è valida: '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocessingSymbol"> <source>Invalid name for a preprocessing symbol; '{0}' is not a valid identifier</source> <target state="translated">Nome non valido per un simbolo di pre-elaborazione. '{0}' non è un identificatore valido</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7_1"> <source>Feature '{0}' is not available in C# 7.1. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 7.1. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7_2"> <source>Feature '{0}' is not available in C# 7.2. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile C# 7.2. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersionCannotHaveLeadingZeroes"> <source>Specified language version '{0}' cannot have leading zeroes</source> <target state="translated">La versione specificata '{0}' del linguaggio non può contenere zeri iniziali</target> <note /> </trans-unit> <trans-unit id="ERR_VoidAssignment"> <source>A value of type 'void' may not be assigned.</source> <target state="translated">Non è possibile assegnare un valore di tipo 'void'.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental"> <source>'{0}' is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">'{0}' viene usato solo a scopo di valutazione e potrebbe essere modificato o rimosso in aggiornamenti futuri.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental_Title"> <source>Type is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">Type viene usato solo a scopo di valutazione e potrebbe essere modificato o rimosso in aggiornamenti futuri.</target> <note /> </trans-unit> <trans-unit id="ERR_CompilerAndLanguageVersion"> <source>Compiler version: '{0}'. Language version: {1}.</source> <target state="translated">Versione del compilatore: '{0}'. Versione del linguaggio: {1}.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsyncMain"> <source>async main</source> <target state="translated">principale asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_TupleInferredNamesNotAvailable"> <source>Tuple element name '{0}' is inferred. Please use language version {1} or greater to access an element by its inferred name.</source> <target state="translated">Il nome '{0}' dell'elemento di tupla è dedotto. Usare la versione {1} o una versione successiva del linguaggio per accedere a un elemento in base al relativo nome dedotto.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidInTuple"> <source>A tuple may not contain a value of type 'void'.</source> <target state="translated">Una tupla non può contenere un valore di tipo 'void'.</target> <note /> </trans-unit> <trans-unit id="ERR_NonTaskMainCantBeAsync"> <source>A void or int returning entry point cannot be async</source> <target state="translated">Un punto di ingresso che restituisce void o int non può essere asincrono</target> <note /> </trans-unit> <trans-unit id="ERR_PatternWrongGenericTypeInVersion"> <source>An expression of type '{0}' cannot be handled by a pattern of type '{1}' in C# {2}. Please use language version {3} or greater.</source> <target state="translated">Un'espressione di tipo '{0}' non può essere gestita da un criterio di tipo '{1}' in C# {2}. Usare la versione {3} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLocalFunction"> <source>The local function '{0}' is declared but never used</source> <target state="translated">La funzione locale '{0}' è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="WRN_UnreferencedLocalFunction_Title"> <source>Local function is declared but never used</source> <target state="translated">La funzione locale è dichiarata, ma non viene mai usata</target> <note /> </trans-unit> <trans-unit id="ERR_LocalFunctionMissingBody"> <source>Local function '{0}' must declare a body because it is not marked 'static extern'.</source> <target state="translated">La funzione locale '{0}' deve dichiarare un corpo perché non è contrassegnata come 'static extern'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInfo"> <source>Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}'</source> <target state="translated">Non è possibile leggere le informazione di debug del metodo '{0}' (token 0x{1:X8}) dall'assembly '{2}'</target> <note /> </trans-unit> <trans-unit id="IConversionExpressionIsNotCSharpConversion"> <source>{0} is not a valid C# conversion expression</source> <target state="translated">{0} non è un'espressione di conversione C# valida</target> <note /> </trans-unit> <trans-unit id="ERR_DynamicLocalFunctionTypeParameter"> <source>Cannot pass argument with dynamic type to generic local function '{0}' with inferred type arguments.</source> <target state="translated">Non è possibile passare l'argomento di tipo dinamico alla funzione locale generica '{0}' con argomenti di tipo dedotti.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureLeadingDigitSeparator"> <source>leading digit separator</source> <target state="translated">separatore di cifra iniziale</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitReservedAttr"> <source>Do not use '{0}'. This is reserved for compiler usage.</source> <target state="translated">Non usare '{0}' perché è riservato al compilatore.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeReserved"> <source>The type name '{0}' is reserved to be used by the compiler.</source> <target state="translated">Il nome di tipo '{0}' è riservato al compilatore.</target> <note /> </trans-unit> <trans-unit id="ERR_InExtensionMustBeValueType"> <source>The first parameter of the 'in' extension method '{0}' must be a concrete (non-generic) value type.</source> <target state="translated">Il primo parametro del metodo di estensione 'in' '{0}' deve essere un tipo valore concreto (non generico).</target> <note /> </trans-unit> <trans-unit id="ERR_FieldsInRoStruct"> <source>Instance fields of readonly structs must be readonly.</source> <target state="translated">I campi di istanza di struct di sola lettura devono essere di sola lettura.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropsInRoStruct"> <source>Auto-implemented instance properties in readonly structs must be readonly.</source> <target state="translated">Tutte le proprietà di istanza implementate automaticamente in struct di sola lettura devono essere di sola lettura.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldlikeEventsInRoStruct"> <source>Field-like events are not allowed in readonly structs.</source> <target state="translated">Nelle struct di sola lettura non sono consentiti eventi simili a campi.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureRefExtensionMethods"> <source>ref extension methods</source> <target state="translated">metodi di estensione ref</target> <note /> </trans-unit> <trans-unit id="ERR_StackAllocConversionNotPossible"> <source>Conversion of a stackalloc expression of type '{0}' to type '{1}' is not possible.</source> <target state="translated">Non è possibile eseguire la conversione di un'espressione stackalloc di tipo '{0}' nel tipo '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RefExtensionMustBeValueTypeOrConstrainedToOne"> <source>The first parameter of a 'ref' extension method '{0}' must be a value type or a generic type constrained to struct.</source> <target state="translated">Il primo parametro di un metodo di estensione 'ref' '{0}' deve essere un tipo valore o un tipo generico vincolato a struct.</target> <note /> </trans-unit> <trans-unit id="ERR_OutAttrOnInParam"> <source>An in parameter cannot have the Out attribute.</source> <target state="translated">Un parametro in non può avere l'attributo Out.</target> <note /> </trans-unit> <trans-unit id="ICompoundAssignmentOperationIsNotCSharpCompoundAssignment"> <source>{0} is not a valid C# compound assignment operation</source> <target state="translated">{0} non è un'operazione valida di assegnazione composta C#</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalse"> <source>Filter expression is a constant 'false', consider removing the catch clause</source> <target state="translated">L'espressione di filtro è una costante 'false'. Provare a rimuovere la clausola catch</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalse_Title"> <source>Filter expression is a constant 'false'</source> <target state="translated">L'espressione di filtro è una costante 'false'</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalseRedundantTryCatch"> <source>Filter expression is a constant 'false', consider removing the try-catch block</source> <target state="translated">L'espressione di filtro è una costante 'false'. Provare a rimuovere il blocco try-catch</target> <note /> </trans-unit> <trans-unit id="WRN_FilterIsConstantFalseRedundantTryCatch_Title"> <source>Filter expression is a constant 'false'. </source> <target state="translated">L'espressione di filtro è una costante 'false'. </target> <note /> </trans-unit> <trans-unit id="ERR_CantUseVoidInArglist"> <source>__arglist cannot have an argument of void type</source> <target state="translated">__arglist non può contenere un argomento di tipo void</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalInInterpolation"> <source>A conditional expression cannot be used directly in a string interpolation because the ':' ends the interpolation. Parenthesize the conditional expression.</source> <target state="translated">Non è possibile usare un'espressione condizionale in un'interpolazione di stringa perché l'interpolazione termina con ':'. Racchiudere tra parentesi l'espressione condizionale.</target> <note /> </trans-unit> <trans-unit id="ERR_DoNotUseFixedBufferAttrOnProperty"> <source>Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute on a property</source> <target state="translated">Non usare l'attributo 'System.Runtime.CompilerServices.FixedBuffer' su una proprietà</target> <note /> </trans-unit> <trans-unit id="ERR_FeatureNotAvailableInVersion7_3"> <source>Feature '{0}' is not available in C# 7.3. Please use language version {1} or greater.</source> <target state="translated">La funzionalità '{0}' non è disponibile in C# 7.3. Usare la versione {1} o versioni successive del linguaggio.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributesOnBackingFieldsNotAvailable"> <source>Field-targeted attributes on auto-properties are not supported in language version {0}. Please use language version {1} or greater.</source> <target state="translated">Gli attributi destinati a campi su proprietà automatiche non sono supportati nella versione {0} del linguaggio. Usare la versione {1} o superiore.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributesOnBackingFieldsNotAvailable_Title"> <source>Field-targeted attributes on auto-properties are not supported in this version of the language.</source> <target state="translated">Gli attributi destinati a campi su proprietà automatiche non sono supportati in questa versione del linguaggio.</target> <note /> </trans-unit> <trans-unit id="IDS_FeatureAsyncStreams"> <source>async streams</source> <target state="translated">flussi asincroni</target> <note /> </trans-unit> <trans-unit id="ERR_NoConvToIAsyncDisp"> <source>'{0}': type used in an asynchronous using statement must be implicitly convertible to 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method.</source> <target state="translated">'{0}': il tipo usato in un'istruzione using asincrona deve essere convertibile in modo implicito in 'System.IAsyncDisposable' o implementare un metodo 'DisposeAsync' adatto.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetAsyncEnumerator"> <source>Asynchronous foreach requires that the return type '{0}' of '{1}' must have a suitable public 'MoveNextAsync' method and public 'Current' property</source> <target state="translated">Con l'istruzione foreach asincrona il tipo restituito '{0}' di '{1}' deve essere associato a un metodo 'MoveNextAsync' pubblico e a una proprietà 'Current' pubblica appropriati</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleIAsyncEnumOfT"> <source>Asynchronous foreach statement cannot operate on variables of type '{0}' because it implements multiple instantiations of '{1}'; try casting to a specific interface instantiation</source> <target state="translated">L'istruzione foreach asincrona non può funzionare con variabili di tipo '{0}' perché implementa più creazioni di un'istanza di '{1}'. Provare a eseguire il cast su una creazione di un'istanza di interfaccia specifica</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacesCantContainConversionOrEqualityOperators"> <source>Conversion, equality, or inequality operators declared in interfaces must be abstract</source> <target state="needs-review-translation">Le interfacce non possono contenere operatori di conversione, uguaglianza o disuguaglianza</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation"> <source>Target runtime doesn't support default interface implementation.</source> <target state="translated">Il runtime di destinazione non supporta l'implementazione di interfaccia predefinita.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementationForMember"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because the target runtime doesn't support default interface implementation.</source> <target state="translated">'{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}' perché il runtime di destinazione non supporta l'implementazione di interfaccia predefinita.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplicitImplementationOfNonPublicInterfaceMember"> <source>'{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement a non-public member in C# {3}. Please use language version '{4}' or greater.</source> <target state="new">'{0}' does not implement interface member '{1}'. '{2}' cannot implicitly implement a non-public member in C# {3}. Please use language version '{4}' or greater.</target> <note /> </trans-unit> <trans-unit id="ERR_MostSpecificImplementationIsNotFound"> <source>Interface member '{0}' does not have a most specific implementation. Neither '{1}', nor '{2}' are most specific.</source> <target state="translated">Il membro di interfaccia '{0}' non contiene un'implementazione più specifica. Né '{1}' né '{2}' sono più specifiche.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersionDoesNotSupportDefaultInterfaceImplementationForMember"> <source>'{0}' cannot implement interface member '{1}' in type '{2}' because feature '{3}' is not available in C# {4}. Please use language version '{5}' or greater.</source> <target state="translated">'{0}' non può implementare il membro di interfaccia '{1}' nel tipo '{2}' perché la funzionalità '{3}' non è disponibile in C# {4}. Usare la versione '{5}' o versioni successive del linguaggio.</target> <note /> </trans-unit> </body> </file> </xliff>
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Analyzers/VisualBasic/Analyzers/SimplifyInterpolation/VisualBasicSimplifyInterpolationHelpers.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.SimplifyInterpolation Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyInterpolation Friend NotInheritable Class VisualBasicSimplifyInterpolationHelpers Inherits AbstractSimplifyInterpolationHelpers Public Shared ReadOnly Property Instance As New VisualBasicSimplifyInterpolationHelpers Private Sub New() End Sub Protected Overrides ReadOnly Property PermitNonLiteralAlignmentComponents As Boolean = False Protected Overrides Function GetPreservedInterpolationExpressionSyntax(operation As IOperation) As SyntaxNode Return operation.Syntax End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.SimplifyInterpolation Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyInterpolation Friend NotInheritable Class VisualBasicSimplifyInterpolationHelpers Inherits AbstractSimplifyInterpolationHelpers Public Shared ReadOnly Property Instance As New VisualBasicSimplifyInterpolationHelpers Private Sub New() End Sub Protected Overrides ReadOnly Property PermitNonLiteralAlignmentComponents As Boolean = False Protected Overrides Function GetPreservedInterpolationExpressionSyntax(operation As IOperation) As SyntaxNode Return operation.Syntax End Function End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/Operations/SuppressOperation.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Formatting.Rules { /// <summary> /// suppress formatting operations within the given text span /// </summary> internal sealed class SuppressOperation { internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) { Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); Contract.ThrowIfTrue(startToken.RawKind == 0); Contract.ThrowIfTrue(endToken.RawKind == 0); this.TextSpan = textSpan; this.Option = option; this.StartToken = startToken; this.EndToken = endToken; } public TextSpan TextSpan { get; } public SuppressOption Option { get; } public SyntaxToken StartToken { get; } public SyntaxToken EndToken { get; } #if DEBUG public override string ToString() => $"Suppress {TextSpan} from '{StartToken}' to '{EndToken}' with '{Option}'"; #endif } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Formatting.Rules { /// <summary> /// suppress formatting operations within the given text span /// </summary> internal sealed class SuppressOperation { internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) { Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); Contract.ThrowIfTrue(startToken.RawKind == 0); Contract.ThrowIfTrue(endToken.RawKind == 0); this.TextSpan = textSpan; this.Option = option; this.StartToken = startToken; this.EndToken = endToken; } public TextSpan TextSpan { get; } public SuppressOption Option { get; } public SyntaxToken StartToken { get; } public SyntaxToken EndToken { get; } #if DEBUG public override string ToString() => $"Suppress {TextSpan} from '{StartToken}' to '{EndToken}' with '{Option}'"; #endif } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/Core.Wpf/Notification/EditorNotificationServiceFactory.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Composition; using System.Windows; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Notification; namespace Microsoft.CodeAnalysis.Editor.Implementation.Notification { [ExportWorkspaceServiceFactory(typeof(INotificationService), ServiceLayer.Editor)] [Shared] internal class EditorNotificationServiceFactory : IWorkspaceServiceFactory { private static readonly object s_gate = new object(); private static EditorDialogService s_singleton; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public EditorNotificationServiceFactory() { } public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { lock (s_gate) { if (s_singleton == null) { s_singleton = new EditorDialogService(); } } return s_singleton; } private class EditorDialogService : INotificationService, INotificationServiceCallback { /// <summary> /// For testing purposes only. If non-null, this callback will be invoked instead of showing a dialog. /// </summary> public Action<string, string, NotificationSeverity> NotificationCallback { get; set; } public void SendNotification( string message, string title = null, NotificationSeverity severity = NotificationSeverity.Warning) { var callback = NotificationCallback; if (callback != null) { // invoke the callback callback(message, title, severity); } else { var image = SeverityToImage(severity); MessageBox.Show(message, title, MessageBoxButton.OK, image); } } public bool ConfirmMessageBox( string message, string title = null, NotificationSeverity severity = NotificationSeverity.Warning) { var callback = NotificationCallback; if (callback != null) { // invoke the callback and assume 'Yes' was clicked. Since this is a test-only scenario, assuming yes should be fine. callback(message, title, severity); return true; } else { var image = SeverityToImage(severity); return MessageBox.Show(message, title, MessageBoxButton.YesNo, image) == MessageBoxResult.Yes; } } private static MessageBoxImage SeverityToImage(NotificationSeverity severity) => severity switch { NotificationSeverity.Information => MessageBoxImage.Information, NotificationSeverity.Warning => MessageBoxImage.Warning, _ => MessageBoxImage.Error, }; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Composition; using System.Windows; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Notification; namespace Microsoft.CodeAnalysis.Editor.Implementation.Notification { [ExportWorkspaceServiceFactory(typeof(INotificationService), ServiceLayer.Editor)] [Shared] internal class EditorNotificationServiceFactory : IWorkspaceServiceFactory { private static readonly object s_gate = new object(); private static EditorDialogService s_singleton; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public EditorNotificationServiceFactory() { } public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { lock (s_gate) { if (s_singleton == null) { s_singleton = new EditorDialogService(); } } return s_singleton; } private class EditorDialogService : INotificationService, INotificationServiceCallback { /// <summary> /// For testing purposes only. If non-null, this callback will be invoked instead of showing a dialog. /// </summary> public Action<string, string, NotificationSeverity> NotificationCallback { get; set; } public void SendNotification( string message, string title = null, NotificationSeverity severity = NotificationSeverity.Warning) { var callback = NotificationCallback; if (callback != null) { // invoke the callback callback(message, title, severity); } else { var image = SeverityToImage(severity); MessageBox.Show(message, title, MessageBoxButton.OK, image); } } public bool ConfirmMessageBox( string message, string title = null, NotificationSeverity severity = NotificationSeverity.Warning) { var callback = NotificationCallback; if (callback != null) { // invoke the callback and assume 'Yes' was clicked. Since this is a test-only scenario, assuming yes should be fine. callback(message, title, severity); return true; } else { var image = SeverityToImage(severity); return MessageBox.Show(message, title, MessageBoxButton.YesNo, image) == MessageBoxResult.Yes; } } private static MessageBoxImage SeverityToImage(NotificationSeverity severity) => severity switch { NotificationSeverity.Information => MessageBoxImage.Information, NotificationSeverity.Warning => MessageBoxImage.Warning, _ => MessageBoxImage.Error, }; } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Portable/Emit/ParameterSymbolAdapter.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Immutable Imports Microsoft.Cci Imports Microsoft.CodeAnalysis.CodeGen Imports Microsoft.CodeAnalysis.Emit Imports Microsoft.CodeAnalysis.VisualBasic.Emit Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols #If DEBUG Then Partial Friend Class ParameterSymbolAdapter Inherits SymbolAdapter #Else Partial Friend Class ParameterSymbol #End If Implements IParameterTypeInformation Implements IParameterDefinition Private ReadOnly Property IParameterTypeInformationCustomModifiers As ImmutableArray(Of Cci.ICustomModifier) Implements IParameterTypeInformation.CustomModifiers Get Return AdaptedParameterSymbol.CustomModifiers.As(Of Cci.ICustomModifier) End Get End Property Private ReadOnly Property IParameterTypeInformationRefCustomModifiers As ImmutableArray(Of Cci.ICustomModifier) Implements IParameterTypeInformation.RefCustomModifiers Get Return AdaptedParameterSymbol.RefCustomModifiers.As(Of Cci.ICustomModifier) End Get End Property Private ReadOnly Property IParameterTypeInformationIsByReference As Boolean Implements IParameterTypeInformation.IsByReference Get Return AdaptedParameterSymbol.IsByRef End Get End Property Private Function IParameterTypeInformationGetType(context As EmitContext) As ITypeReference Implements IParameterTypeInformation.GetType Dim moduleBeingBuilt As PEModuleBuilder = DirectCast(context.Module, PEModuleBuilder) Dim paramType As TypeSymbol = AdaptedParameterSymbol.Type Return moduleBeingBuilt.Translate(paramType, syntaxNodeOpt:=DirectCast(context.SyntaxNode, VisualBasicSyntaxNode), diagnostics:=context.Diagnostics) End Function Private ReadOnly Property IParameterListEntryIndex As UShort Implements IParameterListEntry.Index Get Return CType(AdaptedParameterSymbol.Ordinal, UShort) End Get End Property Private Function IParameterDefinition_GetDefaultValue(context As EmitContext) As MetadataConstant Implements IParameterDefinition.GetDefaultValue CheckDefinitionInvariant() Return Me.GetMetadataConstantValue(context) End Function Friend Function GetMetadataConstantValue(context As EmitContext) As MetadataConstant If AdaptedParameterSymbol.HasMetadataConstantValue Then Return DirectCast(context.Module, PEModuleBuilder).CreateConstant(AdaptedParameterSymbol.Type, AdaptedParameterSymbol.ExplicitDefaultConstantValue.Value, syntaxNodeOpt:=DirectCast(context.SyntaxNode, VisualBasicSyntaxNode), diagnostics:=context.Diagnostics) Else Return Nothing End If End Function Private ReadOnly Property IParameterDefinition_HasDefaultValue As Boolean Implements IParameterDefinition.HasDefaultValue Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.HasMetadataConstantValue End Get End Property Private ReadOnly Property IParameterDefinitionIsOptional As Boolean Implements IParameterDefinition.IsOptional Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMetadataOptional End Get End Property Private ReadOnly Property IParameterDefinitionIsIn As Boolean Implements IParameterDefinition.IsIn Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMetadataIn End Get End Property Private ReadOnly Property IParameterDefinitionIsOut As Boolean Implements IParameterDefinition.IsOut Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMetadataOut End Get End Property Private ReadOnly Property IParameterDefinitionIsMarshalledExplicitly As Boolean Implements IParameterDefinition.IsMarshalledExplicitly Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMarshalledExplicitly End Get End Property Private ReadOnly Property IParameterDefinitionMarshallingInformation As IMarshallingInformation Implements IParameterDefinition.MarshallingInformation Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.MarshallingInformation End Get End Property Private ReadOnly Property IParameterDefinitionMarshallingDescriptor As ImmutableArray(Of Byte) Implements IParameterDefinition.MarshallingDescriptor Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.MarshallingDescriptor End Get End Property Friend NotOverridable Overrides Sub IReferenceDispatch(visitor As MetadataVisitor) ' Implements IReference.Dispatch Debug.Assert(Me.IsDefinitionOrDistinct()) If Not AdaptedParameterSymbol.IsDefinition Then visitor.Visit(DirectCast(Me, IParameterTypeInformation)) Else If AdaptedParameterSymbol.ContainingModule = (DirectCast(visitor.Context.Module, PEModuleBuilder)).SourceModule Then visitor.Visit(DirectCast(Me, IParameterDefinition)) Else visitor.Visit(DirectCast(Me, IParameterTypeInformation)) End If End If End Sub Friend NotOverridable Overrides Function IReferenceAsDefinition(context As EmitContext) As IDefinition ' Implements IReference.AsDefinition Debug.Assert(Me.IsDefinitionOrDistinct()) Dim moduleBeingBuilt As PEModuleBuilder = DirectCast(context.Module, PEModuleBuilder) If AdaptedParameterSymbol.IsDefinition AndAlso AdaptedParameterSymbol.ContainingModule = moduleBeingBuilt.SourceModule Then Return Me End If Return Nothing End Function Private ReadOnly Property INamedEntityName As String Implements INamedEntity.Name Get Return AdaptedParameterSymbol.MetadataName End Get End Property End Class Partial Friend Class ParameterSymbol #If DEBUG Then Private _lazyAdapter As ParameterSymbolAdapter Protected Overrides Function GetCciAdapterImpl() As SymbolAdapter Return GetCciAdapter() End Function Friend Shadows Function GetCciAdapter() As ParameterSymbolAdapter If _lazyAdapter Is Nothing Then Return InterlockedOperations.Initialize(_lazyAdapter, New ParameterSymbolAdapter(Me)) End If Return _lazyAdapter End Function #Else Friend ReadOnly Property AdaptedParameterSymbol As ParameterSymbol Get Return Me End Get End Property Friend Shadows Function GetCciAdapter() As ParameterSymbol Return Me End Function #End If Friend Overridable ReadOnly Property HasMetadataConstantValue As Boolean Get CheckDefinitionInvariant() If Me.HasExplicitDefaultValue Then Dim value = Me.ExplicitDefaultConstantValue Return Not (value.Discriminator = ConstantValueTypeDiscriminator.DateTime OrElse value.Discriminator = ConstantValueTypeDiscriminator.Decimal) End If Return False End Get End Property Friend Overridable ReadOnly Property IsMetadataOptional As Boolean Get CheckDefinitionInvariant() Return Me.IsOptional OrElse GetAttributes().Any(Function(a) a.IsTargetAttribute(Me, AttributeDescription.OptionalAttribute)) End Get End Property Friend Overridable ReadOnly Property IsMarshalledExplicitly As Boolean Get CheckDefinitionInvariant() Return MarshallingInformation IsNot Nothing End Get End Property Friend Overridable ReadOnly Property MarshallingDescriptor As ImmutableArray(Of Byte) Get CheckDefinitionInvariant() Return Nothing End Get End Property End Class #If DEBUG Then Partial Friend NotInheritable Class ParameterSymbolAdapter Friend ReadOnly Property AdaptedParameterSymbol As ParameterSymbol Friend Sub New(underlyingParameterSymbol As ParameterSymbol) AdaptedParameterSymbol = underlyingParameterSymbol End Sub Friend Overrides ReadOnly Property AdaptedSymbol As Symbol Get Return AdaptedParameterSymbol End Get End Property End Class #End If End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Immutable Imports Microsoft.Cci Imports Microsoft.CodeAnalysis.CodeGen Imports Microsoft.CodeAnalysis.Emit Imports Microsoft.CodeAnalysis.VisualBasic.Emit Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols #If DEBUG Then Partial Friend Class ParameterSymbolAdapter Inherits SymbolAdapter #Else Partial Friend Class ParameterSymbol #End If Implements IParameterTypeInformation Implements IParameterDefinition Private ReadOnly Property IParameterTypeInformationCustomModifiers As ImmutableArray(Of Cci.ICustomModifier) Implements IParameterTypeInformation.CustomModifiers Get Return AdaptedParameterSymbol.CustomModifiers.As(Of Cci.ICustomModifier) End Get End Property Private ReadOnly Property IParameterTypeInformationRefCustomModifiers As ImmutableArray(Of Cci.ICustomModifier) Implements IParameterTypeInformation.RefCustomModifiers Get Return AdaptedParameterSymbol.RefCustomModifiers.As(Of Cci.ICustomModifier) End Get End Property Private ReadOnly Property IParameterTypeInformationIsByReference As Boolean Implements IParameterTypeInformation.IsByReference Get Return AdaptedParameterSymbol.IsByRef End Get End Property Private Function IParameterTypeInformationGetType(context As EmitContext) As ITypeReference Implements IParameterTypeInformation.GetType Dim moduleBeingBuilt As PEModuleBuilder = DirectCast(context.Module, PEModuleBuilder) Dim paramType As TypeSymbol = AdaptedParameterSymbol.Type Return moduleBeingBuilt.Translate(paramType, syntaxNodeOpt:=DirectCast(context.SyntaxNode, VisualBasicSyntaxNode), diagnostics:=context.Diagnostics) End Function Private ReadOnly Property IParameterListEntryIndex As UShort Implements IParameterListEntry.Index Get Return CType(AdaptedParameterSymbol.Ordinal, UShort) End Get End Property Private Function IParameterDefinition_GetDefaultValue(context As EmitContext) As MetadataConstant Implements IParameterDefinition.GetDefaultValue CheckDefinitionInvariant() Return Me.GetMetadataConstantValue(context) End Function Friend Function GetMetadataConstantValue(context As EmitContext) As MetadataConstant If AdaptedParameterSymbol.HasMetadataConstantValue Then Return DirectCast(context.Module, PEModuleBuilder).CreateConstant(AdaptedParameterSymbol.Type, AdaptedParameterSymbol.ExplicitDefaultConstantValue.Value, syntaxNodeOpt:=DirectCast(context.SyntaxNode, VisualBasicSyntaxNode), diagnostics:=context.Diagnostics) Else Return Nothing End If End Function Private ReadOnly Property IParameterDefinition_HasDefaultValue As Boolean Implements IParameterDefinition.HasDefaultValue Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.HasMetadataConstantValue End Get End Property Private ReadOnly Property IParameterDefinitionIsOptional As Boolean Implements IParameterDefinition.IsOptional Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMetadataOptional End Get End Property Private ReadOnly Property IParameterDefinitionIsIn As Boolean Implements IParameterDefinition.IsIn Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMetadataIn End Get End Property Private ReadOnly Property IParameterDefinitionIsOut As Boolean Implements IParameterDefinition.IsOut Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMetadataOut End Get End Property Private ReadOnly Property IParameterDefinitionIsMarshalledExplicitly As Boolean Implements IParameterDefinition.IsMarshalledExplicitly Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.IsMarshalledExplicitly End Get End Property Private ReadOnly Property IParameterDefinitionMarshallingInformation As IMarshallingInformation Implements IParameterDefinition.MarshallingInformation Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.MarshallingInformation End Get End Property Private ReadOnly Property IParameterDefinitionMarshallingDescriptor As ImmutableArray(Of Byte) Implements IParameterDefinition.MarshallingDescriptor Get CheckDefinitionInvariant() Return AdaptedParameterSymbol.MarshallingDescriptor End Get End Property Friend NotOverridable Overrides Sub IReferenceDispatch(visitor As MetadataVisitor) ' Implements IReference.Dispatch Debug.Assert(Me.IsDefinitionOrDistinct()) If Not AdaptedParameterSymbol.IsDefinition Then visitor.Visit(DirectCast(Me, IParameterTypeInformation)) Else If AdaptedParameterSymbol.ContainingModule = (DirectCast(visitor.Context.Module, PEModuleBuilder)).SourceModule Then visitor.Visit(DirectCast(Me, IParameterDefinition)) Else visitor.Visit(DirectCast(Me, IParameterTypeInformation)) End If End If End Sub Friend NotOverridable Overrides Function IReferenceAsDefinition(context As EmitContext) As IDefinition ' Implements IReference.AsDefinition Debug.Assert(Me.IsDefinitionOrDistinct()) Dim moduleBeingBuilt As PEModuleBuilder = DirectCast(context.Module, PEModuleBuilder) If AdaptedParameterSymbol.IsDefinition AndAlso AdaptedParameterSymbol.ContainingModule = moduleBeingBuilt.SourceModule Then Return Me End If Return Nothing End Function Private ReadOnly Property INamedEntityName As String Implements INamedEntity.Name Get Return AdaptedParameterSymbol.MetadataName End Get End Property End Class Partial Friend Class ParameterSymbol #If DEBUG Then Private _lazyAdapter As ParameterSymbolAdapter Protected Overrides Function GetCciAdapterImpl() As SymbolAdapter Return GetCciAdapter() End Function Friend Shadows Function GetCciAdapter() As ParameterSymbolAdapter If _lazyAdapter Is Nothing Then Return InterlockedOperations.Initialize(_lazyAdapter, New ParameterSymbolAdapter(Me)) End If Return _lazyAdapter End Function #Else Friend ReadOnly Property AdaptedParameterSymbol As ParameterSymbol Get Return Me End Get End Property Friend Shadows Function GetCciAdapter() As ParameterSymbol Return Me End Function #End If Friend Overridable ReadOnly Property HasMetadataConstantValue As Boolean Get CheckDefinitionInvariant() If Me.HasExplicitDefaultValue Then Dim value = Me.ExplicitDefaultConstantValue Return Not (value.Discriminator = ConstantValueTypeDiscriminator.DateTime OrElse value.Discriminator = ConstantValueTypeDiscriminator.Decimal) End If Return False End Get End Property Friend Overridable ReadOnly Property IsMetadataOptional As Boolean Get CheckDefinitionInvariant() Return Me.IsOptional OrElse GetAttributes().Any(Function(a) a.IsTargetAttribute(Me, AttributeDescription.OptionalAttribute)) End Get End Property Friend Overridable ReadOnly Property IsMarshalledExplicitly As Boolean Get CheckDefinitionInvariant() Return MarshallingInformation IsNot Nothing End Get End Property Friend Overridable ReadOnly Property MarshallingDescriptor As ImmutableArray(Of Byte) Get CheckDefinitionInvariant() Return Nothing End Get End Property End Class #If DEBUG Then Partial Friend NotInheritable Class ParameterSymbolAdapter Friend ReadOnly Property AdaptedParameterSymbol As ParameterSymbol Friend Sub New(underlyingParameterSymbol As ParameterSymbol) AdaptedParameterSymbol = underlyingParameterSymbol End Sub Friend Overrides ReadOnly Property AdaptedSymbol As Symbol Get Return AdaptedParameterSymbol End Get End Property End Class #End If End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/EventMap.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis.ErrorReporting; namespace Roslyn.Utilities { internal class EventMap { private readonly NonReentrantLock _guard = new(); private readonly Dictionary<string, object> _eventNameToRegistries = new(); public EventMap() { } public void AddEventHandler<TEventHandler>(string eventName, TEventHandler eventHandler) where TEventHandler : class { using (_guard.DisposableWait()) { var registries = GetRegistries_NoLock<TEventHandler>(eventName); var newRegistries = registries.Add(new Registry<TEventHandler>(eventHandler)); SetRegistries_NoLock(eventName, newRegistries); } } public void RemoveEventHandler<TEventHandler>(string eventName, TEventHandler eventHandler) where TEventHandler : class { using (_guard.DisposableWait()) { var registries = GetRegistries_NoLock<TEventHandler>(eventName); // remove disabled registrations from list var newRegistries = registries.RemoveAll(r => r.HasHandler(eventHandler)); if (newRegistries != registries) { // disable all registrations of this handler (so pending raise events can be squelched) // This does not guarantee no race condition between Raise and Remove but greatly reduces it. foreach (var registry in registries.Where(r => r.HasHandler(eventHandler))) { registry.Unregister(); } SetRegistries_NoLock(eventName, newRegistries); } } } [PerformanceSensitive( "https://developercommunity.visualstudio.com/content/problem/854696/changing-target-framework-takes-10-minutes-with-10.html", AllowImplicitBoxing = false)] public EventHandlerSet<TEventHandler> GetEventHandlers<TEventHandler>(string eventName) where TEventHandler : class { return new EventHandlerSet<TEventHandler>(this.GetRegistries<TEventHandler>(eventName)); } private ImmutableArray<Registry<TEventHandler>> GetRegistries<TEventHandler>(string eventName) where TEventHandler : class { using (_guard.DisposableWait()) { return GetRegistries_NoLock<TEventHandler>(eventName); } } private ImmutableArray<Registry<TEventHandler>> GetRegistries_NoLock<TEventHandler>(string eventName) where TEventHandler : class { _guard.AssertHasLock(); if (_eventNameToRegistries.TryGetValue(eventName, out var registries)) { return (ImmutableArray<Registry<TEventHandler>>)registries; } return ImmutableArray.Create<Registry<TEventHandler>>(); } private void SetRegistries_NoLock<TEventHandler>(string eventName, ImmutableArray<Registry<TEventHandler>> registries) where TEventHandler : class { _guard.AssertHasLock(); _eventNameToRegistries[eventName] = registries; } internal class Registry<TEventHandler> : IEquatable<Registry<TEventHandler>?> where TEventHandler : class { private TEventHandler? _handler; public Registry(TEventHandler handler) => _handler = handler; public void Unregister() => _handler = null; public void Invoke(Action<TEventHandler> invoker) { var handler = _handler; if (handler != null) { invoker(handler); } } public bool HasHandler(TEventHandler handler) => handler.Equals(_handler); public bool Equals(Registry<TEventHandler>? other) { if (other == null) { return false; } if (other._handler == null && _handler == null) { return true; } if (other._handler == null || _handler == null) { return false; } return other._handler.Equals(_handler); } public override bool Equals(object? obj) => Equals(obj as Registry<TEventHandler>); public override int GetHashCode() => _handler == null ? 0 : _handler.GetHashCode(); } internal struct EventHandlerSet<TEventHandler> where TEventHandler : class { private ImmutableArray<Registry<TEventHandler>> _registries; internal EventHandlerSet(ImmutableArray<Registry<TEventHandler>> registries) => _registries = registries; public bool HasHandlers { get { return _registries != null && _registries.Length > 0; } } public void RaiseEvent(Action<TEventHandler> invoker) { // The try/catch here is to find additional telemetry for https://devdiv.visualstudio.com/DevDiv/_queries/query/71ee8553-7220-4b2a-98cf-20edab701fd1/. // We've realized there's a problem with our eventing, where if an exception is encountered while calling into subscribers to Workspace events, // we won't notify all of the callers. The expectation is such an exception would be thrown to the SafeStartNew in the workspace's event queue that // will raise that as a fatal exception, but OperationCancelledExceptions might be able to propagate through and fault the task we are using in the // chain. I'm choosing to use ReportWithoutCrashAndPropagate, because if our theory here is correct, it seems the first exception isn't actually // causing crashes, and so if it turns out this is a very common situation I don't want to make a often-benign situation fatal. try { if (this.HasHandlers) { foreach (var registry in _registries) { registry.Invoke(invoker); } } } catch (Exception e) when (FatalError.ReportAndPropagate(e)) { throw ExceptionUtilities.Unreachable; } } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis.ErrorReporting; namespace Roslyn.Utilities { internal class EventMap { private readonly NonReentrantLock _guard = new(); private readonly Dictionary<string, object> _eventNameToRegistries = new(); public EventMap() { } public void AddEventHandler<TEventHandler>(string eventName, TEventHandler eventHandler) where TEventHandler : class { using (_guard.DisposableWait()) { var registries = GetRegistries_NoLock<TEventHandler>(eventName); var newRegistries = registries.Add(new Registry<TEventHandler>(eventHandler)); SetRegistries_NoLock(eventName, newRegistries); } } public void RemoveEventHandler<TEventHandler>(string eventName, TEventHandler eventHandler) where TEventHandler : class { using (_guard.DisposableWait()) { var registries = GetRegistries_NoLock<TEventHandler>(eventName); // remove disabled registrations from list var newRegistries = registries.RemoveAll(r => r.HasHandler(eventHandler)); if (newRegistries != registries) { // disable all registrations of this handler (so pending raise events can be squelched) // This does not guarantee no race condition between Raise and Remove but greatly reduces it. foreach (var registry in registries.Where(r => r.HasHandler(eventHandler))) { registry.Unregister(); } SetRegistries_NoLock(eventName, newRegistries); } } } [PerformanceSensitive( "https://developercommunity.visualstudio.com/content/problem/854696/changing-target-framework-takes-10-minutes-with-10.html", AllowImplicitBoxing = false)] public EventHandlerSet<TEventHandler> GetEventHandlers<TEventHandler>(string eventName) where TEventHandler : class { return new EventHandlerSet<TEventHandler>(this.GetRegistries<TEventHandler>(eventName)); } private ImmutableArray<Registry<TEventHandler>> GetRegistries<TEventHandler>(string eventName) where TEventHandler : class { using (_guard.DisposableWait()) { return GetRegistries_NoLock<TEventHandler>(eventName); } } private ImmutableArray<Registry<TEventHandler>> GetRegistries_NoLock<TEventHandler>(string eventName) where TEventHandler : class { _guard.AssertHasLock(); if (_eventNameToRegistries.TryGetValue(eventName, out var registries)) { return (ImmutableArray<Registry<TEventHandler>>)registries; } return ImmutableArray.Create<Registry<TEventHandler>>(); } private void SetRegistries_NoLock<TEventHandler>(string eventName, ImmutableArray<Registry<TEventHandler>> registries) where TEventHandler : class { _guard.AssertHasLock(); _eventNameToRegistries[eventName] = registries; } internal class Registry<TEventHandler> : IEquatable<Registry<TEventHandler>?> where TEventHandler : class { private TEventHandler? _handler; public Registry(TEventHandler handler) => _handler = handler; public void Unregister() => _handler = null; public void Invoke(Action<TEventHandler> invoker) { var handler = _handler; if (handler != null) { invoker(handler); } } public bool HasHandler(TEventHandler handler) => handler.Equals(_handler); public bool Equals(Registry<TEventHandler>? other) { if (other == null) { return false; } if (other._handler == null && _handler == null) { return true; } if (other._handler == null || _handler == null) { return false; } return other._handler.Equals(_handler); } public override bool Equals(object? obj) => Equals(obj as Registry<TEventHandler>); public override int GetHashCode() => _handler == null ? 0 : _handler.GetHashCode(); } internal struct EventHandlerSet<TEventHandler> where TEventHandler : class { private ImmutableArray<Registry<TEventHandler>> _registries; internal EventHandlerSet(ImmutableArray<Registry<TEventHandler>> registries) => _registries = registries; public bool HasHandlers { get { return _registries != null && _registries.Length > 0; } } public void RaiseEvent(Action<TEventHandler> invoker) { // The try/catch here is to find additional telemetry for https://devdiv.visualstudio.com/DevDiv/_queries/query/71ee8553-7220-4b2a-98cf-20edab701fd1/. // We've realized there's a problem with our eventing, where if an exception is encountered while calling into subscribers to Workspace events, // we won't notify all of the callers. The expectation is such an exception would be thrown to the SafeStartNew in the workspace's event queue that // will raise that as a fatal exception, but OperationCancelledExceptions might be able to propagate through and fault the task we are using in the // chain. I'm choosing to use ReportWithoutCrashAndPropagate, because if our theory here is correct, it seems the first exception isn't actually // causing crashes, and so if it turns out this is a very common situation I don't want to make a often-benign situation fatal. try { if (this.HasHandlers) { foreach (var registry in _registries) { registry.Invoke(invoker); } } } catch (Exception e) when (FatalError.ReportAndPropagate(e)) { throw ExceptionUtilities.Unreachable; } } } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Analyzers/CSharp/Tests/UseVarTestExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; #if CODE_STYLE using AbstractCodeActionOrUserDiagnosticTest = Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest; #endif namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeActions { internal static class UseVarTestExtensions { private static readonly CodeStyleOption2<bool> onWithNone = new CodeStyleOption2<bool>(true, NotificationOption2.None); private static readonly CodeStyleOption2<bool> offWithNone = new CodeStyleOption2<bool>(false, NotificationOption2.None); private static readonly CodeStyleOption2<bool> onWithSilent = new CodeStyleOption2<bool>(true, NotificationOption2.Silent); private static readonly CodeStyleOption2<bool> offWithSilent = new CodeStyleOption2<bool>(false, NotificationOption2.Silent); private static readonly CodeStyleOption2<bool> onWithInfo = new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion); private static readonly CodeStyleOption2<bool> offWithInfo = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion); private static readonly CodeStyleOption2<bool> onWithWarning = new CodeStyleOption2<bool>(true, NotificationOption2.Warning); private static readonly CodeStyleOption2<bool> offWithWarning = new CodeStyleOption2<bool>(false, NotificationOption2.Warning); private static readonly CodeStyleOption2<bool> offWithError = new CodeStyleOption2<bool>(false, NotificationOption2.Error); private static readonly CodeStyleOption2<bool> onWithError = new CodeStyleOption2<bool>(true, NotificationOption2.Error); public static OptionsCollection PreferExplicitTypeWithError(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithError }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithError }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithError }, }; public static OptionsCollection PreferImplicitTypeWithError(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithError }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithError }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithError }, }; public static OptionsCollection PreferExplicitTypeWithWarning(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithWarning }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithWarning }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithWarning }, }; public static OptionsCollection PreferImplicitTypeWithWarning(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithWarning }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithWarning }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithWarning }, }; public static OptionsCollection PreferExplicitTypeWithInfo(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithInfo }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithInfo }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo }, }; public static OptionsCollection PreferImplicitTypeWithInfo(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithInfo }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithInfo }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithInfo }, }; public static OptionsCollection PreferExplicitTypeWithSilent(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithSilent }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithSilent }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithSilent }, }; public static OptionsCollection PreferImplicitTypeWithSilent(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithSilent }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithSilent }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithSilent }, }; public static OptionsCollection PreferExplicitTypeWithNone(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithNone }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithNone }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithNone }, }; public static OptionsCollection PreferImplicitTypeWithNone(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithNone }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithNone }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithNone }, }; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; #if CODE_STYLE using AbstractCodeActionOrUserDiagnosticTest = Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest; #endif namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeActions { internal static class UseVarTestExtensions { private static readonly CodeStyleOption2<bool> onWithNone = new CodeStyleOption2<bool>(true, NotificationOption2.None); private static readonly CodeStyleOption2<bool> offWithNone = new CodeStyleOption2<bool>(false, NotificationOption2.None); private static readonly CodeStyleOption2<bool> onWithSilent = new CodeStyleOption2<bool>(true, NotificationOption2.Silent); private static readonly CodeStyleOption2<bool> offWithSilent = new CodeStyleOption2<bool>(false, NotificationOption2.Silent); private static readonly CodeStyleOption2<bool> onWithInfo = new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion); private static readonly CodeStyleOption2<bool> offWithInfo = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion); private static readonly CodeStyleOption2<bool> onWithWarning = new CodeStyleOption2<bool>(true, NotificationOption2.Warning); private static readonly CodeStyleOption2<bool> offWithWarning = new CodeStyleOption2<bool>(false, NotificationOption2.Warning); private static readonly CodeStyleOption2<bool> offWithError = new CodeStyleOption2<bool>(false, NotificationOption2.Error); private static readonly CodeStyleOption2<bool> onWithError = new CodeStyleOption2<bool>(true, NotificationOption2.Error); public static OptionsCollection PreferExplicitTypeWithError(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithError }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithError }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithError }, }; public static OptionsCollection PreferImplicitTypeWithError(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithError }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithError }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithError }, }; public static OptionsCollection PreferExplicitTypeWithWarning(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithWarning }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithWarning }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithWarning }, }; public static OptionsCollection PreferImplicitTypeWithWarning(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithWarning }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithWarning }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithWarning }, }; public static OptionsCollection PreferExplicitTypeWithInfo(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithInfo }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithInfo }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo }, }; public static OptionsCollection PreferImplicitTypeWithInfo(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithInfo }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithInfo }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithInfo }, }; public static OptionsCollection PreferExplicitTypeWithSilent(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithSilent }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithSilent }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithSilent }, }; public static OptionsCollection PreferImplicitTypeWithSilent(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithSilent }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithSilent }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithSilent }, }; public static OptionsCollection PreferExplicitTypeWithNone(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, offWithNone }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithNone }, { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithNone }, }; public static OptionsCollection PreferImplicitTypeWithNone(this AbstractCodeActionOrUserDiagnosticTest test) => new OptionsCollection(test.GetLanguage()) { { CSharpCodeStyleOptions.VarElsewhere, onWithNone }, { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithNone }, { CSharpCodeStyleOptions.VarForBuiltInTypes, onWithNone }, }; } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/VisualStudio/Setup.Dependencies/Properties/launchSettings.json
{ "profiles": { "Visual Studio Extension": { "executablePath": "$(DevEnvDir)devenv.exe", "commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log" } } }
{ "profiles": { "Visual Studio Extension": { "executablePath": "$(DevEnvDir)devenv.exe", "commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log" } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/Core/Portable/ExternalAccess/UnitTesting/Api/UnitTestingSymbolExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Threading; namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api { internal static class UnitTestingSymbolExtensions { public static string GetSymbolKeyString(this ISymbol symbol, CancellationToken cancellationToken) => SymbolKey.Create(symbol, cancellationToken).ToString(); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Threading; namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api { internal static class UnitTestingSymbolExtensions { public static string GetSymbolKeyString(this ISymbol symbol, CancellationToken cancellationToken) => SymbolKey.Create(symbol, cancellationToken).ToString(); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/CSharpTest/QuickInfo/SyntacticQuickInfoSourceTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.QuickInfo; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.QuickInfo; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Adornments; using Moq; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QuickInfo { public class SyntacticQuickInfoSourceTests : AbstractQuickInfoSourceTests { [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_0() { await TestInMethodAndScriptAsync( @" switch (true) { }$$ ", @"switch (true) {"); } [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_1() => await TestInClassAsync("int Property { get; }$$ ", "int Property {"); [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_2() => await TestInClassAsync("void M()\r\n{ }$$ ", "void M()\r\n{"); [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_3() => await TestInMethodAndScriptAsync("var a = new int[] { }$$ ", "new int[] {"); [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_4() { await TestInMethodAndScriptAsync( @" if (true) { }$$ ", @"if (true) {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_0() { await TestInMethodAndScriptAsync( @"if (true) { { }$$ }", "{"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_1() { await TestInMethodAndScriptAsync( @"while (true) { // some // comment { }$$ }", @"// some // comment {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_2() { await TestInMethodAndScriptAsync( @"do { /* comment */ { }$$ } while (true);", @"/* comment */ {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_3() { await TestInMethodAndScriptAsync( @"if (true) { } else { { // some // comment }$$ }", @"{ // some // comment"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_4() { await TestInMethodAndScriptAsync( @"using (var x = new X()) { { /* comment */ }$$ }", @"{ /* comment */"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_5() { await TestInMethodAndScriptAsync( @"foreach (var x in xs) { // above { /* below */ }$$ }", @"// above {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_6() { await TestInMethodAndScriptAsync( @"for (;;) { /*************/ // part 1 // part 2 { }$$ }", @"/*************/ // part 1 // part 2 {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_7() { await TestInMethodAndScriptAsync( @"try { /*************/ // part 1 // part 2 { }$$ } catch { throw; }", @"/*************/ // part 1 // part 2 {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_8() { await TestInMethodAndScriptAsync( @" { /*************/ // part 1 // part 2 }$$ ", @"{ /*************/ // part 1 // part 2"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_9() { await TestInClassAsync( @"int Property { set { { }$$ } }", "{"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_10() { await TestInMethodAndScriptAsync( @"switch (true) { default: // comment { }$$ break; }", @"// comment {"); } private static QuickInfoProvider CreateProvider() => new CSharpSyntacticQuickInfoProvider(); protected override async Task AssertNoContentAsync( TestWorkspace workspace, Document document, int position) { var provider = CreateProvider(); Assert.Null(await provider.GetQuickInfoAsync(new QuickInfoContext(document, position, CancellationToken.None))); } protected override async Task AssertContentIsAsync( TestWorkspace workspace, Document document, int position, string expectedContent, string expectedDocumentationComment = null) { var provider = CreateProvider(); var info = await provider.GetQuickInfoAsync(new QuickInfoContext(document, position, CancellationToken.None)); Assert.NotNull(info); Assert.NotEqual(0, info.RelatedSpans.Length); var trackingSpan = new Mock<ITrackingSpan>(MockBehavior.Strict); var threadingContext = workspace.ExportProvider.GetExportedValue<IThreadingContext>(); var streamingPresenter = workspace.ExportProvider.GetExport<IStreamingFindUsagesPresenter>(); var quickInfoItem = await IntellisenseQuickInfoBuilder.BuildItemAsync(trackingSpan.Object, info, document, threadingContext, streamingPresenter, CancellationToken.None); var containerElement = quickInfoItem.Item as ContainerElement; var textElements = containerElement.Elements.OfType<ClassifiedTextElement>(); Assert.NotEmpty(textElements); var textElement = textElements.First(); var actualText = string.Concat(textElement.Runs.Select(r => r.Text)); Assert.Equal(expectedContent, actualText); } protected override Task TestInMethodAsync(string code, string expectedContent, string expectedDocumentationComment = null) { return TestInClassAsync( @"void M() {" + code + "}", expectedContent, expectedDocumentationComment); } protected override Task TestInClassAsync(string code, string expectedContent, string expectedDocumentationComment = null) { return TestAsync( @"class C {" + code + "}", expectedContent, expectedDocumentationComment); } protected override Task TestInScriptAsync(string code, string expectedContent, string expectedDocumentationComment = null) => TestAsync(code, expectedContent, expectedContent, Options.Script); protected override async Task TestAsync( string code, string expectedContent, string expectedDocumentationComment = null, CSharpParseOptions parseOptions = null) { using var workspace = TestWorkspace.CreateCSharp(code, parseOptions); var testDocument = workspace.Documents.Single(); var position = testDocument.CursorPosition.Value; var document = workspace.CurrentSolution.Projects.First().Documents.First(); if (string.IsNullOrEmpty(expectedContent)) { await AssertNoContentAsync(workspace, document, position); } else { await AssertContentIsAsync(workspace, document, position, expectedContent, expectedDocumentationComment); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.QuickInfo; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.QuickInfo; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Adornments; using Moq; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.QuickInfo { public class SyntacticQuickInfoSourceTests : AbstractQuickInfoSourceTests { [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_0() { await TestInMethodAndScriptAsync( @" switch (true) { }$$ ", @"switch (true) {"); } [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_1() => await TestInClassAsync("int Property { get; }$$ ", "int Property {"); [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_2() => await TestInClassAsync("void M()\r\n{ }$$ ", "void M()\r\n{"); [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_3() => await TestInMethodAndScriptAsync("var a = new int[] { }$$ ", "new int[] {"); [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task Brackets_4() { await TestInMethodAndScriptAsync( @" if (true) { }$$ ", @"if (true) {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_0() { await TestInMethodAndScriptAsync( @"if (true) { { }$$ }", "{"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_1() { await TestInMethodAndScriptAsync( @"while (true) { // some // comment { }$$ }", @"// some // comment {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_2() { await TestInMethodAndScriptAsync( @"do { /* comment */ { }$$ } while (true);", @"/* comment */ {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_3() { await TestInMethodAndScriptAsync( @"if (true) { } else { { // some // comment }$$ }", @"{ // some // comment"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_4() { await TestInMethodAndScriptAsync( @"using (var x = new X()) { { /* comment */ }$$ }", @"{ /* comment */"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_5() { await TestInMethodAndScriptAsync( @"foreach (var x in xs) { // above { /* below */ }$$ }", @"// above {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_6() { await TestInMethodAndScriptAsync( @"for (;;) { /*************/ // part 1 // part 2 { }$$ }", @"/*************/ // part 1 // part 2 {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_7() { await TestInMethodAndScriptAsync( @"try { /*************/ // part 1 // part 2 { }$$ } catch { throw; }", @"/*************/ // part 1 // part 2 {"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_8() { await TestInMethodAndScriptAsync( @" { /*************/ // part 1 // part 2 }$$ ", @"{ /*************/ // part 1 // part 2"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_9() { await TestInClassAsync( @"int Property { set { { }$$ } }", "{"); } [WorkItem(325, "https://github.com/dotnet/roslyn/issues/325")] [WpfFact, Trait(Traits.Feature, Traits.Features.QuickInfo)] public async Task ScopeBrackets_10() { await TestInMethodAndScriptAsync( @"switch (true) { default: // comment { }$$ break; }", @"// comment {"); } private static QuickInfoProvider CreateProvider() => new CSharpSyntacticQuickInfoProvider(); protected override async Task AssertNoContentAsync( TestWorkspace workspace, Document document, int position) { var provider = CreateProvider(); Assert.Null(await provider.GetQuickInfoAsync(new QuickInfoContext(document, position, CancellationToken.None))); } protected override async Task AssertContentIsAsync( TestWorkspace workspace, Document document, int position, string expectedContent, string expectedDocumentationComment = null) { var provider = CreateProvider(); var info = await provider.GetQuickInfoAsync(new QuickInfoContext(document, position, CancellationToken.None)); Assert.NotNull(info); Assert.NotEqual(0, info.RelatedSpans.Length); var trackingSpan = new Mock<ITrackingSpan>(MockBehavior.Strict); var threadingContext = workspace.ExportProvider.GetExportedValue<IThreadingContext>(); var streamingPresenter = workspace.ExportProvider.GetExport<IStreamingFindUsagesPresenter>(); var quickInfoItem = await IntellisenseQuickInfoBuilder.BuildItemAsync(trackingSpan.Object, info, document, threadingContext, streamingPresenter, CancellationToken.None); var containerElement = quickInfoItem.Item as ContainerElement; var textElements = containerElement.Elements.OfType<ClassifiedTextElement>(); Assert.NotEmpty(textElements); var textElement = textElements.First(); var actualText = string.Concat(textElement.Runs.Select(r => r.Text)); Assert.Equal(expectedContent, actualText); } protected override Task TestInMethodAsync(string code, string expectedContent, string expectedDocumentationComment = null) { return TestInClassAsync( @"void M() {" + code + "}", expectedContent, expectedDocumentationComment); } protected override Task TestInClassAsync(string code, string expectedContent, string expectedDocumentationComment = null) { return TestAsync( @"class C {" + code + "}", expectedContent, expectedDocumentationComment); } protected override Task TestInScriptAsync(string code, string expectedContent, string expectedDocumentationComment = null) => TestAsync(code, expectedContent, expectedContent, Options.Script); protected override async Task TestAsync( string code, string expectedContent, string expectedDocumentationComment = null, CSharpParseOptions parseOptions = null) { using var workspace = TestWorkspace.CreateCSharp(code, parseOptions); var testDocument = workspace.Documents.Single(); var position = testDocument.CursorPosition.Value; var document = workspace.CurrentSolution.Projects.First().Documents.First(); if (string.IsNullOrEmpty(expectedContent)) { await AssertNoContentAsync(workspace, document, position); } else { await AssertContentIsAsync(workspace, document, position, expectedContent, expectedDocumentationComment); } } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/BaseIndentationFormattingRule.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Formatting.Rules { internal class BaseIndentationFormattingRule : AbstractFormattingRule { private readonly AbstractFormattingRule? _vbHelperFormattingRule; private readonly int _baseIndentation; private readonly SyntaxToken _token1; private readonly SyntaxToken _token2; private readonly SyntaxNode? _commonNode; private readonly TextSpan _span; public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) { _span = span; SetInnermostNodeForSpan(root, ref _span, out _token1, out _token2, out _commonNode); _baseIndentation = baseIndentation; _vbHelperFormattingRule = vbHelperFormattingRule; } public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, in NextIndentBlockOperationAction nextOperation) { // for the common node itself, return absolute indentation if (_commonNode == node) { // TODO: If the first line of the span includes a node, we want to align with the position of that node // in the primary buffer. That's what Dev12 does for C#, but it doesn't match Roslyn's current model // of each statement being formatted independently with respect to it's parent. list.Add(new IndentBlockOperation(_token1, _token2, _span, _baseIndentation, IndentBlockOption.AbsolutePosition)); } else if (node.Span.Contains(_span)) { // any node bigger than our span is ignored. return; } // Add everything to the list. AddNextIndentBlockOperations(list, node, in nextOperation); // Filter out everything that encompasses our span. AdjustIndentBlockOperation(list); } private void AddNextIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, in NextIndentBlockOperationAction nextOperation) { if (_vbHelperFormattingRule == null) { base.AddIndentBlockOperations(list, node, in nextOperation); return; } _vbHelperFormattingRule.AddIndentBlockOperations(list, node, in nextOperation); } private void AdjustIndentBlockOperation(List<IndentBlockOperation> list) { list.RemoveOrTransformAll( (operation, self) => { // already filtered out operation if (operation == null) { return null; } // if span is same as us, make sure we only include ourselves. if (self._span == operation.TextSpan && !self.Myself(operation)) { return null; } // inside of us, skip it. if (self._span.Contains(operation.TextSpan)) { return operation; } // throw away operation that encloses ourselves if (operation.TextSpan.Contains(self._span)) { return null; } // now we have an interesting case where indentation block intersects with us. // this can happen if code is split in two different script blocks or nuggets. // here, we will re-adjust block to be contained within our span. if (operation.TextSpan.IntersectsWith(self._span)) { return self.CloneAndAdjustFormattingOperation(operation); } return operation; }, this); } private bool Myself(IndentBlockOperation operation) { return operation.TextSpan == _span && operation.StartToken == _token1 && operation.EndToken == _token2 && operation.IndentationDeltaOrPosition == _baseIndentation && operation.Option == IndentBlockOption.AbsolutePosition; } private IndentBlockOperation CloneAndAdjustFormattingOperation(IndentBlockOperation operation) { switch (operation.Option & IndentBlockOption.PositionMask) { case IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine: return FormattingOperations.CreateRelativeIndentBlockOperation(operation.BaseToken, operation.StartToken, operation.EndToken, AdjustTextSpan(operation.TextSpan), operation.IndentationDeltaOrPosition, operation.Option); case IndentBlockOption.RelativePosition: case IndentBlockOption.AbsolutePosition: return FormattingOperations.CreateIndentBlockOperation(operation.StartToken, operation.EndToken, AdjustTextSpan(operation.TextSpan), operation.IndentationDeltaOrPosition, operation.Option); default: throw ExceptionUtilities.UnexpectedValue(operation.Option); } } private TextSpan AdjustTextSpan(TextSpan textSpan) => TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) { commonNode = null; GetTokens(root, span, out token1, out token2); span = GetSpanFromTokens(span, token1, token2); if (token1.RawKind == 0 || token2.RawKind == 0) { return; } commonNode = token1.GetCommonRoot(token2); } private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) { // get tokens within given span token1 = root.FindToken(span.Start); token2 = root.FindTokenFromEnd(span.End); // It is possible the given span doesn't have any tokens in them. In that case, // make tokens to be the adjacent ones to the given span. if (span.End < token1.Span.Start) { token1 = token1.GetPreviousToken(); } if (token2.Span.End < span.Start) { token2 = token2.GetNextToken(); } } private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) { var tree = token1.SyntaxTree; RoslynDebug.AssertNotNull(tree); // adjust span to include all whitespace before and after the given span. var start = token1.Span.End; // current token is inside of the given span, get previous token's end position if (span.Start <= token1.Span.Start) { token1 = token1.GetPreviousToken(); start = token1.Span.End; // If token1, that was passed, is the first visible token of the tree then we want to // the beginning of the span to start from the beginning of the tree if (token1.RawKind == 0) { start = 0; } } var end = token2.Span.Start; // current token is inside of the given span, get next token's start position. if (token2.Span.End <= span.End) { token2 = token2.GetNextToken(); end = token2.Span.Start; // If token2, that was passed, was the last visible token of the tree then we want the // span to expand till the end of the tree if (token2.RawKind == 0) { end = tree.Length; } } if (token1.Equals(token2) && end < start) { // This can happen if `token1.Span` is larger than `span` on each end (due to trivia) and occurs when // only a single token is projected into a buffer and the projection is sandwiched between two other // projections into the same backing buffer. An example of this is during broken code scenarios when // typing certain Razor `@` directives. var temp = end; end = start; start = temp; } return TextSpan.FromBounds(start, end); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Formatting.Rules { internal class BaseIndentationFormattingRule : AbstractFormattingRule { private readonly AbstractFormattingRule? _vbHelperFormattingRule; private readonly int _baseIndentation; private readonly SyntaxToken _token1; private readonly SyntaxToken _token2; private readonly SyntaxNode? _commonNode; private readonly TextSpan _span; public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) { _span = span; SetInnermostNodeForSpan(root, ref _span, out _token1, out _token2, out _commonNode); _baseIndentation = baseIndentation; _vbHelperFormattingRule = vbHelperFormattingRule; } public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, in NextIndentBlockOperationAction nextOperation) { // for the common node itself, return absolute indentation if (_commonNode == node) { // TODO: If the first line of the span includes a node, we want to align with the position of that node // in the primary buffer. That's what Dev12 does for C#, but it doesn't match Roslyn's current model // of each statement being formatted independently with respect to it's parent. list.Add(new IndentBlockOperation(_token1, _token2, _span, _baseIndentation, IndentBlockOption.AbsolutePosition)); } else if (node.Span.Contains(_span)) { // any node bigger than our span is ignored. return; } // Add everything to the list. AddNextIndentBlockOperations(list, node, in nextOperation); // Filter out everything that encompasses our span. AdjustIndentBlockOperation(list); } private void AddNextIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, in NextIndentBlockOperationAction nextOperation) { if (_vbHelperFormattingRule == null) { base.AddIndentBlockOperations(list, node, in nextOperation); return; } _vbHelperFormattingRule.AddIndentBlockOperations(list, node, in nextOperation); } private void AdjustIndentBlockOperation(List<IndentBlockOperation> list) { list.RemoveOrTransformAll( (operation, self) => { // already filtered out operation if (operation == null) { return null; } // if span is same as us, make sure we only include ourselves. if (self._span == operation.TextSpan && !self.Myself(operation)) { return null; } // inside of us, skip it. if (self._span.Contains(operation.TextSpan)) { return operation; } // throw away operation that encloses ourselves if (operation.TextSpan.Contains(self._span)) { return null; } // now we have an interesting case where indentation block intersects with us. // this can happen if code is split in two different script blocks or nuggets. // here, we will re-adjust block to be contained within our span. if (operation.TextSpan.IntersectsWith(self._span)) { return self.CloneAndAdjustFormattingOperation(operation); } return operation; }, this); } private bool Myself(IndentBlockOperation operation) { return operation.TextSpan == _span && operation.StartToken == _token1 && operation.EndToken == _token2 && operation.IndentationDeltaOrPosition == _baseIndentation && operation.Option == IndentBlockOption.AbsolutePosition; } private IndentBlockOperation CloneAndAdjustFormattingOperation(IndentBlockOperation operation) { switch (operation.Option & IndentBlockOption.PositionMask) { case IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine: return FormattingOperations.CreateRelativeIndentBlockOperation(operation.BaseToken, operation.StartToken, operation.EndToken, AdjustTextSpan(operation.TextSpan), operation.IndentationDeltaOrPosition, operation.Option); case IndentBlockOption.RelativePosition: case IndentBlockOption.AbsolutePosition: return FormattingOperations.CreateIndentBlockOperation(operation.StartToken, operation.EndToken, AdjustTextSpan(operation.TextSpan), operation.IndentationDeltaOrPosition, operation.Option); default: throw ExceptionUtilities.UnexpectedValue(operation.Option); } } private TextSpan AdjustTextSpan(TextSpan textSpan) => TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) { commonNode = null; GetTokens(root, span, out token1, out token2); span = GetSpanFromTokens(span, token1, token2); if (token1.RawKind == 0 || token2.RawKind == 0) { return; } commonNode = token1.GetCommonRoot(token2); } private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) { // get tokens within given span token1 = root.FindToken(span.Start); token2 = root.FindTokenFromEnd(span.End); // It is possible the given span doesn't have any tokens in them. In that case, // make tokens to be the adjacent ones to the given span. if (span.End < token1.Span.Start) { token1 = token1.GetPreviousToken(); } if (token2.Span.End < span.Start) { token2 = token2.GetNextToken(); } } private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) { var tree = token1.SyntaxTree; RoslynDebug.AssertNotNull(tree); // adjust span to include all whitespace before and after the given span. var start = token1.Span.End; // current token is inside of the given span, get previous token's end position if (span.Start <= token1.Span.Start) { token1 = token1.GetPreviousToken(); start = token1.Span.End; // If token1, that was passed, is the first visible token of the tree then we want to // the beginning of the span to start from the beginning of the tree if (token1.RawKind == 0) { start = 0; } } var end = token2.Span.Start; // current token is inside of the given span, get next token's start position. if (token2.Span.End <= span.End) { token2 = token2.GetNextToken(); end = token2.Span.Start; // If token2, that was passed, was the last visible token of the tree then we want the // span to expand till the end of the tree if (token2.RawKind == 0) { end = tree.Length; } } if (token1.Equals(token2) && end < start) { // This can happen if `token1.Span` is larger than `span` on each end (due to trivia) and occurs when // only a single token is projected into a buffer and the projection is sandwiched between two other // projections into the same backing buffer. An example of this is during broken code scenarios when // typing certain Razor `@` directives. var temp = end; end = start; start = temp; } return TextSpan.FromBounds(start, end); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Test/Core/Platform/CoreClr/CoreCLRRuntimeEnvironmentFactory.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #if NETCOREAPP using System; using System.Collections.Generic; using Roslyn.Test.Utilities; namespace Roslyn.Test.Utilities.CoreClr { public sealed class CoreCLRRuntimeEnvironmentFactory : IRuntimeEnvironmentFactory { public IRuntimeEnvironment Create(IEnumerable<ModuleData> additionalDependencies) => new CoreCLRRuntimeEnvironment(additionalDependencies); } } #endif
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #if NETCOREAPP using System; using System.Collections.Generic; using Roslyn.Test.Utilities; namespace Roslyn.Test.Utilities.CoreClr { public sealed class CoreCLRRuntimeEnvironmentFactory : IRuntimeEnvironmentFactory { public IRuntimeEnvironment Create(IEnumerable<ModuleData> additionalDependencies) => new CoreCLRRuntimeEnvironment(additionalDependencies); } } #endif
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/ExpressionEvaluator/CSharp/Test/ResultProvider/FullNameTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.ExpressionEvaluator; using Microsoft.VisualStudio.Debugger.ComponentInterfaces; using Microsoft.VisualStudio.Debugger.Clr; using Microsoft.VisualStudio.Debugger.Evaluation; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.UnitTests { public class FullNameTests : CSharpResultProviderTestBase { [Fact] public void Null() { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); Assert.Equal("null", fullNameProvider.GetClrExpressionForNull(inspectionContext)); } [Fact] public void This() { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); Assert.Equal("this", fullNameProvider.GetClrExpressionForThis(inspectionContext)); } [Fact] public void ArrayIndex() { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); Assert.Equal("[]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new string[0])); Assert.Equal("[]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "" })); Assert.Equal("[ ]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { " " })); Assert.Equal("[1]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "1" })); Assert.Equal("[[], 2, 3]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "[]", "2", "3" })); Assert.Equal("[, , ]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "", "", "" })); } [Fact] public void Cast() { var source = @"class C { }"; var runtime = new DkmClrRuntimeInstance(ReflectionUtilities.GetMscorlib(GetAssembly(source))); using (runtime.Load()) { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); var type = runtime.GetType("C"); Assert.Equal("(C)o", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.None)); Assert.Equal("o as C", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("(C)(o)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeArgument)); Assert.Equal("(o) as C", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeArgument | DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("((C)o)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression)); Assert.Equal("(o as C)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("((C)(o))", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ParenthesizeArgument)); Assert.Equal("((o) as C)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ParenthesizeArgument | DkmClrCastExpressionOptions.ConditionalCast)); // Some of the same tests with "..." as the expression ("..." is used // by the debugger when the expression cannot be determined). Assert.Equal("(C)...", fullNameProvider.GetClrCastExpression(inspectionContext, "...", type, null, DkmClrCastExpressionOptions.None)); Assert.Equal("... as C", fullNameProvider.GetClrCastExpression(inspectionContext, "...", type, null, DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("(... as C)", fullNameProvider.GetClrCastExpression(inspectionContext, "...", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ConditionalCast)); } } [Fact] public void RootComment() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a // Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult(" a // Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a// Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a /*b*/ +c /*d*/// Comment", value); Assert.Equal("(a +c).F", GetChildren(root).Single().FullName); root = FormatResult("a /*//*/+ c// Comment", value); Assert.Equal("(a + c).F", GetChildren(root).Single().FullName); root = FormatResult("a /*/**/+ c// Comment", value); Assert.Equal("(a + c).F", GetChildren(root).Single().FullName); root = FormatResult("/**/a// Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); // See https://dev.azure.com/devdiv/DevDiv/_workitems/edit/847849 root = FormatResult(@"""a//b/*"" // c", value); Assert.Equal(@"(""a//b/*"").F", GetChildren(root).Single().FullName); // incorrect - see https://github.com/dotnet/roslyn/issues/37536 root = FormatResult(@"""a"" //""b", value); Assert.Equal(@"(""a"" //""b).F", GetChildren(root).Single().FullName); } [Fact] public void RootFormatSpecifiers() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a, raw", value); // simple Assert.Equal("a, raw", root.FullName); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a, raw, ac, h", value); // multiple specifiers Assert.Equal("a, raw, ac, h", root.FullName); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("M(a, b), raw", value); // non-specifier comma Assert.Equal("M(a, b), raw", root.FullName); Assert.Equal("M(a, b).F", GetChildren(root).Single().FullName); root = FormatResult("a, raw1", value); // alpha-numeric Assert.Equal("a, raw1", root.FullName); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a, $raw", value); // other punctuation Assert.Equal("a, $raw", root.FullName); Assert.Equal("(a, $raw).F", GetChildren(root).Single().FullName); // not ideal } [Fact] public void RootParentheses() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a + b", value); Assert.Equal("(a + b).F", GetChildren(root).Single().FullName); // required root = FormatResult("new C()", value); Assert.Equal("(new C()).F", GetChildren(root).Single().FullName); // documentation root = FormatResult("A.B", value); Assert.Equal("A.B.F", GetChildren(root).Single().FullName); // desirable root = FormatResult("A::B", value); Assert.Equal("(A::B).F", GetChildren(root).Single().FullName); // documentation } [Fact] public void RootTrailingSemicolons() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a;", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a + b;;", value); Assert.Equal("(a + b).F", GetChildren(root).Single().FullName); root = FormatResult(" M( ) ; ;", value); Assert.Equal("M( ).F", GetChildren(root).Single().FullName); } [Fact] public void RootMixedExtras() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); // Semicolon, then comment. var root = FormatResult("a; //", value); Assert.Equal("a", root.FullName); // Comment, then semicolon. root = FormatResult("a // ;", value); Assert.Equal("a", root.FullName); // Semicolon, then format specifier. root = FormatResult("a;, ac", value); Assert.Equal("a, ac", root.FullName); // Format specifier, then semicolon. root = FormatResult("a, ac;", value); Assert.Equal("a, ac", root.FullName); // Comment, then format specifier. root = FormatResult("a//, ac", value); Assert.Equal("a", root.FullName); // Format specifier, then comment. root = FormatResult("a, ac //", value); Assert.Equal("a, ac", root.FullName); // Everything. root = FormatResult("/*A*/ a /*B*/ + /*C*/ b /*D*/ ; ; , ac /*E*/, raw // ;, hidden", value); Assert.Equal("a + b, ac, raw", root.FullName); } [Fact, WorkItem(1022165, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1022165")] public void Keywords_Root() { var source = @" class C { void M() { int @namespace = 3; } } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(3); var root = FormatResult("@namespace", value); Verify(root, EvalResult("@namespace", "3", "int", "@namespace")); value = CreateDkmClrValue(assembly.GetType("C").Instantiate()); root = FormatResult("this", value); Verify(root, EvalResult("this", "{C}", "C", "this")); // Verify that keywords aren't escaped by the ResultProvider at the // root level (we would never expect to see "namespace" passed as a // resultName, but this check verifies that we leave them "as is"). root = FormatResult("namespace", CreateDkmClrValue(new object())); Verify(root, EvalResult("namespace", "{object}", "object", "namespace")); } [Fact] public void Keywords_RuntimeType() { var source = @" public class @struct { } public class @namespace : @struct { @struct m = new @if(); } public class @if : @struct { } "; var assembly = GetAssembly(source); var type = assembly.GetType("namespace"); var declaredType = assembly.GetType("struct"); var value = CreateDkmClrValue(type.Instantiate(), type); var root = FormatResult("o", value, new DkmClrType((TypeImpl)declaredType)); Verify(GetChildren(root), EvalResult("m", "{if}", "struct {if}", "((@namespace)o).m", DkmEvaluationResultFlags.CanFavorite)); } [Fact] public void Keywords_ProxyType() { var source = @" using System.Diagnostics; [DebuggerTypeProxy(typeof(@class))] public class @struct { public bool @true = false; } public class @class { public bool @false = true; public @class(@struct s) { } } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("struct").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("@false", "true", "bool", "new @class(o).@false", DkmEvaluationResultFlags.Boolean | DkmEvaluationResultFlags.BooleanTrue), EvalResult("Raw View", null, "", "o, raw", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Data)); var grandChildren = GetChildren(children.Last()); Verify(grandChildren, EvalResult("@true", "false", "bool", "o.@true", DkmEvaluationResultFlags.Boolean)); } [Fact] public void Keywords_MemberAccess() { var source = @" public class @struct { public int @true; } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("struct").Instantiate()); var root = FormatResult("o", value); Verify(GetChildren(root), EvalResult("@true", "0", "int", "o.@true", DkmEvaluationResultFlags.CanFavorite)); } [Fact] public void Keywords_StaticMembers() { var source = @" public class @struct { public static int @true; } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("struct").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "@struct", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("@true", "0", "int", "@struct.@true", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Public)); } [Fact] public void Keywords_ExplicitInterfaceImplementation() { var source = @" namespace @namespace { public interface @interface<T> { int @return { get; set; } } public class @class : @interface<@class> { int @interface<@class>.@return { get; set; } } } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("namespace.class").Instantiate()); var root = FormatResult("instance", value); Verify(GetChildren(root), EvalResult("@namespace.@interface<@namespace.@class>.@return", "0", "int", "((@namespace.@interface<@namespace.@class>)instance).@return")); } [Fact] public void MangledNames_CastRequired() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field public int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public auto ansi beforefieldinit 'NotMangled' extends '<>Mangled' { .field public int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void '<>Mangled'::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("NotMangled").Instantiate()); var root = FormatResult("o", value); Verify(GetChildren(root), EvalResult("x (<>Mangled)", "0", "int", null), EvalResult("x", "0", "int", "o.x", DkmEvaluationResultFlags.CanFavorite)); } [Fact] public void MangledNames_StaticMembers() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field public static int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public auto ansi beforefieldinit 'NotMangled' extends '<>Mangled' { .field public static int32 y .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void '<>Mangled'::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var baseValue = CreateDkmClrValue(assembly.GetType("<>Mangled").Instantiate()); var root = FormatResult("o", baseValue); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null)); var derivedValue = CreateDkmClrValue(assembly.GetType("NotMangled").Instantiate()); root = FormatResult("o", derivedValue); children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "NotMangled", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null, DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Public), EvalResult("y", "0", "int", "NotMangled.y", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Public)); } [Fact] public void MangledNames_ExplicitInterfaceImplementation() { var il = @" .class interface public abstract auto ansi 'abstract.I<>Mangled' { .method public hidebysig newslot specialname abstract virtual instance int32 get_P() cil managed { } .property instance int32 P() { .get instance int32 'abstract.I<>Mangled'::get_P() } } // end of class 'abstract.I<>Mangled' .class public auto ansi beforefieldinit C extends [mscorlib]System.Object implements 'abstract.I<>Mangled' { .method private hidebysig newslot specialname virtual final instance int32 'abstract.I<>Mangled.get_P'() cil managed { .override 'abstract.I<>Mangled'::get_P ldc.i4.1 ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } .property instance int32 'abstract.I<>Mangled.P'() { .get instance int32 C::'abstract.I<>Mangled.get_P'() } .property instance int32 P() { .get instance int32 C::'abstract.I<>Mangled.get_P'() } } // end of class C "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C").Instantiate()); var root = FormatResult("instance", value); Verify(GetChildren(root), EvalResult("P", "1", "int", "instance.P", DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.CanFavorite, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private), EvalResult("abstract.I<>Mangled.P", "1", "int", null, DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private)); } [Fact] public void MangledNames_ArrayElement() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public auto ansi beforefieldinit NotMangled extends [mscorlib]System.Object { .field public class [mscorlib]System.Collections.Generic.IEnumerable`1<class '<>Mangled'> 'array' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 ldc.i4.1 newarr '<>Mangled' stfld class [mscorlib]System.Collections.Generic.IEnumerable`1<class '<>Mangled'> NotMangled::'array' ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("NotMangled").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("array", "{<>Mangled[1]}", "System.Collections.Generic.IEnumerable<<>Mangled> {<>Mangled[]}", "o.array", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.CanFavorite)); Verify(GetChildren(children.Single()), EvalResult("[0]", "null", "<>Mangled", null)); } [Fact] public void MangledNames_Namespace() { var il = @" .class public auto ansi beforefieldinit '<>Mangled.C' extends [mscorlib]System.Object { .field public static int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var baseValue = CreateDkmClrValue(assembly.GetType("<>Mangled.C").Instantiate()); var root = FormatResult("o", baseValue); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null)); } [Fact] public void MangledNames_PointerDereference() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field private static int32* p .method assembly hidebysig specialname rtspecialname instance void .ctor(int64 arg) cil managed { IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0008: ldarg.1 IL_0009: conv.u IL_000a: stsfld int32* '<>Mangled'::p IL_0010: ret } } // end of class '<>Mangled' "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); unsafe { int i = 4; long p = (long)&i; var type = assembly.GetType("<>Mangled"); var rootExpr = "m"; var value = CreateDkmClrValue(type.Instantiate(p)); var evalResult = FormatResult(rootExpr, value); Verify(evalResult, EvalResult(rootExpr, "{<>Mangled}", "<>Mangled", rootExpr, DkmEvaluationResultFlags.Expandable)); var children = GetChildren(evalResult); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); children = GetChildren(children.Single()); Verify(children, EvalResult("p", PointerToString(new IntPtr(p)), "int*", null, DkmEvaluationResultFlags.Expandable)); children = GetChildren(children.Single()); Verify(children, EvalResult("*p", "4", "int", null)); } } [Fact] public void MangledNames_DebuggerTypeProxy() { var il = @" .class public auto ansi beforefieldinit Type extends [mscorlib]System.Object { .custom instance void [mscorlib]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [mscorlib]System.Type) = {type('<>Mangled')} .field public bool x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 ldc.i4.0 stfld bool Type::x ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } // end of method Type::.ctor } // end of class Type .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field public bool y .method public hidebysig specialname rtspecialname instance void .ctor(class Type s) cil managed { ldarg.0 ldc.i4.1 stfld bool '<>Mangled'::y ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } // end of method '<>Mangled'::.ctor } // end of class '<>Mangled' "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("Type").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("y", "true", "bool", null, DkmEvaluationResultFlags.Boolean | DkmEvaluationResultFlags.BooleanTrue), EvalResult("Raw View", null, "", "o, raw", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Data)); var grandChildren = GetChildren(children.Last()); Verify(grandChildren, EvalResult("x", "false", "bool", "o.x", DkmEvaluationResultFlags.Boolean)); } [Fact] public void GenericTypeWithoutBacktick() { var il = @" .class public auto ansi beforefieldinit C<T> extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C").MakeGenericType(typeof(int)).Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "C<int>", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", "C<int>.x")); } [Fact] public void BackTick_NonGenericType() { var il = @" .class public auto ansi beforefieldinit 'C`1' extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C`1").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null)); } [Fact] public void BackTick_GenericType() { var il = @" .class public auto ansi beforefieldinit 'C`1'<T> extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C`1").MakeGenericType(typeof(int)).Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "C<int>", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", "C<int>.x")); } [Fact] public void BackTick_Member() { // IL doesn't support using generic methods as property accessors so // there's no way to test a "legitimate" backtick in a member name. var il = @" .class public auto ansi beforefieldinit C extends [mscorlib]System.Object { .field public static int32 'x`1' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "C", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x`1", "0", "int", fullName: null)); } [Fact] public void BackTick_FirstCharacter() { var il = @" .class public auto ansi beforefieldinit '`1'<T> extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("`1").MakeGenericType(typeof(int)).Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", fullName: null)); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.ExpressionEvaluator; using Microsoft.VisualStudio.Debugger.ComponentInterfaces; using Microsoft.VisualStudio.Debugger.Clr; using Microsoft.VisualStudio.Debugger.Evaluation; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.UnitTests { public class FullNameTests : CSharpResultProviderTestBase { [Fact] public void Null() { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); Assert.Equal("null", fullNameProvider.GetClrExpressionForNull(inspectionContext)); } [Fact] public void This() { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); Assert.Equal("this", fullNameProvider.GetClrExpressionForThis(inspectionContext)); } [Fact] public void ArrayIndex() { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); Assert.Equal("[]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new string[0])); Assert.Equal("[]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "" })); Assert.Equal("[ ]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { " " })); Assert.Equal("[1]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "1" })); Assert.Equal("[[], 2, 3]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "[]", "2", "3" })); Assert.Equal("[, , ]", fullNameProvider.GetClrArrayIndexExpression(inspectionContext, new[] { "", "", "" })); } [Fact] public void Cast() { var source = @"class C { }"; var runtime = new DkmClrRuntimeInstance(ReflectionUtilities.GetMscorlib(GetAssembly(source))); using (runtime.Load()) { IDkmClrFullNameProvider fullNameProvider = new CSharpFormatter(); var inspectionContext = CreateDkmInspectionContext(); var type = runtime.GetType("C"); Assert.Equal("(C)o", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.None)); Assert.Equal("o as C", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("(C)(o)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeArgument)); Assert.Equal("(o) as C", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeArgument | DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("((C)o)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression)); Assert.Equal("(o as C)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("((C)(o))", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ParenthesizeArgument)); Assert.Equal("((o) as C)", fullNameProvider.GetClrCastExpression(inspectionContext, "o", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ParenthesizeArgument | DkmClrCastExpressionOptions.ConditionalCast)); // Some of the same tests with "..." as the expression ("..." is used // by the debugger when the expression cannot be determined). Assert.Equal("(C)...", fullNameProvider.GetClrCastExpression(inspectionContext, "...", type, null, DkmClrCastExpressionOptions.None)); Assert.Equal("... as C", fullNameProvider.GetClrCastExpression(inspectionContext, "...", type, null, DkmClrCastExpressionOptions.ConditionalCast)); Assert.Equal("(... as C)", fullNameProvider.GetClrCastExpression(inspectionContext, "...", type, null, DkmClrCastExpressionOptions.ParenthesizeEntireExpression | DkmClrCastExpressionOptions.ConditionalCast)); } } [Fact] public void RootComment() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a // Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult(" a // Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a// Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a /*b*/ +c /*d*/// Comment", value); Assert.Equal("(a +c).F", GetChildren(root).Single().FullName); root = FormatResult("a /*//*/+ c// Comment", value); Assert.Equal("(a + c).F", GetChildren(root).Single().FullName); root = FormatResult("a /*/**/+ c// Comment", value); Assert.Equal("(a + c).F", GetChildren(root).Single().FullName); root = FormatResult("/**/a// Comment", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); // See https://dev.azure.com/devdiv/DevDiv/_workitems/edit/847849 root = FormatResult(@"""a//b/*"" // c", value); Assert.Equal(@"(""a//b/*"").F", GetChildren(root).Single().FullName); // incorrect - see https://github.com/dotnet/roslyn/issues/37536 root = FormatResult(@"""a"" //""b", value); Assert.Equal(@"(""a"" //""b).F", GetChildren(root).Single().FullName); } [Fact] public void RootFormatSpecifiers() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a, raw", value); // simple Assert.Equal("a, raw", root.FullName); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a, raw, ac, h", value); // multiple specifiers Assert.Equal("a, raw, ac, h", root.FullName); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("M(a, b), raw", value); // non-specifier comma Assert.Equal("M(a, b), raw", root.FullName); Assert.Equal("M(a, b).F", GetChildren(root).Single().FullName); root = FormatResult("a, raw1", value); // alpha-numeric Assert.Equal("a, raw1", root.FullName); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a, $raw", value); // other punctuation Assert.Equal("a, $raw", root.FullName); Assert.Equal("(a, $raw).F", GetChildren(root).Single().FullName); // not ideal } [Fact] public void RootParentheses() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a + b", value); Assert.Equal("(a + b).F", GetChildren(root).Single().FullName); // required root = FormatResult("new C()", value); Assert.Equal("(new C()).F", GetChildren(root).Single().FullName); // documentation root = FormatResult("A.B", value); Assert.Equal("A.B.F", GetChildren(root).Single().FullName); // desirable root = FormatResult("A::B", value); Assert.Equal("(A::B).F", GetChildren(root).Single().FullName); // documentation } [Fact] public void RootTrailingSemicolons() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); var root = FormatResult("a;", value); Assert.Equal("a.F", GetChildren(root).Single().FullName); root = FormatResult("a + b;;", value); Assert.Equal("(a + b).F", GetChildren(root).Single().FullName); root = FormatResult(" M( ) ; ;", value); Assert.Equal("M( ).F", GetChildren(root).Single().FullName); } [Fact] public void RootMixedExtras() { var source = @" class C { public int F; } "; var assembly = GetAssembly(source); var type = assembly.GetType("C"); var value = CreateDkmClrValue(type.Instantiate()); // Semicolon, then comment. var root = FormatResult("a; //", value); Assert.Equal("a", root.FullName); // Comment, then semicolon. root = FormatResult("a // ;", value); Assert.Equal("a", root.FullName); // Semicolon, then format specifier. root = FormatResult("a;, ac", value); Assert.Equal("a, ac", root.FullName); // Format specifier, then semicolon. root = FormatResult("a, ac;", value); Assert.Equal("a, ac", root.FullName); // Comment, then format specifier. root = FormatResult("a//, ac", value); Assert.Equal("a", root.FullName); // Format specifier, then comment. root = FormatResult("a, ac //", value); Assert.Equal("a, ac", root.FullName); // Everything. root = FormatResult("/*A*/ a /*B*/ + /*C*/ b /*D*/ ; ; , ac /*E*/, raw // ;, hidden", value); Assert.Equal("a + b, ac, raw", root.FullName); } [Fact, WorkItem(1022165, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1022165")] public void Keywords_Root() { var source = @" class C { void M() { int @namespace = 3; } } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(3); var root = FormatResult("@namespace", value); Verify(root, EvalResult("@namespace", "3", "int", "@namespace")); value = CreateDkmClrValue(assembly.GetType("C").Instantiate()); root = FormatResult("this", value); Verify(root, EvalResult("this", "{C}", "C", "this")); // Verify that keywords aren't escaped by the ResultProvider at the // root level (we would never expect to see "namespace" passed as a // resultName, but this check verifies that we leave them "as is"). root = FormatResult("namespace", CreateDkmClrValue(new object())); Verify(root, EvalResult("namespace", "{object}", "object", "namespace")); } [Fact] public void Keywords_RuntimeType() { var source = @" public class @struct { } public class @namespace : @struct { @struct m = new @if(); } public class @if : @struct { } "; var assembly = GetAssembly(source); var type = assembly.GetType("namespace"); var declaredType = assembly.GetType("struct"); var value = CreateDkmClrValue(type.Instantiate(), type); var root = FormatResult("o", value, new DkmClrType((TypeImpl)declaredType)); Verify(GetChildren(root), EvalResult("m", "{if}", "struct {if}", "((@namespace)o).m", DkmEvaluationResultFlags.CanFavorite)); } [Fact] public void Keywords_ProxyType() { var source = @" using System.Diagnostics; [DebuggerTypeProxy(typeof(@class))] public class @struct { public bool @true = false; } public class @class { public bool @false = true; public @class(@struct s) { } } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("struct").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("@false", "true", "bool", "new @class(o).@false", DkmEvaluationResultFlags.Boolean | DkmEvaluationResultFlags.BooleanTrue), EvalResult("Raw View", null, "", "o, raw", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Data)); var grandChildren = GetChildren(children.Last()); Verify(grandChildren, EvalResult("@true", "false", "bool", "o.@true", DkmEvaluationResultFlags.Boolean)); } [Fact] public void Keywords_MemberAccess() { var source = @" public class @struct { public int @true; } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("struct").Instantiate()); var root = FormatResult("o", value); Verify(GetChildren(root), EvalResult("@true", "0", "int", "o.@true", DkmEvaluationResultFlags.CanFavorite)); } [Fact] public void Keywords_StaticMembers() { var source = @" public class @struct { public static int @true; } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("struct").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "@struct", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("@true", "0", "int", "@struct.@true", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Public)); } [Fact] public void Keywords_ExplicitInterfaceImplementation() { var source = @" namespace @namespace { public interface @interface<T> { int @return { get; set; } } public class @class : @interface<@class> { int @interface<@class>.@return { get; set; } } } "; var assembly = GetAssembly(source); var value = CreateDkmClrValue(assembly.GetType("namespace.class").Instantiate()); var root = FormatResult("instance", value); Verify(GetChildren(root), EvalResult("@namespace.@interface<@namespace.@class>.@return", "0", "int", "((@namespace.@interface<@namespace.@class>)instance).@return")); } [Fact] public void MangledNames_CastRequired() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field public int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public auto ansi beforefieldinit 'NotMangled' extends '<>Mangled' { .field public int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void '<>Mangled'::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("NotMangled").Instantiate()); var root = FormatResult("o", value); Verify(GetChildren(root), EvalResult("x (<>Mangled)", "0", "int", null), EvalResult("x", "0", "int", "o.x", DkmEvaluationResultFlags.CanFavorite)); } [Fact] public void MangledNames_StaticMembers() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field public static int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public auto ansi beforefieldinit 'NotMangled' extends '<>Mangled' { .field public static int32 y .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void '<>Mangled'::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var baseValue = CreateDkmClrValue(assembly.GetType("<>Mangled").Instantiate()); var root = FormatResult("o", baseValue); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null)); var derivedValue = CreateDkmClrValue(assembly.GetType("NotMangled").Instantiate()); root = FormatResult("o", derivedValue); children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "NotMangled", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null, DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Public), EvalResult("y", "0", "int", "NotMangled.y", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Public)); } [Fact] public void MangledNames_ExplicitInterfaceImplementation() { var il = @" .class interface public abstract auto ansi 'abstract.I<>Mangled' { .method public hidebysig newslot specialname abstract virtual instance int32 get_P() cil managed { } .property instance int32 P() { .get instance int32 'abstract.I<>Mangled'::get_P() } } // end of class 'abstract.I<>Mangled' .class public auto ansi beforefieldinit C extends [mscorlib]System.Object implements 'abstract.I<>Mangled' { .method private hidebysig newslot specialname virtual final instance int32 'abstract.I<>Mangled.get_P'() cil managed { .override 'abstract.I<>Mangled'::get_P ldc.i4.1 ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } .property instance int32 'abstract.I<>Mangled.P'() { .get instance int32 C::'abstract.I<>Mangled.get_P'() } .property instance int32 P() { .get instance int32 C::'abstract.I<>Mangled.get_P'() } } // end of class C "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C").Instantiate()); var root = FormatResult("instance", value); Verify(GetChildren(root), EvalResult("P", "1", "int", "instance.P", DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.CanFavorite, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private), EvalResult("abstract.I<>Mangled.P", "1", "int", null, DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private)); } [Fact] public void MangledNames_ArrayElement() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public auto ansi beforefieldinit NotMangled extends [mscorlib]System.Object { .field public class [mscorlib]System.Collections.Generic.IEnumerable`1<class '<>Mangled'> 'array' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 ldc.i4.1 newarr '<>Mangled' stfld class [mscorlib]System.Collections.Generic.IEnumerable`1<class '<>Mangled'> NotMangled::'array' ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("NotMangled").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("array", "{<>Mangled[1]}", "System.Collections.Generic.IEnumerable<<>Mangled> {<>Mangled[]}", "o.array", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.CanFavorite)); Verify(GetChildren(children.Single()), EvalResult("[0]", "null", "<>Mangled", null)); } [Fact] public void MangledNames_Namespace() { var il = @" .class public auto ansi beforefieldinit '<>Mangled.C' extends [mscorlib]System.Object { .field public static int32 x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var baseValue = CreateDkmClrValue(assembly.GetType("<>Mangled.C").Instantiate()); var root = FormatResult("o", baseValue); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null)); } [Fact] public void MangledNames_PointerDereference() { var il = @" .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field private static int32* p .method assembly hidebysig specialname rtspecialname instance void .ctor(int64 arg) cil managed { IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0008: ldarg.1 IL_0009: conv.u IL_000a: stsfld int32* '<>Mangled'::p IL_0010: ret } } // end of class '<>Mangled' "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); unsafe { int i = 4; long p = (long)&i; var type = assembly.GetType("<>Mangled"); var rootExpr = "m"; var value = CreateDkmClrValue(type.Instantiate(p)); var evalResult = FormatResult(rootExpr, value); Verify(evalResult, EvalResult(rootExpr, "{<>Mangled}", "<>Mangled", rootExpr, DkmEvaluationResultFlags.Expandable)); var children = GetChildren(evalResult); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); children = GetChildren(children.Single()); Verify(children, EvalResult("p", PointerToString(new IntPtr(p)), "int*", null, DkmEvaluationResultFlags.Expandable)); children = GetChildren(children.Single()); Verify(children, EvalResult("*p", "4", "int", null)); } } [Fact] public void MangledNames_DebuggerTypeProxy() { var il = @" .class public auto ansi beforefieldinit Type extends [mscorlib]System.Object { .custom instance void [mscorlib]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [mscorlib]System.Type) = {type('<>Mangled')} .field public bool x .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 ldc.i4.0 stfld bool Type::x ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } // end of method Type::.ctor } // end of class Type .class public auto ansi beforefieldinit '<>Mangled' extends [mscorlib]System.Object { .field public bool y .method public hidebysig specialname rtspecialname instance void .ctor(class Type s) cil managed { ldarg.0 ldc.i4.1 stfld bool '<>Mangled'::y ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } // end of method '<>Mangled'::.ctor } // end of class '<>Mangled' "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("Type").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("y", "true", "bool", null, DkmEvaluationResultFlags.Boolean | DkmEvaluationResultFlags.BooleanTrue), EvalResult("Raw View", null, "", "o, raw", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Data)); var grandChildren = GetChildren(children.Last()); Verify(grandChildren, EvalResult("x", "false", "bool", "o.x", DkmEvaluationResultFlags.Boolean)); } [Fact] public void GenericTypeWithoutBacktick() { var il = @" .class public auto ansi beforefieldinit C<T> extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C").MakeGenericType(typeof(int)).Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "C<int>", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", "C<int>.x")); } [Fact] public void BackTick_NonGenericType() { var il = @" .class public auto ansi beforefieldinit 'C`1' extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C`1").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", null)); } [Fact] public void BackTick_GenericType() { var il = @" .class public auto ansi beforefieldinit 'C`1'<T> extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C`1").MakeGenericType(typeof(int)).Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "C<int>", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", "C<int>.x")); } [Fact] public void BackTick_Member() { // IL doesn't support using generic methods as property accessors so // there's no way to test a "legitimate" backtick in a member name. var il = @" .class public auto ansi beforefieldinit C extends [mscorlib]System.Object { .field public static int32 'x`1' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("C").Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", "C", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x`1", "0", "int", fullName: null)); } [Fact] public void BackTick_FirstCharacter() { var il = @" .class public auto ansi beforefieldinit '`1'<T> extends [mscorlib]System.Object { .field public static int32 'x' .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } "; ImmutableArray<byte> assemblyBytes; ImmutableArray<byte> pdbBytes; CSharpTestBase.EmitILToArray(il, appendDefaultHeader: true, includePdb: false, assemblyBytes: out assemblyBytes, pdbBytes: out pdbBytes); var assembly = ReflectionUtilities.Load(assemblyBytes); var value = CreateDkmClrValue(assembly.GetType("`1").MakeGenericType(typeof(int)).Instantiate()); var root = FormatResult("o", value); var children = GetChildren(root); Verify(children, EvalResult("Static members", null, "", null, DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class)); Verify(GetChildren(children.Single()), EvalResult("x", "0", "int", fullName: null)); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/CodeStyle/VisualBasic/CodeFixes/PublicAPI.Unshipped.txt
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Core/Portable/MetadataReference/AssemblyIdentityExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Reflection; namespace Microsoft.CodeAnalysis { internal static class AssemblyIdentityExtensions { // Windows.*[.winmd] internal static bool IsWindowsComponent(this AssemblyIdentity identity) { return (identity.ContentType == AssemblyContentType.WindowsRuntime) && identity.Name.StartsWith("windows.", StringComparison.OrdinalIgnoreCase); } // Windows[.winmd] internal static bool IsWindowsRuntime(this AssemblyIdentity identity) { return (identity.ContentType == AssemblyContentType.WindowsRuntime) && string.Equals(identity.Name, "windows", StringComparison.OrdinalIgnoreCase); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Reflection; namespace Microsoft.CodeAnalysis { internal static class AssemblyIdentityExtensions { // Windows.*[.winmd] internal static bool IsWindowsComponent(this AssemblyIdentity identity) { return (identity.ContentType == AssemblyContentType.WindowsRuntime) && identity.Name.StartsWith("windows.", StringComparison.OrdinalIgnoreCase); } // Windows[.winmd] internal static bool IsWindowsRuntime(this AssemblyIdentity identity) { return (identity.ContentType == AssemblyContentType.WindowsRuntime) && string.Equals(identity.Name, "windows", StringComparison.OrdinalIgnoreCase); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Xunit; namespace Microsoft.CodeAnalysis.Editor.UnitTests.CodeRefactoringService { [UseExportProvider] public class CodeRefactoringServiceTest { [Fact] public async Task TestExceptionInComputeRefactorings() => await VerifyRefactoringDisabledAsync<ErrorCases.ExceptionInCodeActions>(); [Fact] public async Task TestExceptionInComputeRefactoringsAsync() => await VerifyRefactoringDisabledAsync<ErrorCases.ExceptionInComputeRefactoringsAsync>(); [Fact] public async Task TestProjectRefactoringAsync() { var code = @" a "; using var workspace = TestWorkspace.CreateCSharp(code, composition: FeaturesTestCompositions.Features); var refactoringService = workspace.GetService<ICodeRefactoringService>(); var reference = new StubAnalyzerReference(); var project = workspace.CurrentSolution.Projects.Single().AddAnalyzerReference(reference); var document = project.Documents.Single(); var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); var stubRefactoringAction = refactorings.Single(refactoring => refactoring.CodeActions.FirstOrDefault().action?.Title == nameof(StubRefactoring)); Assert.True(stubRefactoringAction is object); } private static async Task VerifyRefactoringDisabledAsync<T>() where T : CodeRefactoringProvider { using var workspace = TestWorkspace.CreateCSharp(@"class Program {}", composition: EditorTestCompositions.EditorFeatures.AddParts(typeof(T))); var errorReportingService = (TestErrorReportingService)workspace.Services.GetRequiredService<IErrorReportingService>(); var errorReported = false; errorReportingService.OnError = message => errorReported = true; var refactoringService = workspace.GetService<ICodeRefactoringService>(); var codeRefactoring = workspace.ExportProvider.GetExportedValues<CodeRefactoringProvider>().OfType<T>().Single(); var project = workspace.CurrentSolution.Projects.Single(); var document = project.Documents.Single(); var extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>(); var result = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); Assert.True(extensionManager.IsDisabled(codeRefactoring)); Assert.False(extensionManager.IsIgnored(codeRefactoring)); Assert.True(errorReported); } internal class StubRefactoring : CodeRefactoringProvider { public override Task ComputeRefactoringsAsync(CodeRefactoringContext context) { context.RegisterRefactoring(CodeAction.Create( nameof(StubRefactoring), cancellationToken => Task.FromResult(context.Document), equivalenceKey: nameof(StubRefactoring))); return Task.CompletedTask; } } private class StubAnalyzerReference : AnalyzerReference, ICodeRefactoringProviderFactory { public readonly CodeRefactoringProvider Refactoring; public StubAnalyzerReference() => Refactoring = new StubRefactoring(); public StubAnalyzerReference(CodeRefactoringProvider codeRefactoring) => Refactoring = codeRefactoring; public override string Display => nameof(StubAnalyzerReference); public override string FullPath => string.Empty; public override object Id => nameof(StubAnalyzerReference); public override ImmutableArray<DiagnosticAnalyzer> GetAnalyzers(string language) => ImmutableArray<DiagnosticAnalyzer>.Empty; public override ImmutableArray<DiagnosticAnalyzer> GetAnalyzersForAllLanguages() => ImmutableArray<DiagnosticAnalyzer>.Empty; public ImmutableArray<CodeRefactoringProvider> GetRefactorings() => ImmutableArray.Create(Refactoring); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Xunit; namespace Microsoft.CodeAnalysis.Editor.UnitTests.CodeRefactoringService { [UseExportProvider] public class CodeRefactoringServiceTest { [Fact] public async Task TestExceptionInComputeRefactorings() => await VerifyRefactoringDisabledAsync<ErrorCases.ExceptionInCodeActions>(); [Fact] public async Task TestExceptionInComputeRefactoringsAsync() => await VerifyRefactoringDisabledAsync<ErrorCases.ExceptionInComputeRefactoringsAsync>(); [Fact] public async Task TestProjectRefactoringAsync() { var code = @" a "; using var workspace = TestWorkspace.CreateCSharp(code, composition: FeaturesTestCompositions.Features); var refactoringService = workspace.GetService<ICodeRefactoringService>(); var reference = new StubAnalyzerReference(); var project = workspace.CurrentSolution.Projects.Single().AddAnalyzerReference(reference); var document = project.Documents.Single(); var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); var stubRefactoringAction = refactorings.Single(refactoring => refactoring.CodeActions.FirstOrDefault().action?.Title == nameof(StubRefactoring)); Assert.True(stubRefactoringAction is object); } private static async Task VerifyRefactoringDisabledAsync<T>() where T : CodeRefactoringProvider { using var workspace = TestWorkspace.CreateCSharp(@"class Program {}", composition: EditorTestCompositions.EditorFeatures.AddParts(typeof(T))); var errorReportingService = (TestErrorReportingService)workspace.Services.GetRequiredService<IErrorReportingService>(); var errorReported = false; errorReportingService.OnError = message => errorReported = true; var refactoringService = workspace.GetService<ICodeRefactoringService>(); var codeRefactoring = workspace.ExportProvider.GetExportedValues<CodeRefactoringProvider>().OfType<T>().Single(); var project = workspace.CurrentSolution.Projects.Single(); var document = project.Documents.Single(); var extensionManager = (EditorLayerExtensionManager.ExtensionManager)document.Project.Solution.Workspace.Services.GetRequiredService<IExtensionManager>(); var result = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); Assert.True(extensionManager.IsDisabled(codeRefactoring)); Assert.False(extensionManager.IsIgnored(codeRefactoring)); Assert.True(errorReported); } internal class StubRefactoring : CodeRefactoringProvider { public override Task ComputeRefactoringsAsync(CodeRefactoringContext context) { context.RegisterRefactoring(CodeAction.Create( nameof(StubRefactoring), cancellationToken => Task.FromResult(context.Document), equivalenceKey: nameof(StubRefactoring))); return Task.CompletedTask; } } private class StubAnalyzerReference : AnalyzerReference, ICodeRefactoringProviderFactory { public readonly CodeRefactoringProvider Refactoring; public StubAnalyzerReference() => Refactoring = new StubRefactoring(); public StubAnalyzerReference(CodeRefactoringProvider codeRefactoring) => Refactoring = codeRefactoring; public override string Display => nameof(StubAnalyzerReference); public override string FullPath => string.Empty; public override object Id => nameof(StubAnalyzerReference); public override ImmutableArray<DiagnosticAnalyzer> GetAnalyzers(string language) => ImmutableArray<DiagnosticAnalyzer>.Empty; public override ImmutableArray<DiagnosticAnalyzer> GetAnalyzersForAllLanguages() => ImmutableArray<DiagnosticAnalyzer>.Empty; public ImmutableArray<CodeRefactoringProvider> GetRefactorings() => ImmutableArray.Create(Refactoring); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Workspaces/Core/MSBuild/MSBuild/ProjectFile/IProjectFile.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.MSBuild.Logging; namespace Microsoft.CodeAnalysis.MSBuild { /// <summary> /// Represents a project file loaded from disk. /// </summary> internal interface IProjectFile { /// <summary> /// The path to the project file. /// </summary> string FilePath { get; } /// <summary> /// The error message produced when a failure occurred attempting to access the project file. /// If a failure occurred the project file info will be inaccessible. /// </summary> DiagnosticLog Log { get; } /// <summary> /// Gets project file information asynchronously. Note that this can produce multiple /// instances of <see cref="ProjectFileInfo"/> if the project is multi-targeted: one for /// each target framework. /// </summary> Task<ImmutableArray<ProjectFileInfo>> GetProjectFileInfosAsync(CancellationToken cancellationToken); /// <summary> /// Gets the corresponding extension for a source file of a given kind. /// </summary> string GetDocumentExtension(SourceCodeKind kind); /// <summary> /// Add a source document to a project file. /// </summary> void AddDocument(string filePath, string? logicalPath = null); /// <summary> /// Remove a source document from a project file. /// </summary> void RemoveDocument(string filePath); /// <summary> /// Add a metadata reference to a project file. /// </summary> void AddMetadataReference(MetadataReference reference, AssemblyIdentity identity); /// <summary> /// Remove a metadata reference from a project file. /// </summary> void RemoveMetadataReference(MetadataReference reference, AssemblyIdentity identity); /// <summary> /// Add a reference to another project to a project file. /// </summary> void AddProjectReference(string projectName, ProjectFileReference reference); /// <summary> /// Remove a reference to another project from a project file. /// </summary> void RemoveProjectReference(string projectName, string projectFilePath); /// <summary> /// Add an analyzer reference to the project file. /// </summary> void AddAnalyzerReference(AnalyzerReference reference); /// <summary> /// Remove an analyzer reference from the project file. /// </summary> void RemoveAnalyzerReference(AnalyzerReference reference); /// <summary> /// Save the current state of the project file to disk. /// </summary> void Save(); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.MSBuild.Logging; namespace Microsoft.CodeAnalysis.MSBuild { /// <summary> /// Represents a project file loaded from disk. /// </summary> internal interface IProjectFile { /// <summary> /// The path to the project file. /// </summary> string FilePath { get; } /// <summary> /// The error message produced when a failure occurred attempting to access the project file. /// If a failure occurred the project file info will be inaccessible. /// </summary> DiagnosticLog Log { get; } /// <summary> /// Gets project file information asynchronously. Note that this can produce multiple /// instances of <see cref="ProjectFileInfo"/> if the project is multi-targeted: one for /// each target framework. /// </summary> Task<ImmutableArray<ProjectFileInfo>> GetProjectFileInfosAsync(CancellationToken cancellationToken); /// <summary> /// Gets the corresponding extension for a source file of a given kind. /// </summary> string GetDocumentExtension(SourceCodeKind kind); /// <summary> /// Add a source document to a project file. /// </summary> void AddDocument(string filePath, string? logicalPath = null); /// <summary> /// Remove a source document from a project file. /// </summary> void RemoveDocument(string filePath); /// <summary> /// Add a metadata reference to a project file. /// </summary> void AddMetadataReference(MetadataReference reference, AssemblyIdentity identity); /// <summary> /// Remove a metadata reference from a project file. /// </summary> void RemoveMetadataReference(MetadataReference reference, AssemblyIdentity identity); /// <summary> /// Add a reference to another project to a project file. /// </summary> void AddProjectReference(string projectName, ProjectFileReference reference); /// <summary> /// Remove a reference to another project from a project file. /// </summary> void RemoveProjectReference(string projectName, string projectFilePath); /// <summary> /// Add an analyzer reference to the project file. /// </summary> void AddAnalyzerReference(AnalyzerReference reference); /// <summary> /// Remove an analyzer reference from the project file. /// </summary> void RemoveAnalyzerReference(AnalyzerReference reference); /// <summary> /// Save the current state of the project file to disk. /// </summary> void Save(); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Scripting/CSharp/xlf/CSharpScriptingResources.it.xlf
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="it" original="../CSharpScriptingResources.resx"> <body> <trans-unit id="LogoLine1"> <source>Microsoft (R) Visual C# Interactive Compiler version {0}</source> <target state="translated">Compilatore Microsoft (R) Visual C# Interactive versione {0}</target> <note /> </trans-unit> <trans-unit id="LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.</target> <note /> </trans-unit> <trans-unit id="InteractiveHelp"> <source>Usage: csi [option] ... [script-file.csx] [script-argument] ... Executes script-file.csx if specified, otherwise launches an interactive REPL (Read Eval Print Loop). Options: /help Display this usage message (alternative form: /?) /version Display the version and exit /i Drop to REPL after executing the specified script. /r:&lt;file&gt; Reference metadata from the specified assembly file (alternative form: /reference) /r:&lt;file list&gt; Reference metadata from the specified assembly files (alternative form: /reference) /lib:&lt;path list&gt; List of directories where to look for libraries specified by #r directive. (alternative forms: /libPath /libPaths) /u:&lt;namespace&gt; Define global namespace using (alternative forms: /using, /usings, /import, /imports) /langversion:? Display the allowed values for language version and exit /langversion:&lt;string&gt; Specify language version such as `latest` (latest version, including minor versions), `default` (same as `latest`), `latestmajor` (latest version, excluding minor versions), `preview` (latest version, including features in unsupported preview), or specific versions like `6` or `7.1` @&lt;file&gt; Read response file for more options -- Indicates that the remaining arguments should not be treated as options. </source> <target state="translated">Sintassi: csi [opzione] ... [file-script.csx] [argomento-script] ... Esegue il file-script.csx se specificato; in caso contrario, avvia un REPL (Read Eval Print Loop) interattivo. Opzioni: /help Visualizza questo messaggio relativo alla sintassi. Forma alternativa: -? /version Visualizza la versione ed esce /i Rilascia in REPL dopo l'esecuzione dello script specificato. /r:&lt;file&gt; Crea un riferimento ai metadati dal file di assembly specificato. Forma alternativa: /reference /r:&lt;elenco file&gt; Crea un riferimento ai metadati dai file di assembly specificati. Forma alternativa: /reference /lib:&lt;elenco percorsi&gt; Elenco di directory in cui cercare le librerie specificate dalla direttiva #r. Forme alternative: /libPath /libPaths /u:&lt;spazio dei nomi&gt; Definisce l'istruzione using per lo spazio dei nomi globale. Forme alternative: /using, /usings, /import, /imports /langversion:? Visualizza i valori consentiti per la versione del linguaggio ed esce /langversion:&lt;stringa&gt; Specifica la versione del linguaggio come `latest` (ultima versione, include le versioni secondarie), `default` (uguale a `latest`), `latestmajor` (ultima versione, escluse le versioni secondarie), `preview` (ultima versione, incluse le funzionalità dell'anteprima non supportata), o versioni specifiche, come `6` o `7.1` @&lt;file&gt; Legge il file di risposta per altre opzioni -- Indica che gli argomenti rimanenti non devono essere considerati come opzioni. </target> <note /> </trans-unit> </body> </file> </xliff>
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="it" original="../CSharpScriptingResources.resx"> <body> <trans-unit id="LogoLine1"> <source>Microsoft (R) Visual C# Interactive Compiler version {0}</source> <target state="translated">Compilatore Microsoft (R) Visual C# Interactive versione {0}</target> <note /> </trans-unit> <trans-unit id="LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.</target> <note /> </trans-unit> <trans-unit id="InteractiveHelp"> <source>Usage: csi [option] ... [script-file.csx] [script-argument] ... Executes script-file.csx if specified, otherwise launches an interactive REPL (Read Eval Print Loop). Options: /help Display this usage message (alternative form: /?) /version Display the version and exit /i Drop to REPL after executing the specified script. /r:&lt;file&gt; Reference metadata from the specified assembly file (alternative form: /reference) /r:&lt;file list&gt; Reference metadata from the specified assembly files (alternative form: /reference) /lib:&lt;path list&gt; List of directories where to look for libraries specified by #r directive. (alternative forms: /libPath /libPaths) /u:&lt;namespace&gt; Define global namespace using (alternative forms: /using, /usings, /import, /imports) /langversion:? Display the allowed values for language version and exit /langversion:&lt;string&gt; Specify language version such as `latest` (latest version, including minor versions), `default` (same as `latest`), `latestmajor` (latest version, excluding minor versions), `preview` (latest version, including features in unsupported preview), or specific versions like `6` or `7.1` @&lt;file&gt; Read response file for more options -- Indicates that the remaining arguments should not be treated as options. </source> <target state="translated">Sintassi: csi [opzione] ... [file-script.csx] [argomento-script] ... Esegue il file-script.csx se specificato; in caso contrario, avvia un REPL (Read Eval Print Loop) interattivo. Opzioni: /help Visualizza questo messaggio relativo alla sintassi. Forma alternativa: -? /version Visualizza la versione ed esce /i Rilascia in REPL dopo l'esecuzione dello script specificato. /r:&lt;file&gt; Crea un riferimento ai metadati dal file di assembly specificato. Forma alternativa: /reference /r:&lt;elenco file&gt; Crea un riferimento ai metadati dai file di assembly specificati. Forma alternativa: /reference /lib:&lt;elenco percorsi&gt; Elenco di directory in cui cercare le librerie specificate dalla direttiva #r. Forme alternative: /libPath /libPaths /u:&lt;spazio dei nomi&gt; Definisce l'istruzione using per lo spazio dei nomi globale. Forme alternative: /using, /usings, /import, /imports /langversion:? Visualizza i valori consentiti per la versione del linguaggio ed esce /langversion:&lt;stringa&gt; Specifica la versione del linguaggio come `latest` (ultima versione, include le versioni secondarie), `default` (uguale a `latest`), `latestmajor` (ultima versione, escluse le versioni secondarie), `preview` (ultima versione, incluse le funzionalità dell'anteprima non supportata), o versioni specifiche, come `6` o `7.1` @&lt;file&gt; Legge il file di risposta per altre opzioni -- Indica che gli argomenti rimanenti non devono essere considerati come opzioni. </target> <note /> </trans-unit> </body> </file> </xliff>
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/Core/Shared/Extensions/IContentTypeExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.Utilities; namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions { internal static class IContentTypeExtensions { /// <summary> /// Test whether an extension matches a content type. /// </summary> /// <param name="dataContentType">Content type (typically of a text buffer) against which to /// match an extension.</param> /// <param name="extensionContentTypes">Content types from extension metadata.</param> public static bool MatchesAny(this IContentType dataContentType, IEnumerable<string> extensionContentTypes) => extensionContentTypes.Any(v => dataContentType.IsOfType(v)); public static bool MatchesAny(this IContentType dataContentType, params string[] extensionContentTypes) => dataContentType.MatchesAny((IEnumerable<string>)extensionContentTypes); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.Utilities; namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions { internal static class IContentTypeExtensions { /// <summary> /// Test whether an extension matches a content type. /// </summary> /// <param name="dataContentType">Content type (typically of a text buffer) against which to /// match an extension.</param> /// <param name="extensionContentTypes">Content types from extension metadata.</param> public static bool MatchesAny(this IContentType dataContentType, IEnumerable<string> extensionContentTypes) => extensionContentTypes.Any(v => dataContentType.IsOfType(v)); public static bool MatchesAny(this IContentType dataContentType, params string[] extensionContentTypes) => dataContentType.MatchesAny((IEnumerable<string>)extensionContentTypes); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Tools/AnalyzerRunner/AnalyzerRunnerHelper.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Locator; using Microsoft.CodeAnalysis.MSBuild; namespace AnalyzerRunner { public static class AnalyzerRunnerHelper { static AnalyzerRunnerHelper() { // QueryVisualStudioInstances returns Visual Studio installations on .NET Framework, and .NET Core SDK // installations on .NET Core. We use the one with the most recent version. var msBuildInstance = MSBuildLocator.QueryVisualStudioInstances().OrderByDescending(x => x.Version).First(); #if NETCOREAPP // Since we do not inherit msbuild.deps.json when referencing the SDK copy // of MSBuild and because the SDK no longer ships with version matched assemblies, we // register an assembly loader that will load assemblies from the msbuild path with // equal or higher version numbers than requested. LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); #endif MSBuildLocator.RegisterInstance(msBuildInstance); } public static MSBuildWorkspace CreateWorkspace() { var properties = new Dictionary<string, string> { #if NETCOREAPP // This property ensures that XAML files will be compiled in the current AppDomain // rather than a separate one. Any tasks isolated in AppDomains or tasks that create // AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, #endif // Use the latest language version to force the full set of available analyzers to run on the project. { "LangVersion", "latest" }, }; return MSBuildWorkspace.Create(properties, AnalyzerRunnerMefHostServices.DefaultServices); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Locator; using Microsoft.CodeAnalysis.MSBuild; namespace AnalyzerRunner { public static class AnalyzerRunnerHelper { static AnalyzerRunnerHelper() { // QueryVisualStudioInstances returns Visual Studio installations on .NET Framework, and .NET Core SDK // installations on .NET Core. We use the one with the most recent version. var msBuildInstance = MSBuildLocator.QueryVisualStudioInstances().OrderByDescending(x => x.Version).First(); #if NETCOREAPP // Since we do not inherit msbuild.deps.json when referencing the SDK copy // of MSBuild and because the SDK no longer ships with version matched assemblies, we // register an assembly loader that will load assemblies from the msbuild path with // equal or higher version numbers than requested. LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); #endif MSBuildLocator.RegisterInstance(msBuildInstance); } public static MSBuildWorkspace CreateWorkspace() { var properties = new Dictionary<string, string> { #if NETCOREAPP // This property ensures that XAML files will be compiled in the current AppDomain // rather than a separate one. Any tasks isolated in AppDomains or tasks that create // AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, #endif // Use the latest language version to force the full set of available analyzers to run on the project. { "LangVersion", "latest" }, }; return MSBuildWorkspace.Create(properties, AnalyzerRunnerMefHostServices.DefaultServices); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Analyzers/CSharp/Tests/UseDeconstruction/UseDeconstructionTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.UseDeconstruction; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseDeconstruction { public class UseDeconstructionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { public UseDeconstructionTests(ITestOutputHelper logger) : base(logger) { } internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseDeconstructionDiagnosticAnalyzer(), new CSharpUseDeconstructionCodeFixProvider()); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestVar() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfNameInInnerScope() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); { int age; } } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfNameInOuterScope() { await TestMissingInRegularAndScriptAsync( @"class C { int age; void M() { var [|t1|] = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestUpdateReference() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.name + "" "" + t1.age); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); Console.WriteLine(name + "" "" + age); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestTupleType() { await TestInRegularAndScript1Async( @"class C { void M() { (int name, int age) [|t1|] = GetPerson(); Console.WriteLine(t1.name + "" "" + t1.age); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (int name, int age) = GetPerson(); Console.WriteLine(name + "" "" + age); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestVarInForEach() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { foreach (var [|t1|] in GetPeople()) Console.WriteLine(t1.name + "" "" + t1.age); } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { foreach (var (name, age) in GetPeople()) Console.WriteLine(name + "" "" + age); } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestTupleTypeInForEach() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { foreach ((string name, int age) [|t1|] in GetPeople()) Console.WriteLine(t1.name + "" "" + t1.age); } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { foreach ((string name, int age) in GetPeople()) Console.WriteLine(name + "" "" + age); } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll1() { await TestInRegularAndScript1Async( @"class C { void M() { var {|FixAllInDocument:t1|} = GetPerson(); var t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); var t2 = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll2() { await TestInRegularAndScript1Async( @"class C { void M() { var {|FixAllInDocument:t1|} = GetPerson(); } void M2() { var t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); } void M2() { var (name, age) = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll3() { await TestInRegularAndScript1Async( @"class C { void M() { (string name1, int age1) {|FixAllInDocument:t1|} = GetPerson(); (string name2, int age2) t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (string name1, int age1) = GetPerson(); (string name2, int age2) = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll4() { await TestInRegularAndScript1Async( @"class C { void M() { (string name, int age) {|FixAllInDocument:t1|} = GetPerson(); (string name, int age) t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (string name, int age) = GetPerson(); (string name, int age) t2 = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfDefaultTupleNameWithVar() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); } (string, int) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithUserNamesThatMatchDefaultTupleNameWithVar1() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); } (string Item1, int Item2) GetPerson() => default; }", @"class C { void M() { var (Item1, Item2) = GetPerson(); } (string Item1, int Item2) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithUserNamesThatMatchDefaultTupleNameWithVar2() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.Item1); } (string Item1, int Item2) GetPerson() => default; }", @"class C { void M() { var (Item1, Item2) = GetPerson(); Console.WriteLine(Item1); } (string Item1, int Item2) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfDefaultTupleNameWithTupleType() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { (string, int) [|t1|] = GetPerson(); } (string, int) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleIsUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleMethodIsUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.ToString()); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleDefaultElementNameUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.Item1); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleRandomNameUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.Unknown); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestTrivia1() { await TestInRegularAndScript1Async( @"class C { void M() { /*1*/(/*2*/int/*3*/ name, /*4*/int/*5*/ age)/*6*/ [|t1|] = GetPerson(); Console.WriteLine(/*7*/t1.name/*8*/ + "" "" + /*9*/t1.age/*10*/); } (string name, int age) GetPerson() => default; }", @"class C { void M() { /*1*/(/*2*/int/*3*/ name, /*4*/int/*5*/ age)/*6*/ = GetPerson(); Console.WriteLine(/*7*/name/*8*/ + "" "" + /*9*/age/*10*/); } (string name, int age) GetPerson() => default; }"); } [WorkItem(25260, "https://github.com/dotnet/roslyn/issues/25260")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotWithDefaultLiteralInitializer() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { (string name, int age) [|person|] = default; Console.WriteLine(person.name + "" "" + person.age); } }", new TestParameters(parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7_1))); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithDefaultExpressionInitializer() { await TestInRegularAndScript1Async( @"class C { void M() { (string name, int age) [|person|] = default((string, int)); Console.WriteLine(person.name + "" "" + person.age); } }", @"class C { void M() { (string name, int age) = default((string, int)); Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotWithImplicitConversionFromNonTuple() { await TestMissingInRegularAndScriptAsync( @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { (string name, int age) [|person|] = new Person(); Console.WriteLine(person.name + "" "" + person.age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithExplicitImplicitConversionFromNonTuple() { await TestInRegularAndScript1Async( @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { (string name, int age) [|person|] = ((string, int))new Person(); Console.WriteLine(person.name + "" "" + person.age); } }", @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { (string name, int age) = ((string, int))new Person(); Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotWithImplicitConversionFromNonTupleInForEach() { await TestMissingInRegularAndScriptAsync( @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { foreach ((string name, int age) [|person|] in new Person[] { }) Console.WriteLine(person.name + "" "" + person.age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithExplicitImplicitConversionFromNonTupleInForEach() { await TestInRegularAndScript1Async( @"using System.Linq; class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { foreach ((string name, int age) [|person|] in new Person[] { }.Cast<(string, int)>()) Console.WriteLine(person.name + "" "" + person.age); } }", @"using System.Linq; class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { foreach ((string name, int age) in new Person[] { }.Cast<(string, int)>()) Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithTupleLiteralConversion() { await TestInRegularAndScript1Async( @"class C { void M() { (object name, double age) [|person|] = (null, 0); Console.WriteLine(person.name + "" "" + person.age); } }", @"class C { void M() { (object name, double age) = (null, 0); Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithImplicitTupleConversion() { await TestInRegularAndScript1Async( @"class C { void M() { (object name, double age) [|person|] = GetPerson(); Console.WriteLine(person.name + "" "" + person.age); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (object name, double age) = GetPerson(); Console.WriteLine(name + "" "" + age); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithImplicitTupleConversionInForEach() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { foreach ((object name, double age) [|person|] in GetPeople()) Console.WriteLine(person.name + "" "" + person.age); } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { foreach ((object name, double age) in GetPeople()) Console.WriteLine(name + "" "" + age); } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [WorkItem(27251, "https://github.com/dotnet/roslyn/issues/27251")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestEscapedContextualKeywordAsTupleName() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { var collection = new List<(int position, int @delegate)>(); foreach (var it[||]em in collection) { // Do something } } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { var collection = new List<(int position, int @delegate)>(); foreach (var (position, @delegate) in collection) { // Do something } } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [Fact] [WorkItem(42770, "https://github.com/dotnet/roslyn/issues/42770")] [Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestPreserveAwait() { await TestInRegularAndScript1Async( @"using System; using System.Collections.Generic; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { [Goo] await foreach (var [|t|] in Sequence()) { Console.WriteLine(t.x + t.y); } } static async IAsyncEnumerable<(int x, int y)> Sequence() { yield return (0, 0); await Task.Yield(); } }" + IAsyncEnumerable, @"using System; using System.Collections.Generic; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { [Goo] await foreach (var (x, y) in Sequence()) { Console.WriteLine(x + y); } } static async IAsyncEnumerable<(int x, int y)> Sequence() { yield return (0, 0); await Task.Yield(); } }" + IAsyncEnumerable); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.UseDeconstruction; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseDeconstruction { public class UseDeconstructionTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { public UseDeconstructionTests(ITestOutputHelper logger) : base(logger) { } internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseDeconstructionDiagnosticAnalyzer(), new CSharpUseDeconstructionCodeFixProvider()); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestVar() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfNameInInnerScope() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); { int age; } } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfNameInOuterScope() { await TestMissingInRegularAndScriptAsync( @"class C { int age; void M() { var [|t1|] = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestUpdateReference() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.name + "" "" + t1.age); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); Console.WriteLine(name + "" "" + age); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestTupleType() { await TestInRegularAndScript1Async( @"class C { void M() { (int name, int age) [|t1|] = GetPerson(); Console.WriteLine(t1.name + "" "" + t1.age); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (int name, int age) = GetPerson(); Console.WriteLine(name + "" "" + age); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestVarInForEach() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { foreach (var [|t1|] in GetPeople()) Console.WriteLine(t1.name + "" "" + t1.age); } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { foreach (var (name, age) in GetPeople()) Console.WriteLine(name + "" "" + age); } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestTupleTypeInForEach() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { foreach ((string name, int age) [|t1|] in GetPeople()) Console.WriteLine(t1.name + "" "" + t1.age); } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { foreach ((string name, int age) in GetPeople()) Console.WriteLine(name + "" "" + age); } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll1() { await TestInRegularAndScript1Async( @"class C { void M() { var {|FixAllInDocument:t1|} = GetPerson(); var t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); var t2 = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll2() { await TestInRegularAndScript1Async( @"class C { void M() { var {|FixAllInDocument:t1|} = GetPerson(); } void M2() { var t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { var (name, age) = GetPerson(); } void M2() { var (name, age) = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll3() { await TestInRegularAndScript1Async( @"class C { void M() { (string name1, int age1) {|FixAllInDocument:t1|} = GetPerson(); (string name2, int age2) t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (string name1, int age1) = GetPerson(); (string name2, int age2) = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestFixAll4() { await TestInRegularAndScript1Async( @"class C { void M() { (string name, int age) {|FixAllInDocument:t1|} = GetPerson(); (string name, int age) t2 = GetPerson(); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (string name, int age) = GetPerson(); (string name, int age) t2 = GetPerson(); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfDefaultTupleNameWithVar() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); } (string, int) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithUserNamesThatMatchDefaultTupleNameWithVar1() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); } (string Item1, int Item2) GetPerson() => default; }", @"class C { void M() { var (Item1, Item2) = GetPerson(); } (string Item1, int Item2) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithUserNamesThatMatchDefaultTupleNameWithVar2() { await TestInRegularAndScript1Async( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.Item1); } (string Item1, int Item2) GetPerson() => default; }", @"class C { void M() { var (Item1, Item2) = GetPerson(); Console.WriteLine(Item1); } (string Item1, int Item2) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfDefaultTupleNameWithTupleType() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { (string, int) [|t1|] = GetPerson(); } (string, int) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleIsUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleMethodIsUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.ToString()); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleDefaultElementNameUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.Item1); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotIfTupleRandomNameUsed() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { var [|t1|] = GetPerson(); Console.WriteLine(t1.Unknown); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestTrivia1() { await TestInRegularAndScript1Async( @"class C { void M() { /*1*/(/*2*/int/*3*/ name, /*4*/int/*5*/ age)/*6*/ [|t1|] = GetPerson(); Console.WriteLine(/*7*/t1.name/*8*/ + "" "" + /*9*/t1.age/*10*/); } (string name, int age) GetPerson() => default; }", @"class C { void M() { /*1*/(/*2*/int/*3*/ name, /*4*/int/*5*/ age)/*6*/ = GetPerson(); Console.WriteLine(/*7*/name/*8*/ + "" "" + /*9*/age/*10*/); } (string name, int age) GetPerson() => default; }"); } [WorkItem(25260, "https://github.com/dotnet/roslyn/issues/25260")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotWithDefaultLiteralInitializer() { await TestMissingInRegularAndScriptAsync( @"class C { void M() { (string name, int age) [|person|] = default; Console.WriteLine(person.name + "" "" + person.age); } }", new TestParameters(parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7_1))); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithDefaultExpressionInitializer() { await TestInRegularAndScript1Async( @"class C { void M() { (string name, int age) [|person|] = default((string, int)); Console.WriteLine(person.name + "" "" + person.age); } }", @"class C { void M() { (string name, int age) = default((string, int)); Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotWithImplicitConversionFromNonTuple() { await TestMissingInRegularAndScriptAsync( @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { (string name, int age) [|person|] = new Person(); Console.WriteLine(person.name + "" "" + person.age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithExplicitImplicitConversionFromNonTuple() { await TestInRegularAndScript1Async( @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { (string name, int age) [|person|] = ((string, int))new Person(); Console.WriteLine(person.name + "" "" + person.age); } }", @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { (string name, int age) = ((string, int))new Person(); Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestNotWithImplicitConversionFromNonTupleInForEach() { await TestMissingInRegularAndScriptAsync( @"class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { foreach ((string name, int age) [|person|] in new Person[] { }) Console.WriteLine(person.name + "" "" + person.age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithExplicitImplicitConversionFromNonTupleInForEach() { await TestInRegularAndScript1Async( @"using System.Linq; class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { foreach ((string name, int age) [|person|] in new Person[] { }.Cast<(string, int)>()) Console.WriteLine(person.name + "" "" + person.age); } }", @"using System.Linq; class C { class Person { public static implicit operator (string, int)(Person person) => default; } void M() { foreach ((string name, int age) in new Person[] { }.Cast<(string, int)>()) Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithTupleLiteralConversion() { await TestInRegularAndScript1Async( @"class C { void M() { (object name, double age) [|person|] = (null, 0); Console.WriteLine(person.name + "" "" + person.age); } }", @"class C { void M() { (object name, double age) = (null, 0); Console.WriteLine(name + "" "" + age); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithImplicitTupleConversion() { await TestInRegularAndScript1Async( @"class C { void M() { (object name, double age) [|person|] = GetPerson(); Console.WriteLine(person.name + "" "" + person.age); } (string name, int age) GetPerson() => default; }", @"class C { void M() { (object name, double age) = GetPerson(); Console.WriteLine(name + "" "" + age); } (string name, int age) GetPerson() => default; }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestWithImplicitTupleConversionInForEach() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { foreach ((object name, double age) [|person|] in GetPeople()) Console.WriteLine(person.name + "" "" + person.age); } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { foreach ((object name, double age) in GetPeople()) Console.WriteLine(name + "" "" + age); } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [WorkItem(27251, "https://github.com/dotnet/roslyn/issues/27251")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestEscapedContextualKeywordAsTupleName() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; class C { void M() { var collection = new List<(int position, int @delegate)>(); foreach (var it[||]em in collection) { // Do something } } IEnumerable<(string name, int age)> GetPeople() => default; }", @"using System.Collections.Generic; class C { void M() { var collection = new List<(int position, int @delegate)>(); foreach (var (position, @delegate) in collection) { // Do something } } IEnumerable<(string name, int age)> GetPeople() => default; }"); } [Fact] [WorkItem(42770, "https://github.com/dotnet/roslyn/issues/42770")] [Trait(Traits.Feature, Traits.Features.CodeActionsUseDeconstruction)] public async Task TestPreserveAwait() { await TestInRegularAndScript1Async( @"using System; using System.Collections.Generic; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { [Goo] await foreach (var [|t|] in Sequence()) { Console.WriteLine(t.x + t.y); } } static async IAsyncEnumerable<(int x, int y)> Sequence() { yield return (0, 0); await Task.Yield(); } }" + IAsyncEnumerable, @"using System; using System.Collections.Generic; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { [Goo] await foreach (var (x, y) in Sequence()) { Console.WriteLine(x + y); } } static async IAsyncEnumerable<(int x, int y)> Sequence() { yield return (0, 0); await Task.Yield(); } }" + IAsyncEnumerable); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/CodeStyle/CSharp/Tests/Properties/launchSettings.json
{ "profiles": { "xUnit.net Console (32-bit)": { "commandName": "Executable", "executablePath": "$(NuGetPackageRoot)xunit.runner.console\\$(XUnitVersion)\\tools\\net452\\xunit.console.x86.exe", "commandLineArgs": "$(TargetPath) -noshadow -verbose" }, "xUnit.net Console (64-bit)": { "commandName": "Executable", "executablePath": "$(NuGetPackageRoot)xunit.runner.console\\$(XUnitVersion)\\tools\\net452\\xunit.console.exe", "commandLineArgs": "$(TargetPath) -noshadow -verbose" } } }
{ "profiles": { "xUnit.net Console (32-bit)": { "commandName": "Executable", "executablePath": "$(NuGetPackageRoot)xunit.runner.console\\$(XUnitVersion)\\tools\\net452\\xunit.console.x86.exe", "commandLineArgs": "$(TargetPath) -noshadow -verbose" }, "xUnit.net Console (64-bit)": { "commandName": "Executable", "executablePath": "$(NuGetPackageRoot)xunit.runner.console\\$(XUnitVersion)\\tools\\net452\\xunit.console.exe", "commandLineArgs": "$(TargetPath) -noshadow -verbose" } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/VisualBasic/AddImports/VisualBasicAddImportsOnPasteCommandHandler.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.ComponentModel.Composition Imports Microsoft.CodeAnalysis.Editor.Implementation.AddImports Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.VisualStudio.Commanding Imports Microsoft.VisualStudio.Utilities Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.AddImports <Export> <Export(GetType(ICommandHandler))> <ContentType(ContentTypeNames.VisualBasicContentType)> <Name(PredefinedCommandHandlerNames.AddImportsPaste)> <Order(After:=PredefinedCommandHandlerNames.PasteTrackingPaste)> <Order(Before:=PredefinedCommandHandlerNames.FormatDocument)> Friend Class VisualBasicAddImportsOnPasteCommandHandler Inherits AbstractAddImportsPasteCommandHandler <ImportingConstructor> <Obsolete(MefConstruction.ImportingConstructorMessage, True)> Public Sub New(threadingContext As [Shared].Utilities.IThreadingContext) MyBase.New(threadingContext) End Sub Public Overrides ReadOnly Property DisplayName As String = VBEditorResources.Add_Missing_Imports_on_Paste Protected Overrides ReadOnly Property DialogText As String = VBEditorResources.Adding_missing_imports End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.ComponentModel.Composition Imports Microsoft.CodeAnalysis.Editor.Implementation.AddImports Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.VisualStudio.Commanding Imports Microsoft.VisualStudio.Utilities Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.AddImports <Export> <Export(GetType(ICommandHandler))> <ContentType(ContentTypeNames.VisualBasicContentType)> <Name(PredefinedCommandHandlerNames.AddImportsPaste)> <Order(After:=PredefinedCommandHandlerNames.PasteTrackingPaste)> <Order(Before:=PredefinedCommandHandlerNames.FormatDocument)> Friend Class VisualBasicAddImportsOnPasteCommandHandler Inherits AbstractAddImportsPasteCommandHandler <ImportingConstructor> <Obsolete(MefConstruction.ImportingConstructorMessage, True)> Public Sub New(threadingContext As [Shared].Utilities.IThreadingContext) MyBase.New(threadingContext) End Sub Public Overrides ReadOnly Property DisplayName As String = VBEditorResources.Add_Missing_Imports_on_Paste Protected Overrides ReadOnly Property DialogText As String = VBEditorResources.Adding_missing_imports End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.ExtractMethod; using Microsoft.CodeAnalysis.Editor.CSharp.ExtractMethod; using Microsoft.CodeAnalysis.Editor.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests.Extensions; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.ExtractMethod; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ExtractMethod { public partial class ExtractMethodTests : ExtractMethodBase { [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod1() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; i = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { NewMethod(); } private static void NewMethod() { int i = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod2() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i = 10; int i2 = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { NewMethod(); } private static void NewMethod() { int i = 10; int i2 = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod3() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; [|int i2 = i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; NewMethod(i); } private static void NewMethod(int i) { int i2 = i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod4() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; [|i2 += i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; i2 = NewMethod(i); } private static int NewMethod(int i, int i2) { i2 += i; return i2; } }"; // compoundaction not supported yet. await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod5() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; [|i2 = i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; i2 = NewMethod(i); } private static int NewMethod(int i) { return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod6() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { int field; void Test(string[] args) { int i = 10; [|field = i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { int field; void Test(string[] args) { int i = 10; NewMethod(i); } private void NewMethod(int i) { field = i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod7() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { string [] a = null; [|Test(a);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { string[] a = null; NewMethod(a); } private void NewMethod(string[] a) { Test(a); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod8() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Test(string[] args) { string [] a = null; [|Test(a);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Test(string[] args) { string[] a = null; NewMethod(a); } private static void NewMethod(string[] a) { Test(a); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod9() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i; string s; [|i = 10; s = args[0] + i.ToString();|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i; string s; NewMethod(args, out i, out s); } private static void NewMethod(string[] args, out int i, out string s) { i = 10; s = args[0] + i.ToString(); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod10() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; i = 10; string s; s = args[0] + i.ToString();|] Console.WriteLine(s); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { string s = NewMethod(args); Console.WriteLine(s); } private static string NewMethod(string[] args) { int i = 10; string s; s = args[0] + i.ToString(); return s; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod11() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; int i2 = 10;|] i = 10; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i; NewMethod(); i = 10; } private static void NewMethod() { int i2 = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod11_1() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; int i2 = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { NewMethod(); } private static void NewMethod() { int i; int i2 = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod12() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; [|i = i + 1;|] Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { i = i + 1; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ControlVariableInForeachStatement() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { foreach (var s in args) { [|Console.WriteLine(s);|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { foreach (var s in args) { NewMethod(s); } } private static void NewMethod(string s) { Console.WriteLine(s); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod14() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { for(var i = 1; i < 10; i++) { [|Console.WriteLine(i);|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { for (var i = 1; i < 10; i++) { NewMethod(i); } } private static void NewMethod(int i) { Console.WriteLine(i); } }"; // var in for loop doesn't get bound yet await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod15() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int s = 10, i = 1; int b = s + i;|] System.Console.WriteLine(s); System.Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int s, i; NewMethod(out s, out i); System.Console.WriteLine(s); System.Console.WriteLine(i); } private static void NewMethod(out int s, out int i) { s = 10; i = 1; int b = s + i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod16() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i = 1;|] System.Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = NewMethod(); System.Console.WriteLine(i); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538932")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod17() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { [|T t1; Test(out t1); t = t1;|] System.Console.WriteLine(t1.ToString()); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { T t1; NewMethod(out t, out t1); System.Console.WriteLine(t1.ToString()); } private void NewMethod<T>(out T t, out T t1) where T : class, new() { Test(out t1); t = t1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod18() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { [|T t1 = GetValue(out t);|] System.Console.WriteLine(t1.ToString()); } private T GetValue<T>(out T t) where T : class, new() { return t = new T(); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { T t1; NewMethod(out t, out t1); System.Console.WriteLine(t1.ToString()); } private void NewMethod<T>(out T t, out T t1) where T : class, new() { t1 = GetValue(out t); } private T GetValue<T>(out T t) where T : class, new() { return t = new T(); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod19() { var code = @"using System; using System.Collections.Generic; using System.Linq; unsafe class Program { void Test() { [|int i = 1;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; unsafe class Program { void Test() { NewMethod(); } private static void NewMethod() { int i = 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod20() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { unsafe void Test() { [|int i = 1;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { unsafe void Test() { NewMethod(); } private static unsafe void NewMethod() { int i = 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542677, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542677")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod21() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { unsafe { [|int i = 1;|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { unsafe { NewMethod(); } } private static unsafe void NewMethod() { int i = 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod22() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i; [|int b = 10; if (b < 10) { i = 5; }|] i = 6; Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i; i = NewMethod(i); i = 6; Console.WriteLine(i); } private static int NewMethod(int i) { int b = 10; if (b < 10) { i = 5; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod23() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (true) [|Console.WriteLine(args[0].ToString());|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (true) NewMethod(args); } private static void NewMethod(string[] args) { Console.WriteLine(args[0].ToString()); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod24() { var code = @"using System; class Program { static void Main(string[] args) { int y = [|int.Parse(args[0].ToString())|]; } }"; var expected = @"using System; class Program { static void Main(string[] args) { int y = GetY(args); } private static int GetY(string[] args) { return int.Parse(args[0].ToString()); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod25() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (([|new int[] { 1, 2, 3 }|]).Any()) { return; } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if ((NewMethod()).Any()) { return; } } private static int[] NewMethod() { return new int[] { 1, 2, 3 }; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod26() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if ([|(new int[] { 1, 2, 3 })|].Any()) { return; } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (NewMethod().Any()) { return; } } private static int[] NewMethod() { return (new int[] { 1, 2, 3 }); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod27() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i = 1; [|int b = 10; if (b < 10) { i = 5; }|] i = 6; Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i = 1; i = NewMethod(i); i = 6; Console.WriteLine(i); } private static int NewMethod(int i) { int b = 10; if (b < 10) { i = 5; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod28() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { [|return 1;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { return NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod29() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { int i = 0; [|if (i < 0) { return 1; } else { return 0; }|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { int i = 0; return NewMethod(i); } private static int NewMethod(int i) { if (i < 0) { return 1; } else { return 0; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod30() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(out int i) { [|i = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(out int i) { i = NewMethod(); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod31() { var code = @"using System; using System.Collections.Generic; using System.Text; class Program { void Test() { StringBuilder builder = new StringBuilder(); [|builder.Append(""Hello""); builder.Append("" From ""); builder.Append("" Roslyn"");|] return builder.ToString(); } }"; var expected = @"using System; using System.Collections.Generic; using System.Text; class Program { void Test() { StringBuilder builder = new StringBuilder(); NewMethod(builder); return builder.ToString(); } private static void NewMethod(StringBuilder builder) { builder.Append(""Hello""); builder.Append("" From ""); builder.Append("" Roslyn""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod32() { var code = @"using System; class Program { void Test() { int v = 0; Console.Write([|v|]); } }"; var expected = @"using System; class Program { void Test() { int v = 0; Console.Write(GetV(v)); } private static int GetV(int v) { return v; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(3792, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod33() { var code = @"using System; class Program { void Test() { int v = 0; while (true) { Console.Write([|v++|]); } } }"; var expected = @"using System; class Program { void Test() { int v = 0; while (true) { Console.Write(NewMethod(ref v)); } } private static int NewMethod(ref int v) { return v++; } }"; // this bug has two issues. one is "v" being not in the dataFlowIn and ReadInside collection (hence no method parameter) // and the other is binding not working for "v++" (hence object as return type) await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod34() { var code = @"using System; class Program { static void Main(string[] args) { int x = 1; int y = 2; int z = [|x + y|]; } } "; var expected = @"using System; class Program { static void Main(string[] args) { int x = 1; int y = 2; int z = GetZ(x, y); } private static int GetZ(int x, int y) { return x + y; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(538239, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538239")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod35() { var code = @"using System; class Program { static void Main(string[] args) { int[] r = [|new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }|]; } }"; var expected = @"using System; class Program { static void Main(string[] args) { int[] r = GetR(); } private static int[] GetR() { return new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod36() { var code = @"using System; class Program { static void Main(ref int i) { [|i = 1;|] } }"; var expected = @"using System; class Program { static void Main(ref int i) { i = NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod37() { var code = @"using System; class Program { static void Main(out int i) { [|i = 1;|] } }"; var expected = @"using System; class Program { static void Main(out int i) { i = NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538231")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod38() { var code = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract // unassigned = ReturnVal(0); [|unassigned = unassigned + 10;|] // read // int newVar = unassigned; // write // unassigned = 0; } }"; var expected = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract // unassigned = ReturnVal(0); unassigned = NewMethod(unassigned); // read // int newVar = unassigned; // write // unassigned = 0; } private static int NewMethod(int unassigned) { unassigned = unassigned + 10; return unassigned; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538231")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod39() { var code = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract [|// unassigned = ReturnVal(0); unassigned = unassigned + 10; // read|] // int newVar = unassigned; // write // unassigned = 0; } }"; var expected = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract unassigned = NewMethod(unassigned); // int newVar = unassigned; // write // unassigned = 0; } private static int NewMethod(int unassigned) { // unassigned = ReturnVal(0); unassigned = unassigned + 10; // read return unassigned; } }"; // current bottom-up re-writer makes re-attaching trivia half belongs to previous token // and half belongs to next token very hard. // for now, it won't be able to re-associate trivia belongs to next token. await TestExtractMethodAsync(code, expected); } [WorkItem(538303, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538303")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod40() { var code = @"class Program { static void Main(string[] args) { [|int x;|] } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(868414, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/868414")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodWithLeadingTrivia() { // ensure that the extraction doesn't result in trivia moving up a line: // // a //b // NewMethod(); await TestExtractMethodAsync( @"class C { void M() { // a // b [|System.Console.WriteLine();|] } }", @"class C { void M() { // a // b NewMethod(); } private static void NewMethod() { System.Console.WriteLine(); } }"); } [WorkItem(632351, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/632351")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodFailForTypeInFromClause() { var code = @"class Program { static void Main(string[] args) { var z = from [|T|] x in e; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(632351, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/632351")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodFailForTypeInFromClause_1() { var code = @"class Program { static void Main(string[] args) { var z = from [|W.T|] x in e; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(538314, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538314")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod41() { var code = @"class Program { static void Main(string[] args) { int x = 10; [|int y; if (x == 10) y = 5;|] Console.WriteLine(y); } }"; var expected = @"class Program { static void Main(string[] args) { int x = 10; int y = NewMethod(x); Console.WriteLine(y); } private static int NewMethod(int x) { int y; if (x == 10) y = 5; return y; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538327, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538327")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod42() { var code = @"using System; class Program { static void Main(string[] args) { int a, b; [|a = 5; b = 7;|] Console.Write(a + b); } }"; var expected = @"using System; class Program { static void Main(string[] args) { int a, b; NewMethod(out a, out b); Console.Write(a + b); } private static void NewMethod(out int a, out int b) { a = 5; b = 7; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538327, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538327")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod43() { var code = @"using System; class Program { static void Main(string[] args) { int a, b; [|a = 5; b = 7; int c; int d; int e, f; c = 1; d = 1; e = 1; f = 1;|] Console.Write(a + b); } }"; var expected = @"using System; class Program { static void Main(string[] args) { int a, b; NewMethod(out a, out b); Console.Write(a + b); } private static void NewMethod(out int a, out int b) { a = 5; b = 7; int c; int d; int e, f; c = 1; d = 1; e = 1; f = 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538328, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538328")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod44() { var code = @"using System; class Program { static void Main(string[] args) { int a; //modified in [|a = 1;|] /*data flow out*/ Console.Write(a); } }"; var expected = @"using System; class Program { static void Main(string[] args) { int a; //modified in a = NewMethod(); /*data flow out*/ Console.Write(a); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538393, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538393")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod45() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { /**/[|;|]/**/ } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { /**/ NewMethod();/**/ } private static void NewMethod() { ; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538393, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538393")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod46() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; [|Goo(ref x);|] Console.WriteLine(x); } static void Goo(ref int x) { x = x + 1; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; x = NewMethod(x); Console.WriteLine(x); } private static int NewMethod(int x) { Goo(ref x); return x; } static void Goo(ref int x) { x = x + 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538399, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538399")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod47() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; [|while (true) Console.WriteLine(x);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; NewMethod(x); } private static void NewMethod(int x) { while (true) Console.WriteLine(x); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538401, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538401")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod48() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int[] x = [|{ 1, 2, 3 }|]; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int[] x = GetX(); } private static int[] GetX() { return new int[] { 1, 2, 3 }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538405, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538405")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod49() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Goo(int GetX) { int x = [|1|]; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Goo(int GetX) { int x = GetX1(); } private static int GetX1() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNormalProperty() { var code = @" class Class { private static string name; public static string Names { get { return ""1""; } set { name = value; } } static void Goo(int i) { string str = [|Class.Names|]; } }"; var expected = @" class Class { private static string name; public static string Names { get { return ""1""; } set { name = value; } } static void Goo(int i) { string str = GetStr(); } private static string GetStr() { return Class.Names; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538932")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodAutoProperty() { var code = @" class Class { public string Name { get; set; } static void Main() { string str = new Class().[|Name|]; } }"; // given span is not an expression // selection validator should take care of this case var expected = @" class Class { public string Name { get; set; } static void Main() { string str = GetStr(); } private static string GetStr() { return new Class().Name; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538402, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538402")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix3994() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { byte x = [|1|]; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { byte x = GetX(); } private static byte GetX() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538404, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538404")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix3996() { var code = @"class A<T> { class D : A<T> { } class B { } static D.B Goo() { return null; } class C<T2> { static void Bar() { D.B x = [|Goo()|]; } } }"; var expected = @"class A<T> { class D : A<T> { } class B { } static D.B Goo() { return null; } class C<T2> { static void Bar() { D.B x = GetX(); } private static B GetX() { return Goo(); } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task InsertionPoint() { var code = @"class Test { void Method(string i) { int y2 = [|1|]; } void Method(int i) { } }"; var expected = @"class Test { void Method(string i) { int y2 = GetY2(); } private static int GetY2() { return 1; } void Method(int i) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538980")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4757() { var code = @"class GenericMethod { void Method<T>(T t) { T a; [|a = t;|] } }"; var expected = @"class GenericMethod { void Method<T>(T t) { T a; a = NewMethod(t); } private static T NewMethod<T>(T t) { return t; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538980")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4757_2() { var code = @"class GenericMethod<T1> { void Method<T>(T t) { T a; T1 b; [|a = t; b = default(T1);|] } }"; var expected = @"class GenericMethod<T1> { void Method<T>(T t) { T a; T1 b; NewMethod(t, out a, out b); } private static void NewMethod<T>(T t, out T a, out T1 b) { a = t; b = default(T1); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538980")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4757_3() { var code = @"class GenericMethod { void Method<T, T1>(T t) { T1 a1; T a; [|a = t; a1 = default(T);|] } }"; var expected = @"class GenericMethod { void Method<T, T1>(T t) { T1 a1; T a; NewMethod(t, out a1, out a); } private static void NewMethod<T, T1>(T t, out T1 a1, out T a) { a = t; a1 = default(T); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538422, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538422")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4758() { var code = @"using System; class TestOutParameter { void Method(out int x) { x = 5; Console.Write([|x|]); } }"; var expected = @"using System; class TestOutParameter { void Method(out int x) { x = 5; Console.Write(GetX(x)); } private static int GetX(int x) { return x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538422, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538422")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4758_2() { var code = @"class TestOutParameter { void Method(out int x) { x = 5; Console.Write([|x|]); } }"; var expected = @"class TestOutParameter { void Method(out int x) { x = 5; Console.Write(GetX(x)); } private static int GetX(int x) { return x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538984, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538984")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4761() { var code = @"using System; class A { void Method() { System.Func<int, int> a = x => [|x * x|]; } }"; var expected = @"using System; class A { void Method() { System.Func<int, int> a = x => NewMethod(x); } private static int NewMethod(int x) { return x * x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538997, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538997")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4779() { var code = @"using System; class Program { static void Main() { string s = ""; Func<string> f = [|s|].ToString; } } "; var expected = @"using System; class Program { static void Main() { string s = ""; Func<string> f = GetS(s).ToString; } private static string GetS(string s) { return s; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(538997, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538997")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4779_2() { var code = @"using System; class Program { static void Main() { string s = ""; var f = [|s|].ToString(); } } "; var expected = @"using System; class Program { static void Main() { string s = ""; var f = GetS(s).ToString(); } private static string GetS(string s) { return s; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(4780, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4780() { var code = @"using System; class Program { static void Main() { string s = ""; object f = (Func<string>)[|s.ToString|]; } }"; var expected = @"using System; class Program { static void Main() { string s = ""; object f = (Func<string>)GetToString(s); } private static Func<string> GetToString(string s) { return s.ToString; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(4780, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4780_2() { var code = @"using System; class Program { static void Main() { string s = ""; object f = (string)[|s.ToString()|]; } }"; var expected = @"using System; class Program { static void Main() { string s = ""; object f = (string)NewMethod(s); } private static string NewMethod(string s) { return s.ToString(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(4782, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4782() { var code = @"class A<T> { class D : A<T[]> { } class B { } class C<T> { static void Goo<T>(T a) { T t = [|default(T)|]; } } }"; var expected = @"class A<T> { class D : A<T[]> { } class B { } class C<T> { static void Goo<T>(T a) { T t = GetT<T>(); } private static T GetT<T>() { return default(T); } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(4782, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4782_2() { var code = @"class A<T> { class D : A<T[]> { } class B { } class C<T> { static void Goo() { D.B x = [|new D.B()|]; } } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(4791, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4791() { var code = @"class Program { delegate int Func(int a); static void Main(string[] args) { Func v = (int a) => [|a|]; } }"; var expected = @"class Program { delegate int Func(int a); static void Main(string[] args) { Func v = (int a) => GetA(a); } private static int GetA(int a) { return a; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539019, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539019")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4809() { var code = @"class Program { public Program() { [|int x = 2;|] } }"; var expected = @"class Program { public Program() { NewMethod(); } private static void NewMethod() { int x = 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539029, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539029")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4813() { var code = @"using System; class Program { public Program() { object o = [|new Program()|]; } }"; var expected = @"using System; class Program { public Program() { object o = GetO(); } private static Program GetO() { return new Program(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538425, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538425")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4031() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { bool x = true, y = true, z = true; if (x) while (y) { } else [|while (z) { }|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { bool x = true, y = true, z = true; if (x) while (y) { } else NewMethod(z); } private static void NewMethod(bool z) { while (z) { } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(527499, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527499")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix3992() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; [|while (false) Console.WriteLine(x);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; NewMethod(x); } private static void NewMethod(int x) { while (false) Console.WriteLine(x); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539029, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539029")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4823() { var code = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", [|Area|]); } }"; var expected = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", GetArea()); } private double GetArea() { return Area; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538985, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538985")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4762() { var code = @"class Program { static void Main(string[] args) { //comments [|int x = 2;|] } } "; var expected = @"class Program { static void Main(string[] args) { //comments NewMethod(); } private static void NewMethod() { int x = 2; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(538966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538966")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4744() { var code = @"class Program { static void Main(string[] args) { [|int x = 2; //comments|] } } "; var expected = @"class Program { static void Main(string[] args) { NewMethod(); } private static void NewMethod() { int x = 2; //comments } } "; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesNoNo() { var code = @"using System; class Program { void Test1() { int i; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test1() { int i; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesNoYes() { var code = @"using System; class Program { void Test2() { int i = 0; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test2() { int i = 0; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesYesNo() { var code = @"using System; class Program { void Test3() { int i; while (i > 10) ; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test3() { int i; while (i > 10) ; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesYesYes() { var code = @"using System; class Program { void Test4() { int i = 10; while (i > 10) ; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test4() { int i = 10; while (i > 10) ; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesNoNo() { var code = @"using System; class Program { void Test4_1() { int i; [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_1() { int i; i = NewMethod(); } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesNoYes() { var code = @"using System; class Program { void Test4_2() { int i = 10; [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_2() { int i = 10; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesYesNo() { var code = @"using System; class Program { void Test4_3() { int i; Console.WriteLine(i); [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_3() { int i; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesYesYes() { var code = @"using System; class Program { void Test4_4() { int i = 10; Console.WriteLine(i); [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_4() { int i = 10; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoNoNoNo() { var code = @"using System; class Program { void Test5() { [| int i; |] } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoNoNoYes() { var code = @"using System; class Program { void Test6() { [| int i; |] i = 1; } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoYesNoNo() { var code = @"using System; class Program { void Test7() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test7() { NewMethod(); } private static void NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoYesNoYes() { var code = @"using System; class Program { void Test8() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } |] i = 2; } }"; var expected = @"using System; class Program { void Test8() { int i = NewMethod(); i = 2; } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesNoNoNo() { var code = @"using System; class Program { void Test9() { [| int i; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test9() { NewMethod(); } private static void NewMethod() { int i; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesNoNoYes() { var code = @"using System; class Program { void Test10() { [| int i; Console.WriteLine(i); |] i = 10; } }"; var expected = @"using System; class Program { void Test10() { int i; NewMethod(); i = 10; } private static void NewMethod() { int i; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesYesNoNo() { var code = @"using System; class Program { void Test11() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test11() { NewMethod(); } private static void NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesYesNoYes() { var code = @"using System; class Program { void Test12() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] i = 10; } }"; var expected = @"using System; class Program { void Test12() { int i = NewMethod(); i = 10; } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesNoNo() { var code = @"using System; class Program { void Test13() { int i; [| i = 10; |] } }"; var expected = @"using System; class Program { void Test13() { int i; i = NewMethod(); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesNoYes() { var code = @"using System; class Program { void Test14() { int i; [| i = 10; |] i = 1; } }"; var expected = @"using System; class Program { void Test14() { int i; i = NewMethod(); i = 1; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesYesNo() { var code = @"using System; class Program { void Test15() { int i; Console.WriteLine(i); [| i = 10; |] } }"; var expected = @"using System; class Program { void Test15() { int i; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesYesYes() { var code = @"using System; class Program { void Test16() { int i; [| i = 10; |] i = 10; Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test16() { int i; i = NewMethod(); i = 10; Console.WriteLine(i); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } // dataflow in and out can be false for symbols in unreachable code // boolean indicates // dataFlowIn: false, dataFlowOut: false, alwaysAssigned: true, variableDeclared: false, readInside: true, writtenInside: false, readOutside: false, writtenOutside: true [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesNoNoYes() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable.Select(e => """"); return enumerable;|] } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { return NewMethod(enumerable); } private static IEnumerable<object> NewMethod(IEnumerable<object> enumerable) { while (true) ; enumerable.Select(e => """"); return enumerable; } } }"; await TestExtractMethodAsync(code, expected); } // dataflow in and out can be false for symbols in unreachable code // boolean indicates // dataFlowIn: false, dataFlowOut: false, alwaysAssigned: true, variableDeclared: false, readInside: true, writtenInside: false, readOutside: true, writtenOutside: true [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesNoYesYes() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable.Select(e => """");|] return enumerable; } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { enumerable = NewMethod(enumerable); return enumerable; } private static IEnumerable<object> NewMethod(IEnumerable<object> enumerable) { while (true) ; enumerable.Select(e => """"); return enumerable; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesNoNo() { var code = @"using System; class Program { void Test16_1() { int i; [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_1() { int i; i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesNoYes() { var code = @"using System; class Program { void Test16_2() { int i = 10; [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_2() { int i = 10; i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesYesNo() { var code = @"using System; class Program { void Test16_3() { int i; Console.WriteLine(i); [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_3() { int i; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesYesYes() { var code = @"using System; class Program { void Test16_4() { int i = 10; Console.WriteLine(i); [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_4() { int i = 10; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesNoYesNoNo() { var code = @"using System; class Program { void Test17() { [| int i = 10; |] } }"; var expected = @"using System; class Program { void Test17() { NewMethod(); } private static void NewMethod() { int i = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesNoYesNoYes() { var code = @"using System; class Program { void Test18() { [| int i = 10; |] i = 10; } }"; var expected = @"using System; class Program { void Test18() { int i = NewMethod(); i = 10; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesYesYesNoNo() { var code = @"using System; class Program { void Test19() { [| int i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test19() { NewMethod(); } private static void NewMethod() { int i = 10; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesYesYesNoYes() { var code = @"using System; class Program { void Test20() { [| int i = 10; Console.WriteLine(i); |] i = 10; } }"; var expected = @"using System; class Program { void Test20() { int i; NewMethod(); i = 10; } private static void NewMethod() { int i = 10; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoNoYesYesNo() { var code = @"using System; class Program { void Test21() { int i; [| if (int.Parse(""1"") > 10) { i = 1; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test21() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoNoYesYesYes() { var code = @"using System; class Program { void Test22() { int i = 10; [| if (int.Parse(""1"") > 10) { i = 1; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test22() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoYesYesYesNo() { var code = @"using System; class Program { void Test22_1() { int i; [| if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test22_1() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoYesYesYesYes() { var code = @"using System; class Program { void Test22_2() { int i = 10; [| if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test22_2() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoNoYesNo() { var code = @"using System; class Program { void Test23() { [| int i; |] Console.WriteLine(i); } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoNoYesYes() { var code = @"using System; class Program { void Test24() { [| int i; |] Console.WriteLine(i); i = 10; } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoYesYesNo() { var code = @"using System; class Program { void Test25() { [| int i; if (int.Parse(""1"") > 9) { i = 10; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test25() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i; if (int.Parse(""1"") > 9) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoYesYesYes() { var code = @"using System; class Program { void Test26() { [| int i; if (int.Parse(""1"") > 9) { i = 10; } |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test26() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i; if (int.Parse(""1"") > 9) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesNoYesNo() { var code = @"using System; class Program { void Test27() { [| int i; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test27() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesNoYesYes() { var code = @"using System; class Program { void Test28() { [| int i; Console.WriteLine(i); |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test28() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesYesYesNo() { var code = @"using System; class Program { void Test29() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test29() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesYesYesYes() { var code = @"using System; class Program { void Test30() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test30() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoNoYesYesNo() { var code = @"using System; class Program { void Test31() { int i; [| i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test31() { int i; i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoNoYesYesYes() { var code = @"using System; class Program { void Test32() { int i; [| i = 10; |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test32() { int i; i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoYesYesYesNo() { var code = @"using System; class Program { void Test32_1() { int i; [| i = 10; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test32_1() { int i; i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoYesYesYesYes() { var code = @"using System; class Program { void Test32_2() { int i = 10; [| i = 10; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test32_2() { int i = 10; i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesNoYesYesNo() { var code = @"using System; class Program { void Test33() { [| int i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test33() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesNoYesYesYes() { var code = @"using System; class Program { void Test34() { [| int i = 10; |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test34() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesYesYesYesNo() { var code = @"using System; class Program { void Test35() { [| int i = 10; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test35() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesYesYesYesYes() { var code = @"using System; class Program { void Test36() { [| int i = 10; Console.WriteLine(i); |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test36() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoNoNo() { var code = @"using System; class Program { void Test37() { int i; [| Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test37() { int i; NewMethod(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoNoYes() { var code = @"using System; class Program { void Test38() { int i = 10; [| Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test38() { int i = 10; NewMethod(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoYesNo() { var code = @"using System; class Program { void Test39() { int i; [| Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test39() { int i; NewMethod(i); Console.WriteLine(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoYesYes() { var code = @"using System; class Program { void Test40() { int i = 10; [| Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test40() { int i = 10; NewMethod(i); Console.WriteLine(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesNoNo() { var code = @"using System; class Program { void Test41() { int i; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test41() { int i; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesNoYes() { var code = @"using System; class Program { void Test42() { int i = 10; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test42() { int i = 10; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesYesNo() { var code = @"using System; class Program { void Test43() { int i; Console.WriteLine(i); [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test43() { int i; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesYesYes() { var code = @"using System; class Program { void Test44() { int i = 10; Console.WriteLine(i); [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test44() { int i = 10; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesNoNo() { var code = @"using System; class Program { void Test45() { int i; [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test45() { int i; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesNoYes() { var code = @"using System; class Program { void Test46() { int i = 10; [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test46() { int i = 10; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesYesNo() { var code = @"using System; class Program { void Test47() { int i; Console.WriteLine(i); [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test47() { int i; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesYesYes() { var code = @"using System; class Program { void Test48() { int i = 10; Console.WriteLine(i); [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test48() { int i = 10; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesNoNoYesYesYesNo() { var code = @"using System; class Program { void Test49() { int i; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test49() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesNoNoYesYesYesYes() { var code = @"using System; class Program { void Test50() { int i = 10; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test50() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesYesNoYesYesYesNo() { var code = @"using System; class Program { void Test51() { int i; [| Console.WriteLine(i); i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test51() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesYesNoYesYesYesYes() { var code = @"using System; class Program { void Test52() { int i = 10; [| Console.WriteLine(i); i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test52() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539049, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539049")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInProperty1() { var code = @"class C2 { static public int Area { get { return 1; } } } class C3 { public static int Area { get { return [|C2.Area|]; } } } "; var expected = @"class C2 { static public int Area { get { return 1; } } } class C3 { public static int Area { get { return GetArea(); } } private static int GetArea() { return C2.Area; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539049, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539049")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInProperty2() { var code = @"class C3 { public static int Area { get { [|int i = 10; return i;|] } } } "; var expected = @"class C3 { public static int Area { get { return NewMethod(); } } private static int NewMethod() { return 10; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539049, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539049")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInProperty3() { var code = @"class C3 { public static int Area { set { [|int i = value;|] } } } "; var expected = @"class C3 { public static int Area { set { NewMethod(value); } } private static void NewMethod(int value) { int i = value; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539029, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539029")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodProperty() { var code = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", [|Area|]); } } "; var expected = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", GetArea()); } private double GetArea() { return Area; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539196, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539196")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodWithDeclareOneMoreVariablesInSameLineBeUsedAfter() { var code = @"class C { void M() { [|int x, y = 1;|] x = 4; Console.Write(x + y); } }"; var expected = @"class C { void M() { int x; int y = NewMethod(); x = 4; Console.Write(x + y); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539196, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539196")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodWithDeclareOneMoreVariablesInSameLineNotBeUsedAfter() { var code = @"class C { void M() { [|int x, y = 1;|] } }"; var expected = @"class C { void M() { NewMethod(); } private static void NewMethod() { int x, y = 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539214, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539214")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodForSplitOutStatementWithComments() { var code = @"class C { void M() { //start [|int x, y; x = 5; y = 10;|] //end Console.Write(x + y); } }"; var expected = @"class C { void M() { //start int x, y; NewMethod(out x, out y); //end Console.Write(x + y); } private static void NewMethod(out int x, out int y) { x = 5; y = 10; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539225, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539225")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5098() { var code = @"class Program { static void Main(string[] args) { [|return;|] Console.Write(4); } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(539229, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539229")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5107() { var code = @"class Program { static void Main(string[] args) { int i = 10; [|int j = j + i;|] Console.Write(i); Console.Write(j); } }"; var expected = @"class Program { static void Main(string[] args) { int i = 10; int j = NewMethod(i); Console.Write(i); Console.Write(j); } private static int NewMethod(int i) { return j + i; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539500, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539500")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task LambdaLiftedVariable1() { var code = @"class Program { delegate void Func(ref int i, int r); static void Main(string[] args) { int temp = 2; Func fnc = (ref int arg, int arg2) => { [|temp = arg = arg2;|] }; temp = 4; fnc(ref temp, 2); System.Console.WriteLine(temp); } }"; var expected = @"class Program { delegate void Func(ref int i, int r); static void Main(string[] args) { int temp = 2; Func fnc = (ref int arg, int arg2) => { NewMethod(out arg, arg2, out temp); }; temp = 4; fnc(ref temp, 2); System.Console.WriteLine(temp); } private static void NewMethod(out int arg, int arg2, out int temp) { temp = arg = arg2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539488, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539488")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task LambdaLiftedVariable2() { var code = @"class Program { delegate void Action(); static void Main(string[] args) { int i = 0; Action query = null; if (i == 0) { query = () => { System.Console.WriteLine(i); }; } [|i = 3;|] query(); } }"; var expected = @"class Program { delegate void Action(); static void Main(string[] args) { int i = 0; Action query = null; if (i == 0) { query = () => { System.Console.WriteLine(i); }; } i = NewMethod(); query(); } private static int NewMethod() { return 3; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { [|TestDelegate testDel = (ref int x) => { x = 10; };|] int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = NewMethod(); int p = 2; testDel(ref p); Console.WriteLine(p); } private static TestDelegate NewMethod() { return (ref int x) => { x = 10; }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533_1() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { [|TestDelegate testDel = (ref int x) => { int y = x; x = 10; };|] int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = NewMethod(); int p = 2; testDel(ref p); Console.WriteLine(p); } private static TestDelegate NewMethod() { return (ref int x) => { int y = x; x = 10; }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533_2() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = (ref int x) => { [|int y = x; x = 10;|] }; int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = (ref int x) => { x = NewMethod(x); }; int p = 2; testDel(ref p); Console.WriteLine(p); } private static int NewMethod(int x) { int y = x; x = 10; return x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533_3() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { [|TestDelegate testDel = delegate (ref int x) { x = 10; };|] int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = NewMethod(); int p = 2; testDel(ref p); Console.WriteLine(p); } private static TestDelegate NewMethod() { return delegate (ref int x) { x = 10; }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539859, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539859")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task LambdaLiftedVariable3() { var code = @"using System; class Program { static void Main(string[] args) { Action<int> F = x => { Action<int> F2 = x2 => { [|Console.WriteLine(args.Length + x2 + x);|] }; F2(x); }; F(args.Length); } }"; var expected = @"using System; class Program { static void Main(string[] args) { Action<int> F = x => { Action<int> F2 = x2 => { NewMethod(args, x, x2); }; F2(x); }; F(args.Length); } private static void NewMethod(string[] args, int x, int x2) { Console.WriteLine(args.Length + x2 + x); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539882, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539882")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5982() { var code = @"using System; using System.Collections.Generic; class Program { static void Main(string[] args) { List<int> list = new List<int>(); Console.WriteLine([|list.Capacity|]); } }"; var expected = @"using System; using System.Collections.Generic; class Program { static void Main(string[] args) { List<int> list = new List<int>(); Console.WriteLine(GetCapacity(list)); } private static int GetCapacity(List<int> list) { return list.Capacity; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539932")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6041() { var code = @"using System; class Program { delegate R Del<in T, out R>(T arg); public void Goo() { Del<Exception, ArgumentException> d = (arg) => { return new ArgumentException(); }; [|d(new ArgumentException());|] } }"; var expected = @"using System; class Program { delegate R Del<in T, out R>(T arg); public void Goo() { Del<Exception, ArgumentException> d = (arg) => { return new ArgumentException(); }; NewMethod(d); } private static void NewMethod(Del<Exception, ArgumentException> d) { d(new ArgumentException()); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540183, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540183")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod50() { var code = @"class C { void Method() { while (true) { [|int i = 1; while (false) { int j = 1;|] } } } }"; var expected = @"class C { void Method() { while (true) { NewMethod(); } } private static void NewMethod() { int i = 1; while (false) { int j = 1; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod51() { var code = @"class C { void Method() { while (true) { switch(1) { case 1: [|int i = 10; break; case 2: int i2 = 20;|] break; } } } }"; var expected = @"class C { void Method() { while (true) { NewMethod(); } } private static void NewMethod() { switch (1) { case 1: int i = 10; break; case 2: int i2 = 20; break; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod52() { var code = @"class C { void Method() { [|int i = 1; while (false) { int j = 1;|] } } }"; var expected = @"class C { void Method() { NewMethod(); } private static void NewMethod() { int i = 1; while (false) { int j = 1; } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539963, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539963")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod53() { var code = @"class Class { void Main() { Enum e = Enum.[|Field|]; } } enum Enum { }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(539964, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539964")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod54() { var code = @"class Class { void Main([|string|][] args) { } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540072")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6220() { var code = @"class C { void Main() { [| float f = 1.2f; |] System.Console.WriteLine(); } }"; var expected = @"class C { void Main() { NewMethod(); System.Console.WriteLine(); } private static void NewMethod() { float f = 1.2f; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540072")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6220_1() { var code = @"class C { void Main() { [| float f = 1.2f; // test |] System.Console.WriteLine(); } }"; var expected = @"class C { void Main() { NewMethod(); System.Console.WriteLine(); } private static void NewMethod() { float f = 1.2f; // test } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540071, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540071")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6219() { var code = @"class C { void Main() { float @float = 1.2f; [|@float = 1.44F;|] } }"; var expected = @"class C { void Main() { float @float = 1.2f; @float = NewMethod(); } private static float NewMethod() { return 1.44F; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540080, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540080")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6230() { var code = @"class C { void M() { int v =[| /**/1 + 2|]; System.Console.WriteLine(); } }"; var expected = @"class C { void M() { int v = GetV(); System.Console.WriteLine(); } private static int GetV() { return /**/1 + 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540080, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540080")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6230_1() { var code = @"class C { void M() { int v [|= /**/1 + 2|]; System.Console.WriteLine(); } }"; var expected = @"class C { void M() { NewMethod(); System.Console.WriteLine(); } private static void NewMethod() { int v = /**/1 + 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540052, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540052")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6197() { var code = @"using System; class Program { static void Main(string[] args) { Func<int, int> d = [|NewMethod|]; d.Invoke(2); } private static int NewMethod(int x) { return x * 2; } }"; var expected = @"using System; class Program { static void Main(string[] args) { Func<int, int> d = GetD(); d.Invoke(2); } private static Func<int, int> GetD() { return NewMethod; } private static int NewMethod(int x) { return x * 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(6277, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6277() { var code = @"using System; class Program { static void Main(string[] args) { [|int x; x = 1;|] return; int y = x; } }"; var expected = @"using System; class Program { static void Main(string[] args) { int x = NewMethod(); return; int y = x; } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression() { var code = @"using System; class Program { void Test() { [|if (true) return;|] Console.WriteLine(); } }"; var expected = @"using System; class Program { void Test() { NewMethod(); return; Console.WriteLine(); } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression_1() { var code = @"using System; class Program { void Test() { if (true) [|if (true) return;|] Console.WriteLine(); } }"; var expected = @"using System; class Program { void Test() { if (true) { NewMethod(); return; } Console.WriteLine(); } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression_2() { var code = @"using System; class Program { void Test() { [|if (true) return;|] } }"; var expected = @"using System; class Program { void Test() { NewMethod(); } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression_3() { var code = @"using System; class Program { void Test() { if (true) [|if (true) return;|] } }"; var expected = @"using System; class Program { void Test() { if (true) { NewMethod(); return; } } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313() { var code = @"using System; class Program { void Test(bool b) { [|if (b) { return; } Console.WriteLine();|] } }"; var expected = @"using System; class Program { void Test(bool b) { NewMethod(b); } private static void NewMethod(bool b) { if (b) { return; } Console.WriteLine(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_1() { var code = @"using System; class Program { void Test(bool b) { [|if (b) { return; }|] Console.WriteLine(); } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_2() { var code = @"using System; class Program { int Test(bool b) { [|if (b) { return 1; } Console.WriteLine();|] } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_3() { var code = @"using System; class Program { void Test() { [|bool b = true; if (b) { return; } Action d = () => { if (b) { return; } Console.WriteLine(1); };|] } }"; var expected = @"using System; class Program { void Test() { NewMethod(); } private static void NewMethod() { bool b = true; if (b) { return; } Action d = () => { if (b) { return; } Console.WriteLine(1); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_4() { var code = @"using System; class Program { void Test() { [|Action d = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); }; Action d2 = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); };|] Console.WriteLine(1); } }"; var expected = @"using System; class Program { void Test() { NewMethod(); Console.WriteLine(1); } private static void NewMethod() { Action d = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); }; Action d2 = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_5() { var code = @"using System; class Program { void Test() { Action d = () => { [|int i = 1; if (i > 10) { return; } Console.WriteLine(1);|] }; } }"; var expected = @"using System; class Program { void Test() { Action d = () => { NewMethod(); }; } private static void NewMethod() { int i = 1; if (i > 10) { return; } Console.WriteLine(1); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_6() { var code = @"using System; class Program { void Test() { Action d = () => { [|int i = 1; if (i > 10) { return; }|] Console.WriteLine(1); }; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540170, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540170")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6333() { var code = @"using System; class Program { void Test() { Program p; [|p = new Program()|]; } }"; var expected = @"using System; class Program { void Test() { Program p; p = NewMethod(); } private static Program NewMethod() { return new Program(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540216, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540216")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6393() { var code = @"using System; class Program { object Test<T>() { T abcd; [|abcd = new T()|]; return abcd; } }"; var expected = @"using System; class Program { object Test<T>() { T abcd; abcd = NewMethod<T>(); return abcd; } private static T NewMethod<T>() { return new T(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540184, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540184")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6351() { var code = @"class Test { void method() { if (true) { for (int i = 0; i < 5; i++) { /*Begin*/ [|System.Console.WriteLine(); } System.Console.WriteLine();|] /*End*/ } } }"; var expected = @"class Test { void method() { if (true) { NewMethod(); /*End*/ } } private static void NewMethod() { for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540184, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540184")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6351_1() { var code = @"class Test { void method() { if (true) { for (int i = 0; i < 5; i++) { /*Begin*/ [|System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/|] } } }"; var expected = @"class Test { void method() { if (true) { NewMethod(); } } private static void NewMethod() { for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/ } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540184, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540184")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6351_2() { var code = @"class Test { void method() { if (true) [|{ for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/ }|] } }"; var expected = @"class Test { void method() { if (true) NewMethod(); } private static void NewMethod() { for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/ } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540333, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540333")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6560() { var code = @"using System; class Program { static void Main(string[] args) { string S = [|null|]; int Y = S.Length; } }"; var expected = @"using System; class Program { static void Main(string[] args) { string S = GetS(); int Y = S.Length; } private static string GetS() { return null; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562() { var code = @"using System; class Program { int y = [|10|]; }"; var expected = @"using System; class Program { int y = GetY(); private static int GetY() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562_1() { var code = @"using System; class Program { const int i = [|10|]; }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562_2() { var code = @"using System; class Program { Func<string> f = [|() => ""test""|]; }"; var expected = @"using System; class Program { Func<string> f = GetF(); private static Func<string> GetF() { return () => ""test""; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562_3() { var code = @"using System; class Program { Func<string> f = () => [|""test""|]; }"; var expected = @"using System; class Program { Func<string> f = () => NewMethod(); private static string NewMethod() { return ""test""; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540361, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540361")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6598() { var code = @"using System; using System.Collections.Generic; using System.Linq; class { static void Main(string[] args) { [|Program|] } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540372, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540372")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6613() { var code = @"#define A using System; class Program { static void Main(string[] args) { #if A [|Console.Write(5);|] #endif } }"; var expected = @"#define A using System; class Program { static void Main(string[] args) { #if A NewMethod(); #endif } private static void NewMethod() { Console.Write(5); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540396, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540396")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task InvalidSelection_MethodBody() { var code = @"using System; class Program { static void Main(string[] args) { void Method5(bool b1, bool b2) [|{ if (b1) { if (b2) return; Console.WriteLine(); } Console.WriteLine(); }|] } } "; await ExpectExtractMethodToFailAsync(code); } [WorkItem(541586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541586")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task StructThis() { var code = @"struct S { void Goo() { [|this = new S();|] } }"; var expected = @"struct S { void Goo() { NewMethod(); } private void NewMethod() { this = new S(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(541627, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541627")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontUseConvertedTypeForImplicitNumericConversion() { var code = @"class T { void Goo() { int x1 = 5; long x2 = [|x1|]; } }"; var expected = @"class T { void Goo() { int x1 = 5; long x2 = GetX2(x1); } private static int GetX2(int x1) { return x1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(541668, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541668")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BreakInSelection() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { string x1 = ""Hello""; switch (x1) { case null: int i1 = 10; break; default: switch (x1) { default: switch (x1) { [|default: int j1 = 99; i1 = 45; x1 = ""t""; string j2 = i1.ToString() + j1.ToString() + x1; break; } break; } break;|] } } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(541671, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541671")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task UnreachableCodeWithReturnStatement() { var code = @"class Program { static void Main(string[] args) { return; [|int i1 = 45; i1 = i1 + 10;|] return; } }"; var expected = @"class Program { static void Main(string[] args) { return; NewMethod(); return; } private static void NewMethod() { int i1 = 45; i1 = i1 + 10; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539862, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539862")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontBlindlyPutCapturedVariable1() { var code = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Ros.A a = new Ros.A(); Del d = (int x) => { [|a.F(x)|]; return x * v; }; d(3); } } namespace Ros { partial class A { public void F(int s) { } } }"; var expected = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Ros.A a = new Ros.A(); Del d = (int x) => { NewMethod(x, a); return x * v; }; d(3); } private static void NewMethod(int x, Ros.A a) { a.F(x); } } namespace Ros { partial class A { public void F(int s) { } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539862, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539862")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontBlindlyPutCapturedVariable2() { var code = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Program p; Del d = (int x) => { [|p = null;|]; return x * v; }; d(3); } }"; var expected = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Program p; Del d = (int x) => { p = NewMethod(); ; return x * v; }; d(3); } private static Program NewMethod() { return null; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(541889, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541889")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontCrashOnRangeVariableSymbol() { var code = @"class Test { public void Linq1() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lowNums = [|from|] n in numbers where n < 5 select n; } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractRangeVariable() { var code = @"using System.Linq; class Test { public void Linq1() { string[] array = null; var q = from string s in array select [|s|]; } }"; var expected = @"using System.Linq; class Test { public void Linq1() { string[] array = null; var q = from string s in array select GetS(s); } private static string GetS(string s) { return s; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542155, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542155")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task GenericWithErrorType() { var code = @"using Goo.Utilities; class Goo<T> { } class Bar { void gibberish() { Goo<[|Integer|]> x = null; x.IsEmpty(); } } namespace Goo.Utilities { internal static class GooExtensions { public static bool IsEmpty<T>(this Goo<T> source) { return false; } } }"; var expected = @"using Goo.Utilities; class Goo<T> { } class Bar { void gibberish() { Goo<Integer> x = NewMethod(); x.IsEmpty(); } private static Goo<Integer> NewMethod() { return null; } } namespace Goo.Utilities { internal static class GooExtensions { public static bool IsEmpty<T>(this Goo<T> source) { return false; } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542105, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542105")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task NamedArgument() { var code = @"using System; class C { int this[int x = 5, int y = 7] { get { return 0; } set { } } void Goo() { var y = this[[|y|]: 1]; } }"; var expected = @"using System; class C { int this[int x = 5, int y = 7] { get { return 0; } set { } } void Goo() { var y = GetY(); } private int GetY() { return this[y: 1]; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542213, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542213")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task QueryExpressionVariable() { var code = @"using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { var q2 = from a in Enumerable.Range(1, 2) from b in Enumerable.Range(1, 2) where ([|a == b|]) select a; } }"; var expected = @"using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { var q2 = from a in Enumerable.Range(1, 2) from b in Enumerable.Range(1, 2) where (NewMethod(a, b)) select a; } private static bool NewMethod(int a, int b) { return a == b; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542465, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542465")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task IsExpression() { var code = @"using System; class Class1 { } class IsTest { static void Test(Class1 o) { var b = new Class1() is [|Class1|]; } static void Main() { } }"; var expected = @"using System; class Class1 { } class IsTest { static void Test(Class1 o) { var b = GetB(); } private static bool GetB() { return new Class1() is Class1; } static void Main() { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542526, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542526")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint() { var code = @"using System; using System.Collections.Generic; class A { static void Goo<T, S>(T x) where T : IList<S> { var y = [|x.Count|]; } }"; var expected = @"using System; using System.Collections.Generic; class A { static void Goo<T, S>(T x) where T : IList<S> { var y = GetY<T, S>(x); } private static int GetY<T, S>(T x) where T : IList<S> { return x.Count; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542619, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542619")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task GlobalNamespaceInReturnType() { var code = @"class Program { class System { class Action { } } static global::System.Action a = () => { global::System.Console.WriteLine(); [|}|]; }"; var expected = @"class Program { class System { class Action { } } static global::System.Action a = GetA(); private static global::System.Action GetA() { return () => { global::System.Console.WriteLine(); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542582, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542582")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnFor() { var code = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) [|{ Console.WriteLine(i);|] } } }"; var expected = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) NewMethod(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnFor() { var code = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < [|10|]; i++) ; } }"; var expected = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < NewMethod(); i++) ; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnForeach() { var code = @"using System; class Program { static void Main(string[] args) { foreach (var c in ""123"") [|{ Console.Write(c);|] } } }"; var expected = @"using System; class Program { static void Main(string[] args) { foreach (var c in ""123"") NewMethod(c); } private static void NewMethod(char c) { Console.Write(c); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnForeach() { var code = @"using System; class Program { static void Main(string[] args) { foreach (var c in [|""123""|]) { Console.Write(c); } } }"; var expected = @"using System; class Program { static void Main(string[] args) { foreach (var c in NewMethod()) { Console.Write(c); } } private static string NewMethod() { return ""123""; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnElseClause() { var code = @"using System; class Program { static void Main(string[] args) { if ([|true|]) { } else { } } }"; var expected = @"using System; class Program { static void Main(string[] args) { if (NewMethod()) { } else { } } private static bool NewMethod() { return true; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnLabel() { var code = @"using System; class Program { static void Main(string[] args) { repeat: Console.WriteLine(""Roslyn"")[|;|] if (true) goto repeat; } }"; var expected = @"using System; class Program { static void Main(string[] args) { repeat: NewMethod(); if (true) goto repeat; } private static void NewMethod() { Console.WriteLine(""Roslyn""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnLabel() { var code = @"using System; class Program { static void Main(string[] args) { repeat: Console.WriteLine(""Roslyn""); if ([|true|]) goto repeat; } }"; var expected = @"using System; class Program { static void Main(string[] args) { repeat: Console.WriteLine(""Roslyn""); if (NewMethod()) goto repeat; } private static bool NewMethod() { return true; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnSwitch() { var code = @"using System; class Program { static void Main(string[] args) { switch (args[0]) { case ""1"": Console.WriteLine(""one"")[|;|] break; default: Console.WriteLine(""other""); break; } } }"; var expected = @"using System; class Program { static void Main(string[] args) { switch (args[0]) { case ""1"": NewMethod(); break; default: Console.WriteLine(""other""); break; } } private static void NewMethod() { Console.WriteLine(""one""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnSwitch() { var code = @"using System; class Program { static void Main(string[] args) { switch ([|args[0]|]) { case ""1"": Console.WriteLine(""one""); break; default: Console.WriteLine(""other""); break; } } }"; var expected = @"using System; class Program { static void Main(string[] args) { switch (NewMethod(args)) { case ""1"": Console.WriteLine(""one""); break; default: Console.WriteLine(""other""); break; } } private static string NewMethod(string[] args) { return args[0]; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnDo() { var code = @"using System; class Program { static void Main(string[] args) { do [|{ Console.WriteLine(""I don't like"");|] } while (DateTime.Now.DayOfWeek == DayOfWeek.Monday); } }"; var expected = @"using System; class Program { static void Main(string[] args) { do NewMethod(); while (DateTime.Now.DayOfWeek == DayOfWeek.Monday); } private static void NewMethod() { Console.WriteLine(""I don't like""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnDo() { var code = @"using System; class Program { static void Main(string[] args) { do { Console.WriteLine(""I don't like""); } while ([|DateTime.Now.DayOfWeek == DayOfWeek.Monday|]); } }"; var expected = @"using System; class Program { static void Main(string[] args) { do { Console.WriteLine(""I don't like""); } while (NewMethod()); } private static bool NewMethod() { return DateTime.Now.DayOfWeek == DayOfWeek.Monday; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnWhile() { var code = @"using System; class Program { static void Main(string[] args) { while (true) [|{ ;|] } } }"; var expected = @"using System; class Program { static void Main(string[] args) { while (true) NewMethod(); } private static void NewMethod() { ; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnStruct() { var code = @"using System; struct Goo { static Action a = () => { Console.WriteLine(); [|}|]; }"; var expected = @"using System; struct Goo { static Action a = GetA(); private static Action GetA() { return () => { Console.WriteLine(); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542619, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542619")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodIncludeGlobal() { var code = @"class Program { class System { class Action { } } static global::System.Action a = () => { global::System.Console.WriteLine(); [|}|]; static void Main(string[] args) { } }"; var expected = @"class Program { class System { class Action { } } static global::System.Action a = GetA(); private static global::System.Action GetA() { return () => { global::System.Console.WriteLine(); }; } static void Main(string[] args) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542582, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542582")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelection() { var code = @"class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) [|{ System.Console.WriteLine(i);|] } } }"; var expected = @"class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) NewMethod(i); } private static void NewMethod(int i) { System.Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542594, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542594")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodRename1() { var code = @"class Program { static void Main() { [|var i = 42;|] var j = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; var expected = @"class Program { static void Main() { NewMethod1(); var j = 42; } private static void NewMethod1() { var i = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542594, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542594")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodRename2() { var code = @"class Program { static void Main() { NewMethod1(); [|var j = 42;|] } private static void NewMethod1() { var i = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; var expected = @"class Program { static void Main() { NewMethod1(); NewMethod3(); } private static void NewMethod3() { var j = 42; } private static void NewMethod1() { var i = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542632, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542632")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInInteractive1() { var code = @"int i; [|i = 2|]; i = 3;"; var expected = @"int i; i = NewMethod(); int NewMethod() { return 2; } i = 3;"; await TestExtractMethodAsync(code, expected, parseOptions: Options.Script); } [WorkItem(542670, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542670")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint1() { var code = @"using System; using System.Collections.Generic; class A { static void Goo<T, S, U>(T x) where T : IList<S> where S : IList<U> { var y = [|x.Count|]; } }"; var expected = @"using System; using System.Collections.Generic; class A { static void Goo<T, S, U>(T x) where T : IList<S> where S : IList<U> { var y = GetY<T, S>(x); } private static int GetY<T, S>(T x) where T : IList<S> { return x.Count; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")] [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint2() { var code = @" using System; interface I<T> where T : IComparable<T> { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : IComparable<T> { var y = [|x.Count|]; } } "; var expected = @" using System; interface I<T> where T : IComparable<T> { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : IComparable<T> { var y = GetY<T, S>(x); } private static int GetY<T, S>(S x) where T : IComparable<T> where S : I<T> { return x.Count; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")] [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint3() { var code = @" using System; interface I<T> where T : class { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : class { var y = [|x.Count|]; } } "; var expected = @" using System; interface I<T> where T : class { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : class { var y = GetY<T, S>(x); } private static int GetY<T, S>(S x) where T : class where S : I<T> { return x.Count; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint4() { var code = @" using System; using System.Collections.Generic; interface I<T> where T : class { } interface I2<T1, T2> : I<T1> where T1 : class, IEnumerable<T2> where T2 : struct { int Count { get; } } class A { public virtual void Goo<T, S>(S x) where S : IList<I2<IEnumerable<T>, T>> where T : struct { } } class B : A { public override void Goo<T, S>(S x) { var y = [|x.Count|]; } } "; var expected = @" using System; using System.Collections.Generic; interface I<T> where T : class { } interface I2<T1, T2> : I<T1> where T1 : class, IEnumerable<T2> where T2 : struct { int Count { get; } } class A { public virtual void Goo<T, S>(S x) where S : IList<I2<IEnumerable<T>, T>> where T : struct { } } class B : A { public override void Goo<T, S>(S x) { var y = GetY<T, S>(x); } private static int GetY<T, S>(S x) where T : struct where S : IList<I2<IEnumerable<T>, T>> { return x.Count; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraintBestEffort() { var code = @" using System; using System.Collections.Generic; using System.Linq; class A<T> { public virtual void Test<S>(S s) where S : T { } } class B : A<string> { public override void Test<S>(S s) { var t = [|s.ToString()|]; } } "; var expected = @" using System; using System.Collections.Generic; using System.Linq; class A<T> { public virtual void Test<S>(S s) where S : T { } } class B : A<string> { public override void Test<S>(S s) { var t = GetT(s); } private static string GetT<S>(S s) where S : string { return s.ToString(); } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(542672, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542672")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ConstructedTypes() { var code = @"using System; using System.Collections.Generic; class Program { static void Goo<T>() { List<T> x = new List<T>(); Action a = () => Console.WriteLine([|x.Count|]); } }"; var expected = @"using System; using System.Collections.Generic; class Program { static void Goo<T>() { List<T> x = new List<T>(); Action a = () => Console.WriteLine(GetCount(x)); } private static int GetCount<T>(List<T> x) { return x.Count; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542792, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542792")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeInDefault() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { Node<int, Exception> node = new Node<int, Exception>(); } } class Node<K, T> where T : new() { public K Key; public T Item; public Node<K, T> NextNode; public Node() { Key = default([|K|]); Item = new T(); NextNode = null; Console.WriteLine(Key); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { Node<int, Exception> node = new Node<int, Exception>(); } } class Node<K, T> where T : new() { public K Key; public T Item; public Node<K, T> NextNode; public Node() { Key = NewMethod(); Item = new T(); NextNode = null; Console.WriteLine(Key); } private static K NewMethod() { return default(K); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542708, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542708")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Script_ArgumentException() { var code = @"using System; public static void GetNonVirtualMethod<TDelegate>( Type type, string name) { Type delegateType = typeof(TDelegate); var invoke = [|delegateType|].GetMethod(""Invoke""); }"; var expected = @"using System; public static void GetNonVirtualMethod<TDelegate>( Type type, string name) { Type delegateType = typeof(TDelegate); var invoke = GetDelegateType(delegateType).GetMethod(""Invoke""); } Type GetDelegateType(Type delegateType) { return delegateType; }"; await TestExtractMethodAsync(code, expected, parseOptions: Options.Script); } [WorkItem(529008, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529008")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ReadOutSideIsUnReachable() { var code = @"class Test { public static void Main() { string str = string.Empty; object obj; [|lock (new string[][] { new string[] { str }, new string[] { str } }) { obj = new object(); return; }|] System.Console.Write(obj); } }"; var expected = @"class Test { public static void Main() { string str = string.Empty; object obj; NewMethod(str, out obj); return; System.Console.Write(obj); } private static void NewMethod(string str, out object obj) { lock (new string[][] { new string[] { str }, new string[] { str } }) { obj = new object(); return; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(543186, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543186")] public async Task AnonymousTypePropertyName() { var code = @"class C { void M() { var x = new { [|String|] = true }; } }"; var expected = @"class C { void M() { NewMethod(); } private static void NewMethod() { var x = new { String = true }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(543662, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543662")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentOfBaseConstrInit() { var code = @"class O { public O(int t) : base([|t|]) { } }"; var expected = @"class O { public O(int t) : base(GetT(t)) { } private static int GetT(int t) { return t; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task UnsafeType() { var code = @" unsafe class O { unsafe public O(int t) { [|t = 1;|] } }"; var expected = @" unsafe class O { unsafe public O(int t) { t = NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544144, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544144")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task CastExpressionWithImplicitUserDefinedConversion() { var code = @" class C { static public implicit operator long(C i) { return 5; } static void Main() { C c = new C(); int y1 = [|(int)c|]; } }"; var expected = @" class C { static public implicit operator long(C i) { return 5; } static void Main() { C c = new C(); int y1 = GetY1(c); } private static int GetY1(C c) { return (int)c; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544387, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544387")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task FixedPointerVariable() { var code = @" class Test { static int x = 0; unsafe static void Main() { fixed (int* p1 = &x) { int a1 = [|*p1|]; } } }"; var expected = @" class Test { static int x = 0; unsafe static void Main() { fixed (int* p1 = &x) { int a1 = GetA1(p1); } } private static unsafe int GetA1(int* p1) { return *p1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544444")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task PointerDeclarationStatement() { var code = @" class Program { unsafe static void Main() { int* p1 = null; [|int* p2 = p1;|] } }"; var expected = @" class Program { unsafe static void Main() { int* p1 = null; NewMethod(p1); } private static unsafe void NewMethod(int* p1) { int* p2 = p1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544446, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544446")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task PrecededByCastExpr() { var code = @" class Program { static void Main() { int i1 = (int)[|5L|]; } }"; var expected = @" class Program { static void Main() { int i1 = (int)NewMethod(); } private static long NewMethod() { return 5L; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542944")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExpressionWithLocalConst() { var code = @"class Program { static void Main(string[] args) { const string a = null; [|a = null;|] } }"; var expected = @"class Program { static void Main(string[] args) { const string a = null; a = NewMethod(a); } private static string NewMethod(string a) { a = null; return a; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542944")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExpressionWithLocalConst2() { var code = @"class Program { static void Main(string[] args) { const string a = null; [|a = null;|] } }"; var expected = @"class Program { static void Main(string[] args) { const string a = null; a = NewMethod(a); } private static string NewMethod(string a) { a = null; return a; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544675, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544675")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task HiddenPosition() { var code = @"class Program { static void Main(string[] args) { const string a = null; [|a = null;|] } #line default #line hidden }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(530609, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530609")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task NoCrashInteractive() { var code = @"[|if (true) { }|]"; var expected = @"NewMethod(); void NewMethod() { if (true) { } }"; await TestExtractMethodAsync(code, expected, parseOptions: new CSharpParseOptions(kind: SourceCodeKind.Script)); } [WorkItem(530322, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530322")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodShouldNotBreakFormatting() { var code = @"class C { void M(int i, int j, int k) { M(0, [|1|], 2); } }"; var expected = @"class C { void M(int i, int j, int k) { M(0, NewMethod(), 2); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(604389, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/604389")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractLiteralExpression() { var code = @"class Program { static void Main() { var c = new C { X = { Y = { [|1|] } } }; } } class C { public dynamic X; }"; var expected = @"class Program { static void Main() { var c = new C { X = { Y = { NewMethod() } } }; } private static int NewMethod() { return 1; } } class C { public dynamic X; }"; await TestExtractMethodAsync(code, expected); } [WorkItem(604389, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/604389")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractCollectionInitializer() { var code = @"class Program { static void Main() { var c = new C { X = { Y = [|{ 1 }|] } }; } } class C { public dynamic X; }"; var expected = @"class Program { static void Main() { var c = GetC(); } private static C GetC() { return new C { X = { Y = { 1 } } }; } } class C { public dynamic X; }"; await TestExtractMethodAsync(code, expected); } [WorkItem(854662, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854662")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractCollectionInitializer2() { var code = @"using System; using System.Collections.Generic; class Program { public Dictionary<int, int> A { get; private set; } static int Main(string[] args) { int a = 0; return new Program { A = { { [|a + 2|], 0 } } }.A.Count; } }"; var expected = @"using System; using System.Collections.Generic; class Program { public Dictionary<int, int> A { get; private set; } static int Main(string[] args) { int a = 0; return new Program { A = { { NewMethod(a), 0 } } }.A.Count; } private static int NewMethod(int a) { return a + 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530267, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530267")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestCoClassImplicitConversion() { var code = @"using System; using System.Runtime.InteropServices; [CoClass(typeof(C))] [ComImport] [Guid(""8D3A7A55-A8F5-4669-A5AD-996A3EB8F2ED"")] interface I { } class C : I { static void Main() { [|new I()|]; // Extract Method } }"; var expected = @"using System; using System.Runtime.InteropServices; [CoClass(typeof(C))] [ComImport] [Guid(""8D3A7A55-A8F5-4669-A5AD-996A3EB8F2ED"")] interface I { } class C : I { static void Main() { NewMethod(); // Extract Method } private static I NewMethod() { return new I(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530710")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestOverloadResolution() { var code = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, y => Inner(x => { [|x|].Ex(); }, y)); // Prints 1 } } static class E { public static void Ex(this int x) { } }"; var expected = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, (Action<string>)(y => Inner(x => { GetX(x).Ex(); }, y))); // Prints 1 } private static string GetX(string x) { return x; } } static class E { public static void Ex(this int x) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530710")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestOverloadResolution1() { var code = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, y => Inner(x => { [|x.Ex()|]; }, y)); // Prints 1 } } static class E { public static void Ex(this int x) { } }"; var expected = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, (Action<string>)(y => Inner(x => { NewMethod(x); }, y))); // Prints 1 } private static void NewMethod(string x) { x.Ex(); } } static class E { public static void Ex(this int x) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530710")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestOverloadResolution2() { var code = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, y => Inner(x => { [|x.Ex();|] }, y)); // Prints 1 } } static class E { public static void Ex(this int x) { } }"; var expected = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, (Action<string>)(y => Inner(x => { NewMethod(x); }, y))); // Prints 1 } private static void NewMethod(string x) { x.Ex(); } } static class E { public static void Ex(this int x) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(731924, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/731924")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestTreatEnumSpecial() { var code = @"using System; class Program { public enum A { A1, A2 } static void Main(string[] args) { A a = A.A1; [|Console.WriteLine(a);|] } }"; var expected = @"using System; class Program { public enum A { A1, A2 } static void Main(string[] args) { A a = A.A1; NewMethod(a); } private static void NewMethod(A a) { Console.WriteLine(a); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(756222, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756222")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestReturnStatementInAsyncMethod() { var code = @"using System.Threading.Tasks; class C { async Task<int> M() { await Task.Yield(); [|return 3;|] } }"; var expected = @"using System.Threading.Tasks; class C { async Task<int> M() { await Task.Yield(); return NewMethod(); } private static int NewMethod() { return 3; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(574576, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/574576")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestAsyncMethodWithRefOrOutParameters() { var code = @"using System.Threading.Tasks; class C { public async void Goo() { [|var q = 1; var p = 2; await Task.Yield();|] var r = q; var s = p; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(1025272, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1025272")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestAsyncMethodWithWellKnownValueType() { var code = @"using System; using System.Threading; using System.Threading.Tasks; class Program { public async Task Hello() { var cancellationToken = CancellationToken.None; [|var i = await Task.Run(() => { Console.WriteLine(); cancellationToken.ThrowIfCancellationRequested(); return 1; }, cancellationToken);|] cancellationToken.ThrowIfCancellationRequested(); Console.WriteLine(i); } }"; var expected = @"using System; using System.Threading; using System.Threading.Tasks; class Program { public async Task Hello() { var cancellationToken = CancellationToken.None; int i = await NewMethod(ref cancellationToken); cancellationToken.ThrowIfCancellationRequested(); Console.WriteLine(i); } private static async Task<int> NewMethod(ref CancellationToken cancellationToken) { return await Task.Run(() => { Console.WriteLine(); cancellationToken.ThrowIfCancellationRequested(); return 1; }, cancellationToken); } }"; await ExpectExtractMethodToFailAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestAsyncMethodWithWellKnownValueType1() { var code = @"using System; using System.Threading; using System.Threading.Tasks; class Program { public async Task Hello() { var cancellationToken = CancellationToken.None; [|var i = await Task.Run(() => { Console.WriteLine(); cancellationToken = CancellationToken.None; return 1; }, cancellationToken);|] cancellationToken.ThrowIfCancellationRequested(); Console.WriteLine(i); } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestDontPutOutOrRefForStructOff() { var code = @"using System.Threading.Tasks; namespace ClassLibrary9 { public struct S { public int I; } public class Class1 { private async Task<int> Test() { S s = new S(); s.I = 10; [|int i = await Task.Run(() => { var i2 = s.I; return Test(); });|] return i; } } }"; await ExpectExtractMethodToFailAsync(code, dontPutOutOrRefOnStruct: false); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestDontPutOutOrRefForStructOn() { var code = @"using System.Threading.Tasks; namespace ClassLibrary9 { public struct S { public int I; } public class Class1 { private async Task<int> Test() { S s = new S(); s.I = 10; [|int i = await Task.Run(() => { var i2 = s.I; return Test(); });|] return i; } } }"; var expected = @"using System.Threading.Tasks; namespace ClassLibrary9 { public struct S { public int I; } public class Class1 { private async Task<int> Test() { S s = new S(); s.I = 10; int i = await NewMethod(s); return i; } private async Task<int> NewMethod(S s) { return await Task.Run(() => { var i2 = s.I; return Test(); }); } } }"; await TestExtractMethodAsync(code, expected, dontPutOutOrRefOnStruct: true); } [Theory] [InlineData("add", "remove")] [InlineData("remove", "add")] [WorkItem(17474, "https://github.com/dotnet/roslyn/issues/17474")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractMethodEventAccessorUnresolvedName(string testedAccessor, string untestedAccessor) { // This code intentionally omits a 'using System;' var code = $@"namespace ClassLibrary9 {{ public class Class {{ public event EventHandler Event {{ {testedAccessor} {{ [|throw new NotImplementedException();|] }} {untestedAccessor} {{ throw new NotImplementedException(); }} }} }} }}"; var expected = $@"namespace ClassLibrary9 {{ public class Class {{ public event EventHandler Event {{ {testedAccessor} {{ NewMethod(); }} {untestedAccessor} {{ throw new NotImplementedException(); }} }} private static void NewMethod() {{ throw new NotImplementedException(); }} }} }}"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(19958, "https://github.com/dotnet/roslyn/issues/19958")] public async Task TestExtractMethodRefPassThrough() { var code = @"using System; namespace ClassLibrary9 { internal class ClassExtensions { public static int OtherMethod(ref int x) => x; public static void Method(ref int x) => Console.WriteLine(OtherMethod(ref [|x|])); } }"; var expected = @"using System; namespace ClassLibrary9 { internal class ClassExtensions { public static int OtherMethod(ref int x) => x; public static void Method(ref int x) => Console.WriteLine(OtherMethod(ref $x$)); public static ref int NewMethod(ref int x) { return ref x; } } }"; await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(19958, "https://github.com/dotnet/roslyn/issues/19958")] public async Task TestExtractMethodRefPassThroughDuplicateVariable() { var code = @"using System; namespace ClassLibrary9 { internal interface IClass { bool InterfaceMethod(ref Guid x, out IOtherClass y); } internal interface IOtherClass { bool OtherInterfaceMethod(); } internal static class ClassExtensions { public static void Method(this IClass instance, Guid guid) { var r = instance.InterfaceMethod(ref [|guid|], out IOtherClass guid); if (!r) return; r = guid.OtherInterfaceMethod(); if (r) throw null; } } }"; var expected = @"using System; namespace ClassLibrary9 { internal interface IClass { bool InterfaceMethod(ref Guid x, out IOtherClass y); } internal interface IOtherClass { bool OtherInterfaceMethod(); } internal static class ClassExtensions { public static void Method(this IClass instance, Guid guid) { var r = instance.InterfaceMethod(ref NewMethod(ref guid), out IOtherClass guid); if (!r) return; r = guid.OtherInterfaceMethod(); if (r) throw null; } public static ref Guid NewMethod(ref Guid guid) { return ref guid; } } }"; await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod_Argument1() { var service = new CSharpExtractMethodService(); Assert.NotNull(await Record.ExceptionAsync(async () => { var tree = await service.ExtractMethodAsync(document: null, textSpan: default, localFunction: false, options: null, CancellationToken.None); })); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod_Argument2() { var solution = new AdhocWorkspace().CurrentSolution; var projectId = ProjectId.CreateNewId(); var project = solution.AddProject(projectId, "Project", "Project.dll", LanguageNames.CSharp).GetProject(projectId); var document = project.AddMetadataReference(TestMetadata.Net451.mscorlib) .AddDocument("Document", SourceText.From("")); var service = new CSharpExtractMethodService() as IExtractMethodService; await service.ExtractMethodAsync(document, textSpan: default, localFunction: false); } [WpfFact] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [Trait(Traits.Feature, Traits.Features.Interactive)] public void ExtractMethodCommandDisabledInSubmission() { using var workspace = TestWorkspace.Create(XElement.Parse(@" <Workspace> <Submission Language=""C#"" CommonReferences=""true""> typeof(string).$$Name </Submission> </Workspace> "), workspaceKind: WorkspaceKind.Interactive, composition: EditorTestCompositions.EditorFeaturesWpf); // Force initialization. workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList(); var textView = workspace.Documents.Single().GetTextView(); var handler = workspace.ExportProvider.GetCommandHandler<ExtractMethodCommandHandler>(PredefinedCommandHandlerNames.ExtractMethod, ContentTypeNames.CSharpContentType); var state = handler.GetCommandState(new ExtractMethodCommandArgs(textView, textView.TextBuffer)); Assert.True(state.IsUnspecified); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction1() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|int localValue = arg;|] int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { NewMethod(arg); int LocalCapture() => arg; } private static void NewMethod(int arg) { int localValue = arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction2() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; [|int localValue = arg;|] } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; NewMethod(arg); } private static void NewMethod(int arg) { int localValue = arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction3() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|arg = arg + 3;|] int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { arg = NewMethod(arg); int LocalCapture() => arg; } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction4() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; [|arg = arg + 3;|] } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; arg = NewMethod(arg); } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction5() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|arg = arg + 3;|] arg = 1; int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { arg = NewMethod(arg); arg = 1; int LocalCapture() => arg; } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Theory] [InlineData("LocalCapture();")] [InlineData("System.Func<int> function = LocalCapture;")] [InlineData("System.Func<int> function = () => LocalCapture();")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodFlowsToLocalFunction1(string usageSyntax) { var code = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ [|arg = arg + 3;|] {usageSyntax} int LocalCapture() => arg; }} }} }}"; var expected = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ arg = NewMethod(arg); {usageSyntax} int LocalCapture() => arg; }} private static int NewMethod(int arg) {{ arg = arg + 3; return arg; }} }} }}"; await TestExtractMethodAsync(code, expected); } [Theory] [InlineData("LocalCapture();")] [InlineData("System.Func<int> function = LocalCapture;")] [InlineData("System.Func<int> function = () => LocalCapture();")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodFlowsToLocalFunction2(string usageSyntax) { var code = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int LocalCapture() => arg; [|arg = arg + 3;|] {usageSyntax} }} }} }}"; var expected = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int LocalCapture() => arg; arg = NewMethod(arg); {usageSyntax} }} private static int NewMethod(int arg) {{ arg = arg + 3; return arg; }} }} }}"; await TestExtractMethodAsync(code, expected); } /// <summary> /// This test verifies that Extract Method works properly when the region to extract references a local /// function, the local function uses an unassigned but wholly local variable. /// </summary> [Theory] [InlineData("LocalCapture();")] [InlineData("System.Func<int> function = LocalCapture;")] [InlineData("System.Func<int> function = () => LocalCapture();")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodFlowsToLocalFunctionWithUnassignedLocal(string usageSyntax) { var code = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int local; int LocalCapture() => arg + local; [|arg = arg + 3;|] {usageSyntax} }} }} }}"; var expected = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int local; int LocalCapture() => arg + local; arg = NewMethod(arg); {usageSyntax} }} private static int NewMethod(int arg) {{ arg = arg + 3; return arg; }} }} }}"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodDoesNotFlowToLocalFunction1() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|arg = arg + 3;|] arg = 1; int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { arg = NewMethod(arg); arg = 1; int LocalCapture() => arg; } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestUnreachableCodeModifiedInside() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable = null; var i = enumerable.Any(); return enumerable;|] } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { return NewMethod(ref enumerable); } private static IEnumerable<object> NewMethod(ref IEnumerable<object> enumerable) { while (true) ; enumerable = null; var i = enumerable.Any(); return enumerable; } } }"; // allowMovingDeclaration: false is default behavior on VS. // it doesn't affect result mostly but it does affect for symbols in unreachable code since // data flow in and out for the symbol is always set to false await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestUnreachableCodeModifiedOutside() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; var i = enumerable.Any();|] enumerable = null; return enumerable; } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { NewMethod(enumerable); enumerable = null; return enumerable; } private static void NewMethod(IEnumerable<object> enumerable) { while (true) ; var i = enumerable.Any(); } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestUnreachableCodeModifiedBoth() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable = null; var i = enumerable.Any();|] enumerable = null; return enumerable; } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { enumerable = NewMethod(enumerable); enumerable = null; return enumerable; } private static IEnumerable<object> NewMethod(IEnumerable<object> enumerable) { while (true) ; enumerable = null; var i = enumerable.Any(); return enumerable; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestLocalFunctionParameters() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { public void Bar(int value) { void Local(int value2) { [|Bar(value, value2);|] } } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { public void Bar(int value) { void Local(int value2) { NewMethod(value, value2); } } private void NewMethod(int value, int value2) { Bar(value, value2); } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestDataFlowInButNoReadInside() { var code = @"using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp39 { class Program { void Method(out object test) { test = null; var a = test != null; [|if (a) { return; } if (A == a) { test = new object(); }|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp39 { class Program { void Method(out object test) { test = null; var a = test != null; NewMethod(ref test, a); } private static void NewMethod(ref object test, bool a) { if (a) { return; } if (A == a) { test = new object(); } } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task AllowBestEffortForUnknownVariableDataFlow() { var code = @" class Program { void Method(out object test) { test = null; var a = test != null; [|if (a) { return; } if (A == a) { test = new object(); }|] } }"; var expected = @" class Program { void Method(out object test) { test = null; var a = test != null; NewMethod(ref test, a); } private static void NewMethod(ref object test, bool a) { if (a) { return; } if (A == a) { test = new object(); } } }"; await TestExtractMethodAsync(code, expected, allowBestEffort: true); } [WorkItem(30750, "https://github.com/dotnet/roslyn/issues/30750")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInInterface() { var code = @" interface Program { void Goo(); void Test() { [|Goo();|] } }"; var expected = @" interface Program { void Goo(); void Test() { NewMethod(); } void NewMethod() { Goo(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(33242, "https://github.com/dotnet/roslyn/issues/33242")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInExpressionBodiedConstructors() { var code = @" class Goo { private readonly string _bar; private Goo(string bar) => _bar = [|bar|]; }"; var expected = @" class Goo { private readonly string _bar; private Goo(string bar) => _bar = GetBar(bar); private static string GetBar(string bar) { return bar; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(33242, "https://github.com/dotnet/roslyn/issues/33242")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInExpressionBodiedFinalizers() { var code = @" class Goo { bool finalized; ~Goo() => finalized = [|true|]; }"; var expected = @" class Goo { bool finalized; ~Goo() => finalized = NewMethod(); private static bool NewMethod() { return true; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInvolvingFunctionPointer() { var code = @" class C { void M(delegate*<delegate*<ref string, ref readonly int>> ptr1) { string s = null; _ = [|ptr1()|](ref s); } }"; var expected = @" class C { void M(delegate*<delegate*<ref string, ref readonly int>> ptr1) { string s = null; _ = NewMethod(ptr1)(ref s); } private static delegate*<ref string, ref readonly int> NewMethod(delegate*<delegate*<ref string, ref readonly int>> ptr1) { return ptr1(); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInvolvingFunctionPointerWithTypeParameter() { var code = @" class C { void M<T1, T2>(delegate*<T1, T2> ptr1) { _ = [|ptr1|](); } }"; var expected = @" class C { void M<T1, T2>(delegate*<T1, T2> ptr1) { _ = GetPtr1(ptr1)(); } private static delegate*<T1, T2> GetPtr1<T1, T2>(delegate*<T1, T2> ptr1) { return ptr1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(44260, "https://github.com/dotnet/roslyn/issues/44260")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TopLevelStatement_ValueInAssignment() { var code = @" bool local; local = [|true|]; "; var expected = @" bool local; bool NewMethod() { return true; } local = NewMethod(); "; await TestExtractMethodAsync(code, expected); } [WorkItem(44260, "https://github.com/dotnet/roslyn/issues/44260")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TopLevelStatement_ArgumentInInvocation() { // Note: the cast should be simplified // https://github.com/dotnet/roslyn/issues/44260 var code = @" System.Console.WriteLine([|""string""|]); "; var expected = @" System.Console.WriteLine((string)NewMethod()); string NewMethod() { return ""string""; }"; await TestExtractMethodAsync(code, expected); } [Theory] [InlineData("unsafe")] [InlineData("checked")] [InlineData("unchecked")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(4950, "https://github.com/dotnet/roslyn/issues/4950")] public async Task ExtractMethodInvolvingUnsafeBlock(string keyword) { var code = $@" using System; class Program {{ static void Main(string[] args) {{ object value = args; [| IntPtr p; {keyword} {{ object t = value; p = IntPtr.Zero; }} |] Console.WriteLine(p); }} }} "; var expected = $@" using System; class Program {{ static void Main(string[] args) {{ object value = args; IntPtr p = NewMethod(value); Console.WriteLine(p); }} private static IntPtr NewMethod(object value) {{ IntPtr p; {keyword} {{ object t = value; p = IntPtr.Zero; }} return p; }} }} "; await TestExtractMethodAsync(code, expected); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.ExtractMethod; using Microsoft.CodeAnalysis.Editor.CSharp.ExtractMethod; using Microsoft.CodeAnalysis.Editor.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests.Extensions; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.ExtractMethod; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ExtractMethod { public partial class ExtractMethodTests : ExtractMethodBase { [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod1() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; i = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { NewMethod(); } private static void NewMethod() { int i = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod2() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i = 10; int i2 = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { NewMethod(); } private static void NewMethod() { int i = 10; int i2 = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod3() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; [|int i2 = i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; NewMethod(i); } private static void NewMethod(int i) { int i2 = i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod4() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; [|i2 += i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; i2 = NewMethod(i); } private static int NewMethod(int i, int i2) { i2 += i; return i2; } }"; // compoundaction not supported yet. await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod5() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; [|i2 = i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; int i2 = i; i2 = NewMethod(i); } private static int NewMethod(int i) { return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod6() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { int field; void Test(string[] args) { int i = 10; [|field = i;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { int field; void Test(string[] args) { int i = 10; NewMethod(i); } private void NewMethod(int i) { field = i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod7() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { string [] a = null; [|Test(a);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { string[] a = null; NewMethod(a); } private void NewMethod(string[] a) { Test(a); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod8() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Test(string[] args) { string [] a = null; [|Test(a);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Test(string[] args) { string[] a = null; NewMethod(a); } private static void NewMethod(string[] a) { Test(a); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod9() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i; string s; [|i = 10; s = args[0] + i.ToString();|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i; string s; NewMethod(args, out i, out s); } private static void NewMethod(string[] args, out int i, out string s) { i = 10; s = args[0] + i.ToString(); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod10() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; i = 10; string s; s = args[0] + i.ToString();|] Console.WriteLine(s); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { string s = NewMethod(args); Console.WriteLine(s); } private static string NewMethod(string[] args) { int i = 10; string s; s = args[0] + i.ToString(); return s; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod11() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; int i2 = 10;|] i = 10; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i; NewMethod(); i = 10; } private static void NewMethod() { int i2 = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod11_1() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i; int i2 = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { NewMethod(); } private static void NewMethod() { int i; int i2 = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod12() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; [|i = i + 1;|] Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { i = i + 1; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ControlVariableInForeachStatement() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { foreach (var s in args) { [|Console.WriteLine(s);|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { foreach (var s in args) { NewMethod(s); } } private static void NewMethod(string s) { Console.WriteLine(s); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod14() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { for(var i = 1; i < 10; i++) { [|Console.WriteLine(i);|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { for (var i = 1; i < 10; i++) { NewMethod(i); } } private static void NewMethod(int i) { Console.WriteLine(i); } }"; // var in for loop doesn't get bound yet await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod15() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int s = 10, i = 1; int b = s + i;|] System.Console.WriteLine(s); System.Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int s, i; NewMethod(out s, out i); System.Console.WriteLine(s); System.Console.WriteLine(i); } private static void NewMethod(out int s, out int i) { s = 10; i = 1; int b = s + i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod16() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { [|int i = 1;|] System.Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(string[] args) { int i = NewMethod(); System.Console.WriteLine(i); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538932")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod17() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { [|T t1; Test(out t1); t = t1;|] System.Console.WriteLine(t1.ToString()); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { T t1; NewMethod(out t, out t1); System.Console.WriteLine(t1.ToString()); } private void NewMethod<T>(out T t, out T t1) where T : class, new() { Test(out t1); t = t1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod18() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { [|T t1 = GetValue(out t);|] System.Console.WriteLine(t1.ToString()); } private T GetValue<T>(out T t) where T : class, new() { return t = new T(); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test<T>(out T t) where T : class, new() { T t1; NewMethod(out t, out t1); System.Console.WriteLine(t1.ToString()); } private void NewMethod<T>(out T t, out T t1) where T : class, new() { t1 = GetValue(out t); } private T GetValue<T>(out T t) where T : class, new() { return t = new T(); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod19() { var code = @"using System; using System.Collections.Generic; using System.Linq; unsafe class Program { void Test() { [|int i = 1;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; unsafe class Program { void Test() { NewMethod(); } private static void NewMethod() { int i = 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod20() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { unsafe void Test() { [|int i = 1;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { unsafe void Test() { NewMethod(); } private static unsafe void NewMethod() { int i = 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542677, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542677")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod21() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { unsafe { [|int i = 1;|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { unsafe { NewMethod(); } } private static unsafe void NewMethod() { int i = 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod22() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i; [|int b = 10; if (b < 10) { i = 5; }|] i = 6; Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i; i = NewMethod(i); i = 6; Console.WriteLine(i); } private static int NewMethod(int i) { int b = 10; if (b < 10) { i = 5; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod23() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (true) [|Console.WriteLine(args[0].ToString());|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (true) NewMethod(args); } private static void NewMethod(string[] args) { Console.WriteLine(args[0].ToString()); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod24() { var code = @"using System; class Program { static void Main(string[] args) { int y = [|int.Parse(args[0].ToString())|]; } }"; var expected = @"using System; class Program { static void Main(string[] args) { int y = GetY(args); } private static int GetY(string[] args) { return int.Parse(args[0].ToString()); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod25() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (([|new int[] { 1, 2, 3 }|]).Any()) { return; } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if ((NewMethod()).Any()) { return; } } private static int[] NewMethod() { return new int[] { 1, 2, 3 }; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod26() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if ([|(new int[] { 1, 2, 3 })|].Any()) { return; } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { if (NewMethod().Any()) { return; } } private static int[] NewMethod() { return (new int[] { 1, 2, 3 }); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod27() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i = 1; [|int b = 10; if (b < 10) { i = 5; }|] i = 6; Console.WriteLine(i); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test() { int i = 1; i = NewMethod(i); i = 6; Console.WriteLine(i); } private static int NewMethod(int i) { int b = 10; if (b < 10) { i = 5; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod28() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { [|return 1;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { return NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod29() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { int i = 0; [|if (i < 0) { return 1; } else { return 0; }|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { int Test() { int i = 0; return NewMethod(i); } private static int NewMethod(int i) { if (i < 0) { return 1; } else { return 0; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod30() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(out int i) { [|i = 10;|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { void Test(out int i) { i = NewMethod(); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod31() { var code = @"using System; using System.Collections.Generic; using System.Text; class Program { void Test() { StringBuilder builder = new StringBuilder(); [|builder.Append(""Hello""); builder.Append("" From ""); builder.Append("" Roslyn"");|] return builder.ToString(); } }"; var expected = @"using System; using System.Collections.Generic; using System.Text; class Program { void Test() { StringBuilder builder = new StringBuilder(); NewMethod(builder); return builder.ToString(); } private static void NewMethod(StringBuilder builder) { builder.Append(""Hello""); builder.Append("" From ""); builder.Append("" Roslyn""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod32() { var code = @"using System; class Program { void Test() { int v = 0; Console.Write([|v|]); } }"; var expected = @"using System; class Program { void Test() { int v = 0; Console.Write(GetV(v)); } private static int GetV(int v) { return v; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(3792, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod33() { var code = @"using System; class Program { void Test() { int v = 0; while (true) { Console.Write([|v++|]); } } }"; var expected = @"using System; class Program { void Test() { int v = 0; while (true) { Console.Write(NewMethod(ref v)); } } private static int NewMethod(ref int v) { return v++; } }"; // this bug has two issues. one is "v" being not in the dataFlowIn and ReadInside collection (hence no method parameter) // and the other is binding not working for "v++" (hence object as return type) await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod34() { var code = @"using System; class Program { static void Main(string[] args) { int x = 1; int y = 2; int z = [|x + y|]; } } "; var expected = @"using System; class Program { static void Main(string[] args) { int x = 1; int y = 2; int z = GetZ(x, y); } private static int GetZ(int x, int y) { return x + y; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(538239, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538239")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod35() { var code = @"using System; class Program { static void Main(string[] args) { int[] r = [|new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }|]; } }"; var expected = @"using System; class Program { static void Main(string[] args) { int[] r = GetR(); } private static int[] GetR() { return new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod36() { var code = @"using System; class Program { static void Main(ref int i) { [|i = 1;|] } }"; var expected = @"using System; class Program { static void Main(ref int i) { i = NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod37() { var code = @"using System; class Program { static void Main(out int i) { [|i = 1;|] } }"; var expected = @"using System; class Program { static void Main(out int i) { i = NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538231")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod38() { var code = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract // unassigned = ReturnVal(0); [|unassigned = unassigned + 10;|] // read // int newVar = unassigned; // write // unassigned = 0; } }"; var expected = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract // unassigned = ReturnVal(0); unassigned = NewMethod(unassigned); // read // int newVar = unassigned; // write // unassigned = 0; } private static int NewMethod(int unassigned) { unassigned = unassigned + 10; return unassigned; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538231")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod39() { var code = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract [|// unassigned = ReturnVal(0); unassigned = unassigned + 10; // read|] // int newVar = unassigned; // write // unassigned = 0; } }"; var expected = @"using System; class Program { static void Main(string[] args) { // int v = 0; // while (true) // { // NewMethod(v++); // NewMethod(ReturnVal(v++)); // } int unassigned; // extract unassigned = NewMethod(unassigned); // int newVar = unassigned; // write // unassigned = 0; } private static int NewMethod(int unassigned) { // unassigned = ReturnVal(0); unassigned = unassigned + 10; // read return unassigned; } }"; // current bottom-up re-writer makes re-attaching trivia half belongs to previous token // and half belongs to next token very hard. // for now, it won't be able to re-associate trivia belongs to next token. await TestExtractMethodAsync(code, expected); } [WorkItem(538303, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538303")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod40() { var code = @"class Program { static void Main(string[] args) { [|int x;|] } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(868414, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/868414")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodWithLeadingTrivia() { // ensure that the extraction doesn't result in trivia moving up a line: // // a //b // NewMethod(); await TestExtractMethodAsync( @"class C { void M() { // a // b [|System.Console.WriteLine();|] } }", @"class C { void M() { // a // b NewMethod(); } private static void NewMethod() { System.Console.WriteLine(); } }"); } [WorkItem(632351, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/632351")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodFailForTypeInFromClause() { var code = @"class Program { static void Main(string[] args) { var z = from [|T|] x in e; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(632351, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/632351")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodFailForTypeInFromClause_1() { var code = @"class Program { static void Main(string[] args) { var z = from [|W.T|] x in e; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(538314, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538314")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod41() { var code = @"class Program { static void Main(string[] args) { int x = 10; [|int y; if (x == 10) y = 5;|] Console.WriteLine(y); } }"; var expected = @"class Program { static void Main(string[] args) { int x = 10; int y = NewMethod(x); Console.WriteLine(y); } private static int NewMethod(int x) { int y; if (x == 10) y = 5; return y; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538327, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538327")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod42() { var code = @"using System; class Program { static void Main(string[] args) { int a, b; [|a = 5; b = 7;|] Console.Write(a + b); } }"; var expected = @"using System; class Program { static void Main(string[] args) { int a, b; NewMethod(out a, out b); Console.Write(a + b); } private static void NewMethod(out int a, out int b) { a = 5; b = 7; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538327, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538327")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod43() { var code = @"using System; class Program { static void Main(string[] args) { int a, b; [|a = 5; b = 7; int c; int d; int e, f; c = 1; d = 1; e = 1; f = 1;|] Console.Write(a + b); } }"; var expected = @"using System; class Program { static void Main(string[] args) { int a, b; NewMethod(out a, out b); Console.Write(a + b); } private static void NewMethod(out int a, out int b) { a = 5; b = 7; int c; int d; int e, f; c = 1; d = 1; e = 1; f = 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538328, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538328")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod44() { var code = @"using System; class Program { static void Main(string[] args) { int a; //modified in [|a = 1;|] /*data flow out*/ Console.Write(a); } }"; var expected = @"using System; class Program { static void Main(string[] args) { int a; //modified in a = NewMethod(); /*data flow out*/ Console.Write(a); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538393, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538393")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod45() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { /**/[|;|]/**/ } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { /**/ NewMethod();/**/ } private static void NewMethod() { ; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538393, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538393")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod46() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; [|Goo(ref x);|] Console.WriteLine(x); } static void Goo(ref int x) { x = x + 1; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; x = NewMethod(x); Console.WriteLine(x); } private static int NewMethod(int x) { Goo(ref x); return x; } static void Goo(ref int x) { x = x + 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538399, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538399")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod47() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; [|while (true) Console.WriteLine(x);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; NewMethod(x); } private static void NewMethod(int x) { while (true) Console.WriteLine(x); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538401, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538401")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod48() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int[] x = [|{ 1, 2, 3 }|]; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int[] x = GetX(); } private static int[] GetX() { return new int[] { 1, 2, 3 }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538405, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538405")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod49() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Goo(int GetX) { int x = [|1|]; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Goo(int GetX) { int x = GetX1(); } private static int GetX1() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNormalProperty() { var code = @" class Class { private static string name; public static string Names { get { return ""1""; } set { name = value; } } static void Goo(int i) { string str = [|Class.Names|]; } }"; var expected = @" class Class { private static string name; public static string Names { get { return ""1""; } set { name = value; } } static void Goo(int i) { string str = GetStr(); } private static string GetStr() { return Class.Names; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538932")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodAutoProperty() { var code = @" class Class { public string Name { get; set; } static void Main() { string str = new Class().[|Name|]; } }"; // given span is not an expression // selection validator should take care of this case var expected = @" class Class { public string Name { get; set; } static void Main() { string str = GetStr(); } private static string GetStr() { return new Class().Name; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538402, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538402")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix3994() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { byte x = [|1|]; } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { byte x = GetX(); } private static byte GetX() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538404, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538404")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix3996() { var code = @"class A<T> { class D : A<T> { } class B { } static D.B Goo() { return null; } class C<T2> { static void Bar() { D.B x = [|Goo()|]; } } }"; var expected = @"class A<T> { class D : A<T> { } class B { } static D.B Goo() { return null; } class C<T2> { static void Bar() { D.B x = GetX(); } private static B GetX() { return Goo(); } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task InsertionPoint() { var code = @"class Test { void Method(string i) { int y2 = [|1|]; } void Method(int i) { } }"; var expected = @"class Test { void Method(string i) { int y2 = GetY2(); } private static int GetY2() { return 1; } void Method(int i) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538980")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4757() { var code = @"class GenericMethod { void Method<T>(T t) { T a; [|a = t;|] } }"; var expected = @"class GenericMethod { void Method<T>(T t) { T a; a = NewMethod(t); } private static T NewMethod<T>(T t) { return t; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538980")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4757_2() { var code = @"class GenericMethod<T1> { void Method<T>(T t) { T a; T1 b; [|a = t; b = default(T1);|] } }"; var expected = @"class GenericMethod<T1> { void Method<T>(T t) { T a; T1 b; NewMethod(t, out a, out b); } private static void NewMethod<T>(T t, out T a, out T1 b) { a = t; b = default(T1); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538980, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538980")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4757_3() { var code = @"class GenericMethod { void Method<T, T1>(T t) { T1 a1; T a; [|a = t; a1 = default(T);|] } }"; var expected = @"class GenericMethod { void Method<T, T1>(T t) { T1 a1; T a; NewMethod(t, out a1, out a); } private static void NewMethod<T, T1>(T t, out T1 a1, out T a) { a = t; a1 = default(T); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538422, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538422")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4758() { var code = @"using System; class TestOutParameter { void Method(out int x) { x = 5; Console.Write([|x|]); } }"; var expected = @"using System; class TestOutParameter { void Method(out int x) { x = 5; Console.Write(GetX(x)); } private static int GetX(int x) { return x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538422, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538422")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4758_2() { var code = @"class TestOutParameter { void Method(out int x) { x = 5; Console.Write([|x|]); } }"; var expected = @"class TestOutParameter { void Method(out int x) { x = 5; Console.Write(GetX(x)); } private static int GetX(int x) { return x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538984, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538984")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4761() { var code = @"using System; class A { void Method() { System.Func<int, int> a = x => [|x * x|]; } }"; var expected = @"using System; class A { void Method() { System.Func<int, int> a = x => NewMethod(x); } private static int NewMethod(int x) { return x * x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538997, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538997")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4779() { var code = @"using System; class Program { static void Main() { string s = ""; Func<string> f = [|s|].ToString; } } "; var expected = @"using System; class Program { static void Main() { string s = ""; Func<string> f = GetS(s).ToString; } private static string GetS(string s) { return s; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(538997, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538997")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4779_2() { var code = @"using System; class Program { static void Main() { string s = ""; var f = [|s|].ToString(); } } "; var expected = @"using System; class Program { static void Main() { string s = ""; var f = GetS(s).ToString(); } private static string GetS(string s) { return s; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(4780, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4780() { var code = @"using System; class Program { static void Main() { string s = ""; object f = (Func<string>)[|s.ToString|]; } }"; var expected = @"using System; class Program { static void Main() { string s = ""; object f = (Func<string>)GetToString(s); } private static Func<string> GetToString(string s) { return s.ToString; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(4780, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4780_2() { var code = @"using System; class Program { static void Main() { string s = ""; object f = (string)[|s.ToString()|]; } }"; var expected = @"using System; class Program { static void Main() { string s = ""; object f = (string)NewMethod(s); } private static string NewMethod(string s) { return s.ToString(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(4782, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4782() { var code = @"class A<T> { class D : A<T[]> { } class B { } class C<T> { static void Goo<T>(T a) { T t = [|default(T)|]; } } }"; var expected = @"class A<T> { class D : A<T[]> { } class B { } class C<T> { static void Goo<T>(T a) { T t = GetT<T>(); } private static T GetT<T>() { return default(T); } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(4782, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4782_2() { var code = @"class A<T> { class D : A<T[]> { } class B { } class C<T> { static void Goo() { D.B x = [|new D.B()|]; } } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(4791, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4791() { var code = @"class Program { delegate int Func(int a); static void Main(string[] args) { Func v = (int a) => [|a|]; } }"; var expected = @"class Program { delegate int Func(int a); static void Main(string[] args) { Func v = (int a) => GetA(a); } private static int GetA(int a) { return a; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539019, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539019")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4809() { var code = @"class Program { public Program() { [|int x = 2;|] } }"; var expected = @"class Program { public Program() { NewMethod(); } private static void NewMethod() { int x = 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539029, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539029")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4813() { var code = @"using System; class Program { public Program() { object o = [|new Program()|]; } }"; var expected = @"using System; class Program { public Program() { object o = GetO(); } private static Program GetO() { return new Program(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538425, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538425")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4031() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { bool x = true, y = true, z = true; if (x) while (y) { } else [|while (z) { }|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { bool x = true, y = true, z = true; if (x) while (y) { } else NewMethod(z); } private static void NewMethod(bool z) { while (z) { } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(527499, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527499")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix3992() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; [|while (false) Console.WriteLine(x);|] } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int x = 1; NewMethod(x); } private static void NewMethod(int x) { while (false) Console.WriteLine(x); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539029, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539029")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4823() { var code = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", [|Area|]); } }"; var expected = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", GetArea()); } private double GetArea() { return Area; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(538985, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538985")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4762() { var code = @"class Program { static void Main(string[] args) { //comments [|int x = 2;|] } } "; var expected = @"class Program { static void Main(string[] args) { //comments NewMethod(); } private static void NewMethod() { int x = 2; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(538966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538966")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BugFix4744() { var code = @"class Program { static void Main(string[] args) { [|int x = 2; //comments|] } } "; var expected = @"class Program { static void Main(string[] args) { NewMethod(); } private static void NewMethod() { int x = 2; //comments } } "; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesNoNo() { var code = @"using System; class Program { void Test1() { int i; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test1() { int i; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesNoYes() { var code = @"using System; class Program { void Test2() { int i = 0; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test2() { int i = 0; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesYesNo() { var code = @"using System; class Program { void Test3() { int i; while (i > 10) ; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test3() { int i; while (i > 10) ; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoNoYesYesYes() { var code = @"using System; class Program { void Test4() { int i = 10; while (i > 10) ; [| if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test4() { int i = 10; while (i > 10) ; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesNoNo() { var code = @"using System; class Program { void Test4_1() { int i; [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_1() { int i; i = NewMethod(); } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesNoYes() { var code = @"using System; class Program { void Test4_2() { int i = 10; [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_2() { int i = 10; i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesYesNo() { var code = @"using System; class Program { void Test4_3() { int i; Console.WriteLine(i); [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_3() { int i; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoNoYesYesYesYes() { var code = @"using System; class Program { void Test4_4() { int i = 10; Console.WriteLine(i); [| if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } |] } }"; var expected = @"using System; class Program { void Test4_4() { int i = 10; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 0) { i = 10; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoNoNoNo() { var code = @"using System; class Program { void Test5() { [| int i; |] } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoNoNoYes() { var code = @"using System; class Program { void Test6() { [| int i; |] i = 1; } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoYesNoNo() { var code = @"using System; class Program { void Test7() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test7() { NewMethod(); } private static void NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesNoYesNoYes() { var code = @"using System; class Program { void Test8() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } |] i = 2; } }"; var expected = @"using System; class Program { void Test8() { int i = NewMethod(); i = 2; } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesNoNoNo() { var code = @"using System; class Program { void Test9() { [| int i; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test9() { NewMethod(); } private static void NewMethod() { int i; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesNoNoYes() { var code = @"using System; class Program { void Test10() { [| int i; Console.WriteLine(i); |] i = 10; } }"; var expected = @"using System; class Program { void Test10() { int i; NewMethod(); i = 10; } private static void NewMethod() { int i; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesYesNoNo() { var code = @"using System; class Program { void Test11() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test11() { NewMethod(); } private static void NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoNoYesYesYesNoYes() { var code = @"using System; class Program { void Test12() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] i = 10; } }"; var expected = @"using System; class Program { void Test12() { int i = NewMethod(); i = 10; } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesNoNo() { var code = @"using System; class Program { void Test13() { int i; [| i = 10; |] } }"; var expected = @"using System; class Program { void Test13() { int i; i = NewMethod(); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesNoYes() { var code = @"using System; class Program { void Test14() { int i; [| i = 10; |] i = 1; } }"; var expected = @"using System; class Program { void Test14() { int i; i = NewMethod(); i = 1; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesYesNo() { var code = @"using System; class Program { void Test15() { int i; Console.WriteLine(i); [| i = 10; |] } }"; var expected = @"using System; class Program { void Test15() { int i; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoNoYesYesYes() { var code = @"using System; class Program { void Test16() { int i; [| i = 10; |] i = 10; Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test16() { int i; i = NewMethod(); i = 10; Console.WriteLine(i); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } // dataflow in and out can be false for symbols in unreachable code // boolean indicates // dataFlowIn: false, dataFlowOut: false, alwaysAssigned: true, variableDeclared: false, readInside: true, writtenInside: false, readOutside: false, writtenOutside: true [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesNoNoYes() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable.Select(e => """"); return enumerable;|] } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { return NewMethod(enumerable); } private static IEnumerable<object> NewMethod(IEnumerable<object> enumerable) { while (true) ; enumerable.Select(e => """"); return enumerable; } } }"; await TestExtractMethodAsync(code, expected); } // dataflow in and out can be false for symbols in unreachable code // boolean indicates // dataFlowIn: false, dataFlowOut: false, alwaysAssigned: true, variableDeclared: false, readInside: true, writtenInside: false, readOutside: true, writtenOutside: true [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesNoYesYes() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable.Select(e => """");|] return enumerable; } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { enumerable = NewMethod(enumerable); return enumerable; } private static IEnumerable<object> NewMethod(IEnumerable<object> enumerable) { while (true) ; enumerable.Select(e => """"); return enumerable; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesNoNo() { var code = @"using System; class Program { void Test16_1() { int i; [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_1() { int i; i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesNoYes() { var code = @"using System; class Program { void Test16_2() { int i = 10; [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_2() { int i = 10; i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesYesNo() { var code = @"using System; class Program { void Test16_3() { int i; Console.WriteLine(i); [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_3() { int i; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesNoYesYesYesYes() { var code = @"using System; class Program { void Test16_4() { int i = 10; Console.WriteLine(i); [| i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test16_4() { int i = 10; Console.WriteLine(i); i = NewMethod(); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesNoYesNoNo() { var code = @"using System; class Program { void Test17() { [| int i = 10; |] } }"; var expected = @"using System; class Program { void Test17() { NewMethod(); } private static void NewMethod() { int i = 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesNoYesNoYes() { var code = @"using System; class Program { void Test18() { [| int i = 10; |] i = 10; } }"; var expected = @"using System; class Program { void Test18() { int i = NewMethod(); i = 10; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesYesYesNoNo() { var code = @"using System; class Program { void Test19() { [| int i = 10; Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test19() { NewMethod(); } private static void NewMethod() { int i = 10; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoNoYesYesYesYesNoYes() { var code = @"using System; class Program { void Test20() { [| int i = 10; Console.WriteLine(i); |] i = 10; } }"; var expected = @"using System; class Program { void Test20() { int i; NewMethod(); i = 10; } private static void NewMethod() { int i = 10; Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoNoYesYesNo() { var code = @"using System; class Program { void Test21() { int i; [| if (int.Parse(""1"") > 10) { i = 1; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test21() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoNoYesYesYes() { var code = @"using System; class Program { void Test22() { int i = 10; [| if (int.Parse(""1"") > 10) { i = 1; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test22() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoYesYesYesNo() { var code = @"using System; class Program { void Test22_1() { int i; [| if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test22_1() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoNoYesYesYesYes() { var code = @"using System; class Program { void Test22_2() { int i = 10; [| if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test22_2() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { if (int.Parse(""1"") > 10) { i = 1; Console.WriteLine(i); } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoNoYesNo() { var code = @"using System; class Program { void Test23() { [| int i; |] Console.WriteLine(i); } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoNoYesYes() { var code = @"using System; class Program { void Test24() { [| int i; |] Console.WriteLine(i); i = 10; } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoYesYesNo() { var code = @"using System; class Program { void Test25() { [| int i; if (int.Parse(""1"") > 9) { i = 10; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test25() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i; if (int.Parse(""1"") > 9) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesNoYesYesYes() { var code = @"using System; class Program { void Test26() { [| int i; if (int.Parse(""1"") > 9) { i = 10; } |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test26() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i; if (int.Parse(""1"") > 9) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesNoYesNo() { var code = @"using System; class Program { void Test27() { [| int i; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test27() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesNoYesYes() { var code = @"using System; class Program { void Test28() { [| int i; Console.WriteLine(i); |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test28() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesYesYesNo() { var code = @"using System; class Program { void Test29() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test29() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesNoYesYesYesYesYes() { var code = @"using System; class Program { void Test30() { [| int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test30() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i; if (int.Parse(""1"") > 0) { i = 10; } Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoNoYesYesNo() { var code = @"using System; class Program { void Test31() { int i; [| i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test31() { int i; i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoNoYesYesYes() { var code = @"using System; class Program { void Test32() { int i; [| i = 10; |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test32() { int i; i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoYesYesYesNo() { var code = @"using System; class Program { void Test32_1() { int i; [| i = 10; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test32_1() { int i; i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesNoYesYesYesYes() { var code = @"using System; class Program { void Test32_2() { int i = 10; [| i = 10; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test32_2() { int i = 10; i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesNoYesYesNo() { var code = @"using System; class Program { void Test33() { [| int i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test33() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesNoYesYesYes() { var code = @"using System; class Program { void Test34() { [| int i = 10; |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test34() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesYesYesYesNo() { var code = @"using System; class Program { void Test35() { [| int i = 10; Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test35() { int i = NewMethod(); Console.WriteLine(i); } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_NoYesYesYesYesYesYesYes() { var code = @"using System; class Program { void Test36() { [| int i = 10; Console.WriteLine(i); |] Console.WriteLine(i); i = 10; } }"; var expected = @"using System; class Program { void Test36() { int i = NewMethod(); Console.WriteLine(i); i = 10; } private static int NewMethod() { int i = 10; Console.WriteLine(i); return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoNoNo() { var code = @"using System; class Program { void Test37() { int i; [| Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test37() { int i; NewMethod(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoNoYes() { var code = @"using System; class Program { void Test38() { int i = 10; [| Console.WriteLine(i); |] } }"; var expected = @"using System; class Program { void Test38() { int i = 10; NewMethod(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoYesNo() { var code = @"using System; class Program { void Test39() { int i; [| Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test39() { int i; NewMethod(i); Console.WriteLine(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesNoYesYes() { var code = @"using System; class Program { void Test40() { int i = 10; [| Console.WriteLine(i); |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test40() { int i = 10; NewMethod(i); Console.WriteLine(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesNoNo() { var code = @"using System; class Program { void Test41() { int i; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test41() { int i; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesNoYes() { var code = @"using System; class Program { void Test42() { int i = 10; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test42() { int i = 10; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesYesNo() { var code = @"using System; class Program { void Test43() { int i; Console.WriteLine(i); [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test43() { int i; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoNoNoYesYesYesYes() { var code = @"using System; class Program { void Test44() { int i = 10; Console.WriteLine(i); [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] } }"; var expected = @"using System; class Program { void Test44() { int i = 10; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesNoNo() { var code = @"using System; class Program { void Test45() { int i; [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test45() { int i; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesNoYes() { var code = @"using System; class Program { void Test46() { int i = 10; [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test46() { int i = 10; i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesYesNo() { var code = @"using System; class Program { void Test47() { int i; Console.WriteLine(i); [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test47() { int i; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesNoYesNoYesYesYesYes() { var code = @"using System; class Program { void Test48() { int i = 10; Console.WriteLine(i); [| Console.WriteLine(i); i = 10; |] } }"; var expected = @"using System; class Program { void Test48() { int i = 10; Console.WriteLine(i); i = NewMethod(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesNoNoYesYesYesNo() { var code = @"using System; class Program { void Test49() { int i; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test49() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesNoNoYesYesYesYes() { var code = @"using System; class Program { void Test50() { int i = 10; [| Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test50() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); if (int.Parse(""1"") > 0) { i = 10; } return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesYesNoYesYesYesNo() { var code = @"using System; class Program { void Test51() { int i; [| Console.WriteLine(i); i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test51() { int i; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task MatrixCase_YesYesYesNoYesYesYesYes() { var code = @"using System; class Program { void Test52() { int i = 10; [| Console.WriteLine(i); i = 10; |] Console.WriteLine(i); } }"; var expected = @"using System; class Program { void Test52() { int i = 10; i = NewMethod(i); Console.WriteLine(i); } private static int NewMethod(int i) { Console.WriteLine(i); i = 10; return i; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539049, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539049")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInProperty1() { var code = @"class C2 { static public int Area { get { return 1; } } } class C3 { public static int Area { get { return [|C2.Area|]; } } } "; var expected = @"class C2 { static public int Area { get { return 1; } } } class C3 { public static int Area { get { return GetArea(); } } private static int GetArea() { return C2.Area; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539049, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539049")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInProperty2() { var code = @"class C3 { public static int Area { get { [|int i = 10; return i;|] } } } "; var expected = @"class C3 { public static int Area { get { return NewMethod(); } } private static int NewMethod() { return 10; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539049, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539049")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInProperty3() { var code = @"class C3 { public static int Area { set { [|int i = value;|] } } } "; var expected = @"class C3 { public static int Area { set { NewMethod(value); } } private static void NewMethod(int value) { int i = value; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539029, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539029")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodProperty() { var code = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", [|Area|]); } } "; var expected = @"class Program { private double area = 1.0; public double Area { get { return area; } } public override string ToString() { return string.Format(""{0:F2}"", GetArea()); } private double GetArea() { return Area; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(539196, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539196")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodWithDeclareOneMoreVariablesInSameLineBeUsedAfter() { var code = @"class C { void M() { [|int x, y = 1;|] x = 4; Console.Write(x + y); } }"; var expected = @"class C { void M() { int x; int y = NewMethod(); x = 4; Console.Write(x + y); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539196, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539196")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodWithDeclareOneMoreVariablesInSameLineNotBeUsedAfter() { var code = @"class C { void M() { [|int x, y = 1;|] } }"; var expected = @"class C { void M() { NewMethod(); } private static void NewMethod() { int x, y = 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539214, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539214")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodForSplitOutStatementWithComments() { var code = @"class C { void M() { //start [|int x, y; x = 5; y = 10;|] //end Console.Write(x + y); } }"; var expected = @"class C { void M() { //start int x, y; NewMethod(out x, out y); //end Console.Write(x + y); } private static void NewMethod(out int x, out int y) { x = 5; y = 10; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539225, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539225")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5098() { var code = @"class Program { static void Main(string[] args) { [|return;|] Console.Write(4); } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(539229, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539229")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5107() { var code = @"class Program { static void Main(string[] args) { int i = 10; [|int j = j + i;|] Console.Write(i); Console.Write(j); } }"; var expected = @"class Program { static void Main(string[] args) { int i = 10; int j = NewMethod(i); Console.Write(i); Console.Write(j); } private static int NewMethod(int i) { return j + i; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539500, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539500")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task LambdaLiftedVariable1() { var code = @"class Program { delegate void Func(ref int i, int r); static void Main(string[] args) { int temp = 2; Func fnc = (ref int arg, int arg2) => { [|temp = arg = arg2;|] }; temp = 4; fnc(ref temp, 2); System.Console.WriteLine(temp); } }"; var expected = @"class Program { delegate void Func(ref int i, int r); static void Main(string[] args) { int temp = 2; Func fnc = (ref int arg, int arg2) => { NewMethod(out arg, arg2, out temp); }; temp = 4; fnc(ref temp, 2); System.Console.WriteLine(temp); } private static void NewMethod(out int arg, int arg2, out int temp) { temp = arg = arg2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539488, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539488")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task LambdaLiftedVariable2() { var code = @"class Program { delegate void Action(); static void Main(string[] args) { int i = 0; Action query = null; if (i == 0) { query = () => { System.Console.WriteLine(i); }; } [|i = 3;|] query(); } }"; var expected = @"class Program { delegate void Action(); static void Main(string[] args) { int i = 0; Action query = null; if (i == 0) { query = () => { System.Console.WriteLine(i); }; } i = NewMethod(); query(); } private static int NewMethod() { return 3; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { [|TestDelegate testDel = (ref int x) => { x = 10; };|] int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = NewMethod(); int p = 2; testDel(ref p); Console.WriteLine(p); } private static TestDelegate NewMethod() { return (ref int x) => { x = 10; }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533_1() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { [|TestDelegate testDel = (ref int x) => { int y = x; x = 10; };|] int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = NewMethod(); int p = 2; testDel(ref p); Console.WriteLine(p); } private static TestDelegate NewMethod() { return (ref int x) => { int y = x; x = 10; }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533_2() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = (ref int x) => { [|int y = x; x = 10;|] }; int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = (ref int x) => { x = NewMethod(x); }; int p = 2; testDel(ref p); Console.WriteLine(p); } private static int NewMethod(int x) { int y = x; x = 10; return x; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539531")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5533_3() { var code = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { [|TestDelegate testDel = delegate (ref int x) { x = 10; };|] int p = 2; testDel(ref p); Console.WriteLine(p); } }"; var expected = @"using System; class Program { delegate void TestDelegate(ref int x); static void Main(string[] args) { TestDelegate testDel = NewMethod(); int p = 2; testDel(ref p); Console.WriteLine(p); } private static TestDelegate NewMethod() { return delegate (ref int x) { x = 10; }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539859, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539859")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task LambdaLiftedVariable3() { var code = @"using System; class Program { static void Main(string[] args) { Action<int> F = x => { Action<int> F2 = x2 => { [|Console.WriteLine(args.Length + x2 + x);|] }; F2(x); }; F(args.Length); } }"; var expected = @"using System; class Program { static void Main(string[] args) { Action<int> F = x => { Action<int> F2 = x2 => { NewMethod(args, x, x2); }; F2(x); }; F(args.Length); } private static void NewMethod(string[] args, int x, int x2) { Console.WriteLine(args.Length + x2 + x); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539882, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539882")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug5982() { var code = @"using System; using System.Collections.Generic; class Program { static void Main(string[] args) { List<int> list = new List<int>(); Console.WriteLine([|list.Capacity|]); } }"; var expected = @"using System; using System.Collections.Generic; class Program { static void Main(string[] args) { List<int> list = new List<int>(); Console.WriteLine(GetCapacity(list)); } private static int GetCapacity(List<int> list) { return list.Capacity; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539932, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539932")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6041() { var code = @"using System; class Program { delegate R Del<in T, out R>(T arg); public void Goo() { Del<Exception, ArgumentException> d = (arg) => { return new ArgumentException(); }; [|d(new ArgumentException());|] } }"; var expected = @"using System; class Program { delegate R Del<in T, out R>(T arg); public void Goo() { Del<Exception, ArgumentException> d = (arg) => { return new ArgumentException(); }; NewMethod(d); } private static void NewMethod(Del<Exception, ArgumentException> d) { d(new ArgumentException()); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540183, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540183")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod50() { var code = @"class C { void Method() { while (true) { [|int i = 1; while (false) { int j = 1;|] } } } }"; var expected = @"class C { void Method() { while (true) { NewMethod(); } } private static void NewMethod() { int i = 1; while (false) { int j = 1; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod51() { var code = @"class C { void Method() { while (true) { switch(1) { case 1: [|int i = 10; break; case 2: int i2 = 20;|] break; } } } }"; var expected = @"class C { void Method() { while (true) { NewMethod(); } } private static void NewMethod() { switch (1) { case 1: int i = 10; break; case 2: int i2 = 20; break; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod52() { var code = @"class C { void Method() { [|int i = 1; while (false) { int j = 1;|] } } }"; var expected = @"class C { void Method() { NewMethod(); } private static void NewMethod() { int i = 1; while (false) { int j = 1; } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539963, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539963")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod53() { var code = @"class Class { void Main() { Enum e = Enum.[|Field|]; } } enum Enum { }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(539964, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539964")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod54() { var code = @"class Class { void Main([|string|][] args) { } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540072")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6220() { var code = @"class C { void Main() { [| float f = 1.2f; |] System.Console.WriteLine(); } }"; var expected = @"class C { void Main() { NewMethod(); System.Console.WriteLine(); } private static void NewMethod() { float f = 1.2f; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540072, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540072")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6220_1() { var code = @"class C { void Main() { [| float f = 1.2f; // test |] System.Console.WriteLine(); } }"; var expected = @"class C { void Main() { NewMethod(); System.Console.WriteLine(); } private static void NewMethod() { float f = 1.2f; // test } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540071, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540071")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6219() { var code = @"class C { void Main() { float @float = 1.2f; [|@float = 1.44F;|] } }"; var expected = @"class C { void Main() { float @float = 1.2f; @float = NewMethod(); } private static float NewMethod() { return 1.44F; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540080, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540080")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6230() { var code = @"class C { void M() { int v =[| /**/1 + 2|]; System.Console.WriteLine(); } }"; var expected = @"class C { void M() { int v = GetV(); System.Console.WriteLine(); } private static int GetV() { return /**/1 + 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540080, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540080")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6230_1() { var code = @"class C { void M() { int v [|= /**/1 + 2|]; System.Console.WriteLine(); } }"; var expected = @"class C { void M() { NewMethod(); System.Console.WriteLine(); } private static void NewMethod() { int v = /**/1 + 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540052, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540052")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6197() { var code = @"using System; class Program { static void Main(string[] args) { Func<int, int> d = [|NewMethod|]; d.Invoke(2); } private static int NewMethod(int x) { return x * 2; } }"; var expected = @"using System; class Program { static void Main(string[] args) { Func<int, int> d = GetD(); d.Invoke(2); } private static Func<int, int> GetD() { return NewMethod; } private static int NewMethod(int x) { return x * 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(6277, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6277() { var code = @"using System; class Program { static void Main(string[] args) { [|int x; x = 1;|] return; int y = x; } }"; var expected = @"using System; class Program { static void Main(string[] args) { int x = NewMethod(); return; int y = x; } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression() { var code = @"using System; class Program { void Test() { [|if (true) return;|] Console.WriteLine(); } }"; var expected = @"using System; class Program { void Test() { NewMethod(); return; Console.WriteLine(); } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression_1() { var code = @"using System; class Program { void Test() { if (true) [|if (true) return;|] Console.WriteLine(); } }"; var expected = @"using System; class Program { void Test() { if (true) { NewMethod(); return; } Console.WriteLine(); } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression_2() { var code = @"using System; class Program { void Test() { [|if (true) return;|] } }"; var expected = @"using System; class Program { void Test() { NewMethod(); } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540151")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentlessReturnWithConstIfExpression_3() { var code = @"using System; class Program { void Test() { if (true) [|if (true) return;|] } }"; var expected = @"using System; class Program { void Test() { if (true) { NewMethod(); return; } } private static void NewMethod() { if (true) return; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313() { var code = @"using System; class Program { void Test(bool b) { [|if (b) { return; } Console.WriteLine();|] } }"; var expected = @"using System; class Program { void Test(bool b) { NewMethod(b); } private static void NewMethod(bool b) { if (b) { return; } Console.WriteLine(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_1() { var code = @"using System; class Program { void Test(bool b) { [|if (b) { return; }|] Console.WriteLine(); } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_2() { var code = @"using System; class Program { int Test(bool b) { [|if (b) { return 1; } Console.WriteLine();|] } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_3() { var code = @"using System; class Program { void Test() { [|bool b = true; if (b) { return; } Action d = () => { if (b) { return; } Console.WriteLine(1); };|] } }"; var expected = @"using System; class Program { void Test() { NewMethod(); } private static void NewMethod() { bool b = true; if (b) { return; } Action d = () => { if (b) { return; } Console.WriteLine(1); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_4() { var code = @"using System; class Program { void Test() { [|Action d = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); }; Action d2 = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); };|] Console.WriteLine(1); } }"; var expected = @"using System; class Program { void Test() { NewMethod(); Console.WriteLine(1); } private static void NewMethod() { Action d = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); }; Action d2 = () => { int i = 1; if (i > 10) { return; } Console.WriteLine(1); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_5() { var code = @"using System; class Program { void Test() { Action d = () => { [|int i = 1; if (i > 10) { return; } Console.WriteLine(1);|] }; } }"; var expected = @"using System; class Program { void Test() { Action d = () => { NewMethod(); }; } private static void NewMethod() { int i = 1; if (i > 10) { return; } Console.WriteLine(1); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540154, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540154")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6313_6() { var code = @"using System; class Program { void Test() { Action d = () => { [|int i = 1; if (i > 10) { return; }|] Console.WriteLine(1); }; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540170, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540170")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6333() { var code = @"using System; class Program { void Test() { Program p; [|p = new Program()|]; } }"; var expected = @"using System; class Program { void Test() { Program p; p = NewMethod(); } private static Program NewMethod() { return new Program(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540216, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540216")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6393() { var code = @"using System; class Program { object Test<T>() { T abcd; [|abcd = new T()|]; return abcd; } }"; var expected = @"using System; class Program { object Test<T>() { T abcd; abcd = NewMethod<T>(); return abcd; } private static T NewMethod<T>() { return new T(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540184, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540184")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6351() { var code = @"class Test { void method() { if (true) { for (int i = 0; i < 5; i++) { /*Begin*/ [|System.Console.WriteLine(); } System.Console.WriteLine();|] /*End*/ } } }"; var expected = @"class Test { void method() { if (true) { NewMethod(); /*End*/ } } private static void NewMethod() { for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540184, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540184")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6351_1() { var code = @"class Test { void method() { if (true) { for (int i = 0; i < 5; i++) { /*Begin*/ [|System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/|] } } }"; var expected = @"class Test { void method() { if (true) { NewMethod(); } } private static void NewMethod() { for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/ } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540184, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540184")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6351_2() { var code = @"class Test { void method() { if (true) [|{ for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/ }|] } }"; var expected = @"class Test { void method() { if (true) NewMethod(); } private static void NewMethod() { for (int i = 0; i < 5; i++) { /*Begin*/ System.Console.WriteLine(); } System.Console.WriteLine(); /*End*/ } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540333, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540333")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6560() { var code = @"using System; class Program { static void Main(string[] args) { string S = [|null|]; int Y = S.Length; } }"; var expected = @"using System; class Program { static void Main(string[] args) { string S = GetS(); int Y = S.Length; } private static string GetS() { return null; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562() { var code = @"using System; class Program { int y = [|10|]; }"; var expected = @"using System; class Program { int y = GetY(); private static int GetY() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562_1() { var code = @"using System; class Program { const int i = [|10|]; }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562_2() { var code = @"using System; class Program { Func<string> f = [|() => ""test""|]; }"; var expected = @"using System; class Program { Func<string> f = GetF(); private static Func<string> GetF() { return () => ""test""; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540335")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6562_3() { var code = @"using System; class Program { Func<string> f = () => [|""test""|]; }"; var expected = @"using System; class Program { Func<string> f = () => NewMethod(); private static string NewMethod() { return ""test""; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540361, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540361")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6598() { var code = @"using System; using System.Collections.Generic; using System.Linq; class { static void Main(string[] args) { [|Program|] } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(540372, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540372")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Bug6613() { var code = @"#define A using System; class Program { static void Main(string[] args) { #if A [|Console.Write(5);|] #endif } }"; var expected = @"#define A using System; class Program { static void Main(string[] args) { #if A NewMethod(); #endif } private static void NewMethod() { Console.Write(5); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(540396, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540396")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task InvalidSelection_MethodBody() { var code = @"using System; class Program { static void Main(string[] args) { void Method5(bool b1, bool b2) [|{ if (b1) { if (b2) return; Console.WriteLine(); } Console.WriteLine(); }|] } } "; await ExpectExtractMethodToFailAsync(code); } [WorkItem(541586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541586")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task StructThis() { var code = @"struct S { void Goo() { [|this = new S();|] } }"; var expected = @"struct S { void Goo() { NewMethod(); } private void NewMethod() { this = new S(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(541627, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541627")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontUseConvertedTypeForImplicitNumericConversion() { var code = @"class T { void Goo() { int x1 = 5; long x2 = [|x1|]; } }"; var expected = @"class T { void Goo() { int x1 = 5; long x2 = GetX2(x1); } private static int GetX2(int x1) { return x1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(541668, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541668")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task BreakInSelection() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { string x1 = ""Hello""; switch (x1) { case null: int i1 = 10; break; default: switch (x1) { default: switch (x1) { [|default: int j1 = 99; i1 = 45; x1 = ""t""; string j2 = i1.ToString() + j1.ToString() + x1; break; } break; } break;|] } } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(541671, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541671")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task UnreachableCodeWithReturnStatement() { var code = @"class Program { static void Main(string[] args) { return; [|int i1 = 45; i1 = i1 + 10;|] return; } }"; var expected = @"class Program { static void Main(string[] args) { return; NewMethod(); return; } private static void NewMethod() { int i1 = 45; i1 = i1 + 10; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539862, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539862")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontBlindlyPutCapturedVariable1() { var code = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Ros.A a = new Ros.A(); Del d = (int x) => { [|a.F(x)|]; return x * v; }; d(3); } } namespace Ros { partial class A { public void F(int s) { } } }"; var expected = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Ros.A a = new Ros.A(); Del d = (int x) => { NewMethod(x, a); return x * v; }; d(3); } private static void NewMethod(int x, Ros.A a) { a.F(x); } } namespace Ros { partial class A { public void F(int s) { } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(539862, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539862")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontBlindlyPutCapturedVariable2() { var code = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Program p; Del d = (int x) => { [|p = null;|]; return x * v; }; d(3); } }"; var expected = @"using System; class Program { private static readonly int v = 5; delegate int Del(int i); static void Main(string[] args) { Program p; Del d = (int x) => { p = NewMethod(); ; return x * v; }; d(3); } private static Program NewMethod() { return null; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(541889, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541889")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task DontCrashOnRangeVariableSymbol() { var code = @"class Test { public void Linq1() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lowNums = [|from|] n in numbers where n < 5 select n; } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractRangeVariable() { var code = @"using System.Linq; class Test { public void Linq1() { string[] array = null; var q = from string s in array select [|s|]; } }"; var expected = @"using System.Linq; class Test { public void Linq1() { string[] array = null; var q = from string s in array select GetS(s); } private static string GetS(string s) { return s; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542155, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542155")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task GenericWithErrorType() { var code = @"using Goo.Utilities; class Goo<T> { } class Bar { void gibberish() { Goo<[|Integer|]> x = null; x.IsEmpty(); } } namespace Goo.Utilities { internal static class GooExtensions { public static bool IsEmpty<T>(this Goo<T> source) { return false; } } }"; var expected = @"using Goo.Utilities; class Goo<T> { } class Bar { void gibberish() { Goo<Integer> x = NewMethod(); x.IsEmpty(); } private static Goo<Integer> NewMethod() { return null; } } namespace Goo.Utilities { internal static class GooExtensions { public static bool IsEmpty<T>(this Goo<T> source) { return false; } } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542105, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542105")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task NamedArgument() { var code = @"using System; class C { int this[int x = 5, int y = 7] { get { return 0; } set { } } void Goo() { var y = this[[|y|]: 1]; } }"; var expected = @"using System; class C { int this[int x = 5, int y = 7] { get { return 0; } set { } } void Goo() { var y = GetY(); } private int GetY() { return this[y: 1]; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542213, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542213")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task QueryExpressionVariable() { var code = @"using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { var q2 = from a in Enumerable.Range(1, 2) from b in Enumerable.Range(1, 2) where ([|a == b|]) select a; } }"; var expected = @"using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { var q2 = from a in Enumerable.Range(1, 2) from b in Enumerable.Range(1, 2) where (NewMethod(a, b)) select a; } private static bool NewMethod(int a, int b) { return a == b; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542465, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542465")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task IsExpression() { var code = @"using System; class Class1 { } class IsTest { static void Test(Class1 o) { var b = new Class1() is [|Class1|]; } static void Main() { } }"; var expected = @"using System; class Class1 { } class IsTest { static void Test(Class1 o) { var b = GetB(); } private static bool GetB() { return new Class1() is Class1; } static void Main() { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542526, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542526")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint() { var code = @"using System; using System.Collections.Generic; class A { static void Goo<T, S>(T x) where T : IList<S> { var y = [|x.Count|]; } }"; var expected = @"using System; using System.Collections.Generic; class A { static void Goo<T, S>(T x) where T : IList<S> { var y = GetY<T, S>(x); } private static int GetY<T, S>(T x) where T : IList<S> { return x.Count; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542619, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542619")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task GlobalNamespaceInReturnType() { var code = @"class Program { class System { class Action { } } static global::System.Action a = () => { global::System.Console.WriteLine(); [|}|]; }"; var expected = @"class Program { class System { class Action { } } static global::System.Action a = GetA(); private static global::System.Action GetA() { return () => { global::System.Console.WriteLine(); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542582, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542582")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnFor() { var code = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) [|{ Console.WriteLine(i);|] } } }"; var expected = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) NewMethod(i); } private static void NewMethod(int i) { Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnFor() { var code = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < [|10|]; i++) ; } }"; var expected = @"using System; class Program { static void Main(string[] args) { for (int i = 0; i < NewMethod(); i++) ; } private static int NewMethod() { return 10; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnForeach() { var code = @"using System; class Program { static void Main(string[] args) { foreach (var c in ""123"") [|{ Console.Write(c);|] } } }"; var expected = @"using System; class Program { static void Main(string[] args) { foreach (var c in ""123"") NewMethod(c); } private static void NewMethod(char c) { Console.Write(c); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnForeach() { var code = @"using System; class Program { static void Main(string[] args) { foreach (var c in [|""123""|]) { Console.Write(c); } } }"; var expected = @"using System; class Program { static void Main(string[] args) { foreach (var c in NewMethod()) { Console.Write(c); } } private static string NewMethod() { return ""123""; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnElseClause() { var code = @"using System; class Program { static void Main(string[] args) { if ([|true|]) { } else { } } }"; var expected = @"using System; class Program { static void Main(string[] args) { if (NewMethod()) { } else { } } private static bool NewMethod() { return true; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnLabel() { var code = @"using System; class Program { static void Main(string[] args) { repeat: Console.WriteLine(""Roslyn"")[|;|] if (true) goto repeat; } }"; var expected = @"using System; class Program { static void Main(string[] args) { repeat: NewMethod(); if (true) goto repeat; } private static void NewMethod() { Console.WriteLine(""Roslyn""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnLabel() { var code = @"using System; class Program { static void Main(string[] args) { repeat: Console.WriteLine(""Roslyn""); if ([|true|]) goto repeat; } }"; var expected = @"using System; class Program { static void Main(string[] args) { repeat: Console.WriteLine(""Roslyn""); if (NewMethod()) goto repeat; } private static bool NewMethod() { return true; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnSwitch() { var code = @"using System; class Program { static void Main(string[] args) { switch (args[0]) { case ""1"": Console.WriteLine(""one"")[|;|] break; default: Console.WriteLine(""other""); break; } } }"; var expected = @"using System; class Program { static void Main(string[] args) { switch (args[0]) { case ""1"": NewMethod(); break; default: Console.WriteLine(""other""); break; } } private static void NewMethod() { Console.WriteLine(""one""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnSwitch() { var code = @"using System; class Program { static void Main(string[] args) { switch ([|args[0]|]) { case ""1"": Console.WriteLine(""one""); break; default: Console.WriteLine(""other""); break; } } }"; var expected = @"using System; class Program { static void Main(string[] args) { switch (NewMethod(args)) { case ""1"": Console.WriteLine(""one""); break; default: Console.WriteLine(""other""); break; } } private static string NewMethod(string[] args) { return args[0]; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnDo() { var code = @"using System; class Program { static void Main(string[] args) { do [|{ Console.WriteLine(""I don't like"");|] } while (DateTime.Now.DayOfWeek == DayOfWeek.Monday); } }"; var expected = @"using System; class Program { static void Main(string[] args) { do NewMethod(); while (DateTime.Now.DayOfWeek == DayOfWeek.Monday); } private static void NewMethod() { Console.WriteLine(""I don't like""); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodNotContainerOnDo() { var code = @"using System; class Program { static void Main(string[] args) { do { Console.WriteLine(""I don't like""); } while ([|DateTime.Now.DayOfWeek == DayOfWeek.Monday|]); } }"; var expected = @"using System; class Program { static void Main(string[] args) { do { Console.WriteLine(""I don't like""); } while (NewMethod()); } private static bool NewMethod() { return DateTime.Now.DayOfWeek == DayOfWeek.Monday; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnWhile() { var code = @"using System; class Program { static void Main(string[] args) { while (true) [|{ ;|] } } }"; var expected = @"using System; class Program { static void Main(string[] args) { while (true) NewMethod(); } private static void NewMethod() { ; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelectionOnStruct() { var code = @"using System; struct Goo { static Action a = () => { Console.WriteLine(); [|}|]; }"; var expected = @"using System; struct Goo { static Action a = GetA(); private static Action GetA() { return () => { Console.WriteLine(); }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542619, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542619")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodIncludeGlobal() { var code = @"class Program { class System { class Action { } } static global::System.Action a = () => { global::System.Console.WriteLine(); [|}|]; static void Main(string[] args) { } }"; var expected = @"class Program { class System { class Action { } } static global::System.Action a = GetA(); private static global::System.Action GetA() { return () => { global::System.Console.WriteLine(); }; } static void Main(string[] args) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542582, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542582")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodExpandSelection() { var code = @"class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) [|{ System.Console.WriteLine(i);|] } } }"; var expected = @"class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) NewMethod(i); } private static void NewMethod(int i) { System.Console.WriteLine(i); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542594, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542594")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodRename1() { var code = @"class Program { static void Main() { [|var i = 42;|] var j = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; var expected = @"class Program { static void Main() { NewMethod1(); var j = 42; } private static void NewMethod1() { var i = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542594, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542594")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodRename2() { var code = @"class Program { static void Main() { NewMethod1(); [|var j = 42;|] } private static void NewMethod1() { var i = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; var expected = @"class Program { static void Main() { NewMethod1(); NewMethod3(); } private static void NewMethod3() { var j = 42; } private static void NewMethod1() { var i = 42; } private static void NewMethod() { } private static void NewMethod2() { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542632, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542632")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInInteractive1() { var code = @"int i; [|i = 2|]; i = 3;"; var expected = @"int i; i = NewMethod(); int NewMethod() { return 2; } i = 3;"; await TestExtractMethodAsync(code, expected, parseOptions: Options.Script); } [WorkItem(542670, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542670")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint1() { var code = @"using System; using System.Collections.Generic; class A { static void Goo<T, S, U>(T x) where T : IList<S> where S : IList<U> { var y = [|x.Count|]; } }"; var expected = @"using System; using System.Collections.Generic; class A { static void Goo<T, S, U>(T x) where T : IList<S> where S : IList<U> { var y = GetY<T, S>(x); } private static int GetY<T, S>(T x) where T : IList<S> { return x.Count; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")] [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint2() { var code = @" using System; interface I<T> where T : IComparable<T> { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : IComparable<T> { var y = [|x.Count|]; } } "; var expected = @" using System; interface I<T> where T : IComparable<T> { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : IComparable<T> { var y = GetY<T, S>(x); } private static int GetY<T, S>(S x) where T : IComparable<T> where S : I<T> { return x.Count; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(706894, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/706894")] [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint3() { var code = @" using System; interface I<T> where T : class { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : class { var y = [|x.Count|]; } } "; var expected = @" using System; interface I<T> where T : class { int Count { get; } } class A { static void Goo<T, S>(S x) where S : I<T> where T : class { var y = GetY<T, S>(x); } private static int GetY<T, S>(S x) where T : class where S : I<T> { return x.Count; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraint4() { var code = @" using System; using System.Collections.Generic; interface I<T> where T : class { } interface I2<T1, T2> : I<T1> where T1 : class, IEnumerable<T2> where T2 : struct { int Count { get; } } class A { public virtual void Goo<T, S>(S x) where S : IList<I2<IEnumerable<T>, T>> where T : struct { } } class B : A { public override void Goo<T, S>(S x) { var y = [|x.Count|]; } } "; var expected = @" using System; using System.Collections.Generic; interface I<T> where T : class { } interface I2<T1, T2> : I<T1> where T1 : class, IEnumerable<T2> where T2 : struct { int Count { get; } } class A { public virtual void Goo<T, S>(S x) where S : IList<I2<IEnumerable<T>, T>> where T : struct { } } class B : A { public override void Goo<T, S>(S x) { var y = GetY<T, S>(x); } private static int GetY<T, S>(S x) where T : struct where S : IList<I2<IEnumerable<T>, T>> { return x.Count; } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(543012, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543012")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeParametersInConstraintBestEffort() { var code = @" using System; using System.Collections.Generic; using System.Linq; class A<T> { public virtual void Test<S>(S s) where S : T { } } class B : A<string> { public override void Test<S>(S s) { var t = [|s.ToString()|]; } } "; var expected = @" using System; using System.Collections.Generic; using System.Linq; class A<T> { public virtual void Test<S>(S s) where S : T { } } class B : A<string> { public override void Test<S>(S s) { var t = GetT(s); } private static string GetT<S>(S s) where S : string { return s.ToString(); } } "; await TestExtractMethodAsync(code, expected); } [WorkItem(542672, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542672")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ConstructedTypes() { var code = @"using System; using System.Collections.Generic; class Program { static void Goo<T>() { List<T> x = new List<T>(); Action a = () => Console.WriteLine([|x.Count|]); } }"; var expected = @"using System; using System.Collections.Generic; class Program { static void Goo<T>() { List<T> x = new List<T>(); Action a = () => Console.WriteLine(GetCount(x)); } private static int GetCount<T>(List<T> x) { return x.Count; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542792, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542792")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TypeInDefault() { var code = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { Node<int, Exception> node = new Node<int, Exception>(); } } class Node<K, T> where T : new() { public K Key; public T Item; public Node<K, T> NextNode; public Node() { Key = default([|K|]); Item = new T(); NextNode = null; Console.WriteLine(Key); } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { Node<int, Exception> node = new Node<int, Exception>(); } } class Node<K, T> where T : new() { public K Key; public T Item; public Node<K, T> NextNode; public Node() { Key = NewMethod(); Item = new T(); NextNode = null; Console.WriteLine(Key); } private static K NewMethod() { return default(K); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542708, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542708")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task Script_ArgumentException() { var code = @"using System; public static void GetNonVirtualMethod<TDelegate>( Type type, string name) { Type delegateType = typeof(TDelegate); var invoke = [|delegateType|].GetMethod(""Invoke""); }"; var expected = @"using System; public static void GetNonVirtualMethod<TDelegate>( Type type, string name) { Type delegateType = typeof(TDelegate); var invoke = GetDelegateType(delegateType).GetMethod(""Invoke""); } Type GetDelegateType(Type delegateType) { return delegateType; }"; await TestExtractMethodAsync(code, expected, parseOptions: Options.Script); } [WorkItem(529008, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529008")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ReadOutSideIsUnReachable() { var code = @"class Test { public static void Main() { string str = string.Empty; object obj; [|lock (new string[][] { new string[] { str }, new string[] { str } }) { obj = new object(); return; }|] System.Console.Write(obj); } }"; var expected = @"class Test { public static void Main() { string str = string.Empty; object obj; NewMethod(str, out obj); return; System.Console.Write(obj); } private static void NewMethod(string str, out object obj) { lock (new string[][] { new string[] { str }, new string[] { str } }) { obj = new object(); return; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(543186, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543186")] public async Task AnonymousTypePropertyName() { var code = @"class C { void M() { var x = new { [|String|] = true }; } }"; var expected = @"class C { void M() { NewMethod(); } private static void NewMethod() { var x = new { String = true }; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(543662, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543662")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ArgumentOfBaseConstrInit() { var code = @"class O { public O(int t) : base([|t|]) { } }"; var expected = @"class O { public O(int t) : base(GetT(t)) { } private static int GetT(int t) { return t; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task UnsafeType() { var code = @" unsafe class O { unsafe public O(int t) { [|t = 1;|] } }"; var expected = @" unsafe class O { unsafe public O(int t) { t = NewMethod(); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544144, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544144")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task CastExpressionWithImplicitUserDefinedConversion() { var code = @" class C { static public implicit operator long(C i) { return 5; } static void Main() { C c = new C(); int y1 = [|(int)c|]; } }"; var expected = @" class C { static public implicit operator long(C i) { return 5; } static void Main() { C c = new C(); int y1 = GetY1(c); } private static int GetY1(C c) { return (int)c; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544387, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544387")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task FixedPointerVariable() { var code = @" class Test { static int x = 0; unsafe static void Main() { fixed (int* p1 = &x) { int a1 = [|*p1|]; } } }"; var expected = @" class Test { static int x = 0; unsafe static void Main() { fixed (int* p1 = &x) { int a1 = GetA1(p1); } } private static unsafe int GetA1(int* p1) { return *p1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544444")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task PointerDeclarationStatement() { var code = @" class Program { unsafe static void Main() { int* p1 = null; [|int* p2 = p1;|] } }"; var expected = @" class Program { unsafe static void Main() { int* p1 = null; NewMethod(p1); } private static unsafe void NewMethod(int* p1) { int* p2 = p1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544446, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544446")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task PrecededByCastExpr() { var code = @" class Program { static void Main() { int i1 = (int)[|5L|]; } }"; var expected = @" class Program { static void Main() { int i1 = (int)NewMethod(); } private static long NewMethod() { return 5L; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542944")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExpressionWithLocalConst() { var code = @"class Program { static void Main(string[] args) { const string a = null; [|a = null;|] } }"; var expected = @"class Program { static void Main(string[] args) { const string a = null; a = NewMethod(a); } private static string NewMethod(string a) { a = null; return a; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(542944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542944")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExpressionWithLocalConst2() { var code = @"class Program { static void Main(string[] args) { const string a = null; [|a = null;|] } }"; var expected = @"class Program { static void Main(string[] args) { const string a = null; a = NewMethod(a); } private static string NewMethod(string a) { a = null; return a; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(544675, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544675")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task HiddenPosition() { var code = @"class Program { static void Main(string[] args) { const string a = null; [|a = null;|] } #line default #line hidden }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(530609, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530609")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task NoCrashInteractive() { var code = @"[|if (true) { }|]"; var expected = @"NewMethod(); void NewMethod() { if (true) { } }"; await TestExtractMethodAsync(code, expected, parseOptions: new CSharpParseOptions(kind: SourceCodeKind.Script)); } [WorkItem(530322, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530322")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodShouldNotBreakFormatting() { var code = @"class C { void M(int i, int j, int k) { M(0, [|1|], 2); } }"; var expected = @"class C { void M(int i, int j, int k) { M(0, NewMethod(), 2); } private static int NewMethod() { return 1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(604389, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/604389")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractLiteralExpression() { var code = @"class Program { static void Main() { var c = new C { X = { Y = { [|1|] } } }; } } class C { public dynamic X; }"; var expected = @"class Program { static void Main() { var c = new C { X = { Y = { NewMethod() } } }; } private static int NewMethod() { return 1; } } class C { public dynamic X; }"; await TestExtractMethodAsync(code, expected); } [WorkItem(604389, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/604389")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractCollectionInitializer() { var code = @"class Program { static void Main() { var c = new C { X = { Y = [|{ 1 }|] } }; } } class C { public dynamic X; }"; var expected = @"class Program { static void Main() { var c = GetC(); } private static C GetC() { return new C { X = { Y = { 1 } } }; } } class C { public dynamic X; }"; await TestExtractMethodAsync(code, expected); } [WorkItem(854662, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/854662")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractCollectionInitializer2() { var code = @"using System; using System.Collections.Generic; class Program { public Dictionary<int, int> A { get; private set; } static int Main(string[] args) { int a = 0; return new Program { A = { { [|a + 2|], 0 } } }.A.Count; } }"; var expected = @"using System; using System.Collections.Generic; class Program { public Dictionary<int, int> A { get; private set; } static int Main(string[] args) { int a = 0; return new Program { A = { { NewMethod(a), 0 } } }.A.Count; } private static int NewMethod(int a) { return a + 2; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530267, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530267")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestCoClassImplicitConversion() { var code = @"using System; using System.Runtime.InteropServices; [CoClass(typeof(C))] [ComImport] [Guid(""8D3A7A55-A8F5-4669-A5AD-996A3EB8F2ED"")] interface I { } class C : I { static void Main() { [|new I()|]; // Extract Method } }"; var expected = @"using System; using System.Runtime.InteropServices; [CoClass(typeof(C))] [ComImport] [Guid(""8D3A7A55-A8F5-4669-A5AD-996A3EB8F2ED"")] interface I { } class C : I { static void Main() { NewMethod(); // Extract Method } private static I NewMethod() { return new I(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530710")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestOverloadResolution() { var code = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, y => Inner(x => { [|x|].Ex(); }, y)); // Prints 1 } } static class E { public static void Ex(this int x) { } }"; var expected = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, (Action<string>)(y => Inner(x => { GetX(x).Ex(); }, y))); // Prints 1 } private static string GetX(string x) { return x; } } static class E { public static void Ex(this int x) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530710")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestOverloadResolution1() { var code = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, y => Inner(x => { [|x.Ex()|]; }, y)); // Prints 1 } } static class E { public static void Ex(this int x) { } }"; var expected = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, (Action<string>)(y => Inner(x => { NewMethod(x); }, y))); // Prints 1 } private static void NewMethod(string x) { x.Ex(); } } static class E { public static void Ex(this int x) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(530710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530710")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestOverloadResolution2() { var code = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, y => Inner(x => { [|x.Ex();|] }, y)); // Prints 1 } } static class E { public static void Ex(this int x) { } }"; var expected = @"using System; static class C { static void Ex(this string x) { } static void Inner(Action<string> x, string y) { } static void Inner(Action<string> x, int y) { } static void Inner(Action<int> x, int y) { } static void Outer(object y, Action<string> x) { Console.WriteLine(1); } static void Outer(string y, Action<int> x) { Console.WriteLine(2); } static void Main() { Outer(null, (Action<string>)(y => Inner(x => { NewMethod(x); }, y))); // Prints 1 } private static void NewMethod(string x) { x.Ex(); } } static class E { public static void Ex(this int x) { } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(731924, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/731924")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestTreatEnumSpecial() { var code = @"using System; class Program { public enum A { A1, A2 } static void Main(string[] args) { A a = A.A1; [|Console.WriteLine(a);|] } }"; var expected = @"using System; class Program { public enum A { A1, A2 } static void Main(string[] args) { A a = A.A1; NewMethod(a); } private static void NewMethod(A a) { Console.WriteLine(a); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(756222, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/756222")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestReturnStatementInAsyncMethod() { var code = @"using System.Threading.Tasks; class C { async Task<int> M() { await Task.Yield(); [|return 3;|] } }"; var expected = @"using System.Threading.Tasks; class C { async Task<int> M() { await Task.Yield(); return NewMethod(); } private static int NewMethod() { return 3; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(574576, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/574576")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestAsyncMethodWithRefOrOutParameters() { var code = @"using System.Threading.Tasks; class C { public async void Goo() { [|var q = 1; var p = 2; await Task.Yield();|] var r = q; var s = p; } }"; await ExpectExtractMethodToFailAsync(code); } [WorkItem(1025272, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1025272")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestAsyncMethodWithWellKnownValueType() { var code = @"using System; using System.Threading; using System.Threading.Tasks; class Program { public async Task Hello() { var cancellationToken = CancellationToken.None; [|var i = await Task.Run(() => { Console.WriteLine(); cancellationToken.ThrowIfCancellationRequested(); return 1; }, cancellationToken);|] cancellationToken.ThrowIfCancellationRequested(); Console.WriteLine(i); } }"; var expected = @"using System; using System.Threading; using System.Threading.Tasks; class Program { public async Task Hello() { var cancellationToken = CancellationToken.None; int i = await NewMethod(ref cancellationToken); cancellationToken.ThrowIfCancellationRequested(); Console.WriteLine(i); } private static async Task<int> NewMethod(ref CancellationToken cancellationToken) { return await Task.Run(() => { Console.WriteLine(); cancellationToken.ThrowIfCancellationRequested(); return 1; }, cancellationToken); } }"; await ExpectExtractMethodToFailAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestAsyncMethodWithWellKnownValueType1() { var code = @"using System; using System.Threading; using System.Threading.Tasks; class Program { public async Task Hello() { var cancellationToken = CancellationToken.None; [|var i = await Task.Run(() => { Console.WriteLine(); cancellationToken = CancellationToken.None; return 1; }, cancellationToken);|] cancellationToken.ThrowIfCancellationRequested(); Console.WriteLine(i); } }"; await ExpectExtractMethodToFailAsync(code); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestDontPutOutOrRefForStructOff() { var code = @"using System.Threading.Tasks; namespace ClassLibrary9 { public struct S { public int I; } public class Class1 { private async Task<int> Test() { S s = new S(); s.I = 10; [|int i = await Task.Run(() => { var i2 = s.I; return Test(); });|] return i; } } }"; await ExpectExtractMethodToFailAsync(code, dontPutOutOrRefOnStruct: false); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestDontPutOutOrRefForStructOn() { var code = @"using System.Threading.Tasks; namespace ClassLibrary9 { public struct S { public int I; } public class Class1 { private async Task<int> Test() { S s = new S(); s.I = 10; [|int i = await Task.Run(() => { var i2 = s.I; return Test(); });|] return i; } } }"; var expected = @"using System.Threading.Tasks; namespace ClassLibrary9 { public struct S { public int I; } public class Class1 { private async Task<int> Test() { S s = new S(); s.I = 10; int i = await NewMethod(s); return i; } private async Task<int> NewMethod(S s) { return await Task.Run(() => { var i2 = s.I; return Test(); }); } } }"; await TestExtractMethodAsync(code, expected, dontPutOutOrRefOnStruct: true); } [Theory] [InlineData("add", "remove")] [InlineData("remove", "add")] [WorkItem(17474, "https://github.com/dotnet/roslyn/issues/17474")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestExtractMethodEventAccessorUnresolvedName(string testedAccessor, string untestedAccessor) { // This code intentionally omits a 'using System;' var code = $@"namespace ClassLibrary9 {{ public class Class {{ public event EventHandler Event {{ {testedAccessor} {{ [|throw new NotImplementedException();|] }} {untestedAccessor} {{ throw new NotImplementedException(); }} }} }} }}"; var expected = $@"namespace ClassLibrary9 {{ public class Class {{ public event EventHandler Event {{ {testedAccessor} {{ NewMethod(); }} {untestedAccessor} {{ throw new NotImplementedException(); }} }} private static void NewMethod() {{ throw new NotImplementedException(); }} }} }}"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(19958, "https://github.com/dotnet/roslyn/issues/19958")] public async Task TestExtractMethodRefPassThrough() { var code = @"using System; namespace ClassLibrary9 { internal class ClassExtensions { public static int OtherMethod(ref int x) => x; public static void Method(ref int x) => Console.WriteLine(OtherMethod(ref [|x|])); } }"; var expected = @"using System; namespace ClassLibrary9 { internal class ClassExtensions { public static int OtherMethod(ref int x) => x; public static void Method(ref int x) => Console.WriteLine(OtherMethod(ref $x$)); public static ref int NewMethod(ref int x) { return ref x; } } }"; await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(19958, "https://github.com/dotnet/roslyn/issues/19958")] public async Task TestExtractMethodRefPassThroughDuplicateVariable() { var code = @"using System; namespace ClassLibrary9 { internal interface IClass { bool InterfaceMethod(ref Guid x, out IOtherClass y); } internal interface IOtherClass { bool OtherInterfaceMethod(); } internal static class ClassExtensions { public static void Method(this IClass instance, Guid guid) { var r = instance.InterfaceMethod(ref [|guid|], out IOtherClass guid); if (!r) return; r = guid.OtherInterfaceMethod(); if (r) throw null; } } }"; var expected = @"using System; namespace ClassLibrary9 { internal interface IClass { bool InterfaceMethod(ref Guid x, out IOtherClass y); } internal interface IOtherClass { bool OtherInterfaceMethod(); } internal static class ClassExtensions { public static void Method(this IClass instance, Guid guid) { var r = instance.InterfaceMethod(ref NewMethod(ref guid), out IOtherClass guid); if (!r) return; r = guid.OtherInterfaceMethod(); if (r) throw null; } public static ref Guid NewMethod(ref Guid guid) { return ref guid; } } }"; await TestExtractMethodAsync(code, expected, temporaryFailing: true); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod_Argument1() { var service = new CSharpExtractMethodService(); Assert.NotNull(await Record.ExceptionAsync(async () => { var tree = await service.ExtractMethodAsync(document: null, textSpan: default, localFunction: false, options: null, CancellationToken.None); })); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethod_Argument2() { var solution = new AdhocWorkspace().CurrentSolution; var projectId = ProjectId.CreateNewId(); var project = solution.AddProject(projectId, "Project", "Project.dll", LanguageNames.CSharp).GetProject(projectId); var document = project.AddMetadataReference(TestMetadata.Net451.mscorlib) .AddDocument("Document", SourceText.From("")); var service = new CSharpExtractMethodService() as IExtractMethodService; await service.ExtractMethodAsync(document, textSpan: default, localFunction: false); } [WpfFact] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [Trait(Traits.Feature, Traits.Features.Interactive)] public void ExtractMethodCommandDisabledInSubmission() { using var workspace = TestWorkspace.Create(XElement.Parse(@" <Workspace> <Submission Language=""C#"" CommonReferences=""true""> typeof(string).$$Name </Submission> </Workspace> "), workspaceKind: WorkspaceKind.Interactive, composition: EditorTestCompositions.EditorFeaturesWpf); // Force initialization. workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList(); var textView = workspace.Documents.Single().GetTextView(); var handler = workspace.ExportProvider.GetCommandHandler<ExtractMethodCommandHandler>(PredefinedCommandHandlerNames.ExtractMethod, ContentTypeNames.CSharpContentType); var state = handler.GetCommandState(new ExtractMethodCommandArgs(textView, textView.TextBuffer)); Assert.True(state.IsUnspecified); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction1() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|int localValue = arg;|] int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { NewMethod(arg); int LocalCapture() => arg; } private static void NewMethod(int arg) { int localValue = arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction2() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; [|int localValue = arg;|] } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; NewMethod(arg); } private static void NewMethod(int arg) { int localValue = arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction3() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|arg = arg + 3;|] int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { arg = NewMethod(arg); int LocalCapture() => arg; } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction4() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; [|arg = arg + 3;|] } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { int LocalCapture() => arg; arg = NewMethod(arg); } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodUnreferencedLocalFunction5() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|arg = arg + 3;|] arg = 1; int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { arg = NewMethod(arg); arg = 1; int LocalCapture() => arg; } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Theory] [InlineData("LocalCapture();")] [InlineData("System.Func<int> function = LocalCapture;")] [InlineData("System.Func<int> function = () => LocalCapture();")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodFlowsToLocalFunction1(string usageSyntax) { var code = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ [|arg = arg + 3;|] {usageSyntax} int LocalCapture() => arg; }} }} }}"; var expected = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ arg = NewMethod(arg); {usageSyntax} int LocalCapture() => arg; }} private static int NewMethod(int arg) {{ arg = arg + 3; return arg; }} }} }}"; await TestExtractMethodAsync(code, expected); } [Theory] [InlineData("LocalCapture();")] [InlineData("System.Func<int> function = LocalCapture;")] [InlineData("System.Func<int> function = () => LocalCapture();")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodFlowsToLocalFunction2(string usageSyntax) { var code = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int LocalCapture() => arg; [|arg = arg + 3;|] {usageSyntax} }} }} }}"; var expected = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int LocalCapture() => arg; arg = NewMethod(arg); {usageSyntax} }} private static int NewMethod(int arg) {{ arg = arg + 3; return arg; }} }} }}"; await TestExtractMethodAsync(code, expected); } /// <summary> /// This test verifies that Extract Method works properly when the region to extract references a local /// function, the local function uses an unassigned but wholly local variable. /// </summary> [Theory] [InlineData("LocalCapture();")] [InlineData("System.Func<int> function = LocalCapture;")] [InlineData("System.Func<int> function = () => LocalCapture();")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodFlowsToLocalFunctionWithUnassignedLocal(string usageSyntax) { var code = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int local; int LocalCapture() => arg + local; [|arg = arg + 3;|] {usageSyntax} }} }} }}"; var expected = $@"namespace ExtractMethodCrashRepro {{ public static class SomeClass {{ private static void Repro( int arg ) {{ int local; int LocalCapture() => arg + local; arg = NewMethod(arg); {usageSyntax} }} private static int NewMethod(int arg) {{ arg = arg + 3; return arg; }} }} }}"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(18347, "https://github.com/dotnet/roslyn/issues/18347")] public async Task ExtractMethodDoesNotFlowToLocalFunction1() { var code = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { [|arg = arg + 3;|] arg = 1; int LocalCapture() => arg; } } }"; var expected = @"namespace ExtractMethodCrashRepro { public static class SomeClass { private static void Repro( int arg ) { arg = NewMethod(arg); arg = 1; int LocalCapture() => arg; } private static int NewMethod(int arg) { arg = arg + 3; return arg; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestUnreachableCodeModifiedInside() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable = null; var i = enumerable.Any(); return enumerable;|] } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { return NewMethod(ref enumerable); } private static IEnumerable<object> NewMethod(ref IEnumerable<object> enumerable) { while (true) ; enumerable = null; var i = enumerable.Any(); return enumerable; } } }"; // allowMovingDeclaration: false is default behavior on VS. // it doesn't affect result mostly but it does affect for symbols in unreachable code since // data flow in and out for the symbol is always set to false await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestUnreachableCodeModifiedOutside() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; var i = enumerable.Any();|] enumerable = null; return enumerable; } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { NewMethod(enumerable); enumerable = null; return enumerable; } private static void NewMethod(IEnumerable<object> enumerable) { while (true) ; var i = enumerable.Any(); } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestUnreachableCodeModifiedBoth() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { [|while (true) ; enumerable = null; var i = enumerable.Any();|] enumerable = null; return enumerable; } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { IEnumerable<object> Crash0(IEnumerable<object> enumerable) { enumerable = NewMethod(enumerable); enumerable = null; return enumerable; } private static IEnumerable<object> NewMethod(IEnumerable<object> enumerable) { while (true) ; enumerable = null; var i = enumerable.Any(); return enumerable; } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestLocalFunctionParameters() { var code = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { public void Bar(int value) { void Local(int value2) { [|Bar(value, value2);|] } } } }"; var expected = @"using System.Collections.Generic; using System.Linq; namespace ConsoleApp1 { class Test { public void Bar(int value) { void Local(int value2) { NewMethod(value, value2); } } private void NewMethod(int value, int value2) { Bar(value, value2); } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TestDataFlowInButNoReadInside() { var code = @"using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp39 { class Program { void Method(out object test) { test = null; var a = test != null; [|if (a) { return; } if (A == a) { test = new object(); }|] } } }"; var expected = @"using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp39 { class Program { void Method(out object test) { test = null; var a = test != null; NewMethod(ref test, a); } private static void NewMethod(ref object test, bool a) { if (a) { return; } if (A == a) { test = new object(); } } } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task AllowBestEffortForUnknownVariableDataFlow() { var code = @" class Program { void Method(out object test) { test = null; var a = test != null; [|if (a) { return; } if (A == a) { test = new object(); }|] } }"; var expected = @" class Program { void Method(out object test) { test = null; var a = test != null; NewMethod(ref test, a); } private static void NewMethod(ref object test, bool a) { if (a) { return; } if (A == a) { test = new object(); } } }"; await TestExtractMethodAsync(code, expected, allowBestEffort: true); } [WorkItem(30750, "https://github.com/dotnet/roslyn/issues/30750")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInInterface() { var code = @" interface Program { void Goo(); void Test() { [|Goo();|] } }"; var expected = @" interface Program { void Goo(); void Test() { NewMethod(); } void NewMethod() { Goo(); } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(33242, "https://github.com/dotnet/roslyn/issues/33242")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInExpressionBodiedConstructors() { var code = @" class Goo { private readonly string _bar; private Goo(string bar) => _bar = [|bar|]; }"; var expected = @" class Goo { private readonly string _bar; private Goo(string bar) => _bar = GetBar(bar); private static string GetBar(string bar) { return bar; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(33242, "https://github.com/dotnet/roslyn/issues/33242")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInExpressionBodiedFinalizers() { var code = @" class Goo { bool finalized; ~Goo() => finalized = [|true|]; }"; var expected = @" class Goo { bool finalized; ~Goo() => finalized = NewMethod(); private static bool NewMethod() { return true; } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInvolvingFunctionPointer() { var code = @" class C { void M(delegate*<delegate*<ref string, ref readonly int>> ptr1) { string s = null; _ = [|ptr1()|](ref s); } }"; var expected = @" class C { void M(delegate*<delegate*<ref string, ref readonly int>> ptr1) { string s = null; _ = NewMethod(ptr1)(ref s); } private static delegate*<ref string, ref readonly int> NewMethod(delegate*<delegate*<ref string, ref readonly int>> ptr1) { return ptr1(); } }"; await TestExtractMethodAsync(code, expected); } [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task ExtractMethodInvolvingFunctionPointerWithTypeParameter() { var code = @" class C { void M<T1, T2>(delegate*<T1, T2> ptr1) { _ = [|ptr1|](); } }"; var expected = @" class C { void M<T1, T2>(delegate*<T1, T2> ptr1) { _ = GetPtr1(ptr1)(); } private static delegate*<T1, T2> GetPtr1<T1, T2>(delegate*<T1, T2> ptr1) { return ptr1; } }"; await TestExtractMethodAsync(code, expected); } [WorkItem(44260, "https://github.com/dotnet/roslyn/issues/44260")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TopLevelStatement_ValueInAssignment() { var code = @" bool local; local = [|true|]; "; var expected = @" bool local; bool NewMethod() { return true; } local = NewMethod(); "; await TestExtractMethodAsync(code, expected); } [WorkItem(44260, "https://github.com/dotnet/roslyn/issues/44260")] [Fact, Trait(Traits.Feature, Traits.Features.ExtractMethod)] public async Task TopLevelStatement_ArgumentInInvocation() { // Note: the cast should be simplified // https://github.com/dotnet/roslyn/issues/44260 var code = @" System.Console.WriteLine([|""string""|]); "; var expected = @" System.Console.WriteLine((string)NewMethod()); string NewMethod() { return ""string""; }"; await TestExtractMethodAsync(code, expected); } [Theory] [InlineData("unsafe")] [InlineData("checked")] [InlineData("unchecked")] [Trait(Traits.Feature, Traits.Features.ExtractMethod)] [WorkItem(4950, "https://github.com/dotnet/roslyn/issues/4950")] public async Task ExtractMethodInvolvingUnsafeBlock(string keyword) { var code = $@" using System; class Program {{ static void Main(string[] args) {{ object value = args; [| IntPtr p; {keyword} {{ object t = value; p = IntPtr.Zero; }} |] Console.WriteLine(p); }} }} "; var expected = $@" using System; class Program {{ static void Main(string[] args) {{ object value = args; IntPtr p = NewMethod(value); Console.WriteLine(p); }} private static IntPtr NewMethod(object value) {{ IntPtr p; {keyword} {{ object t = value; p = IntPtr.Zero; }} return p; }} }} "; await TestExtractMethodAsync(code, expected); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./eng/targets/GeneratePkgDef.targets
<?xml version="1.0" encoding="utf-8"?> <!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> <Project> <!-- This file must be imported after targets from NuGet packages have been imported (e.g. from Directory.Build.targets). It overwrites GeneratePkgDef defined by VSSDK NuGet package targets. GeneratePkgDef target defined below generates .pkgdef file based on PkgDef* items that represent entries in pkgdef file. Unlike the VSSDK implementation it does not load the project assembly and does not use RegistrationAttributes. The following item PkgDef* groups are recognized: 1) PkgDefPackageRegistration Corresponds to Microsoft.VisualStudio.Shell.PackageRegistrationAttribute. Project specifies this entry explicitly. Metadata: - ItemSpec: package guid - Name: package name - Class: namespace qualified type name of package implementation class - AllowsBackgroundLoad: bool 2) PkgDefInstalledProduct Emits $RootKey$\InstalledProducts entry. Project specifies this entry explicitly. Metadata: - ItemSpec: package guid - Name - DisplayName (resource id) - ProductDetauls (resource id) 3) PkgDefBrokeredService Emits $RootKey$\BrokeredServices entry. Entries with ProfferingPackageId correspond to Microsoft.VisualStudio.Shell.ServiceBroker.ProvideBrokeredServiceAttribute. Metadata: - ItemSpec: service name - Audience ('Local'|'Process'|...): Microsoft.VisualStudio.Shell.ServiceBroker.ServiceAudience enum value - ProfferingPackageId (guid, optional): GUID of the proffering package or empty for ServiceHub services 4) PkgDefBindingRedirect Emits $RootKey$\RuntimeConfiguration\dependentAssembly\bindingRedirection entry. Project may specify <PkgDefEntry>BindingRedirect</PkgDefEntry> on any item that contributes to ReferencePath item group. (e.g. ProjectReference), or on NuGetPackageToIncludeInVsix items. These items will be automatically included in PkgDefEntry items. Metadata: - ItemSpec: full path to the binary if FusionName is not specified, otherwise it may be just a file name - FusionName: optional assembly name (read from the binary if not specified) 5) PkgDefCodeBase Emits $RootKey$\RuntimeConfiguration\dependentAssembly\codeBase entry. Project may specify <PkgDefEntry>CodeBase</PkgDefEntry> on any item that contributes to ReferencePath item group. (e.g. ProjectReference), or on NuGetPackageToIncludeInVsix items. These items will be automatically included in PkgDefEntry items. Metadata: - ItemSpec: full path to the binary - FusionName: optional assembly name (read from the binary if not specified) 6) PkgDefFileContent Merges the content of the file whose path is specified in the identity of the item to the generated pkgdef file. The path may be relative to the project being built. Project may specify these items using None item group with PkgDefEntry="FileContent" metadata set like so: <None Include="PackageRegistration.pkgdef" PkgDefEntry="FileContent"/>. PkgDefFileContent allows the project to add arbitrary static content. The other kinds are used to generate dynamic content. Note: We use None items since we do not want them to be included in VSIX and we want them to be displayed in Solution Explorer (if we used Content items they would get included in the VSIX by VSSDK by default). --> <UsingTask TaskName="Microsoft.DotNet.Build.Tasks.VisualStudio.GetPkgDefAssemblyDependencyGuid" AssemblyFile="$(ArcadeVisualStudioBuildTasksAssembly)" /> <UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.GetAssemblyFullName" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" /> <Target Name="_SetGeneratePkgDefInputsOutputs"> <PropertyGroup> <!-- The path must match the value that VSSDK uses. --> <_GeneratePkgDefOutputFile>$(IntermediateOutputPath)$(TargetName).pkgdef</_GeneratePkgDefOutputFile> </PropertyGroup> <ItemGroup> <_FileContentEntries Include="@(None)" Condition="'%(None.PkgDefEntry)' == 'FileContent'"> <FullFilePath>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(None.Identity)'))</FullFilePath> </_FileContentEntries> <PkgDefFileContent Include="@(_FileContentEntries->'%(FullFilePath)')" /> </ItemGroup> </Target> <!-- Initializes metadata of PkgDefBrokeredService items. --> <Target Name="_InitializeBrokeredServiceEntries" BeforeTargets="GeneratePkgDef"> <ItemGroup> <PkgDefBrokeredService Update="@(PkgDefBrokeredService)"> <_Audience>dword:00000003</_Audience> <!-- default: Local --> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'Process'">dword:00000001</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'RemoteExclusiveClient'">dword:00000100</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'LiveShareGuest'">dword:00000400</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'RemoteExclusiveServer'">dword:00000800</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'AllClientsIncludingGuests'">dword:00000503</_Audience> <_ServiceLocation Condition="'%(PkgDefBrokeredService.SubFolder)' == ''">"$PackageFolder$"</_ServiceLocation> <_ServiceLocation Condition="'%(PkgDefBrokeredService.SubFolder)' != ''">"$PackageFolder$\%(PkgDefBrokeredService.SubFolder)"</_ServiceLocation> </PkgDefBrokeredService> </ItemGroup> </Target> <!-- Initializes metadata of PkgDefPackageRegistration items. --> <Target Name="_InitializePackageRegistrationEntries" BeforeTargets="GeneratePkgDef" DependsOnTargets="GetAssemblyVersion"> <PropertyGroup> <_AssemblyCodeBase>$([System.IO.Path]::Combine('$PackageFolder$', '$(AssemblyVSIXSubPath)', '$(TargetFileName)'))</_AssemblyCodeBase> <_AssemblyOrCodeBase Condition="'$(UseCodeBase)' != 'true'">"Assembly"="$(AssemblyName), Version=$(AssemblyVersion), Culture=neutral, PublicKeyToken=$(PublicKeyToken)"</_AssemblyOrCodeBase> <_AssemblyOrCodeBase Condition="'$(UseCodeBase)' == 'true'">"CodeBase"="$(_AssemblyCodeBase)"</_AssemblyOrCodeBase> </PropertyGroup> <ItemGroup> <PkgDefPackageRegistration Update="@(PkgDefPackageRegistration)"> <_AllowsBackgroundLoad>dword:00000000</_AllowsBackgroundLoad> <_AllowsBackgroundLoad Condition="'%(PkgDefPackageRegistration.AllowsBackgroundLoad)' == 'true'">dword:00000001</_AllowsBackgroundLoad> <_AssemblyOrCodeBase>$(_AssemblyOrCodeBase)</_AssemblyOrCodeBase> </PkgDefPackageRegistration> </ItemGroup> </Target> <!-- Initializes metadata of PkgDefInstalledProduct items. --> <Target Name="_InitializeInstalledProductEntries" BeforeTargets="GeneratePkgDef" DependsOnTargets="AddSourceRevisionToInformationalVersion"> <ItemGroup> <PkgDefInstalledProduct Update="@(PkgDefInstalledProduct)"> <_PID>$(InformationalVersion)</_PID> </PkgDefInstalledProduct> </ItemGroup> </Target> <!-- Populates PkgDefBindingRedirect and PkgDefCodeBase items from references. --> <Target Name="_AddPkgDefEntriesFromReferences" BeforeTargets="AfterResolveReferences;GeneratePkgDef"> <ItemGroup> <PkgDefBindingRedirect Include="@(ReferencePath)" Condition="'%(ReferencePath.PkgDefEntry)' == 'BindingRedirect'" /> <PkgDefCodeBase Include="@(ReferencePath)" Condition="'%(ReferencePath.PkgDefEntry)' == 'CodeBase'" /> </ItemGroup> </Target> <!-- Generates a .pkgdef file based on items in PkgDef* groups. --> <Target Name="GeneratePkgDef" DependsOnTargets="$(GeneratePkgDefDependsOn);_SetGeneratePkgDefInputsOutputs" Inputs="$(MSBuildAllProjects);@(PkgDefFileContent)" Outputs="$(_GeneratePkgDefOutputFile)"> <ItemGroup> <_AssemblyDependencyEntry Include="@(PkgDefBindingRedirect)" Kind="BindingRedirect" /> <_AssemblyDependencyEntry Include="@(PkgDefCodeBase)" Kind="CodeBase" /> <_AssemblyDependencyEntryWithoutAssemblyName Include="@(_AssemblyDependencyEntry)" Condition="'%(_AssemblyDependencyEntry.FusionName)' == ''" /> <_AssemblyDependencyEntry Remove="@(_AssemblyDependencyEntryWithoutAssemblyName)" /> </ItemGroup> <Microsoft.DotNet.Arcade.Sdk.GetAssemblyFullName Items="@(_AssemblyDependencyEntryWithoutAssemblyName)" FullNameMetadata="FusionName"> <Output TaskParameter="ItemsWithFullName" ItemName="_AssemblyDependencyEntryWithCalculatedAssemblyName"/> </Microsoft.DotNet.Arcade.Sdk.GetAssemblyFullName> <ItemGroup> <_AssemblyDependencyEntry Include="@(_AssemblyDependencyEntryWithCalculatedAssemblyName)" /> <_AssemblyDependencyEntry Update="@(_AssemblyDependencyEntry)"> <AssemblyFileName>%(_AssemblyDependencyEntry.FileName)%(_AssemblyDependencyEntry.Extension)</AssemblyFileName> <OldAssemblyVersion>0.0.0.0</OldAssemblyVersion> <!-- Split FusionName: "{0}, Version={1}, Culture={2}, PublicKeyToken={3}" --> <AssemblyName>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[0])</AssemblyName> <AssemblyVersion>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[1].Split('=')[1])</AssemblyVersion> <Culture>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[2].Split('=')[1])</Culture> <PublicKeyToken>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[3].Split('=')[1])</PublicKeyToken> </_AssemblyDependencyEntry> <_AssemblyDependencyEntry Update="@(_AssemblyDependencyEntry)" Condition="'%(Kind)' == 'BindingRedirect'"> <HashBase>%(AssemblyName),%(PublicKeyToken),%(Culture),%(OldAssemblyVersion)-%(AssemblyVersion),%(AssemblyVersion)</HashBase> </_AssemblyDependencyEntry> <_AssemblyDependencyEntry Update="@(_AssemblyDependencyEntry)" Condition="'%(Kind)' == 'CodeBase'"> <HashBase>%(AssemblyName),%(PublicKeyToken),%(Culture),%(AssemblyVersion)</HashBase> </_AssemblyDependencyEntry> </ItemGroup> <Microsoft.DotNet.Build.Tasks.VisualStudio.GetPkgDefAssemblyDependencyGuid Items="@(_AssemblyDependencyEntry)" InputMetadata="HashBase" OutputMetadata="Guid"> <Output TaskParameter="OutputItems" ItemName="_AssemblyDependencyEntryWithGuid"/> </Microsoft.DotNet.Build.Tasks.VisualStudio.GetPkgDefAssemblyDependencyGuid> <ItemGroup> <_AssemblyDependencyEntry Remove="@(_AssemblyDependencyEntry)" /> <_AssemblyDependencyEntry Include="@(_AssemblyDependencyEntryWithGuid)" /> <_PkgDefEntry Include="@(PkgDefPackageRegistration)"> <RawValue> <![CDATA[[$RootKey$\Packages\%(PkgDefPackageRegistration.Identity)] @="%(PkgDefPackageRegistration.Name)" "InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL" "Class"="%(PkgDefPackageRegistration.Class)" %(PkgDefPackageRegistration._AssemblyOrCodeBase) "AllowsBackgroundLoad"=%(PkgDefPackageRegistration._AllowsBackgroundLoad) ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(PkgDefInstalledProduct)"> <RawValue> <![CDATA[[$RootKey$\InstalledProducts\%(PkgDefInstalledProduct.Name)] @="%(PkgDefInstalledProduct.DisplayName)" "Package"="%(PkgDefInstalledProduct.Identity)" "PID"="%(PkgDefInstalledProduct._PID)" "ProductDetails"="%(PkgDefInstalledProduct.ProductDetails)" "UseInterface"=dword:00000000 "UseVSProductID"=dword:00000000 ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(PkgDefBrokeredService)" Condition="'%(PkgDefBrokeredService.ProfferingPackageId)' == ''"> <!-- 11AD60FC-6D87-4674-8F88-9ABE79176CBE is id of the HubClient package which proffers ServiceHub services --> <RawValue> <![CDATA[[$RootKey$\BrokeredServices\%(PkgDefBrokeredService.Identity)] @="11AD60FC-6D87-4674-8F88-9ABE79176CBE" "IsServiceHub"=dword:00000001 "ServiceLocation"=%(PkgDefBrokeredService._ServiceLocation) "audience"=%(PkgDefBrokeredService._Audience) ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(PkgDefBrokeredService)" Condition="'%(PkgDefBrokeredService.ProfferingPackageId)' != ''"> <RawValue> <![CDATA[[$RootKey$\BrokeredServices\%(PkgDefBrokeredService.Identity)] @="%(PkgDefBrokeredService.ProfferingPackageId)" "audience"=%(PkgDefBrokeredService._Audience) ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(_AssemblyDependencyEntry)" Condition="'%(_AssemblyDependencyEntry.Kind)' == 'BindingRedirect'"> <RawValue> <![CDATA[[$RootKey$\RuntimeConfiguration\dependentAssembly\bindingRedirection\%(_AssemblyDependencyEntry.Guid)] "name"="%(_AssemblyDependencyEntry.AssemblyName)" "publicKeyToken"="%(_AssemblyDependencyEntry.PublicKeyToken)" "culture"="%(_AssemblyDependencyEntry.Culture)" "oldVersion"="%(_AssemblyDependencyEntry.OldAssemblyVersion)-%(_AssemblyDependencyEntry.AssemblyVersion)" "newVersion"="%(_AssemblyDependencyEntry.AssemblyVersion)" "codeBase"="$PackageFolder$\%(_AssemblyDependencyEntry.AssemblyFileName)" ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(_AssemblyDependencyEntry)" Condition="'%(_AssemblyDependencyEntry.Kind)' == 'CodeBase'"> <RawValue> <![CDATA[[$RootKey$\RuntimeConfiguration\dependentAssembly\codeBase\%(_AssemblyDependencyEntry.Guid)] "name"="%(_AssemblyDependencyEntry.AssemblyName)" "publicKeyToken"="%(_AssemblyDependencyEntry.PublicKeyToken)" "culture"="%(_AssemblyDependencyEntry.Culture)" "version"="%(_AssemblyDependencyEntry.AssemblyVersion)" "codeBase"="$PackageFolder$\%(_AssemblyDependencyEntry.AssemblyFileName)" ]]> </RawValue> </_PkgDefEntry> </ItemGroup> <!-- Include content generated above --> <ItemGroup> <_PkgDefLines Include="@(_PkgDefEntry->'%(RawValue)')" /> </ItemGroup> <!-- Include content of files listed in PkgDefFileContent items --> <ItemGroup> <_FilesToMerge Include="@(PkgDefFileContent)"/> </ItemGroup> <ReadLinesFromFile File="%(_FilesToMerge.Identity)" Condition="'@(_FilesToMerge)' != ''"> <Output TaskParameter="Lines" ItemName="_PkgDefLines"/> </ReadLinesFromFile> <Error Text="GeneratePkgDefFile is true but the project did not produce any entries (PkgDef* items) to be written to pkgdef file" Condition="'@(_PkgDefLines)' == ''"/> <!-- Write final pkgdef content. If the CTO file was changed, touch the pkgdef file to cause a re-merge (see VSSDK targets). --> <WriteLinesToFile File="$(_GeneratePkgDefOutputFile)" Lines="@(_PkgDefLines)" Overwrite="true" Encoding="UTF-8" WriteOnlyWhenDifferent="!$([MSBuild]::ValueOrDefault('$(CTOFileHasChanged)', 'false'))" /> <ItemGroup> <FileWrites Include="$(_GeneratePkgDefOutputFile)" /> </ItemGroup> </Target> </Project>
<?xml version="1.0" encoding="utf-8"?> <!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> <Project> <!-- This file must be imported after targets from NuGet packages have been imported (e.g. from Directory.Build.targets). It overwrites GeneratePkgDef defined by VSSDK NuGet package targets. GeneratePkgDef target defined below generates .pkgdef file based on PkgDef* items that represent entries in pkgdef file. Unlike the VSSDK implementation it does not load the project assembly and does not use RegistrationAttributes. The following item PkgDef* groups are recognized: 1) PkgDefPackageRegistration Corresponds to Microsoft.VisualStudio.Shell.PackageRegistrationAttribute. Project specifies this entry explicitly. Metadata: - ItemSpec: package guid - Name: package name - Class: namespace qualified type name of package implementation class - AllowsBackgroundLoad: bool 2) PkgDefInstalledProduct Emits $RootKey$\InstalledProducts entry. Project specifies this entry explicitly. Metadata: - ItemSpec: package guid - Name - DisplayName (resource id) - ProductDetauls (resource id) 3) PkgDefBrokeredService Emits $RootKey$\BrokeredServices entry. Entries with ProfferingPackageId correspond to Microsoft.VisualStudio.Shell.ServiceBroker.ProvideBrokeredServiceAttribute. Metadata: - ItemSpec: service name - Audience ('Local'|'Process'|...): Microsoft.VisualStudio.Shell.ServiceBroker.ServiceAudience enum value - ProfferingPackageId (guid, optional): GUID of the proffering package or empty for ServiceHub services 4) PkgDefBindingRedirect Emits $RootKey$\RuntimeConfiguration\dependentAssembly\bindingRedirection entry. Project may specify <PkgDefEntry>BindingRedirect</PkgDefEntry> on any item that contributes to ReferencePath item group. (e.g. ProjectReference), or on NuGetPackageToIncludeInVsix items. These items will be automatically included in PkgDefEntry items. Metadata: - ItemSpec: full path to the binary if FusionName is not specified, otherwise it may be just a file name - FusionName: optional assembly name (read from the binary if not specified) 5) PkgDefCodeBase Emits $RootKey$\RuntimeConfiguration\dependentAssembly\codeBase entry. Project may specify <PkgDefEntry>CodeBase</PkgDefEntry> on any item that contributes to ReferencePath item group. (e.g. ProjectReference), or on NuGetPackageToIncludeInVsix items. These items will be automatically included in PkgDefEntry items. Metadata: - ItemSpec: full path to the binary - FusionName: optional assembly name (read from the binary if not specified) 6) PkgDefFileContent Merges the content of the file whose path is specified in the identity of the item to the generated pkgdef file. The path may be relative to the project being built. Project may specify these items using None item group with PkgDefEntry="FileContent" metadata set like so: <None Include="PackageRegistration.pkgdef" PkgDefEntry="FileContent"/>. PkgDefFileContent allows the project to add arbitrary static content. The other kinds are used to generate dynamic content. Note: We use None items since we do not want them to be included in VSIX and we want them to be displayed in Solution Explorer (if we used Content items they would get included in the VSIX by VSSDK by default). --> <UsingTask TaskName="Microsoft.DotNet.Build.Tasks.VisualStudio.GetPkgDefAssemblyDependencyGuid" AssemblyFile="$(ArcadeVisualStudioBuildTasksAssembly)" /> <UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.GetAssemblyFullName" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" /> <Target Name="_SetGeneratePkgDefInputsOutputs"> <PropertyGroup> <!-- The path must match the value that VSSDK uses. --> <_GeneratePkgDefOutputFile>$(IntermediateOutputPath)$(TargetName).pkgdef</_GeneratePkgDefOutputFile> </PropertyGroup> <ItemGroup> <_FileContentEntries Include="@(None)" Condition="'%(None.PkgDefEntry)' == 'FileContent'"> <FullFilePath>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(None.Identity)'))</FullFilePath> </_FileContentEntries> <PkgDefFileContent Include="@(_FileContentEntries->'%(FullFilePath)')" /> </ItemGroup> </Target> <!-- Initializes metadata of PkgDefBrokeredService items. --> <Target Name="_InitializeBrokeredServiceEntries" BeforeTargets="GeneratePkgDef"> <ItemGroup> <PkgDefBrokeredService Update="@(PkgDefBrokeredService)"> <_Audience>dword:00000003</_Audience> <!-- default: Local --> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'Process'">dword:00000001</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'RemoteExclusiveClient'">dword:00000100</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'LiveShareGuest'">dword:00000400</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'RemoteExclusiveServer'">dword:00000800</_Audience> <_Audience Condition="'%(PkgDefBrokeredService.Audience)' == 'AllClientsIncludingGuests'">dword:00000503</_Audience> <_ServiceLocation Condition="'%(PkgDefBrokeredService.SubFolder)' == ''">"$PackageFolder$"</_ServiceLocation> <_ServiceLocation Condition="'%(PkgDefBrokeredService.SubFolder)' != ''">"$PackageFolder$\%(PkgDefBrokeredService.SubFolder)"</_ServiceLocation> </PkgDefBrokeredService> </ItemGroup> </Target> <!-- Initializes metadata of PkgDefPackageRegistration items. --> <Target Name="_InitializePackageRegistrationEntries" BeforeTargets="GeneratePkgDef" DependsOnTargets="GetAssemblyVersion"> <PropertyGroup> <_AssemblyCodeBase>$([System.IO.Path]::Combine('$PackageFolder$', '$(AssemblyVSIXSubPath)', '$(TargetFileName)'))</_AssemblyCodeBase> <_AssemblyOrCodeBase Condition="'$(UseCodeBase)' != 'true'">"Assembly"="$(AssemblyName), Version=$(AssemblyVersion), Culture=neutral, PublicKeyToken=$(PublicKeyToken)"</_AssemblyOrCodeBase> <_AssemblyOrCodeBase Condition="'$(UseCodeBase)' == 'true'">"CodeBase"="$(_AssemblyCodeBase)"</_AssemblyOrCodeBase> </PropertyGroup> <ItemGroup> <PkgDefPackageRegistration Update="@(PkgDefPackageRegistration)"> <_AllowsBackgroundLoad>dword:00000000</_AllowsBackgroundLoad> <_AllowsBackgroundLoad Condition="'%(PkgDefPackageRegistration.AllowsBackgroundLoad)' == 'true'">dword:00000001</_AllowsBackgroundLoad> <_AssemblyOrCodeBase>$(_AssemblyOrCodeBase)</_AssemblyOrCodeBase> </PkgDefPackageRegistration> </ItemGroup> </Target> <!-- Initializes metadata of PkgDefInstalledProduct items. --> <Target Name="_InitializeInstalledProductEntries" BeforeTargets="GeneratePkgDef" DependsOnTargets="AddSourceRevisionToInformationalVersion"> <ItemGroup> <PkgDefInstalledProduct Update="@(PkgDefInstalledProduct)"> <_PID>$(InformationalVersion)</_PID> </PkgDefInstalledProduct> </ItemGroup> </Target> <!-- Populates PkgDefBindingRedirect and PkgDefCodeBase items from references. --> <Target Name="_AddPkgDefEntriesFromReferences" BeforeTargets="AfterResolveReferences;GeneratePkgDef"> <ItemGroup> <PkgDefBindingRedirect Include="@(ReferencePath)" Condition="'%(ReferencePath.PkgDefEntry)' == 'BindingRedirect'" /> <PkgDefCodeBase Include="@(ReferencePath)" Condition="'%(ReferencePath.PkgDefEntry)' == 'CodeBase'" /> </ItemGroup> </Target> <!-- Generates a .pkgdef file based on items in PkgDef* groups. --> <Target Name="GeneratePkgDef" DependsOnTargets="$(GeneratePkgDefDependsOn);_SetGeneratePkgDefInputsOutputs" Inputs="$(MSBuildAllProjects);@(PkgDefFileContent)" Outputs="$(_GeneratePkgDefOutputFile)"> <ItemGroup> <_AssemblyDependencyEntry Include="@(PkgDefBindingRedirect)" Kind="BindingRedirect" /> <_AssemblyDependencyEntry Include="@(PkgDefCodeBase)" Kind="CodeBase" /> <_AssemblyDependencyEntryWithoutAssemblyName Include="@(_AssemblyDependencyEntry)" Condition="'%(_AssemblyDependencyEntry.FusionName)' == ''" /> <_AssemblyDependencyEntry Remove="@(_AssemblyDependencyEntryWithoutAssemblyName)" /> </ItemGroup> <Microsoft.DotNet.Arcade.Sdk.GetAssemblyFullName Items="@(_AssemblyDependencyEntryWithoutAssemblyName)" FullNameMetadata="FusionName"> <Output TaskParameter="ItemsWithFullName" ItemName="_AssemblyDependencyEntryWithCalculatedAssemblyName"/> </Microsoft.DotNet.Arcade.Sdk.GetAssemblyFullName> <ItemGroup> <_AssemblyDependencyEntry Include="@(_AssemblyDependencyEntryWithCalculatedAssemblyName)" /> <_AssemblyDependencyEntry Update="@(_AssemblyDependencyEntry)"> <AssemblyFileName>%(_AssemblyDependencyEntry.FileName)%(_AssemblyDependencyEntry.Extension)</AssemblyFileName> <OldAssemblyVersion>0.0.0.0</OldAssemblyVersion> <!-- Split FusionName: "{0}, Version={1}, Culture={2}, PublicKeyToken={3}" --> <AssemblyName>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[0])</AssemblyName> <AssemblyVersion>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[1].Split('=')[1])</AssemblyVersion> <Culture>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[2].Split('=')[1])</Culture> <PublicKeyToken>$([MSBuild]::ValueOrDefault('%(_AssemblyDependencyEntry.FusionName)', '').Split(',')[3].Split('=')[1])</PublicKeyToken> </_AssemblyDependencyEntry> <_AssemblyDependencyEntry Update="@(_AssemblyDependencyEntry)" Condition="'%(Kind)' == 'BindingRedirect'"> <HashBase>%(AssemblyName),%(PublicKeyToken),%(Culture),%(OldAssemblyVersion)-%(AssemblyVersion),%(AssemblyVersion)</HashBase> </_AssemblyDependencyEntry> <_AssemblyDependencyEntry Update="@(_AssemblyDependencyEntry)" Condition="'%(Kind)' == 'CodeBase'"> <HashBase>%(AssemblyName),%(PublicKeyToken),%(Culture),%(AssemblyVersion)</HashBase> </_AssemblyDependencyEntry> </ItemGroup> <Microsoft.DotNet.Build.Tasks.VisualStudio.GetPkgDefAssemblyDependencyGuid Items="@(_AssemblyDependencyEntry)" InputMetadata="HashBase" OutputMetadata="Guid"> <Output TaskParameter="OutputItems" ItemName="_AssemblyDependencyEntryWithGuid"/> </Microsoft.DotNet.Build.Tasks.VisualStudio.GetPkgDefAssemblyDependencyGuid> <ItemGroup> <_AssemblyDependencyEntry Remove="@(_AssemblyDependencyEntry)" /> <_AssemblyDependencyEntry Include="@(_AssemblyDependencyEntryWithGuid)" /> <_PkgDefEntry Include="@(PkgDefPackageRegistration)"> <RawValue> <![CDATA[[$RootKey$\Packages\%(PkgDefPackageRegistration.Identity)] @="%(PkgDefPackageRegistration.Name)" "InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL" "Class"="%(PkgDefPackageRegistration.Class)" %(PkgDefPackageRegistration._AssemblyOrCodeBase) "AllowsBackgroundLoad"=%(PkgDefPackageRegistration._AllowsBackgroundLoad) ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(PkgDefInstalledProduct)"> <RawValue> <![CDATA[[$RootKey$\InstalledProducts\%(PkgDefInstalledProduct.Name)] @="%(PkgDefInstalledProduct.DisplayName)" "Package"="%(PkgDefInstalledProduct.Identity)" "PID"="%(PkgDefInstalledProduct._PID)" "ProductDetails"="%(PkgDefInstalledProduct.ProductDetails)" "UseInterface"=dword:00000000 "UseVSProductID"=dword:00000000 ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(PkgDefBrokeredService)" Condition="'%(PkgDefBrokeredService.ProfferingPackageId)' == ''"> <!-- 11AD60FC-6D87-4674-8F88-9ABE79176CBE is id of the HubClient package which proffers ServiceHub services --> <RawValue> <![CDATA[[$RootKey$\BrokeredServices\%(PkgDefBrokeredService.Identity)] @="11AD60FC-6D87-4674-8F88-9ABE79176CBE" "IsServiceHub"=dword:00000001 "ServiceLocation"=%(PkgDefBrokeredService._ServiceLocation) "audience"=%(PkgDefBrokeredService._Audience) ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(PkgDefBrokeredService)" Condition="'%(PkgDefBrokeredService.ProfferingPackageId)' != ''"> <RawValue> <![CDATA[[$RootKey$\BrokeredServices\%(PkgDefBrokeredService.Identity)] @="%(PkgDefBrokeredService.ProfferingPackageId)" "audience"=%(PkgDefBrokeredService._Audience) ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(_AssemblyDependencyEntry)" Condition="'%(_AssemblyDependencyEntry.Kind)' == 'BindingRedirect'"> <RawValue> <![CDATA[[$RootKey$\RuntimeConfiguration\dependentAssembly\bindingRedirection\%(_AssemblyDependencyEntry.Guid)] "name"="%(_AssemblyDependencyEntry.AssemblyName)" "publicKeyToken"="%(_AssemblyDependencyEntry.PublicKeyToken)" "culture"="%(_AssemblyDependencyEntry.Culture)" "oldVersion"="%(_AssemblyDependencyEntry.OldAssemblyVersion)-%(_AssemblyDependencyEntry.AssemblyVersion)" "newVersion"="%(_AssemblyDependencyEntry.AssemblyVersion)" "codeBase"="$PackageFolder$\%(_AssemblyDependencyEntry.AssemblyFileName)" ]]> </RawValue> </_PkgDefEntry> <_PkgDefEntry Include="@(_AssemblyDependencyEntry)" Condition="'%(_AssemblyDependencyEntry.Kind)' == 'CodeBase'"> <RawValue> <![CDATA[[$RootKey$\RuntimeConfiguration\dependentAssembly\codeBase\%(_AssemblyDependencyEntry.Guid)] "name"="%(_AssemblyDependencyEntry.AssemblyName)" "publicKeyToken"="%(_AssemblyDependencyEntry.PublicKeyToken)" "culture"="%(_AssemblyDependencyEntry.Culture)" "version"="%(_AssemblyDependencyEntry.AssemblyVersion)" "codeBase"="$PackageFolder$\%(_AssemblyDependencyEntry.AssemblyFileName)" ]]> </RawValue> </_PkgDefEntry> </ItemGroup> <!-- Include content generated above --> <ItemGroup> <_PkgDefLines Include="@(_PkgDefEntry->'%(RawValue)')" /> </ItemGroup> <!-- Include content of files listed in PkgDefFileContent items --> <ItemGroup> <_FilesToMerge Include="@(PkgDefFileContent)"/> </ItemGroup> <ReadLinesFromFile File="%(_FilesToMerge.Identity)" Condition="'@(_FilesToMerge)' != ''"> <Output TaskParameter="Lines" ItemName="_PkgDefLines"/> </ReadLinesFromFile> <Error Text="GeneratePkgDefFile is true but the project did not produce any entries (PkgDef* items) to be written to pkgdef file" Condition="'@(_PkgDefLines)' == ''"/> <!-- Write final pkgdef content. If the CTO file was changed, touch the pkgdef file to cause a re-merge (see VSSDK targets). --> <WriteLinesToFile File="$(_GeneratePkgDefOutputFile)" Lines="@(_PkgDefLines)" Overwrite="true" Encoding="UTF-8" WriteOnlyWhenDifferent="!$([MSBuild]::ValueOrDefault('$(CTOFileHasChanged)', 'false'))" /> <ItemGroup> <FileWrites Include="$(_GeneratePkgDefOutputFile)" /> </ItemGroup> </Target> </Project>
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Features/VisualBasic/Portable/Organizing/Organizers/MemberDeclarationsOrganizer.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Threading Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Organizing.Organizers Partial Friend Class MemberDeclarationsOrganizer Private Sub New() End Sub Public Shared Function Organize(members As SyntaxList(Of StatementSyntax), cancellationToken As CancellationToken) As SyntaxList(Of StatementSyntax) ' Break the list of members up into groups based on the PP ' directives between them. Dim groups = members.SplitNodesOnPreprocessorBoundaries(cancellationToken) ' Go into each group and organize them. We'll then have a list of ' lists. Flatten that list and return that. Dim sortedGroups = groups.Select(AddressOf OrganizeMemberGroup).Flatten().ToList() If sortedGroups.SequenceEqual(members) Then Return members End If Return SyntaxFactory.List(sortedGroups) End Function Private Shared Sub TransferTrivia(Of TSyntaxNode As SyntaxNode)( originalList As IList(Of TSyntaxNode), finalList As IList(Of TSyntaxNode)) Debug.Assert(originalList.Count = finalList.Count) If originalList.Count >= 2 Then ' Ok, we wanted to reorder the list. But we're definitely not done right now. While ' most of the list will look fine, we will have issues with the first node. First, ' we don't want to move any pp directives or banners that are on the first node. ' Second, it can often be the case that the node doesn't even have any trivia. We ' want to follow the user's style. So we find the node that was in the index that ' the first node moved to, and we attempt to keep an appropriate amount of ' whitespace based on that. ' ' If the first node didn't move, then we don't need to do any of this special fixup ' logic. If originalList(0) IsNot finalList(0) Then ' First. Strip any pp directives or banners on the first node. They have to ' move to the first node in the final list. CopyBanner(originalList, finalList) ' Now, we need to fix up the first node wherever it is in the final list. We ' need to strip it of its banner, and we need to add additional whitespace to ' match the user's style FixupOriginalFirstNode(Of TSyntaxNode)(originalList, finalList) End If End If End Sub Private Shared Sub FixupOriginalFirstNode(Of TSyntaxNode As SyntaxNode)( originalList As IList(Of TSyntaxNode), finalList As IList(Of TSyntaxNode)) ' Now, find the original node in the final list. Dim originalFirstNode = originalList(0) Dim indexInFinalList = finalList.IndexOf(originalFirstNode) ' Find the initial node we had at that same index. Dim originalNodeAtThatIndex = originalList(indexInFinalList) ' If that node had blank lines above it, then place that number of blank ' lines before the first node in the final list. Dim blankLines = originalNodeAtThatIndex.GetLeadingBlankLines() originalFirstNode = originalFirstNode.GetNodeWithoutLeadingBannerAndPreprocessorDirectives(). WithPrependedLeadingTrivia(blankLines) finalList(indexInFinalList) = originalFirstNode End Sub Private Shared Sub CopyBanner(Of TSyntaxNode As SyntaxNode)( originalList As IList(Of TSyntaxNode), finalList As IList(Of TSyntaxNode)) ' First. Strip any pp directives or banners on the first node. They ' have to stay at the top of the list. Dim banner = originalList(0).GetLeadingBannerAndPreprocessorDirectives() ' Now, we want to remove any blank lines from the new first node and then ' reattach the banner. Dim finalFirstNode = finalList(0) finalFirstNode = finalFirstNode.GetNodeWithoutLeadingBlankLines() finalFirstNode = finalFirstNode.WithLeadingTrivia(banner.Concat(finalFirstNode.GetLeadingTrivia())) ' Place the updated first node back in the result list finalList(0) = finalFirstNode End Sub Private Shared Function OrganizeMemberGroup(members As IList(Of StatementSyntax)) As IList(Of StatementSyntax) If members.Count > 1 Then Dim originalList = New List(Of StatementSyntax)(members) Dim finalList = originalList.OrderBy(New Comparer()).ToList() If Not finalList.SequenceEqual(originalList) Then TransferTrivia(originalList, finalList) Return finalList End If End If Return members End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Threading Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Organizing.Organizers Partial Friend Class MemberDeclarationsOrganizer Private Sub New() End Sub Public Shared Function Organize(members As SyntaxList(Of StatementSyntax), cancellationToken As CancellationToken) As SyntaxList(Of StatementSyntax) ' Break the list of members up into groups based on the PP ' directives between them. Dim groups = members.SplitNodesOnPreprocessorBoundaries(cancellationToken) ' Go into each group and organize them. We'll then have a list of ' lists. Flatten that list and return that. Dim sortedGroups = groups.Select(AddressOf OrganizeMemberGroup).Flatten().ToList() If sortedGroups.SequenceEqual(members) Then Return members End If Return SyntaxFactory.List(sortedGroups) End Function Private Shared Sub TransferTrivia(Of TSyntaxNode As SyntaxNode)( originalList As IList(Of TSyntaxNode), finalList As IList(Of TSyntaxNode)) Debug.Assert(originalList.Count = finalList.Count) If originalList.Count >= 2 Then ' Ok, we wanted to reorder the list. But we're definitely not done right now. While ' most of the list will look fine, we will have issues with the first node. First, ' we don't want to move any pp directives or banners that are on the first node. ' Second, it can often be the case that the node doesn't even have any trivia. We ' want to follow the user's style. So we find the node that was in the index that ' the first node moved to, and we attempt to keep an appropriate amount of ' whitespace based on that. ' ' If the first node didn't move, then we don't need to do any of this special fixup ' logic. If originalList(0) IsNot finalList(0) Then ' First. Strip any pp directives or banners on the first node. They have to ' move to the first node in the final list. CopyBanner(originalList, finalList) ' Now, we need to fix up the first node wherever it is in the final list. We ' need to strip it of its banner, and we need to add additional whitespace to ' match the user's style FixupOriginalFirstNode(Of TSyntaxNode)(originalList, finalList) End If End If End Sub Private Shared Sub FixupOriginalFirstNode(Of TSyntaxNode As SyntaxNode)( originalList As IList(Of TSyntaxNode), finalList As IList(Of TSyntaxNode)) ' Now, find the original node in the final list. Dim originalFirstNode = originalList(0) Dim indexInFinalList = finalList.IndexOf(originalFirstNode) ' Find the initial node we had at that same index. Dim originalNodeAtThatIndex = originalList(indexInFinalList) ' If that node had blank lines above it, then place that number of blank ' lines before the first node in the final list. Dim blankLines = originalNodeAtThatIndex.GetLeadingBlankLines() originalFirstNode = originalFirstNode.GetNodeWithoutLeadingBannerAndPreprocessorDirectives(). WithPrependedLeadingTrivia(blankLines) finalList(indexInFinalList) = originalFirstNode End Sub Private Shared Sub CopyBanner(Of TSyntaxNode As SyntaxNode)( originalList As IList(Of TSyntaxNode), finalList As IList(Of TSyntaxNode)) ' First. Strip any pp directives or banners on the first node. They ' have to stay at the top of the list. Dim banner = originalList(0).GetLeadingBannerAndPreprocessorDirectives() ' Now, we want to remove any blank lines from the new first node and then ' reattach the banner. Dim finalFirstNode = finalList(0) finalFirstNode = finalFirstNode.GetNodeWithoutLeadingBlankLines() finalFirstNode = finalFirstNode.WithLeadingTrivia(banner.Concat(finalFirstNode.GetLeadingTrivia())) ' Place the updated first node back in the result list finalList(0) = finalFirstNode End Sub Private Shared Function OrganizeMemberGroup(members As IList(Of StatementSyntax)) As IList(Of StatementSyntax) If members.Count > 1 Then Dim originalList = New List(Of StatementSyntax)(members) Dim finalList = originalList.OrderBy(New Comparer()).ToList() If Not finalList.SequenceEqual(originalList) Then TransferTrivia(originalList, finalList) Return finalList End If End If Return members End Function End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceTransform.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; #if CODE_STYLE using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; #endif namespace Microsoft.CodeAnalysis.CSharp.ConvertNamespace { internal static class ConvertNamespaceTransform { public static async Task<Document> ConvertAsync( Document document, BaseNamespaceDeclarationSyntax baseNamespace, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); return document.WithSyntaxRoot(root.ReplaceNode(baseNamespace, Convert(baseNamespace))); } public static BaseNamespaceDeclarationSyntax Convert(BaseNamespaceDeclarationSyntax baseNamespace) { return baseNamespace switch { FileScopedNamespaceDeclarationSyntax fileScopedNamespace => ConvertFileScopedNamespace(fileScopedNamespace), NamespaceDeclarationSyntax namespaceDeclaration => ConvertNamespaceDeclaration(namespaceDeclaration), _ => throw ExceptionUtilities.UnexpectedValue(baseNamespace.Kind()), }; } private static bool HasLeadingBlankLine( SyntaxToken token, out SyntaxToken withoutBlankLine) { var leadingTrivia = token.LeadingTrivia; if (leadingTrivia.Count >= 1 && leadingTrivia[0].Kind() == SyntaxKind.EndOfLineTrivia) { withoutBlankLine = token.WithLeadingTrivia(leadingTrivia.RemoveAt(0)); return true; } if (leadingTrivia.Count >= 2 && leadingTrivia[0].IsKind(SyntaxKind.WhitespaceTrivia) && leadingTrivia[1].IsKind(SyntaxKind.EndOfLineTrivia)) { withoutBlankLine = token.WithLeadingTrivia(leadingTrivia.Skip(2)); return true; } withoutBlankLine = default; return false; } private static FileScopedNamespaceDeclarationSyntax ConvertNamespaceDeclaration(NamespaceDeclarationSyntax namespaceDeclaration) { var fileScopedNamespace = SyntaxFactory.FileScopedNamespaceDeclaration( namespaceDeclaration.AttributeLists, namespaceDeclaration.Modifiers, namespaceDeclaration.NamespaceKeyword, namespaceDeclaration.Name, SyntaxFactory.Token(SyntaxKind.SemicolonToken).WithTrailingTrivia(namespaceDeclaration.OpenBraceToken.TrailingTrivia), namespaceDeclaration.Externs, namespaceDeclaration.Usings, namespaceDeclaration.Members).WithAdditionalAnnotations(Formatter.Annotation); // Ensure there's a blank line between the namespace line and the first body member. var firstBodyToken = fileScopedNamespace.SemicolonToken.GetNextToken(); if (firstBodyToken.Kind() != SyntaxKind.EndOfFileToken && !HasLeadingBlankLine(firstBodyToken, out _)) { fileScopedNamespace = fileScopedNamespace.ReplaceToken( firstBodyToken, firstBodyToken.WithPrependedLeadingTrivia(SyntaxFactory.ElasticCarriageReturnLineFeed)); } return fileScopedNamespace; } private static NamespaceDeclarationSyntax ConvertFileScopedNamespace(FileScopedNamespaceDeclarationSyntax fileScopedNamespace) { var namespaceDeclaration = SyntaxFactory.NamespaceDeclaration( fileScopedNamespace.AttributeLists, fileScopedNamespace.Modifiers, fileScopedNamespace.NamespaceKeyword, fileScopedNamespace.Name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken).WithTrailingTrivia(fileScopedNamespace.SemicolonToken.TrailingTrivia), fileScopedNamespace.Externs, fileScopedNamespace.Usings, fileScopedNamespace.Members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), semicolonToken: default).WithAdditionalAnnotations(Formatter.Annotation); // Ensure there is no errant blank line between the open curly and the first body element. var firstBodyToken = namespaceDeclaration.OpenBraceToken.GetNextToken(); if (firstBodyToken != namespaceDeclaration.CloseBraceToken && firstBodyToken.Kind() != SyntaxKind.EndOfFileToken && HasLeadingBlankLine(firstBodyToken, out var firstBodyTokenWithoutBlankLine)) { namespaceDeclaration = namespaceDeclaration.ReplaceToken(firstBodyToken, firstBodyTokenWithoutBlankLine); } return namespaceDeclaration; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; #if CODE_STYLE using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; #endif namespace Microsoft.CodeAnalysis.CSharp.ConvertNamespace { internal static class ConvertNamespaceTransform { public static async Task<Document> ConvertAsync( Document document, BaseNamespaceDeclarationSyntax baseNamespace, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); return document.WithSyntaxRoot(root.ReplaceNode(baseNamespace, Convert(baseNamespace))); } public static BaseNamespaceDeclarationSyntax Convert(BaseNamespaceDeclarationSyntax baseNamespace) { return baseNamespace switch { FileScopedNamespaceDeclarationSyntax fileScopedNamespace => ConvertFileScopedNamespace(fileScopedNamespace), NamespaceDeclarationSyntax namespaceDeclaration => ConvertNamespaceDeclaration(namespaceDeclaration), _ => throw ExceptionUtilities.UnexpectedValue(baseNamespace.Kind()), }; } private static bool HasLeadingBlankLine( SyntaxToken token, out SyntaxToken withoutBlankLine) { var leadingTrivia = token.LeadingTrivia; if (leadingTrivia.Count >= 1 && leadingTrivia[0].Kind() == SyntaxKind.EndOfLineTrivia) { withoutBlankLine = token.WithLeadingTrivia(leadingTrivia.RemoveAt(0)); return true; } if (leadingTrivia.Count >= 2 && leadingTrivia[0].IsKind(SyntaxKind.WhitespaceTrivia) && leadingTrivia[1].IsKind(SyntaxKind.EndOfLineTrivia)) { withoutBlankLine = token.WithLeadingTrivia(leadingTrivia.Skip(2)); return true; } withoutBlankLine = default; return false; } private static FileScopedNamespaceDeclarationSyntax ConvertNamespaceDeclaration(NamespaceDeclarationSyntax namespaceDeclaration) { var fileScopedNamespace = SyntaxFactory.FileScopedNamespaceDeclaration( namespaceDeclaration.AttributeLists, namespaceDeclaration.Modifiers, namespaceDeclaration.NamespaceKeyword, namespaceDeclaration.Name, SyntaxFactory.Token(SyntaxKind.SemicolonToken).WithTrailingTrivia(namespaceDeclaration.OpenBraceToken.TrailingTrivia), namespaceDeclaration.Externs, namespaceDeclaration.Usings, namespaceDeclaration.Members).WithAdditionalAnnotations(Formatter.Annotation); // Ensure there's a blank line between the namespace line and the first body member. var firstBodyToken = fileScopedNamespace.SemicolonToken.GetNextToken(); if (firstBodyToken.Kind() != SyntaxKind.EndOfFileToken && !HasLeadingBlankLine(firstBodyToken, out _)) { fileScopedNamespace = fileScopedNamespace.ReplaceToken( firstBodyToken, firstBodyToken.WithPrependedLeadingTrivia(SyntaxFactory.ElasticCarriageReturnLineFeed)); } return fileScopedNamespace; } private static NamespaceDeclarationSyntax ConvertFileScopedNamespace(FileScopedNamespaceDeclarationSyntax fileScopedNamespace) { var namespaceDeclaration = SyntaxFactory.NamespaceDeclaration( fileScopedNamespace.AttributeLists, fileScopedNamespace.Modifiers, fileScopedNamespace.NamespaceKeyword, fileScopedNamespace.Name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken).WithTrailingTrivia(fileScopedNamespace.SemicolonToken.TrailingTrivia), fileScopedNamespace.Externs, fileScopedNamespace.Usings, fileScopedNamespace.Members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), semicolonToken: default).WithAdditionalAnnotations(Formatter.Annotation); // Ensure there is no errant blank line between the open curly and the first body element. var firstBodyToken = namespaceDeclaration.OpenBraceToken.GetNextToken(); if (firstBodyToken != namespaceDeclaration.CloseBraceToken && firstBodyToken.Kind() != SyntaxKind.EndOfFileToken && HasLeadingBlankLine(firstBodyToken, out var firstBodyTokenWithoutBlankLine)) { namespaceDeclaration = namespaceDeclaration.ReplaceToken(firstBodyToken, firstBodyTokenWithoutBlankLine); } return namespaceDeclaration; } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Test/Semantic/Semantics/OverloadResolution.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Immutable Imports System.IO Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.SpecialType Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic Imports Microsoft.CodeAnalysis.VisualBasic.OverloadResolution Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests.Emit Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics.OverloadResolutionTestHelpers Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Namespace OverloadResolutionTestHelpers Friend Module Extensions Public Function ResolveMethodOverloading( instanceMethods As ImmutableArray(Of MethodSymbol), extensionMethods As ImmutableArray(Of MethodSymbol), typeArguments As ImmutableArray(Of TypeSymbol), arguments As ImmutableArray(Of BoundExpression), argumentNames As ImmutableArray(Of String), binder As Binder, lateBindingIsAllowed As Boolean, Optional includeEliminatedCandidates As Boolean = False ) As OverloadResolution.OverloadResolutionResult Dim methods As ImmutableArray(Of MethodSymbol) If instanceMethods.IsDefaultOrEmpty Then methods = extensionMethods ElseIf extensionMethods.IsDefaultOrEmpty Then methods = instanceMethods Else methods = instanceMethods.Concat(extensionMethods) End If Dim methodGroup = New BoundMethodGroup(VisualBasicSyntaxTree.Dummy.GetRoot(Nothing), If(typeArguments.IsDefaultOrEmpty, Nothing, New BoundTypeArguments(VisualBasicSyntaxTree.Dummy.GetRoot(Nothing), typeArguments)), methods, LookupResultKind.Good, Nothing, QualificationKind.Unqualified) Return OverloadResolution.MethodInvocationOverloadResolution( methodGroup, arguments, argumentNames, binder, includeEliminatedCandidates:=includeEliminatedCandidates, lateBindingIsAllowed:=lateBindingIsAllowed, callerInfoOpt:=Nothing, useSiteInfo:=CompoundUseSiteInfo(Of AssemblySymbol).Discarded) End Function End Module End Namespace Public Class OverloadResolutionTests Inherits BasicTestBase <Fact> Public Sub BasicTests() Dim optionStrictOn = <file> Option Strict On Class OptionStrictOn Shared Sub Context() End Sub End Class </file> Dim optionStrictOff = <file> Option Strict Off Class OptionStrictOff Shared Sub Context() End Sub End Class </file> Dim optionStrictOnTree = VisualBasicSyntaxTree.ParseText(optionStrictOn.Value) Dim optionStrictOffTree = VisualBasicSyntaxTree.ParseText(optionStrictOff.Value) Dim c1 = VisualBasicCompilation.Create("Test1", syntaxTrees:={VisualBasicSyntaxTree.ParseText(SemanticResourceUtil.OverloadResolutionTestSource), optionStrictOnTree, optionStrictOffTree}, references:={MscorlibRef, SystemCoreRef}) Dim sourceModule = DirectCast(c1.Assembly.Modules(0), SourceModuleSymbol) Dim optionStrictOnContext = DirectCast(sourceModule.GlobalNamespace.GetTypeMembers("OptionStrictOn").Single().GetMembers("Context").Single(), SourceMethodSymbol) Dim optionStrictOffContext = DirectCast(sourceModule.GlobalNamespace.GetTypeMembers("OptionStrictOff").Single().GetMembers("Context").Single(), SourceMethodSymbol) Dim optionStrictOnBinder = BinderBuilder.CreateBinderForMethodBody(sourceModule, optionStrictOnTree, optionStrictOnContext) Dim optionStrictOffBinder = BinderBuilder.CreateBinderForMethodBody(sourceModule, optionStrictOffTree, optionStrictOffContext) Dim TestClass1 = c1.Assembly.GlobalNamespace.GetTypeMembers("TestClass1").Single() Dim TestClass1_M1 = TestClass1.GetMembers("M1").OfType(Of MethodSymbol)().Single() Dim TestClass1_M2 = TestClass1.GetMembers("M2").OfType(Of MethodSymbol)().Single() Dim TestClass1_M3 = TestClass1.GetMembers("M3").OfType(Of MethodSymbol)().Single() Dim TestClass1_M4 = TestClass1.GetMembers("M4").OfType(Of MethodSymbol)().Single() Dim TestClass1_M5 = TestClass1.GetMembers("M5").OfType(Of MethodSymbol)().Single() Dim TestClass1_M6 = TestClass1.GetMembers("M6").OfType(Of MethodSymbol)().Single() Dim TestClass1_M7 = TestClass1.GetMembers("M7").OfType(Of MethodSymbol)().Single() Dim TestClass1_M8 = TestClass1.GetMembers("M8").OfType(Of MethodSymbol)().Single() Dim TestClass1_M9 = TestClass1.GetMembers("M9").OfType(Of MethodSymbol)().Single() Dim TestClass1_M10 = TestClass1.GetMembers("M10").OfType(Of MethodSymbol)().Single() Dim TestClass1_M11 = TestClass1.GetMembers("M11").OfType(Of MethodSymbol)().Single() Dim TestClass1_M12 = TestClass1.GetMembers("M12").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M13 = TestClass1.GetMembers("M13").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M14 = TestClass1.GetMembers("M14").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M15 = TestClass1.GetMembers("M15").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M16 = TestClass1.GetMembers("M16").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M17 = TestClass1.GetMembers("M17").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M18 = TestClass1.GetMembers("M18").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M19 = TestClass1.GetMembers("M19").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M20 = TestClass1.GetMembers("M20").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M21 = TestClass1.GetMembers("M21").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M22 = TestClass1.GetMembers("M22").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M23 = TestClass1.GetMembers("M23").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M24 = TestClass1.GetMembers("M24").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M25 = TestClass1.GetMembers("M25").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M26 = TestClass1.GetMembers("M26").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M27 = TestClass1.GetMembers("M27").OfType(Of MethodSymbol)().Single() Dim TestClass1_g = TestClass1.GetMembers("g").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_SM = TestClass1.GetMembers("SM").OfType(Of MethodSymbol)().Single() Dim TestClass1_SM1 = TestClass1.GetMembers("SM1").OfType(Of MethodSymbol)().Single() Dim TestClass1_ShortField = TestClass1.GetMembers("ShortField").OfType(Of FieldSymbol)().Single() Dim TestClass1_DoubleField = TestClass1.GetMembers("DoubleField").OfType(Of FieldSymbol)().Single() Dim TestClass1_ObjectField = TestClass1.GetMembers("ObjectField").OfType(Of FieldSymbol)().Single() Dim base = c1.Assembly.GlobalNamespace.GetTypeMembers("Base").Single() Dim baseExt = c1.Assembly.GlobalNamespace.GetTypeMembers("BaseExt").Single() Dim derived = c1.Assembly.GlobalNamespace.GetTypeMembers("Derived").Single() Dim derivedExt = c1.Assembly.GlobalNamespace.GetTypeMembers("DerivedExt").Single() Dim ext = c1.Assembly.GlobalNamespace.GetTypeMembers("Ext").Single() Dim ext1 = c1.Assembly.GlobalNamespace.GetTypeMembers("Ext1").Single() Dim base_M1 = base.GetMembers("M1").OfType(Of MethodSymbol)().Single() Dim base_M2 = base.GetMembers("M2").OfType(Of MethodSymbol)().Single() Dim base_M3 = base.GetMembers("M3").OfType(Of MethodSymbol)().Single() Dim base_M4 = base.GetMembers("M4").OfType(Of MethodSymbol)().Single() Dim base_M5 = base.GetMembers("M5").OfType(Of MethodSymbol)().Single() Dim base_M6 = base.GetMembers("M6").OfType(Of MethodSymbol)().Single() Dim base_M7 = base.GetMembers("M7").OfType(Of MethodSymbol)().Single() Dim base_M8 = base.GetMembers("M8").OfType(Of MethodSymbol)().Single() Dim base_M9 = base.GetMembers("M9").OfType(Of MethodSymbol)().Single() Dim base_M10 = baseExt.GetMembers("M10").OfType(Of MethodSymbol)().Single() Dim derived_M1 = derived.GetMembers("M1").OfType(Of MethodSymbol)().Single() Dim derived_M2 = derived.GetMembers("M2").OfType(Of MethodSymbol)().Single() Dim derived_M3 = derived.GetMembers("M3").OfType(Of MethodSymbol)().Single() Dim derived_M4 = derived.GetMembers("M4").OfType(Of MethodSymbol)().Single() Dim derived_M5 = derived.GetMembers("M5").OfType(Of MethodSymbol)().Single() Dim derived_M6 = derived.GetMembers("M6").OfType(Of MethodSymbol)().Single() Dim derived_M7 = derived.GetMembers("M7").OfType(Of MethodSymbol)().Single() Dim derived_M8 = derived.GetMembers("M8").OfType(Of MethodSymbol)().Single() Dim derived_M9 = derived.GetMembers("M9").OfType(Of MethodSymbol)().Single() Dim derived_M10 = derivedExt.GetMembers("M10").OfType(Of MethodSymbol)().Single() Dim derived_M11 = derivedExt.GetMembers("M11").OfType(Of MethodSymbol)().Single() Dim derived_M12 = derivedExt.GetMembers("M12").OfType(Of MethodSymbol)().Single() Dim ext_M11 = ext.GetMembers("M11").OfType(Of MethodSymbol)().Single() Dim ext_M12 = ext.GetMembers("M12").OfType(Of MethodSymbol)().Single() Dim ext_M13 = ext.GetMembers("M13").OfType(Of MethodSymbol)().ToArray() Dim ext_M14 = ext.GetMembers("M14").OfType(Of MethodSymbol)().Single() Dim ext_M15 = ext.GetMembers("M15").OfType(Of MethodSymbol)().Single() Dim ext_SM = ext.GetMembers("SM").OfType(Of MethodSymbol)().Single() Dim ext_SM1 = ext.GetMembers("SM1").OfType(Of MethodSymbol)().ToArray() Dim ext1_M14 = ext1.GetMembers("M14").OfType(Of MethodSymbol)().Single() Dim TestClass2 = c1.Assembly.GlobalNamespace.GetTypeMembers("TestClass2").Single() Dim TestClass2OfInteger = TestClass2.Construct(c1.GetSpecialType(System_Int32)) Dim TestClass2OfInteger_S1 = TestClass2OfInteger.GetMembers("S1").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S2 = TestClass2OfInteger.GetMembers("S2").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S3 = TestClass2OfInteger.GetMembers("S3").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S4 = TestClass2OfInteger.GetMembers("S4").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S5 = TestClass2OfInteger.GetMembers("S5").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S6 = TestClass2OfInteger.GetMembers("S6").OfType(Of MethodSymbol)().ToArray() Dim _syntaxNode = optionStrictOffTree.GetVisualBasicRoot(Nothing) Dim [nothing] As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Nothing, Nothing) Dim intZero As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Create(0I), c1.GetSpecialType(System_Int32)) Dim longZero As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Create(0L), c1.GetSpecialType(System_Int64)) Dim unsignedOne As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Create(1UI), c1.GetSpecialType(System_UInt32)) Dim longConst As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(-1L), c1.GetSpecialType(System_Int64), Nothing) Dim intVal As BoundExpression = New BoundUnaryOperator(_syntaxNode, UnaryOperatorKind.Minus, intZero, False, intZero.Type) Dim intArray As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.CreateArrayTypeSymbol(intZero.Type)) Dim TestClass1Val As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, TestClass1) Dim omitted As BoundExpression = New BoundOmittedArgument(_syntaxNode, Nothing) Dim doubleConst As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(0.0R), c1.GetSpecialType(System_Double), Nothing) Dim doubleVal As BoundExpression = New BoundUnaryOperator(_syntaxNode, UnaryOperatorKind.Minus, doubleConst, False, doubleConst.Type) Dim shortVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_Int16)) Dim ushortVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_UInt16)) Dim objectVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_Object)) Dim objectArray As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.CreateArrayTypeSymbol(objectVal.Type)) Dim shortField As BoundExpression = New BoundFieldAccess(_syntaxNode, Nothing, TestClass1_ShortField, True, TestClass1_ShortField.Type) Dim doubleField As BoundExpression = New BoundFieldAccess(_syntaxNode, Nothing, TestClass1_DoubleField, True, TestClass1_DoubleField.Type) Dim objectField As BoundExpression = New BoundFieldAccess(_syntaxNode, Nothing, TestClass1_ObjectField, True, TestClass1_ObjectField.Type) Dim stringVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_String)) Dim result As OverloadResolution.OverloadResolutionResult 'TestClass1.M1() result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={TestClass1_M1}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M1(Of TestClass1)() 'error BC32045: 'Public Shared Sub M1()' has no type parameters and so cannot have type arguments. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={TestClass1_M1}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=(New TypeSymbol() {TestClass1}).AsImmutableOrNull(), arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.BadGenericArity, result.Candidates(0).State) Assert.Same(TestClass1_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M1(Nothing) 'error BC30057: Too many arguments to 'Public Shared Sub M1()'. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M1)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M2() 'error BC32050: Type parameter 'T' for 'Public Shared Sub M2(Of T)()' cannot be inferred. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.TypeInferenceFailed, result.Candidates(0).State) Assert.Same(TestClass1_M2, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M2(Of TestClass1)() result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=(New TypeSymbol() {TestClass1}).AsImmutableOrNull(), arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M2.Construct((New TypeSymbol() {TestClass1}).AsImmutableOrNull()), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M3() result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M3(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Equal(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'TestClass1.M3(intArray) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intArray}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Equal(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M3(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Equal(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M4(intVal, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.IsDefault) 'error BC30311: Value of type 'TestClass1' cannot be converted to 'Integer'. 'TestClass1.M4(TestClass1Val, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, TestClass1Val}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30311: Value of type 'Integer' cannot be converted to 'TestClass1'. 'TestClass1.M4(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M4(intVal, y:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={Nothing, "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({0, 1}.AsImmutableOrNull())) 'TestClass1.M4(X:=intVal, y:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"X", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({0, 1}.AsImmutableOrNull())) 'TestClass1.M4(y:=TestClass1Val, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, intVal}.AsImmutableOrNull(), argumentNames:={"y", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({1, 0}.AsImmutableOrNull())) 'error BC30311: Value of type 'Integer' cannot be converted to 'TestClass1'. 'TestClass1.M4(y:=intVal, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"y", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({1, 0}.AsImmutableOrNull())) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30274: Parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)' already has a matching argument. 'TestClass1.M4(intVal, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC32021: Parameter 'x' in 'Public Shared Sub M4(x As Integer, y As TestClass1)' already has a matching omitted argument. 'TestClass1.M4(, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={omitted, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30274: Parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)' already has a matching argument. 'TestClass1.M4(x:=intVal, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"x", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30272: 'z' is not a parameter of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(z:=intVal, y:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"z", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30272: 'z' is not a parameter of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(z:=TestClass1Val, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, intVal}.AsImmutableOrNull(), argumentNames:={"z", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={omitted, TestClass1Val}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(intVal, ) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, omitted}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30587: Named argument cannot match a ParamArray parameter. 'TestClass1.M3(x:=intArray) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intArray}.AsImmutableOrNull(), argumentNames:={"x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30587: Named argument cannot match a ParamArray parameter. 'TestClass1.M3(x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:={"x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30588: Omitted argument cannot match a ParamArray parameter. 'TestClass1.M5(intVal, ) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M5)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, omitted}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Same(TestClass1_M5, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Same(TestClass1_M5, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M4(x:=intVal, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"x", Nothing}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.BestResult.HasValue) 'error BC30057: Too many arguments to 'Public Shared Sub M2(Of T)()'. 'TestClass1.M2(Of TestClass1)(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=(New TypeSymbol() {TestClass1}).AsImmutableOrNull(), arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(0).State) Assert.Equal(TestClass1_M2.Construct((New TypeSymbol() {TestClass1}).AsImmutableOrNull()), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M6(shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M6(doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.False(result.BestResult.HasValue) 'TestClass1.M6(doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Integer'. 'TestClass1.M6(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.False(result.BestResult.HasValue) 'TestClass1.M7(shortVal, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(doubleVal, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(shortVal, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(doubleVal, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M7(doubleConst, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M7(shortVal, doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M7(doubleConst, doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst, doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(objectVal, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(shortVal, objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(objectVal, objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(objectVal, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(doubleConst, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(objectVal, doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC32029: Option Strict On disallows narrowing from type 'Double' to type 'Short' in copying the value of 'ByRef' parameter 'x' back to the matching argument. 'TestClass1.M8(TestClass1.ShortField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M8)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M8((shortVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M8)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC32029: Option Strict On disallows narrowing from type 'Object' to type 'Short' in copying the value of 'ByRef' parameter 'x' back to the matching argument. 'TestClass1.M9(TestClass1.ShortField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M9((shortVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M10(doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M10(TestClass1.DoubleField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M10(TestClass1.ObjectField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M10((doubleVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M10((objectVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M11(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M11)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'TestClass1.M11(objectArray) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M11)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectArray}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M12(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M12(0)), (TestClass1_M12(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M12(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M12(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M12(0)), (TestClass1_M12(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M12(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M12(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'TestClass1.M13(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:={"a"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M13(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"a", "b"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(3, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(2).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass1_M13(1), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(2)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(1)), (TestClass1_M13(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M13(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M13(intVal, intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M13(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Derived.M1(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M1), (base_M1)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(base_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(base_M1), (derived_M1)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(base_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Derived.M2(intVal, z:=stringVal) ' Should bind to Base.M2 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M2), (base_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, stringVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M2, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M2, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Derived.M2(intVal, z:=stringVal) ' Should bind to Base.M2 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M2), (base_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, stringVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(0).State) Assert.Same(derived_M2, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M2, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M3(intVal, z:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M3), (base_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'error BC30272: 'z' is not a parameter of 'Public Shared Overloads Sub M4(u As Integer, [v As Integer = 0], [w As Integer = 0])'. 'Derived.M4(intVal, z:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M4), (base_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'derived.M5(a:=objectVal) ' Should bind to Base.M5 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M5), (base_M5)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:={"a"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(derived_M5, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M5, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M6(a:=objectVal) ' Should bind to Base.M6 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M6), (base_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:={"a"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(0).State) Assert.Same(derived_M6, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M6, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M7(objectVal, objectVal) ' Should bind to Base.M7 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M7), (base_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M7, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M7, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M8(objectVal, objectVal) ' Should bind to Derived.M8 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M8), (base_M8)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M8, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(derived_M8, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Derived.M9(a:=TestClass1Val, b:=1) ' Should bind to Derived.M9 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M9), (base_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, intVal}.AsImmutableOrNull(), argumentNames:={"a", "b"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M9, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'error BC30311: Value of type 'Integer' cannot be converted to 'TestClass1'. 'error BC30311: Value of type 'TestClass1' cannot be converted to 'Integer'. 'Derived.M9(a:=intVal, b:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M9), (base_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"a", "b"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M9, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Derived.M9(Nothing, Nothing) ' Should bind to Derived.M9 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M9), (base_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing], [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M9, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls BaseExt.M 'b.M10(intVal) Dim base_M10_Candidate = (base_M10.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={base_M10_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(base_M10_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls DerivedExt.M 'd.M10(intVal) Dim derived_M10_Candidate = (derived_M10.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={base_M10_Candidate, derived_M10_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M10_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M10_Candidate, base_M10_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M10_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls Ext.M11(derived, ...), because Ext.M11(I1, ...) is hidden since it extends ' an interface. 'd.M11(intVal) Dim derived_M11_Candidate = (derived_M11.ReduceExtensionMethod(derived, 0)) Dim i1_M11_Candidate = (ext_M11.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M11_Candidate, i1_M11_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M11_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={i1_M11_Candidate, derived_M11_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M11_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls derived.M12 since T.M12 target type is more generic. 'd.M12(10) Dim derived_M12_Candidate = (derived_M12.ReduceExtensionMethod(derived, 0)) Dim ext_M12_Candidate = (ext_M12.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M12_Candidate, ext_M12_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M12_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M12_Candidate, derived_M12_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M12_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M12_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M12_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'tc2.S1(10, 10) ' Calls S1(U, T) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S1(0)), (TestClass2OfInteger_S1(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S1(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S1(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S1(1)), (TestClass2OfInteger_S1(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S1(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S1(1).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S1(1)), (TestClass2OfInteger_S1(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S1(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S1(1).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'tc2.S2(10, 10) ' Calls S2(Integer, T) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S2(0)), (TestClass2OfInteger_S2(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S2(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S2(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S2(1)), (TestClass2OfInteger_S2(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S2(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S2(1).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S2(0)), (TestClass2OfInteger_S2(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S2(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S2(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'M13(Of T, U)(x As T, y As U, z As T) 'intVal.M13(intVal, intVal) Dim ext_M13_0_Candidate = (ext_M13(0).ReduceExtensionMethod(intVal.Type, 0)) Dim ext_M13_1_Candidate = (ext_M13(1).ReduceExtensionMethod(intVal.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M13_0_Candidate, ext_M13_1_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(ext_M13_0_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext_M13_1_Candidate.OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M13_1_Candidate, ext_M13_0_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(ext_M13_0_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M13_1_Candidate.OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Extension method precedence Dim derived_M11_Candidate_0 = (derived_M11.ReduceExtensionMethod(derived, 0)) Dim derived_M11_Candidate_1 = (derived_M11.ReduceExtensionMethod(derived, 1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M11_Candidate_0, derived_M11_Candidate_1}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M11_Candidate_0, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(derived_M11_Candidate_1, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M11_Candidate_1, derived_M11_Candidate_0}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(derived_M11_Candidate_0, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(derived_M11_Candidate_1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S3(0)), (TestClass2OfInteger_S3(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal, intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S3(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S3(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.True(result.BestResult.HasValue) 'error BC30521: Overload resolution failed because no accessible 'M14' is most specific for these arguments: 'Extension(method) 'Public Sub M14(Of Integer)(y As Integer, z As Integer)' defined in 'Ext1': Not most specific. 'Extension(method) 'Public Sub M14(Of Integer)(y As Integer, z As Integer)' defined in 'Ext': Not most specific. 'intVal.M14(intVal, intVal) Dim ext_M14_Candidate = (ext_M14.ReduceExtensionMethod(intVal.Type, 0)) Dim ext1_M14_Candidate = (ext1_M14.ReduceExtensionMethod(intVal.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M14_Candidate, ext1_M14_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M14_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext1_M14_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) 'error BC30521: Overload resolution failed because no accessible 'S4' is most specific for these arguments: 'Public Sub S4(Of Integer)(x As Integer, y() As Integer, z As TestClass2(Of Integer), v As Integer)': Not most specific. 'Public Sub S4(Of Integer)(x As Integer, y() As Integer, z As TestClass2(Of Integer), v As Integer)': Not most specific. 'tc2.S4(intVal, Nothing, Nothing, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S4(0)), (TestClass2OfInteger_S4(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, [nothing], [nothing], intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S4(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S4(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) 'error BC30521: Overload resolution failed because no accessible 'S5' is most specific for these arguments: 'Public Sub S5(x As Integer, y As TestClass2(Of Integer()))': Not most specific. 'Public Sub S5(x As Integer, y As TestClass2(Of Integer))': Not most specific. 'tc2.S5(intVal, Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S5(0)), (TestClass2OfInteger_S5(1)), (TestClass2OfInteger_S5(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S5(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S5(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass2OfInteger_S5(2).OriginalDefinition, result.Candidates(2).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S5(0)), (TestClass2OfInteger_S5(1)), (TestClass2OfInteger_S5(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, [nothing]}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S5(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S5(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass2OfInteger_S5(2).OriginalDefinition, result.Candidates(2).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) 'intVal.M15(intVal, intVal) Dim ext_M15_Candidate = (ext_M15.ReduceExtensionMethod(intVal.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M15_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M15_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'S6(x As T, ParamArray y As Integer()) 'tc2.S6(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S6(0)), (TestClass2OfInteger_S6(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(4, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S6(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S6(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.Candidates(2).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(2).State) Assert.Same(TestClass2OfInteger_S6(1).OriginalDefinition, result.Candidates(2).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.True(result.Candidates(3).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(3).State) Assert.Same(TestClass2OfInteger_S6(1).OriginalDefinition, result.Candidates(3).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(3)) 'M14(a As Integer) 'TestClass1.M14(shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M14(0)), (TestClass1_M14(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M14(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M14(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M14(1)), (TestClass1_M14(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M14(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M14(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'M15(a As Integer) 'TestClass1.M15(0) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M15(0)), (TestClass1_M15(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M15(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M15(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M15(1)), (TestClass1_M15(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M15(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M15(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'M16(a As Short) 'TestClass1.M16(0L) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(0)), (TestClass1_M16(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.True(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Option Strict Off 'error BC30519: Overload resolution failed because no accessible 'M16' can be called without a narrowing conversion: 'Public Shared Sub M16(a As System.TypeCode)': Argument matching parameter 'a' narrows from 'Long' to 'System.TypeCode'. 'Public Shared Sub M16(a As Short)': Argument matching parameter 'a' narrows from 'Long' to 'Short'. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(0)), (TestClass1_M16(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.True(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(1)), (TestClass1_M16(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.False(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'M16(a As System.TypeCode) 'TestClass1.M16(0) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(0)), (TestClass1_M16(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(0).State) Assert.Same(TestClass1_M16(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M16(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(1)), (TestClass1_M16(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(1).State) Assert.Same(TestClass1_M16(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M16(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Byte 'TestClass1.M17(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M17(0)), (TestClass1_M17(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M17(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M17(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M17(1)), (TestClass1_M17(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M17(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M17(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Short 'TestClass1.M18(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M18(0)), (TestClass1_M18(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M18(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M18(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M18(1)), (TestClass1_M18(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M18(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M18(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Integer 'TestClass1.M19(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M19(0)), (TestClass1_M19(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M19(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M19(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M19(1)), (TestClass1_M19(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M19(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M19(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Long 'TestClass1.M20(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M20(0)), (TestClass1_M20(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M20(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M20(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M20(1)), (TestClass1_M20(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M20(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M20(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Integer 'TestClass1.M21(ushortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M21(0)), (TestClass1_M21(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={ushortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M21(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M21(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M21(1)), (TestClass1_M21(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={ushortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M21(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M21(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) Dim numericTypesPrecedence = {System_SByte, System_Byte, System_Int16, System_UInt16, System_Int32, System_UInt32, System_Int64, System_UInt64, System_Decimal, System_Single, System_Double} Dim prev As SpecialType = 0 For i As Integer = 0 To numericTypesPrecedence.Length - 1 Step 1 Assert.InRange(numericTypesPrecedence(i), prev + 1, Integer.MaxValue) prev = numericTypesPrecedence(i) Next 'error BC30521: Overload resolution failed because no accessible 'M22' is most specific for these arguments: 'Public Shared Sub M22(a As SByte, b As Long)': Not most specific. 'Public Shared Sub M22(a As Byte, b As ULong)': Not most specific. 'TestClass1.M22(Nothing, Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M22(0)), (TestClass1_M22(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing], [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M22(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M22(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M22(1)), (TestClass1_M22(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing], [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M22(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M22(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'M23(a As Long) 'TestClass1.M23(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.True(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Option strict OFF: late call 'TestClass1.M23(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.True(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Option strict ON ' error BC30518: Overload resolution failed because no accessible 'M23' can be called with these arguments: 'Public Shared Sub M23(a As Short)': Option Strict On disallows implicit conversions from 'Object' to 'Short'. 'Public Shared Sub M23(a As Long)': Option Strict On disallows implicit conversions from 'Object' to 'Long'. 'TestClass1.M23(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Option strict OFF 'warning BC42016: Implicit conversion from 'Object' to 'Short'. 'TestClass1.M24(objectVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M24(0)), (TestClass1_M24(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ExtensionMethodVsLateBinding, result.Candidates(0).State) Assert.Same(TestClass1_M24(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M24(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Option strict ON 'F:\ddp\Roslyn\Main\Open\Compilers\VisualBasic\Test\Semantics\OverloadResolutionTestSource.vb(549) : error BC30518: Overload resolution failed because no accessible 'M24' can be called with these arguments: 'Public Shared Sub M24(a As Short, b As Integer)': Option Strict On disallows implicit conversions from 'Object' to 'Short'. 'Public Shared Sub M24(a As Long, b As Short)': Option Strict On disallows implicit conversions from 'Object' to 'Long'. 'Public Shared Sub M24(a As Long, b As Short)': Option Strict On disallows implicit conversions from 'Integer' to 'Short'. 'TestClass1.M24(objectVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M24(0)), (TestClass1_M24(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M24(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M24(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M24(0)), (TestClass1_M24(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M24(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M24(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'M25(a As SByte) 'TestClass1.M25(-1L) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M25(0)), (TestClass1_M25(1)), (TestClass1_M25(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M25(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M25(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass1_M25(2), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(2)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M25(2)), (TestClass1_M25(0)), (TestClass1_M25(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M25(2), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M25(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(2).State) Assert.Same(TestClass1_M25(1), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M25(1)), (TestClass1_M25(2)), (TestClass1_M25(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M25(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M25(2), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(2).State) Assert.Same(TestClass1_M25(0), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'BC30518: Overload resolution failed because no accessible 'M26' can be called with these arguments: 'Public Shared Sub M26(a As Integer, b As Short)': Option Strict On disallows implicit conversions from 'Double' to 'Short'. 'Public Shared Sub M26(a As Short, b As Integer)': Option Strict On disallows implicit conversions from 'Double' to 'Integer'. 'TestClass1.M26(-1L, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(1)), (TestClass1_M26(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30512: Option Strict On disallows implicit conversions from 'Integer' to 'Short'. 'TestClass1.M27(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Sub M14(a As Long) 'TestClass1.M14(0L) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M14(0)), (TestClass1_M14(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(0).State) Assert.Same(TestClass1_M14(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M14(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) Dim DoubleMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Double.MaxValue), c1.GetSpecialType(System_Double), Nothing) Dim IntegerMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Integer.MaxValue), c1.GetSpecialType(System_Int32), Nothing) Assert.True(c1.Options.CheckOverflow) 'error BC30439: Constant expression not representable in type 'Short'. 'TestClass1.M27(Integer.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30439: Constant expression not representable in type 'Short'. 'TestClass1.M27(Double.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={DoubleMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30519: Overload resolution failed because no accessible 'M26' can be called without a narrowing conversion: 'Public Shared Sub M26(a As Integer, b As Short)': Argument matching parameter 'b' narrows from 'Integer' to 'Short'. 'Public Shared Sub M26(a As Short, b As Integer)': Argument matching parameter 'a' narrows from 'Integer' to 'Short'. 'TestClass1.M26(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Overflow On - Sub M26(a As Integer, b As Short) 'TestClass1.M26(Integer.MaxValue, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'error BC30521: Overload resolution failed because no accessible 'g' is most specific for these arguments 'TestClass1.g(1UI) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_g(0)), (TestClass1_g(1)), (TestClass1_g(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={unsignedOne}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_g(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_g(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass1_g(2), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Should bind to extension method 'TestClass1Val.SM(x:=intVal, y:=objectVal) Dim ext_SM_Candidate = (ext_SM.ReduceExtensionMethod(TestClass1Val.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_SM)}.AsImmutableOrNull(), extensionMethods:={ext_SM_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal, objectVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass1_SM, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext_SM_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'error BC30519: Overload resolution failed because no accessible 'SM1' can be called without a narrowing conversion: 'Extension(method) 'Public Sub SM1(y As Object, x As Short)' defined in 'Ext': Argument matching parameter 'x' narrows from 'Integer' to 'Short'. 'Extension(method) 'Public Sub SM1(y As Double, x As Integer)' defined in 'Ext': Argument matching parameter 'y' narrows from 'Object' to 'Double'. 'TestClass1Val.SM1(x:=intVal, y:=objectVal) Dim ext_SM1_0_Candidate = (ext_SM1(0).ReduceExtensionMethod(TestClass1Val.Type, 0)) Dim ext_SM1_1_Candidate = (ext_SM1(1).ReduceExtensionMethod(TestClass1Val.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_SM1)}.AsImmutableOrNull(), extensionMethods:={ext_SM1_0_Candidate, ext_SM1_1_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal, objectVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass1_SM1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext_SM1_0_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(ext_SM1_1_Candidate, result.Candidates(2).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) End Sub <Fact> Public Sub BasicTests2() Dim optionStrictOff = <file> Option Strict Off Class OptionStrictOff Shared Sub Context() End Sub End Class </file> Dim optionStrictOffTree = VisualBasicSyntaxTree.ParseText(optionStrictOff.Value) Dim c1 = VisualBasicCompilation.Create("Test1", syntaxTrees:={Parse(SemanticResourceUtil.OverloadResolutionTestSource), optionStrictOffTree}, references:={TestMetadata.Net40.mscorlib}, options:=TestOptions.ReleaseExe.WithOverflowChecks(False)) Dim sourceModule = DirectCast(c1.Assembly.Modules(0), SourceModuleSymbol) Dim optionStrictOffContext = DirectCast(sourceModule.GlobalNamespace.GetTypeMembers("OptionStrictOff").Single().GetMembers("Context").Single(), SourceMethodSymbol) Dim optionStrictOffBinder = BinderBuilder.CreateBinderForMethodBody(sourceModule, optionStrictOffTree, optionStrictOffContext) Assert.False(c1.Options.CheckOverflow) Dim TestClass1 = c1.Assembly.GlobalNamespace.GetTypeMembers("TestClass1").Single() Dim TestClass1_M26 = TestClass1.GetMembers("M26").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M27 = TestClass1.GetMembers("M27").OfType(Of MethodSymbol)().Single() Dim _syntaxNode = optionStrictOffTree.GetVisualBasicRoot(Nothing) Dim _syntaxTree = optionStrictOffTree Dim DoubleMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Double.MaxValue), c1.GetSpecialType(System_Double), Nothing) Dim IntegerMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Integer.MaxValue), c1.GetSpecialType(System_Int32), Nothing) Dim intVal As BoundExpression = New BoundUnaryOperator(_syntaxNode, UnaryOperatorKind.Minus, IntegerMaxValue, False, IntegerMaxValue.Type) Dim result As OverloadResolution.OverloadResolutionResult 'Overflow Off 'TestClass1.M27(Integer.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Overflow Off 'error BC30439: Constant expression not representable in type 'Short'. 'TestClass1.M27(Double.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={DoubleMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Overflow Off 'error BC30519: Overload resolution failed because no accessible 'M26' can be called without a narrowing conversion: 'Public Shared Sub M26(a As Integer, b As Short)': Argument matching parameter 'b' narrows from 'Integer' to 'Short'. 'Public Shared Sub M26(a As Short, b As Integer)': Argument matching parameter 'a' narrows from 'Integer' to 'Short'. 'TestClass1.M26(Integer.MaxValue, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) End Sub <Fact> Public Sub Bug4219() Dim compilationDef = <compilation name="Bug4219"> <file name="a.vb"> Option Strict On Module Program Sub Main() Dim a As A(Of Long, Integer) a.Goo(y:=1, x:=1) End Sub End Module Class A(Of T, S) Sub Goo(x As Integer, y As T) End Sub Sub Goo(y As Long, x As S) End Sub End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC42104: Variable 'a' is used before it has been assigned a value. A null reference exception could result at runtime. a.Goo(y:=1, x:=1) ~ BC30521: Overload resolution failed because no accessible 'Goo' is most specific for these arguments: 'Public Sub Goo(x As Integer, y As Long)': Not most specific. 'Public Sub Goo(y As Long, x As Integer)': Not most specific. a.Goo(y:=1, x:=1) ~~~ </expected>) End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186a() Dim compilationDef = <compilation name="Bug14186a"> <file name="a.vb"> Imports System Imports System.Collections.Generic Public Class Bar Shared Sub Equal(Of T)(exp As IEnumerable(Of T), act As IEnumerable(Of T)) Console.Write("A;") End Sub Shared Sub Equal(Of T)(exp As T, act As T) Console.Write("B;") End Sub End Class Public Module Goo Sub Main() Dim goo As IEnumerable(Of Integer) = Nothing Bar.Equal(goo, goo) End Sub End Module </file> </compilation> CompileAndVerify(compilationDef, expectedOutput:="A;") End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186b() Dim compilationDef = <compilation name="Bug14186b"> <file name="a.vb"> Imports System.Collections.Generic Public Class Bar Shared Sub Equal(Of T)(exp As IEnumerable(Of T), act As T) End Sub Shared Sub Equal(Of T)(exp As T, act As IEnumerable(Of T)) End Sub End Class Public Module Goo Sub Main() Dim goo As IEnumerable(Of Integer) = Nothing Bar.Equal(goo, goo) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30518: Overload resolution failed because no accessible 'Equal' can be called with these arguments: 'Public Shared Sub Equal(Of T)(exp As IEnumerable(Of T), act As T)': Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error. 'Public Shared Sub Equal(Of T)(exp As T, act As IEnumerable(Of T))': Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error. Bar.Equal(goo, goo) ~~~~~ </expected>) End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186c() Dim compilationDef = <compilation name="Bug14186c"> <file name="a.vb"> Public Class Bar Shared Sub Equal(Of T)(exp As I1(Of T)) End Sub Shared Sub Equal(Of T)(exp As I2(Of T)) End Sub End Class Public Interface I1(Of T) End Interface Public Interface I2(Of T) End Interface Class P(Of T) Implements I1(Of T), I2(Of T) End Class Public Module Goo Sub Main() Dim goo As New P(Of Integer) Bar.Equal(goo) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30521: Overload resolution failed because no accessible 'Equal' is most specific for these arguments: 'Public Shared Sub Equal(Of Integer)(exp As I1(Of Integer))': Not most specific. 'Public Shared Sub Equal(Of Integer)(exp As I2(Of Integer))': Not most specific. Bar.Equal(goo) ~~~~~ </expected>) End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186d() Dim compilationDef = <compilation name="Bug14186d"> <file name="a.vb"> Imports System Public Class Bar Shared Sub Equal(Of T)(exp As I2(Of I2(Of T))) Console.Write("A;") End Sub Shared Sub Equal(Of T)(exp As I2(Of T)) Console.Write("B;") End Sub End Class Public Interface I2(Of T) End Interface Class P(Of T) Implements I2(Of I2(Of T)), I2(Of T) End Class Public Module Goo Sub Main() Dim goo As New P(Of Integer) Dim goo2 As I2(Of Integer) = goo Bar.Equal(goo2) Dim goo3 As I2(Of I2(Of Integer)) = goo Bar.Equal(goo3) End Sub End Module </file> </compilation> CompileAndVerify(compilationDef, expectedOutput:="B;A;") End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186e() Dim compilationDef = <compilation name="Bug14186e"> <file name="a.vb"> Imports System Public Class Bar Shared Sub Equal(Of T)(exp() As I2(Of T)) Console.Write("A;") End Sub Shared Sub Equal(Of T)(exp() As T) Console.Write("B;") End Sub End Class Public Interface I2(Of T) End Interface Public Module Goo Sub Main() Dim goo() As I2(Of Integer) = Nothing Bar.Equal(goo) End Sub End Module </file> </compilation> CompileAndVerify(compilationDef, expectedOutput:="A;") End Sub <Fact> Public Sub Diagnostics1() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() F1(Of Integer, Integer)() F1(Of Integer, Integer)(1, 2) F2(Of Integer)() F2(Of Integer)(1, 2) F3(Of Integer)() F3(Of Integer)(1, 2) F1(Of Integer)() F1(Of Integer)(1, 2) F4() F4(, , , ) F4(1, 2, , 4) F3(y:=1) F3(1, y:=2) F3(y:=1, z:=2) F4(y:=1, x:=2) F4(, y:=1) F3(x:=1, x:=2) F3(, x:=2) F3(1, x:=2) F4(x:=1, x:=2) F4(, x:=2) F4(1, x:=2) F5(x:=1, x:=2) F2(1) Dim g As System.Guid = Nothing F6(g, g) F6(y:=g, x:=g) F4(g, Nothing) F4(1, g) Dim l As Long = 1 Dim s As Short = 1 F3(l) F7(g) F7(s) F7((l)) F8(y:=Nothing) End Sub Sub F1(Of T)(x As Integer) End Sub Sub F2(Of T, S)(x As Integer) End Sub Sub F3(x As Integer) End Sub Sub F4(x As Integer, ParamArray y As Integer()) End Sub Sub F5(x As Integer, y As Integer) End Sub Sub F6(x As Integer, y As Long) End Sub Sub F7(ByRef x As Integer) End Sub Sub F8(ParamArray y As Integer()) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32043: Too many type arguments to 'Public Sub F1(Of T)(x As Integer)'. F1(Of Integer, Integer)() ~~~~~~~~~~~~~~~~~~~~~ BC32043: Too many type arguments to 'Public Sub F1(Of T)(x As Integer)'. F1(Of Integer, Integer)(1, 2) ~~~~~~~~~~~~~~~~~~~~~ BC32042: Too few type arguments to 'Public Sub F2(Of T, S)(x As Integer)'. F2(Of Integer)() ~~~~~~~~~~~~ BC32042: Too few type arguments to 'Public Sub F2(Of T, S)(x As Integer)'. F2(Of Integer)(1, 2) ~~~~~~~~~~~~ BC32045: 'Public Sub F3(x As Integer)' has no type parameters and so cannot have type arguments. F3(Of Integer)() ~~~~~~~~~~~~ BC32045: 'Public Sub F3(x As Integer)' has no type parameters and so cannot have type arguments. F3(Of Integer)(1, 2) ~~~~~~~~~~~~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F1(Of Integer)(x As Integer)'. F1(Of Integer)() ~~~~~~~~~~~~~~ BC30057: Too many arguments to 'Public Sub F1(Of Integer)(x As Integer)'. F1(Of Integer)(1, 2) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())'. F4() ~~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())'. F4(, , , ) ~~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(, , , ) ~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(, , , ) ~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(, , , ) ~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(1, 2, , 4) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F3(x As Integer)'. F3(y:=1) ~~ BC30272: 'y' is not a parameter of 'Public Sub F3(x As Integer)'. F3(y:=1) ~ BC30272: 'y' is not a parameter of 'Public Sub F3(x As Integer)'. F3(1, y:=2) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F3(x As Integer)'. F3(y:=1, z:=2) ~~ BC30272: 'y' is not a parameter of 'Public Sub F3(x As Integer)'. F3(y:=1, z:=2) ~ BC30272: 'z' is not a parameter of 'Public Sub F3(x As Integer)'. F3(y:=1, z:=2) ~ BC30587: Named argument cannot match a ParamArray parameter. F4(y:=1, x:=2) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())'. F4(, y:=1) ~~ BC30587: Named argument cannot match a ParamArray parameter. F4(, y:=1) ~ BC30274: Parameter 'x' of 'Public Sub F3(x As Integer)' already has a matching argument. F3(x:=1, x:=2) ~ BC32021: Parameter 'x' in 'Public Sub F3(x As Integer)' already has a matching omitted argument. F3(, x:=2) ~ BC30274: Parameter 'x' of 'Public Sub F3(x As Integer)' already has a matching argument. F3(1, x:=2) ~ BC30274: Parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())' already has a matching argument. F4(x:=1, x:=2) ~ BC32021: Parameter 'x' in 'Public Sub F4(x As Integer, ParamArray y As Integer())' already has a matching omitted argument. F4(, x:=2) ~ BC30274: Parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())' already has a matching argument. F4(1, x:=2) ~ BC30455: Argument not specified for parameter 'y' of 'Public Sub F5(x As Integer, y As Integer)'. F5(x:=1, x:=2) ~~ BC30274: Parameter 'x' of 'Public Sub F5(x As Integer, y As Integer)' already has a matching argument. F5(x:=1, x:=2) ~ BC32050: Type parameter 'S' for 'Public Sub F2(Of T, S)(x As Integer)' cannot be inferred. F2(1) ~~ BC32050: Type parameter 'T' for 'Public Sub F2(Of T, S)(x As Integer)' cannot be inferred. F2(1) ~~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F6(g, g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Long'. F6(g, g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Long'. F6(y:=g, x:=g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F6(y:=g, x:=g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F4(g, Nothing) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F4(1, g) ~ BC30512: Option Strict On disallows implicit conversions from 'Long' to 'Integer'. F3(l) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F7(g) ~ BC32029: Option Strict On disallows narrowing from type 'Integer' to type 'Short' in copying the value of 'ByRef' parameter 'x' back to the matching argument. F7(s) ~ BC30512: Option Strict On disallows implicit conversions from 'Long' to 'Integer'. F7((l)) ~~~ BC30587: Named argument cannot match a ParamArray parameter. F8(y:=Nothing) ~ </expected>) End Sub <Fact> Public Sub Diagnostics2() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() Goo(Of Integer, Integer)() Goo(Of Integer, Integer)(1, 2) Goo(Of Integer)() Goo(Of Integer)(1, 2) Dim g As System.Guid = Nothing F1(g) F1(y:=1) F2(1, y:=1) F2(1, ) F3(1, , z:=1) F3(1, 1, x:=1) Goo(1) End Sub Sub Goo(Of T)(x As Integer) End Sub Sub Goo(Of S)(x As Long) End Sub Sub F1(x As Integer) End Sub Sub F1(x As Long) End Sub Sub F2(x As Long, ParamArray y As Integer()) End Sub Sub F2(x As Integer, a As Integer, ParamArray y As Integer()) End Sub Sub F3(x As Long, y As Integer, z As Long) End Sub Sub F3(x As Long, z As Long, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32087: Overload resolution failed because no accessible 'Goo' accepts this number of type arguments. Goo(Of Integer, Integer)() ~~~~~~~~~~~~~~~~~~~~~~~~ BC32087: Overload resolution failed because no accessible 'Goo' accepts this number of type arguments. Goo(Of Integer, Integer)(1, 2) ~~~~~~~~~~~~~~~~~~~~~~~~ BC30516: Overload resolution failed because no accessible 'Goo' accepts this number of arguments. Goo(Of Integer)() ~~~~~~~~~~~~~~~ BC30516: Overload resolution failed because no accessible 'Goo' accepts this number of arguments. Goo(Of Integer)(1, 2) ~~~~~~~~~~~~~~~ BC30518: Overload resolution failed because no accessible 'F1' can be called with these arguments: 'Public Sub F1(x As Integer)': Value of type 'Guid' cannot be converted to 'Integer'. 'Public Sub F1(x As Long)': Value of type 'Guid' cannot be converted to 'Long'. F1(g) ~~ BC30518: Overload resolution failed because no accessible 'F1' can be called with these arguments: 'Public Sub F1(x As Integer)': 'y' is not a method parameter. 'Public Sub F1(x As Integer)': Argument not specified for parameter 'x'. 'Public Sub F1(x As Long)': 'y' is not a method parameter. 'Public Sub F1(x As Long)': Argument not specified for parameter 'x'. F1(y:=1) ~~ BC30518: Overload resolution failed because no accessible 'F2' can be called with these arguments: 'Public Sub F2(x As Long, ParamArray y As Integer())': Named argument cannot match a ParamArray parameter. 'Public Sub F2(x As Integer, a As Integer, ParamArray y As Integer())': Named argument cannot match a ParamArray parameter. 'Public Sub F2(x As Integer, a As Integer, ParamArray y As Integer())': Argument not specified for parameter 'a'. F2(1, y:=1) ~~ BC30518: Overload resolution failed because no accessible 'F2' can be called with these arguments: 'Public Sub F2(x As Long, ParamArray y As Integer())': Omitted argument cannot match a ParamArray parameter. 'Public Sub F2(x As Integer, a As Integer, ParamArray y As Integer())': Argument not specified for parameter 'a'. F2(1, ) ~~ BC30518: Overload resolution failed because no accessible 'F3' can be called with these arguments: 'Public Sub F3(x As Long, y As Integer, z As Long)': Argument not specified for parameter 'y'. 'Public Sub F3(x As Long, z As Long, y As Integer)': Parameter 'z' already has a matching omitted argument. 'Public Sub F3(x As Long, z As Long, y As Integer)': Argument not specified for parameter 'y'. F3(1, , z:=1) ~~ BC30518: Overload resolution failed because no accessible 'F3' can be called with these arguments: 'Public Sub F3(x As Long, y As Integer, z As Long)': Parameter 'x' already has a matching argument. 'Public Sub F3(x As Long, y As Integer, z As Long)': Argument not specified for parameter 'z'. 'Public Sub F3(x As Long, z As Long, y As Integer)': Parameter 'x' already has a matching argument. 'Public Sub F3(x As Long, z As Long, y As Integer)': Argument not specified for parameter 'y'. F3(1, 1, x:=1) ~~ BC30518: Overload resolution failed because no accessible 'Goo' can be called with these arguments: 'Public Sub Goo(Of T)(x As Integer)': Type parameter 'T' cannot be inferred. 'Public Sub Goo(Of S)(x As Long)': Type parameter 'S' cannot be inferred. Goo(1) ~~~ </expected>) End Sub <Fact> Public Sub Diagnostics3() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict Off Imports System.Console Module Module1 Sub Main() Dim i As Integer = 0 F1(i) F2(i, i) F2(1, 1) End Sub Sub F1(x As Byte) End Sub Sub F1(x As SByte) End Sub Sub F1(ByRef x As Long) End Sub Sub F2(x As Integer, ParamArray y As Byte()) End Sub Sub F2(x As SByte, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30519: Overload resolution failed because no accessible 'F1' can be called without a narrowing conversion: 'Public Sub F1(x As Byte)': Argument matching parameter 'x' narrows from 'Integer' to 'Byte'. 'Public Sub F1(x As SByte)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. 'Public Sub F1(ByRef x As Long)': Copying the value of 'ByRef' parameter 'x' back to the matching argument narrows from type 'Long' to type 'Integer'. F1(i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(i, i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(1, 1) ~~ </expected>) End Sub <Fact> Public Sub Diagnostics4() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() Dim i As Integer = 0 F1(i) F2(i, i) F2(1, 1) End Sub Sub F1(x As Byte) End Sub Sub F1(x As SByte) End Sub Sub F1(ByRef x As Long) End Sub Sub F2(x As Integer, ParamArray y As Byte()) End Sub Sub F2(x As SByte, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30518: Overload resolution failed because no accessible 'F1' can be called with these arguments: 'Public Sub F1(x As Byte)': Option Strict On disallows implicit conversions from 'Integer' to 'Byte'. 'Public Sub F1(x As SByte)': Option Strict On disallows implicit conversions from 'Integer' to 'SByte'. 'Public Sub F1(ByRef x As Long)': Option Strict On disallows narrowing from type 'Long' to type 'Integer' in copying the value of 'ByRef' parameter 'x' back to the matching argument. F1(i) ~~ BC30518: Overload resolution failed because no accessible 'F2' can be called with these arguments: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Option Strict On disallows implicit conversions from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Option Strict On disallows implicit conversions from 'Integer' to 'SByte'. F2(i, i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(1, 1) ~~ </expected>) End Sub <Fact> Public Sub Diagnostics5() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Imports System.Console Module Module1 Sub Main() Dim i As Integer = 0 F1(i) F2(i, i) F2(1, 1) End Sub Sub F1(x As Byte) End Sub Sub F1(x As SByte) End Sub Sub F1(ByRef x As Long) End Sub Sub F2(x As Integer, ParamArray y As Byte()) End Sub Sub F2(x As SByte, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Custom)) Assert.Equal(OptionStrict.Custom, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30519: Overload resolution failed because no accessible 'F1' can be called without a narrowing conversion: 'Public Sub F1(x As Byte)': Argument matching parameter 'x' narrows from 'Integer' to 'Byte'. 'Public Sub F1(x As SByte)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. 'Public Sub F1(ByRef x As Long)': Copying the value of 'ByRef' parameter 'x' back to the matching argument narrows from type 'Long' to type 'Integer'. F1(i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(i, i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(1, 1) ~~ </expected>) End Sub <Fact(), WorkItem(527622, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527622")> Public Sub NoisyDiagnostics() Dim compilationDef = <compilation> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() F4(y:=Nothing,) End Sub Sub F4(x As Integer, y As Integer()) End Sub End Module Class C Private Sub M() Dim x As String = F(:'BIND:"F(" End Sub Private Function F(arg As Integer) As String Return "Hello" End Function Private Function F(arg As String) As String Return "Goodbye" End Function End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, parseOptions:=TestOptions.Regular.WithLanguageVersion(LanguageVersion.VisualBasic15_3)) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC37302: Named argument 'y' is used out-of-position but is followed by an unnamed argument F4(y:=Nothing,) ~ BC30241: Named argument expected. Please use language version 15.5 or greater to use non-trailing named arguments. F4(y:=Nothing,) ~ BC30198: ')' expected. Dim x As String = F(:'BIND:"F(" ~ BC30201: Expression expected. Dim x As String = F(:'BIND:"F(" ~ </expected>) End Sub <Fact> Public Sub Bug4263() Dim compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Option Strict Off Module M Sub Main() Dim x As String Dim y As Object = Nothing x = Goo(y).ToLower() x = Goo((y)).ToLower() End Sub Sub Goo(ByVal x As String) End Sub Function Goo(ByVal ParamArray x As String()) As String return Nothing End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30491: Expression does not produce a value. x = Goo(y).ToLower() ~~~~~~ BC30491: Expression does not produce a value. x = Goo((y)).ToLower() ~~~~~~~~ </expected>) compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Option Strict Off Imports System Module M Sub Main() Dim x As String x = Goo(CObj(Nothing)).ToLower() x = Goo(CObj((Nothing))).ToLower() x = Goo(CType(Nothing, Object)).ToLower() x = Goo(DirectCast(Nothing, Object)).ToLower() x = Goo(TryCast(Nothing, Object)).ToLower() x = Goo(CType(CStr(Nothing), Object)).ToLower() x = Goo(CType(CType(Nothing, ValueType), Object)).ToLower() x = Goo(CType(CType(CType(Nothing, Derived()), Base()), Object)).ToLower() x = Goo(CType(CType(CType(Nothing, Derived), Derived), Object)).ToLower() x = Goo(CType(Nothing, String())).ToLower() End Sub Sub Goo(ByVal x As String) End Sub Function Goo(ByVal ParamArray x As String()) As String System.Console.WriteLine("Function") Return "" End Function End Module Class Base End Class Class Derived Inherits Base End Class </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation, <![CDATA[ Function Function Function Function Function Function Function Function Function Function ]]>) compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Imports System Module M Sub Main() Goo(CObj(Nothing)) End Sub Sub Goo(ByVal x As String) End Sub Function Goo(ByVal ParamArray x As String()) As String System.Console.WriteLine("Function") Return "" End Function End Module </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOptionStrict(OptionStrict.On)) Assert.Equal(OptionStrict.On, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30518: Overload resolution failed because no accessible 'Goo' can be called with these arguments: 'Public Sub Goo(x As String)': Option Strict On disallows implicit conversions from 'Object' to 'String'. 'Public Function Goo(ParamArray x As String()) As String': Option Strict On disallows implicit conversions from 'Object' to 'String()'. Goo(CObj(Nothing)) ~~~ </expected>) compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOptionStrict(OptionStrict.Custom)) Assert.Equal(OptionStrict.Custom, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC42016: Implicit conversion from 'Object' to 'String()'. Goo(CObj(Nothing)) ~~~~~~~~~~~~~ </expected>) compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Imports System Module M Sub Main() Dim x As String = (CObj(Nothing)) End Sub End Module </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOptionStrict(OptionStrict.On)) Assert.Equal(OptionStrict.On, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30512: Option Strict On disallows implicit conversions from 'Object' to 'String'. Dim x As String = (CObj(Nothing)) ~~~~~~~~~~~~~~~ </expected>) End Sub <WorkItem(539850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539850")> <Fact> Public Sub TestConversionFromZeroLiteralToEnum() Dim compilationDef = <compilation name="TestConversionFromZeroLiteralToEnum"> <file name="Program.vb"> Imports System Module Program Sub Main() Console.WriteLine(Goo(0).ToLower()) End Sub Sub Goo(x As DayOfWeek) End Sub Function Goo(x As Object) As String Return "ABC" End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) CompileAndVerify(compilation, expectedOutput:="abc") compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="abc") End Sub <WorkItem(528006, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528006")> <Fact()> Public Sub TestConversionFromZeroLiteralToNullableEnum() Dim compilationDef = <compilation name="TestConversionFromZeroLiteralToNullableEnum"> <file name="Program.vb"> Option Strict On Imports System Module Program Sub Main() Console.WriteLine(Goo(0).ToLower()) End Sub Function Goo(x As DayOfWeek?) As String Return "ABC" End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) CompileAndVerify(compilation, expectedOutput:="abc") End Sub <WorkItem(528011, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528011")> <Fact()> Public Sub TestInvocationWithNamedArgumentInLambda() Dim compilationDef = <compilation name="TestInvocationWithNamedArgumentInLambda"> <file name="Program.vb"> Imports System Class B Sub Goo(x As Integer, ParamArray z As Integer()) System.Console.WriteLine("B.Goo") End Sub End Class Class C Inherits B Overloads Sub Goo(y As Integer) System.Console.WriteLine("C.Goo") End Sub End Class Module M Sub Main() Dim p as New C() p.Goo(x:=1) ' This fails to compile in Dev10, but works in Roslyn End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) CompileAndVerify(compilation, expectedOutput:="B.Goo") compilationDef = <compilation name="TestInvocationWithNamedArgumentInLambda"> <file name="Program.vb"> Imports System Class B Sub Goo(x As Integer, ParamArray z As Integer()) End Sub End Class Class C Inherits B Overloads Sub Goo(y As Integer) End Sub End Class Class D Overloads Sub Goo(x As Integer) End Sub End Class Module M Sub Main() Console.WriteLine(Bar(Sub(p) p.Goo(x:=1)).ToLower()) End Sub Sub Bar(a As Action(Of C)) End Sub Function Bar(a As Action(Of D)) As String Return "ABC" End Function End Module </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) compilation.AssertTheseDiagnostics(<![CDATA[ BC30521: Overload resolution failed because no accessible 'Bar' is most specific for these arguments: 'Public Sub Bar(a As Action(Of C))': Not most specific. 'Public Function Bar(a As Action(Of D)) As String': Not most specific. Console.WriteLine(Bar(Sub(p) p.Goo(x:=1)).ToLower()) ~~~]]>) compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) compilation.AssertTheseDiagnostics(<![CDATA[ BC30521: Overload resolution failed because no accessible 'Bar' is most specific for these arguments: 'Public Sub Bar(a As Action(Of C))': Not most specific. 'Public Function Bar(a As Action(Of D)) As String': Not most specific. Console.WriteLine(Bar(Sub(p) p.Goo(x:=1)).ToLower()) ~~~]]>) End Sub <WorkItem(539994, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539994")> <Fact> Public Sub MethodTypeParameterInferenceBadArg() ' Method type parameter inference should complete in the case where ' the type of a method argument is ErrorType but HasErrors=False. Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40( <compilation> <file name="a.vb"> Class C Sub M(Of T)(x As T, y As T) End Sub Sub N() Dim d As D = GetD() M("", d.F) End Sub End Class </file> </compilation>) Dim diagnostics = compilation.GetDiagnostics().ToArray() ' The actual errors are not as important as ensuring compilation completes. ' (Just returning successfully from GetDiagnostics() is sufficient in this case.) Dim anyErrors = diagnostics.Length > 0 Assert.True(anyErrors) End Sub <Fact()> Public Sub InaccessibleMethods() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Imports System Module Module2 Private Sub M1(x as Integer) End Sub Private Sub M1(x as Long) End Sub Private Sub M2(x as Integer) End Sub Private Sub M2(x as Long, y as Integer) End Sub End Module Module Module1 Sub Main() M1(1) 'BIND1:"M1(1)" M1(1, 2) 'BIND2:"M1(1, 2)" M2(1, 2) 'BIND3:"M2(1, 2)" End Sub End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30390: 'Module2.Private Sub M1(x As Integer)' is not accessible in this context because it is 'Private'. M1(1) 'BIND1:"M1(1)" ~~ BC30517: Overload resolution failed because no 'M1' is accessible. M1(1, 2) 'BIND2:"M1(1, 2)" ~~ BC30390: 'Module2.Private Sub M2(x As Long, y As Integer)' is not accessible in this context because it is 'Private'. M2(1, 2) 'BIND3:"M2(1, 2)" ~~ </expected>) Dim tree As SyntaxTree = (From t In compilation.SyntaxTrees Where t.FilePath = "a.vb").Single() Dim semanticModel = compilation.GetSemanticModel(tree) If True Then Dim node1 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 1) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node1) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub Module2.M1(x As System.Int32)", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If If True Then Dim node2 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 2) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node2) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(2, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub Module2.M1(x As System.Int32)", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) Assert.Equal("Sub Module2.M1(x As System.Int64)", symbolInfo.CandidateSymbols(1).ToTestDisplayString()) End If If True Then Dim node3 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 3) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node3) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub Module2.M2(x As System.Int64, y As System.Int32)", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If End Sub <Fact()> Public Sub InaccessibleProperties() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Imports System Module Module2 Private Property P1(x as Integer) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property Private Property P1(x as Long) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property Private Property P2(x as Integer) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property Private Property P2(x as Long, y as Integer) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property End Module Module Module1 Sub Main() P1(1)=1 'BIND1:"P1(1)" P1(1, 2)=1 'BIND2:"P1(1, 2)" P2(1, 2)=1 'BIND3:"P2(1, 2)" Dim x = P2(1) End Sub End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30389: 'Module2.P1(x As Integer)' is not accessible in this context because it is 'Private'. P1(1)=1 'BIND1:"P1(1)" ~~ BC30517: Overload resolution failed because no 'P1' is accessible. P1(1, 2)=1 'BIND2:"P1(1, 2)" ~~ BC30389: 'Module2.P2(x As Long, y As Integer)' is not accessible in this context because it is 'Private'. P2(1, 2)=1 'BIND3:"P2(1, 2)" ~~ BC30389: 'Module2.P2(x As Integer)' is not accessible in this context because it is 'Private'. Dim x = P2(1) ~~ </expected>) Dim tree As SyntaxTree = (From t In compilation.SyntaxTrees Where t.FilePath = "a.vb").Single() Dim semanticModel = compilation.GetSemanticModel(tree) If True Then Dim node1 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 1) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node1) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Property Module2.P1(x As System.Int32) As System.Int32", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If If True Then Dim node2 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 2) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node2) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(2, symbolInfo.CandidateSymbols.Length) Assert.Equal("Property Module2.P1(x As System.Int32) As System.Int32", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) Assert.Equal("Property Module2.P1(x As System.Int64) As System.Int32", symbolInfo.CandidateSymbols(1).ToTestDisplayString()) End If If True Then Dim node3 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 3) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node3) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Property Module2.P2(x As System.Int64, y As System.Int32) As System.Int32", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If End Sub <Fact, WorkItem(545574, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545574")> Public Sub OverloadWithIntermediateDifferentMember1() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Class A Shared Sub Goo(x As Integer) End Sub End Class Class B Inherits A Shadows Property Goo As Integer End Class Class C Inherits B Overloads Shared Function Goo(x As Object) As Object Return Nothing End Function Shared Sub Bar() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC40004: function 'Goo' conflicts with property 'Goo' in the base class 'B' and should be declared 'Shadows'. Overloads Shared Function Goo(x As Object) As Object ~~~ </expected>) End Sub <Fact, WorkItem(545574, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545574")> Public Sub OverloadWithIntermediateDifferentMember2() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Class A Shared Sub Goo(x As Integer) End Sub End Class Class B Inherits A Overloads Property Goo As Integer End Class Class C Inherits B Overloads Shared Function Goo(x As Object) As Object Return Nothing End Function Shared Sub Bar() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC40004: property 'Goo' conflicts with sub 'Goo' in the base class 'A' and should be declared 'Shadows'. Overloads Property Goo As Integer ~~~ BC40004: function 'Goo' conflicts with property 'Goo' in the base class 'B' and should be declared 'Shadows'. Overloads Shared Function Goo(x As Object) As Object ~~~ </expected>) End Sub <Fact, WorkItem(545574, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545574")> Public Sub OverloadWithIntermediateDifferentMember3() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Interface A Sub Goo(x As Integer) End Interface Interface B Inherits A Shadows Property Goo As Integer End Interface Interface C Inherits B Overloads Function Goo(x As Object) As Object End Interface Class D Shared Sub Bar() Dim q As C = Nothing q.Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC40004: function 'Goo' conflicts with property 'Goo' in the base interface 'B' and should be declared 'Shadows'. Overloads Function Goo(x As Object) As Object ~~~ </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Class A Shared Function Goo() As Integer() Return Nothing End Function End Class Class B Inherits A Overloads Shared Sub Goo() End Sub Sub Main() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32016: 'Public Shared Overloads Sub Goo()' has no parameters and its return type cannot be indexed. Goo(1).ToString() ~~~ </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub2() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Class A Shared Function Goo() As Integer() Return Nothing End Function End Class Class B Inherits A Overloads Shared Sub Goo(optional a as integer = 3) End Sub Sub Main() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32016: 'Public Shared Overloads Sub Goo([a As Integer = 3])' has no parameters and its return type cannot be indexed. Goo(1).ToString() ~~~ BC30491: Expression does not produce a value. Goo(1).ToString() ~~~~~~ </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub3() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Class A Shared Function Goo() As Integer() Return Nothing End Function End Class Class B Inherits A Overloads Shared Sub Goo(ParamArray a as Integer()) End Sub Sub Main() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub4() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Interface A Function Goo() As Integer() End Interface Interface B Sub Goo() End Interface Interface C Inherits A, B End Interface Module M1 Sub Main() Dim c As C = Nothing c.Goo(1).ToString() End Sub End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30516: Overload resolution failed because no accessible 'Goo' accepts this number of arguments. c.Goo(1).ToString() ~~~ </expected>) End Sub <Fact, WorkItem(546129, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546129")> Public Sub SameMethodNameDifferentCase() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Module Test Sub Main() Dim a = New class1 Dim O As Object = 5 a.Bb(O) End Sub Friend Class class1 Public Overridable Sub Bb(ByRef y As String) End Sub Public Overridable Sub BB(ByRef y As Short) End Sub End Class End Module ]]></file> </compilation>) compilation.VerifyDiagnostics() End Sub <WorkItem(544657, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544657")> <Fact()> Public Sub Regress14728() Dim compilationDef = <compilation name="Regress14728"> <file name="Program.vb"> Option Strict Off Module Module1 Sub Main() Dim o As New class1 o.CallLateBound("qq", "aa") End Sub Class class1 Private Shared CurrentCycle As Integer Sub CallLateBound(ByVal ParamArray prmarray1() As Object) LateBound(prmarray1.GetUpperBound(0), prmarray1) End Sub Sub LateBound(ByVal ScenDesc As String, ByVal ParamArray prm1() As Object) System.Console.WriteLine(ScenDesc + prm1(0)) End Sub End Class End Module </file> </compilation> Dim Compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(Compilation, expectedOutput:="1qq") End Sub <Fact(), WorkItem(544657, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544657")> Public Sub Regress14728Err() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Option Strict Off Module Module1 Sub Main() Dim o As New class1 o.CallLateBound("qq", "aa") End Sub Class class1 Private Shared CurrentCycle As Integer Sub CallLateBound(ByVal ParamArray prmarray1() As Object) LateBound(prmarray1.GetUpperBound(0), prmarray1) End Sub Sub LateBound(ByVal ScenDesc As String, ByVal ParamArray prm1() As Object) System.Console.WriteLine(ScenDesc + prm1(0)) End Sub Sub LateBound() System.Console.WriteLine("hi") End Sub End Class End Module ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="1qq") End Sub <Fact, WorkItem(546747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546747")> Public Sub Bug16716_1() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ <ProvideMenuResource(1000, 1)> Public NotInheritable Class TNuggetPackage Sub Test() Dim z As New ProvideMenuResourceAttribute(1000, 1) End Sub End Class Public Class ProvideMenuResourceAttribute Inherits System.Attribute Public Sub New(x As Short, y As Integer) End Sub Public Sub New(x As String, y As Integer) End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30519: Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: 'Public Sub New(x As Short, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'Short'. 'Public Sub New(x As String, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'String'. Dim z As New ProvideMenuResourceAttribute(1000, 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </expected>) Dim TNuggetPackage = compilation.GetTypeByMetadataName("TNuggetPackage") Assert.Equal("Sub ProvideMenuResourceAttribute..ctor(x As System.Int16, y As System.Int32)", TNuggetPackage.GetAttributes()(0).AttributeConstructor.ToTestDisplayString()) End Sub <Fact, WorkItem(546747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546747")> Public Sub Bug16716_2() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ <ProvideMenuResource(1000, 1)> Public NotInheritable Class TNuggetPackage End Class Public Class ProvideMenuResourceAttribute Inherits System.Attribute Public Sub New(x As Short, y As String) End Sub Public Sub New(x As String, y As Short) End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30519: Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: 'Public Sub New(x As Short, y As String)': Argument matching parameter 'x' narrows from 'Integer' to 'Short'. 'Public Sub New(x As Short, y As String)': Argument matching parameter 'y' narrows from 'Integer' to 'String'. 'Public Sub New(x As String, y As Short)': Argument matching parameter 'x' narrows from 'Integer' to 'String'. 'Public Sub New(x As String, y As Short)': Argument matching parameter 'y' narrows from 'Integer' to 'Short'. <ProvideMenuResource(1000, 1)> ~~~~~~~~~~~~~~~~~~~ ]]></expected>) End Sub <Fact, WorkItem(546747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546747")> Public Sub Bug16716_3() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ <ProvideMenuResource(1000, 1)> Public NotInheritable Class TNuggetPackage End Class Public Class ProvideMenuResourceAttribute Inherits System.Attribute Public Sub New(x As String, y As Short) End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30934: Conversion from 'Integer' to 'String' cannot occur in a constant expression used as an argument to an attribute. <ProvideMenuResource(1000, 1)> ~~~~ ]]></expected>) End Sub <Fact, WorkItem(546875, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546875"), WorkItem(530930, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530930")> Public Sub BigVisitor() Dim source = <compilation> <file name="a.vb"> Public Module Test Sub Main() Dim visitor As New ConcreteVisitor() visitor.Visit(New Class090()) End Sub End Module </file> </compilation> Dim libRef = TestReferences.SymbolsTests.BigVisitor Dim start = DateTime.UtcNow CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source, {libRef}).VerifyDiagnostics() Dim elapsed = DateTime.UtcNow - start Assert.InRange(elapsed.TotalSeconds, 0, 5) ' The key is seconds - not minutes - so feel free to loosen. End Sub <Fact> Public Sub CompareSymbolsOriginalDefinition() Dim source = <compilation> <file name="a.vb"> <![CDATA[ Imports System.Runtime.CompilerServices <Assembly: InternalsVisibleTo("Goo")> Public Class Test(Of t1, t2) Public Sub Add(x As t1) End Sub Friend Sub Add(x As t2) End Sub End Class ]]> </file> </compilation> Dim source2 = <compilation name="Goo"> <file name="b.vb"> Public Class Test2 Public Sub Main() Dim x = New Test(Of Integer, Integer)() x.Add(5) End Sub End Class </file> </compilation> Dim comp = CreateCompilationWithMscorlib40(source, options:=TestOptions.ReleaseDll) Dim comp2 = CreateCompilationWithMscorlib40(source2, references:={comp.EmitToImageReference()}) CompilationUtils.AssertTheseDiagnostics(comp2, <expected> BC30521: Overload resolution failed because no accessible 'Add' is most specific for these arguments: 'Public Sub Add(x As Integer)': Not most specific. 'Friend Sub Add(x As Integer)': Not most specific. x.Add(5) ~~~ </expected>) End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688_1() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System Module Module1 Class C0Base Overloads Shared Widening Operator CType(x As C0Base) As NullReferenceException System.Console.Write("CType1") Return Nothing End Operator End Class Class C0 Inherits C0Base Overloads Shared Widening Operator CType(x As C0) As NullReferenceException System.Console.Write("CType2") Return Nothing End Operator End Class Class C1Base Overloads Shared Widening Operator CType(x As C1Base) As NullReferenceException() System.Console.Write("CType3") Return Nothing End Operator End Class Class C1 Inherits C1Base Overloads Shared Widening Operator CType(x As C1) As NullReferenceException() System.Console.Write("CType4") Return Nothing End Operator End Class Sub Main() Dim x1 As Exception = New C0 Dim x2 As Exception() = New C1 End Sub End Module ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="CType2CType4") End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688_2() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System Module Module1 Sub Main() C2.goo(New C2) End Sub Class C2 Public Shared Widening Operator CType(x As C2) As C2() Return New C2() {} End Operator Public Shared Sub goo(x As String) End Sub Public Shared Sub goo(ParamArray y As C2()) Console.WriteLine(y.Length) End Sub End Class End Module ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="1") End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688Err() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System.Collections Module Module1 Sub Main() cls2.Goo("qq", New cls2) End Sub End Module Interface IGetExpression End Interface Interface IExpression Inherits IGetExpression End Interface Class cls0 Implements IExpression End Class Class cls1 Implements IExpression Public Shared Widening Operator CType(x As cls1) As IExpression() System.Console.WriteLine("CType") Return Nothing End Operator End Class Class cls2 Inherits cls1 Public Shared Function Goo(x As String) As String Return x End Function Public Shared Function Goo(x As String, ByVal ParamArray params() As IGetExpression) As String System.Console.WriteLine("Goo") Return Nothing End Function End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30521: Overload resolution failed because no accessible 'Goo' is most specific for these arguments: 'Public Shared Function Goo(x As String, ParamArray params As IGetExpression()) As String': Not most specific. cls2.Goo("qq", New cls2) ~~~ ]]></expected>) End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688Err01() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System Module Module1 Sub Main() C2.goo(New C2) End Sub Interface i1 End Interface Class C2 Implements i1 Public Shared Widening Operator CType(x As C2) As i1() Return New C2() {} End Operator ' uncommenting this will change results in VBC ' Public Shared Sub goo(x as string) ' End Sub Public Shared Sub goo(ParamArray y As i1()) Console.WriteLine(y.Length) End Sub End Class End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30521: Overload resolution failed because no accessible 'goo' is most specific for these arguments: 'Public Shared Sub goo(ParamArray y As Module1.i1())': Not most specific. C2.goo(New C2) ~~~ ]]></expected>) End Sub <Fact(), WorkItem(32, "https://roslyn.codeplex.com/workitem/31")> Public Sub BugCodePlex_32() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() Dim b As New B() b.Test(Function() 1) End Sub End Module Class A Sub Test(x As System.Func(Of Integer)) System.Console.WriteLine("A.Test") End Sub End Class Class B Inherits A Overloads Sub Test(Of T)(x As System.Linq.Expressions.Expression(Of System.Func(Of T))) System.Console.WriteLine("B.Test") End Sub End Class ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(compilationDef, {SystemCoreRef}, TestOptions.ReleaseExe) CompileAndVerify(compilation, expectedOutput:="A.Test") End Sub <Fact(), WorkItem(918579, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/918579"), WorkItem(34, "CodePlex")> Public Sub Bug918579_01() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() Dim p As IDerived = New CTest() Dim x = p.X End Sub End Module Public Interface IBase1 ReadOnly Property X As Integer End Interface Public Interface IBase2 ReadOnly Property X As Integer End Interface Public Interface IDerived Inherits IBase1, IBase2 Overloads ReadOnly Property X As Integer End Interface Class CTest Implements IDerived Public ReadOnly Property IDerived_X As Integer Implements IDerived.X Get System.Console.WriteLine("IDerived_X") Return 0 End Get End Property Private ReadOnly Property IBase1_X As Integer Implements IBase1.X Get System.Console.WriteLine("IBase1_X") Return 0 End Get End Property Private ReadOnly Property IBase2_X As Integer Implements IBase2.X Get System.Console.WriteLine("IBase2_X") Return 0 End Get End Property End Class ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation, expectedOutput:="IDerived_X") End Sub <Fact(), WorkItem(918579, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/918579"), WorkItem(34, "CodePlex")> Public Sub Bug918579_02() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() Dim p As IDerived = New CTest() Dim x = p.X(CInt(0)) x = p.X(CShort(0)) x = p.X(CLng(0)) End Sub End Module Public Interface IBase1 ReadOnly Property X(y As Integer) As Integer End Interface Public Interface IBase2 ReadOnly Property X(y As Short) As Integer End Interface Public Interface IDerived Inherits IBase1, IBase2 Overloads ReadOnly Property X(y As Long) As Integer End Interface Class CTest Implements IDerived Public ReadOnly Property IDerived_X(y As Long) As Integer Implements IDerived.X Get System.Console.WriteLine("IDerived_X") Return 0 End Get End Property Private ReadOnly Property IBase1_X(y As Integer) As Integer Implements IBase1.X Get System.Console.WriteLine("IBase1_X") Return 0 End Get End Property Private ReadOnly Property IBase2_X(y As Short) As Integer Implements IBase2.X Get System.Console.WriteLine("IBase2_X") Return 0 End Get End Property End Class ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation, expectedOutput:= "IBase1_X IBase2_X IDerived_X") End Sub <Fact(), WorkItem(918579, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/918579"), WorkItem(34, "CodePlex")> Public Sub Bug918579_03() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() End Sub Sub Test(x as I3) x.M1() End Sub Sub Test(x as I4) x.M1() End Sub End Module Interface I1(Of T) Sub M1() End Interface Interface I2 Inherits I1(Of String) Shadows Sub M1(x as Integer) End Interface Interface I3 Inherits I2, I1(Of Integer) End Interface Interface I4 Inherits I1(Of Integer), I2 End Interface ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation) End Sub <Fact, WorkItem(1034429, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1034429")> Public Sub Bug1034429() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Imports System Imports System.Security.Permissions Public Class A Inherits Attribute Public Sub New(ByVal ParamArray p As SecurityAction) End Sub End Class Public Class B Inherits Attribute Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction) End Sub End Class Public Class C Inherits Attribute Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction, ByVal p3 As String) End Sub End Class Module Module1 <A(SecurityAction.Assert)> <B(p2:=SecurityAction.Assert, p1:=0)> <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> Sub Main() End Sub End Module ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30050: ParamArray parameter must be an array. Public Sub New(ByVal ParamArray p As SecurityAction) ~ BC30050: ParamArray parameter must be an array. Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction) ~~ BC30050: ParamArray parameter must be an array. Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction, ByVal p3 As String) ~~ BC30192: End of parameter list expected. Cannot define parameters after a paramarray parameter. Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction, ByVal p3 As String) ~~~~~~~~~~~~~~~~~~ BC31092: ParamArray parameters must have an array type. <A(SecurityAction.Assert)> ~ BC30455: Argument not specified for parameter 'p1' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction)'. <B(p2:=SecurityAction.Assert, p1:=0)> ~ BC31092: ParamArray parameters must have an array type. <B(p2:=SecurityAction.Assert, p1:=0)> ~ BC30661: Field or property 'p2' is not found. <B(p2:=SecurityAction.Assert, p1:=0)> ~~ BC30661: Field or property 'p1' is not found. <B(p2:=SecurityAction.Assert, p1:=0)> ~~ BC30455: Argument not specified for parameter 'p1' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction, p3 As String)'. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~ BC30455: Argument not specified for parameter 'p2' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction, p3 As String)'. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~ BC30455: Argument not specified for parameter 'p3' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction, p3 As String)'. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~ BC30661: Field or property 'p3' is not found. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~~ BC30661: Field or property 'p2' is not found. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~~ BC30661: Field or property 'p1' is not found. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~~ ]]></expected>) End Sub <Fact, WorkItem(2604, "https://github.com/dotnet/roslyn/issues/2604")> Public Sub FailureDueToAnErrorInALambda_01() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() M0(0, Function() doesntexist) M1(0, Function() doesntexist) M2(0, Function() doesntexist) End Sub Sub M0(x As Integer, y As System.Func(Of Integer)) End Sub Sub M1(x As Integer, y As System.Func(Of Integer)) End Sub Sub M1(x As Long, y As System.Func(Of Long)) End Sub Sub M2(x As Integer, y As System.Func(Of Integer)) End Sub Sub M2(x As c1, y As System.Func(Of Long)) End Sub End Module Class c1 End Class ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30451: 'doesntexist' is not declared. It may be inaccessible due to its protection level. M0(0, Function() doesntexist) ~~~~~~~~~~~ BC30451: 'doesntexist' is not declared. It may be inaccessible due to its protection level. M1(0, Function() doesntexist) ~~~~~~~~~~~ BC30451: 'doesntexist' is not declared. It may be inaccessible due to its protection level. M2(0, Function() doesntexist) ~~~~~~~~~~~ ]]></expected>) End Sub <Fact, WorkItem(4587, "https://github.com/dotnet/roslyn/issues/4587")> Public Sub FailureDueToAnErrorInALambda_02() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Threading.Tasks Imports System.Linq Module Module1 Sub Main() End Sub Private Async Function GetDataAsync(cs As Characters, imax As Integer) As Task Dim Roles = Await cs.GetRoleAsync() Dim RoleTasks = Roles.Select( Async Function(role As Role) As Task Dim Lines = Await role.GetLines() If imax <= LinesKey Then Return Dim SentenceTasks = Lines.Select( Async Function(Sentence) As Task Dim Words = Await Sentence.GetWordsAsync() If imax <= WordsKey Then Return Dim WordTasks = Words.Select( Async Function(Word) As Task Dim Letters = Await Word.GetLettersAsync() If imax <= LettersKey Then Return Dim StrokeTasks = Letters.Select( Async Function(Stroke) As Task Dim endpoints = Await Stroke.GetEndpointsAsync() Await Task.WhenAll(endpoints.ToArray()) End Function) Await Task.WhenAll(StrokeTasks.ToArray()) End Function) Await Task.WhenAll(WordTasks.ToArray()) End Function) Await Task.WhenAll(SentenceTasks.ToArray()) End Function) End Function Function RetryAsync(Of T)(f As Func(Of Task(Of T))) As Task(Of T) Return f() End Function End Module Friend Class Characters Function GetRoleAsync() As Task(Of List(Of Role)) Return Nothing End Function End Class Class Role Function GetLines() As Task(Of List(Of Line)) Return Nothing End Function End Class Public Class Line End Class ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib45AndVBRuntime(compilationDef, references:={SystemCoreRef}, options:=TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30451: 'LinesKey' is not declared. It may be inaccessible due to its protection level. If imax <= LinesKey Then Return ~~~~~~~~ BC30456: 'GetWordsAsync' is not a member of 'Line'. Dim Words = Await Sentence.GetWordsAsync() ~~~~~~~~~~~~~~~~~~~~~~ BC30451: 'WordsKey' is not declared. It may be inaccessible due to its protection level. If imax <= WordsKey Then Return ~~~~~~~~ ]]></expected>) End Sub <Fact, WorkItem(4587, "https://github.com/dotnet/roslyn/issues/4587")> Public Sub FailureDueToAnErrorInALambda_03() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Threading.Tasks Imports System.Linq Module Module1 Sub Main() End Sub Private Async Function GetDataAsync(DeliveryWindow As DeliveryWindow, MaxDepth As Integer) As Task Dim Vendors = Await RetryAsync(Function() DeliveryWindow.GetVendorsAsync()) Dim VendorTasks = Vendors.Select(Async Function(vendor As DeliveryWindowVendor) As Task Dim Departments = Await RetryAsync(Async Function() Await vendor.GetDeliveryWindowDepartmentsAsync()) If MaxDepth <= DepartmentsKey Then Return End If Dim DepartmentTasks = Departments.Select(Async Function(Department) As Task Dim Vendor9s = Await RetryAsync(Async Function() Await Department.GetDeliveryWindowVendor9Async()) If MaxDepth <= Vendor9Key Then Return End If Dim Vendor9Tasks = Vendor9s.Select(Async Function(Vendor9) As Task Dim poTypes = Await RetryAsync(Async Function() Await Vendor9.GetDeliveryWindowPOTypesAsync()) If MaxDepth <= POTypesKey Then Return End If Dim POTypeTasks = poTypes.Select(Async Function(poType) As Task Dim pos = Await RetryAsync(Async Function() Await poType.GetDeliveryWindowPOAsync()) If MaxDepth <= POsKey Then Return End If Dim POTasks = pos.ToList() _ .Select(Async Function(po) As Task Await RetryAsync(Async Function() Await po.GetDeliveryWindowPOLineAsync()) End Function) _ .ToArray() Await Task.WhenAll(POTasks.ToArray()) End Function) Await Task.WhenAll(POTypeTasks.ToArray()) End Function) Await Task.WhenAll(Vendor9Tasks.ToArray()) End Function) Await Task.WhenAll(DepartmentTasks.ToArray()) End Function) Await Task.WhenAll(VendorTasks.ToArray()) End Function Function RetryAsync(Of T)(f As Func(Of Task(Of T))) As Task(Of T) Return f() End Function End Module Friend Class DeliveryWindow Function GetVendorsAsync() As Task(Of List(Of DeliveryWindowVendor)) Return Nothing End Function End Class Class DeliveryWindowVendor Function GetDeliveryWindowDepartmentsAsync() As Task(Of List(Of DeliveryWindowDepartments)) Return Nothing End Function End Class Public Class DeliveryWindowDepartments End Class ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib45AndVBRuntime(compilationDef, references:={SystemCoreRef}, options:=TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30451: 'DepartmentsKey' is not declared. It may be inaccessible due to its protection level. If MaxDepth <= DepartmentsKey Then ~~~~~~~~~~~~~~ BC30456: 'GetDeliveryWindowVendor9Async' is not a member of 'DeliveryWindowDepartments'. Dim Vendor9s = Await RetryAsync(Async Function() Await Department.GetDeliveryWindowVendor9Async()) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC30451: 'Vendor9Key' is not declared. It may be inaccessible due to its protection level. If MaxDepth <= Vendor9Key Then ~~~~~~~~~~ ]]></expected>) End Sub <WorkItem(9341, "https://github.com/dotnet/roslyn/issues/9341")> <Fact()> Public Sub FailureDueToAnErrorInALambda_04() Dim compilationDef = <compilation> <file name="a.vb"> Imports System Module Test Sub Main() Invoke( Sub() M1("error here") End Sub) End Sub Sub M1() End Sub Public Sub Invoke(callback As Action) End Sub Function Invoke(Of TResult)(callback As Func(Of TResult)) As TResult Return Nothing End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30057: Too many arguments to 'Public Sub M1()'. M1("error here") ~~~~~~~~~~~~ </expected>) End Sub <Fact> <WorkItem(16478, "https://github.com/dotnet/roslyn/issues/16478")> Public Sub AmbiguousInference_01() Dim compilationDef = <compilation> <file name="a.vb"> Imports System Imports System.Collections.Generic Public Class Test Public Shared Sub Assert(Of T)(a As T, b As T) Console.WriteLine("Non collection") End Sub Public Shared Sub Assert(Of T)(a As IEnumerable(Of T), b As IEnumerable(Of T)) Console.WriteLine("Collection") End Sub Public Shared Sub Main() Dim a = {"A"} Dim b = New StringValues() Assert(a, b) Assert(b, a) End Sub Private Class StringValues Inherits List(Of String) Public Shared Widening Operator CType(values As String()) As StringValues Return New StringValues() End Operator Public Shared Widening Operator CType(value As StringValues) As String() Return {} End Operator End Class End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompileAndVerify(compilationDef, expectedOutput:= "Collection Collection") End Sub <Fact> <WorkItem(16478, "https://github.com/dotnet/roslyn/issues/16478")> Public Sub AmbiguousInference_02() Dim compilationDef = <compilation> <file name="a.vb"> Imports System Imports System.Collections.Generic Public Class Test Public Shared Sub Assert(Of T)(a As T, b As T) Console.WriteLine("Non collection") End Sub Public Shared Sub Main() Dim a = {"A"} Dim b = New StringValues() Assert(a, b) Assert(b, a) End Sub Private Class StringValues Inherits List(Of String) Public Shared Widening Operator CType(values As String()) As StringValues Return New StringValues() End Operator Public Shared Widening Operator CType(value As StringValues) As String() Return {} End Operator End Class End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC36651: Data type(s) of the type parameter(s) in method 'Public Shared Sub Assert(Of T)(a As T, b As T)' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error. Assert(a, b) ~~~~~~ BC36651: Data type(s) of the type parameter(s) in method 'Public Shared Sub Assert(Of T)(a As T, b As T)' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error. Assert(b, a) ~~~~~~ </expected>) End Sub End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Collections.Immutable Imports System.IO Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.SpecialType Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic Imports Microsoft.CodeAnalysis.VisualBasic.OverloadResolution Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests.Emit Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics.OverloadResolutionTestHelpers Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Namespace OverloadResolutionTestHelpers Friend Module Extensions Public Function ResolveMethodOverloading( instanceMethods As ImmutableArray(Of MethodSymbol), extensionMethods As ImmutableArray(Of MethodSymbol), typeArguments As ImmutableArray(Of TypeSymbol), arguments As ImmutableArray(Of BoundExpression), argumentNames As ImmutableArray(Of String), binder As Binder, lateBindingIsAllowed As Boolean, Optional includeEliminatedCandidates As Boolean = False ) As OverloadResolution.OverloadResolutionResult Dim methods As ImmutableArray(Of MethodSymbol) If instanceMethods.IsDefaultOrEmpty Then methods = extensionMethods ElseIf extensionMethods.IsDefaultOrEmpty Then methods = instanceMethods Else methods = instanceMethods.Concat(extensionMethods) End If Dim methodGroup = New BoundMethodGroup(VisualBasicSyntaxTree.Dummy.GetRoot(Nothing), If(typeArguments.IsDefaultOrEmpty, Nothing, New BoundTypeArguments(VisualBasicSyntaxTree.Dummy.GetRoot(Nothing), typeArguments)), methods, LookupResultKind.Good, Nothing, QualificationKind.Unqualified) Return OverloadResolution.MethodInvocationOverloadResolution( methodGroup, arguments, argumentNames, binder, includeEliminatedCandidates:=includeEliminatedCandidates, lateBindingIsAllowed:=lateBindingIsAllowed, callerInfoOpt:=Nothing, useSiteInfo:=CompoundUseSiteInfo(Of AssemblySymbol).Discarded) End Function End Module End Namespace Public Class OverloadResolutionTests Inherits BasicTestBase <Fact> Public Sub BasicTests() Dim optionStrictOn = <file> Option Strict On Class OptionStrictOn Shared Sub Context() End Sub End Class </file> Dim optionStrictOff = <file> Option Strict Off Class OptionStrictOff Shared Sub Context() End Sub End Class </file> Dim optionStrictOnTree = VisualBasicSyntaxTree.ParseText(optionStrictOn.Value) Dim optionStrictOffTree = VisualBasicSyntaxTree.ParseText(optionStrictOff.Value) Dim c1 = VisualBasicCompilation.Create("Test1", syntaxTrees:={VisualBasicSyntaxTree.ParseText(SemanticResourceUtil.OverloadResolutionTestSource), optionStrictOnTree, optionStrictOffTree}, references:={MscorlibRef, SystemCoreRef}) Dim sourceModule = DirectCast(c1.Assembly.Modules(0), SourceModuleSymbol) Dim optionStrictOnContext = DirectCast(sourceModule.GlobalNamespace.GetTypeMembers("OptionStrictOn").Single().GetMembers("Context").Single(), SourceMethodSymbol) Dim optionStrictOffContext = DirectCast(sourceModule.GlobalNamespace.GetTypeMembers("OptionStrictOff").Single().GetMembers("Context").Single(), SourceMethodSymbol) Dim optionStrictOnBinder = BinderBuilder.CreateBinderForMethodBody(sourceModule, optionStrictOnTree, optionStrictOnContext) Dim optionStrictOffBinder = BinderBuilder.CreateBinderForMethodBody(sourceModule, optionStrictOffTree, optionStrictOffContext) Dim TestClass1 = c1.Assembly.GlobalNamespace.GetTypeMembers("TestClass1").Single() Dim TestClass1_M1 = TestClass1.GetMembers("M1").OfType(Of MethodSymbol)().Single() Dim TestClass1_M2 = TestClass1.GetMembers("M2").OfType(Of MethodSymbol)().Single() Dim TestClass1_M3 = TestClass1.GetMembers("M3").OfType(Of MethodSymbol)().Single() Dim TestClass1_M4 = TestClass1.GetMembers("M4").OfType(Of MethodSymbol)().Single() Dim TestClass1_M5 = TestClass1.GetMembers("M5").OfType(Of MethodSymbol)().Single() Dim TestClass1_M6 = TestClass1.GetMembers("M6").OfType(Of MethodSymbol)().Single() Dim TestClass1_M7 = TestClass1.GetMembers("M7").OfType(Of MethodSymbol)().Single() Dim TestClass1_M8 = TestClass1.GetMembers("M8").OfType(Of MethodSymbol)().Single() Dim TestClass1_M9 = TestClass1.GetMembers("M9").OfType(Of MethodSymbol)().Single() Dim TestClass1_M10 = TestClass1.GetMembers("M10").OfType(Of MethodSymbol)().Single() Dim TestClass1_M11 = TestClass1.GetMembers("M11").OfType(Of MethodSymbol)().Single() Dim TestClass1_M12 = TestClass1.GetMembers("M12").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M13 = TestClass1.GetMembers("M13").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M14 = TestClass1.GetMembers("M14").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M15 = TestClass1.GetMembers("M15").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M16 = TestClass1.GetMembers("M16").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M17 = TestClass1.GetMembers("M17").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M18 = TestClass1.GetMembers("M18").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M19 = TestClass1.GetMembers("M19").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M20 = TestClass1.GetMembers("M20").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M21 = TestClass1.GetMembers("M21").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M22 = TestClass1.GetMembers("M22").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M23 = TestClass1.GetMembers("M23").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M24 = TestClass1.GetMembers("M24").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M25 = TestClass1.GetMembers("M25").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M26 = TestClass1.GetMembers("M26").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M27 = TestClass1.GetMembers("M27").OfType(Of MethodSymbol)().Single() Dim TestClass1_g = TestClass1.GetMembers("g").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_SM = TestClass1.GetMembers("SM").OfType(Of MethodSymbol)().Single() Dim TestClass1_SM1 = TestClass1.GetMembers("SM1").OfType(Of MethodSymbol)().Single() Dim TestClass1_ShortField = TestClass1.GetMembers("ShortField").OfType(Of FieldSymbol)().Single() Dim TestClass1_DoubleField = TestClass1.GetMembers("DoubleField").OfType(Of FieldSymbol)().Single() Dim TestClass1_ObjectField = TestClass1.GetMembers("ObjectField").OfType(Of FieldSymbol)().Single() Dim base = c1.Assembly.GlobalNamespace.GetTypeMembers("Base").Single() Dim baseExt = c1.Assembly.GlobalNamespace.GetTypeMembers("BaseExt").Single() Dim derived = c1.Assembly.GlobalNamespace.GetTypeMembers("Derived").Single() Dim derivedExt = c1.Assembly.GlobalNamespace.GetTypeMembers("DerivedExt").Single() Dim ext = c1.Assembly.GlobalNamespace.GetTypeMembers("Ext").Single() Dim ext1 = c1.Assembly.GlobalNamespace.GetTypeMembers("Ext1").Single() Dim base_M1 = base.GetMembers("M1").OfType(Of MethodSymbol)().Single() Dim base_M2 = base.GetMembers("M2").OfType(Of MethodSymbol)().Single() Dim base_M3 = base.GetMembers("M3").OfType(Of MethodSymbol)().Single() Dim base_M4 = base.GetMembers("M4").OfType(Of MethodSymbol)().Single() Dim base_M5 = base.GetMembers("M5").OfType(Of MethodSymbol)().Single() Dim base_M6 = base.GetMembers("M6").OfType(Of MethodSymbol)().Single() Dim base_M7 = base.GetMembers("M7").OfType(Of MethodSymbol)().Single() Dim base_M8 = base.GetMembers("M8").OfType(Of MethodSymbol)().Single() Dim base_M9 = base.GetMembers("M9").OfType(Of MethodSymbol)().Single() Dim base_M10 = baseExt.GetMembers("M10").OfType(Of MethodSymbol)().Single() Dim derived_M1 = derived.GetMembers("M1").OfType(Of MethodSymbol)().Single() Dim derived_M2 = derived.GetMembers("M2").OfType(Of MethodSymbol)().Single() Dim derived_M3 = derived.GetMembers("M3").OfType(Of MethodSymbol)().Single() Dim derived_M4 = derived.GetMembers("M4").OfType(Of MethodSymbol)().Single() Dim derived_M5 = derived.GetMembers("M5").OfType(Of MethodSymbol)().Single() Dim derived_M6 = derived.GetMembers("M6").OfType(Of MethodSymbol)().Single() Dim derived_M7 = derived.GetMembers("M7").OfType(Of MethodSymbol)().Single() Dim derived_M8 = derived.GetMembers("M8").OfType(Of MethodSymbol)().Single() Dim derived_M9 = derived.GetMembers("M9").OfType(Of MethodSymbol)().Single() Dim derived_M10 = derivedExt.GetMembers("M10").OfType(Of MethodSymbol)().Single() Dim derived_M11 = derivedExt.GetMembers("M11").OfType(Of MethodSymbol)().Single() Dim derived_M12 = derivedExt.GetMembers("M12").OfType(Of MethodSymbol)().Single() Dim ext_M11 = ext.GetMembers("M11").OfType(Of MethodSymbol)().Single() Dim ext_M12 = ext.GetMembers("M12").OfType(Of MethodSymbol)().Single() Dim ext_M13 = ext.GetMembers("M13").OfType(Of MethodSymbol)().ToArray() Dim ext_M14 = ext.GetMembers("M14").OfType(Of MethodSymbol)().Single() Dim ext_M15 = ext.GetMembers("M15").OfType(Of MethodSymbol)().Single() Dim ext_SM = ext.GetMembers("SM").OfType(Of MethodSymbol)().Single() Dim ext_SM1 = ext.GetMembers("SM1").OfType(Of MethodSymbol)().ToArray() Dim ext1_M14 = ext1.GetMembers("M14").OfType(Of MethodSymbol)().Single() Dim TestClass2 = c1.Assembly.GlobalNamespace.GetTypeMembers("TestClass2").Single() Dim TestClass2OfInteger = TestClass2.Construct(c1.GetSpecialType(System_Int32)) Dim TestClass2OfInteger_S1 = TestClass2OfInteger.GetMembers("S1").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S2 = TestClass2OfInteger.GetMembers("S2").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S3 = TestClass2OfInteger.GetMembers("S3").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S4 = TestClass2OfInteger.GetMembers("S4").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S5 = TestClass2OfInteger.GetMembers("S5").OfType(Of MethodSymbol)().ToArray() Dim TestClass2OfInteger_S6 = TestClass2OfInteger.GetMembers("S6").OfType(Of MethodSymbol)().ToArray() Dim _syntaxNode = optionStrictOffTree.GetVisualBasicRoot(Nothing) Dim [nothing] As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Nothing, Nothing) Dim intZero As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Create(0I), c1.GetSpecialType(System_Int32)) Dim longZero As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Create(0L), c1.GetSpecialType(System_Int64)) Dim unsignedOne As BoundExpression = New BoundLiteral(_syntaxNode, ConstantValue.Create(1UI), c1.GetSpecialType(System_UInt32)) Dim longConst As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(-1L), c1.GetSpecialType(System_Int64), Nothing) Dim intVal As BoundExpression = New BoundUnaryOperator(_syntaxNode, UnaryOperatorKind.Minus, intZero, False, intZero.Type) Dim intArray As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.CreateArrayTypeSymbol(intZero.Type)) Dim TestClass1Val As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, TestClass1) Dim omitted As BoundExpression = New BoundOmittedArgument(_syntaxNode, Nothing) Dim doubleConst As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(0.0R), c1.GetSpecialType(System_Double), Nothing) Dim doubleVal As BoundExpression = New BoundUnaryOperator(_syntaxNode, UnaryOperatorKind.Minus, doubleConst, False, doubleConst.Type) Dim shortVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_Int16)) Dim ushortVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_UInt16)) Dim objectVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_Object)) Dim objectArray As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.CreateArrayTypeSymbol(objectVal.Type)) Dim shortField As BoundExpression = New BoundFieldAccess(_syntaxNode, Nothing, TestClass1_ShortField, True, TestClass1_ShortField.Type) Dim doubleField As BoundExpression = New BoundFieldAccess(_syntaxNode, Nothing, TestClass1_DoubleField, True, TestClass1_DoubleField.Type) Dim objectField As BoundExpression = New BoundFieldAccess(_syntaxNode, Nothing, TestClass1_ObjectField, True, TestClass1_ObjectField.Type) Dim stringVal As BoundExpression = New BoundRValuePlaceholder(_syntaxNode, c1.GetSpecialType(System_String)) Dim result As OverloadResolution.OverloadResolutionResult 'TestClass1.M1() result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={TestClass1_M1}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M1(Of TestClass1)() 'error BC32045: 'Public Shared Sub M1()' has no type parameters and so cannot have type arguments. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={TestClass1_M1}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=(New TypeSymbol() {TestClass1}).AsImmutableOrNull(), arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.BadGenericArity, result.Candidates(0).State) Assert.Same(TestClass1_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M1(Nothing) 'error BC30057: Too many arguments to 'Public Shared Sub M1()'. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M1)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M2() 'error BC32050: Type parameter 'T' for 'Public Shared Sub M2(Of T)()' cannot be inferred. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.TypeInferenceFailed, result.Candidates(0).State) Assert.Same(TestClass1_M2, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M2(Of TestClass1)() result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=(New TypeSymbol() {TestClass1}).AsImmutableOrNull(), arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M2.Construct((New TypeSymbol() {TestClass1}).AsImmutableOrNull()), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M3() result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:=Nothing, argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M3(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Equal(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'TestClass1.M3(intArray) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intArray}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Equal(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M3(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Equal(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Equal(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M4(intVal, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.IsDefault) 'error BC30311: Value of type 'TestClass1' cannot be converted to 'Integer'. 'TestClass1.M4(TestClass1Val, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, TestClass1Val}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30311: Value of type 'Integer' cannot be converted to 'TestClass1'. 'TestClass1.M4(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M4(intVal, y:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={Nothing, "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({0, 1}.AsImmutableOrNull())) 'TestClass1.M4(X:=intVal, y:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"X", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({0, 1}.AsImmutableOrNull())) 'TestClass1.M4(y:=TestClass1Val, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, intVal}.AsImmutableOrNull(), argumentNames:={"y", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({1, 0}.AsImmutableOrNull())) 'error BC30311: Value of type 'Integer' cannot be converted to 'TestClass1'. 'TestClass1.M4(y:=intVal, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"y", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) Assert.True(result.Candidates(0).ArgsToParamsOpt.SequenceEqual({1, 0}.AsImmutableOrNull())) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30274: Parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)' already has a matching argument. 'TestClass1.M4(intVal, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC32021: Parameter 'x' in 'Public Shared Sub M4(x As Integer, y As TestClass1)' already has a matching omitted argument. 'TestClass1.M4(, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={omitted, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30274: Parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)' already has a matching argument. 'TestClass1.M4(x:=intVal, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"x", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30272: 'z' is not a parameter of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(z:=intVal, y:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"z", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'error BC30272: 'z' is not a parameter of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(z:=TestClass1Val, x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, intVal}.AsImmutableOrNull(), argumentNames:={"z", "x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'x' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={omitted, TestClass1Val}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30455: Argument not specified for parameter 'y' of 'Public Shared Sub M4(x As Integer, y As TestClass1)'. 'TestClass1.M4(intVal, ) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, omitted}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30587: Named argument cannot match a ParamArray parameter. 'TestClass1.M3(x:=intArray) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intArray}.AsImmutableOrNull(), argumentNames:={"x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30587: Named argument cannot match a ParamArray parameter. 'TestClass1.M3(x:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:={"x"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Same(TestClass1_M3, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30588: Omitted argument cannot match a ParamArray parameter. 'TestClass1.M5(intVal, ) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M5)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, omitted}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Same(TestClass1_M5, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Same(TestClass1_M5, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M4(x:=intVal, TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"x", Nothing}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.BestResult.HasValue) 'error BC30057: Too many arguments to 'Public Shared Sub M2(Of T)()'. 'TestClass1.M2(Of TestClass1)(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=(New TypeSymbol() {TestClass1}).AsImmutableOrNull(), arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(0).State) Assert.Equal(TestClass1_M2.Construct((New TypeSymbol() {TestClass1}).AsImmutableOrNull()), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'TestClass1.M6(shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M6(doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.False(result.BestResult.HasValue) 'TestClass1.M6(doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Integer'. 'TestClass1.M6(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.False(result.BestResult.HasValue) 'TestClass1.M7(shortVal, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(doubleVal, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(shortVal, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(doubleVal, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M7(doubleConst, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M7(shortVal, doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M7(doubleConst, doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst, doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(objectVal, shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(shortVal, objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(objectVal, objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(objectVal, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M7(doubleConst, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M7(objectVal, doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC32029: Option Strict On disallows narrowing from type 'Double' to type 'Short' in copying the value of 'ByRef' parameter 'x' back to the matching argument. 'TestClass1.M8(TestClass1.ShortField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M8)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M8((shortVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M8)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC32029: Option Strict On disallows narrowing from type 'Object' to type 'Short' in copying the value of 'ByRef' parameter 'x' back to the matching argument. 'TestClass1.M9(TestClass1.ShortField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M9((shortVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.False(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M10(doubleConst) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M10(TestClass1.DoubleField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M10(TestClass1.ObjectField) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectField}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'error BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Single'. 'TestClass1.M10((doubleVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'Option Strict On disallows implicit conversions from 'Object' to 'Single'. 'TestClass1.M10((objectVal)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M10)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromObject) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) 'TestClass1.M11(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M11)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'TestClass1.M11(objectArray) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M11)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectArray}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M12(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M12(0)), (TestClass1_M12(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M12(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M12(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M12(0)), (TestClass1_M12(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M12(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M12(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'TestClass1.M13(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:={"a"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M13(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"a", "b"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(3, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M13(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(2).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass1_M13(1), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(2)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(1)), (TestClass1_M13(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M13(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M13(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'TestClass1.M13(intVal, intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M13(0)), (TestClass1_M13(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M13(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M13(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Derived.M1(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M1), (base_M1)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(base_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(base_M1), (derived_M1)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(base_M1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Derived.M2(intVal, z:=stringVal) ' Should bind to Base.M2 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M2), (base_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, stringVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M2, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M2, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Derived.M2(intVal, z:=stringVal) ' Should bind to Base.M2 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M2), (base_M2)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, stringVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(0).State) Assert.Same(derived_M2, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M2, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M3(intVal, z:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M3), (base_M3)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M3, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'error BC30272: 'z' is not a parameter of 'Public Shared Overloads Sub M4(u As Integer, [v As Integer = 0], [w As Integer = 0])'. 'Derived.M4(intVal, z:=intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M4), (base_M4)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={Nothing, "z"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M4, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'derived.M5(a:=objectVal) ' Should bind to Base.M5 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M5), (base_M5)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:={"a"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(derived_M5, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M5, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M6(a:=objectVal) ' Should bind to Base.M6 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M6), (base_M6)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:={"a"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentCountMismatch, result.Candidates(0).State) Assert.Same(derived_M6, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M6, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M7(objectVal, objectVal) ' Should bind to Base.M7 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M7), (base_M7)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M7, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(base_M7, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'derived.M8(objectVal, objectVal) ' Should bind to Derived.M8 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M8), (base_M8)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M8, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(derived_M8, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Derived.M9(a:=TestClass1Val, b:=1) ' Should bind to Derived.M9 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M9), (base_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={TestClass1Val, intVal}.AsImmutableOrNull(), argumentNames:={"a", "b"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M9, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'error BC30311: Value of type 'Integer' cannot be converted to 'TestClass1'. 'error BC30311: Value of type 'TestClass1' cannot be converted to 'Integer'. 'Derived.M9(a:=intVal, b:=TestClass1Val) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M9), (base_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, TestClass1Val}.AsImmutableOrNull(), argumentNames:={"a", "b"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(derived_M9, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Derived.M9(Nothing, Nothing) ' Should bind to Derived.M9 result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(derived_M9), (base_M9)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing], [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.True(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M9, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls BaseExt.M 'b.M10(intVal) Dim base_M10_Candidate = (base_M10.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={base_M10_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(base_M10_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls DerivedExt.M 'd.M10(intVal) Dim derived_M10_Candidate = (derived_M10.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={base_M10_Candidate, derived_M10_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M10_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M10_Candidate, base_M10_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M10_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls Ext.M11(derived, ...), because Ext.M11(I1, ...) is hidden since it extends ' an interface. 'd.M11(intVal) Dim derived_M11_Candidate = (derived_M11.ReduceExtensionMethod(derived, 0)) Dim i1_M11_Candidate = (ext_M11.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M11_Candidate, i1_M11_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M11_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={i1_M11_Candidate, derived_M11_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M11_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Calls derived.M12 since T.M12 target type is more generic. 'd.M12(10) Dim derived_M12_Candidate = (derived_M12.ReduceExtensionMethod(derived, 0)) Dim ext_M12_Candidate = (ext_M12.ReduceExtensionMethod(derived, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M12_Candidate, ext_M12_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M12_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M12_Candidate, derived_M12_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M12_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M12_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M12_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'tc2.S1(10, 10) ' Calls S1(U, T) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S1(0)), (TestClass2OfInteger_S1(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S1(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S1(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S1(1)), (TestClass2OfInteger_S1(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S1(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S1(1).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S1(1)), (TestClass2OfInteger_S1(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S1(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S1(1).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'tc2.S2(10, 10) ' Calls S2(Integer, T) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S2(0)), (TestClass2OfInteger_S2(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S2(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S2(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S2(1)), (TestClass2OfInteger_S2(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S2(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S2(1).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S2(0)), (TestClass2OfInteger_S2(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S2(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S2(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'M13(Of T, U)(x As T, y As U, z As T) 'intVal.M13(intVal, intVal) Dim ext_M13_0_Candidate = (ext_M13(0).ReduceExtensionMethod(intVal.Type, 0)) Dim ext_M13_1_Candidate = (ext_M13(1).ReduceExtensionMethod(intVal.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M13_0_Candidate, ext_M13_1_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(ext_M13_0_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext_M13_1_Candidate.OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M13_1_Candidate, ext_M13_0_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(ext_M13_0_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M13_1_Candidate.OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) ' Extension method precedence Dim derived_M11_Candidate_0 = (derived_M11.ReduceExtensionMethod(derived, 0)) Dim derived_M11_Candidate_1 = (derived_M11.ReduceExtensionMethod(derived, 1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M11_Candidate_0, derived_M11_Candidate_1}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(derived_M11_Candidate_0, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(derived_M11_Candidate_1, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={derived_M11_Candidate_1, derived_M11_Candidate_0}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(derived_M11_Candidate_0, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(derived_M11_Candidate_1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S3(0)), (TestClass2OfInteger_S3(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal, intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S3(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S3(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.True(result.BestResult.HasValue) 'error BC30521: Overload resolution failed because no accessible 'M14' is most specific for these arguments: 'Extension(method) 'Public Sub M14(Of Integer)(y As Integer, z As Integer)' defined in 'Ext1': Not most specific. 'Extension(method) 'Public Sub M14(Of Integer)(y As Integer, z As Integer)' defined in 'Ext': Not most specific. 'intVal.M14(intVal, intVal) Dim ext_M14_Candidate = (ext_M14.ReduceExtensionMethod(intVal.Type, 0)) Dim ext1_M14_Candidate = (ext1_M14.ReduceExtensionMethod(intVal.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M14_Candidate, ext1_M14_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M14_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext1_M14_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) 'error BC30521: Overload resolution failed because no accessible 'S4' is most specific for these arguments: 'Public Sub S4(Of Integer)(x As Integer, y() As Integer, z As TestClass2(Of Integer), v As Integer)': Not most specific. 'Public Sub S4(Of Integer)(x As Integer, y() As Integer, z As TestClass2(Of Integer), v As Integer)': Not most specific. 'tc2.S4(intVal, Nothing, Nothing, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S4(0)), (TestClass2OfInteger_S4(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, [nothing], [nothing], intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S4(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S4(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) 'error BC30521: Overload resolution failed because no accessible 'S5' is most specific for these arguments: 'Public Sub S5(x As Integer, y As TestClass2(Of Integer()))': Not most specific. 'Public Sub S5(x As Integer, y As TestClass2(Of Integer))': Not most specific. 'tc2.S5(intVal, Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S5(0)), (TestClass2OfInteger_S5(1)), (TestClass2OfInteger_S5(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S5(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S5(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass2OfInteger_S5(2).OriginalDefinition, result.Candidates(2).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S5(0)), (TestClass2OfInteger_S5(1)), (TestClass2OfInteger_S5(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, [nothing]}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S5(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S5(1).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass2OfInteger_S5(2).OriginalDefinition, result.Candidates(2).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.BestResult.HasValue) 'intVal.M15(intVal, intVal) Dim ext_M15_Candidate = (ext_M15.ReduceExtensionMethod(intVal.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:=Nothing, extensionMethods:={ext_M15_Candidate}. AsImmutableOrNull(), typeArguments:={intVal.Type}.AsImmutableOrNull(), arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(ext_M15_Candidate, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'S6(x As T, ParamArray y As Integer()) 'tc2.S6(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass2OfInteger_S6(0)), (TestClass2OfInteger_S6(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(4, result.Candidates.Length) Assert.False(result.Candidates(0).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass2OfInteger_S6(0).OriginalDefinition, result.Candidates(0).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.True(result.Candidates(1).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(1).State) Assert.Same(TestClass2OfInteger_S6(0).OriginalDefinition, result.Candidates(1).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.False(result.Candidates(2).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(2).State) Assert.Same(TestClass2OfInteger_S6(1).OriginalDefinition, result.Candidates(2).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.True(result.Candidates(3).IsExpandedParamArrayForm) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(3).State) Assert.Same(TestClass2OfInteger_S6(1).OriginalDefinition, result.Candidates(3).Candidate.UnderlyingSymbol.OriginalDefinition) Assert.Equal(result.BestResult.Value, result.Candidates(3)) 'M14(a As Integer) 'TestClass1.M14(shortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M14(0)), (TestClass1_M14(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M14(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M14(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M14(1)), (TestClass1_M14(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={shortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M14(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M14(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'M15(a As Integer) 'TestClass1.M15(0) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M15(0)), (TestClass1_M15(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M15(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M15(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M15(1)), (TestClass1_M15(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M15(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M15(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'M16(a As Short) 'TestClass1.M16(0L) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(0)), (TestClass1_M16(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.True(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Option Strict Off 'error BC30519: Overload resolution failed because no accessible 'M16' can be called without a narrowing conversion: 'Public Shared Sub M16(a As System.TypeCode)': Argument matching parameter 'a' narrows from 'Long' to 'System.TypeCode'. 'Public Shared Sub M16(a As Short)': Argument matching parameter 'a' narrows from 'Long' to 'Short'. result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(0)), (TestClass1_M16(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.False(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.True(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(1)), (TestClass1_M16(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.True(result.Candidates(0).RequiresNarrowingConversion) Assert.True(result.Candidates(0).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.False(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M16(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'M16(a As System.TypeCode) 'TestClass1.M16(0) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(0)), (TestClass1_M16(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(0).State) Assert.Same(TestClass1_M16(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M16(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M16(1)), (TestClass1_M16(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(1).State) Assert.Same(TestClass1_M16(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M16(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Byte 'TestClass1.M17(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M17(0)), (TestClass1_M17(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M17(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M17(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M17(1)), (TestClass1_M17(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M17(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M17(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Short 'TestClass1.M18(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M18(0)), (TestClass1_M18(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M18(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M18(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M18(1)), (TestClass1_M18(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M18(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M18(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Integer 'TestClass1.M19(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M19(0)), (TestClass1_M19(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M19(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M19(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M19(1)), (TestClass1_M19(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M19(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M19(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Long 'TestClass1.M20(Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M20(0)), (TestClass1_M20(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M20(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M20(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M20(1)), (TestClass1_M20(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M20(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M20(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Integer 'TestClass1.M21(ushortVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M21(0)), (TestClass1_M21(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={ushortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M21(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M21(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M21(1)), (TestClass1_M21(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={ushortVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M21(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M21(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) Dim numericTypesPrecedence = {System_SByte, System_Byte, System_Int16, System_UInt16, System_Int32, System_UInt32, System_Int64, System_UInt64, System_Decimal, System_Single, System_Double} Dim prev As SpecialType = 0 For i As Integer = 0 To numericTypesPrecedence.Length - 1 Step 1 Assert.InRange(numericTypesPrecedence(i), prev + 1, Integer.MaxValue) prev = numericTypesPrecedence(i) Next 'error BC30521: Overload resolution failed because no accessible 'M22' is most specific for these arguments: 'Public Shared Sub M22(a As SByte, b As Long)': Not most specific. 'Public Shared Sub M22(a As Byte, b As ULong)': Not most specific. 'TestClass1.M22(Nothing, Nothing) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M22(0)), (TestClass1_M22(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing], [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M22(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M22(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M22(1)), (TestClass1_M22(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={[nothing], [nothing]}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M22(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M22(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'M23(a As Long) 'TestClass1.M23(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.True(result.Candidates(1).RequiresNarrowingConversion) Assert.True(result.Candidates(1).RequiresNarrowingNotFromNumericConstant) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Option strict OFF: late call 'TestClass1.M23(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.True(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Option strict ON ' error BC30518: Overload resolution failed because no accessible 'M23' can be called with these arguments: 'Public Shared Sub M23(a As Short)': Option Strict On disallows implicit conversions from 'Object' to 'Short'. 'Public Shared Sub M23(a As Long)': Option Strict On disallows implicit conversions from 'Object' to 'Long'. 'TestClass1.M23(objectVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M23(0)), (TestClass1_M23(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M23(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M23(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Option strict OFF 'warning BC42016: Implicit conversion from 'Object' to 'Short'. 'TestClass1.M24(objectVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M24(0)), (TestClass1_M24(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ExtensionMethodVsLateBinding, result.Candidates(0).State) Assert.Same(TestClass1_M24(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M24(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'Option strict ON 'F:\ddp\Roslyn\Main\Open\Compilers\VisualBasic\Test\Semantics\OverloadResolutionTestSource.vb(549) : error BC30518: Overload resolution failed because no accessible 'M24' can be called with these arguments: 'Public Shared Sub M24(a As Short, b As Integer)': Option Strict On disallows implicit conversions from 'Object' to 'Short'. 'Public Shared Sub M24(a As Long, b As Short)': Option Strict On disallows implicit conversions from 'Object' to 'Long'. 'Public Shared Sub M24(a As Long, b As Short)': Option Strict On disallows implicit conversions from 'Integer' to 'Short'. 'TestClass1.M24(objectVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M24(0)), (TestClass1_M24(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M24(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M24(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M24(0)), (TestClass1_M24(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={objectVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=False, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M24(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(1).State) Assert.Same(TestClass1_M24(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'M25(a As SByte) 'TestClass1.M25(-1L) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M25(0)), (TestClass1_M25(1)), (TestClass1_M25(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M25(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M25(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass1_M25(2), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(2)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M25(2)), (TestClass1_M25(0)), (TestClass1_M25(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M25(2), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(1).State) Assert.Same(TestClass1_M25(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(2).State) Assert.Same(TestClass1_M25(1), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M25(1)), (TestClass1_M25(2)), (TestClass1_M25(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(0).State) Assert.Same(TestClass1_M25(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M25(2), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.LessApplicable, result.Candidates(2).State) Assert.Same(TestClass1_M25(0), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'BC30518: Overload resolution failed because no accessible 'M26' can be called with these arguments: 'Public Shared Sub M26(a As Integer, b As Short)': Option Strict On disallows implicit conversions from 'Double' to 'Short'. 'Public Shared Sub M26(a As Short, b As Integer)': Option Strict On disallows implicit conversions from 'Double' to 'Integer'. 'TestClass1.M26(-1L, doubleVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(1)), (TestClass1_M26(0))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longConst, doubleVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(1), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(0), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30512: Option Strict On disallows implicit conversions from 'Integer' to 'Short'. 'TestClass1.M27(intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOnBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Sub M14(a As Long) 'TestClass1.M14(0L) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M14(0)), (TestClass1_M14(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={longZero}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.RequiresNarrowing, result.Candidates(0).State) Assert.Same(TestClass1_M14(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M14(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) Dim DoubleMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Double.MaxValue), c1.GetSpecialType(System_Double), Nothing) Dim IntegerMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Integer.MaxValue), c1.GetSpecialType(System_Int32), Nothing) Assert.True(c1.Options.CheckOverflow) 'error BC30439: Constant expression not representable in type 'Short'. 'TestClass1.M27(Integer.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30439: Constant expression not representable in type 'Short'. 'TestClass1.M27(Double.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={DoubleMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'error BC30519: Overload resolution failed because no accessible 'M26' can be called without a narrowing conversion: 'Public Shared Sub M26(a As Integer, b As Short)': Argument matching parameter 'b' narrows from 'Integer' to 'Short'. 'Public Shared Sub M26(a As Short, b As Integer)': Argument matching parameter 'a' narrows from 'Integer' to 'Short'. 'TestClass1.M26(intVal, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={intVal, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Overflow On - Sub M26(a As Integer, b As Short) 'TestClass1.M26(Integer.MaxValue, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'error BC30521: Overload resolution failed because no accessible 'g' is most specific for these arguments 'TestClass1.g(1UI) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_g(0)), (TestClass1_g(1)), (TestClass1_g(2))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={unsignedOne}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.False(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_g(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_g(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(TestClass1_g(2), result.Candidates(2).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Should bind to extension method 'TestClass1Val.SM(x:=intVal, y:=objectVal) Dim ext_SM_Candidate = (ext_SM.ReduceExtensionMethod(TestClass1Val.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_SM)}.AsImmutableOrNull(), extensionMethods:={ext_SM_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal, objectVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass1_SM, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext_SM_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(1)) 'error BC30519: Overload resolution failed because no accessible 'SM1' can be called without a narrowing conversion: 'Extension(method) 'Public Sub SM1(y As Object, x As Short)' defined in 'Ext': Argument matching parameter 'x' narrows from 'Integer' to 'Short'. 'Extension(method) 'Public Sub SM1(y As Double, x As Integer)' defined in 'Ext': Argument matching parameter 'y' narrows from 'Object' to 'Double'. 'TestClass1Val.SM1(x:=intVal, y:=objectVal) Dim ext_SM1_0_Candidate = (ext_SM1(0).ReduceExtensionMethod(TestClass1Val.Type, 0)) Dim ext_SM1_1_Candidate = (ext_SM1(1).ReduceExtensionMethod(TestClass1Val.Type, 0)) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_SM1)}.AsImmutableOrNull(), extensionMethods:={ext_SM1_0_Candidate, ext_SM1_1_Candidate}.AsImmutableOrNull(), typeArguments:=Nothing, arguments:={intVal, objectVal}.AsImmutableOrNull(), argumentNames:={"x", "y"}.AsImmutableOrNull(), lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(3, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Shadowed, result.Candidates(0).State) Assert.Same(TestClass1_SM1, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(ext_SM1_0_Candidate, result.Candidates(1).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(2).State) Assert.Same(ext_SM1_1_Candidate, result.Candidates(2).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) End Sub <Fact> Public Sub BasicTests2() Dim optionStrictOff = <file> Option Strict Off Class OptionStrictOff Shared Sub Context() End Sub End Class </file> Dim optionStrictOffTree = VisualBasicSyntaxTree.ParseText(optionStrictOff.Value) Dim c1 = VisualBasicCompilation.Create("Test1", syntaxTrees:={Parse(SemanticResourceUtil.OverloadResolutionTestSource), optionStrictOffTree}, references:={TestMetadata.Net40.mscorlib}, options:=TestOptions.ReleaseExe.WithOverflowChecks(False)) Dim sourceModule = DirectCast(c1.Assembly.Modules(0), SourceModuleSymbol) Dim optionStrictOffContext = DirectCast(sourceModule.GlobalNamespace.GetTypeMembers("OptionStrictOff").Single().GetMembers("Context").Single(), SourceMethodSymbol) Dim optionStrictOffBinder = BinderBuilder.CreateBinderForMethodBody(sourceModule, optionStrictOffTree, optionStrictOffContext) Assert.False(c1.Options.CheckOverflow) Dim TestClass1 = c1.Assembly.GlobalNamespace.GetTypeMembers("TestClass1").Single() Dim TestClass1_M26 = TestClass1.GetMembers("M26").OfType(Of MethodSymbol)().ToArray() Dim TestClass1_M27 = TestClass1.GetMembers("M27").OfType(Of MethodSymbol)().Single() Dim _syntaxNode = optionStrictOffTree.GetVisualBasicRoot(Nothing) Dim _syntaxTree = optionStrictOffTree Dim DoubleMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Double.MaxValue), c1.GetSpecialType(System_Double), Nothing) Dim IntegerMaxValue As BoundExpression = New BoundConversion(_syntaxNode, New BoundLiteral(_syntaxNode, ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Create(Integer.MaxValue), c1.GetSpecialType(System_Int32), Nothing) Dim intVal As BoundExpression = New BoundUnaryOperator(_syntaxNode, UnaryOperatorKind.Minus, IntegerMaxValue, False, IntegerMaxValue.Type) Dim result As OverloadResolution.OverloadResolutionResult 'Overflow Off 'TestClass1.M27(Integer.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(result.BestResult.Value, result.Candidates(0)) 'Overflow Off 'error BC30439: Constant expression not representable in type 'Short'. 'TestClass1.M27(Double.MaxValue) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M27)}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={DoubleMaxValue}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.Equal(1, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.ArgumentMismatch, result.Candidates(0).State) Assert.Same(TestClass1_M27, result.Candidates(0).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) 'Overflow Off 'error BC30519: Overload resolution failed because no accessible 'M26' can be called without a narrowing conversion: 'Public Shared Sub M26(a As Integer, b As Short)': Argument matching parameter 'b' narrows from 'Integer' to 'Short'. 'Public Shared Sub M26(a As Short, b As Integer)': Argument matching parameter 'a' narrows from 'Integer' to 'Short'. 'TestClass1.M26(Integer.MaxValue, intVal) result = ResolveMethodOverloading(includeEliminatedCandidates:=True, instanceMethods:={(TestClass1_M26(0)), (TestClass1_M26(1))}.AsImmutableOrNull(), extensionMethods:=Nothing, typeArguments:=Nothing, arguments:={IntegerMaxValue, intVal}.AsImmutableOrNull(), argumentNames:=Nothing, lateBindingIsAllowed:=True, binder:=optionStrictOffBinder) Assert.False(result.ResolutionIsLateBound) Assert.True(result.RemainingCandidatesRequireNarrowingConversion) Assert.Equal(2, result.Candidates.Length) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(0).State) Assert.Same(TestClass1_M26(0), result.Candidates(0).Candidate.UnderlyingSymbol) Assert.Equal(CandidateAnalysisResultState.Applicable, result.Candidates(1).State) Assert.Same(TestClass1_M26(1), result.Candidates(1).Candidate.UnderlyingSymbol) Assert.False(result.BestResult.HasValue) End Sub <Fact> Public Sub Bug4219() Dim compilationDef = <compilation name="Bug4219"> <file name="a.vb"> Option Strict On Module Program Sub Main() Dim a As A(Of Long, Integer) a.Goo(y:=1, x:=1) End Sub End Module Class A(Of T, S) Sub Goo(x As Integer, y As T) End Sub Sub Goo(y As Long, x As S) End Sub End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC42104: Variable 'a' is used before it has been assigned a value. A null reference exception could result at runtime. a.Goo(y:=1, x:=1) ~ BC30521: Overload resolution failed because no accessible 'Goo' is most specific for these arguments: 'Public Sub Goo(x As Integer, y As Long)': Not most specific. 'Public Sub Goo(y As Long, x As Integer)': Not most specific. a.Goo(y:=1, x:=1) ~~~ </expected>) End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186a() Dim compilationDef = <compilation name="Bug14186a"> <file name="a.vb"> Imports System Imports System.Collections.Generic Public Class Bar Shared Sub Equal(Of T)(exp As IEnumerable(Of T), act As IEnumerable(Of T)) Console.Write("A;") End Sub Shared Sub Equal(Of T)(exp As T, act As T) Console.Write("B;") End Sub End Class Public Module Goo Sub Main() Dim goo As IEnumerable(Of Integer) = Nothing Bar.Equal(goo, goo) End Sub End Module </file> </compilation> CompileAndVerify(compilationDef, expectedOutput:="A;") End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186b() Dim compilationDef = <compilation name="Bug14186b"> <file name="a.vb"> Imports System.Collections.Generic Public Class Bar Shared Sub Equal(Of T)(exp As IEnumerable(Of T), act As T) End Sub Shared Sub Equal(Of T)(exp As T, act As IEnumerable(Of T)) End Sub End Class Public Module Goo Sub Main() Dim goo As IEnumerable(Of Integer) = Nothing Bar.Equal(goo, goo) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30518: Overload resolution failed because no accessible 'Equal' can be called with these arguments: 'Public Shared Sub Equal(Of T)(exp As IEnumerable(Of T), act As T)': Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error. 'Public Shared Sub Equal(Of T)(exp As T, act As IEnumerable(Of T))': Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error. Bar.Equal(goo, goo) ~~~~~ </expected>) End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186c() Dim compilationDef = <compilation name="Bug14186c"> <file name="a.vb"> Public Class Bar Shared Sub Equal(Of T)(exp As I1(Of T)) End Sub Shared Sub Equal(Of T)(exp As I2(Of T)) End Sub End Class Public Interface I1(Of T) End Interface Public Interface I2(Of T) End Interface Class P(Of T) Implements I1(Of T), I2(Of T) End Class Public Module Goo Sub Main() Dim goo As New P(Of Integer) Bar.Equal(goo) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30521: Overload resolution failed because no accessible 'Equal' is most specific for these arguments: 'Public Shared Sub Equal(Of Integer)(exp As I1(Of Integer))': Not most specific. 'Public Shared Sub Equal(Of Integer)(exp As I2(Of Integer))': Not most specific. Bar.Equal(goo) ~~~~~ </expected>) End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186d() Dim compilationDef = <compilation name="Bug14186d"> <file name="a.vb"> Imports System Public Class Bar Shared Sub Equal(Of T)(exp As I2(Of I2(Of T))) Console.Write("A;") End Sub Shared Sub Equal(Of T)(exp As I2(Of T)) Console.Write("B;") End Sub End Class Public Interface I2(Of T) End Interface Class P(Of T) Implements I2(Of I2(Of T)), I2(Of T) End Class Public Module Goo Sub Main() Dim goo As New P(Of Integer) Dim goo2 As I2(Of Integer) = goo Bar.Equal(goo2) Dim goo3 As I2(Of I2(Of Integer)) = goo Bar.Equal(goo3) End Sub End Module </file> </compilation> CompileAndVerify(compilationDef, expectedOutput:="B;A;") End Sub <WorkItem(545633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545633")> <Fact> Public Sub Bug14186e() Dim compilationDef = <compilation name="Bug14186e"> <file name="a.vb"> Imports System Public Class Bar Shared Sub Equal(Of T)(exp() As I2(Of T)) Console.Write("A;") End Sub Shared Sub Equal(Of T)(exp() As T) Console.Write("B;") End Sub End Class Public Interface I2(Of T) End Interface Public Module Goo Sub Main() Dim goo() As I2(Of Integer) = Nothing Bar.Equal(goo) End Sub End Module </file> </compilation> CompileAndVerify(compilationDef, expectedOutput:="A;") End Sub <Fact> Public Sub Diagnostics1() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() F1(Of Integer, Integer)() F1(Of Integer, Integer)(1, 2) F2(Of Integer)() F2(Of Integer)(1, 2) F3(Of Integer)() F3(Of Integer)(1, 2) F1(Of Integer)() F1(Of Integer)(1, 2) F4() F4(, , , ) F4(1, 2, , 4) F3(y:=1) F3(1, y:=2) F3(y:=1, z:=2) F4(y:=1, x:=2) F4(, y:=1) F3(x:=1, x:=2) F3(, x:=2) F3(1, x:=2) F4(x:=1, x:=2) F4(, x:=2) F4(1, x:=2) F5(x:=1, x:=2) F2(1) Dim g As System.Guid = Nothing F6(g, g) F6(y:=g, x:=g) F4(g, Nothing) F4(1, g) Dim l As Long = 1 Dim s As Short = 1 F3(l) F7(g) F7(s) F7((l)) F8(y:=Nothing) End Sub Sub F1(Of T)(x As Integer) End Sub Sub F2(Of T, S)(x As Integer) End Sub Sub F3(x As Integer) End Sub Sub F4(x As Integer, ParamArray y As Integer()) End Sub Sub F5(x As Integer, y As Integer) End Sub Sub F6(x As Integer, y As Long) End Sub Sub F7(ByRef x As Integer) End Sub Sub F8(ParamArray y As Integer()) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32043: Too many type arguments to 'Public Sub F1(Of T)(x As Integer)'. F1(Of Integer, Integer)() ~~~~~~~~~~~~~~~~~~~~~ BC32043: Too many type arguments to 'Public Sub F1(Of T)(x As Integer)'. F1(Of Integer, Integer)(1, 2) ~~~~~~~~~~~~~~~~~~~~~ BC32042: Too few type arguments to 'Public Sub F2(Of T, S)(x As Integer)'. F2(Of Integer)() ~~~~~~~~~~~~ BC32042: Too few type arguments to 'Public Sub F2(Of T, S)(x As Integer)'. F2(Of Integer)(1, 2) ~~~~~~~~~~~~ BC32045: 'Public Sub F3(x As Integer)' has no type parameters and so cannot have type arguments. F3(Of Integer)() ~~~~~~~~~~~~ BC32045: 'Public Sub F3(x As Integer)' has no type parameters and so cannot have type arguments. F3(Of Integer)(1, 2) ~~~~~~~~~~~~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F1(Of Integer)(x As Integer)'. F1(Of Integer)() ~~~~~~~~~~~~~~ BC30057: Too many arguments to 'Public Sub F1(Of Integer)(x As Integer)'. F1(Of Integer)(1, 2) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())'. F4() ~~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())'. F4(, , , ) ~~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(, , , ) ~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(, , , ) ~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(, , , ) ~ BC30588: Omitted argument cannot match a ParamArray parameter. F4(1, 2, , 4) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F3(x As Integer)'. F3(y:=1) ~~ BC30272: 'y' is not a parameter of 'Public Sub F3(x As Integer)'. F3(y:=1) ~ BC30272: 'y' is not a parameter of 'Public Sub F3(x As Integer)'. F3(1, y:=2) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F3(x As Integer)'. F3(y:=1, z:=2) ~~ BC30272: 'y' is not a parameter of 'Public Sub F3(x As Integer)'. F3(y:=1, z:=2) ~ BC30272: 'z' is not a parameter of 'Public Sub F3(x As Integer)'. F3(y:=1, z:=2) ~ BC30587: Named argument cannot match a ParamArray parameter. F4(y:=1, x:=2) ~ BC30455: Argument not specified for parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())'. F4(, y:=1) ~~ BC30587: Named argument cannot match a ParamArray parameter. F4(, y:=1) ~ BC30274: Parameter 'x' of 'Public Sub F3(x As Integer)' already has a matching argument. F3(x:=1, x:=2) ~ BC32021: Parameter 'x' in 'Public Sub F3(x As Integer)' already has a matching omitted argument. F3(, x:=2) ~ BC30274: Parameter 'x' of 'Public Sub F3(x As Integer)' already has a matching argument. F3(1, x:=2) ~ BC30274: Parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())' already has a matching argument. F4(x:=1, x:=2) ~ BC32021: Parameter 'x' in 'Public Sub F4(x As Integer, ParamArray y As Integer())' already has a matching omitted argument. F4(, x:=2) ~ BC30274: Parameter 'x' of 'Public Sub F4(x As Integer, ParamArray y As Integer())' already has a matching argument. F4(1, x:=2) ~ BC30455: Argument not specified for parameter 'y' of 'Public Sub F5(x As Integer, y As Integer)'. F5(x:=1, x:=2) ~~ BC30274: Parameter 'x' of 'Public Sub F5(x As Integer, y As Integer)' already has a matching argument. F5(x:=1, x:=2) ~ BC32050: Type parameter 'S' for 'Public Sub F2(Of T, S)(x As Integer)' cannot be inferred. F2(1) ~~ BC32050: Type parameter 'T' for 'Public Sub F2(Of T, S)(x As Integer)' cannot be inferred. F2(1) ~~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F6(g, g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Long'. F6(g, g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Long'. F6(y:=g, x:=g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F6(y:=g, x:=g) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F4(g, Nothing) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F4(1, g) ~ BC30512: Option Strict On disallows implicit conversions from 'Long' to 'Integer'. F3(l) ~ BC30311: Value of type 'Guid' cannot be converted to 'Integer'. F7(g) ~ BC32029: Option Strict On disallows narrowing from type 'Integer' to type 'Short' in copying the value of 'ByRef' parameter 'x' back to the matching argument. F7(s) ~ BC30512: Option Strict On disallows implicit conversions from 'Long' to 'Integer'. F7((l)) ~~~ BC30587: Named argument cannot match a ParamArray parameter. F8(y:=Nothing) ~ </expected>) End Sub <Fact> Public Sub Diagnostics2() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() Goo(Of Integer, Integer)() Goo(Of Integer, Integer)(1, 2) Goo(Of Integer)() Goo(Of Integer)(1, 2) Dim g As System.Guid = Nothing F1(g) F1(y:=1) F2(1, y:=1) F2(1, ) F3(1, , z:=1) F3(1, 1, x:=1) Goo(1) End Sub Sub Goo(Of T)(x As Integer) End Sub Sub Goo(Of S)(x As Long) End Sub Sub F1(x As Integer) End Sub Sub F1(x As Long) End Sub Sub F2(x As Long, ParamArray y As Integer()) End Sub Sub F2(x As Integer, a As Integer, ParamArray y As Integer()) End Sub Sub F3(x As Long, y As Integer, z As Long) End Sub Sub F3(x As Long, z As Long, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32087: Overload resolution failed because no accessible 'Goo' accepts this number of type arguments. Goo(Of Integer, Integer)() ~~~~~~~~~~~~~~~~~~~~~~~~ BC32087: Overload resolution failed because no accessible 'Goo' accepts this number of type arguments. Goo(Of Integer, Integer)(1, 2) ~~~~~~~~~~~~~~~~~~~~~~~~ BC30516: Overload resolution failed because no accessible 'Goo' accepts this number of arguments. Goo(Of Integer)() ~~~~~~~~~~~~~~~ BC30516: Overload resolution failed because no accessible 'Goo' accepts this number of arguments. Goo(Of Integer)(1, 2) ~~~~~~~~~~~~~~~ BC30518: Overload resolution failed because no accessible 'F1' can be called with these arguments: 'Public Sub F1(x As Integer)': Value of type 'Guid' cannot be converted to 'Integer'. 'Public Sub F1(x As Long)': Value of type 'Guid' cannot be converted to 'Long'. F1(g) ~~ BC30518: Overload resolution failed because no accessible 'F1' can be called with these arguments: 'Public Sub F1(x As Integer)': 'y' is not a method parameter. 'Public Sub F1(x As Integer)': Argument not specified for parameter 'x'. 'Public Sub F1(x As Long)': 'y' is not a method parameter. 'Public Sub F1(x As Long)': Argument not specified for parameter 'x'. F1(y:=1) ~~ BC30518: Overload resolution failed because no accessible 'F2' can be called with these arguments: 'Public Sub F2(x As Long, ParamArray y As Integer())': Named argument cannot match a ParamArray parameter. 'Public Sub F2(x As Integer, a As Integer, ParamArray y As Integer())': Named argument cannot match a ParamArray parameter. 'Public Sub F2(x As Integer, a As Integer, ParamArray y As Integer())': Argument not specified for parameter 'a'. F2(1, y:=1) ~~ BC30518: Overload resolution failed because no accessible 'F2' can be called with these arguments: 'Public Sub F2(x As Long, ParamArray y As Integer())': Omitted argument cannot match a ParamArray parameter. 'Public Sub F2(x As Integer, a As Integer, ParamArray y As Integer())': Argument not specified for parameter 'a'. F2(1, ) ~~ BC30518: Overload resolution failed because no accessible 'F3' can be called with these arguments: 'Public Sub F3(x As Long, y As Integer, z As Long)': Argument not specified for parameter 'y'. 'Public Sub F3(x As Long, z As Long, y As Integer)': Parameter 'z' already has a matching omitted argument. 'Public Sub F3(x As Long, z As Long, y As Integer)': Argument not specified for parameter 'y'. F3(1, , z:=1) ~~ BC30518: Overload resolution failed because no accessible 'F3' can be called with these arguments: 'Public Sub F3(x As Long, y As Integer, z As Long)': Parameter 'x' already has a matching argument. 'Public Sub F3(x As Long, y As Integer, z As Long)': Argument not specified for parameter 'z'. 'Public Sub F3(x As Long, z As Long, y As Integer)': Parameter 'x' already has a matching argument. 'Public Sub F3(x As Long, z As Long, y As Integer)': Argument not specified for parameter 'y'. F3(1, 1, x:=1) ~~ BC30518: Overload resolution failed because no accessible 'Goo' can be called with these arguments: 'Public Sub Goo(Of T)(x As Integer)': Type parameter 'T' cannot be inferred. 'Public Sub Goo(Of S)(x As Long)': Type parameter 'S' cannot be inferred. Goo(1) ~~~ </expected>) End Sub <Fact> Public Sub Diagnostics3() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict Off Imports System.Console Module Module1 Sub Main() Dim i As Integer = 0 F1(i) F2(i, i) F2(1, 1) End Sub Sub F1(x As Byte) End Sub Sub F1(x As SByte) End Sub Sub F1(ByRef x As Long) End Sub Sub F2(x As Integer, ParamArray y As Byte()) End Sub Sub F2(x As SByte, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30519: Overload resolution failed because no accessible 'F1' can be called without a narrowing conversion: 'Public Sub F1(x As Byte)': Argument matching parameter 'x' narrows from 'Integer' to 'Byte'. 'Public Sub F1(x As SByte)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. 'Public Sub F1(ByRef x As Long)': Copying the value of 'ByRef' parameter 'x' back to the matching argument narrows from type 'Long' to type 'Integer'. F1(i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(i, i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(1, 1) ~~ </expected>) End Sub <Fact> Public Sub Diagnostics4() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() Dim i As Integer = 0 F1(i) F2(i, i) F2(1, 1) End Sub Sub F1(x As Byte) End Sub Sub F1(x As SByte) End Sub Sub F1(ByRef x As Long) End Sub Sub F2(x As Integer, ParamArray y As Byte()) End Sub Sub F2(x As SByte, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30518: Overload resolution failed because no accessible 'F1' can be called with these arguments: 'Public Sub F1(x As Byte)': Option Strict On disallows implicit conversions from 'Integer' to 'Byte'. 'Public Sub F1(x As SByte)': Option Strict On disallows implicit conversions from 'Integer' to 'SByte'. 'Public Sub F1(ByRef x As Long)': Option Strict On disallows narrowing from type 'Long' to type 'Integer' in copying the value of 'ByRef' parameter 'x' back to the matching argument. F1(i) ~~ BC30518: Overload resolution failed because no accessible 'F2' can be called with these arguments: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Option Strict On disallows implicit conversions from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Option Strict On disallows implicit conversions from 'Integer' to 'SByte'. F2(i, i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(1, 1) ~~ </expected>) End Sub <Fact> Public Sub Diagnostics5() Dim compilationDef = <compilation name="OverloadResolutionDiagnostics"> <file name="a.vb"> Imports System.Console Module Module1 Sub Main() Dim i As Integer = 0 F1(i) F2(i, i) F2(1, 1) End Sub Sub F1(x As Byte) End Sub Sub F1(x As SByte) End Sub Sub F1(ByRef x As Long) End Sub Sub F2(x As Integer, ParamArray y As Byte()) End Sub Sub F2(x As SByte, y As Integer) End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Custom)) Assert.Equal(OptionStrict.Custom, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30519: Overload resolution failed because no accessible 'F1' can be called without a narrowing conversion: 'Public Sub F1(x As Byte)': Argument matching parameter 'x' narrows from 'Integer' to 'Byte'. 'Public Sub F1(x As SByte)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. 'Public Sub F1(ByRef x As Long)': Copying the value of 'ByRef' parameter 'x' back to the matching argument narrows from type 'Long' to type 'Integer'. F1(i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(i, i) ~~ BC30519: Overload resolution failed because no accessible 'F2' can be called without a narrowing conversion: 'Public Sub F2(x As Integer, ParamArray y As Byte())': Argument matching parameter 'y' narrows from 'Integer' to 'Byte'. 'Public Sub F2(x As SByte, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'SByte'. F2(1, 1) ~~ </expected>) End Sub <Fact(), WorkItem(527622, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527622")> Public Sub NoisyDiagnostics() Dim compilationDef = <compilation> <file name="a.vb"> Option Strict On Imports System.Console Module Module1 Sub Main() F4(y:=Nothing,) End Sub Sub F4(x As Integer, y As Integer()) End Sub End Module Class C Private Sub M() Dim x As String = F(:'BIND:"F(" End Sub Private Function F(arg As Integer) As String Return "Hello" End Function Private Function F(arg As String) As String Return "Goodbye" End Function End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, parseOptions:=TestOptions.Regular.WithLanguageVersion(LanguageVersion.VisualBasic15_3)) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC37302: Named argument 'y' is used out-of-position but is followed by an unnamed argument F4(y:=Nothing,) ~ BC30241: Named argument expected. Please use language version 15.5 or greater to use non-trailing named arguments. F4(y:=Nothing,) ~ BC30198: ')' expected. Dim x As String = F(:'BIND:"F(" ~ BC30201: Expression expected. Dim x As String = F(:'BIND:"F(" ~ </expected>) End Sub <Fact> Public Sub Bug4263() Dim compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Option Strict Off Module M Sub Main() Dim x As String Dim y As Object = Nothing x = Goo(y).ToLower() x = Goo((y)).ToLower() End Sub Sub Goo(ByVal x As String) End Sub Function Goo(ByVal ParamArray x As String()) As String return Nothing End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30491: Expression does not produce a value. x = Goo(y).ToLower() ~~~~~~ BC30491: Expression does not produce a value. x = Goo((y)).ToLower() ~~~~~~~~ </expected>) compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Option Strict Off Imports System Module M Sub Main() Dim x As String x = Goo(CObj(Nothing)).ToLower() x = Goo(CObj((Nothing))).ToLower() x = Goo(CType(Nothing, Object)).ToLower() x = Goo(DirectCast(Nothing, Object)).ToLower() x = Goo(TryCast(Nothing, Object)).ToLower() x = Goo(CType(CStr(Nothing), Object)).ToLower() x = Goo(CType(CType(Nothing, ValueType), Object)).ToLower() x = Goo(CType(CType(CType(Nothing, Derived()), Base()), Object)).ToLower() x = Goo(CType(CType(CType(Nothing, Derived), Derived), Object)).ToLower() x = Goo(CType(Nothing, String())).ToLower() End Sub Sub Goo(ByVal x As String) End Sub Function Goo(ByVal ParamArray x As String()) As String System.Console.WriteLine("Function") Return "" End Function End Module Class Base End Class Class Derived Inherits Base End Class </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation, <![CDATA[ Function Function Function Function Function Function Function Function Function Function ]]>) compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Imports System Module M Sub Main() Goo(CObj(Nothing)) End Sub Sub Goo(ByVal x As String) End Sub Function Goo(ByVal ParamArray x As String()) As String System.Console.WriteLine("Function") Return "" End Function End Module </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOptionStrict(OptionStrict.On)) Assert.Equal(OptionStrict.On, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30518: Overload resolution failed because no accessible 'Goo' can be called with these arguments: 'Public Sub Goo(x As String)': Option Strict On disallows implicit conversions from 'Object' to 'String'. 'Public Function Goo(ParamArray x As String()) As String': Option Strict On disallows implicit conversions from 'Object' to 'String()'. Goo(CObj(Nothing)) ~~~ </expected>) compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOptionStrict(OptionStrict.Custom)) Assert.Equal(OptionStrict.Custom, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC42016: Implicit conversion from 'Object' to 'String()'. Goo(CObj(Nothing)) ~~~~~~~~~~~~~ </expected>) compilationDef = <compilation name="Bug4263"> <file name="a.vb"> Imports System Module M Sub Main() Dim x As String = (CObj(Nothing)) End Sub End Module </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOptionStrict(OptionStrict.On)) Assert.Equal(OptionStrict.On, compilation.Options.OptionStrict) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30512: Option Strict On disallows implicit conversions from 'Object' to 'String'. Dim x As String = (CObj(Nothing)) ~~~~~~~~~~~~~~~ </expected>) End Sub <WorkItem(539850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539850")> <Fact> Public Sub TestConversionFromZeroLiteralToEnum() Dim compilationDef = <compilation name="TestConversionFromZeroLiteralToEnum"> <file name="Program.vb"> Imports System Module Program Sub Main() Console.WriteLine(Goo(0).ToLower()) End Sub Sub Goo(x As DayOfWeek) End Sub Function Goo(x As Object) As String Return "ABC" End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) CompileAndVerify(compilation, expectedOutput:="abc") compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="abc") End Sub <WorkItem(528006, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528006")> <Fact()> Public Sub TestConversionFromZeroLiteralToNullableEnum() Dim compilationDef = <compilation name="TestConversionFromZeroLiteralToNullableEnum"> <file name="Program.vb"> Option Strict On Imports System Module Program Sub Main() Console.WriteLine(Goo(0).ToLower()) End Sub Function Goo(x As DayOfWeek?) As String Return "ABC" End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) CompileAndVerify(compilation, expectedOutput:="abc") End Sub <WorkItem(528011, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528011")> <Fact()> Public Sub TestInvocationWithNamedArgumentInLambda() Dim compilationDef = <compilation name="TestInvocationWithNamedArgumentInLambda"> <file name="Program.vb"> Imports System Class B Sub Goo(x As Integer, ParamArray z As Integer()) System.Console.WriteLine("B.Goo") End Sub End Class Class C Inherits B Overloads Sub Goo(y As Integer) System.Console.WriteLine("C.Goo") End Sub End Class Module M Sub Main() Dim p as New C() p.Goo(x:=1) ' This fails to compile in Dev10, but works in Roslyn End Sub End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) CompileAndVerify(compilation, expectedOutput:="B.Goo") compilationDef = <compilation name="TestInvocationWithNamedArgumentInLambda"> <file name="Program.vb"> Imports System Class B Sub Goo(x As Integer, ParamArray z As Integer()) End Sub End Class Class C Inherits B Overloads Sub Goo(y As Integer) End Sub End Class Class D Overloads Sub Goo(x As Integer) End Sub End Class Module M Sub Main() Console.WriteLine(Bar(Sub(p) p.Goo(x:=1)).ToLower()) End Sub Sub Bar(a As Action(Of C)) End Sub Function Bar(a As Action(Of D)) As String Return "ABC" End Function End Module </file> </compilation> compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.On)) compilation.AssertTheseDiagnostics(<![CDATA[ BC30521: Overload resolution failed because no accessible 'Bar' is most specific for these arguments: 'Public Sub Bar(a As Action(Of C))': Not most specific. 'Public Function Bar(a As Action(Of D)) As String': Not most specific. Console.WriteLine(Bar(Sub(p) p.Goo(x:=1)).ToLower()) ~~~]]>) compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) compilation.AssertTheseDiagnostics(<![CDATA[ BC30521: Overload resolution failed because no accessible 'Bar' is most specific for these arguments: 'Public Sub Bar(a As Action(Of C))': Not most specific. 'Public Function Bar(a As Action(Of D)) As String': Not most specific. Console.WriteLine(Bar(Sub(p) p.Goo(x:=1)).ToLower()) ~~~]]>) End Sub <WorkItem(539994, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539994")> <Fact> Public Sub MethodTypeParameterInferenceBadArg() ' Method type parameter inference should complete in the case where ' the type of a method argument is ErrorType but HasErrors=False. Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40( <compilation> <file name="a.vb"> Class C Sub M(Of T)(x As T, y As T) End Sub Sub N() Dim d As D = GetD() M("", d.F) End Sub End Class </file> </compilation>) Dim diagnostics = compilation.GetDiagnostics().ToArray() ' The actual errors are not as important as ensuring compilation completes. ' (Just returning successfully from GetDiagnostics() is sufficient in this case.) Dim anyErrors = diagnostics.Length > 0 Assert.True(anyErrors) End Sub <Fact()> Public Sub InaccessibleMethods() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Imports System Module Module2 Private Sub M1(x as Integer) End Sub Private Sub M1(x as Long) End Sub Private Sub M2(x as Integer) End Sub Private Sub M2(x as Long, y as Integer) End Sub End Module Module Module1 Sub Main() M1(1) 'BIND1:"M1(1)" M1(1, 2) 'BIND2:"M1(1, 2)" M2(1, 2) 'BIND3:"M2(1, 2)" End Sub End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30390: 'Module2.Private Sub M1(x As Integer)' is not accessible in this context because it is 'Private'. M1(1) 'BIND1:"M1(1)" ~~ BC30517: Overload resolution failed because no 'M1' is accessible. M1(1, 2) 'BIND2:"M1(1, 2)" ~~ BC30390: 'Module2.Private Sub M2(x As Long, y As Integer)' is not accessible in this context because it is 'Private'. M2(1, 2) 'BIND3:"M2(1, 2)" ~~ </expected>) Dim tree As SyntaxTree = (From t In compilation.SyntaxTrees Where t.FilePath = "a.vb").Single() Dim semanticModel = compilation.GetSemanticModel(tree) If True Then Dim node1 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 1) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node1) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub Module2.M1(x As System.Int32)", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If If True Then Dim node2 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 2) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node2) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(2, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub Module2.M1(x As System.Int32)", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) Assert.Equal("Sub Module2.M1(x As System.Int64)", symbolInfo.CandidateSymbols(1).ToTestDisplayString()) End If If True Then Dim node3 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 3) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node3) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub Module2.M2(x As System.Int64, y As System.Int32)", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If End Sub <Fact()> Public Sub InaccessibleProperties() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Imports System Module Module2 Private Property P1(x as Integer) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property Private Property P1(x as Long) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property Private Property P2(x as Integer) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property Private Property P2(x as Long, y as Integer) As Integer Get Return 0 End Get Set(value As Integer) End Set End Property End Module Module Module1 Sub Main() P1(1)=1 'BIND1:"P1(1)" P1(1, 2)=1 'BIND2:"P1(1, 2)" P2(1, 2)=1 'BIND3:"P2(1, 2)" Dim x = P2(1) End Sub End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30389: 'Module2.P1(x As Integer)' is not accessible in this context because it is 'Private'. P1(1)=1 'BIND1:"P1(1)" ~~ BC30517: Overload resolution failed because no 'P1' is accessible. P1(1, 2)=1 'BIND2:"P1(1, 2)" ~~ BC30389: 'Module2.P2(x As Long, y As Integer)' is not accessible in this context because it is 'Private'. P2(1, 2)=1 'BIND3:"P2(1, 2)" ~~ BC30389: 'Module2.P2(x As Integer)' is not accessible in this context because it is 'Private'. Dim x = P2(1) ~~ </expected>) Dim tree As SyntaxTree = (From t In compilation.SyntaxTrees Where t.FilePath = "a.vb").Single() Dim semanticModel = compilation.GetSemanticModel(tree) If True Then Dim node1 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 1) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node1) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Property Module2.P1(x As System.Int32) As System.Int32", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If If True Then Dim node2 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 2) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node2) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(2, symbolInfo.CandidateSymbols.Length) Assert.Equal("Property Module2.P1(x As System.Int32) As System.Int32", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) Assert.Equal("Property Module2.P1(x As System.Int64) As System.Int32", symbolInfo.CandidateSymbols(1).ToTestDisplayString()) End If If True Then Dim node3 As InvocationExpressionSyntax = CompilationUtils.FindBindingText(Of InvocationExpressionSyntax)(compilation, "a.vb", 3) Dim symbolInfo As SymbolInfo = semanticModel.GetSymbolInfo(node3) Assert.Equal(CandidateReason.Inaccessible, symbolInfo.CandidateReason) Assert.Null(symbolInfo.Symbol) Assert.Equal(1, symbolInfo.CandidateSymbols.Length) Assert.Equal("Property Module2.P2(x As System.Int64, y As System.Int32) As System.Int32", symbolInfo.CandidateSymbols(0).ToTestDisplayString()) End If End Sub <Fact, WorkItem(545574, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545574")> Public Sub OverloadWithIntermediateDifferentMember1() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Class A Shared Sub Goo(x As Integer) End Sub End Class Class B Inherits A Shadows Property Goo As Integer End Class Class C Inherits B Overloads Shared Function Goo(x As Object) As Object Return Nothing End Function Shared Sub Bar() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC40004: function 'Goo' conflicts with property 'Goo' in the base class 'B' and should be declared 'Shadows'. Overloads Shared Function Goo(x As Object) As Object ~~~ </expected>) End Sub <Fact, WorkItem(545574, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545574")> Public Sub OverloadWithIntermediateDifferentMember2() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Class A Shared Sub Goo(x As Integer) End Sub End Class Class B Inherits A Overloads Property Goo As Integer End Class Class C Inherits B Overloads Shared Function Goo(x As Object) As Object Return Nothing End Function Shared Sub Bar() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC40004: property 'Goo' conflicts with sub 'Goo' in the base class 'A' and should be declared 'Shadows'. Overloads Property Goo As Integer ~~~ BC40004: function 'Goo' conflicts with property 'Goo' in the base class 'B' and should be declared 'Shadows'. Overloads Shared Function Goo(x As Object) As Object ~~~ </expected>) End Sub <Fact, WorkItem(545574, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545574")> Public Sub OverloadWithIntermediateDifferentMember3() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Interface A Sub Goo(x As Integer) End Interface Interface B Inherits A Shadows Property Goo As Integer End Interface Interface C Inherits B Overloads Function Goo(x As Object) As Object End Interface Class D Shared Sub Bar() Dim q As C = Nothing q.Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC40004: function 'Goo' conflicts with property 'Goo' in the base interface 'B' and should be declared 'Shadows'. Overloads Function Goo(x As Object) As Object ~~~ </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Class A Shared Function Goo() As Integer() Return Nothing End Function End Class Class B Inherits A Overloads Shared Sub Goo() End Sub Sub Main() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32016: 'Public Shared Overloads Sub Goo()' has no parameters and its return type cannot be indexed. Goo(1).ToString() ~~~ </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub2() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Class A Shared Function Goo() As Integer() Return Nothing End Function End Class Class B Inherits A Overloads Shared Sub Goo(optional a as integer = 3) End Sub Sub Main() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC32016: 'Public Shared Overloads Sub Goo([a As Integer = 3])' has no parameters and its return type cannot be indexed. Goo(1).ToString() ~~~ BC30491: Expression does not produce a value. Goo(1).ToString() ~~~~~~ </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub3() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Class A Shared Function Goo() As Integer() Return Nothing End Function End Class Class B Inherits A Overloads Shared Sub Goo(ParamArray a as Integer()) End Sub Sub Main() Goo(1).ToString() End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> </expected>) End Sub <Fact, WorkItem(545520, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545520")> Public Sub OverloadSameSigBetweenFunctionAndSub4() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Interface A Function Goo() As Integer() End Interface Interface B Sub Goo() End Interface Interface C Inherits A, B End Interface Module M1 Sub Main() Dim c As C = Nothing c.Goo(1).ToString() End Sub End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30516: Overload resolution failed because no accessible 'Goo' accepts this number of arguments. c.Goo(1).ToString() ~~~ </expected>) End Sub <Fact, WorkItem(546129, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546129")> Public Sub SameMethodNameDifferentCase() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Module Test Sub Main() Dim a = New class1 Dim O As Object = 5 a.Bb(O) End Sub Friend Class class1 Public Overridable Sub Bb(ByRef y As String) End Sub Public Overridable Sub BB(ByRef y As Short) End Sub End Class End Module ]]></file> </compilation>) compilation.VerifyDiagnostics() End Sub <WorkItem(544657, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544657")> <Fact()> Public Sub Regress14728() Dim compilationDef = <compilation name="Regress14728"> <file name="Program.vb"> Option Strict Off Module Module1 Sub Main() Dim o As New class1 o.CallLateBound("qq", "aa") End Sub Class class1 Private Shared CurrentCycle As Integer Sub CallLateBound(ByVal ParamArray prmarray1() As Object) LateBound(prmarray1.GetUpperBound(0), prmarray1) End Sub Sub LateBound(ByVal ScenDesc As String, ByVal ParamArray prm1() As Object) System.Console.WriteLine(ScenDesc + prm1(0)) End Sub End Class End Module </file> </compilation> Dim Compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(Compilation, expectedOutput:="1qq") End Sub <Fact(), WorkItem(544657, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544657")> Public Sub Regress14728Err() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Option Strict Off Module Module1 Sub Main() Dim o As New class1 o.CallLateBound("qq", "aa") End Sub Class class1 Private Shared CurrentCycle As Integer Sub CallLateBound(ByVal ParamArray prmarray1() As Object) LateBound(prmarray1.GetUpperBound(0), prmarray1) End Sub Sub LateBound(ByVal ScenDesc As String, ByVal ParamArray prm1() As Object) System.Console.WriteLine(ScenDesc + prm1(0)) End Sub Sub LateBound() System.Console.WriteLine("hi") End Sub End Class End Module ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="1qq") End Sub <Fact, WorkItem(546747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546747")> Public Sub Bug16716_1() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ <ProvideMenuResource(1000, 1)> Public NotInheritable Class TNuggetPackage Sub Test() Dim z As New ProvideMenuResourceAttribute(1000, 1) End Sub End Class Public Class ProvideMenuResourceAttribute Inherits System.Attribute Public Sub New(x As Short, y As Integer) End Sub Public Sub New(x As String, y As Integer) End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30519: Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: 'Public Sub New(x As Short, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'Short'. 'Public Sub New(x As String, y As Integer)': Argument matching parameter 'x' narrows from 'Integer' to 'String'. Dim z As New ProvideMenuResourceAttribute(1000, 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </expected>) Dim TNuggetPackage = compilation.GetTypeByMetadataName("TNuggetPackage") Assert.Equal("Sub ProvideMenuResourceAttribute..ctor(x As System.Int16, y As System.Int32)", TNuggetPackage.GetAttributes()(0).AttributeConstructor.ToTestDisplayString()) End Sub <Fact, WorkItem(546747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546747")> Public Sub Bug16716_2() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ <ProvideMenuResource(1000, 1)> Public NotInheritable Class TNuggetPackage End Class Public Class ProvideMenuResourceAttribute Inherits System.Attribute Public Sub New(x As Short, y As String) End Sub Public Sub New(x As String, y As Short) End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30519: Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: 'Public Sub New(x As Short, y As String)': Argument matching parameter 'x' narrows from 'Integer' to 'Short'. 'Public Sub New(x As Short, y As String)': Argument matching parameter 'y' narrows from 'Integer' to 'String'. 'Public Sub New(x As String, y As Short)': Argument matching parameter 'x' narrows from 'Integer' to 'String'. 'Public Sub New(x As String, y As Short)': Argument matching parameter 'y' narrows from 'Integer' to 'Short'. <ProvideMenuResource(1000, 1)> ~~~~~~~~~~~~~~~~~~~ ]]></expected>) End Sub <Fact, WorkItem(546747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546747")> Public Sub Bug16716_3() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ <ProvideMenuResource(1000, 1)> Public NotInheritable Class TNuggetPackage End Class Public Class ProvideMenuResourceAttribute Inherits System.Attribute Public Sub New(x As String, y As Short) End Sub End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30934: Conversion from 'Integer' to 'String' cannot occur in a constant expression used as an argument to an attribute. <ProvideMenuResource(1000, 1)> ~~~~ ]]></expected>) End Sub <Fact, WorkItem(546875, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546875"), WorkItem(530930, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530930")> Public Sub BigVisitor() Dim source = <compilation> <file name="a.vb"> Public Module Test Sub Main() Dim visitor As New ConcreteVisitor() visitor.Visit(New Class090()) End Sub End Module </file> </compilation> Dim libRef = TestReferences.SymbolsTests.BigVisitor Dim start = DateTime.UtcNow CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source, {libRef}).VerifyDiagnostics() Dim elapsed = DateTime.UtcNow - start Assert.InRange(elapsed.TotalSeconds, 0, 5) ' The key is seconds - not minutes - so feel free to loosen. End Sub <Fact> Public Sub CompareSymbolsOriginalDefinition() Dim source = <compilation> <file name="a.vb"> <![CDATA[ Imports System.Runtime.CompilerServices <Assembly: InternalsVisibleTo("Goo")> Public Class Test(Of t1, t2) Public Sub Add(x As t1) End Sub Friend Sub Add(x As t2) End Sub End Class ]]> </file> </compilation> Dim source2 = <compilation name="Goo"> <file name="b.vb"> Public Class Test2 Public Sub Main() Dim x = New Test(Of Integer, Integer)() x.Add(5) End Sub End Class </file> </compilation> Dim comp = CreateCompilationWithMscorlib40(source, options:=TestOptions.ReleaseDll) Dim comp2 = CreateCompilationWithMscorlib40(source2, references:={comp.EmitToImageReference()}) CompilationUtils.AssertTheseDiagnostics(comp2, <expected> BC30521: Overload resolution failed because no accessible 'Add' is most specific for these arguments: 'Public Sub Add(x As Integer)': Not most specific. 'Friend Sub Add(x As Integer)': Not most specific. x.Add(5) ~~~ </expected>) End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688_1() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System Module Module1 Class C0Base Overloads Shared Widening Operator CType(x As C0Base) As NullReferenceException System.Console.Write("CType1") Return Nothing End Operator End Class Class C0 Inherits C0Base Overloads Shared Widening Operator CType(x As C0) As NullReferenceException System.Console.Write("CType2") Return Nothing End Operator End Class Class C1Base Overloads Shared Widening Operator CType(x As C1Base) As NullReferenceException() System.Console.Write("CType3") Return Nothing End Operator End Class Class C1 Inherits C1Base Overloads Shared Widening Operator CType(x As C1) As NullReferenceException() System.Console.Write("CType4") Return Nothing End Operator End Class Sub Main() Dim x1 As Exception = New C0 Dim x2 As Exception() = New C1 End Sub End Module ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="CType2CType4") End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688_2() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System Module Module1 Sub Main() C2.goo(New C2) End Sub Class C2 Public Shared Widening Operator CType(x As C2) As C2() Return New C2() {} End Operator Public Shared Sub goo(x As String) End Sub Public Shared Sub goo(ParamArray y As C2()) Console.WriteLine(y.Length) End Sub End Class End Module ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication).WithOptionStrict(OptionStrict.Off)) CompileAndVerify(compilation, expectedOutput:="1") End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688Err() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System.Collections Module Module1 Sub Main() cls2.Goo("qq", New cls2) End Sub End Module Interface IGetExpression End Interface Interface IExpression Inherits IGetExpression End Interface Class cls0 Implements IExpression End Class Class cls1 Implements IExpression Public Shared Widening Operator CType(x As cls1) As IExpression() System.Console.WriteLine("CType") Return Nothing End Operator End Class Class cls2 Inherits cls1 Public Shared Function Goo(x As String) As String Return x End Function Public Shared Function Goo(x As String, ByVal ParamArray params() As IGetExpression) As String System.Console.WriteLine("Goo") Return Nothing End Function End Class ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30521: Overload resolution failed because no accessible 'Goo' is most specific for these arguments: 'Public Shared Function Goo(x As String, ParamArray params As IGetExpression()) As String': Not most specific. cls2.Goo("qq", New cls2) ~~~ ]]></expected>) End Sub <Fact(), WorkItem(738688, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/738688")> Public Sub Regress738688Err01() Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime( <compilation> <file name="a.vb"><![CDATA[ Option Strict On Imports System Module Module1 Sub Main() C2.goo(New C2) End Sub Interface i1 End Interface Class C2 Implements i1 Public Shared Widening Operator CType(x As C2) As i1() Return New C2() {} End Operator ' uncommenting this will change results in VBC ' Public Shared Sub goo(x as string) ' End Sub Public Shared Sub goo(ParamArray y As i1()) Console.WriteLine(y.Length) End Sub End Class End Module ]]></file> </compilation>) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30521: Overload resolution failed because no accessible 'goo' is most specific for these arguments: 'Public Shared Sub goo(ParamArray y As Module1.i1())': Not most specific. C2.goo(New C2) ~~~ ]]></expected>) End Sub <Fact(), WorkItem(32, "https://roslyn.codeplex.com/workitem/31")> Public Sub BugCodePlex_32() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() Dim b As New B() b.Test(Function() 1) End Sub End Module Class A Sub Test(x As System.Func(Of Integer)) System.Console.WriteLine("A.Test") End Sub End Class Class B Inherits A Overloads Sub Test(Of T)(x As System.Linq.Expressions.Expression(Of System.Func(Of T))) System.Console.WriteLine("B.Test") End Sub End Class ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(compilationDef, {SystemCoreRef}, TestOptions.ReleaseExe) CompileAndVerify(compilation, expectedOutput:="A.Test") End Sub <Fact(), WorkItem(918579, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/918579"), WorkItem(34, "CodePlex")> Public Sub Bug918579_01() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() Dim p As IDerived = New CTest() Dim x = p.X End Sub End Module Public Interface IBase1 ReadOnly Property X As Integer End Interface Public Interface IBase2 ReadOnly Property X As Integer End Interface Public Interface IDerived Inherits IBase1, IBase2 Overloads ReadOnly Property X As Integer End Interface Class CTest Implements IDerived Public ReadOnly Property IDerived_X As Integer Implements IDerived.X Get System.Console.WriteLine("IDerived_X") Return 0 End Get End Property Private ReadOnly Property IBase1_X As Integer Implements IBase1.X Get System.Console.WriteLine("IBase1_X") Return 0 End Get End Property Private ReadOnly Property IBase2_X As Integer Implements IBase2.X Get System.Console.WriteLine("IBase2_X") Return 0 End Get End Property End Class ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation, expectedOutput:="IDerived_X") End Sub <Fact(), WorkItem(918579, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/918579"), WorkItem(34, "CodePlex")> Public Sub Bug918579_02() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() Dim p As IDerived = New CTest() Dim x = p.X(CInt(0)) x = p.X(CShort(0)) x = p.X(CLng(0)) End Sub End Module Public Interface IBase1 ReadOnly Property X(y As Integer) As Integer End Interface Public Interface IBase2 ReadOnly Property X(y As Short) As Integer End Interface Public Interface IDerived Inherits IBase1, IBase2 Overloads ReadOnly Property X(y As Long) As Integer End Interface Class CTest Implements IDerived Public ReadOnly Property IDerived_X(y As Long) As Integer Implements IDerived.X Get System.Console.WriteLine("IDerived_X") Return 0 End Get End Property Private ReadOnly Property IBase1_X(y As Integer) As Integer Implements IBase1.X Get System.Console.WriteLine("IBase1_X") Return 0 End Get End Property Private ReadOnly Property IBase2_X(y As Short) As Integer Implements IBase2.X Get System.Console.WriteLine("IBase2_X") Return 0 End Get End Property End Class ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation, expectedOutput:= "IBase1_X IBase2_X IDerived_X") End Sub <Fact(), WorkItem(918579, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/918579"), WorkItem(34, "CodePlex")> Public Sub Bug918579_03() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() End Sub Sub Test(x as I3) x.M1() End Sub Sub Test(x as I4) x.M1() End Sub End Module Interface I1(Of T) Sub M1() End Interface Interface I2 Inherits I1(Of String) Shadows Sub M1(x as Integer) End Interface Interface I3 Inherits I2, I1(Of Integer) End Interface Interface I4 Inherits I1(Of Integer), I2 End Interface ]]></file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompileAndVerify(compilation) End Sub <Fact, WorkItem(1034429, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1034429")> Public Sub Bug1034429() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Imports System Imports System.Security.Permissions Public Class A Inherits Attribute Public Sub New(ByVal ParamArray p As SecurityAction) End Sub End Class Public Class B Inherits Attribute Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction) End Sub End Class Public Class C Inherits Attribute Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction, ByVal p3 As String) End Sub End Class Module Module1 <A(SecurityAction.Assert)> <B(p2:=SecurityAction.Assert, p1:=0)> <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> Sub Main() End Sub End Module ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30050: ParamArray parameter must be an array. Public Sub New(ByVal ParamArray p As SecurityAction) ~ BC30050: ParamArray parameter must be an array. Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction) ~~ BC30050: ParamArray parameter must be an array. Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction, ByVal p3 As String) ~~ BC30192: End of parameter list expected. Cannot define parameters after a paramarray parameter. Public Sub New(ByVal p1 As Integer, ByVal ParamArray p2 As SecurityAction, ByVal p3 As String) ~~~~~~~~~~~~~~~~~~ BC31092: ParamArray parameters must have an array type. <A(SecurityAction.Assert)> ~ BC30455: Argument not specified for parameter 'p1' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction)'. <B(p2:=SecurityAction.Assert, p1:=0)> ~ BC31092: ParamArray parameters must have an array type. <B(p2:=SecurityAction.Assert, p1:=0)> ~ BC30661: Field or property 'p2' is not found. <B(p2:=SecurityAction.Assert, p1:=0)> ~~ BC30661: Field or property 'p1' is not found. <B(p2:=SecurityAction.Assert, p1:=0)> ~~ BC30455: Argument not specified for parameter 'p1' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction, p3 As String)'. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~ BC30455: Argument not specified for parameter 'p2' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction, p3 As String)'. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~ BC30455: Argument not specified for parameter 'p3' of 'Public Sub New(p1 As Integer, ParamArray p2 As SecurityAction, p3 As String)'. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~ BC30661: Field or property 'p3' is not found. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~~ BC30661: Field or property 'p2' is not found. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~~ BC30661: Field or property 'p1' is not found. <C(p3:="again", p2:=SecurityAction.Assert, p1:=0)> ~~ ]]></expected>) End Sub <Fact, WorkItem(2604, "https://github.com/dotnet/roslyn/issues/2604")> Public Sub FailureDueToAnErrorInALambda_01() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Module Module1 Sub Main() M0(0, Function() doesntexist) M1(0, Function() doesntexist) M2(0, Function() doesntexist) End Sub Sub M0(x As Integer, y As System.Func(Of Integer)) End Sub Sub M1(x As Integer, y As System.Func(Of Integer)) End Sub Sub M1(x As Long, y As System.Func(Of Long)) End Sub Sub M2(x As Integer, y As System.Func(Of Integer)) End Sub Sub M2(x As c1, y As System.Func(Of Long)) End Sub End Module Class c1 End Class ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef, TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30451: 'doesntexist' is not declared. It may be inaccessible due to its protection level. M0(0, Function() doesntexist) ~~~~~~~~~~~ BC30451: 'doesntexist' is not declared. It may be inaccessible due to its protection level. M1(0, Function() doesntexist) ~~~~~~~~~~~ BC30451: 'doesntexist' is not declared. It may be inaccessible due to its protection level. M2(0, Function() doesntexist) ~~~~~~~~~~~ ]]></expected>) End Sub <Fact, WorkItem(4587, "https://github.com/dotnet/roslyn/issues/4587")> Public Sub FailureDueToAnErrorInALambda_02() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Threading.Tasks Imports System.Linq Module Module1 Sub Main() End Sub Private Async Function GetDataAsync(cs As Characters, imax As Integer) As Task Dim Roles = Await cs.GetRoleAsync() Dim RoleTasks = Roles.Select( Async Function(role As Role) As Task Dim Lines = Await role.GetLines() If imax <= LinesKey Then Return Dim SentenceTasks = Lines.Select( Async Function(Sentence) As Task Dim Words = Await Sentence.GetWordsAsync() If imax <= WordsKey Then Return Dim WordTasks = Words.Select( Async Function(Word) As Task Dim Letters = Await Word.GetLettersAsync() If imax <= LettersKey Then Return Dim StrokeTasks = Letters.Select( Async Function(Stroke) As Task Dim endpoints = Await Stroke.GetEndpointsAsync() Await Task.WhenAll(endpoints.ToArray()) End Function) Await Task.WhenAll(StrokeTasks.ToArray()) End Function) Await Task.WhenAll(WordTasks.ToArray()) End Function) Await Task.WhenAll(SentenceTasks.ToArray()) End Function) End Function Function RetryAsync(Of T)(f As Func(Of Task(Of T))) As Task(Of T) Return f() End Function End Module Friend Class Characters Function GetRoleAsync() As Task(Of List(Of Role)) Return Nothing End Function End Class Class Role Function GetLines() As Task(Of List(Of Line)) Return Nothing End Function End Class Public Class Line End Class ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib45AndVBRuntime(compilationDef, references:={SystemCoreRef}, options:=TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30451: 'LinesKey' is not declared. It may be inaccessible due to its protection level. If imax <= LinesKey Then Return ~~~~~~~~ BC30456: 'GetWordsAsync' is not a member of 'Line'. Dim Words = Await Sentence.GetWordsAsync() ~~~~~~~~~~~~~~~~~~~~~~ BC30451: 'WordsKey' is not declared. It may be inaccessible due to its protection level. If imax <= WordsKey Then Return ~~~~~~~~ ]]></expected>) End Sub <Fact, WorkItem(4587, "https://github.com/dotnet/roslyn/issues/4587")> Public Sub FailureDueToAnErrorInALambda_03() Dim compilationDef = <compilation> <file name="a.vb"><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Threading.Tasks Imports System.Linq Module Module1 Sub Main() End Sub Private Async Function GetDataAsync(DeliveryWindow As DeliveryWindow, MaxDepth As Integer) As Task Dim Vendors = Await RetryAsync(Function() DeliveryWindow.GetVendorsAsync()) Dim VendorTasks = Vendors.Select(Async Function(vendor As DeliveryWindowVendor) As Task Dim Departments = Await RetryAsync(Async Function() Await vendor.GetDeliveryWindowDepartmentsAsync()) If MaxDepth <= DepartmentsKey Then Return End If Dim DepartmentTasks = Departments.Select(Async Function(Department) As Task Dim Vendor9s = Await RetryAsync(Async Function() Await Department.GetDeliveryWindowVendor9Async()) If MaxDepth <= Vendor9Key Then Return End If Dim Vendor9Tasks = Vendor9s.Select(Async Function(Vendor9) As Task Dim poTypes = Await RetryAsync(Async Function() Await Vendor9.GetDeliveryWindowPOTypesAsync()) If MaxDepth <= POTypesKey Then Return End If Dim POTypeTasks = poTypes.Select(Async Function(poType) As Task Dim pos = Await RetryAsync(Async Function() Await poType.GetDeliveryWindowPOAsync()) If MaxDepth <= POsKey Then Return End If Dim POTasks = pos.ToList() _ .Select(Async Function(po) As Task Await RetryAsync(Async Function() Await po.GetDeliveryWindowPOLineAsync()) End Function) _ .ToArray() Await Task.WhenAll(POTasks.ToArray()) End Function) Await Task.WhenAll(POTypeTasks.ToArray()) End Function) Await Task.WhenAll(Vendor9Tasks.ToArray()) End Function) Await Task.WhenAll(DepartmentTasks.ToArray()) End Function) Await Task.WhenAll(VendorTasks.ToArray()) End Function Function RetryAsync(Of T)(f As Func(Of Task(Of T))) As Task(Of T) Return f() End Function End Module Friend Class DeliveryWindow Function GetVendorsAsync() As Task(Of List(Of DeliveryWindowVendor)) Return Nothing End Function End Class Class DeliveryWindowVendor Function GetDeliveryWindowDepartmentsAsync() As Task(Of List(Of DeliveryWindowDepartments)) Return Nothing End Function End Class Public Class DeliveryWindowDepartments End Class ]]> </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib45AndVBRuntime(compilationDef, references:={SystemCoreRef}, options:=TestOptions.ReleaseExe) CompilationUtils.AssertTheseDiagnostics(compilation, <expected><![CDATA[ BC30451: 'DepartmentsKey' is not declared. It may be inaccessible due to its protection level. If MaxDepth <= DepartmentsKey Then ~~~~~~~~~~~~~~ BC30456: 'GetDeliveryWindowVendor9Async' is not a member of 'DeliveryWindowDepartments'. Dim Vendor9s = Await RetryAsync(Async Function() Await Department.GetDeliveryWindowVendor9Async()) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC30451: 'Vendor9Key' is not declared. It may be inaccessible due to its protection level. If MaxDepth <= Vendor9Key Then ~~~~~~~~~~ ]]></expected>) End Sub <WorkItem(9341, "https://github.com/dotnet/roslyn/issues/9341")> <Fact()> Public Sub FailureDueToAnErrorInALambda_04() Dim compilationDef = <compilation> <file name="a.vb"> Imports System Module Test Sub Main() Invoke( Sub() M1("error here") End Sub) End Sub Sub M1() End Sub Public Sub Invoke(callback As Action) End Sub Function Invoke(Of TResult)(callback As Func(Of TResult)) As TResult Return Nothing End Function End Module </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC30057: Too many arguments to 'Public Sub M1()'. M1("error here") ~~~~~~~~~~~~ </expected>) End Sub <Fact> <WorkItem(16478, "https://github.com/dotnet/roslyn/issues/16478")> Public Sub AmbiguousInference_01() Dim compilationDef = <compilation> <file name="a.vb"> Imports System Imports System.Collections.Generic Public Class Test Public Shared Sub Assert(Of T)(a As T, b As T) Console.WriteLine("Non collection") End Sub Public Shared Sub Assert(Of T)(a As IEnumerable(Of T), b As IEnumerable(Of T)) Console.WriteLine("Collection") End Sub Public Shared Sub Main() Dim a = {"A"} Dim b = New StringValues() Assert(a, b) Assert(b, a) End Sub Private Class StringValues Inherits List(Of String) Public Shared Widening Operator CType(values As String()) As StringValues Return New StringValues() End Operator Public Shared Widening Operator CType(value As StringValues) As String() Return {} End Operator End Class End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompileAndVerify(compilationDef, expectedOutput:= "Collection Collection") End Sub <Fact> <WorkItem(16478, "https://github.com/dotnet/roslyn/issues/16478")> Public Sub AmbiguousInference_02() Dim compilationDef = <compilation> <file name="a.vb"> Imports System Imports System.Collections.Generic Public Class Test Public Shared Sub Assert(Of T)(a As T, b As T) Console.WriteLine("Non collection") End Sub Public Shared Sub Main() Dim a = {"A"} Dim b = New StringValues() Assert(a, b) Assert(b, a) End Sub Private Class StringValues Inherits List(Of String) Public Shared Widening Operator CType(values As String()) As StringValues Return New StringValues() End Operator Public Shared Widening Operator CType(value As StringValues) As String() Return {} End Operator End Class End Class </file> </compilation> Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) CompilationUtils.AssertTheseDiagnostics(compilation, <expected> BC36651: Data type(s) of the type parameter(s) in method 'Public Shared Sub Assert(Of T)(a As T, b As T)' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error. Assert(a, b) ~~~~~~ BC36651: Data type(s) of the type parameter(s) in method 'Public Shared Sub Assert(Of T)(a As T, b As T)' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error. Assert(b, a) ~~~~~~ </expected>) End Sub End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Test/Core/Compilation/TestStrongNameFileSystem.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.IO; namespace Microsoft.CodeAnalysis.Test.Utilities { internal sealed class TestStrongNameFileSystem : StrongNameFileSystem { internal Func<string, byte[]> ReadAllBytesFunc { get; set; } internal Func<string, FileMode, FileAccess, FileShare, FileStream> CreateFileStreamFunc { get; set; } internal TestStrongNameFileSystem() { ReadAllBytesFunc = base.ReadAllBytes; CreateFileStreamFunc = base.CreateFileStream; } internal override byte[] ReadAllBytes(string fullPath) => ReadAllBytesFunc(fullPath); internal override FileStream CreateFileStream(string filePath, FileMode fileMode, FileAccess fileAccess, FileShare fileShare) => CreateFileStreamFunc(filePath, fileMode, fileAccess, fileShare); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.IO; namespace Microsoft.CodeAnalysis.Test.Utilities { internal sealed class TestStrongNameFileSystem : StrongNameFileSystem { internal Func<string, byte[]> ReadAllBytesFunc { get; set; } internal Func<string, FileMode, FileAccess, FileShare, FileStream> CreateFileStreamFunc { get; set; } internal TestStrongNameFileSystem() { ReadAllBytesFunc = base.ReadAllBytes; CreateFileStreamFunc = base.CreateFileStream; } internal override byte[] ReadAllBytes(string fullPath) => ReadAllBytesFunc(fullPath); internal override FileStream CreateFileStream(string filePath, FileMode fileMode, FileAccess fileAccess, FileShare fileShare) => CreateFileStreamFunc(filePath, fileMode, fileAccess, fileShare); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersFolderItem/AnalyzersFolderItemSource.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections; using System.Collections.ObjectModel; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.Shell; namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer { using Workspace = Microsoft.CodeAnalysis.Workspace; internal class AnalyzersFolderItemSource : IAttachedCollectionSource { private readonly IVsHierarchyItem _projectHierarchyItem; private readonly Workspace _workspace; private readonly ProjectId _projectId; private readonly ObservableCollection<AnalyzersFolderItem> _folderItems; private readonly IAnalyzersCommandHandler _commandHandler; public AnalyzersFolderItemSource(Workspace workspace, ProjectId projectId, IVsHierarchyItem projectHierarchyItem, IAnalyzersCommandHandler commandHandler) { _workspace = workspace; _projectId = projectId; _projectHierarchyItem = projectHierarchyItem; _commandHandler = commandHandler; _folderItems = new ObservableCollection<AnalyzersFolderItem>(); Update(); } public bool HasItems { get { return true; } } public IEnumerable Items { get { return _folderItems; } } public object SourceItem { get { return _projectHierarchyItem; } } internal void Update() { // Don't create the item a 2nd time. if (_folderItems.Any()) { return; } _folderItems.Add( new AnalyzersFolderItem( _workspace, _projectId, _projectHierarchyItem, _commandHandler.AnalyzerFolderContextMenuController)); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections; using System.Collections.ObjectModel; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.Shell; namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer { using Workspace = Microsoft.CodeAnalysis.Workspace; internal class AnalyzersFolderItemSource : IAttachedCollectionSource { private readonly IVsHierarchyItem _projectHierarchyItem; private readonly Workspace _workspace; private readonly ProjectId _projectId; private readonly ObservableCollection<AnalyzersFolderItem> _folderItems; private readonly IAnalyzersCommandHandler _commandHandler; public AnalyzersFolderItemSource(Workspace workspace, ProjectId projectId, IVsHierarchyItem projectHierarchyItem, IAnalyzersCommandHandler commandHandler) { _workspace = workspace; _projectId = projectId; _projectHierarchyItem = projectHierarchyItem; _commandHandler = commandHandler; _folderItems = new ObservableCollection<AnalyzersFolderItem>(); Update(); } public bool HasItems { get { return true; } } public IEnumerable Items { get { return _folderItems; } } public object SourceItem { get { return _projectHierarchyItem; } } internal void Update() { // Don't create the item a 2nd time. if (_folderItems.Any()) { return; } _folderItems.Add( new AnalyzersFolderItem( _workspace, _projectId, _projectHierarchyItem, _commandHandler.AnalyzerFolderContextMenuController)); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Tools/BuildValidator/BuildValidator.csproj
<?xml version="1.0" encoding="utf-8"?> <!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks> <PlatformTarget>AnyCPU</PlatformTarget> <Nullable>enable</Nullable> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup Label="Project References"> <ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" /> <ProjectReference Include="..\..\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj" /> <ProjectReference Include="..\..\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" /> <ProjectReference Include="..\..\Compilers\Core\Rebuild\Microsoft.CodeAnalysis.Rebuild.csproj" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingVersion)" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsoleVersion)" /> <PackageReference Include="Microsoft.Win32.Registry" Version="$(MicrosoftWin32RegistryVersion)" /> <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" /> <PackageReference Include="Microsoft.Metadata.Visualizer" Version="$(MicrosoftMetadataVisualizerVersion)" /> <PackageReference Include="Microsoft.DiaSymReader.Converter.Xml" Version="$(MicrosoftDiaSymReaderConverterXmlVersion)" /> <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" /> <PackageReference Include="System.CommandLine" Version="$(SystemCommandLineVersion)" /> </ItemGroup> <ItemGroup> <EmbeddedResource Update="BuildValidatorResources.resx" GenerateSource="true" /> </ItemGroup> <Import Project="$(RepositoryEngineeringDir)targets\ILDAsm.targets" /> </Project>
<?xml version="1.0" encoding="utf-8"?> <!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks> <PlatformTarget>AnyCPU</PlatformTarget> <Nullable>enable</Nullable> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup Label="Project References"> <ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" /> <ProjectReference Include="..\..\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj" /> <ProjectReference Include="..\..\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" /> <ProjectReference Include="..\..\Compilers\Core\Rebuild\Microsoft.CodeAnalysis.Rebuild.csproj" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingVersion)" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsoleVersion)" /> <PackageReference Include="Microsoft.Win32.Registry" Version="$(MicrosoftWin32RegistryVersion)" /> <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" /> <PackageReference Include="Microsoft.Metadata.Visualizer" Version="$(MicrosoftMetadataVisualizerVersion)" /> <PackageReference Include="Microsoft.DiaSymReader.Converter.Xml" Version="$(MicrosoftDiaSymReaderConverterXmlVersion)" /> <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" /> <PackageReference Include="System.CommandLine" Version="$(SystemCommandLineVersion)" /> </ItemGroup> <ItemGroup> <EmbeddedResource Update="BuildValidatorResources.resx" GenerateSource="true" /> </ItemGroup> <Import Project="$(RepositoryEngineeringDir)targets\ILDAsm.targets" /> </Project>
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/CSharpTest/SplitOrMergeIfStatements/MergeConsecutiveIfStatementsTests_Statements_WithNext.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SplitOrMergeIfStatements { public sealed partial class MergeConsecutiveIfStatementsTests { [Theory] [InlineData("[||]if (a)")] [InlineData("i[||]f (a)")] [InlineData("if[||] (a)")] [InlineData("if [||](a)")] [InlineData("if (a)[||]")] [InlineData("[|if|] (a)")] [InlineData("[|if (a)|]")] public async Task MergedIntoNextStatementOnIfSpans(string ifLine) { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { " + ifLine + @" return; if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Fact] public async Task MergedIntoNextStatementOnIfExtendedHeaderSelection() { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [| if (a) return; |] if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Fact] public async Task MergedIntoNextStatementOnIfFullSelection() { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [|if (a) return;|] if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Fact] public async Task MergedIntoNextStatementOnIfExtendedFullSelection() { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [| if (a) return; |] if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Theory] [InlineData("if ([||]a)")] [InlineData("[|i|]f (a)")] [InlineData("[|if (|]a)")] [InlineData("if [|(|]a)")] [InlineData("if (a[|)|]")] [InlineData("if ([|a|])")] [InlineData("if [|(a)|]")] public async Task NotMergedIntoNextStatementOnIfSpans(string ifLine) { await TestMissingInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { " + ifLine + @" return; if (b) return; } }"); } [Fact] public async Task NotMergedIntoNextStatementOnIfOverreachingSelection() { await TestMissingInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [|if (a) |] return; if (b) return; } }"); } [Fact] public async Task NotMergedIntoNextStatementOnIfBodySelection() { await TestMissingInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { if (a) [|return;|] if (b) return; } }"); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SplitOrMergeIfStatements { public sealed partial class MergeConsecutiveIfStatementsTests { [Theory] [InlineData("[||]if (a)")] [InlineData("i[||]f (a)")] [InlineData("if[||] (a)")] [InlineData("if [||](a)")] [InlineData("if (a)[||]")] [InlineData("[|if|] (a)")] [InlineData("[|if (a)|]")] public async Task MergedIntoNextStatementOnIfSpans(string ifLine) { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { " + ifLine + @" return; if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Fact] public async Task MergedIntoNextStatementOnIfExtendedHeaderSelection() { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [| if (a) return; |] if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Fact] public async Task MergedIntoNextStatementOnIfFullSelection() { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [|if (a) return;|] if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Fact] public async Task MergedIntoNextStatementOnIfExtendedFullSelection() { await TestInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [| if (a) return; |] if (b) return; } }", @"class C { void M(bool a, bool b) { if (a || b) return; } }"); } [Theory] [InlineData("if ([||]a)")] [InlineData("[|i|]f (a)")] [InlineData("[|if (|]a)")] [InlineData("if [|(|]a)")] [InlineData("if (a[|)|]")] [InlineData("if ([|a|])")] [InlineData("if [|(a)|]")] public async Task NotMergedIntoNextStatementOnIfSpans(string ifLine) { await TestMissingInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { " + ifLine + @" return; if (b) return; } }"); } [Fact] public async Task NotMergedIntoNextStatementOnIfOverreachingSelection() { await TestMissingInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { [|if (a) |] return; if (b) return; } }"); } [Fact] public async Task NotMergedIntoNextStatementOnIfBodySelection() { await TestMissingInRegularAndScriptAsync( @"class C { void M(bool a, bool b) { if (a) [|return;|] if (b) return; } }"); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Tools/ExternalAccess/Apex/PublicAPI.Unshipped.txt
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/VisualStudio/Core/Def/Implementation/Utilities/IVsEnumDebugName.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Runtime.InteropServices; using Microsoft.VisualStudio.TextManager.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Utilities { [ComImport] [Guid("9AD7EC03-4157-45B4-A999-403D6DB94578")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IVsEnumDebugName { [PreserveSig] int Next(uint celt, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface)] IVsDebugName[] rgelt, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4)] uint[] pceltFetched); [PreserveSig] int Skip(uint celt); [PreserveSig] int Reset(); [PreserveSig] int Clone(out IVsEnumDebugName ppEnum); [PreserveSig] int GetCount(out uint pceltCount); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Runtime.InteropServices; using Microsoft.VisualStudio.TextManager.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Utilities { [ComImport] [Guid("9AD7EC03-4157-45B4-A999-403D6DB94578")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IVsEnumDebugName { [PreserveSig] int Next(uint celt, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Interface)] IVsDebugName[] rgelt, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4)] uint[] pceltFetched); [PreserveSig] int Skip(uint celt); [PreserveSig] int Reset(); [PreserveSig] int Clone(out IVsEnumDebugName ppEnum); [PreserveSig] int GetCount(out uint pceltCount); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Analyzers/CSharp/Analyzers/UsePatternCombinators/AnalyzedPattern.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.UsePatternCombinators { /// <summary> /// Base class to represent a pattern constructed from various checks /// </summary> internal abstract class AnalyzedPattern { public readonly IOperation Target; private AnalyzedPattern(IOperation target) => Target = target; /// <summary> /// Represents a type-pattern, constructed from an is-expression /// </summary> internal sealed class Type : AnalyzedPattern { public readonly TypeSyntax TypeSyntax; public Type(TypeSyntax type, IOperation target) : base(target) => TypeSyntax = type; } /// <summary> /// Represents a source-pattern, constructed from C# patterns /// </summary> internal sealed class Source : AnalyzedPattern { public readonly PatternSyntax PatternSyntax; public Source(PatternSyntax patternSyntax, IOperation target) : base(target) => PatternSyntax = patternSyntax; } /// <summary> /// Represents a constant-pattern, constructed from an equality check /// </summary> internal sealed class Constant : AnalyzedPattern { public readonly ExpressionSyntax ExpressionSyntax; public Constant(ExpressionSyntax expression, IOperation target) : base(target) => ExpressionSyntax = expression; } /// <summary> /// Represents a relational-pattern, constructed from relational operators /// </summary> internal sealed class Relational : AnalyzedPattern { public readonly BinaryOperatorKind OperatorKind; public readonly ExpressionSyntax Value; public Relational(BinaryOperatorKind operatorKind, ExpressionSyntax value, IOperation target) : base(target) { OperatorKind = operatorKind; Value = value; } } /// <summary> /// Represents an and/or pattern, constructed from a logical and/or expression. /// </summary> internal sealed class Binary : AnalyzedPattern { public readonly AnalyzedPattern Left; public readonly AnalyzedPattern Right; public readonly bool IsDisjunctive; public readonly SyntaxToken Token; private Binary(AnalyzedPattern leftPattern, AnalyzedPattern rightPattern, bool isDisjunctive, SyntaxToken token, IOperation target) : base(target) { Left = leftPattern; Right = rightPattern; IsDisjunctive = isDisjunctive; Token = token; } public static AnalyzedPattern? TryCreate(AnalyzedPattern leftPattern, AnalyzedPattern rightPattern, bool isDisjunctive, SyntaxToken token) { var leftTarget = leftPattern.Target; var rightTarget = rightPattern.Target; var leftConv = (leftTarget as IConversionOperation)?.Conversion; var rightConv = (rightTarget as IConversionOperation)?.Conversion; var target = (leftConv, rightConv) switch { ({ IsUserDefined: true }, _) or (_, { IsUserDefined: true }) => null, // If the original targets are implicitly converted due to usage of operators, // both targets must have been converted to the same type, otherwise we bail. ({ IsImplicit: true }, { IsImplicit: true }) when !Equals(leftTarget.Type, rightTarget.Type) => null, // If either of targets are implicitly converted but not both, // we take the conversion node so that we can generate a cast off of it. (null, { IsImplicit: true }) => rightTarget, ({ IsImplicit: true }, null) => leftTarget, // If no implicit conversion is present, we just pick either side and continue. _ => leftTarget, }; if (target is null) return null; var compareTarget = target == leftTarget ? rightTarget : leftTarget; if (!SyntaxFactory.AreEquivalent(target.Syntax, compareTarget.Syntax)) return null; return new Binary(leftPattern, rightPattern, isDisjunctive, token, target); } } /// <summary> /// Represents a not-pattern, constructed from inequality check or a logical-not expression. /// </summary> internal sealed class Not : AnalyzedPattern { public readonly AnalyzedPattern Pattern; private Not(AnalyzedPattern pattern, IOperation target) : base(target) => Pattern = pattern; private static BinaryOperatorKind Negate(BinaryOperatorKind kind) { return kind switch { BinaryOperatorKind.LessThan => BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.GreaterThan => BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.LessThanOrEqual => BinaryOperatorKind.GreaterThan, BinaryOperatorKind.GreaterThanOrEqual => BinaryOperatorKind.LessThan, var v => throw ExceptionUtilities.UnexpectedValue(v) }; } public static AnalyzedPattern? TryCreate(AnalyzedPattern? pattern) { return pattern switch { null => null, Not p => p.Pattern, // Avoid double negative Relational p => new Relational(Negate(p.OperatorKind), p.Value, p.Target), Binary { Left: Not left, Right: Not right } p // Apply demorgans's law => Binary.TryCreate(left.Pattern, right.Pattern, !p.IsDisjunctive, p.Token), _ => new Not(pattern, pattern.Target) }; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.UsePatternCombinators { /// <summary> /// Base class to represent a pattern constructed from various checks /// </summary> internal abstract class AnalyzedPattern { public readonly IOperation Target; private AnalyzedPattern(IOperation target) => Target = target; /// <summary> /// Represents a type-pattern, constructed from an is-expression /// </summary> internal sealed class Type : AnalyzedPattern { public readonly TypeSyntax TypeSyntax; public Type(TypeSyntax type, IOperation target) : base(target) => TypeSyntax = type; } /// <summary> /// Represents a source-pattern, constructed from C# patterns /// </summary> internal sealed class Source : AnalyzedPattern { public readonly PatternSyntax PatternSyntax; public Source(PatternSyntax patternSyntax, IOperation target) : base(target) => PatternSyntax = patternSyntax; } /// <summary> /// Represents a constant-pattern, constructed from an equality check /// </summary> internal sealed class Constant : AnalyzedPattern { public readonly ExpressionSyntax ExpressionSyntax; public Constant(ExpressionSyntax expression, IOperation target) : base(target) => ExpressionSyntax = expression; } /// <summary> /// Represents a relational-pattern, constructed from relational operators /// </summary> internal sealed class Relational : AnalyzedPattern { public readonly BinaryOperatorKind OperatorKind; public readonly ExpressionSyntax Value; public Relational(BinaryOperatorKind operatorKind, ExpressionSyntax value, IOperation target) : base(target) { OperatorKind = operatorKind; Value = value; } } /// <summary> /// Represents an and/or pattern, constructed from a logical and/or expression. /// </summary> internal sealed class Binary : AnalyzedPattern { public readonly AnalyzedPattern Left; public readonly AnalyzedPattern Right; public readonly bool IsDisjunctive; public readonly SyntaxToken Token; private Binary(AnalyzedPattern leftPattern, AnalyzedPattern rightPattern, bool isDisjunctive, SyntaxToken token, IOperation target) : base(target) { Left = leftPattern; Right = rightPattern; IsDisjunctive = isDisjunctive; Token = token; } public static AnalyzedPattern? TryCreate(AnalyzedPattern leftPattern, AnalyzedPattern rightPattern, bool isDisjunctive, SyntaxToken token) { var leftTarget = leftPattern.Target; var rightTarget = rightPattern.Target; var leftConv = (leftTarget as IConversionOperation)?.Conversion; var rightConv = (rightTarget as IConversionOperation)?.Conversion; var target = (leftConv, rightConv) switch { ({ IsUserDefined: true }, _) or (_, { IsUserDefined: true }) => null, // If the original targets are implicitly converted due to usage of operators, // both targets must have been converted to the same type, otherwise we bail. ({ IsImplicit: true }, { IsImplicit: true }) when !Equals(leftTarget.Type, rightTarget.Type) => null, // If either of targets are implicitly converted but not both, // we take the conversion node so that we can generate a cast off of it. (null, { IsImplicit: true }) => rightTarget, ({ IsImplicit: true }, null) => leftTarget, // If no implicit conversion is present, we just pick either side and continue. _ => leftTarget, }; if (target is null) return null; var compareTarget = target == leftTarget ? rightTarget : leftTarget; if (!SyntaxFactory.AreEquivalent(target.Syntax, compareTarget.Syntax)) return null; return new Binary(leftPattern, rightPattern, isDisjunctive, token, target); } } /// <summary> /// Represents a not-pattern, constructed from inequality check or a logical-not expression. /// </summary> internal sealed class Not : AnalyzedPattern { public readonly AnalyzedPattern Pattern; private Not(AnalyzedPattern pattern, IOperation target) : base(target) => Pattern = pattern; private static BinaryOperatorKind Negate(BinaryOperatorKind kind) { return kind switch { BinaryOperatorKind.LessThan => BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.GreaterThan => BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.LessThanOrEqual => BinaryOperatorKind.GreaterThan, BinaryOperatorKind.GreaterThanOrEqual => BinaryOperatorKind.LessThan, var v => throw ExceptionUtilities.UnexpectedValue(v) }; } public static AnalyzedPattern? TryCreate(AnalyzedPattern? pattern) { return pattern switch { null => null, Not p => p.Pattern, // Avoid double negative Relational p => new Relational(Negate(p.OperatorKind), p.Value, p.Target), Binary { Left: Not left, Right: Not right } p // Apply demorgans's law => Binary.TryCreate(left.Pattern, right.Pattern, !p.IsDisjunctive, p.Token), _ => new Not(pattern, pattern.Target) }; } } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Features/CSharp/Portable/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixHelper.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.CSharp.CodeGeneration; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.FindSymbols; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic { internal static class MakeLocalFunctionStaticCodeFixHelper { public static async Task<Document> MakeLocalFunctionStaticAsync( Document document, LocalFunctionStatementSyntax localFunction, ImmutableArray<ISymbol> captures, CancellationToken cancellationToken) { var root = (await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false))!; var syntaxEditor = new SyntaxEditor(root, document.Project.Solution.Workspace); await MakeLocalFunctionStaticAsync(document, localFunction, captures, syntaxEditor, cancellationToken).ConfigureAwait(false); return document.WithSyntaxRoot(syntaxEditor.GetChangedRoot()); } public static async Task MakeLocalFunctionStaticAsync( Document document, LocalFunctionStatementSyntax localFunction, ImmutableArray<ISymbol> captures, SyntaxEditor syntaxEditor, CancellationToken cancellationToken) { var root = (await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false))!; var semanticModel = (await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false))!; var localFunctionSymbol = semanticModel.GetDeclaredSymbol(localFunction, cancellationToken); Contract.ThrowIfNull(localFunctionSymbol, "We should have gotten a method symbol for a local function."); var documentImmutableSet = ImmutableHashSet.Create(document); // Finds all the call sites of the local function var referencedSymbols = await SymbolFinder.FindReferencesAsync( localFunctionSymbol, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); // Now we need to find all the references to the local function that we might need to fix. var shouldWarn = false; using var builderDisposer = ArrayBuilder<InvocationExpressionSyntax>.GetInstance(out var invocations); foreach (var referencedSymbol in referencedSymbols) { foreach (var location in referencedSymbol.Locations) { // We limited the search scope to the single document, // so all reference should be in the same tree. var referenceNode = root.FindNode(location.Location.SourceSpan); if (!(referenceNode is IdentifierNameSyntax identifierNode)) { // Unexpected scenario, skip and warn. shouldWarn = true; continue; } if (identifierNode.Parent is InvocationExpressionSyntax invocation) { invocations.Add(invocation); } else { // We won't be able to fix non-invocation references, // e.g. creating a delegate. shouldWarn = true; } } } var parameterAndCapturedSymbols = CreateParameterSymbols(captures); // Fix all invocations by passing in additional arguments. foreach (var invocation in invocations) { syntaxEditor.ReplaceNode( invocation, (node, generator) => { var currentInvocation = (InvocationExpressionSyntax)node; var seenNamedArgument = currentInvocation.ArgumentList.Arguments.Any(a => a.NameColon != null); var seenDefaultArgumentValue = currentInvocation.ArgumentList.Arguments.Count < localFunction.ParameterList.Parameters.Count; var newArguments = parameterAndCapturedSymbols.Select( p => (ArgumentSyntax)generator.Argument( seenNamedArgument || seenDefaultArgumentValue ? p.symbol.Name : null, p.symbol.RefKind, p.capture.Name.ToIdentifierName())); var newArgList = currentInvocation.ArgumentList.WithArguments(currentInvocation.ArgumentList.Arguments.AddRange(newArguments)); return currentInvocation.WithArgumentList(newArgList); }); } // In case any of the captured variable isn't camel-cased, // we need to change the referenced name inside local function to use the new parameter's name. foreach (var (parameter, capture) in parameterAndCapturedSymbols) { if (parameter.Name == capture.Name) { continue; } var referencedCaptureSymbols = await SymbolFinder.FindReferencesAsync( capture, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); foreach (var referencedSymbol in referencedCaptureSymbols) { foreach (var location in referencedSymbol.Locations) { var referenceSpan = location.Location.SourceSpan; if (!localFunction.FullSpan.Contains(referenceSpan)) { continue; } var referenceNode = root.FindNode(referenceSpan); if (referenceNode is IdentifierNameSyntax identifierNode) { syntaxEditor.ReplaceNode( identifierNode, (node, generator) => generator.IdentifierName(parameter.Name.ToIdentifierToken()).WithTriviaFrom(node)); } } } } // Updates the local function declaration with variables passed in as parameters syntaxEditor.ReplaceNode( localFunction, (node, generator) => { var localFunctionWithNewParameters = CodeGenerator.AddParameterDeclarations( node, parameterAndCapturedSymbols.SelectAsArray(p => p.symbol), document.Project.Solution.Workspace); if (shouldWarn) { var annotation = WarningAnnotation.Create(CSharpCodeFixesResources.Warning_colon_Adding_parameters_to_local_function_declaration_may_produce_invalid_code); localFunctionWithNewParameters = localFunctionWithNewParameters.WithAdditionalAnnotations(annotation); } return AddStaticModifier(localFunctionWithNewParameters, CSharpSyntaxGenerator.Instance); }); } public static SyntaxNode AddStaticModifier(SyntaxNode localFunction, SyntaxGenerator generator) => generator.WithModifiers( localFunction, generator.GetModifiers(localFunction).WithIsStatic(true)); /// <summary> /// Creates a new parameter symbol paired with the original captured symbol for each captured variables. /// </summary> private static ImmutableArray<(IParameterSymbol symbol, ISymbol capture)> CreateParameterSymbols(ImmutableArray<ISymbol> captures) => captures.SelectAsArray(static c => { var symbolType = c.GetSymbolType(); Contract.ThrowIfNull(symbolType); return (CodeGenerationSymbolFactory.CreateParameterSymbol( attributes: default, refKind: RefKind.None, isParams: false, type: symbolType, name: c.Name.ToCamelCase()), c); }); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.CSharp.CodeGeneration; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.FindSymbols; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic { internal static class MakeLocalFunctionStaticCodeFixHelper { public static async Task<Document> MakeLocalFunctionStaticAsync( Document document, LocalFunctionStatementSyntax localFunction, ImmutableArray<ISymbol> captures, CancellationToken cancellationToken) { var root = (await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false))!; var syntaxEditor = new SyntaxEditor(root, document.Project.Solution.Workspace); await MakeLocalFunctionStaticAsync(document, localFunction, captures, syntaxEditor, cancellationToken).ConfigureAwait(false); return document.WithSyntaxRoot(syntaxEditor.GetChangedRoot()); } public static async Task MakeLocalFunctionStaticAsync( Document document, LocalFunctionStatementSyntax localFunction, ImmutableArray<ISymbol> captures, SyntaxEditor syntaxEditor, CancellationToken cancellationToken) { var root = (await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false))!; var semanticModel = (await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false))!; var localFunctionSymbol = semanticModel.GetDeclaredSymbol(localFunction, cancellationToken); Contract.ThrowIfNull(localFunctionSymbol, "We should have gotten a method symbol for a local function."); var documentImmutableSet = ImmutableHashSet.Create(document); // Finds all the call sites of the local function var referencedSymbols = await SymbolFinder.FindReferencesAsync( localFunctionSymbol, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); // Now we need to find all the references to the local function that we might need to fix. var shouldWarn = false; using var builderDisposer = ArrayBuilder<InvocationExpressionSyntax>.GetInstance(out var invocations); foreach (var referencedSymbol in referencedSymbols) { foreach (var location in referencedSymbol.Locations) { // We limited the search scope to the single document, // so all reference should be in the same tree. var referenceNode = root.FindNode(location.Location.SourceSpan); if (!(referenceNode is IdentifierNameSyntax identifierNode)) { // Unexpected scenario, skip and warn. shouldWarn = true; continue; } if (identifierNode.Parent is InvocationExpressionSyntax invocation) { invocations.Add(invocation); } else { // We won't be able to fix non-invocation references, // e.g. creating a delegate. shouldWarn = true; } } } var parameterAndCapturedSymbols = CreateParameterSymbols(captures); // Fix all invocations by passing in additional arguments. foreach (var invocation in invocations) { syntaxEditor.ReplaceNode( invocation, (node, generator) => { var currentInvocation = (InvocationExpressionSyntax)node; var seenNamedArgument = currentInvocation.ArgumentList.Arguments.Any(a => a.NameColon != null); var seenDefaultArgumentValue = currentInvocation.ArgumentList.Arguments.Count < localFunction.ParameterList.Parameters.Count; var newArguments = parameterAndCapturedSymbols.Select( p => (ArgumentSyntax)generator.Argument( seenNamedArgument || seenDefaultArgumentValue ? p.symbol.Name : null, p.symbol.RefKind, p.capture.Name.ToIdentifierName())); var newArgList = currentInvocation.ArgumentList.WithArguments(currentInvocation.ArgumentList.Arguments.AddRange(newArguments)); return currentInvocation.WithArgumentList(newArgList); }); } // In case any of the captured variable isn't camel-cased, // we need to change the referenced name inside local function to use the new parameter's name. foreach (var (parameter, capture) in parameterAndCapturedSymbols) { if (parameter.Name == capture.Name) { continue; } var referencedCaptureSymbols = await SymbolFinder.FindReferencesAsync( capture, document.Project.Solution, documentImmutableSet, cancellationToken).ConfigureAwait(false); foreach (var referencedSymbol in referencedCaptureSymbols) { foreach (var location in referencedSymbol.Locations) { var referenceSpan = location.Location.SourceSpan; if (!localFunction.FullSpan.Contains(referenceSpan)) { continue; } var referenceNode = root.FindNode(referenceSpan); if (referenceNode is IdentifierNameSyntax identifierNode) { syntaxEditor.ReplaceNode( identifierNode, (node, generator) => generator.IdentifierName(parameter.Name.ToIdentifierToken()).WithTriviaFrom(node)); } } } } // Updates the local function declaration with variables passed in as parameters syntaxEditor.ReplaceNode( localFunction, (node, generator) => { var localFunctionWithNewParameters = CodeGenerator.AddParameterDeclarations( node, parameterAndCapturedSymbols.SelectAsArray(p => p.symbol), document.Project.Solution.Workspace); if (shouldWarn) { var annotation = WarningAnnotation.Create(CSharpCodeFixesResources.Warning_colon_Adding_parameters_to_local_function_declaration_may_produce_invalid_code); localFunctionWithNewParameters = localFunctionWithNewParameters.WithAdditionalAnnotations(annotation); } return AddStaticModifier(localFunctionWithNewParameters, CSharpSyntaxGenerator.Instance); }); } public static SyntaxNode AddStaticModifier(SyntaxNode localFunction, SyntaxGenerator generator) => generator.WithModifiers( localFunction, generator.GetModifiers(localFunction).WithIsStatic(true)); /// <summary> /// Creates a new parameter symbol paired with the original captured symbol for each captured variables. /// </summary> private static ImmutableArray<(IParameterSymbol symbol, ISymbol capture)> CreateParameterSymbols(ImmutableArray<ISymbol> captures) => captures.SelectAsArray(static c => { var symbolType = c.GetSymbolType(); Contract.ThrowIfNull(symbolType); return (CodeGenerationSymbolFactory.CreateParameterSymbol( attributes: default, refKind: RefKind.None, isParams: false, type: symbolType, name: c.Name.ToCamelCase()), c); }); } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Features/Core/Portable/GenerateMember/AbstractGenerateMemberService.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.GenerateMember { internal abstract partial class AbstractGenerateMemberService<TSimpleNameSyntax, TExpressionSyntax> where TSimpleNameSyntax : TExpressionSyntax where TExpressionSyntax : SyntaxNode { protected AbstractGenerateMemberService() { } protected static readonly ISet<TypeKind> EnumType = new HashSet<TypeKind> { TypeKind.Enum }; protected static readonly ISet<TypeKind> ClassInterfaceModuleStructTypes = new HashSet<TypeKind> { TypeKind.Class, TypeKind.Module, TypeKind.Struct, TypeKind.Interface }; protected static bool ValidateTypeToGenerateIn( INamedTypeSymbol typeToGenerateIn, bool isStatic, ISet<TypeKind> typeKinds) { if (typeToGenerateIn == null) { return false; } if (typeToGenerateIn.IsAnonymousType) { return false; } if (!typeKinds.Contains(typeToGenerateIn.TypeKind)) { return false; } if (typeToGenerateIn.TypeKind == TypeKind.Interface && isStatic) { return false; } // TODO(cyrusn): Make sure that there is a totally visible part somewhere (i.e. // venus) that we can generate into. var locations = typeToGenerateIn.Locations; return locations.Any(loc => loc.IsInSource); } protected static bool TryDetermineTypeToGenerateIn( SemanticDocument document, INamedTypeSymbol containingType, TExpressionSyntax simpleNameOrMemberAccessExpression, CancellationToken cancellationToken, out INamedTypeSymbol typeToGenerateIn, out bool isStatic) { TryDetermineTypeToGenerateInWorker( document, containingType, simpleNameOrMemberAccessExpression, cancellationToken, out typeToGenerateIn, out isStatic); if (typeToGenerateIn != null) { typeToGenerateIn = typeToGenerateIn.OriginalDefinition; } return typeToGenerateIn != null; } private static void TryDetermineTypeToGenerateInWorker( SemanticDocument semanticDocument, INamedTypeSymbol containingType, TExpressionSyntax expression, CancellationToken cancellationToken, out INamedTypeSymbol typeToGenerateIn, out bool isStatic) { typeToGenerateIn = null; isStatic = false; var syntaxFacts = semanticDocument.Document.GetLanguageService<ISyntaxFactsService>(); var semanticModel = semanticDocument.SemanticModel; if (syntaxFacts.IsSimpleMemberAccessExpression(expression)) { // Figure out what's before the dot. For VB, that also means finding out // what ".X" might mean, even when there's nothing before the dot itself. var beforeDotExpression = syntaxFacts.GetExpressionOfMemberAccessExpression( expression, allowImplicitTarget: true); if (beforeDotExpression != null) { DetermineTypeToGenerateInWorker( semanticModel, beforeDotExpression, out typeToGenerateIn, out isStatic, cancellationToken); } return; } if (syntaxFacts.IsConditionalAccessExpression(expression)) { var beforeDotExpression = syntaxFacts.GetExpressionOfConditionalAccessExpression(expression); if (beforeDotExpression != null) { DetermineTypeToGenerateInWorker( semanticModel, beforeDotExpression, out typeToGenerateIn, out isStatic, cancellationToken); if (typeToGenerateIn.IsNullable(out var underlyingType) && underlyingType is INamedTypeSymbol underlyingNamedType) { typeToGenerateIn = underlyingNamedType; } } return; } if (syntaxFacts.IsPointerMemberAccessExpression(expression)) { var beforeArrowExpression = syntaxFacts.GetExpressionOfMemberAccessExpression(expression); if (beforeArrowExpression != null) { var typeInfo = semanticModel.GetTypeInfo(beforeArrowExpression, cancellationToken); if (typeInfo.Type.IsPointerType()) { typeToGenerateIn = ((IPointerTypeSymbol)typeInfo.Type).PointedAtType as INamedTypeSymbol; isStatic = false; } } return; } if (syntaxFacts.IsAttributeNamedArgumentIdentifier(expression)) { var attributeNode = expression.GetAncestors().FirstOrDefault(syntaxFacts.IsAttribute); var attributeName = syntaxFacts.GetNameOfAttribute(attributeNode); var attributeType = semanticModel.GetTypeInfo(attributeName, cancellationToken); typeToGenerateIn = attributeType.Type as INamedTypeSymbol; isStatic = false; return; } if (syntaxFacts.IsMemberInitializerNamedAssignmentIdentifier( expression, out var initializedObject)) { typeToGenerateIn = semanticModel.GetTypeInfo(initializedObject, cancellationToken).Type as INamedTypeSymbol; isStatic = false; return; } else if (syntaxFacts.IsNameOfSubpattern(expression)) { var propertyPatternClause = expression.Ancestors().FirstOrDefault(syntaxFacts.IsPropertyPatternClause); if (propertyPatternClause != null) { // something like: { [|X|]: int i } or like: Blah { [|X|]: int i } var inferenceService = semanticDocument.Document.GetLanguageService<ITypeInferenceService>(); typeToGenerateIn = inferenceService.InferType(semanticModel, propertyPatternClause, objectAsDefault: true, cancellationToken) as INamedTypeSymbol; isStatic = false; return; } } // Generating into the containing type. typeToGenerateIn = containingType; isStatic = syntaxFacts.IsInStaticContext(expression); } private static void DetermineTypeToGenerateInWorker( SemanticModel semanticModel, SyntaxNode expression, out INamedTypeSymbol typeToGenerateIn, out bool isStatic, CancellationToken cancellationToken) { var typeInfo = semanticModel.GetTypeInfo(expression, cancellationToken); var semanticInfo = semanticModel.GetSymbolInfo(expression, cancellationToken); typeToGenerateIn = typeInfo.Type is ITypeParameterSymbol typeParameter ? typeParameter.GetNamedTypeSymbolConstraint() : typeInfo.Type as INamedTypeSymbol; isStatic = semanticInfo.Symbol is INamedTypeSymbol; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.GenerateMember { internal abstract partial class AbstractGenerateMemberService<TSimpleNameSyntax, TExpressionSyntax> where TSimpleNameSyntax : TExpressionSyntax where TExpressionSyntax : SyntaxNode { protected AbstractGenerateMemberService() { } protected static readonly ISet<TypeKind> EnumType = new HashSet<TypeKind> { TypeKind.Enum }; protected static readonly ISet<TypeKind> ClassInterfaceModuleStructTypes = new HashSet<TypeKind> { TypeKind.Class, TypeKind.Module, TypeKind.Struct, TypeKind.Interface }; protected static bool ValidateTypeToGenerateIn( INamedTypeSymbol typeToGenerateIn, bool isStatic, ISet<TypeKind> typeKinds) { if (typeToGenerateIn == null) { return false; } if (typeToGenerateIn.IsAnonymousType) { return false; } if (!typeKinds.Contains(typeToGenerateIn.TypeKind)) { return false; } if (typeToGenerateIn.TypeKind == TypeKind.Interface && isStatic) { return false; } // TODO(cyrusn): Make sure that there is a totally visible part somewhere (i.e. // venus) that we can generate into. var locations = typeToGenerateIn.Locations; return locations.Any(loc => loc.IsInSource); } protected static bool TryDetermineTypeToGenerateIn( SemanticDocument document, INamedTypeSymbol containingType, TExpressionSyntax simpleNameOrMemberAccessExpression, CancellationToken cancellationToken, out INamedTypeSymbol typeToGenerateIn, out bool isStatic) { TryDetermineTypeToGenerateInWorker( document, containingType, simpleNameOrMemberAccessExpression, cancellationToken, out typeToGenerateIn, out isStatic); if (typeToGenerateIn != null) { typeToGenerateIn = typeToGenerateIn.OriginalDefinition; } return typeToGenerateIn != null; } private static void TryDetermineTypeToGenerateInWorker( SemanticDocument semanticDocument, INamedTypeSymbol containingType, TExpressionSyntax expression, CancellationToken cancellationToken, out INamedTypeSymbol typeToGenerateIn, out bool isStatic) { typeToGenerateIn = null; isStatic = false; var syntaxFacts = semanticDocument.Document.GetLanguageService<ISyntaxFactsService>(); var semanticModel = semanticDocument.SemanticModel; if (syntaxFacts.IsSimpleMemberAccessExpression(expression)) { // Figure out what's before the dot. For VB, that also means finding out // what ".X" might mean, even when there's nothing before the dot itself. var beforeDotExpression = syntaxFacts.GetExpressionOfMemberAccessExpression( expression, allowImplicitTarget: true); if (beforeDotExpression != null) { DetermineTypeToGenerateInWorker( semanticModel, beforeDotExpression, out typeToGenerateIn, out isStatic, cancellationToken); } return; } if (syntaxFacts.IsConditionalAccessExpression(expression)) { var beforeDotExpression = syntaxFacts.GetExpressionOfConditionalAccessExpression(expression); if (beforeDotExpression != null) { DetermineTypeToGenerateInWorker( semanticModel, beforeDotExpression, out typeToGenerateIn, out isStatic, cancellationToken); if (typeToGenerateIn.IsNullable(out var underlyingType) && underlyingType is INamedTypeSymbol underlyingNamedType) { typeToGenerateIn = underlyingNamedType; } } return; } if (syntaxFacts.IsPointerMemberAccessExpression(expression)) { var beforeArrowExpression = syntaxFacts.GetExpressionOfMemberAccessExpression(expression); if (beforeArrowExpression != null) { var typeInfo = semanticModel.GetTypeInfo(beforeArrowExpression, cancellationToken); if (typeInfo.Type.IsPointerType()) { typeToGenerateIn = ((IPointerTypeSymbol)typeInfo.Type).PointedAtType as INamedTypeSymbol; isStatic = false; } } return; } if (syntaxFacts.IsAttributeNamedArgumentIdentifier(expression)) { var attributeNode = expression.GetAncestors().FirstOrDefault(syntaxFacts.IsAttribute); var attributeName = syntaxFacts.GetNameOfAttribute(attributeNode); var attributeType = semanticModel.GetTypeInfo(attributeName, cancellationToken); typeToGenerateIn = attributeType.Type as INamedTypeSymbol; isStatic = false; return; } if (syntaxFacts.IsMemberInitializerNamedAssignmentIdentifier( expression, out var initializedObject)) { typeToGenerateIn = semanticModel.GetTypeInfo(initializedObject, cancellationToken).Type as INamedTypeSymbol; isStatic = false; return; } else if (syntaxFacts.IsNameOfSubpattern(expression)) { var propertyPatternClause = expression.Ancestors().FirstOrDefault(syntaxFacts.IsPropertyPatternClause); if (propertyPatternClause != null) { // something like: { [|X|]: int i } or like: Blah { [|X|]: int i } var inferenceService = semanticDocument.Document.GetLanguageService<ITypeInferenceService>(); typeToGenerateIn = inferenceService.InferType(semanticModel, propertyPatternClause, objectAsDefault: true, cancellationToken) as INamedTypeSymbol; isStatic = false; return; } } // Generating into the containing type. typeToGenerateIn = containingType; isStatic = syntaxFacts.IsInStaticContext(expression); } private static void DetermineTypeToGenerateInWorker( SemanticModel semanticModel, SyntaxNode expression, out INamedTypeSymbol typeToGenerateIn, out bool isStatic, CancellationToken cancellationToken) { var typeInfo = semanticModel.GetTypeInfo(expression, cancellationToken); var semanticInfo = semanticModel.GetSymbolInfo(expression, cancellationToken); typeToGenerateIn = typeInfo.Type is ITypeParameterSymbol typeParameter ? typeParameter.GetNamedTypeSymbolConstraint() : typeInfo.Type as INamedTypeSymbol; isStatic = semanticInfo.Symbol is INamedTypeSymbol; } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/VisualBasic/GoToDefinition/VisualBasicGoToDefinitionService.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Composition Imports System.Diagnostics.CodeAnalysis Imports Microsoft.CodeAnalysis.Editor.GoToDefinition Imports Microsoft.CodeAnalysis.Editor.Host Imports Microsoft.CodeAnalysis.Editor.Shared.Utilities Imports Microsoft.CodeAnalysis.Host.Mef Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.GoToDefinition <ExportLanguageService(GetType(IGoToDefinitionService), LanguageNames.VisualBasic), [Shared]> Friend Class VisualBasicGoToDefinitionService Inherits AbstractGoToDefinitionService <ImportingConstructor> <SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification:="Used in test code: https://github.com/dotnet/roslyn/issues/42814")> Public Sub New(threadingContext As IThreadingContext, streamingPresenter As IStreamingFindUsagesPresenter) MyBase.New(threadingContext, streamingPresenter) End Sub End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports System.Composition Imports System.Diagnostics.CodeAnalysis Imports Microsoft.CodeAnalysis.Editor.GoToDefinition Imports Microsoft.CodeAnalysis.Editor.Host Imports Microsoft.CodeAnalysis.Editor.Shared.Utilities Imports Microsoft.CodeAnalysis.Host.Mef Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.GoToDefinition <ExportLanguageService(GetType(IGoToDefinitionService), LanguageNames.VisualBasic), [Shared]> Friend Class VisualBasicGoToDefinitionService Inherits AbstractGoToDefinitionService <ImportingConstructor> <SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification:="Used in test code: https://github.com/dotnet/roslyn/issues/42814")> Public Sub New(threadingContext As IThreadingContext, streamingPresenter As IStreamingFindUsagesPresenter) MyBase.New(threadingContext, streamingPresenter) End Sub End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/EditorFeatures/CSharpTest/UseExpressionBody/Refactoring/UseExpressionBodyForLocalFunctionsRefactoringTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.UseExpressionBody; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForLocalFunctionsRefactoringTests : AbstractCSharpCodeActionTest { protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters) => new UseExpressionBodyCodeRefactoringProvider(); private OptionsCollection UseExpressionBody => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, CSharpCodeStyleOptions.WhenPossibleWithSilentEnforcement); private OptionsCollection UseExpressionBodyDisabledDiagnostic => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); private OptionsCollection UseBlockBody => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, CSharpCodeStyleOptions.NeverWithSilentEnforcement); private OptionsCollection UseBlockBodyDisabledDiagnostic => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None)); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestNotOfferedIfUserPrefersExpressionBodiesAndInBlockBody() { await TestMissingAsync( @"class C { void Goo() { void Bar() { [||]Test(); } } }", parameters: new TestParameters(options: UseExpressionBody)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersExpressionBodiesWithoutDiagnosticAndInBlockBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() { [||]Test(); } } }", @"class C { void Goo() { void Bar() => Test(); } }", parameters: new TestParameters(options: UseExpressionBodyDisabledDiagnostic)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersBlockBodiesAndInBlockBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() { [||]Test(); } } }", @"class C { void Goo() { void Bar() => Test(); } }", parameters: new TestParameters(options: UseBlockBody)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestNotOfferedIfUserPrefersBlockBodiesAndInExpressionBody() { await TestMissingAsync( @"class C { void Goo() { void Bar() => [||]Test(); } }", parameters: new TestParameters(options: UseBlockBody)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersBlockBodiesWithoutDiagnosticAndInExpressionBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() => [||]Test(); } }", @"class C { void Goo() { void Bar() { Test(); } } }", parameters: new TestParameters(options: UseBlockBodyDisabledDiagnostic)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersExpressionBodiesAndInExpressionBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() => [||]Test(); } }", @"class C { void Goo() { void Bar() { Test(); } } }", parameters: new TestParameters(options: UseExpressionBody)); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.UseExpressionBody; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { public class UseExpressionBodyForLocalFunctionsRefactoringTests : AbstractCSharpCodeActionTest { protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters) => new UseExpressionBodyCodeRefactoringProvider(); private OptionsCollection UseExpressionBody => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, CSharpCodeStyleOptions.WhenPossibleWithSilentEnforcement); private OptionsCollection UseExpressionBodyDisabledDiagnostic => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.WhenPossible, NotificationOption2.None)); private OptionsCollection UseBlockBody => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, CSharpCodeStyleOptions.NeverWithSilentEnforcement); private OptionsCollection UseBlockBodyDisabledDiagnostic => Option(CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, new CodeStyleOption2<ExpressionBodyPreference>(ExpressionBodyPreference.Never, NotificationOption2.None)); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestNotOfferedIfUserPrefersExpressionBodiesAndInBlockBody() { await TestMissingAsync( @"class C { void Goo() { void Bar() { [||]Test(); } } }", parameters: new TestParameters(options: UseExpressionBody)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersExpressionBodiesWithoutDiagnosticAndInBlockBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() { [||]Test(); } } }", @"class C { void Goo() { void Bar() => Test(); } }", parameters: new TestParameters(options: UseExpressionBodyDisabledDiagnostic)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersBlockBodiesAndInBlockBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() { [||]Test(); } } }", @"class C { void Goo() { void Bar() => Test(); } }", parameters: new TestParameters(options: UseBlockBody)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestNotOfferedIfUserPrefersBlockBodiesAndInExpressionBody() { await TestMissingAsync( @"class C { void Goo() { void Bar() => [||]Test(); } }", parameters: new TestParameters(options: UseBlockBody)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersBlockBodiesWithoutDiagnosticAndInExpressionBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() => [||]Test(); } }", @"class C { void Goo() { void Bar() { Test(); } } }", parameters: new TestParameters(options: UseBlockBodyDisabledDiagnostic)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestOfferedIfUserPrefersExpressionBodiesAndInExpressionBody() { await TestInRegularAndScript1Async( @"class C { void Goo() { void Bar() => [||]Test(); } }", @"class C { void Goo() { void Bar() { Test(); } } }", parameters: new TestParameters(options: UseExpressionBody)); } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./Roslyn.sln
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31319.15 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoslynDeployment", "src\Deployment\RoslynDeployment.csproj", "{600AF682-E097-407B-AD85-EE3CED37E680}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{A41D1B99-F489-4C43-BBDF-96D61B19A6B9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compilers", "Compilers", "{3F40F71B-7DCF-44A1-B15C-38CA34824143}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "CSharp", "{32A48625-F0AD-419D-828B-A50BDABA38EA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualBasic", "VisualBasic", "{C65C6143-BED3-46E6-869E-9F0BE6E84C37}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workspaces", "Workspaces", "{55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EditorFeatures", "EditorFeatures", "{EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExpressionEvaluator", "ExpressionEvaluator", "{235A3418-A3B0-4844-BCEB-F1CF45069232}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Features", "Features", "{3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interactive", "Interactive", "{999FBDA2-33DA-4F74-B957-03AC72CCE5EC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripting", "Scripting", "{38940C5F-97FD-4B2A-B2CD-C4E4EF601B05}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualStudio", "VisualStudio", "{8DBA5174-B0AA-4561-82B1-A46607697753}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "CSharp", "{913A4C08-898E-49C7-9692-0EF9DC56CF6E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualBasic", "VisualBasic", "{151F6994-AEB3-4B12-B746-2ACFF26C7BBB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Setup", "Setup", "{4C81EBB2-82E1-4C81-80C4-84CC40FA281B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{998CAFE8-06E4-4683-A151-0F6AA4BFF6C6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Setup", "Setup", "{19148439-436F-4CDA-B493-70AF4FFC13E9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosts", "Hosts", "{5CA5F70E-0FDB-467B-B22C-3CD5994F0087}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{7E907718-0B33-45C8-851F-396CEFDC1AB6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{CAD2965A-19AB-489F-BE2E-7649957F914A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IntegrationTest", "IntegrationTest", "{CC126D03-7EAC-493F-B187-DCDEE1EF6A70}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{C2D1346B-9665-4150-B644-075CF1636BAA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Perf", "Perf", "{DD13507E-D5AF-4B61-B11A-D55D6F4A73A5}" ProjectSection(SolutionItems) = preProject src\Test\Perf\readme.md = src\Test\Perf\readme.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeStyle", "CodeStyle", "{DC014586-8D07-4DE6-B28E-C0540C59C085}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.UnitTests", "src\Compilers\Core\CodeAnalysisTest\Microsoft.CodeAnalysis.UnitTests.csproj", "{A4C99B85-765C-4C65-9C2A-BB609AAB09E6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis", "src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj", "{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VBCSCompiler", "src\Compilers\Server\VBCSCompiler\VBCSCompiler.csproj", "{9508F118-F62E-4C16-A6F4-7C3B56E166AD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VBCSCompiler.UnitTests", "src\Compilers\Server\VBCSCompilerTests\VBCSCompiler.UnitTests.csproj", "{F5CE416E-B906-41D2-80B9-0078E887A3F6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csc", "src\Compilers\CSharp\csc\csc.csproj", "{4B45CA0C-03A0-400F-B454-3D4BCB16AF38}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp", "src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj", "{B501A547-C911-4A05-AC6E-274A50DFF30E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests", "src\Compilers\CSharp\Test\CommandLine\Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj", "{50D26304-0961-4A51-ABF6-6CAD1A56D203}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Emit.UnitTests", "src\Compilers\CSharp\Test\Emit\Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj", "{4462B57A-7245-4146-B504-D46FDE762948}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests", "src\Compilers\CSharp\Test\IOperation\Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests.csproj", "{1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests", "src\Compilers\CSharp\Test\Semantic\Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests.csproj", "{B2C33A93-DB30-4099-903E-77D75C4C3F45}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests", "src\Compilers\CSharp\Test\Symbol\Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests.csproj", "{28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests", "src\Compilers\CSharp\Test\Syntax\Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests.csproj", "{50D26304-0961-4A51-ABF6-6CAD1A56D202}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compiler.Test.Resources", "src\Compilers\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj", "{7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Test.Utilities", "src\Compilers\Test\Utilities\CSharp\Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj", "{4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Test.Utilities", "src\Compilers\Test\Utilities\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.Test.Utilities.vbproj", "{4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic", "src\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj", "{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests", "src\Compilers\VisualBasic\Test\CommandLine\Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests.vbproj", "{E3B32027-3362-41DF-9172-4D3B623F42A5}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests", "src\Compilers\VisualBasic\Test\Emit\Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests.vbproj", "{190CE348-596E-435A-9E5B-12A689F9FC29}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Roslyn.Compilers.VisualBasic.IOperation.UnitTests", "src\Compilers\VisualBasic\Test\IOperation\Roslyn.Compilers.VisualBasic.IOperation.UnitTests.vbproj", "{9C9DABA4-0E72-4469-ADF1-4991F3CA572A}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests", "src\Compilers\VisualBasic\Test\Semantic\Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests.vbproj", "{BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests", "src\Compilers\VisualBasic\Test\Symbol\Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests.vbproj", "{BDA5D613-596D-4B61-837C-63554151C8F5}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests", "src\Compilers\VisualBasic\Test\Syntax\Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests.vbproj", "{91F6F646-4F6E-449A-9AB4-2986348F329D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Test.PdbUtilities", "src\Test\PdbUtilities\Roslyn.Test.PdbUtilities.csproj", "{AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces", "src\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj", "{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompilersBoundTreeGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\BoundTreeGenerator\CompilersBoundTreeGenerator.csproj", "{02459936-CD2C-4F61-B671-5C518F2A3DDC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpErrorFactsGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\CSharpErrorFactsGenerator\CSharpErrorFactsGenerator.csproj", "{288089C5-8721-458E-BE3E-78990DAB5E2E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpSyntaxGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\CSharpSyntaxGenerator.csproj", "{288089C5-8721-458E-BE3E-78990DAB5E2D}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VisualBasicSyntaxGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\VisualBasicSyntaxGenerator\VisualBasicSyntaxGenerator.vbproj", "{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.UnitTests", "src\Workspaces\CoreTest\Microsoft.CodeAnalysis.Workspaces.UnitTests.csproj", "{C50166F1-BABC-40A9-95EB-8200080CD701}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests", "src\Workspaces\CSharpTest\Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests.csproj", "{E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests", "src\Workspaces\VisualBasicTest\Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests.vbproj", "{E3FDC65F-568D-4E2D-A093-5132FD3793B7}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VisualBasicErrorFactsGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\VisualBasicErrorFactsGenerator\VisualBasicErrorFactsGenerator.vbproj", "{909B656F-6095-4AC2-A5AB-C3F032315C45}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Desktop", "src\Workspaces\Core\Desktop\Microsoft.CodeAnalysis.Workspaces.Desktop.csproj", "{2E87FA96-50BB-4607-8676-46521599F998}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.MSBuild", "src\Workspaces\Core\MSBuild\Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj", "{96EB2D3B-F694-48C6-A284-67382841E086}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Workspaces", "src\Workspaces\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj", "{21B239D0-D144-430F-A394-C066D58EE267}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Workspaces", "src\Workspaces\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj", "{57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RunTests", "src\Tools\Source\RunTests\RunTests.csproj", "{1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Features", "src\Features\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Features.vbproj", "{A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Features", "src\Features\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Features.csproj", "{3973B09A-4FBF-44A5-8359-3D22CEB71F71}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Features", "src\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj", "{EDC68A0E-C68D-4A74-91B7-BF38EC909888}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Text", "src\EditorFeatures\Text\Microsoft.CodeAnalysis.EditorFeatures.Text.csproj", "{18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.EditorFeatures", "src\EditorFeatures\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.vbproj", "{49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.EditorFeatures", "src\EditorFeatures\CSharp\Microsoft.CodeAnalysis.CSharp.EditorFeatures.csproj", "{B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures", "src\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj", "{3CDEEAB7-2256-418A-BEB2-620B5CB16302}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests", "src\EditorFeatures\VisualBasicTest\Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests.vbproj", "{0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Scripting", "src\Scripting\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.Scripting.vbproj", "{3E7DEA65-317B-4F43-A25D-62F18D96CFD7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting", "src\Scripting\Core\Microsoft.CodeAnalysis.Scripting.csproj", "{12A68549-4E8C-42D6-8703-A09335F97997}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.UnitTests", "src\Scripting\CoreTest\Microsoft.CodeAnalysis.Scripting.UnitTests.csproj", "{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Scripting", "src\Scripting\CSharp\Microsoft.CodeAnalysis.CSharp.Scripting.csproj", "{066F0DBD-C46C-4C20-AFEC-99829A172625}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests", "src\Scripting\CSharpTest\Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests.csproj", "{2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.InteractiveHost", "src\Interactive\Host\Microsoft.CodeAnalysis.InteractiveHost.csproj", "{8E2A252E-A140-45A6-A81A-2652996EA589}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests", "src\EditorFeatures\CSharpTest\Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj", "{AC2BCEFB-9298-4621-AC48-1FF5E639E48D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests", "src\EditorFeatures\CSharpTest2\Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj", "{16E93074-4252-466C-89A3-3B905ABAF779}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.UnitTests", "src\EditorFeatures\Test\Microsoft.CodeAnalysis.EditorFeatures.UnitTests.csproj", "{8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.EditorFeatures2.UnitTests", "src\EditorFeatures\Test2\Microsoft.CodeAnalysis.EditorFeatures2.UnitTests.vbproj", "{3CEA0D69-00D3-40E5-A661-DC41EA07269B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities", "src\EditorFeatures\TestUtilities\Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj", "{76C6F005-C89D-4348-BB4A-39189DDBEB52}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveHost32", "src\Interactive\HostProcess\InteractiveHost32.csproj", "{EBA4DFA1-6DED-418F-A485-A3B608978906}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveHost.UnitTests", "src\Interactive\HostTest\InteractiveHost.UnitTests.csproj", "{8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csi", "src\Interactive\csi\csi.csproj", "{14118347-ED06-4608-9C45-18228273C712}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "vbi", "src\Interactive\vbi\vbi.vbproj", "{6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices", "src\VisualStudio\Core\Def\Microsoft.VisualStudio.LanguageServices.csproj", "{86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Implementation", "src\VisualStudio\Core\Impl\Microsoft.VisualStudio.LanguageServices.Implementation.csproj", "{C0E80510-4FBE-4B0C-AF2C-4F473787722C}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.VisualStudio.LanguageServices.VisualBasic", "src\VisualStudio\VisualBasic\Impl\Microsoft.VisualStudio.LanguageServices.VisualBasic.vbproj", "{D49439D7-56D2-450F-A4F0-74CB95D620E6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.CSharp", "src\VisualStudio\CSharp\Impl\Microsoft.VisualStudio.LanguageServices.CSharp.csproj", "{5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests", "src\VisualStudio\CSharp\Test\Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj", "{91C574AD-0352-47E9-A019-EE02CC32A396}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.VisualStudio.LanguageServices.UnitTests", "src\VisualStudio\Core\Test\Microsoft.VisualStudio.LanguageServices.UnitTests.vbproj", "{A1455D30-55FC-45EF-8759-3AEBDB13D940}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup", "src\VisualStudio\Setup\Roslyn.VisualStudio.Setup.csproj", "{201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.DiagnosticsWindow", "src\VisualStudio\VisualStudioDiagnosticsToolWindow\Roslyn.VisualStudio.DiagnosticsWindow.csproj", "{A486D7DE-F614-409D-BB41-0FFDF582E35C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExpressionEvaluatorPackage", "src\ExpressionEvaluator\Package\ExpressionEvaluatorPackage.csproj", "{B617717C-7881-4F01-AB6D-B1B6CC0483A0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ExpressionCompiler", "src\ExpressionEvaluator\CSharp\Source\ExpressionCompiler\Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.csproj", "{FD6BA96C-7905-4876-8BCC-E38E2CA64F31}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.UnitTests", "src\ExpressionEvaluator\CSharp\Test\ExpressionCompiler\Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.UnitTests.csproj", "{AE297965-4D56-4BA9-85EB-655AC4FC95A0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ResultProvider.UnitTests", "src\ExpressionEvaluator\CSharp\Test\ResultProvider\Microsoft.CodeAnalysis.CSharp.ResultProvider.UnitTests.csproj", "{60DB272A-21C9-4E8D-9803-FF4E132392C8}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler", "src\ExpressionEvaluator\VisualBasic\Source\ExpressionCompiler\Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.vbproj", "{73242A2D-6300-499D-8C15-FADF7ECB185C}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.UnitTests", "src\ExpressionEvaluator\VisualBasic\Test\ExpressionCompiler\Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.UnitTests.vbproj", "{AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExpressionCompiler", "src\ExpressionEvaluator\Core\Source\ExpressionCompiler\Microsoft.CodeAnalysis.ExpressionCompiler.csproj", "{B8DA3A90-A60C-42E3-9D8E-6C67B800C395}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ResultProvider.UnitTests", "src\ExpressionEvaluator\VisualBasic\Test\ResultProvider\Microsoft.CodeAnalysis.VisualBasic.ResultProvider.UnitTests.vbproj", "{ACE53515-482C-4C6A-E2D2-4242A687DFEE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExpressionCompiler.Utilities", "src\ExpressionEvaluator\Core\Test\ExpressionCompiler\Microsoft.CodeAnalysis.ExpressionCompiler.Utilities.csproj", "{21B80A31-8FF9-4E3A-8403-AABD635AEED9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ResultProvider.Utilities", "src\ExpressionEvaluator\Core\Test\ResultProvider\Microsoft.CodeAnalysis.ResultProvider.Utilities.csproj", "{ABDBAC1E-350E-4DC3-BB45-3504404545EE}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "AnalyzerDriver", "src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.shproj", "{D0BC9BE7-24F6-40CA-8DC6-FCB93BD44B34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests", "src\Compilers\CSharp\Test\WinRT\Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests.csproj", "{FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.Tasks.CodeAnalysis.UnitTests", "src\Compilers\Core\MSBuildTaskTests\Microsoft.Build.Tasks.CodeAnalysis.UnitTests.csproj", "{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BasicResultProvider", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.shproj", "{3140FE61-0856-4367-9AA3-8081B9A80E35}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "BasicResultProvider.NetFX20", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\NetFX20\BasicResultProvider.NetFX20.vbproj", "{76242A2D-2600-49DD-8C15-FEA07ECB1842}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ResultProvider", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\Portable\Microsoft.CodeAnalysis.VisualBasic.ResultProvider.vbproj", "{76242A2D-2600-49DD-8C15-FEA07ECB1843}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpResultProvider", "src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.shproj", "{3140FE61-0856-4367-9AA3-8081B9A80E36}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpResultProvider.NetFX20", "src\ExpressionEvaluator\CSharp\Source\ResultProvider\NetFX20\CSharpResultProvider.NetFX20.csproj", "{BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ResultProvider", "src\ExpressionEvaluator\CSharp\Source\ResultProvider\Portable\Microsoft.CodeAnalysis.CSharp.ResultProvider.csproj", "{BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ResultProvider", "src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.shproj", "{BB3CA047-5D00-48D4-B7D3-233C1265C065}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResultProvider.NetFX20", "src\ExpressionEvaluator\Core\Source\ResultProvider\NetFX20\ResultProvider.NetFX20.csproj", "{BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ResultProvider", "src\ExpressionEvaluator\Core\Source\ResultProvider\Portable\Microsoft.CodeAnalysis.ResultProvider.csproj", "{FA0E905D-EC46-466D-B7B2-3B5557F9428C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vbc", "src\Compilers\VisualBasic\vbc\vbc.csproj", "{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests", "src\Scripting\CoreTest.Desktop\Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests.csproj", "{6FD1CC3E-6A99-4736-9B8D-757992DDE75D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests", "src\Scripting\CSharpTest.Desktop\Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests.csproj", "{286B01F3-811A-40A7-8C1F-10C9BB0597F7}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Scripting.Desktop.UnitTests", "src\Scripting\VisualBasicTest.Desktop\Microsoft.CodeAnalysis.VisualBasic.Scripting.Desktop.UnitTests.vbproj", "{24973B4C-FD09-4EE1-97F4-EA03E6B12040}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests", "src\Scripting\VisualBasicTest\Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests.vbproj", "{ABC7262E-1053-49F3-B846-E3091BB92E8C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Hosting.Diagnostics", "src\Test\Diagnostics\Roslyn.Hosting.Diagnostics.csproj", "{E2E889A5-2489-4546-9194-47C63E49EAEB}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BasicAnalyzerDriver", "src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.shproj", "{E8F0BAA5-7327-43D1-9A51-644E81AE55F1}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpAnalyzerDriver", "src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.shproj", "{54E08BF5-F819-404F-A18D-0AB9EA81EA04}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CommandLine", "src\Compilers\Core\CommandLine\CommandLine.shproj", "{AD6F474E-E6D4-4217-91F3-B7AF1BE31CCC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Compilers.Extension", "src\Compilers\Extension\Roslyn.Compilers.Extension.csproj", "{43026D51-3083-4850-928D-07E1883D5B1A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.Setup", "src\VisualStudio\IntegrationTest\TestSetup\Microsoft.VisualStudio.IntegrationTest.Setup.csproj", "{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}" ProjectSection(ProjectDependencies) = postProject {600AF682-E097-407B-AD85-EE3CED37E680} = {600AF682-E097-407B-AD85-EE3CED37E680} {A486D7DE-F614-409D-BB41-0FFDF582E35C} = {A486D7DE-F614-409D-BB41-0FFDF582E35C} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.IntegrationTests", "src\VisualStudio\IntegrationTest\IntegrationTests\Microsoft.VisualStudio.LanguageServices.IntegrationTests.csproj", "{E5A55C16-A5B9-4874-9043-A5266DC02F58}" ProjectSection(ProjectDependencies) = postProject {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2} = {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.Utilities", "src\VisualStudio\IntegrationTest\TestUtilities\Microsoft.VisualStudio.IntegrationTest.Utilities.csproj", "{3BED15FD-D608-4573-B432-1569C1026F6D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.PerformanceTests", "src\Test\Perf\tests\Roslyn.PerformanceTests.csproj", "{DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Xaml", "src\VisualStudio\Xaml\Impl\Microsoft.VisualStudio.LanguageServices.Xaml.csproj", "{971E832B-7471-48B5-833E-5913188EC0E4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Test.Performance.Utilities", "src\Test\Perf\Utilities\Roslyn.Test.Performance.Utilities.csproj", "{59AD474E-2A35-4E8A-A74D-E33479977FBF}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.Debugging", "src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.shproj", "{D73ADF7D-2C1C-42AE-B2AB-EDC9497E4B71}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.PooledObjects", "src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.shproj", "{C1930979-C824-496B-A630-70F5369A636F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.Workspaces", "src\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj", "{F822F72A-CC87-4E31-B57D-853F65CBEBF3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.ServiceHub", "src\Workspaces\Remote\ServiceHub\Microsoft.CodeAnalysis.Remote.ServiceHub.csproj", "{80FDDD00-9393-47F7-8BAF-7E87CE011068}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.Tasks.CodeAnalysis", "src\Compilers\Core\MSBuildTask\Microsoft.Build.Tasks.CodeAnalysis.csproj", "{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Next.UnitTests", "src\VisualStudio\Core\Test.Next\Roslyn.VisualStudio.Next.UnitTests.csproj", "{2E1658E2-5045-4F85-A64C-C0ECCD39F719}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildBoss", "src\Tools\BuildBoss\BuildBoss.csproj", "{9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.TestUtilities", "src\Scripting\CoreTestUtilities\Microsoft.CodeAnalysis.Scripting.TestUtilities.csproj", "{21A01C2D-2501-4619-8144-48977DD22D9C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Test.Utilities", "src\Workspaces\CoreTestUtilities\Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj", "{3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2", "src\EditorFeatures\TestUtilities2\Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2.vbproj", "{3DFB4701-E3D6-4435-9F70-A6E35822C4F2}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.VisualStudio.LanguageServices.Test.Utilities2", "src\VisualStudio\TestUtilities2\Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj", "{69F853E5-BD04-4842-984F-FC68CC51F402}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.FunctionResolver", "src\ExpressionEvaluator\Core\Source\FunctionResolver\Microsoft.CodeAnalysis.FunctionResolver.csproj", "{6FC8E6F5-659C-424D-AEB5-331B95883E29}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.FunctionResolver.UnitTests", "src\ExpressionEvaluator\Core\Test\FunctionResolver\Microsoft.CodeAnalysis.FunctionResolver.UnitTests.csproj", "{DD317BE1-42A1-4795-B1D4-F370C40D649A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup.Dependencies", "src\VisualStudio\Setup.Dependencies\Roslyn.VisualStudio.Setup.Dependencies.csproj", "{1688E1E5-D510-4E06-86F3-F8DB10B1393D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackDepthTest", "src\Test\Perf\StackDepthTest\StackDepthTest.csproj", "{F040CEC5-5E11-4DBD-9F6A-250478E28177}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle", "src\CodeStyle\Core\Analyzers\Microsoft.CodeAnalysis.CodeStyle.csproj", "{275812EE-DEDB-4232-9439-91C9757D2AE4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle.Fixes", "src\CodeStyle\Core\CodeFixes\Microsoft.CodeAnalysis.CodeStyle.Fixes.csproj", "{5FF1E493-69CC-4D0B-83F2-039F469A04E1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CodeStyle", "src\CodeStyle\CSharp\Analyzers\Microsoft.CodeAnalysis.CSharp.CodeStyle.csproj", "{AA87BFED-089A-4096-B8D5-690BDC7D5B24}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes", "src\CodeStyle\CSharp\CodeFixes\Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes.csproj", "{A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}" ProjectSection(ProjectDependencies) = postProject {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} = {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} EndProjectSection EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CodeStyle", "src\CodeStyle\VisualBasic\Analyzers\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.vbproj", "{2531A8C4-97DD-47BC-A79C-B7846051E137}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes", "src\CodeStyle\VisualBasic\CodeFixes\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes.vbproj", "{0141285D-8F6C-42C7-BAF3-3C0CCD61C716}" ProjectSection(ProjectDependencies) = postProject {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} = {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities", "src\CodeStyle\Core\Tests\Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities.csproj", "{9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests", "src\CodeStyle\CSharp\Tests\Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests.csproj", "{5018D049-5870-465A-889B-C742CE1E31CB}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests", "src\CodeStyle\VisualBasic\Tests\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests.vbproj", "{E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Wpf", "src\EditorFeatures\Core.Wpf\Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj", "{FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnalyzerRunner", "src\Tools\AnalyzerRunner\AnalyzerRunner.csproj", "{60166C60-813C-46C4-911D-2411B4ABBC0F}" ProjectSection(ProjectDependencies) = postProject {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2} = {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2} {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD} = {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD} {3CDEEAB7-2256-418A-BEB2-620B5CB16302} = {3CDEEAB7-2256-418A-BEB2-620B5CB16302} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Debugging.Package", "src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.Package.csproj", "{FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.PooledObjects.Package", "src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.Package.csproj", "{49E7C367-181B-499C-AC2E-8E17C81418D6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests", "src\Workspaces\MSBuildTest\Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests.csproj", "{037F06F0-3BE8-42D0-801E-2F74FC380AB8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveHost64", "src\Interactive\HostProcess\InteractiveHost64.csproj", "{2F11618A-9251-4609-B3D5-CE4D2B3D3E49}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.IntegrationService", "src\VisualStudio\IntegrationTest\IntegrationService\Microsoft.VisualStudio.IntegrationTest.IntegrationService.csproj", "{764D2C19-0187-4837-A2A3-96DDC6EF4CE2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Compilers.Package", "src\NuGet\Microsoft.Net.Compilers\Microsoft.Net.Compilers.Package.csproj", "{9102ECF3-5CD1-4107-B8B7-F3795A52D790}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NETCore.Compilers.Package", "src\NuGet\Microsoft.NETCore.Compilers\Microsoft.NETCore.Compilers.Package.csproj", "{50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compilers.Package", "src\NuGet\Microsoft.CodeAnalysis.Compilers.Package.csproj", "{CFA94A39-4805-456D-A369-FC35CCC170E9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{C52D8057-43AF-40E6-A01B-6CDBB7301985}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.Package", "src\NuGet\Microsoft.CodeAnalysis.Scripting.Package.csproj", "{4A490CBC-37F4-4859-AFDB-4B0833D144AF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Package", "src\NuGet\Microsoft.CodeAnalysis.EditorFeatures.Package.csproj", "{34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{BE25E872-1667-4649-9D19-96B83E75A44E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VS.ExternalAPIs.Roslyn.Package", "src\NuGet\VisualStudio\VS.ExternalAPIs.Roslyn.Package.csproj", "{0EB22BD1-B8B1-417D-8276-F475C2E190FF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VS.Tools.Roslyn.Package", "src\NuGet\VisualStudio\VS.Tools.Roslyn.Package.csproj", "{3636D3E2-E3EF-4815-B020-819F382204CD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Package", "src\NuGet\Microsoft.CodeAnalysis.Package.csproj", "{B9843F65-262E-4F40-A0BC-2CBEF7563A44}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compilers.Setup", "src\Setup\DevDivVsix\CompilersPackage\Microsoft.CodeAnalysis.Compilers.Setup.csproj", "{03607817-6800-40B6-BEAA-D6F437CD62B7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Installer.Package", "src\Setup\Installer\Installer.Package.csproj", "{6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests", "src\Workspaces\DesktopTest\Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests.csproj", "{23405307-7EFF-4774-8B11-8F5885439761}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Insertion", "Insertion", "{AFA5F921-0650-45E8-B293-51A0BB89DEA0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevDivInsertionFiles", "src\Setup\DevDivInsertionFiles\DevDivInsertionFiles.csproj", "{6362616E-6A47-48F0-9EE0-27800B306ACB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalAccess", "ExternalAccess", "{8977A560-45C2-4EC2-A849-97335B382C74}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.FSharp", "src\Tools\ExternalAccess\FSharp\Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj", "{BD8CE303-5F04-45EC-8DCF-73C9164CD614}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Razor", "src\Tools\ExternalAccess\Razor\Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj", "{2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.CodeLens", "src\VisualStudio\CodeLens\Microsoft.VisualStudio.LanguageServices.CodeLens.csproj", "{5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Compilers.Toolset.Package", "src\NuGet\Microsoft.Net.Compilers.Toolset\Microsoft.Net.Compilers.Toolset.Package.csproj", "{A74C7D2E-92FA-490A-B80A-28BEF56B56FC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer.Protocol", "src\Features\LanguageServer\Protocol\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj", "{686BF57E-A6FF-467B-AAB3-44DE916A9772}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests", "src\Features\LanguageServer\ProtocolUnitTests\Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests.csproj", "{1DDE89EE-5819-441F-A060-2FF4A986F372}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Debugger", "src\Tools\ExternalAccess\Debugger\Microsoft.CodeAnalysis.ExternalAccess.Debugger.csproj", "{655A5B07-39B8-48CD-8590-8AC0C2B708D8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote", "src\Tools\ExternalAccess\Xamarin.Remote\Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote.csproj", "{DE53934B-7FC1-48A0-85AB-C519FBBD02CF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup.ServiceHub", "src\Setup\DevDivVsix\ServiceHubConfig\Roslyn.VisualStudio.Setup.ServiceHub.csproj", "{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests", "src\Tools\ExternalAccess\FSharpTest\Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj", "{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Apex", "src\Tools\ExternalAccess\Apex\Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj", "{FC32EF16-31B1-47B3-B625-A80933CB3F29}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.LiveShare", "src\VisualStudio\LiveShare\Impl\Microsoft.VisualStudio.LanguageServices.LiveShare.csproj", "{453C8E28-81D4-431E-BFB0-F3D413346E51}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests", "src\VisualStudio\LiveShare\Test\Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests.csproj", "{CE7F7553-DB2D-4839-92E3-F042E4261B4E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdeBenchmarks", "src\Tools\IdeBenchmarks\IdeBenchmarks.csproj", "{FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{157EA250-2F28-4948-A8F2-D58EAEA05DC8}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .vsconfig = .vsconfig EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompilersIOperationGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\IOperationGenerator\CompilersIOperationGenerator.csproj", "{D55FB2BD-CC9E-454B-9654-94AF5D910BF7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator", "src\Features\Lsif\Generator\Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj", "{B9899CF1-E0EB-4599-9E24-6939A04B4979}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests", "src\Features\Lsif\GeneratorTest\Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests.vbproj", "{D15BF03E-04ED-4BEE-A72B-7620F541F4E2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzers", "Analyzers", "{4A49D526-1644-4819-AA4F-95B348D447D4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CompilerExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.shproj", "{EC946164-1E17-410B-B7D9-7DE7E6268D63}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "WorkspaceExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.shproj", "{99F594B1-3916-471D-A761-A6731FC50E9A}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpCompilerExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.shproj", "{699FEA05-AEA7-403D-827E-53CF4E826955}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpWorkspaceExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.shproj", "{438DB8AF-F3F0-4ED9-80B5-13FDDD5B8787}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpAnalyzers.UnitTests", "src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.shproj", "{58969243-7F59-4236-93D0-C93B81F569B3}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicCompilerExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.shproj", "{CEC0DCE7-8D52-45C3-9295-FC7B16BD2451}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicWorkspaceExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.shproj", "{E9DBFA41-7A9C-49BE-BD36-FD71B31AA9FE}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicAnalyzers.UnitTests", "src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.shproj", "{7B7F4153-AE93-4908-B8F0-430871589F83}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Analyzers", "src\Analyzers\Core\Analyzers\Analyzers.shproj", "{76E96966-4780-4040-8197-BDE2879516F4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CodeFixes", "src\Analyzers\Core\CodeFixes\CodeFixes.shproj", "{1B6C4A1A-413B-41FB-9F85-5C09118E541B}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpAnalyzers", "src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.shproj", "{EAFFCA55-335B-4860-BB99-EFCEAD123199}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpCodeFixes", "src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.shproj", "{DA973826-C985-4128-9948-0B445E638BDB}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicAnalyzers", "src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.shproj", "{94FAF461-2E74-4DBB-9813-6B2CDE6F1880}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicCodeFixes", "src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.shproj", "{9F9CCC78-7487-4127-9D46-DB23E501F001}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SharedUtilitiesAndExtensions", "SharedUtilitiesAndExtensions", "{DF17AF27-AA02-482B-8946-5CA8A50D5A2B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compiler", "Compiler", "{7A69EA65-4411-4CD0-B439-035E720C1BD3}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workspace", "Workspace", "{9C1BE25C-5926-4E56-84AE-D2242CB0627E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities", "src\EditorFeatures\DiagnosticsTestUtilities\Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj", "{B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities", "src\CodeStyle\Core\Tests\Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities.csproj", "{2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdeCoreBenchmarks", "src\Tools\IdeCoreBenchmarks\IdeCoreBenchmarks.csproj", "{CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildValidator", "src\Tools\BuildValidator\BuildValidator.csproj", "{8D22FC91-BDFE-4342-999B-D695E1C57E85}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildActionTelemetryTable", "src\Tools\BuildActionTelemetryTable\BuildActionTelemetryTable.csproj", "{2801F82B-78CE-4BAE-B06F-537574751E2E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrepareTests", "src\Tools\PrepareTests\PrepareTests.csproj", "{9B25E472-DF94-4E24-9F5D-E487CE5A91FB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Cocoa", "src\EditorFeatures\Core.Cocoa\Microsoft.CodeAnalysis.EditorFeatures.Cocoa.csproj", "{67F44564-759B-4643-BD86-407B010B0B74}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Test.Utilities", "src\Compilers\Test\Core\Microsoft.CodeAnalysis.Test.Utilities.csproj", "{5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.TestSourceGenerator", "src\Workspaces\TestSourceGenerator\Microsoft.CodeAnalysis.TestSourceGenerator.csproj", "{21B50E65-D601-4D82-B98A-FFE6DE3B25DC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.XunitHook", "src\EditorFeatures\XunitHook\Microsoft.CodeAnalysis.XunitHook.csproj", "{967A8F5E-7D18-436C-97ED-1DB303FE5DE0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeStyleConfigFileGenerator", "src\CodeStyle\Tools\CodeStyleConfigFileGenerator.csproj", "{41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.Collections", "src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.shproj", "{E919DD77-34F8-4F57-8058-4D3FF4C2B241}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Collections.Package", "src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.Package.csproj", "{0C2E1633-1462-4712-88F4-A0C945BAD3A8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Rebuild", "src\Compilers\Core\Rebuild\Microsoft.CodeAnalysis.Rebuild.csproj", "{B7D29559-4360-434A-B9B9-2C0612287999}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Rebuild.UnitTests", "src\Compilers\Core\RebuildTest\Microsoft.CodeAnalysis.Rebuild.UnitTests.csproj", "{21B49277-E55A-45EF-8818-744BCD6CB732}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests", "src\Tools\ExternalAccess\RazorTest\Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests.csproj", "{BB987FFC-B758-4F73-96A3-923DE8DCFF1A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.OmniSharp", "src\Tools\ExternalAccess\OmniSharp\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.csproj", "{1B73FB08-9A17-497E-97C5-FA312867D51B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp", "src\Tools\ExternalAccess\OmniSharp.CSharp\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp.csproj", "{AE976DE9-811D-4C86-AEBB-DCDC1226D754}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.UnitTests", "src\Tools\ExternalAccess\OmniSharpTest\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.UnitTests.csproj", "{3829F774-33F2-41E9-B568-AE555004FC62}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents", "src\Workspaces\Remote\ServiceHub.CoreComponents\Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj", "{8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{0be66736-cdaa-4989-88b1-b3f46ebdca4a}*SharedItemsImports = 5 src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{1b6c4a1a-413b-41fb-9f85-5c09118e541b}*SharedItemsImports = 13 src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.projitems*{21b239d0-d144-430f-a394-c066d58ee267}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{21b239d0-d144-430f-a394-c066d58ee267}*SharedItemsImports = 5 src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{2531a8c4-97dd-47bc-a79c-b7846051e137}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{2531a8c4-97dd-47bc-a79c-b7846051e137}*SharedItemsImports = 5 src\Analyzers\Core\Analyzers\Analyzers.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{3140fe61-0856-4367-9aa3-8081b9a80e35}*SharedItemsImports = 13 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{3140fe61-0856-4367-9aa3-8081b9a80e36}*SharedItemsImports = 13 src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{438db8af-f3f0-4ed9-80b5-13fddd5b8787}*SharedItemsImports = 13 src\Compilers\Core\CommandLine\CommandLine.projitems*{4b45ca0c-03a0-400f-b454-3d4bcb16af38}*SharedItemsImports = 5 src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{5018d049-5870-465a-889b-c742ce1e31cb}*SharedItemsImports = 5 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{54e08bf5-f819-404f-a18d-0ab9ea81ea04}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{57ca988d-f010-4bf2-9a2e-07d6dcd2ff2c}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{57ca988d-f010-4bf2-9a2e-07d6dcd2ff2c}*SharedItemsImports = 5 src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{58969243-7f59-4236-93d0-c93b81f569b3}*SharedItemsImports = 13 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{5ff1e493-69cc-4d0b-83f2-039f469a04e1}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{5ff1e493-69cc-4d0b-83f2-039f469a04e1}*SharedItemsImports = 5 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{60db272a-21c9-4e8d-9803-ff4e132392c8}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.projitems*{699fea05-aea7-403d-827e-53cf4e826955}*SharedItemsImports = 13 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{76242a2d-2600-49dd-8c15-fea07ecb1842}*SharedItemsImports = 5 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{76242a2d-2600-49dd-8c15-fea07ecb1843}*SharedItemsImports = 5 src\Analyzers\Core\Analyzers\Analyzers.projitems*{76e96966-4780-4040-8197-bde2879516f4}*SharedItemsImports = 13 src\Compilers\Core\CommandLine\CommandLine.projitems*{7ad4fe65-9a30-41a6-8004-aa8f89bcb7f3}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{7b7f4153-ae93-4908-b8f0-430871589f83}*SharedItemsImports = 13 src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{94faf461-2e74-4dbb-9813-6b2cde6f1880}*SharedItemsImports = 13 src\Compilers\Core\CommandLine\CommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{99f594b1-3916-471d-a761-a6731fc50e9a}*SharedItemsImports = 13 src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{9f9ccc78-7487-4127-9d46-db23e501f001}*SharedItemsImports = 13 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{a07abcf5-bc43-4ee9-8fd8-b2d77fd54d73}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{a07abcf5-bc43-4ee9-8fd8-b2d77fd54d73}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 5 src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 5 src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 5 src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.projitems*{aa87bfed-089a-4096-b8d5-690bdc7d5b24}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.projitems*{aa87bfed-089a-4096-b8d5-690bdc7d5b24}*SharedItemsImports = 5 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{abdbac1e-350e-4dc3-bb45-3504404545ee}*SharedItemsImports = 5 src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{ac2bcefb-9298-4621-ac48-1ff5e639e48d}*SharedItemsImports = 5 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{ace53515-482c-4c6a-e2d2-4242a687dfee}*SharedItemsImports = 5 src\Compilers\Core\CommandLine\CommandLine.projitems*{ad6f474e-e6d4-4217-91f3-b7af1be31ccc}*SharedItemsImports = 13 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{b501a547-c911-4a05-ac6e-274a50dff30e}*SharedItemsImports = 5 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{bb3ca047-5d00-48d4-b7d3-233c1265c065}*SharedItemsImports = 13 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{bedc5a4a-809e-4017-9cfd-6c8d4e1847f0}*SharedItemsImports = 5 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{bf9dac1e-3a5e-4dc3-bb44-9a64e0d4e9d3}*SharedItemsImports = 5 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{bf9dac1e-3a5e-4dc3-bb44-9a64e0d4e9d4}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{c1930979-c824-496b-a630-70f5369a636f}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{cec0dce7-8d52-45c3-9295-fc7b16bd2451}*SharedItemsImports = 13 src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{d0bc9be7-24f6-40ca-8dc6-fcb93bd44b34}*SharedItemsImports = 13 src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{d73adf7d-2c1c-42ae-b2ab-edc9497e4b71}*SharedItemsImports = 13 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{da973826-c985-4128-9948-0b445e638bdb}*SharedItemsImports = 13 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{e512c6c1-f085-4ad7-b0d9-e8f1a0a2a510}*SharedItemsImports = 5 src\Compilers\Core\CommandLine\CommandLine.projitems*{e58ee9d7-1239-4961-a0c1-f9ec3952c4c1}*SharedItemsImports = 5 src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{e8f0baa5-7327-43d1-9a51-644e81ae55f1}*SharedItemsImports = 13 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{e919dd77-34f8-4f57-8058-4d3ff4c2b241}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{e9dbfa41-7a9c-49be-bd36-fd71b31aa9fe}*SharedItemsImports = 13 src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.projitems*{eaffca55-335b-4860-bb99-efcead123199}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.projitems*{ec946164-1e17-410b-b7d9-7de7e6268d63}*SharedItemsImports = 13 src\Analyzers\Core\Analyzers\Analyzers.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{fa0e905d-ec46-466d-b7b2-3b5557f9428c}*SharedItemsImports = 5 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|Any CPU.Build.0 = Debug|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.ActiveCfg = Release|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.Build.0 = Release|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|Any CPU.Build.0 = Release|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|Any CPU.Build.0 = Debug|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|Any CPU.ActiveCfg = Release|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|Any CPU.Build.0 = Release|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|Any CPU.Build.0 = Release|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|Any CPU.Build.0 = Release|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|Any CPU.Build.0 = Debug|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|Any CPU.ActiveCfg = Release|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|Any CPU.Build.0 = Release|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|Any CPU.Build.0 = Debug|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|Any CPU.ActiveCfg = Release|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|Any CPU.Build.0 = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|Any CPU.Build.0 = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|Any CPU.ActiveCfg = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|Any CPU.Build.0 = Release|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Debug|Any CPU.Build.0 = Debug|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Release|Any CPU.ActiveCfg = Release|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Release|Any CPU.Build.0 = Release|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|Any CPU.Build.0 = Release|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|Any CPU.Build.0 = Debug|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|Any CPU.ActiveCfg = Release|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|Any CPU.Build.0 = Release|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|Any CPU.Build.0 = Debug|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|Any CPU.ActiveCfg = Release|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|Any CPU.Build.0 = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|Any CPU.Build.0 = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|Any CPU.ActiveCfg = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|Any CPU.Build.0 = Release|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|Any CPU.ActiveCfg = Release|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|Any CPU.Build.0 = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|Any CPU.Build.0 = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|Any CPU.Build.0 = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|Any CPU.Build.0 = Release|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|Any CPU.Build.0 = Release|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|Any CPU.Build.0 = Release|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|Any CPU.Build.0 = Debug|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|Any CPU.ActiveCfg = Release|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|Any CPU.Build.0 = Release|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|Any CPU.Build.0 = Release|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|Any CPU.Build.0 = Release|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|Any CPU.Build.0 = Debug|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|Any CPU.Build.0 = Release|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|Any CPU.Build.0 = Debug|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|Any CPU.ActiveCfg = Release|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|Any CPU.Build.0 = Release|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|Any CPU.Build.0 = Release|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|Any CPU.Build.0 = Release|Any CPU {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Debug|Any CPU.ActiveCfg = Debug|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Debug|Any CPU.Build.0 = Debug|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Release|Any CPU.ActiveCfg = Release|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Release|Any CPU.Build.0 = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Debug|Any CPU.ActiveCfg = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Debug|Any CPU.Build.0 = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Release|Any CPU.ActiveCfg = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Release|Any CPU.Build.0 = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|Any CPU.Build.0 = Debug|Any CPU {288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.ActiveCfg = Release|Any CPU {288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.Build.0 = Release|Any CPU {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.ActiveCfg = Debug|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.Build.0 = Debug|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Any CPU.ActiveCfg = Release|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Any CPU.Build.0 = Release|x64 {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|Any CPU.Build.0 = Debug|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|Any CPU.ActiveCfg = Release|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|Any CPU.Build.0 = Release|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|Any CPU.Build.0 = Release|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|Any CPU.Build.0 = Release|Any CPU {909B656F-6095-4AC2-A5AB-C3F032315C45}.Debug|Any CPU.ActiveCfg = Debug|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Debug|Any CPU.Build.0 = Debug|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Release|Any CPU.ActiveCfg = Release|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Release|Any CPU.Build.0 = Release|x64 {2E87FA96-50BB-4607-8676-46521599F998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Release|Any CPU.Build.0 = Release|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|Any CPU.Build.0 = Debug|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Release|Any CPU.ActiveCfg = Release|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Release|Any CPU.Build.0 = Release|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Release|Any CPU.Build.0 = Release|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|Any CPU.Build.0 = Debug|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|Any CPU.ActiveCfg = Release|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|Any CPU.Build.0 = Release|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|Any CPU.Build.0 = Debug|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|Any CPU.Build.0 = Release|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|Any CPU.Build.0 = Release|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|Any CPU.Build.0 = Debug|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|Any CPU.ActiveCfg = Release|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|Any CPU.Build.0 = Release|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|Any CPU.Build.0 = Debug|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|Any CPU.ActiveCfg = Release|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|Any CPU.Build.0 = Release|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|Any CPU.Build.0 = Release|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|Any CPU.Build.0 = Debug|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|Any CPU.ActiveCfg = Release|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|Any CPU.Build.0 = Release|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|Any CPU.Build.0 = Release|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|Any CPU.Build.0 = Release|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|Any CPU.Build.0 = Debug|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|Any CPU.ActiveCfg = Release|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|Any CPU.Build.0 = Release|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|Any CPU.Build.0 = Release|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|Any CPU.Build.0 = Debug|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Release|Any CPU.ActiveCfg = Release|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Release|Any CPU.Build.0 = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|Any CPU.Build.0 = Release|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|Any CPU.Build.0 = Debug|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|Any CPU.ActiveCfg = Release|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|Any CPU.Build.0 = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.Build.0 = Release|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|Any CPU.Build.0 = Debug|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|Any CPU.ActiveCfg = Release|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|Any CPU.Build.0 = Release|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|Any CPU.Build.0 = Release|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|Any CPU.Build.0 = Debug|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Release|Any CPU.ActiveCfg = Release|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Release|Any CPU.Build.0 = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|Any CPU.ActiveCfg = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|Any CPU.Build.0 = Release|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|Any CPU.Build.0 = Release|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|Any CPU.Build.0 = Debug|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|Any CPU.ActiveCfg = Release|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|Any CPU.Build.0 = Release|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|Any CPU.Build.0 = Debug|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|Any CPU.ActiveCfg = Release|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|Any CPU.Build.0 = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|Any CPU.ActiveCfg = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|Any CPU.Build.0 = Release|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Debug|Any CPU.Build.0 = Debug|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Release|Any CPU.ActiveCfg = Release|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Release|Any CPU.Build.0 = Release|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|Any CPU.Build.0 = Debug|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|Any CPU.ActiveCfg = Release|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|Any CPU.Build.0 = Release|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|Any CPU.Build.0 = Debug|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|Any CPU.ActiveCfg = Release|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|Any CPU.Build.0 = Release|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|Any CPU.Build.0 = Debug|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|Any CPU.ActiveCfg = Release|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|Any CPU.Build.0 = Release|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|Any CPU.Build.0 = Release|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|Any CPU.Build.0 = Debug|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|Any CPU.Build.0 = Release|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|Any CPU.Build.0 = Debug|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|Any CPU.ActiveCfg = Release|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|Any CPU.Build.0 = Release|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|Any CPU.Build.0 = Debug|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|Any CPU.Build.0 = Release|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|Any CPU.Build.0 = Release|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|Any CPU.Build.0 = Debug|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|Any CPU.ActiveCfg = Release|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|Any CPU.Build.0 = Release|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|Any CPU.Build.0 = Debug|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|Any CPU.Build.0 = Release|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|Any CPU.ActiveCfg = Release|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|Any CPU.Build.0 = Release|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|Any CPU.Build.0 = Release|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|Any CPU.Build.0 = Release|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|Any CPU.Build.0 = Debug|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|Any CPU.ActiveCfg = Release|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|Any CPU.Build.0 = Release|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|Any CPU.Build.0 = Release|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|Any CPU.Build.0 = Release|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|Any CPU.Build.0 = Debug|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|Any CPU.Build.0 = Release|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|Any CPU.Build.0 = Release|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|Any CPU.Build.0 = Debug|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|Any CPU.Build.0 = Release|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|Any CPU.Build.0 = Debug|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|Any CPU.ActiveCfg = Release|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|Any CPU.Build.0 = Release|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.Build.0 = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|Any CPU.Build.0 = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|Any CPU.ActiveCfg = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|Any CPU.Build.0 = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|Any CPU.Build.0 = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|Any CPU.ActiveCfg = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|Any CPU.Build.0 = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|Any CPU.Build.0 = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|Any CPU.Build.0 = Release|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Any CPU.Build.0 = Release|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|Any CPU.Build.0 = Debug|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|Any CPU.Build.0 = Release|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.Build.0 = Release|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|Any CPU.Build.0 = Release|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|Any CPU.Build.0 = Release|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|Any CPU.Build.0 = Debug|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|Any CPU.ActiveCfg = Release|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|Any CPU.Build.0 = Release|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.Build.0 = Release|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|Any CPU.ActiveCfg = Release|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|Any CPU.Build.0 = Release|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Release|Any CPU.Build.0 = Release|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|Any CPU.Build.0 = Release|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.Build.0 = Debug|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.ActiveCfg = Release|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.Build.0 = Release|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.Build.0 = Debug|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|Any CPU.ActiveCfg = Release|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|Any CPU.Build.0 = Release|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|Any CPU.Build.0 = Debug|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|Any CPU.ActiveCfg = Release|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|Any CPU.Build.0 = Release|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|Any CPU.Build.0 = Debug|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Release|Any CPU.Build.0 = Release|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|Any CPU.Build.0 = Debug|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|Any CPU.ActiveCfg = Release|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|Any CPU.Build.0 = Release|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|Any CPU.Build.0 = Debug|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|Any CPU.ActiveCfg = Release|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|Any CPU.Build.0 = Release|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|Any CPU.Build.0 = Debug|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|Any CPU.ActiveCfg = Release|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|Any CPU.Build.0 = Release|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|Any CPU.Build.0 = Release|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|Any CPU.Build.0 = Release|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|Any CPU.Build.0 = Release|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|Any CPU.Build.0 = Release|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|Any CPU.Build.0 = Debug|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|Any CPU.ActiveCfg = Release|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|Any CPU.Build.0 = Release|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|Any CPU.Build.0 = Debug|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|Any CPU.ActiveCfg = Release|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|Any CPU.Build.0 = Release|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|Any CPU.Build.0 = Debug|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|Any CPU.ActiveCfg = Release|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|Any CPU.Build.0 = Release|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|Any CPU.Build.0 = Release|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|Any CPU.Build.0 = Debug|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|Any CPU.ActiveCfg = Release|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|Any CPU.Build.0 = Release|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|Any CPU.Build.0 = Debug|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|Any CPU.ActiveCfg = Release|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|Any CPU.Build.0 = Release|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|Any CPU.Build.0 = Debug|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|Any CPU.ActiveCfg = Release|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|Any CPU.Build.0 = Release|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|Any CPU.Build.0 = Release|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|Any CPU.Build.0 = Release|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|Any CPU.Build.0 = Release|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|Any CPU.Build.0 = Debug|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|Any CPU.ActiveCfg = Release|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|Any CPU.Build.0 = Release|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|Any CPU.Build.0 = Debug|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|Any CPU.ActiveCfg = Release|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|Any CPU.Build.0 = Release|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|Any CPU.Build.0 = Debug|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|Any CPU.ActiveCfg = Release|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|Any CPU.Build.0 = Release|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|Any CPU.Build.0 = Debug|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|Any CPU.ActiveCfg = Release|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|Any CPU.Build.0 = Release|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|Any CPU.Build.0 = Debug|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Release|Any CPU.Build.0 = Release|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|Any CPU.Build.0 = Debug|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|Any CPU.ActiveCfg = Release|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|Any CPU.Build.0 = Release|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|Any CPU.Build.0 = Release|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|Any CPU.Build.0 = Debug|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|Any CPU.Build.0 = Release|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|Any CPU.Build.0 = Release|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|Any CPU.Build.0 = Release|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.Build.0 = Release|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.Build.0 = Debug|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|Any CPU.Build.0 = Release|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|Any CPU.Build.0 = Release|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|Any CPU.Build.0 = Debug|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|Any CPU.ActiveCfg = Release|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|Any CPU.Build.0 = Release|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|Any CPU.Build.0 = Debug|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|Any CPU.ActiveCfg = Release|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|Any CPU.Build.0 = Release|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|Any CPU.Build.0 = Release|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|Any CPU.Build.0 = Release|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|Any CPU.Build.0 = Debug|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|Any CPU.Build.0 = Release|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|Any CPU.Build.0 = Release|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|Any CPU.Build.0 = Release|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.Build.0 = Release|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.Build.0 = Release|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.Build.0 = Release|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.Build.0 = Debug|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.ActiveCfg = Release|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.Build.0 = Release|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.Build.0 = Debug|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.ActiveCfg = Release|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.Build.0 = Release|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|Any CPU.Build.0 = Release|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|Any CPU.Build.0 = Debug|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|Any CPU.ActiveCfg = Release|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|Any CPU.Build.0 = Release|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|Any CPU.ActiveCfg = Release|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|Any CPU.Build.0 = Release|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|Any CPU.Build.0 = Release|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|Any CPU.Build.0 = Debug|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|Any CPU.ActiveCfg = Release|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|Any CPU.Build.0 = Release|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|Any CPU.Build.0 = Debug|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|Any CPU.Build.0 = Release|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|Any CPU.Build.0 = Release|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.Build.0 = Release|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.Build.0 = Release|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.Build.0 = Release|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|Any CPU.Build.0 = Release|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|Any CPU.Build.0 = Debug|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|Any CPU.ActiveCfg = Release|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|Any CPU.Build.0 = Release|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.Build.0 = Release|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.Build.0 = Release|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|Any CPU.Build.0 = Release|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|Any CPU.Build.0 = Release|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|Any CPU.Build.0 = Release|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|Any CPU.Build.0 = Debug|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|Any CPU.ActiveCfg = Release|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|Any CPU.Build.0 = Release|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|Any CPU.Build.0 = Release|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|Any CPU.Build.0 = Debug|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|Any CPU.Build.0 = Release|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Release|Any CPU.Build.0 = Release|Any CPU {2801F82B-78CE-4BAE-B06F-537574751E2E}.Debug|Any CPU.ActiveCfg = Debug|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Debug|Any CPU.Build.0 = Debug|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|Any CPU.ActiveCfg = Release|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|Any CPU.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Debug|Any CPU.Build.0 = Debug|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Release|Any CPU.ActiveCfg = Release|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Release|Any CPU.Build.0 = Release|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Debug|Any CPU.Build.0 = Debug|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Release|Any CPU.ActiveCfg = Release|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Release|Any CPU.Build.0 = Release|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Release|Any CPU.Build.0 = Release|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Debug|Any CPU.Build.0 = Debug|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Release|Any CPU.ActiveCfg = Release|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Release|Any CPU.Build.0 = Release|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Debug|Any CPU.Build.0 = Debug|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Release|Any CPU.ActiveCfg = Release|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Release|Any CPU.Build.0 = Release|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Release|Any CPU.Build.0 = Release|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Debug|Any CPU.Build.0 = Debug|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Release|Any CPU.ActiveCfg = Release|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Release|Any CPU.Build.0 = Release|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Release|Any CPU.Build.0 = Release|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Release|Any CPU.Build.0 = Release|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Release|Any CPU.Build.0 = Release|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Release|Any CPU.Build.0 = Release|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Debug|Any CPU.Build.0 = Debug|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Release|Any CPU.ActiveCfg = Release|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Release|Any CPU.Build.0 = Release|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Debug|Any CPU.Build.0 = Debug|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {32A48625-F0AD-419D-828B-A50BDABA38EA} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {C65C6143-BED3-46E6-869E-9F0BE6E84C37} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {913A4C08-898E-49C7-9692-0EF9DC56CF6E} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {4C81EBB2-82E1-4C81-80C4-84CC40FA281B} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {19148439-436F-4CDA-B493-70AF4FFC13E9} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC} {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC} {7E907718-0B33-45C8-851F-396CEFDC1AB6} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} = {8DBA5174-B0AA-4561-82B1-A46607697753} {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} = {CAD2965A-19AB-489F-BE2E-7649957F914A} {DC014586-8D07-4DE6-B28E-C0540C59C085} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {A4C99B85-765C-4C65-9C2A-BB609AAB09E6} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {9508F118-F62E-4C16-A6F4-7C3B56E166AD} = {7E907718-0B33-45C8-851F-396CEFDC1AB6} {F5CE416E-B906-41D2-80B9-0078E887A3F6} = {7E907718-0B33-45C8-851F-396CEFDC1AB6} {4B45CA0C-03A0-400F-B454-3D4BCB16AF38} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {B501A547-C911-4A05-AC6E-274A50DFF30E} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {50D26304-0961-4A51-ABF6-6CAD1A56D203} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {4462B57A-7245-4146-B504-D46FDE762948} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {B2C33A93-DB30-4099-903E-77D75C4C3F45} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {50D26304-0961-4A51-ABF6-6CAD1A56D202} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {E3B32027-3362-41DF-9172-4D3B623F42A5} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {190CE348-596E-435A-9E5B-12A689F9FC29} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {9C9DABA4-0E72-4469-ADF1-4991F3CA572A} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {BDA5D613-596D-4B61-837C-63554151C8F5} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {91F6F646-4F6E-449A-9AB4-2986348F329D} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {5F8D2414-064A-4B3A-9B42-8E2A04246BE5} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {02459936-CD2C-4F61-B671-5C518F2A3DDC} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {288089C5-8721-458E-BE3E-78990DAB5E2E} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {288089C5-8721-458E-BE3E-78990DAB5E2D} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {C50166F1-BABC-40A9-95EB-8200080CD701} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {E3FDC65F-568D-4E2D-A093-5132FD3793B7} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {909B656F-6095-4AC2-A5AB-C3F032315C45} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {2E87FA96-50BB-4607-8676-46521599F998} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {96EB2D3B-F694-48C6-A284-67382841E086} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {21B239D0-D144-430F-A394-C066D58EE267} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {3973B09A-4FBF-44A5-8359-3D22CEB71F71} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {EDC68A0E-C68D-4A74-91B7-BF38EC909888} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {3CDEEAB7-2256-418A-BEB2-620B5CB16302} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {3E7DEA65-317B-4F43-A25D-62F18D96CFD7} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {12A68549-4E8C-42D6-8703-A09335F97997} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {066F0DBD-C46C-4C20-AFEC-99829A172625} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {8E2A252E-A140-45A6-A81A-2652996EA589} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {AC2BCEFB-9298-4621-AC48-1FF5E639E48D} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {16E93074-4252-466C-89A3-3B905ABAF779} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {3CEA0D69-00D3-40E5-A661-DC41EA07269B} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {76C6F005-C89D-4348-BB4A-39189DDBEB52} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {EBA4DFA1-6DED-418F-A485-A3B608978906} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {14118347-ED06-4608-9C45-18228273C712} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C} = {8DBA5174-B0AA-4561-82B1-A46607697753} {C0E80510-4FBE-4B0C-AF2C-4F473787722C} = {8DBA5174-B0AA-4561-82B1-A46607697753} {D49439D7-56D2-450F-A4F0-74CB95D620E6} = {8DBA5174-B0AA-4561-82B1-A46607697753} {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9} = {8DBA5174-B0AA-4561-82B1-A46607697753} {91C574AD-0352-47E9-A019-EE02CC32A396} = {8DBA5174-B0AA-4561-82B1-A46607697753} {A1455D30-55FC-45EF-8759-3AEBDB13D940} = {8DBA5174-B0AA-4561-82B1-A46607697753} {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC} = {8DBA5174-B0AA-4561-82B1-A46607697753} {A486D7DE-F614-409D-BB41-0FFDF582E35C} = {8DBA5174-B0AA-4561-82B1-A46607697753} {B617717C-7881-4F01-AB6D-B1B6CC0483A0} = {4C81EBB2-82E1-4C81-80C4-84CC40FA281B} {FD6BA96C-7905-4876-8BCC-E38E2CA64F31} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {AE297965-4D56-4BA9-85EB-655AC4FC95A0} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {60DB272A-21C9-4E8D-9803-FF4E132392C8} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {73242A2D-6300-499D-8C15-FADF7ECB185C} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {B8DA3A90-A60C-42E3-9D8E-6C67B800C395} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {ACE53515-482C-4C6A-E2D2-4242A687DFEE} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {21B80A31-8FF9-4E3A-8403-AABD635AEED9} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {ABDBAC1E-350E-4DC3-BB45-3504404545EE} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {D0BC9BE7-24F6-40CA-8DC6-FCB93BD44B34} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {3140FE61-0856-4367-9AA3-8081B9A80E35} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {76242A2D-2600-49DD-8C15-FEA07ECB1842} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {76242A2D-2600-49DD-8C15-FEA07ECB1843} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {3140FE61-0856-4367-9AA3-8081B9A80E36} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {BB3CA047-5D00-48D4-B7D3-233C1265C065} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {FA0E905D-EC46-466D-B7B2-3B5557F9428C} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {6FD1CC3E-6A99-4736-9B8D-757992DDE75D} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {286B01F3-811A-40A7-8C1F-10C9BB0597F7} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {24973B4C-FD09-4EE1-97F4-EA03E6B12040} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {ABC7262E-1053-49F3-B846-E3091BB92E8C} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {E2E889A5-2489-4546-9194-47C63E49EAEB} = {8DBA5174-B0AA-4561-82B1-A46607697753} {E8F0BAA5-7327-43D1-9A51-644E81AE55F1} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {54E08BF5-F819-404F-A18D-0AB9EA81EA04} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {AD6F474E-E6D4-4217-91F3-B7AF1BE31CCC} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {43026D51-3083-4850-928D-07E1883D5B1A} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {E5A55C16-A5B9-4874-9043-A5266DC02F58} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {3BED15FD-D608-4573-B432-1569C1026F6D} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} {971E832B-7471-48B5-833E-5913188EC0E4} = {8DBA5174-B0AA-4561-82B1-A46607697753} {59AD474E-2A35-4E8A-A74D-E33479977FBF} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} {D73ADF7D-2C1C-42AE-B2AB-EDC9497E4B71} = {C2D1346B-9665-4150-B644-075CF1636BAA} {C1930979-C824-496B-A630-70F5369A636F} = {C2D1346B-9665-4150-B644-075CF1636BAA} {F822F72A-CC87-4E31-B57D-853F65CBEBF3} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {80FDDD00-9393-47F7-8BAF-7E87CE011068} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {2E1658E2-5045-4F85-A64C-C0ECCD39F719} = {8DBA5174-B0AA-4561-82B1-A46607697753} {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {21A01C2D-2501-4619-8144-48977DD22D9C} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {3DFB4701-E3D6-4435-9F70-A6E35822C4F2} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {69F853E5-BD04-4842-984F-FC68CC51F402} = {8DBA5174-B0AA-4561-82B1-A46607697753} {6FC8E6F5-659C-424D-AEB5-331B95883E29} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {DD317BE1-42A1-4795-B1D4-F370C40D649A} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {1688E1E5-D510-4E06-86F3-F8DB10B1393D} = {8DBA5174-B0AA-4561-82B1-A46607697753} {F040CEC5-5E11-4DBD-9F6A-250478E28177} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} {275812EE-DEDB-4232-9439-91C9757D2AE4} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {5FF1E493-69CC-4D0B-83F2-039F469A04E1} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {AA87BFED-089A-4096-B8D5-690BDC7D5B24} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {2531A8C4-97DD-47BC-A79C-B7846051E137} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {0141285D-8F6C-42C7-BAF3-3C0CCD61C716} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {5018D049-5870-465A-889B-C742CE1E31CB} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {60166C60-813C-46C4-911D-2411B4ABBC0F} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89} = {C2D1346B-9665-4150-B644-075CF1636BAA} {49E7C367-181B-499C-AC2E-8E17C81418D6} = {C2D1346B-9665-4150-B644-075CF1636BAA} {037F06F0-3BE8-42D0-801E-2F74FC380AB8} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {2F11618A-9251-4609-B3D5-CE4D2B3D3E49} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {764D2C19-0187-4837-A2A3-96DDC6EF4CE2} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {9102ECF3-5CD1-4107-B8B7-F3795A52D790} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {CFA94A39-4805-456D-A369-FC35CCC170E9} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {C52D8057-43AF-40E6-A01B-6CDBB7301985} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {4A490CBC-37F4-4859-AFDB-4B0833D144AF} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {BE25E872-1667-4649-9D19-96B83E75A44E} = {8DBA5174-B0AA-4561-82B1-A46607697753} {0EB22BD1-B8B1-417D-8276-F475C2E190FF} = {BE25E872-1667-4649-9D19-96B83E75A44E} {3636D3E2-E3EF-4815-B020-819F382204CD} = {BE25E872-1667-4649-9D19-96B83E75A44E} {B9843F65-262E-4F40-A0BC-2CBEF7563A44} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {03607817-6800-40B6-BEAA-D6F437CD62B7} = {BE25E872-1667-4649-9D19-96B83E75A44E} {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5} = {BE25E872-1667-4649-9D19-96B83E75A44E} {23405307-7EFF-4774-8B11-8F5885439761} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {AFA5F921-0650-45E8-B293-51A0BB89DEA0} = {8DBA5174-B0AA-4561-82B1-A46607697753} {6362616E-6A47-48F0-9EE0-27800B306ACB} = {AFA5F921-0650-45E8-B293-51A0BB89DEA0} {8977A560-45C2-4EC2-A849-97335B382C74} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {BD8CE303-5F04-45EC-8DCF-73C9164CD614} = {8977A560-45C2-4EC2-A849-97335B382C74} {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC} = {8977A560-45C2-4EC2-A849-97335B382C74} {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE} = {8DBA5174-B0AA-4561-82B1-A46607697753} {A74C7D2E-92FA-490A-B80A-28BEF56B56FC} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {686BF57E-A6FF-467B-AAB3-44DE916A9772} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {1DDE89EE-5819-441F-A060-2FF4A986F372} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {655A5B07-39B8-48CD-8590-8AC0C2B708D8} = {8977A560-45C2-4EC2-A849-97335B382C74} {DE53934B-7FC1-48A0-85AB-C519FBBD02CF} = {8977A560-45C2-4EC2-A849-97335B382C74} {3D33BBFD-EC63-4E8C-A714-0A48A3809A87} = {BE25E872-1667-4649-9D19-96B83E75A44E} {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5} = {8977A560-45C2-4EC2-A849-97335B382C74} {FC32EF16-31B1-47B3-B625-A80933CB3F29} = {8977A560-45C2-4EC2-A849-97335B382C74} {453C8E28-81D4-431E-BFB0-F3D413346E51} = {8DBA5174-B0AA-4561-82B1-A46607697753} {CE7F7553-DB2D-4839-92E3-F042E4261B4E} = {8DBA5174-B0AA-4561-82B1-A46607697753} {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {D55FB2BD-CC9E-454B-9654-94AF5D910BF7} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {B9899CF1-E0EB-4599-9E24-6939A04B4979} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {D15BF03E-04ED-4BEE-A72B-7620F541F4E2} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {4A49D526-1644-4819-AA4F-95B348D447D4} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {EC946164-1E17-410B-B7D9-7DE7E6268D63} = {7A69EA65-4411-4CD0-B439-035E720C1BD3} {99F594B1-3916-471D-A761-A6731FC50E9A} = {9C1BE25C-5926-4E56-84AE-D2242CB0627E} {699FEA05-AEA7-403D-827E-53CF4E826955} = {7A69EA65-4411-4CD0-B439-035E720C1BD3} {438DB8AF-F3F0-4ED9-80B5-13FDDD5B8787} = {9C1BE25C-5926-4E56-84AE-D2242CB0627E} {58969243-7F59-4236-93D0-C93B81F569B3} = {4A49D526-1644-4819-AA4F-95B348D447D4} {CEC0DCE7-8D52-45C3-9295-FC7B16BD2451} = {7A69EA65-4411-4CD0-B439-035E720C1BD3} {E9DBFA41-7A9C-49BE-BD36-FD71B31AA9FE} = {9C1BE25C-5926-4E56-84AE-D2242CB0627E} {7B7F4153-AE93-4908-B8F0-430871589F83} = {4A49D526-1644-4819-AA4F-95B348D447D4} {76E96966-4780-4040-8197-BDE2879516F4} = {4A49D526-1644-4819-AA4F-95B348D447D4} {1B6C4A1A-413B-41FB-9F85-5C09118E541B} = {4A49D526-1644-4819-AA4F-95B348D447D4} {EAFFCA55-335B-4860-BB99-EFCEAD123199} = {4A49D526-1644-4819-AA4F-95B348D447D4} {DA973826-C985-4128-9948-0B445E638BDB} = {4A49D526-1644-4819-AA4F-95B348D447D4} {94FAF461-2E74-4DBB-9813-6B2CDE6F1880} = {4A49D526-1644-4819-AA4F-95B348D447D4} {9F9CCC78-7487-4127-9D46-DB23E501F001} = {4A49D526-1644-4819-AA4F-95B348D447D4} {DF17AF27-AA02-482B-8946-5CA8A50D5A2B} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {7A69EA65-4411-4CD0-B439-035E720C1BD3} = {DF17AF27-AA02-482B-8946-5CA8A50D5A2B} {9C1BE25C-5926-4E56-84AE-D2242CB0627E} = {DF17AF27-AA02-482B-8946-5CA8A50D5A2B} {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {8D22FC91-BDFE-4342-999B-D695E1C57E85} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {2801F82B-78CE-4BAE-B06F-537574751E2E} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {9B25E472-DF94-4E24-9F5D-E487CE5A91FB} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {67F44564-759B-4643-BD86-407B010B0B74} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {21B50E65-D601-4D82-B98A-FFE6DE3B25DC} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {967A8F5E-7D18-436C-97ED-1DB303FE5DE0} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {E919DD77-34F8-4F57-8058-4D3FF4C2B241} = {C2D1346B-9665-4150-B644-075CF1636BAA} {0C2E1633-1462-4712-88F4-A0C945BAD3A8} = {C2D1346B-9665-4150-B644-075CF1636BAA} {B7D29559-4360-434A-B9B9-2C0612287999} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {21B49277-E55A-45EF-8818-744BCD6CB732} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {BB987FFC-B758-4F73-96A3-923DE8DCFF1A} = {8977A560-45C2-4EC2-A849-97335B382C74} {1B73FB08-9A17-497E-97C5-FA312867D51B} = {8977A560-45C2-4EC2-A849-97335B382C74} {AE976DE9-811D-4C86-AEBB-DCDC1226D754} = {8977A560-45C2-4EC2-A849-97335B382C74} {3829F774-33F2-41E9-B568-AE555004FC62} = {8977A560-45C2-4EC2-A849-97335B382C74} {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {604E6B91-7BC0-4126-AE07-D4D2FEFC3D29} EndGlobalSection EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31319.15 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoslynDeployment", "src\Deployment\RoslynDeployment.csproj", "{600AF682-E097-407B-AD85-EE3CED37E680}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{A41D1B99-F489-4C43-BBDF-96D61B19A6B9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compilers", "Compilers", "{3F40F71B-7DCF-44A1-B15C-38CA34824143}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "CSharp", "{32A48625-F0AD-419D-828B-A50BDABA38EA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualBasic", "VisualBasic", "{C65C6143-BED3-46E6-869E-9F0BE6E84C37}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workspaces", "Workspaces", "{55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EditorFeatures", "EditorFeatures", "{EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExpressionEvaluator", "ExpressionEvaluator", "{235A3418-A3B0-4844-BCEB-F1CF45069232}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Features", "Features", "{3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interactive", "Interactive", "{999FBDA2-33DA-4F74-B957-03AC72CCE5EC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripting", "Scripting", "{38940C5F-97FD-4B2A-B2CD-C4E4EF601B05}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualStudio", "VisualStudio", "{8DBA5174-B0AA-4561-82B1-A46607697753}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "CSharp", "{913A4C08-898E-49C7-9692-0EF9DC56CF6E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualBasic", "VisualBasic", "{151F6994-AEB3-4B12-B746-2ACFF26C7BBB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Setup", "Setup", "{4C81EBB2-82E1-4C81-80C4-84CC40FA281B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{998CAFE8-06E4-4683-A151-0F6AA4BFF6C6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Setup", "Setup", "{19148439-436F-4CDA-B493-70AF4FFC13E9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosts", "Hosts", "{5CA5F70E-0FDB-467B-B22C-3CD5994F0087}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{7E907718-0B33-45C8-851F-396CEFDC1AB6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{CAD2965A-19AB-489F-BE2E-7649957F914A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IntegrationTest", "IntegrationTest", "{CC126D03-7EAC-493F-B187-DCDEE1EF6A70}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{C2D1346B-9665-4150-B644-075CF1636BAA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Perf", "Perf", "{DD13507E-D5AF-4B61-B11A-D55D6F4A73A5}" ProjectSection(SolutionItems) = preProject src\Test\Perf\readme.md = src\Test\Perf\readme.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeStyle", "CodeStyle", "{DC014586-8D07-4DE6-B28E-C0540C59C085}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.UnitTests", "src\Compilers\Core\CodeAnalysisTest\Microsoft.CodeAnalysis.UnitTests.csproj", "{A4C99B85-765C-4C65-9C2A-BB609AAB09E6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis", "src\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj", "{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VBCSCompiler", "src\Compilers\Server\VBCSCompiler\VBCSCompiler.csproj", "{9508F118-F62E-4C16-A6F4-7C3B56E166AD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VBCSCompiler.UnitTests", "src\Compilers\Server\VBCSCompilerTests\VBCSCompiler.UnitTests.csproj", "{F5CE416E-B906-41D2-80B9-0078E887A3F6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csc", "src\Compilers\CSharp\csc\csc.csproj", "{4B45CA0C-03A0-400F-B454-3D4BCB16AF38}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp", "src\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj", "{B501A547-C911-4A05-AC6E-274A50DFF30E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests", "src\Compilers\CSharp\Test\CommandLine\Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj", "{50D26304-0961-4A51-ABF6-6CAD1A56D203}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Emit.UnitTests", "src\Compilers\CSharp\Test\Emit\Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj", "{4462B57A-7245-4146-B504-D46FDE762948}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests", "src\Compilers\CSharp\Test\IOperation\Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests.csproj", "{1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests", "src\Compilers\CSharp\Test\Semantic\Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests.csproj", "{B2C33A93-DB30-4099-903E-77D75C4C3F45}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests", "src\Compilers\CSharp\Test\Symbol\Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests.csproj", "{28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests", "src\Compilers\CSharp\Test\Syntax\Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests.csproj", "{50D26304-0961-4A51-ABF6-6CAD1A56D202}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compiler.Test.Resources", "src\Compilers\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj", "{7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Test.Utilities", "src\Compilers\Test\Utilities\CSharp\Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj", "{4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Test.Utilities", "src\Compilers\Test\Utilities\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.Test.Utilities.vbproj", "{4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic", "src\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj", "{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests", "src\Compilers\VisualBasic\Test\CommandLine\Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests.vbproj", "{E3B32027-3362-41DF-9172-4D3B623F42A5}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests", "src\Compilers\VisualBasic\Test\Emit\Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests.vbproj", "{190CE348-596E-435A-9E5B-12A689F9FC29}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Roslyn.Compilers.VisualBasic.IOperation.UnitTests", "src\Compilers\VisualBasic\Test\IOperation\Roslyn.Compilers.VisualBasic.IOperation.UnitTests.vbproj", "{9C9DABA4-0E72-4469-ADF1-4991F3CA572A}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests", "src\Compilers\VisualBasic\Test\Semantic\Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests.vbproj", "{BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests", "src\Compilers\VisualBasic\Test\Symbol\Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests.vbproj", "{BDA5D613-596D-4B61-837C-63554151C8F5}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests", "src\Compilers\VisualBasic\Test\Syntax\Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests.vbproj", "{91F6F646-4F6E-449A-9AB4-2986348F329D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Test.PdbUtilities", "src\Test\PdbUtilities\Roslyn.Test.PdbUtilities.csproj", "{AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces", "src\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj", "{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompilersBoundTreeGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\BoundTreeGenerator\CompilersBoundTreeGenerator.csproj", "{02459936-CD2C-4F61-B671-5C518F2A3DDC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpErrorFactsGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\CSharpErrorFactsGenerator\CSharpErrorFactsGenerator.csproj", "{288089C5-8721-458E-BE3E-78990DAB5E2E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpSyntaxGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\CSharpSyntaxGenerator.csproj", "{288089C5-8721-458E-BE3E-78990DAB5E2D}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VisualBasicSyntaxGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\VisualBasicSyntaxGenerator\VisualBasicSyntaxGenerator.vbproj", "{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.UnitTests", "src\Workspaces\CoreTest\Microsoft.CodeAnalysis.Workspaces.UnitTests.csproj", "{C50166F1-BABC-40A9-95EB-8200080CD701}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests", "src\Workspaces\CSharpTest\Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests.csproj", "{E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests", "src\Workspaces\VisualBasicTest\Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests.vbproj", "{E3FDC65F-568D-4E2D-A093-5132FD3793B7}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VisualBasicErrorFactsGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\VisualBasicErrorFactsGenerator\VisualBasicErrorFactsGenerator.vbproj", "{909B656F-6095-4AC2-A5AB-C3F032315C45}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Desktop", "src\Workspaces\Core\Desktop\Microsoft.CodeAnalysis.Workspaces.Desktop.csproj", "{2E87FA96-50BB-4607-8676-46521599F998}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.MSBuild", "src\Workspaces\Core\MSBuild\Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj", "{96EB2D3B-F694-48C6-A284-67382841E086}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Workspaces", "src\Workspaces\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj", "{21B239D0-D144-430F-A394-C066D58EE267}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Workspaces", "src\Workspaces\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj", "{57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RunTests", "src\Tools\Source\RunTests\RunTests.csproj", "{1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Features", "src\Features\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Features.vbproj", "{A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Features", "src\Features\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Features.csproj", "{3973B09A-4FBF-44A5-8359-3D22CEB71F71}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Features", "src\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj", "{EDC68A0E-C68D-4A74-91B7-BF38EC909888}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Text", "src\EditorFeatures\Text\Microsoft.CodeAnalysis.EditorFeatures.Text.csproj", "{18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.EditorFeatures", "src\EditorFeatures\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.vbproj", "{49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.EditorFeatures", "src\EditorFeatures\CSharp\Microsoft.CodeAnalysis.CSharp.EditorFeatures.csproj", "{B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures", "src\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj", "{3CDEEAB7-2256-418A-BEB2-620B5CB16302}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests", "src\EditorFeatures\VisualBasicTest\Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests.vbproj", "{0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Scripting", "src\Scripting\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.Scripting.vbproj", "{3E7DEA65-317B-4F43-A25D-62F18D96CFD7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting", "src\Scripting\Core\Microsoft.CodeAnalysis.Scripting.csproj", "{12A68549-4E8C-42D6-8703-A09335F97997}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.UnitTests", "src\Scripting\CoreTest\Microsoft.CodeAnalysis.Scripting.UnitTests.csproj", "{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Scripting", "src\Scripting\CSharp\Microsoft.CodeAnalysis.CSharp.Scripting.csproj", "{066F0DBD-C46C-4C20-AFEC-99829A172625}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests", "src\Scripting\CSharpTest\Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests.csproj", "{2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.InteractiveHost", "src\Interactive\Host\Microsoft.CodeAnalysis.InteractiveHost.csproj", "{8E2A252E-A140-45A6-A81A-2652996EA589}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests", "src\EditorFeatures\CSharpTest\Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj", "{AC2BCEFB-9298-4621-AC48-1FF5E639E48D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests", "src\EditorFeatures\CSharpTest2\Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj", "{16E93074-4252-466C-89A3-3B905ABAF779}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.UnitTests", "src\EditorFeatures\Test\Microsoft.CodeAnalysis.EditorFeatures.UnitTests.csproj", "{8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.EditorFeatures2.UnitTests", "src\EditorFeatures\Test2\Microsoft.CodeAnalysis.EditorFeatures2.UnitTests.vbproj", "{3CEA0D69-00D3-40E5-A661-DC41EA07269B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities", "src\EditorFeatures\TestUtilities\Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj", "{76C6F005-C89D-4348-BB4A-39189DDBEB52}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveHost32", "src\Interactive\HostProcess\InteractiveHost32.csproj", "{EBA4DFA1-6DED-418F-A485-A3B608978906}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveHost.UnitTests", "src\Interactive\HostTest\InteractiveHost.UnitTests.csproj", "{8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csi", "src\Interactive\csi\csi.csproj", "{14118347-ED06-4608-9C45-18228273C712}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "vbi", "src\Interactive\vbi\vbi.vbproj", "{6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices", "src\VisualStudio\Core\Def\Microsoft.VisualStudio.LanguageServices.csproj", "{86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Implementation", "src\VisualStudio\Core\Impl\Microsoft.VisualStudio.LanguageServices.Implementation.csproj", "{C0E80510-4FBE-4B0C-AF2C-4F473787722C}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.VisualStudio.LanguageServices.VisualBasic", "src\VisualStudio\VisualBasic\Impl\Microsoft.VisualStudio.LanguageServices.VisualBasic.vbproj", "{D49439D7-56D2-450F-A4F0-74CB95D620E6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.CSharp", "src\VisualStudio\CSharp\Impl\Microsoft.VisualStudio.LanguageServices.CSharp.csproj", "{5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests", "src\VisualStudio\CSharp\Test\Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests.csproj", "{91C574AD-0352-47E9-A019-EE02CC32A396}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.VisualStudio.LanguageServices.UnitTests", "src\VisualStudio\Core\Test\Microsoft.VisualStudio.LanguageServices.UnitTests.vbproj", "{A1455D30-55FC-45EF-8759-3AEBDB13D940}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup", "src\VisualStudio\Setup\Roslyn.VisualStudio.Setup.csproj", "{201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.DiagnosticsWindow", "src\VisualStudio\VisualStudioDiagnosticsToolWindow\Roslyn.VisualStudio.DiagnosticsWindow.csproj", "{A486D7DE-F614-409D-BB41-0FFDF582E35C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExpressionEvaluatorPackage", "src\ExpressionEvaluator\Package\ExpressionEvaluatorPackage.csproj", "{B617717C-7881-4F01-AB6D-B1B6CC0483A0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ExpressionCompiler", "src\ExpressionEvaluator\CSharp\Source\ExpressionCompiler\Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.csproj", "{FD6BA96C-7905-4876-8BCC-E38E2CA64F31}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.UnitTests", "src\ExpressionEvaluator\CSharp\Test\ExpressionCompiler\Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.UnitTests.csproj", "{AE297965-4D56-4BA9-85EB-655AC4FC95A0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ResultProvider.UnitTests", "src\ExpressionEvaluator\CSharp\Test\ResultProvider\Microsoft.CodeAnalysis.CSharp.ResultProvider.UnitTests.csproj", "{60DB272A-21C9-4E8D-9803-FF4E132392C8}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler", "src\ExpressionEvaluator\VisualBasic\Source\ExpressionCompiler\Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.vbproj", "{73242A2D-6300-499D-8C15-FADF7ECB185C}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.UnitTests", "src\ExpressionEvaluator\VisualBasic\Test\ExpressionCompiler\Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.UnitTests.vbproj", "{AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExpressionCompiler", "src\ExpressionEvaluator\Core\Source\ExpressionCompiler\Microsoft.CodeAnalysis.ExpressionCompiler.csproj", "{B8DA3A90-A60C-42E3-9D8E-6C67B800C395}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ResultProvider.UnitTests", "src\ExpressionEvaluator\VisualBasic\Test\ResultProvider\Microsoft.CodeAnalysis.VisualBasic.ResultProvider.UnitTests.vbproj", "{ACE53515-482C-4C6A-E2D2-4242A687DFEE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExpressionCompiler.Utilities", "src\ExpressionEvaluator\Core\Test\ExpressionCompiler\Microsoft.CodeAnalysis.ExpressionCompiler.Utilities.csproj", "{21B80A31-8FF9-4E3A-8403-AABD635AEED9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ResultProvider.Utilities", "src\ExpressionEvaluator\Core\Test\ResultProvider\Microsoft.CodeAnalysis.ResultProvider.Utilities.csproj", "{ABDBAC1E-350E-4DC3-BB45-3504404545EE}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "AnalyzerDriver", "src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.shproj", "{D0BC9BE7-24F6-40CA-8DC6-FCB93BD44B34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests", "src\Compilers\CSharp\Test\WinRT\Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests.csproj", "{FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.Tasks.CodeAnalysis.UnitTests", "src\Compilers\Core\MSBuildTaskTests\Microsoft.Build.Tasks.CodeAnalysis.UnitTests.csproj", "{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BasicResultProvider", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.shproj", "{3140FE61-0856-4367-9AA3-8081B9A80E35}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "BasicResultProvider.NetFX20", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\NetFX20\BasicResultProvider.NetFX20.vbproj", "{76242A2D-2600-49DD-8C15-FEA07ECB1842}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.ResultProvider", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\Portable\Microsoft.CodeAnalysis.VisualBasic.ResultProvider.vbproj", "{76242A2D-2600-49DD-8C15-FEA07ECB1843}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpResultProvider", "src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.shproj", "{3140FE61-0856-4367-9AA3-8081B9A80E36}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpResultProvider.NetFX20", "src\ExpressionEvaluator\CSharp\Source\ResultProvider\NetFX20\CSharpResultProvider.NetFX20.csproj", "{BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.ResultProvider", "src\ExpressionEvaluator\CSharp\Source\ResultProvider\Portable\Microsoft.CodeAnalysis.CSharp.ResultProvider.csproj", "{BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ResultProvider", "src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.shproj", "{BB3CA047-5D00-48D4-B7D3-233C1265C065}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResultProvider.NetFX20", "src\ExpressionEvaluator\Core\Source\ResultProvider\NetFX20\ResultProvider.NetFX20.csproj", "{BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ResultProvider", "src\ExpressionEvaluator\Core\Source\ResultProvider\Portable\Microsoft.CodeAnalysis.ResultProvider.csproj", "{FA0E905D-EC46-466D-B7B2-3B5557F9428C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vbc", "src\Compilers\VisualBasic\vbc\vbc.csproj", "{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests", "src\Scripting\CoreTest.Desktop\Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests.csproj", "{6FD1CC3E-6A99-4736-9B8D-757992DDE75D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests", "src\Scripting\CSharpTest.Desktop\Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests.csproj", "{286B01F3-811A-40A7-8C1F-10C9BB0597F7}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Scripting.Desktop.UnitTests", "src\Scripting\VisualBasicTest.Desktop\Microsoft.CodeAnalysis.VisualBasic.Scripting.Desktop.UnitTests.vbproj", "{24973B4C-FD09-4EE1-97F4-EA03E6B12040}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests", "src\Scripting\VisualBasicTest\Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests.vbproj", "{ABC7262E-1053-49F3-B846-E3091BB92E8C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Hosting.Diagnostics", "src\Test\Diagnostics\Roslyn.Hosting.Diagnostics.csproj", "{E2E889A5-2489-4546-9194-47C63E49EAEB}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BasicAnalyzerDriver", "src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.shproj", "{E8F0BAA5-7327-43D1-9A51-644E81AE55F1}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpAnalyzerDriver", "src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.shproj", "{54E08BF5-F819-404F-A18D-0AB9EA81EA04}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CommandLine", "src\Compilers\Core\CommandLine\CommandLine.shproj", "{AD6F474E-E6D4-4217-91F3-B7AF1BE31CCC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Compilers.Extension", "src\Compilers\Extension\Roslyn.Compilers.Extension.csproj", "{43026D51-3083-4850-928D-07E1883D5B1A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.Setup", "src\VisualStudio\IntegrationTest\TestSetup\Microsoft.VisualStudio.IntegrationTest.Setup.csproj", "{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}" ProjectSection(ProjectDependencies) = postProject {600AF682-E097-407B-AD85-EE3CED37E680} = {600AF682-E097-407B-AD85-EE3CED37E680} {A486D7DE-F614-409D-BB41-0FFDF582E35C} = {A486D7DE-F614-409D-BB41-0FFDF582E35C} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.IntegrationTests", "src\VisualStudio\IntegrationTest\IntegrationTests\Microsoft.VisualStudio.LanguageServices.IntegrationTests.csproj", "{E5A55C16-A5B9-4874-9043-A5266DC02F58}" ProjectSection(ProjectDependencies) = postProject {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2} = {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.Utilities", "src\VisualStudio\IntegrationTest\TestUtilities\Microsoft.VisualStudio.IntegrationTest.Utilities.csproj", "{3BED15FD-D608-4573-B432-1569C1026F6D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.PerformanceTests", "src\Test\Perf\tests\Roslyn.PerformanceTests.csproj", "{DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Xaml", "src\VisualStudio\Xaml\Impl\Microsoft.VisualStudio.LanguageServices.Xaml.csproj", "{971E832B-7471-48B5-833E-5913188EC0E4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.Test.Performance.Utilities", "src\Test\Perf\Utilities\Roslyn.Test.Performance.Utilities.csproj", "{59AD474E-2A35-4E8A-A74D-E33479977FBF}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.Debugging", "src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.shproj", "{D73ADF7D-2C1C-42AE-B2AB-EDC9497E4B71}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.PooledObjects", "src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.shproj", "{C1930979-C824-496B-A630-70F5369A636F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.Workspaces", "src\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj", "{F822F72A-CC87-4E31-B57D-853F65CBEBF3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.ServiceHub", "src\Workspaces\Remote\ServiceHub\Microsoft.CodeAnalysis.Remote.ServiceHub.csproj", "{80FDDD00-9393-47F7-8BAF-7E87CE011068}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.Tasks.CodeAnalysis", "src\Compilers\Core\MSBuildTask\Microsoft.Build.Tasks.CodeAnalysis.csproj", "{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Next.UnitTests", "src\VisualStudio\Core\Test.Next\Roslyn.VisualStudio.Next.UnitTests.csproj", "{2E1658E2-5045-4F85-A64C-C0ECCD39F719}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildBoss", "src\Tools\BuildBoss\BuildBoss.csproj", "{9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.TestUtilities", "src\Scripting\CoreTestUtilities\Microsoft.CodeAnalysis.Scripting.TestUtilities.csproj", "{21A01C2D-2501-4619-8144-48977DD22D9C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Test.Utilities", "src\Workspaces\CoreTestUtilities\Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj", "{3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2", "src\EditorFeatures\TestUtilities2\Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2.vbproj", "{3DFB4701-E3D6-4435-9F70-A6E35822C4F2}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.VisualStudio.LanguageServices.Test.Utilities2", "src\VisualStudio\TestUtilities2\Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj", "{69F853E5-BD04-4842-984F-FC68CC51F402}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.FunctionResolver", "src\ExpressionEvaluator\Core\Source\FunctionResolver\Microsoft.CodeAnalysis.FunctionResolver.csproj", "{6FC8E6F5-659C-424D-AEB5-331B95883E29}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.FunctionResolver.UnitTests", "src\ExpressionEvaluator\Core\Test\FunctionResolver\Microsoft.CodeAnalysis.FunctionResolver.UnitTests.csproj", "{DD317BE1-42A1-4795-B1D4-F370C40D649A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup.Dependencies", "src\VisualStudio\Setup.Dependencies\Roslyn.VisualStudio.Setup.Dependencies.csproj", "{1688E1E5-D510-4E06-86F3-F8DB10B1393D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackDepthTest", "src\Test\Perf\StackDepthTest\StackDepthTest.csproj", "{F040CEC5-5E11-4DBD-9F6A-250478E28177}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle", "src\CodeStyle\Core\Analyzers\Microsoft.CodeAnalysis.CodeStyle.csproj", "{275812EE-DEDB-4232-9439-91C9757D2AE4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle.Fixes", "src\CodeStyle\Core\CodeFixes\Microsoft.CodeAnalysis.CodeStyle.Fixes.csproj", "{5FF1E493-69CC-4D0B-83F2-039F469A04E1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CodeStyle", "src\CodeStyle\CSharp\Analyzers\Microsoft.CodeAnalysis.CSharp.CodeStyle.csproj", "{AA87BFED-089A-4096-B8D5-690BDC7D5B24}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes", "src\CodeStyle\CSharp\CodeFixes\Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes.csproj", "{A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}" ProjectSection(ProjectDependencies) = postProject {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} = {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} EndProjectSection EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CodeStyle", "src\CodeStyle\VisualBasic\Analyzers\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.vbproj", "{2531A8C4-97DD-47BC-A79C-B7846051E137}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes", "src\CodeStyle\VisualBasic\CodeFixes\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes.vbproj", "{0141285D-8F6C-42C7-BAF3-3C0CCD61C716}" ProjectSection(ProjectDependencies) = postProject {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} = {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities", "src\CodeStyle\Core\Tests\Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities.csproj", "{9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests", "src\CodeStyle\CSharp\Tests\Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests.csproj", "{5018D049-5870-465A-889B-C742CE1E31CB}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests", "src\CodeStyle\VisualBasic\Tests\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests.vbproj", "{E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Wpf", "src\EditorFeatures\Core.Wpf\Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj", "{FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnalyzerRunner", "src\Tools\AnalyzerRunner\AnalyzerRunner.csproj", "{60166C60-813C-46C4-911D-2411B4ABBC0F}" ProjectSection(ProjectDependencies) = postProject {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2} = {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2} {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD} = {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD} {3CDEEAB7-2256-418A-BEB2-620B5CB16302} = {3CDEEAB7-2256-418A-BEB2-620B5CB16302} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Debugging.Package", "src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.Package.csproj", "{FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.PooledObjects.Package", "src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.Package.csproj", "{49E7C367-181B-499C-AC2E-8E17C81418D6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests", "src\Workspaces\MSBuildTest\Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests.csproj", "{037F06F0-3BE8-42D0-801E-2F74FC380AB8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteractiveHost64", "src\Interactive\HostProcess\InteractiveHost64.csproj", "{2F11618A-9251-4609-B3D5-CE4D2B3D3E49}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.IntegrationService", "src\VisualStudio\IntegrationTest\IntegrationService\Microsoft.VisualStudio.IntegrationTest.IntegrationService.csproj", "{764D2C19-0187-4837-A2A3-96DDC6EF4CE2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Compilers.Package", "src\NuGet\Microsoft.Net.Compilers\Microsoft.Net.Compilers.Package.csproj", "{9102ECF3-5CD1-4107-B8B7-F3795A52D790}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NETCore.Compilers.Package", "src\NuGet\Microsoft.NETCore.Compilers\Microsoft.NETCore.Compilers.Package.csproj", "{50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compilers.Package", "src\NuGet\Microsoft.CodeAnalysis.Compilers.Package.csproj", "{CFA94A39-4805-456D-A369-FC35CCC170E9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{C52D8057-43AF-40E6-A01B-6CDBB7301985}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Scripting.Package", "src\NuGet\Microsoft.CodeAnalysis.Scripting.Package.csproj", "{4A490CBC-37F4-4859-AFDB-4B0833D144AF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Package", "src\NuGet\Microsoft.CodeAnalysis.EditorFeatures.Package.csproj", "{34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{BE25E872-1667-4649-9D19-96B83E75A44E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VS.ExternalAPIs.Roslyn.Package", "src\NuGet\VisualStudio\VS.ExternalAPIs.Roslyn.Package.csproj", "{0EB22BD1-B8B1-417D-8276-F475C2E190FF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VS.Tools.Roslyn.Package", "src\NuGet\VisualStudio\VS.Tools.Roslyn.Package.csproj", "{3636D3E2-E3EF-4815-B020-819F382204CD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Package", "src\NuGet\Microsoft.CodeAnalysis.Package.csproj", "{B9843F65-262E-4F40-A0BC-2CBEF7563A44}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compilers.Setup", "src\Setup\DevDivVsix\CompilersPackage\Microsoft.CodeAnalysis.Compilers.Setup.csproj", "{03607817-6800-40B6-BEAA-D6F437CD62B7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Installer.Package", "src\Setup\Installer\Installer.Package.csproj", "{6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests", "src\Workspaces\DesktopTest\Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests.csproj", "{23405307-7EFF-4774-8B11-8F5885439761}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Insertion", "Insertion", "{AFA5F921-0650-45E8-B293-51A0BB89DEA0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevDivInsertionFiles", "src\Setup\DevDivInsertionFiles\DevDivInsertionFiles.csproj", "{6362616E-6A47-48F0-9EE0-27800B306ACB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalAccess", "ExternalAccess", "{8977A560-45C2-4EC2-A849-97335B382C74}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.FSharp", "src\Tools\ExternalAccess\FSharp\Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj", "{BD8CE303-5F04-45EC-8DCF-73C9164CD614}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Razor", "src\Tools\ExternalAccess\Razor\Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj", "{2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.CodeLens", "src\VisualStudio\CodeLens\Microsoft.VisualStudio.LanguageServices.CodeLens.csproj", "{5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Compilers.Toolset.Package", "src\NuGet\Microsoft.Net.Compilers.Toolset\Microsoft.Net.Compilers.Toolset.Package.csproj", "{A74C7D2E-92FA-490A-B80A-28BEF56B56FC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer.Protocol", "src\Features\LanguageServer\Protocol\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj", "{686BF57E-A6FF-467B-AAB3-44DE916A9772}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests", "src\Features\LanguageServer\ProtocolUnitTests\Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests.csproj", "{1DDE89EE-5819-441F-A060-2FF4A986F372}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Debugger", "src\Tools\ExternalAccess\Debugger\Microsoft.CodeAnalysis.ExternalAccess.Debugger.csproj", "{655A5B07-39B8-48CD-8590-8AC0C2B708D8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote", "src\Tools\ExternalAccess\Xamarin.Remote\Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote.csproj", "{DE53934B-7FC1-48A0-85AB-C519FBBD02CF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.VisualStudio.Setup.ServiceHub", "src\Setup\DevDivVsix\ServiceHubConfig\Roslyn.VisualStudio.Setup.ServiceHub.csproj", "{3D33BBFD-EC63-4E8C-A714-0A48A3809A87}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests", "src\Tools\ExternalAccess\FSharpTest\Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests.csproj", "{BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Apex", "src\Tools\ExternalAccess\Apex\Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj", "{FC32EF16-31B1-47B3-B625-A80933CB3F29}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.LiveShare", "src\VisualStudio\LiveShare\Impl\Microsoft.VisualStudio.LanguageServices.LiveShare.csproj", "{453C8E28-81D4-431E-BFB0-F3D413346E51}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests", "src\VisualStudio\LiveShare\Test\Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests.csproj", "{CE7F7553-DB2D-4839-92E3-F042E4261B4E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdeBenchmarks", "src\Tools\IdeBenchmarks\IdeBenchmarks.csproj", "{FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{157EA250-2F28-4948-A8F2-D58EAEA05DC8}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .vsconfig = .vsconfig EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompilersIOperationGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\IOperationGenerator\CompilersIOperationGenerator.csproj", "{D55FB2BD-CC9E-454B-9654-94AF5D910BF7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator", "src\Features\Lsif\Generator\Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj", "{B9899CF1-E0EB-4599-9E24-6939A04B4979}" EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests", "src\Features\Lsif\GeneratorTest\Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests.vbproj", "{D15BF03E-04ED-4BEE-A72B-7620F541F4E2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzers", "Analyzers", "{4A49D526-1644-4819-AA4F-95B348D447D4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CompilerExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.shproj", "{EC946164-1E17-410B-B7D9-7DE7E6268D63}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "WorkspaceExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.shproj", "{99F594B1-3916-471D-A761-A6731FC50E9A}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpCompilerExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.shproj", "{699FEA05-AEA7-403D-827E-53CF4E826955}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpWorkspaceExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.shproj", "{438DB8AF-F3F0-4ED9-80B5-13FDDD5B8787}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpAnalyzers.UnitTests", "src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.shproj", "{58969243-7F59-4236-93D0-C93B81F569B3}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicCompilerExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.shproj", "{CEC0DCE7-8D52-45C3-9295-FC7B16BD2451}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicWorkspaceExtensions", "src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.shproj", "{E9DBFA41-7A9C-49BE-BD36-FD71B31AA9FE}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicAnalyzers.UnitTests", "src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.shproj", "{7B7F4153-AE93-4908-B8F0-430871589F83}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Analyzers", "src\Analyzers\Core\Analyzers\Analyzers.shproj", "{76E96966-4780-4040-8197-BDE2879516F4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CodeFixes", "src\Analyzers\Core\CodeFixes\CodeFixes.shproj", "{1B6C4A1A-413B-41FB-9F85-5C09118E541B}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpAnalyzers", "src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.shproj", "{EAFFCA55-335B-4860-BB99-EFCEAD123199}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CSharpCodeFixes", "src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.shproj", "{DA973826-C985-4128-9948-0B445E638BDB}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicAnalyzers", "src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.shproj", "{94FAF461-2E74-4DBB-9813-6B2CDE6F1880}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VisualBasicCodeFixes", "src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.shproj", "{9F9CCC78-7487-4127-9D46-DB23E501F001}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SharedUtilitiesAndExtensions", "SharedUtilitiesAndExtensions", "{DF17AF27-AA02-482B-8946-5CA8A50D5A2B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compiler", "Compiler", "{7A69EA65-4411-4CD0-B439-035E720C1BD3}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workspace", "Workspace", "{9C1BE25C-5926-4E56-84AE-D2242CB0627E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities", "src\EditorFeatures\DiagnosticsTestUtilities\Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj", "{B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities", "src\CodeStyle\Core\Tests\Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities.csproj", "{2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdeCoreBenchmarks", "src\Tools\IdeCoreBenchmarks\IdeCoreBenchmarks.csproj", "{CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildValidator", "src\Tools\BuildValidator\BuildValidator.csproj", "{8D22FC91-BDFE-4342-999B-D695E1C57E85}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildActionTelemetryTable", "src\Tools\BuildActionTelemetryTable\BuildActionTelemetryTable.csproj", "{2801F82B-78CE-4BAE-B06F-537574751E2E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrepareTests", "src\Tools\PrepareTests\PrepareTests.csproj", "{9B25E472-DF94-4E24-9F5D-E487CE5A91FB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.EditorFeatures.Cocoa", "src\EditorFeatures\Core.Cocoa\Microsoft.CodeAnalysis.EditorFeatures.Cocoa.csproj", "{67F44564-759B-4643-BD86-407B010B0B74}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Test.Utilities", "src\Compilers\Test\Core\Microsoft.CodeAnalysis.Test.Utilities.csproj", "{5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.TestSourceGenerator", "src\Workspaces\TestSourceGenerator\Microsoft.CodeAnalysis.TestSourceGenerator.csproj", "{21B50E65-D601-4D82-B98A-FFE6DE3B25DC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.XunitHook", "src\EditorFeatures\XunitHook\Microsoft.CodeAnalysis.XunitHook.csproj", "{967A8F5E-7D18-436C-97ED-1DB303FE5DE0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeStyleConfigFileGenerator", "src\CodeStyle\Tools\CodeStyleConfigFileGenerator.csproj", "{41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.Collections", "src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.shproj", "{E919DD77-34F8-4F57-8058-4D3FF4C2B241}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Collections.Package", "src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.Package.csproj", "{0C2E1633-1462-4712-88F4-A0C945BAD3A8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Rebuild", "src\Compilers\Core\Rebuild\Microsoft.CodeAnalysis.Rebuild.csproj", "{B7D29559-4360-434A-B9B9-2C0612287999}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Rebuild.UnitTests", "src\Compilers\Core\RebuildTest\Microsoft.CodeAnalysis.Rebuild.UnitTests.csproj", "{21B49277-E55A-45EF-8818-744BCD6CB732}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests", "src\Tools\ExternalAccess\RazorTest\Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests.csproj", "{BB987FFC-B758-4F73-96A3-923DE8DCFF1A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.OmniSharp", "src\Tools\ExternalAccess\OmniSharp\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.csproj", "{1B73FB08-9A17-497E-97C5-FA312867D51B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp", "src\Tools\ExternalAccess\OmniSharp.CSharp\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp.csproj", "{AE976DE9-811D-4C86-AEBB-DCDC1226D754}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.UnitTests", "src\Tools\ExternalAccess\OmniSharpTest\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.UnitTests.csproj", "{3829F774-33F2-41E9-B568-AE555004FC62}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents", "src\Workspaces\Remote\ServiceHub.CoreComponents\Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj", "{8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{0be66736-cdaa-4989-88b1-b3f46ebdca4a}*SharedItemsImports = 5 src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{1b6c4a1a-413b-41fb-9f85-5c09118e541b}*SharedItemsImports = 13 src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.projitems*{21b239d0-d144-430f-a394-c066d58ee267}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{21b239d0-d144-430f-a394-c066d58ee267}*SharedItemsImports = 5 src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{2531a8c4-97dd-47bc-a79c-b7846051e137}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{2531a8c4-97dd-47bc-a79c-b7846051e137}*SharedItemsImports = 5 src\Analyzers\Core\Analyzers\Analyzers.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.projitems*{275812ee-dedb-4232-9439-91c9757d2ae4}*SharedItemsImports = 5 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{3140fe61-0856-4367-9aa3-8081b9a80e35}*SharedItemsImports = 13 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{3140fe61-0856-4367-9aa3-8081b9a80e36}*SharedItemsImports = 13 src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{438db8af-f3f0-4ed9-80b5-13fddd5b8787}*SharedItemsImports = 13 src\Compilers\Core\CommandLine\CommandLine.projitems*{4b45ca0c-03a0-400f-b454-3d4bcb16af38}*SharedItemsImports = 5 src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{5018d049-5870-465a-889b-c742ce1e31cb}*SharedItemsImports = 5 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{54e08bf5-f819-404f-a18d-0ab9ea81ea04}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{57ca988d-f010-4bf2-9a2e-07d6dcd2ff2c}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{57ca988d-f010-4bf2-9a2e-07d6dcd2ff2c}*SharedItemsImports = 5 src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{58969243-7f59-4236-93d0-c93b81f569b3}*SharedItemsImports = 13 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{5f8d2414-064a-4b3a-9b42-8e2a04246be5}*SharedItemsImports = 5 src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{5ff1e493-69cc-4d0b-83f2-039f469a04e1}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{5ff1e493-69cc-4d0b-83f2-039f469a04e1}*SharedItemsImports = 5 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{60db272a-21c9-4e8d-9803-ff4e132392c8}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.projitems*{699fea05-aea7-403d-827e-53cf4e826955}*SharedItemsImports = 13 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{76242a2d-2600-49dd-8c15-fea07ecb1842}*SharedItemsImports = 5 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{76242a2d-2600-49dd-8c15-fea07ecb1843}*SharedItemsImports = 5 src\Analyzers\Core\Analyzers\Analyzers.projitems*{76e96966-4780-4040-8197-bde2879516f4}*SharedItemsImports = 13 src\Compilers\Core\CommandLine\CommandLine.projitems*{7ad4fe65-9a30-41a6-8004-aa8f89bcb7f3}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{7b7f4153-ae93-4908-b8f0-430871589f83}*SharedItemsImports = 13 src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{94faf461-2e74-4dbb-9813-6b2cde6f1880}*SharedItemsImports = 13 src\Compilers\Core\CommandLine\CommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{99f594b1-3916-471d-a761-a6731fc50e9a}*SharedItemsImports = 13 src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{9f9ccc78-7487-4127-9d46-db23e501f001}*SharedItemsImports = 13 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{a07abcf5-bc43-4ee9-8fd8-b2d77fd54d73}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{a07abcf5-bc43-4ee9-8fd8-b2d77fd54d73}*SharedItemsImports = 5 src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 5 src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 5 src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 5 src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.projitems*{aa87bfed-089a-4096-b8d5-690bdc7d5b24}*SharedItemsImports = 5 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CSharpCompilerExtensions.projitems*{aa87bfed-089a-4096-b8d5-690bdc7d5b24}*SharedItemsImports = 5 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{abdbac1e-350e-4dc3-bb45-3504404545ee}*SharedItemsImports = 5 src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{ac2bcefb-9298-4621-ac48-1ff5e639e48d}*SharedItemsImports = 5 src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.projitems*{ace53515-482c-4c6a-e2d2-4242a687dfee}*SharedItemsImports = 5 src\Compilers\Core\CommandLine\CommandLine.projitems*{ad6f474e-e6d4-4217-91f3-b7af1be31ccc}*SharedItemsImports = 13 src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{b501a547-c911-4a05-ac6e-274a50dff30e}*SharedItemsImports = 5 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{bb3ca047-5d00-48d4-b7d3-233c1265c065}*SharedItemsImports = 13 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{bedc5a4a-809e-4017-9cfd-6c8d4e1847f0}*SharedItemsImports = 5 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{bf9dac1e-3a5e-4dc3-bb44-9a64e0d4e9d3}*SharedItemsImports = 5 src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpResultProvider.projitems*{bf9dac1e-3a5e-4dc3-bb44-9a64e0d4e9d4}*SharedItemsImports = 5 src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{c1930979-c824-496b-a630-70f5369a636f}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{cec0dce7-8d52-45c3-9295-fc7b16bd2451}*SharedItemsImports = 13 src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{d0bc9be7-24f6-40ca-8dc6-fcb93bd44b34}*SharedItemsImports = 13 src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{d73adf7d-2c1c-42ae-b2ab-edc9497e4b71}*SharedItemsImports = 13 src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{da973826-c985-4128-9948-0b445e638bdb}*SharedItemsImports = 13 src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{e512c6c1-f085-4ad7-b0d9-e8f1a0a2a510}*SharedItemsImports = 5 src\Compilers\Core\CommandLine\CommandLine.projitems*{e58ee9d7-1239-4961-a0c1-f9ec3952c4c1}*SharedItemsImports = 5 src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{e8f0baa5-7327-43d1-9a51-644e81ae55f1}*SharedItemsImports = 13 src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{e919dd77-34f8-4f57-8058-4d3ff4c2b241}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{e9dbfa41-7a9c-49be-bd36-fd71b31aa9fe}*SharedItemsImports = 13 src\Analyzers\CSharp\Analyzers\CSharpAnalyzers.projitems*{eaffca55-335b-4860-bb99-efcead123199}*SharedItemsImports = 13 src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CompilerExtensions.projitems*{ec946164-1e17-410b-b7d9-7de7e6268d63}*SharedItemsImports = 13 src\Analyzers\Core\Analyzers\Analyzers.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 5 src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{fa0e905d-ec46-466d-b7b2-3b5557f9428c}*SharedItemsImports = 5 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|Any CPU.Build.0 = Debug|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.ActiveCfg = Release|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.Build.0 = Release|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|Any CPU.Build.0 = Release|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|Any CPU.Build.0 = Debug|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|Any CPU.ActiveCfg = Release|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|Any CPU.Build.0 = Release|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|Any CPU.Build.0 = Release|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|Any CPU.Build.0 = Release|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|Any CPU.Build.0 = Debug|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|Any CPU.ActiveCfg = Release|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|Any CPU.Build.0 = Release|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|Any CPU.Build.0 = Debug|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|Any CPU.ActiveCfg = Release|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|Any CPU.Build.0 = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|Any CPU.Build.0 = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|Any CPU.ActiveCfg = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|Any CPU.Build.0 = Release|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Debug|Any CPU.Build.0 = Debug|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Release|Any CPU.ActiveCfg = Release|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Release|Any CPU.Build.0 = Release|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|Any CPU.Build.0 = Release|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|Any CPU.Build.0 = Debug|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|Any CPU.ActiveCfg = Release|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|Any CPU.Build.0 = Release|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|Any CPU.Build.0 = Debug|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|Any CPU.ActiveCfg = Release|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|Any CPU.Build.0 = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|Any CPU.Build.0 = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|Any CPU.ActiveCfg = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|Any CPU.Build.0 = Release|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|Any CPU.ActiveCfg = Release|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|Any CPU.Build.0 = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|Any CPU.Build.0 = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|Any CPU.Build.0 = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|Any CPU.Build.0 = Release|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|Any CPU.Build.0 = Release|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|Any CPU.Build.0 = Release|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|Any CPU.Build.0 = Debug|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|Any CPU.ActiveCfg = Release|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|Any CPU.Build.0 = Release|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|Any CPU.Build.0 = Release|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|Any CPU.Build.0 = Release|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|Any CPU.Build.0 = Debug|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|Any CPU.Build.0 = Release|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|Any CPU.Build.0 = Debug|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|Any CPU.ActiveCfg = Release|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|Any CPU.Build.0 = Release|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|Any CPU.Build.0 = Release|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|Any CPU.Build.0 = Release|Any CPU {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Debug|Any CPU.ActiveCfg = Debug|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Debug|Any CPU.Build.0 = Debug|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Release|Any CPU.ActiveCfg = Release|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Release|Any CPU.Build.0 = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Debug|Any CPU.ActiveCfg = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Debug|Any CPU.Build.0 = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Release|Any CPU.ActiveCfg = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Release|Any CPU.Build.0 = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|Any CPU.Build.0 = Debug|Any CPU {288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.ActiveCfg = Release|Any CPU {288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.Build.0 = Release|Any CPU {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.ActiveCfg = Debug|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.Build.0 = Debug|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Any CPU.ActiveCfg = Release|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Any CPU.Build.0 = Release|x64 {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|Any CPU.Build.0 = Debug|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|Any CPU.ActiveCfg = Release|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|Any CPU.Build.0 = Release|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|Any CPU.Build.0 = Release|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|Any CPU.Build.0 = Release|Any CPU {909B656F-6095-4AC2-A5AB-C3F032315C45}.Debug|Any CPU.ActiveCfg = Debug|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Debug|Any CPU.Build.0 = Debug|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Release|Any CPU.ActiveCfg = Release|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Release|Any CPU.Build.0 = Release|x64 {2E87FA96-50BB-4607-8676-46521599F998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Release|Any CPU.Build.0 = Release|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|Any CPU.Build.0 = Debug|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Release|Any CPU.ActiveCfg = Release|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Release|Any CPU.Build.0 = Release|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Release|Any CPU.Build.0 = Release|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|Any CPU.Build.0 = Debug|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|Any CPU.ActiveCfg = Release|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|Any CPU.Build.0 = Release|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|Any CPU.Build.0 = Debug|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|Any CPU.Build.0 = Release|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|Any CPU.Build.0 = Release|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|Any CPU.Build.0 = Debug|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|Any CPU.ActiveCfg = Release|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|Any CPU.Build.0 = Release|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|Any CPU.Build.0 = Debug|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|Any CPU.ActiveCfg = Release|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|Any CPU.Build.0 = Release|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|Any CPU.Build.0 = Release|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|Any CPU.Build.0 = Debug|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|Any CPU.ActiveCfg = Release|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|Any CPU.Build.0 = Release|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|Any CPU.Build.0 = Release|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|Any CPU.Build.0 = Release|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|Any CPU.Build.0 = Debug|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|Any CPU.ActiveCfg = Release|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|Any CPU.Build.0 = Release|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|Any CPU.Build.0 = Release|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|Any CPU.Build.0 = Debug|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Release|Any CPU.ActiveCfg = Release|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Release|Any CPU.Build.0 = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|Any CPU.Build.0 = Release|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|Any CPU.Build.0 = Debug|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|Any CPU.ActiveCfg = Release|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|Any CPU.Build.0 = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.Build.0 = Release|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|Any CPU.Build.0 = Debug|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|Any CPU.ActiveCfg = Release|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|Any CPU.Build.0 = Release|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|Any CPU.Build.0 = Release|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|Any CPU.Build.0 = Debug|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Release|Any CPU.ActiveCfg = Release|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Release|Any CPU.Build.0 = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|Any CPU.ActiveCfg = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|Any CPU.Build.0 = Release|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|Any CPU.Build.0 = Release|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|Any CPU.Build.0 = Debug|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|Any CPU.ActiveCfg = Release|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|Any CPU.Build.0 = Release|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|Any CPU.Build.0 = Debug|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|Any CPU.ActiveCfg = Release|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|Any CPU.Build.0 = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|Any CPU.Build.0 = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|Any CPU.ActiveCfg = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|Any CPU.Build.0 = Release|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Debug|Any CPU.Build.0 = Debug|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Release|Any CPU.ActiveCfg = Release|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Release|Any CPU.Build.0 = Release|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|Any CPU.Build.0 = Debug|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|Any CPU.ActiveCfg = Release|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|Any CPU.Build.0 = Release|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|Any CPU.Build.0 = Debug|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|Any CPU.ActiveCfg = Release|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|Any CPU.Build.0 = Release|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|Any CPU.Build.0 = Debug|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|Any CPU.ActiveCfg = Release|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|Any CPU.Build.0 = Release|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|Any CPU.Build.0 = Release|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|Any CPU.Build.0 = Debug|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|Any CPU.Build.0 = Release|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|Any CPU.Build.0 = Debug|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|Any CPU.ActiveCfg = Release|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|Any CPU.Build.0 = Release|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|Any CPU.Build.0 = Debug|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|Any CPU.Build.0 = Release|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|Any CPU.Build.0 = Release|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|Any CPU.Build.0 = Debug|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|Any CPU.ActiveCfg = Release|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|Any CPU.Build.0 = Release|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|Any CPU.Build.0 = Debug|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|Any CPU.Build.0 = Release|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|Any CPU.ActiveCfg = Release|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|Any CPU.Build.0 = Release|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|Any CPU.Build.0 = Release|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|Any CPU.Build.0 = Release|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|Any CPU.Build.0 = Debug|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|Any CPU.ActiveCfg = Release|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|Any CPU.Build.0 = Release|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|Any CPU.Build.0 = Release|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|Any CPU.Build.0 = Release|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|Any CPU.Build.0 = Debug|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|Any CPU.Build.0 = Release|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|Any CPU.Build.0 = Release|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|Any CPU.Build.0 = Debug|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|Any CPU.Build.0 = Release|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|Any CPU.Build.0 = Debug|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|Any CPU.ActiveCfg = Release|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|Any CPU.Build.0 = Release|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.Build.0 = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|Any CPU.Build.0 = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|Any CPU.ActiveCfg = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|Any CPU.Build.0 = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|Any CPU.Build.0 = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|Any CPU.ActiveCfg = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|Any CPU.Build.0 = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|Any CPU.Build.0 = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|Any CPU.Build.0 = Release|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Any CPU.Build.0 = Release|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|Any CPU.Build.0 = Debug|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|Any CPU.Build.0 = Release|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.Build.0 = Release|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|Any CPU.Build.0 = Release|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|Any CPU.Build.0 = Release|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|Any CPU.Build.0 = Debug|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|Any CPU.ActiveCfg = Release|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|Any CPU.Build.0 = Release|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.Build.0 = Release|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|Any CPU.ActiveCfg = Release|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|Any CPU.Build.0 = Release|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Release|Any CPU.Build.0 = Release|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|Any CPU.Build.0 = Release|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.Build.0 = Debug|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.ActiveCfg = Release|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.Build.0 = Release|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.Build.0 = Debug|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|Any CPU.ActiveCfg = Release|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|Any CPU.Build.0 = Release|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|Any CPU.Build.0 = Debug|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|Any CPU.ActiveCfg = Release|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|Any CPU.Build.0 = Release|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|Any CPU.Build.0 = Debug|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Release|Any CPU.Build.0 = Release|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|Any CPU.Build.0 = Debug|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|Any CPU.ActiveCfg = Release|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|Any CPU.Build.0 = Release|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|Any CPU.Build.0 = Debug|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|Any CPU.ActiveCfg = Release|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|Any CPU.Build.0 = Release|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|Any CPU.Build.0 = Debug|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|Any CPU.ActiveCfg = Release|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|Any CPU.Build.0 = Release|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|Any CPU.Build.0 = Release|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|Any CPU.Build.0 = Release|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|Any CPU.Build.0 = Release|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|Any CPU.Build.0 = Release|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|Any CPU.Build.0 = Debug|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|Any CPU.ActiveCfg = Release|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|Any CPU.Build.0 = Release|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|Any CPU.Build.0 = Debug|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|Any CPU.ActiveCfg = Release|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|Any CPU.Build.0 = Release|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|Any CPU.Build.0 = Debug|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|Any CPU.ActiveCfg = Release|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|Any CPU.Build.0 = Release|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|Any CPU.Build.0 = Release|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|Any CPU.Build.0 = Debug|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|Any CPU.ActiveCfg = Release|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|Any CPU.Build.0 = Release|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|Any CPU.Build.0 = Debug|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|Any CPU.ActiveCfg = Release|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|Any CPU.Build.0 = Release|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|Any CPU.Build.0 = Debug|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|Any CPU.ActiveCfg = Release|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|Any CPU.Build.0 = Release|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|Any CPU.Build.0 = Release|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|Any CPU.Build.0 = Release|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|Any CPU.Build.0 = Release|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|Any CPU.Build.0 = Debug|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|Any CPU.ActiveCfg = Release|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|Any CPU.Build.0 = Release|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|Any CPU.Build.0 = Debug|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|Any CPU.ActiveCfg = Release|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|Any CPU.Build.0 = Release|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|Any CPU.Build.0 = Debug|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|Any CPU.ActiveCfg = Release|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|Any CPU.Build.0 = Release|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|Any CPU.Build.0 = Debug|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|Any CPU.ActiveCfg = Release|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|Any CPU.Build.0 = Release|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|Any CPU.Build.0 = Debug|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Release|Any CPU.Build.0 = Release|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|Any CPU.Build.0 = Debug|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|Any CPU.ActiveCfg = Release|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|Any CPU.Build.0 = Release|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|Any CPU.Build.0 = Release|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|Any CPU.Build.0 = Debug|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|Any CPU.Build.0 = Release|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|Any CPU.Build.0 = Release|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|Any CPU.Build.0 = Release|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.Build.0 = Release|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.Build.0 = Debug|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|Any CPU.Build.0 = Release|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|Any CPU.Build.0 = Release|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|Any CPU.Build.0 = Debug|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|Any CPU.ActiveCfg = Release|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|Any CPU.Build.0 = Release|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|Any CPU.Build.0 = Debug|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|Any CPU.ActiveCfg = Release|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|Any CPU.Build.0 = Release|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|Any CPU.Build.0 = Release|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|Any CPU.Build.0 = Release|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|Any CPU.Build.0 = Debug|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|Any CPU.Build.0 = Release|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|Any CPU.Build.0 = Release|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|Any CPU.Build.0 = Release|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.Build.0 = Release|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.Build.0 = Release|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.Build.0 = Release|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.Build.0 = Debug|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.ActiveCfg = Release|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.Build.0 = Release|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.Build.0 = Debug|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.ActiveCfg = Release|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.Build.0 = Release|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|Any CPU.Build.0 = Release|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|Any CPU.Build.0 = Debug|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|Any CPU.ActiveCfg = Release|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|Any CPU.Build.0 = Release|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|Any CPU.ActiveCfg = Release|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|Any CPU.Build.0 = Release|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|Any CPU.Build.0 = Release|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|Any CPU.Build.0 = Debug|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|Any CPU.ActiveCfg = Release|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|Any CPU.Build.0 = Release|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|Any CPU.Build.0 = Debug|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|Any CPU.Build.0 = Release|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|Any CPU.Build.0 = Release|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.Build.0 = Release|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.Build.0 = Release|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.Build.0 = Release|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|Any CPU.Build.0 = Release|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|Any CPU.Build.0 = Debug|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|Any CPU.ActiveCfg = Release|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|Any CPU.Build.0 = Release|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.Build.0 = Release|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.Build.0 = Release|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|Any CPU.Build.0 = Release|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|Any CPU.Build.0 = Release|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|Any CPU.Build.0 = Release|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|Any CPU.Build.0 = Debug|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|Any CPU.ActiveCfg = Release|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|Any CPU.Build.0 = Release|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|Any CPU.Build.0 = Release|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|Any CPU.Build.0 = Debug|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|Any CPU.Build.0 = Release|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D22FC91-BDFE-4342-999B-D695E1C57E85}.Release|Any CPU.Build.0 = Release|Any CPU {2801F82B-78CE-4BAE-B06F-537574751E2E}.Debug|Any CPU.ActiveCfg = Debug|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Debug|Any CPU.Build.0 = Debug|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|Any CPU.ActiveCfg = Release|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|Any CPU.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Debug|Any CPU.Build.0 = Debug|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Release|Any CPU.ActiveCfg = Release|Any CPU {67F44564-759B-4643-BD86-407B010B0B74}.Release|Any CPU.Build.0 = Release|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Debug|Any CPU.Build.0 = Debug|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Release|Any CPU.ActiveCfg = Release|Any CPU {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6}.Release|Any CPU.Build.0 = Release|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B50E65-D601-4D82-B98A-FFE6DE3B25DC}.Release|Any CPU.Build.0 = Release|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Debug|Any CPU.Build.0 = Debug|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Release|Any CPU.ActiveCfg = Release|Any CPU {967A8F5E-7D18-436C-97ED-1DB303FE5DE0}.Release|Any CPU.Build.0 = Release|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Debug|Any CPU.Build.0 = Debug|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Release|Any CPU.ActiveCfg = Release|Any CPU {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0}.Release|Any CPU.Build.0 = Release|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C2E1633-1462-4712-88F4-A0C945BAD3A8}.Release|Any CPU.Build.0 = Release|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Debug|Any CPU.Build.0 = Debug|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Release|Any CPU.ActiveCfg = Release|Any CPU {B7D29559-4360-434A-B9B9-2C0612287999}.Release|Any CPU.Build.0 = Release|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Debug|Any CPU.Build.0 = Debug|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B49277-E55A-45EF-8818-744BCD6CB732}.Release|Any CPU.Build.0 = Release|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {BB987FFC-B758-4F73-96A3-923DE8DCFF1A}.Release|Any CPU.Build.0 = Release|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B73FB08-9A17-497E-97C5-FA312867D51B}.Release|Any CPU.Build.0 = Release|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE976DE9-811D-4C86-AEBB-DCDC1226D754}.Release|Any CPU.Build.0 = Release|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Debug|Any CPU.Build.0 = Debug|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Release|Any CPU.ActiveCfg = Release|Any CPU {3829F774-33F2-41E9-B568-AE555004FC62}.Release|Any CPU.Build.0 = Release|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Debug|Any CPU.Build.0 = Debug|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {32A48625-F0AD-419D-828B-A50BDABA38EA} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {C65C6143-BED3-46E6-869E-9F0BE6E84C37} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {913A4C08-898E-49C7-9692-0EF9DC56CF6E} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {4C81EBB2-82E1-4C81-80C4-84CC40FA281B} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} = {235A3418-A3B0-4844-BCEB-F1CF45069232} {19148439-436F-4CDA-B493-70AF4FFC13E9} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC} {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC} {7E907718-0B33-45C8-851F-396CEFDC1AB6} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} = {8DBA5174-B0AA-4561-82B1-A46607697753} {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} = {CAD2965A-19AB-489F-BE2E-7649957F914A} {DC014586-8D07-4DE6-B28E-C0540C59C085} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {A4C99B85-765C-4C65-9C2A-BB609AAB09E6} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {9508F118-F62E-4C16-A6F4-7C3B56E166AD} = {7E907718-0B33-45C8-851F-396CEFDC1AB6} {F5CE416E-B906-41D2-80B9-0078E887A3F6} = {7E907718-0B33-45C8-851F-396CEFDC1AB6} {4B45CA0C-03A0-400F-B454-3D4BCB16AF38} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {B501A547-C911-4A05-AC6E-274A50DFF30E} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {50D26304-0961-4A51-ABF6-6CAD1A56D203} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {4462B57A-7245-4146-B504-D46FDE762948} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {B2C33A93-DB30-4099-903E-77D75C4C3F45} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {50D26304-0961-4A51-ABF6-6CAD1A56D202} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {E3B32027-3362-41DF-9172-4D3B623F42A5} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {190CE348-596E-435A-9E5B-12A689F9FC29} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {9C9DABA4-0E72-4469-ADF1-4991F3CA572A} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {BDA5D613-596D-4B61-837C-63554151C8F5} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {91F6F646-4F6E-449A-9AB4-2986348F329D} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {5F8D2414-064A-4B3A-9B42-8E2A04246BE5} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {02459936-CD2C-4F61-B671-5C518F2A3DDC} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {288089C5-8721-458E-BE3E-78990DAB5E2E} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {288089C5-8721-458E-BE3E-78990DAB5E2D} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {C50166F1-BABC-40A9-95EB-8200080CD701} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {E3FDC65F-568D-4E2D-A093-5132FD3793B7} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {909B656F-6095-4AC2-A5AB-C3F032315C45} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {2E87FA96-50BB-4607-8676-46521599F998} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {96EB2D3B-F694-48C6-A284-67382841E086} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {21B239D0-D144-430F-A394-C066D58EE267} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {3973B09A-4FBF-44A5-8359-3D22CEB71F71} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {EDC68A0E-C68D-4A74-91B7-BF38EC909888} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {3CDEEAB7-2256-418A-BEB2-620B5CB16302} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {3E7DEA65-317B-4F43-A25D-62F18D96CFD7} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {12A68549-4E8C-42D6-8703-A09335F97997} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {066F0DBD-C46C-4C20-AFEC-99829A172625} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {8E2A252E-A140-45A6-A81A-2652996EA589} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {AC2BCEFB-9298-4621-AC48-1FF5E639E48D} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {16E93074-4252-466C-89A3-3B905ABAF779} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {3CEA0D69-00D3-40E5-A661-DC41EA07269B} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {76C6F005-C89D-4348-BB4A-39189DDBEB52} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {EBA4DFA1-6DED-418F-A485-A3B608978906} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {14118347-ED06-4608-9C45-18228273C712} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C} = {8DBA5174-B0AA-4561-82B1-A46607697753} {C0E80510-4FBE-4B0C-AF2C-4F473787722C} = {8DBA5174-B0AA-4561-82B1-A46607697753} {D49439D7-56D2-450F-A4F0-74CB95D620E6} = {8DBA5174-B0AA-4561-82B1-A46607697753} {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9} = {8DBA5174-B0AA-4561-82B1-A46607697753} {91C574AD-0352-47E9-A019-EE02CC32A396} = {8DBA5174-B0AA-4561-82B1-A46607697753} {A1455D30-55FC-45EF-8759-3AEBDB13D940} = {8DBA5174-B0AA-4561-82B1-A46607697753} {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC} = {8DBA5174-B0AA-4561-82B1-A46607697753} {A486D7DE-F614-409D-BB41-0FFDF582E35C} = {8DBA5174-B0AA-4561-82B1-A46607697753} {B617717C-7881-4F01-AB6D-B1B6CC0483A0} = {4C81EBB2-82E1-4C81-80C4-84CC40FA281B} {FD6BA96C-7905-4876-8BCC-E38E2CA64F31} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {AE297965-4D56-4BA9-85EB-655AC4FC95A0} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {60DB272A-21C9-4E8D-9803-FF4E132392C8} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {73242A2D-6300-499D-8C15-FADF7ECB185C} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {B8DA3A90-A60C-42E3-9D8E-6C67B800C395} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {ACE53515-482C-4C6A-E2D2-4242A687DFEE} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {21B80A31-8FF9-4E3A-8403-AABD635AEED9} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {ABDBAC1E-350E-4DC3-BB45-3504404545EE} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {D0BC9BE7-24F6-40CA-8DC6-FCB93BD44B34} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {3140FE61-0856-4367-9AA3-8081B9A80E35} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {76242A2D-2600-49DD-8C15-FEA07ECB1842} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {76242A2D-2600-49DD-8C15-FEA07ECB1843} = {151F6994-AEB3-4B12-B746-2ACFF26C7BBB} {3140FE61-0856-4367-9AA3-8081B9A80E36} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4} = {913A4C08-898E-49C7-9692-0EF9DC56CF6E} {BB3CA047-5D00-48D4-B7D3-233C1265C065} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {FA0E905D-EC46-466D-B7B2-3B5557F9428C} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {6FD1CC3E-6A99-4736-9B8D-757992DDE75D} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {286B01F3-811A-40A7-8C1F-10C9BB0597F7} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {24973B4C-FD09-4EE1-97F4-EA03E6B12040} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {ABC7262E-1053-49F3-B846-E3091BB92E8C} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {E2E889A5-2489-4546-9194-47C63E49EAEB} = {8DBA5174-B0AA-4561-82B1-A46607697753} {E8F0BAA5-7327-43D1-9A51-644E81AE55F1} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37} {54E08BF5-F819-404F-A18D-0AB9EA81EA04} = {32A48625-F0AD-419D-828B-A50BDABA38EA} {AD6F474E-E6D4-4217-91F3-B7AF1BE31CCC} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {43026D51-3083-4850-928D-07E1883D5B1A} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {E5A55C16-A5B9-4874-9043-A5266DC02F58} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {3BED15FD-D608-4573-B432-1569C1026F6D} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} {971E832B-7471-48B5-833E-5913188EC0E4} = {8DBA5174-B0AA-4561-82B1-A46607697753} {59AD474E-2A35-4E8A-A74D-E33479977FBF} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} {D73ADF7D-2C1C-42AE-B2AB-EDC9497E4B71} = {C2D1346B-9665-4150-B644-075CF1636BAA} {C1930979-C824-496B-A630-70F5369A636F} = {C2D1346B-9665-4150-B644-075CF1636BAA} {F822F72A-CC87-4E31-B57D-853F65CBEBF3} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {80FDDD00-9393-47F7-8BAF-7E87CE011068} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {2E1658E2-5045-4F85-A64C-C0ECCD39F719} = {8DBA5174-B0AA-4561-82B1-A46607697753} {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {21A01C2D-2501-4619-8144-48977DD22D9C} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {3DFB4701-E3D6-4435-9F70-A6E35822C4F2} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {69F853E5-BD04-4842-984F-FC68CC51F402} = {8DBA5174-B0AA-4561-82B1-A46607697753} {6FC8E6F5-659C-424D-AEB5-331B95883E29} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {DD317BE1-42A1-4795-B1D4-F370C40D649A} = {998CAFE8-06E4-4683-A151-0F6AA4BFF6C6} {1688E1E5-D510-4E06-86F3-F8DB10B1393D} = {8DBA5174-B0AA-4561-82B1-A46607697753} {F040CEC5-5E11-4DBD-9F6A-250478E28177} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5} {275812EE-DEDB-4232-9439-91C9757D2AE4} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {5FF1E493-69CC-4D0B-83F2-039F469A04E1} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {AA87BFED-089A-4096-B8D5-690BDC7D5B24} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {2531A8C4-97DD-47BC-A79C-B7846051E137} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {0141285D-8F6C-42C7-BAF3-3C0CCD61C716} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {5018D049-5870-465A-889B-C742CE1E31CB} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {60166C60-813C-46C4-911D-2411B4ABBC0F} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89} = {C2D1346B-9665-4150-B644-075CF1636BAA} {49E7C367-181B-499C-AC2E-8E17C81418D6} = {C2D1346B-9665-4150-B644-075CF1636BAA} {037F06F0-3BE8-42D0-801E-2F74FC380AB8} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {2F11618A-9251-4609-B3D5-CE4D2B3D3E49} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087} {764D2C19-0187-4837-A2A3-96DDC6EF4CE2} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70} {9102ECF3-5CD1-4107-B8B7-F3795A52D790} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {CFA94A39-4805-456D-A369-FC35CCC170E9} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {C52D8057-43AF-40E6-A01B-6CDBB7301985} = {3F40F71B-7DCF-44A1-B15C-38CA34824143} {4A490CBC-37F4-4859-AFDB-4B0833D144AF} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05} {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {BE25E872-1667-4649-9D19-96B83E75A44E} = {8DBA5174-B0AA-4561-82B1-A46607697753} {0EB22BD1-B8B1-417D-8276-F475C2E190FF} = {BE25E872-1667-4649-9D19-96B83E75A44E} {3636D3E2-E3EF-4815-B020-819F382204CD} = {BE25E872-1667-4649-9D19-96B83E75A44E} {B9843F65-262E-4F40-A0BC-2CBEF7563A44} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {03607817-6800-40B6-BEAA-D6F437CD62B7} = {BE25E872-1667-4649-9D19-96B83E75A44E} {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5} = {BE25E872-1667-4649-9D19-96B83E75A44E} {23405307-7EFF-4774-8B11-8F5885439761} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {AFA5F921-0650-45E8-B293-51A0BB89DEA0} = {8DBA5174-B0AA-4561-82B1-A46607697753} {6362616E-6A47-48F0-9EE0-27800B306ACB} = {AFA5F921-0650-45E8-B293-51A0BB89DEA0} {8977A560-45C2-4EC2-A849-97335B382C74} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {BD8CE303-5F04-45EC-8DCF-73C9164CD614} = {8977A560-45C2-4EC2-A849-97335B382C74} {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC} = {8977A560-45C2-4EC2-A849-97335B382C74} {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE} = {8DBA5174-B0AA-4561-82B1-A46607697753} {A74C7D2E-92FA-490A-B80A-28BEF56B56FC} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} {686BF57E-A6FF-467B-AAB3-44DE916A9772} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {1DDE89EE-5819-441F-A060-2FF4A986F372} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {655A5B07-39B8-48CD-8590-8AC0C2B708D8} = {8977A560-45C2-4EC2-A849-97335B382C74} {DE53934B-7FC1-48A0-85AB-C519FBBD02CF} = {8977A560-45C2-4EC2-A849-97335B382C74} {3D33BBFD-EC63-4E8C-A714-0A48A3809A87} = {BE25E872-1667-4649-9D19-96B83E75A44E} {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5} = {8977A560-45C2-4EC2-A849-97335B382C74} {FC32EF16-31B1-47B3-B625-A80933CB3F29} = {8977A560-45C2-4EC2-A849-97335B382C74} {453C8E28-81D4-431E-BFB0-F3D413346E51} = {8DBA5174-B0AA-4561-82B1-A46607697753} {CE7F7553-DB2D-4839-92E3-F042E4261B4E} = {8DBA5174-B0AA-4561-82B1-A46607697753} {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {D55FB2BD-CC9E-454B-9654-94AF5D910BF7} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {B9899CF1-E0EB-4599-9E24-6939A04B4979} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {D15BF03E-04ED-4BEE-A72B-7620F541F4E2} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {4A49D526-1644-4819-AA4F-95B348D447D4} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} {EC946164-1E17-410B-B7D9-7DE7E6268D63} = {7A69EA65-4411-4CD0-B439-035E720C1BD3} {99F594B1-3916-471D-A761-A6731FC50E9A} = {9C1BE25C-5926-4E56-84AE-D2242CB0627E} {699FEA05-AEA7-403D-827E-53CF4E826955} = {7A69EA65-4411-4CD0-B439-035E720C1BD3} {438DB8AF-F3F0-4ED9-80B5-13FDDD5B8787} = {9C1BE25C-5926-4E56-84AE-D2242CB0627E} {58969243-7F59-4236-93D0-C93B81F569B3} = {4A49D526-1644-4819-AA4F-95B348D447D4} {CEC0DCE7-8D52-45C3-9295-FC7B16BD2451} = {7A69EA65-4411-4CD0-B439-035E720C1BD3} {E9DBFA41-7A9C-49BE-BD36-FD71B31AA9FE} = {9C1BE25C-5926-4E56-84AE-D2242CB0627E} {7B7F4153-AE93-4908-B8F0-430871589F83} = {4A49D526-1644-4819-AA4F-95B348D447D4} {76E96966-4780-4040-8197-BDE2879516F4} = {4A49D526-1644-4819-AA4F-95B348D447D4} {1B6C4A1A-413B-41FB-9F85-5C09118E541B} = {4A49D526-1644-4819-AA4F-95B348D447D4} {EAFFCA55-335B-4860-BB99-EFCEAD123199} = {4A49D526-1644-4819-AA4F-95B348D447D4} {DA973826-C985-4128-9948-0B445E638BDB} = {4A49D526-1644-4819-AA4F-95B348D447D4} {94FAF461-2E74-4DBB-9813-6B2CDE6F1880} = {4A49D526-1644-4819-AA4F-95B348D447D4} {9F9CCC78-7487-4127-9D46-DB23E501F001} = {4A49D526-1644-4819-AA4F-95B348D447D4} {DF17AF27-AA02-482B-8946-5CA8A50D5A2B} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {7A69EA65-4411-4CD0-B439-035E720C1BD3} = {DF17AF27-AA02-482B-8946-5CA8A50D5A2B} {9C1BE25C-5926-4E56-84AE-D2242CB0627E} = {DF17AF27-AA02-482B-8946-5CA8A50D5A2B} {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {8D22FC91-BDFE-4342-999B-D695E1C57E85} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {2801F82B-78CE-4BAE-B06F-537574751E2E} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {9B25E472-DF94-4E24-9F5D-E487CE5A91FB} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {67F44564-759B-4643-BD86-407B010B0B74} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {5D94ED65-EFA3-44EB-A5DA-62E85BAC9DD6} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {21B50E65-D601-4D82-B98A-FFE6DE3B25DC} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {967A8F5E-7D18-436C-97ED-1DB303FE5DE0} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6} {41ED1BFA-FDAD-4FE4-8118-DB23FB49B0B0} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {E919DD77-34F8-4F57-8058-4D3FF4C2B241} = {C2D1346B-9665-4150-B644-075CF1636BAA} {0C2E1633-1462-4712-88F4-A0C945BAD3A8} = {C2D1346B-9665-4150-B644-075CF1636BAA} {B7D29559-4360-434A-B9B9-2C0612287999} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {21B49277-E55A-45EF-8818-744BCD6CB732} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} {BB987FFC-B758-4F73-96A3-923DE8DCFF1A} = {8977A560-45C2-4EC2-A849-97335B382C74} {1B73FB08-9A17-497E-97C5-FA312867D51B} = {8977A560-45C2-4EC2-A849-97335B382C74} {AE976DE9-811D-4C86-AEBB-DCDC1226D754} = {8977A560-45C2-4EC2-A849-97335B382C74} {3829F774-33F2-41E9-B568-AE555004FC62} = {8977A560-45C2-4EC2-A849-97335B382C74} {8FCD1B85-BE63-4A2F-8E19-37244F19BE0F} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {604E6B91-7BC0-4126-AE07-D4D2FEFC3D29} EndGlobalSection EndGlobal
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/Util/WriteUtils.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. '----------------------------------------------------------------------------------------------------------- ' Defines a base class that is inherited by the writing classes that defines a bunch of utility ' functions for building up names of constructs. Basically anything that we want to shared between different ' output classes is defined here. '----------------------------------------------------------------------------------------------------------- Imports System.IO Imports System.Text ' Utility functions for writing out the parse tree. Basically name generation and various simply utility functions ' that are shared by different writing classes. This is typically inherited by a writing class. Public MustInherit Class WriteUtils Protected _parseTree As ParseTree ' the tree to output #If OLDSTYLE Then Protected Const NodeKindString = "NodeKind" Protected Const NodeListString = "NodeList" Protected Const SeparatedNodeListString = "SeparatedNodeList" Protected Const NodeFactoryListString = "NodeFactory" #Else Protected Const NodeKindString = "SyntaxKind" Protected Const NodeListString = "SyntaxList" Protected Const SeparatedNodeListString = "SeparatedSyntaxList" Protected Const NodeFactoryListString = "Syntax" #End If Public Sub New(parseTree As ParseTree) _parseTree = parseTree End Sub ' Name generation ' Get the base type name (no namespace) for a node structure. Protected Function StructureTypeName(nodeStructure As ParseNodeStructure) As String Return Ident(nodeStructure.Name) End Function ' Get the base type name (no namespace) for an enumeration. Protected Function EnumerationName(enumeration As ParseEnumeration) As String Return Ident(enumeration.Name) End Function 'Get a factory name from a kind Protected Function FactoryName(nodeKind As ParseNodeKind) As String Return nodeKind.Name End Function 'Get a factory name from a structure Protected Function FactoryName(nodeStructure As ParseNodeStructure) As String #If OLDSTYLE Then Return nodeStructure.Name #Else If nodeStructure.Name.EndsWith("Syntax", StringComparison.Ordinal) Then Return nodeStructure.Name.Substring(0, nodeStructure.Name.Length - 6) Else Return nodeStructure.Name End If #End If End Function Protected Function SyntaxFactName(nodeStructure As ParseNodeStructure) As String Dim name = FactoryName(nodeStructure) If name = "Keyword" Then name = "KeywordKind" End If Return name End Function ' Get the name for a field private variable Protected Function FieldVarName(nodeField As ParseNodeField) As String Dim name As String = nodeField.Name Return "_" + LowerFirstCharacter(name) End Function ' Get the name for a child private variable Protected Function ChildVarName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name Return "_" + LowerFirstCharacter(name) End Function ' Get the name for a child private variable cache (not in the builder, but in the actual node) Protected Function ChildCacheVarName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name Return "_" + LowerFirstCharacter(name) + "Cache" End Function ' Get the name for a new child variable is the visitor Protected Function ChildNewVarName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name Return Ident("new" + UpperFirstCharacter(name)) End Function #If False Then ' Get the name for a new child variable is the visitor, but for the separators Protected Function ChildNewVarSeparatorsName(ByVal nodeChild As ParseNodeChild) As String Dim name As String = ChildSeparatorsName(nodeChild) Return Ident(LowerFirstCharacter(name) + "New") End Function #End If ' Get the name for a field parameter. ' If conflictName is not nothing, make sure the name doesn't conflict with that name. Protected Function FieldParamName(nodeField As ParseNodeField, Optional conflictName As String = Nothing) As String Dim name As String = nodeField.Name If String.Equals(name, conflictName, StringComparison.OrdinalIgnoreCase) Then name += "Parameter" End If Return Ident(LowerFirstCharacter(name)) End Function ' Get the name for a child parameter ' If conflictName is not nothing, make sure the name doesn't conflict with that name. Protected Function ChildParamName(nodeChild As ParseNodeChild, Optional conflictName As String = Nothing) As String Dim name As String = OptionalChildName(nodeChild) If String.Equals(name, conflictName, StringComparison.OrdinalIgnoreCase) Then name += "Parameter" End If Return Ident(LowerFirstCharacter(name)) End Function #If False Then ' Get the name for a child separator list parameter Protected Function ChildSeparatorsParamName(ByVal nodeChild As ParseNodeChild) As String Return Ident(LowerFirstCharacter(ChildSeparatorsName(nodeChild))) End Function #End If ' Get the name for a field property Protected Function FieldPropertyName(nodeField As ParseNodeField) As String Return Ident(UnescapedFieldPropertyName(nodeField)) End Function Protected Function UnescapedFieldPropertyName(nodeField As ParseNodeField) As String Dim name As String = nodeField.Name Return UpperFirstCharacter(name) End Function ' Get the name for a child property Protected Function ChildWithFunctionName(nodeChild As ParseNodeChild) As String Return Ident("With" + UpperFirstCharacter(nodeChild.Name)) End Function ' Get the name for a child property Protected Function ChildPropertyName(nodeChild As ParseNodeChild) As String Return Ident(UnescapedChildPropertyName(nodeChild)) End Function Protected Function UnescapedChildPropertyName(nodeChild As ParseNodeChild) As String Return UpperFirstCharacter(OptionalChildName(nodeChild)) End Function ' Get the name for a child separators property Protected Function ChildSeparatorsPropertyName(nodeChild As ParseNodeChild) As String Return Ident(UpperFirstCharacter(ChildSeparatorsName(nodeChild))) End Function ' If a child is optional and isn't a list, add "Optional" to the name. Protected Function OptionalChildName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name If nodeChild.IsOptional AndAlso Not nodeChild.IsList Then #If OLDSTYLE Then Return "Optional" + UpperFirstCharacter(name) #Else Return UpperFirstCharacter(name) #End If Else Return UpperFirstCharacter(name) End If End Function ' If a child is a separated list, return the name of the separators. Protected Function ChildSeparatorsName(nodeChild As ParseNodeChild) As String If nodeChild.IsList AndAlso nodeChild.IsSeparated Then If String.IsNullOrEmpty(nodeChild.SeparatorsName) Then _parseTree.ReportError(nodeChild.Element, "separator-name was not found, but is required for separated lists") End If Return UpperFirstCharacter(nodeChild.SeparatorsName) Else Throw New InvalidOperationException("Shouldn't get here") End If End Function ' Get the type reference for a field property Protected Function FieldTypeRef(nodeField As ParseNodeField) As String Dim fieldType As Object = nodeField.FieldType If TypeOf fieldType Is SimpleType Then Return SimpleTypeName(CType(fieldType, SimpleType)) ElseIf TypeOf fieldType Is ParseEnumeration Then Return EnumerationTypeName(CType(fieldType, ParseEnumeration)) End If nodeField.ParseTree.ReportError(nodeField.Element, "Bad type for field") Return "UNKNOWNTYPE" End Function ' Get the type reference for a child property Protected Function ChildPropertyTypeRef(nodeStructure As ParseNodeStructure, nodeChild As ParseNodeChild, Optional isGreen As Boolean = False, Optional denyOverride As Boolean = False) As String Dim isOverride = nodeChild.ContainingStructure IsNot nodeStructure AndAlso Not denyOverride Dim result As String If nodeChild.IsList Then If nodeChild.IsSeparated Then result = String.Format(If(isGreen, "SeparatedSyntaxList(Of {0})", "SeparatedSyntaxList(Of {0})"), BaseTypeReference(nodeChild)) ElseIf KindTypeStructure(nodeChild.ChildKind).IsToken Then If isGreen Then result = String.Format("SyntaxList(Of {0})", BaseTypeReference(nodeChild)) Else result = "SyntaxTokenList" End If Else result = String.Format("SyntaxList(Of {0})", BaseTypeReference(nodeChild)) End If Else If Not isGreen AndAlso KindTypeStructure(nodeChild.ChildKind).IsToken Then Return String.Format("SyntaxToken") End If If Not isGreen AndAlso isOverride Then Dim childKindStructure As ParseNodeStructure = Nothing If nodeStructure.NodeKinds.Count = 1 Then Dim childNodeKind = GetChildNodeKind(nodeStructure.NodeKinds(0), nodeChild) childKindStructure = KindTypeStructure(childNodeKind) Else Dim childKinds As New HashSet(Of ParseNodeKind)() For Each kind In nodeStructure.NodeKinds Dim childNodeKind = GetChildNodeKind(kind, nodeChild) If childNodeKind IsNot Nothing Then childKinds.Add(GetChildNodeKind(kind, nodeChild)) Else childKinds = Nothing Exit For End If Next If childKinds IsNot Nothing Then If childKinds.Count = 1 Then childKindStructure = KindTypeStructure(childKinds.First) Else childKindStructure = GetCommonStructure(childKinds.ToList()) End If End If End If If childKindStructure IsNot Nothing Then Return childKindStructure.Name End If End If result = BaseTypeReference(nodeChild) End If If isGreen Then If nodeChild.IsList Then Return String.Format("Global.Microsoft.CodeAnalysis.Syntax.InternalSyntax.{0}", result) Else Return String.Format("InternalSyntax.{0}", result) End If End If Return result End Function Protected Function ChildFieldTypeRef(nodeChild As ParseNodeChild, Optional isGreen As Boolean = False) As String If nodeChild.IsList Then If nodeChild.IsSeparated Then Return String.Format(If(isGreen, "GreenNode", "SeparatedSyntaxList(Of {0})"), BaseTypeReference(nodeChild)) Else Return String.Format(If(isGreen, "GreenNode", "SyntaxList(Of {0})"), BaseTypeReference(nodeChild)) End If Else Return BaseTypeReference(nodeChild) End If End Function Protected Function ChildPrivateFieldTypeRef(nodeChild As ParseNodeChild) As String If nodeChild.IsList Then Return "SyntaxNode" Else Return BaseTypeReference(nodeChild) End If End Function ' Get the type reference for a child separators property Protected Function ChildSeparatorsTypeRef(nodeChild As ParseNodeChild) As String Return String.Format("SyntaxList(Of {0})", SeparatorsBaseTypeReference(nodeChild)) End Function ' Get the type reference for a child constructor Protected Function ChildConstructorTypeRef(nodeChild As ParseNodeChild, Optional isGreen As Boolean = False) As String If nodeChild.IsList Then If isGreen OrElse KindTypeStructure(nodeChild.ChildKind).IsToken Then Return "GreenNode" Else Return "SyntaxNode" End If Else Dim name = BaseTypeReference(nodeChild) If KindTypeStructure(nodeChild.ChildKind).IsToken Then Return "InternalSyntax." + name End If Return name End If End Function ' Get the type reference for a child constructor Protected Function ChildFactoryTypeRef(nodeStructure As ParseNodeStructure, nodeChild As ParseNodeChild, Optional isGreen As Boolean = False, Optional internalForm As Boolean = False) As String If nodeChild.IsList Then If nodeChild.IsSeparated Then If isGreen Then Return String.Format("Global.Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(of GreenNode)", BaseTypeReference(nodeChild)) Else Return String.Format("SeparatedSyntaxList(Of {0})", BaseTypeReference(nodeChild)) End If Else If isGreen Then Return String.Format("Global.Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(of GreenNode)", StructureTypeName(_parseTree.RootStructure)) Else If KindTypeStructure(nodeChild.ChildKind).IsToken Then Return String.Format("SyntaxTokenList") Else Return String.Format("SyntaxList(of {0})", BaseTypeReference(nodeChild)) End If End If End If Else If Not internalForm AndAlso KindTypeStructure(nodeChild.ChildKind).IsToken Then Return String.Format("SyntaxToken", BaseTypeReference(nodeChild)) End If If Not isGreen Then Return ChildPropertyTypeRef(nodeStructure, nodeChild, isGreen) Else Return BaseTypeReference(nodeChild) End If End If End Function #If False Then ' Get the type reference for a child separators constructor Protected Function ChildSeparatorConstructorTypeRef(ByVal nodeChild As ParseNodeChild) As String If nodeChild.IsList AndAlso nodeChild.IsSeparated Then Return String.Format("SeparatedNodeList(Of {0})", SeparatorsBaseTypeReference(nodeChild)) Else Throw New ApplicationException("shouldn't get here") End If End Function #End If ' Is this type reference a list structure kind? Protected Function IsListStructureType(nodeField As ParseNodeChild) As Boolean Return nodeField.IsList AndAlso (TypeOf nodeField.ChildKind Is ParseNodeKind OrElse TypeOf nodeField.ChildKind Is List(Of ParseNodeKind)) End Function ' Is this type reference a non-list structure kind? Protected Function IsNodeStructureType(nodeField As ParseNodeChild) As Boolean Return Not nodeField.IsList AndAlso (TypeOf nodeField.ChildKind Is ParseNodeKind OrElse TypeOf nodeField.ChildKind Is List(Of ParseNodeKind)) End Function ' Get the type reference for a child private variable, ignoring lists Protected Function BaseTypeReference(nodeChild As ParseNodeChild) As String Return KindTypeReference(nodeChild.ChildKind, nodeChild.Element) End Function ' Get the type reference for separators, ignoring lists Protected Function SeparatorsBaseTypeReference(nodeChild As ParseNodeChild) As String Return KindTypeReference(nodeChild.SeparatorsKind, nodeChild.Element) End Function ' Get the type reference for a kind Private Function KindTypeReference(kind As Object, element As XNode) As String If TypeOf kind Is ParseNodeKind Then Return StructureTypeName(CType(kind, ParseNodeKind).NodeStructure) ElseIf TypeOf kind Is List(Of ParseNodeKind) Then Dim commonStructure = GetCommonStructure(CType(kind, List(Of ParseNodeKind))) If commonStructure Is Nothing Then Return "Object" Else Return StructureTypeName(commonStructure) End If End If _parseTree.ReportError(element, "Invalid kind specified") Return "UNKNOWNTYPE" End Function ' Get the type reference for a kind Protected Function KindTypeStructure(kind As Object) As ParseNodeStructure If TypeOf kind Is ParseNodeKind Then Return CType(kind, ParseNodeKind).NodeStructure ElseIf TypeOf kind Is List(Of ParseNodeKind) Then Return GetCommonStructure(CType(kind, List(Of ParseNodeKind))) End If Return Nothing End Function ' Get the type name of a simple type Protected Function SimpleTypeName(simpleType As SimpleType) As String Select Case simpleType Case SimpleType.Bool Return "Boolean" Case SimpleType.Text Return "String" Case SimpleType.Character Return "Char" Case SimpleType.Int32 Return "Integer" Case SimpleType.UInt32 Return "UInteger" Case SimpleType.Int64 Return "Long" Case SimpleType.UInt64 Return "ULong" Case SimpleType.Float32 Return "Single" Case SimpleType.Float64 Return "Double" Case SimpleType.Decimal Return "System.Decimal" Case SimpleType.DateTime Return "DateTime" Case SimpleType.TextSpan Return "TextSpan" Case SimpleType.NodeKind Return NodeKindString Case Else Throw New InvalidOperationException("Unexpected simple type") End Select End Function ' Get the type name of an enumeration type Protected Function EnumerationTypeName(enumType As ParseEnumeration) As String Return Ident(enumType.Name) End Function ' The name of the node kind enumeration Protected Function NodeKindType() As String Return NodeKindString End Function ' The name of the visitor method for a structure type Protected Function VisitorMethodName(nodeStructure As ParseNodeStructure) As String Dim nodeName = nodeStructure.Name If nodeName.EndsWith("Syntax", StringComparison.Ordinal) Then nodeName = nodeName.Substring(0, nodeName.Length - 6) Return "Visit" + nodeName End Function ' Is this structure the root? Protected Function IsRoot(nodeStructure As ParseNodeStructure) As Boolean Return String.IsNullOrEmpty(nodeStructure.ParentStructureId) End Function ' Given a list of ParseNodeKinds, find the common structure that encapsulates all ' of them, or else return Nothing if there is no common structure. Protected Function GetCommonStructure(kindList As List(Of ParseNodeKind)) As ParseNodeStructure Dim structList = kindList.Select(Function(kind) kind.NodeStructure).ToList() ' list of the structures. ' Any candidate ancestor is an ancestor (or same) of the first element Dim candidate As ParseNodeStructure = structList(0) Do If IsAncestorOfAll(candidate, structList) Then Return candidate End If candidate = candidate.ParentStructure Loop While (candidate IsNot Nothing) Return Nothing ' no ancestor End Function ' Is this structure an ancestorOrSame of all Protected Function IsAncestorOfAll(parent As ParseNodeStructure, children As List(Of ParseNodeStructure)) As Boolean Return children.TrueForAll(Function(child) _parseTree.IsAncestorOrSame(parent, child)) End Function ' Get all of the fields of a structure, including inherited fields, in the right order. ' TODO: need way to get the ordering right. Protected Function GetAllFieldsOfStructure(struct As ParseNodeStructure) As List(Of ParseNodeField) Dim fullList As New List(Of ParseNodeField) ' For now, just put inherited stuff at the beginning, until we design a real ordering solution Do While struct IsNot Nothing fullList.InsertRange(0, struct.Fields) struct = struct.ParentStructure Loop Return fullList End Function ' Get all of the children of a structure, including inherited children, in the right order. ' The ordering is defined first by order attribute, then by declared order (base before derived) Protected Function GetAllChildrenOfStructure(struct As ParseNodeStructure) As List(Of ParseNodeChild) Dim fullList As New List(Of Tuple(Of ParseNodeChild, Integer)) ' For now, just put inherited stuff at the beginning, until we design a real ordering solution Dim baseLevel = 0 ' 0 for this structure, 1 for base, 2 for grandbase, ... Do While struct IsNot Nothing For i = 0 To struct.Children.Count - 1 ' Add each child with an integer giving default sort order. fullList.Add(New Tuple(Of ParseNodeChild, Integer)(struct.Children(i), i - baseLevel * 100)) Next struct = struct.ParentStructure baseLevel += 1 Loop ' Return a new list in order. Return (From n In fullList Order By n.Item1.Order, n.Item2 Select n.Item1).ToList() End Function ' Get all of the children of a structure, including inherited children, in the right order. ' that can be passed to the factory method. ' The ordering is defined first by order attribute, then by declared order (base before derived) Protected Function GetAllFactoryChildrenOfStructure(struct As ParseNodeStructure) As IEnumerable(Of ParseNodeChild) Return From child In GetAllChildrenOfStructure(struct) Where Not child.NotInFactory Select child End Function ' String utility functions ' Lowercase the first character o a string Protected Function LowerFirstCharacter(s As String) As String If s Is Nothing OrElse s.Length = 0 Then Return s Else Return Char.ToLowerInvariant(s(0)) + s.Substring(1) End If End Function ' Uppercase the first character o a string Protected Function UpperFirstCharacter(s As String) As String If s Is Nothing OrElse s.Length = 0 Then Return s Else Return Char.ToUpperInvariant(s(0)) + s.Substring(1) End If End Function ' Word wrap a string into lines Protected Function WordWrap(text As String) As List(Of String) Const LineLength As Integer = 80 Dim lines As New List(Of String) ' Remove newlines, consecutive spaces. text = text.Replace(vbCr, " ") text = text.Replace(vbLf, " ") Do Dim newText = text.Replace(" ", " ") If newText = text Then Exit Do text = newText Loop text = text.Trim() While text.Length >= LineLength Dim split As Integer = text.Substring(0, LineLength).LastIndexOf(" "c) If split < 0 Then split = LineLength Dim line As String = text.Substring(0, split).Trim() lines.Add(line) text = text.Substring(split).Trim() End While If text.Length > 0 Then lines.Add(text) End If Return lines End Function ' Create a description XML comment with the given tag, indented the given number of characters Private Sub GenerateXmlCommentPart(writer As TextWriter, text As String, xmlTag As String, indent As Integer, Optional escape As Boolean = True) If String.IsNullOrWhiteSpace(text) Then Return Dim lines As List(Of String) If escape Then text = XmlEscape(text) lines = WordWrap(text) Else lines = text.Replace(vbCrLf, vbLf).Replace(vbCr, vbLf).Split(vbLf).ToList() End If lines.Insert(0, "<" & xmlTag & ">") lines.Add("</" & xmlTag & ">") Dim prefix = New String(" "c, indent) & "''' " For Each line In lines writer.WriteLine(prefix & line) Next End Sub Protected Shared Function XmlEscape(value As String) As String Return value.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;") End Function Protected Shadows Function XmlEscapeAndWrap(value As String) As List(Of String) Return WordWrap(XmlEscape(value)) End Function Public Sub GenerateSummaryXmlComment(writer As TextWriter, text As String, Optional indent As Integer = 8) GenerateXmlCommentPart(writer, text, "summary", indent) End Sub Public Sub GenerateParameterXmlComment(writer As TextWriter, parameterName As String, text As String, Optional escapeText As Boolean = False, Optional indent As Integer = 8) If String.IsNullOrWhiteSpace(text) Then Return If escapeText Then text = XmlEscape(text) Else ' Ensure the text does not require escaping. Dim filtered = text.Replace("<cref ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "") Debug.Assert(filtered = XmlEscape(filtered)) End If Dim prefix = New String(" "c, indent) & "''' " writer.WriteLine(prefix & "<param name=""{0}"">", parameterName) For Each line In WordWrap(text) writer.WriteLine(prefix & line) Next writer.WriteLine(prefix & "</param>") End Sub Public Sub GenerateTypeParameterXmlComment(writer As TextWriter, typeParameterName As String, text As String, Optional indent As Integer = 4) If String.IsNullOrWhiteSpace(text) Then Return text = XmlEscape(text) Dim prefix = New String(" "c, indent) & "''' " writer.WriteLine(prefix & "<typeparam name=""{0}"">", typeParameterName) For Each line In WordWrap(text) writer.WriteLine(prefix & line) Next writer.WriteLine(prefix & "</typeparam>") End Sub ' Generate and XML comment with the given description and remarks sections. If empty, the sections are omitted. Protected Sub GenerateXmlComment(writer As TextWriter, descriptionText As String, remarksText As String, indent As Integer) GenerateXmlCommentPart(writer, descriptionText, "summary", indent) GenerateXmlCommentPart(writer, remarksText, "remarks", indent, escape:=False) End Sub ' Generate XML comment for a structure Protected Sub GenerateXmlComment(writer As TextWriter, struct As ParseNodeStructure, indent As Integer, includeRemarks As Boolean) Dim descriptionText As String = struct.Description Dim remarksText As String = Nothing If includeRemarks AndAlso struct.NodeKinds.Any() Then remarksText += "<para>This node is associated with the following syntax kinds:</para>" & vbCrLf & "<list type=""bullet"">" & vbCrLf For Each kind In struct.NodeKinds remarksText += $"<item><description><see cref=""SyntaxKind.{kind.Name}""/></description></item>" & vbCrLf Next remarksText += "</list>" End If GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a child Protected Sub GenerateXmlComment(writer As TextWriter, child As ParseNodeChild, indent As Integer) Dim descriptionText As String = child.Description Dim remarksText As String = Nothing If child.IsOptional Then If child.IsList Then remarksText = "If nothing is present, an empty list is returned." Else remarksText = "This child is optional. If it is not present, then Nothing is returned." End If End If GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a child Protected Sub GenerateWithXmlComment(writer As TextWriter, child As ParseNodeChild, indent As Integer) Dim descriptionText As String = "Returns a copy of this with the " + ChildPropertyName(child) + " property changed to the specified value. Returns this instance if the specified value is the same as the current value." Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a field Protected Sub GenerateXmlComment(writer As TextWriter, field As ParseNodeField, indent As Integer) Dim descriptionText As String = field.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a kind Protected Sub GenerateXmlComment(writer As TextWriter, kind As ParseNodeKind, indent As Integer) Dim descriptionText As String = kind.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for an enumeration Protected Sub GenerateXmlComment(writer As TextWriter, enumerator As ParseEnumeration, indent As Integer) Dim descriptionText As String = enumerator.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for an enumerator Protected Sub GenerateXmlComment(writer As TextWriter, enumerator As ParseEnumerator, indent As Integer) Dim descriptionText As String = enumerator.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub Private ReadOnly _VBKeywords As String() = { "ADDHANDLER", "ADDRESSOF", "ALIAS", "AND", "ANDALSO", "AS", "BOOLEAN", "BYREF", "BYTE", "BYVAL", "CALL", "CASE", "CATCH", "CBOOL", "CBYTE", "CCHAR", "CDATE", "CDBL", "CDEC", "CHAR", "CINT", "CLASS", "CLNG", "COBJ", "CONST", "CONTINUE", "CSBYTE", "CSHORT", "CSNG", "CSTR", "CTYPE", "CUINT", "CULNG", "CUSHORT", "DATE", "DECIMAL", "DECLARE", "DEFAULT", "DELEGATE", "DIM", "DIRECTCAST", "DO", "DOUBLE", "EACH", "ELSE", "ELSEIF", "END", "ENDIF", "ENUM", "ERASE", "ERROR", "EVENT", "EXIT", "FALSE", "FINALLY", "FOR", "FRIEND", "FUNCTION", "GET", "GETTYPE", "GETXMLNAMESPACE", "GLOBAL", "GOSUB", "GOTO", "HANDLES", "IF", "IMPLEMENTS", "IMPORTS", "IN", "INHERITS", "INTEGER", "INTERFACE", "IS", "ISNOT", "LET", "LIB", "LIKE", "LONG", "LOOP", "ME", "MOD", "MODULE", "MUSTINHERIT", "MUSTOVERRIDE", "MYBASE", "MYCLASS", "NAMESPACE", "NARROWING", "NEW", "NEXT", "NOT", "NOTHING", "NOTINHERITABLE", "NOTOVERRIDABLE", "OBJECT", "OF", "ON", "OPERATOR", "OPTION", "OPTIONAL", "OR", "ORELSE", "OVERLOADS", "OVERRIDABLE", "OVERRIDES", "PARAMARRAY", "PARTIAL", "PRIVATE", "PROPERTY", "PROTECTED", "PUBLIC", "RAISEEVENT", "READONLY", "REDIM", "REM", "REMOVEHANDLER", "RESUME", "RETURN", "SBYTE", "SELECT", "SET", "SHADOWS", "SHARED", "SHORT", "SINGLE", "STATIC", "STEP", "STOP", "STRING", "STRUCTURE", "SUB", "SYNCLOCK", "THEN", "THROW", "TO", "TRUE", "TRY", "TRYCAST", "TYPEOF", "UINTEGER", "ULONG", "USHORT", "USING", "VARIANT", "WEND", "WHEN", "WHILE", "WIDENING", "WITH", "WITHEVENTS", "WRITEONLY", "XOR"} ' If the string is a keyword, escape it. Otherwise just return it. Protected Function Ident(id As String) As String If _VBKeywords.Contains(id.ToUpperInvariant()) Then Return "[" + id + "]" Else Return id End If End Function Public Function EscapeQuotes(s As String) As String If s.IndexOf(""""c) <> -1 Then Dim sb As New StringBuilder Dim parts = s.Split(""""c) Dim last = parts.Length - 1 For i = 0 To last - 1 sb.Append(parts(i)) sb.Append("""""") Next sb.Append(parts(last)) s = sb.ToString End If Return s End Function Public Function GetChildNodeKind(nodeKind As ParseNodeKind, child As ParseNodeChild) As ParseNodeKind Dim childNodeKind = TryCast(child.ChildKind, ParseNodeKind) Dim childNodeKinds = TryCast(child.ChildKind, List(Of ParseNodeKind)) If childNodeKinds IsNot Nothing AndAlso nodeKind IsNot Nothing Then childNodeKind = child.ChildKind(nodeKind.Name) End If If childNodeKind Is Nothing AndAlso child.DefaultChildKind IsNot Nothing Then childNodeKind = child.DefaultChildKind End If Return childNodeKind End Function Public Function IsAutoCreatableToken(node As ParseNodeStructure, nodeKind As ParseNodeKind, child As ParseNodeChild) As Boolean Dim childNodeKind = GetChildNodeKind(nodeKind, child) If childNodeKind IsNot Nothing Then Dim childNodeStructure = KindTypeStructure(childNodeKind) If childNodeStructure.IsToken AndAlso childNodeKind.Name <> "IdentifierToken" Then Return True End If End If Return False End Function Public Function IsAutoCreatableNodeOfAutoCreatableTokens(node As ParseNodeStructure, nodeKind As ParseNodeKind, child As ParseNodeChild) As Boolean Dim childNodeKind = GetChildNodeKind(nodeKind, child) ' Node contains only auto-creatable tokens If childNodeKind IsNot Nothing Then Dim childNodeStructure = KindTypeStructure(childNodeKind) If Not childNodeStructure.IsToken Then Dim allChildren = GetAllChildrenOfStructure(childNodeStructure) For Each childNodeChild In allChildren If Not IsAutoCreatableToken(childNodeStructure, childNodeKind, childNodeChild) Then Return False End If Next Return True End If End If Return False End Function Public Function IsAutoCreatableChild(node As ParseNodeStructure, nodeKind As ParseNodeKind, child As ParseNodeChild) As Boolean Return IsAutoCreatableToken(node, nodeKind, child) OrElse IsAutoCreatableNodeOfAutoCreatableTokens(node, nodeKind, child) End Function End Class
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. '----------------------------------------------------------------------------------------------------------- ' Defines a base class that is inherited by the writing classes that defines a bunch of utility ' functions for building up names of constructs. Basically anything that we want to shared between different ' output classes is defined here. '----------------------------------------------------------------------------------------------------------- Imports System.IO Imports System.Text ' Utility functions for writing out the parse tree. Basically name generation and various simply utility functions ' that are shared by different writing classes. This is typically inherited by a writing class. Public MustInherit Class WriteUtils Protected _parseTree As ParseTree ' the tree to output #If OLDSTYLE Then Protected Const NodeKindString = "NodeKind" Protected Const NodeListString = "NodeList" Protected Const SeparatedNodeListString = "SeparatedNodeList" Protected Const NodeFactoryListString = "NodeFactory" #Else Protected Const NodeKindString = "SyntaxKind" Protected Const NodeListString = "SyntaxList" Protected Const SeparatedNodeListString = "SeparatedSyntaxList" Protected Const NodeFactoryListString = "Syntax" #End If Public Sub New(parseTree As ParseTree) _parseTree = parseTree End Sub ' Name generation ' Get the base type name (no namespace) for a node structure. Protected Function StructureTypeName(nodeStructure As ParseNodeStructure) As String Return Ident(nodeStructure.Name) End Function ' Get the base type name (no namespace) for an enumeration. Protected Function EnumerationName(enumeration As ParseEnumeration) As String Return Ident(enumeration.Name) End Function 'Get a factory name from a kind Protected Function FactoryName(nodeKind As ParseNodeKind) As String Return nodeKind.Name End Function 'Get a factory name from a structure Protected Function FactoryName(nodeStructure As ParseNodeStructure) As String #If OLDSTYLE Then Return nodeStructure.Name #Else If nodeStructure.Name.EndsWith("Syntax", StringComparison.Ordinal) Then Return nodeStructure.Name.Substring(0, nodeStructure.Name.Length - 6) Else Return nodeStructure.Name End If #End If End Function Protected Function SyntaxFactName(nodeStructure As ParseNodeStructure) As String Dim name = FactoryName(nodeStructure) If name = "Keyword" Then name = "KeywordKind" End If Return name End Function ' Get the name for a field private variable Protected Function FieldVarName(nodeField As ParseNodeField) As String Dim name As String = nodeField.Name Return "_" + LowerFirstCharacter(name) End Function ' Get the name for a child private variable Protected Function ChildVarName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name Return "_" + LowerFirstCharacter(name) End Function ' Get the name for a child private variable cache (not in the builder, but in the actual node) Protected Function ChildCacheVarName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name Return "_" + LowerFirstCharacter(name) + "Cache" End Function ' Get the name for a new child variable is the visitor Protected Function ChildNewVarName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name Return Ident("new" + UpperFirstCharacter(name)) End Function #If False Then ' Get the name for a new child variable is the visitor, but for the separators Protected Function ChildNewVarSeparatorsName(ByVal nodeChild As ParseNodeChild) As String Dim name As String = ChildSeparatorsName(nodeChild) Return Ident(LowerFirstCharacter(name) + "New") End Function #End If ' Get the name for a field parameter. ' If conflictName is not nothing, make sure the name doesn't conflict with that name. Protected Function FieldParamName(nodeField As ParseNodeField, Optional conflictName As String = Nothing) As String Dim name As String = nodeField.Name If String.Equals(name, conflictName, StringComparison.OrdinalIgnoreCase) Then name += "Parameter" End If Return Ident(LowerFirstCharacter(name)) End Function ' Get the name for a child parameter ' If conflictName is not nothing, make sure the name doesn't conflict with that name. Protected Function ChildParamName(nodeChild As ParseNodeChild, Optional conflictName As String = Nothing) As String Dim name As String = OptionalChildName(nodeChild) If String.Equals(name, conflictName, StringComparison.OrdinalIgnoreCase) Then name += "Parameter" End If Return Ident(LowerFirstCharacter(name)) End Function #If False Then ' Get the name for a child separator list parameter Protected Function ChildSeparatorsParamName(ByVal nodeChild As ParseNodeChild) As String Return Ident(LowerFirstCharacter(ChildSeparatorsName(nodeChild))) End Function #End If ' Get the name for a field property Protected Function FieldPropertyName(nodeField As ParseNodeField) As String Return Ident(UnescapedFieldPropertyName(nodeField)) End Function Protected Function UnescapedFieldPropertyName(nodeField As ParseNodeField) As String Dim name As String = nodeField.Name Return UpperFirstCharacter(name) End Function ' Get the name for a child property Protected Function ChildWithFunctionName(nodeChild As ParseNodeChild) As String Return Ident("With" + UpperFirstCharacter(nodeChild.Name)) End Function ' Get the name for a child property Protected Function ChildPropertyName(nodeChild As ParseNodeChild) As String Return Ident(UnescapedChildPropertyName(nodeChild)) End Function Protected Function UnescapedChildPropertyName(nodeChild As ParseNodeChild) As String Return UpperFirstCharacter(OptionalChildName(nodeChild)) End Function ' Get the name for a child separators property Protected Function ChildSeparatorsPropertyName(nodeChild As ParseNodeChild) As String Return Ident(UpperFirstCharacter(ChildSeparatorsName(nodeChild))) End Function ' If a child is optional and isn't a list, add "Optional" to the name. Protected Function OptionalChildName(nodeChild As ParseNodeChild) As String Dim name As String = nodeChild.Name If nodeChild.IsOptional AndAlso Not nodeChild.IsList Then #If OLDSTYLE Then Return "Optional" + UpperFirstCharacter(name) #Else Return UpperFirstCharacter(name) #End If Else Return UpperFirstCharacter(name) End If End Function ' If a child is a separated list, return the name of the separators. Protected Function ChildSeparatorsName(nodeChild As ParseNodeChild) As String If nodeChild.IsList AndAlso nodeChild.IsSeparated Then If String.IsNullOrEmpty(nodeChild.SeparatorsName) Then _parseTree.ReportError(nodeChild.Element, "separator-name was not found, but is required for separated lists") End If Return UpperFirstCharacter(nodeChild.SeparatorsName) Else Throw New InvalidOperationException("Shouldn't get here") End If End Function ' Get the type reference for a field property Protected Function FieldTypeRef(nodeField As ParseNodeField) As String Dim fieldType As Object = nodeField.FieldType If TypeOf fieldType Is SimpleType Then Return SimpleTypeName(CType(fieldType, SimpleType)) ElseIf TypeOf fieldType Is ParseEnumeration Then Return EnumerationTypeName(CType(fieldType, ParseEnumeration)) End If nodeField.ParseTree.ReportError(nodeField.Element, "Bad type for field") Return "UNKNOWNTYPE" End Function ' Get the type reference for a child property Protected Function ChildPropertyTypeRef(nodeStructure As ParseNodeStructure, nodeChild As ParseNodeChild, Optional isGreen As Boolean = False, Optional denyOverride As Boolean = False) As String Dim isOverride = nodeChild.ContainingStructure IsNot nodeStructure AndAlso Not denyOverride Dim result As String If nodeChild.IsList Then If nodeChild.IsSeparated Then result = String.Format(If(isGreen, "SeparatedSyntaxList(Of {0})", "SeparatedSyntaxList(Of {0})"), BaseTypeReference(nodeChild)) ElseIf KindTypeStructure(nodeChild.ChildKind).IsToken Then If isGreen Then result = String.Format("SyntaxList(Of {0})", BaseTypeReference(nodeChild)) Else result = "SyntaxTokenList" End If Else result = String.Format("SyntaxList(Of {0})", BaseTypeReference(nodeChild)) End If Else If Not isGreen AndAlso KindTypeStructure(nodeChild.ChildKind).IsToken Then Return String.Format("SyntaxToken") End If If Not isGreen AndAlso isOverride Then Dim childKindStructure As ParseNodeStructure = Nothing If nodeStructure.NodeKinds.Count = 1 Then Dim childNodeKind = GetChildNodeKind(nodeStructure.NodeKinds(0), nodeChild) childKindStructure = KindTypeStructure(childNodeKind) Else Dim childKinds As New HashSet(Of ParseNodeKind)() For Each kind In nodeStructure.NodeKinds Dim childNodeKind = GetChildNodeKind(kind, nodeChild) If childNodeKind IsNot Nothing Then childKinds.Add(GetChildNodeKind(kind, nodeChild)) Else childKinds = Nothing Exit For End If Next If childKinds IsNot Nothing Then If childKinds.Count = 1 Then childKindStructure = KindTypeStructure(childKinds.First) Else childKindStructure = GetCommonStructure(childKinds.ToList()) End If End If End If If childKindStructure IsNot Nothing Then Return childKindStructure.Name End If End If result = BaseTypeReference(nodeChild) End If If isGreen Then If nodeChild.IsList Then Return String.Format("Global.Microsoft.CodeAnalysis.Syntax.InternalSyntax.{0}", result) Else Return String.Format("InternalSyntax.{0}", result) End If End If Return result End Function Protected Function ChildFieldTypeRef(nodeChild As ParseNodeChild, Optional isGreen As Boolean = False) As String If nodeChild.IsList Then If nodeChild.IsSeparated Then Return String.Format(If(isGreen, "GreenNode", "SeparatedSyntaxList(Of {0})"), BaseTypeReference(nodeChild)) Else Return String.Format(If(isGreen, "GreenNode", "SyntaxList(Of {0})"), BaseTypeReference(nodeChild)) End If Else Return BaseTypeReference(nodeChild) End If End Function Protected Function ChildPrivateFieldTypeRef(nodeChild As ParseNodeChild) As String If nodeChild.IsList Then Return "SyntaxNode" Else Return BaseTypeReference(nodeChild) End If End Function ' Get the type reference for a child separators property Protected Function ChildSeparatorsTypeRef(nodeChild As ParseNodeChild) As String Return String.Format("SyntaxList(Of {0})", SeparatorsBaseTypeReference(nodeChild)) End Function ' Get the type reference for a child constructor Protected Function ChildConstructorTypeRef(nodeChild As ParseNodeChild, Optional isGreen As Boolean = False) As String If nodeChild.IsList Then If isGreen OrElse KindTypeStructure(nodeChild.ChildKind).IsToken Then Return "GreenNode" Else Return "SyntaxNode" End If Else Dim name = BaseTypeReference(nodeChild) If KindTypeStructure(nodeChild.ChildKind).IsToken Then Return "InternalSyntax." + name End If Return name End If End Function ' Get the type reference for a child constructor Protected Function ChildFactoryTypeRef(nodeStructure As ParseNodeStructure, nodeChild As ParseNodeChild, Optional isGreen As Boolean = False, Optional internalForm As Boolean = False) As String If nodeChild.IsList Then If nodeChild.IsSeparated Then If isGreen Then Return String.Format("Global.Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(of GreenNode)", BaseTypeReference(nodeChild)) Else Return String.Format("SeparatedSyntaxList(Of {0})", BaseTypeReference(nodeChild)) End If Else If isGreen Then Return String.Format("Global.Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(of GreenNode)", StructureTypeName(_parseTree.RootStructure)) Else If KindTypeStructure(nodeChild.ChildKind).IsToken Then Return String.Format("SyntaxTokenList") Else Return String.Format("SyntaxList(of {0})", BaseTypeReference(nodeChild)) End If End If End If Else If Not internalForm AndAlso KindTypeStructure(nodeChild.ChildKind).IsToken Then Return String.Format("SyntaxToken", BaseTypeReference(nodeChild)) End If If Not isGreen Then Return ChildPropertyTypeRef(nodeStructure, nodeChild, isGreen) Else Return BaseTypeReference(nodeChild) End If End If End Function #If False Then ' Get the type reference for a child separators constructor Protected Function ChildSeparatorConstructorTypeRef(ByVal nodeChild As ParseNodeChild) As String If nodeChild.IsList AndAlso nodeChild.IsSeparated Then Return String.Format("SeparatedNodeList(Of {0})", SeparatorsBaseTypeReference(nodeChild)) Else Throw New ApplicationException("shouldn't get here") End If End Function #End If ' Is this type reference a list structure kind? Protected Function IsListStructureType(nodeField As ParseNodeChild) As Boolean Return nodeField.IsList AndAlso (TypeOf nodeField.ChildKind Is ParseNodeKind OrElse TypeOf nodeField.ChildKind Is List(Of ParseNodeKind)) End Function ' Is this type reference a non-list structure kind? Protected Function IsNodeStructureType(nodeField As ParseNodeChild) As Boolean Return Not nodeField.IsList AndAlso (TypeOf nodeField.ChildKind Is ParseNodeKind OrElse TypeOf nodeField.ChildKind Is List(Of ParseNodeKind)) End Function ' Get the type reference for a child private variable, ignoring lists Protected Function BaseTypeReference(nodeChild As ParseNodeChild) As String Return KindTypeReference(nodeChild.ChildKind, nodeChild.Element) End Function ' Get the type reference for separators, ignoring lists Protected Function SeparatorsBaseTypeReference(nodeChild As ParseNodeChild) As String Return KindTypeReference(nodeChild.SeparatorsKind, nodeChild.Element) End Function ' Get the type reference for a kind Private Function KindTypeReference(kind As Object, element As XNode) As String If TypeOf kind Is ParseNodeKind Then Return StructureTypeName(CType(kind, ParseNodeKind).NodeStructure) ElseIf TypeOf kind Is List(Of ParseNodeKind) Then Dim commonStructure = GetCommonStructure(CType(kind, List(Of ParseNodeKind))) If commonStructure Is Nothing Then Return "Object" Else Return StructureTypeName(commonStructure) End If End If _parseTree.ReportError(element, "Invalid kind specified") Return "UNKNOWNTYPE" End Function ' Get the type reference for a kind Protected Function KindTypeStructure(kind As Object) As ParseNodeStructure If TypeOf kind Is ParseNodeKind Then Return CType(kind, ParseNodeKind).NodeStructure ElseIf TypeOf kind Is List(Of ParseNodeKind) Then Return GetCommonStructure(CType(kind, List(Of ParseNodeKind))) End If Return Nothing End Function ' Get the type name of a simple type Protected Function SimpleTypeName(simpleType As SimpleType) As String Select Case simpleType Case SimpleType.Bool Return "Boolean" Case SimpleType.Text Return "String" Case SimpleType.Character Return "Char" Case SimpleType.Int32 Return "Integer" Case SimpleType.UInt32 Return "UInteger" Case SimpleType.Int64 Return "Long" Case SimpleType.UInt64 Return "ULong" Case SimpleType.Float32 Return "Single" Case SimpleType.Float64 Return "Double" Case SimpleType.Decimal Return "System.Decimal" Case SimpleType.DateTime Return "DateTime" Case SimpleType.TextSpan Return "TextSpan" Case SimpleType.NodeKind Return NodeKindString Case Else Throw New InvalidOperationException("Unexpected simple type") End Select End Function ' Get the type name of an enumeration type Protected Function EnumerationTypeName(enumType As ParseEnumeration) As String Return Ident(enumType.Name) End Function ' The name of the node kind enumeration Protected Function NodeKindType() As String Return NodeKindString End Function ' The name of the visitor method for a structure type Protected Function VisitorMethodName(nodeStructure As ParseNodeStructure) As String Dim nodeName = nodeStructure.Name If nodeName.EndsWith("Syntax", StringComparison.Ordinal) Then nodeName = nodeName.Substring(0, nodeName.Length - 6) Return "Visit" + nodeName End Function ' Is this structure the root? Protected Function IsRoot(nodeStructure As ParseNodeStructure) As Boolean Return String.IsNullOrEmpty(nodeStructure.ParentStructureId) End Function ' Given a list of ParseNodeKinds, find the common structure that encapsulates all ' of them, or else return Nothing if there is no common structure. Protected Function GetCommonStructure(kindList As List(Of ParseNodeKind)) As ParseNodeStructure Dim structList = kindList.Select(Function(kind) kind.NodeStructure).ToList() ' list of the structures. ' Any candidate ancestor is an ancestor (or same) of the first element Dim candidate As ParseNodeStructure = structList(0) Do If IsAncestorOfAll(candidate, structList) Then Return candidate End If candidate = candidate.ParentStructure Loop While (candidate IsNot Nothing) Return Nothing ' no ancestor End Function ' Is this structure an ancestorOrSame of all Protected Function IsAncestorOfAll(parent As ParseNodeStructure, children As List(Of ParseNodeStructure)) As Boolean Return children.TrueForAll(Function(child) _parseTree.IsAncestorOrSame(parent, child)) End Function ' Get all of the fields of a structure, including inherited fields, in the right order. ' TODO: need way to get the ordering right. Protected Function GetAllFieldsOfStructure(struct As ParseNodeStructure) As List(Of ParseNodeField) Dim fullList As New List(Of ParseNodeField) ' For now, just put inherited stuff at the beginning, until we design a real ordering solution Do While struct IsNot Nothing fullList.InsertRange(0, struct.Fields) struct = struct.ParentStructure Loop Return fullList End Function ' Get all of the children of a structure, including inherited children, in the right order. ' The ordering is defined first by order attribute, then by declared order (base before derived) Protected Function GetAllChildrenOfStructure(struct As ParseNodeStructure) As List(Of ParseNodeChild) Dim fullList As New List(Of Tuple(Of ParseNodeChild, Integer)) ' For now, just put inherited stuff at the beginning, until we design a real ordering solution Dim baseLevel = 0 ' 0 for this structure, 1 for base, 2 for grandbase, ... Do While struct IsNot Nothing For i = 0 To struct.Children.Count - 1 ' Add each child with an integer giving default sort order. fullList.Add(New Tuple(Of ParseNodeChild, Integer)(struct.Children(i), i - baseLevel * 100)) Next struct = struct.ParentStructure baseLevel += 1 Loop ' Return a new list in order. Return (From n In fullList Order By n.Item1.Order, n.Item2 Select n.Item1).ToList() End Function ' Get all of the children of a structure, including inherited children, in the right order. ' that can be passed to the factory method. ' The ordering is defined first by order attribute, then by declared order (base before derived) Protected Function GetAllFactoryChildrenOfStructure(struct As ParseNodeStructure) As IEnumerable(Of ParseNodeChild) Return From child In GetAllChildrenOfStructure(struct) Where Not child.NotInFactory Select child End Function ' String utility functions ' Lowercase the first character o a string Protected Function LowerFirstCharacter(s As String) As String If s Is Nothing OrElse s.Length = 0 Then Return s Else Return Char.ToLowerInvariant(s(0)) + s.Substring(1) End If End Function ' Uppercase the first character o a string Protected Function UpperFirstCharacter(s As String) As String If s Is Nothing OrElse s.Length = 0 Then Return s Else Return Char.ToUpperInvariant(s(0)) + s.Substring(1) End If End Function ' Word wrap a string into lines Protected Function WordWrap(text As String) As List(Of String) Const LineLength As Integer = 80 Dim lines As New List(Of String) ' Remove newlines, consecutive spaces. text = text.Replace(vbCr, " ") text = text.Replace(vbLf, " ") Do Dim newText = text.Replace(" ", " ") If newText = text Then Exit Do text = newText Loop text = text.Trim() While text.Length >= LineLength Dim split As Integer = text.Substring(0, LineLength).LastIndexOf(" "c) If split < 0 Then split = LineLength Dim line As String = text.Substring(0, split).Trim() lines.Add(line) text = text.Substring(split).Trim() End While If text.Length > 0 Then lines.Add(text) End If Return lines End Function ' Create a description XML comment with the given tag, indented the given number of characters Private Sub GenerateXmlCommentPart(writer As TextWriter, text As String, xmlTag As String, indent As Integer, Optional escape As Boolean = True) If String.IsNullOrWhiteSpace(text) Then Return Dim lines As List(Of String) If escape Then text = XmlEscape(text) lines = WordWrap(text) Else lines = text.Replace(vbCrLf, vbLf).Replace(vbCr, vbLf).Split(vbLf).ToList() End If lines.Insert(0, "<" & xmlTag & ">") lines.Add("</" & xmlTag & ">") Dim prefix = New String(" "c, indent) & "''' " For Each line In lines writer.WriteLine(prefix & line) Next End Sub Protected Shared Function XmlEscape(value As String) As String Return value.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;") End Function Protected Shadows Function XmlEscapeAndWrap(value As String) As List(Of String) Return WordWrap(XmlEscape(value)) End Function Public Sub GenerateSummaryXmlComment(writer As TextWriter, text As String, Optional indent As Integer = 8) GenerateXmlCommentPart(writer, text, "summary", indent) End Sub Public Sub GenerateParameterXmlComment(writer As TextWriter, parameterName As String, text As String, Optional escapeText As Boolean = False, Optional indent As Integer = 8) If String.IsNullOrWhiteSpace(text) Then Return If escapeText Then text = XmlEscape(text) Else ' Ensure the text does not require escaping. Dim filtered = text.Replace("<cref ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "") Debug.Assert(filtered = XmlEscape(filtered)) End If Dim prefix = New String(" "c, indent) & "''' " writer.WriteLine(prefix & "<param name=""{0}"">", parameterName) For Each line In WordWrap(text) writer.WriteLine(prefix & line) Next writer.WriteLine(prefix & "</param>") End Sub Public Sub GenerateTypeParameterXmlComment(writer As TextWriter, typeParameterName As String, text As String, Optional indent As Integer = 4) If String.IsNullOrWhiteSpace(text) Then Return text = XmlEscape(text) Dim prefix = New String(" "c, indent) & "''' " writer.WriteLine(prefix & "<typeparam name=""{0}"">", typeParameterName) For Each line In WordWrap(text) writer.WriteLine(prefix & line) Next writer.WriteLine(prefix & "</typeparam>") End Sub ' Generate and XML comment with the given description and remarks sections. If empty, the sections are omitted. Protected Sub GenerateXmlComment(writer As TextWriter, descriptionText As String, remarksText As String, indent As Integer) GenerateXmlCommentPart(writer, descriptionText, "summary", indent) GenerateXmlCommentPart(writer, remarksText, "remarks", indent, escape:=False) End Sub ' Generate XML comment for a structure Protected Sub GenerateXmlComment(writer As TextWriter, struct As ParseNodeStructure, indent As Integer, includeRemarks As Boolean) Dim descriptionText As String = struct.Description Dim remarksText As String = Nothing If includeRemarks AndAlso struct.NodeKinds.Any() Then remarksText += "<para>This node is associated with the following syntax kinds:</para>" & vbCrLf & "<list type=""bullet"">" & vbCrLf For Each kind In struct.NodeKinds remarksText += $"<item><description><see cref=""SyntaxKind.{kind.Name}""/></description></item>" & vbCrLf Next remarksText += "</list>" End If GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a child Protected Sub GenerateXmlComment(writer As TextWriter, child As ParseNodeChild, indent As Integer) Dim descriptionText As String = child.Description Dim remarksText As String = Nothing If child.IsOptional Then If child.IsList Then remarksText = "If nothing is present, an empty list is returned." Else remarksText = "This child is optional. If it is not present, then Nothing is returned." End If End If GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a child Protected Sub GenerateWithXmlComment(writer As TextWriter, child As ParseNodeChild, indent As Integer) Dim descriptionText As String = "Returns a copy of this with the " + ChildPropertyName(child) + " property changed to the specified value. Returns this instance if the specified value is the same as the current value." Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a field Protected Sub GenerateXmlComment(writer As TextWriter, field As ParseNodeField, indent As Integer) Dim descriptionText As String = field.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for a kind Protected Sub GenerateXmlComment(writer As TextWriter, kind As ParseNodeKind, indent As Integer) Dim descriptionText As String = kind.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for an enumeration Protected Sub GenerateXmlComment(writer As TextWriter, enumerator As ParseEnumeration, indent As Integer) Dim descriptionText As String = enumerator.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub ' Generate XML comment for an enumerator Protected Sub GenerateXmlComment(writer As TextWriter, enumerator As ParseEnumerator, indent As Integer) Dim descriptionText As String = enumerator.Description Dim remarksText As String = Nothing GenerateXmlComment(writer, descriptionText, remarksText, indent) End Sub Private ReadOnly _VBKeywords As String() = { "ADDHANDLER", "ADDRESSOF", "ALIAS", "AND", "ANDALSO", "AS", "BOOLEAN", "BYREF", "BYTE", "BYVAL", "CALL", "CASE", "CATCH", "CBOOL", "CBYTE", "CCHAR", "CDATE", "CDBL", "CDEC", "CHAR", "CINT", "CLASS", "CLNG", "COBJ", "CONST", "CONTINUE", "CSBYTE", "CSHORT", "CSNG", "CSTR", "CTYPE", "CUINT", "CULNG", "CUSHORT", "DATE", "DECIMAL", "DECLARE", "DEFAULT", "DELEGATE", "DIM", "DIRECTCAST", "DO", "DOUBLE", "EACH", "ELSE", "ELSEIF", "END", "ENDIF", "ENUM", "ERASE", "ERROR", "EVENT", "EXIT", "FALSE", "FINALLY", "FOR", "FRIEND", "FUNCTION", "GET", "GETTYPE", "GETXMLNAMESPACE", "GLOBAL", "GOSUB", "GOTO", "HANDLES", "IF", "IMPLEMENTS", "IMPORTS", "IN", "INHERITS", "INTEGER", "INTERFACE", "IS", "ISNOT", "LET", "LIB", "LIKE", "LONG", "LOOP", "ME", "MOD", "MODULE", "MUSTINHERIT", "MUSTOVERRIDE", "MYBASE", "MYCLASS", "NAMESPACE", "NARROWING", "NEW", "NEXT", "NOT", "NOTHING", "NOTINHERITABLE", "NOTOVERRIDABLE", "OBJECT", "OF", "ON", "OPERATOR", "OPTION", "OPTIONAL", "OR", "ORELSE", "OVERLOADS", "OVERRIDABLE", "OVERRIDES", "PARAMARRAY", "PARTIAL", "PRIVATE", "PROPERTY", "PROTECTED", "PUBLIC", "RAISEEVENT", "READONLY", "REDIM", "REM", "REMOVEHANDLER", "RESUME", "RETURN", "SBYTE", "SELECT", "SET", "SHADOWS", "SHARED", "SHORT", "SINGLE", "STATIC", "STEP", "STOP", "STRING", "STRUCTURE", "SUB", "SYNCLOCK", "THEN", "THROW", "TO", "TRUE", "TRY", "TRYCAST", "TYPEOF", "UINTEGER", "ULONG", "USHORT", "USING", "VARIANT", "WEND", "WHEN", "WHILE", "WIDENING", "WITH", "WITHEVENTS", "WRITEONLY", "XOR"} ' If the string is a keyword, escape it. Otherwise just return it. Protected Function Ident(id As String) As String If _VBKeywords.Contains(id.ToUpperInvariant()) Then Return "[" + id + "]" Else Return id End If End Function Public Function EscapeQuotes(s As String) As String If s.IndexOf(""""c) <> -1 Then Dim sb As New StringBuilder Dim parts = s.Split(""""c) Dim last = parts.Length - 1 For i = 0 To last - 1 sb.Append(parts(i)) sb.Append("""""") Next sb.Append(parts(last)) s = sb.ToString End If Return s End Function Public Function GetChildNodeKind(nodeKind As ParseNodeKind, child As ParseNodeChild) As ParseNodeKind Dim childNodeKind = TryCast(child.ChildKind, ParseNodeKind) Dim childNodeKinds = TryCast(child.ChildKind, List(Of ParseNodeKind)) If childNodeKinds IsNot Nothing AndAlso nodeKind IsNot Nothing Then childNodeKind = child.ChildKind(nodeKind.Name) End If If childNodeKind Is Nothing AndAlso child.DefaultChildKind IsNot Nothing Then childNodeKind = child.DefaultChildKind End If Return childNodeKind End Function Public Function IsAutoCreatableToken(node As ParseNodeStructure, nodeKind As ParseNodeKind, child As ParseNodeChild) As Boolean Dim childNodeKind = GetChildNodeKind(nodeKind, child) If childNodeKind IsNot Nothing Then Dim childNodeStructure = KindTypeStructure(childNodeKind) If childNodeStructure.IsToken AndAlso childNodeKind.Name <> "IdentifierToken" Then Return True End If End If Return False End Function Public Function IsAutoCreatableNodeOfAutoCreatableTokens(node As ParseNodeStructure, nodeKind As ParseNodeKind, child As ParseNodeChild) As Boolean Dim childNodeKind = GetChildNodeKind(nodeKind, child) ' Node contains only auto-creatable tokens If childNodeKind IsNot Nothing Then Dim childNodeStructure = KindTypeStructure(childNodeKind) If Not childNodeStructure.IsToken Then Dim allChildren = GetAllChildrenOfStructure(childNodeStructure) For Each childNodeChild In allChildren If Not IsAutoCreatableToken(childNodeStructure, childNodeKind, childNodeChild) Then Return False End If Next Return True End If End If Return False End Function Public Function IsAutoCreatableChild(node As ParseNodeStructure, nodeKind As ParseNodeKind, child As ParseNodeChild) As Boolean Return IsAutoCreatableToken(node, nodeKind, child) OrElse IsAutoCreatableNodeOfAutoCreatableTokens(node, nodeKind, child) End Function End Class
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmClrEvalAttribute.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #region Assembly Microsoft.VisualStudio.Debugger.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a // References\Debugger\v2.0\Microsoft.VisualStudio.Debugger.Engine.dll #endregion namespace Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation { public abstract class DkmClrEvalAttribute { internal DkmClrEvalAttribute(string targetMember) { this.TargetMember = targetMember; } public readonly string TargetMember; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #region Assembly Microsoft.VisualStudio.Debugger.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a // References\Debugger\v2.0\Microsoft.VisualStudio.Debugger.Engine.dll #endregion namespace Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation { public abstract class DkmClrEvalAttribute { internal DkmClrEvalAttribute(string targetMember) { this.TargetMember = targetMember; } public readonly string TargetMember; } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/VisualBasic/Test/IOperation/IOperation/IOperationTests_IReDimOperation.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Partial Public Class IOperationTests Inherits SemanticModelTestBase <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_SingleClause_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"ReDim intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim intArray(2)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimClause_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of RedimClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimOperand_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"intArray" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of IdentifierNameSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimSize_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"2" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of LiteralExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_SingleClause_MultiDimensionalArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1, 1) As Integer ReDim intArray(2, 1)'BIND:"ReDim intArray(2, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim intArray(2, 1)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2, 1)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32(,)) (Syntax: 'intArray') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_MultipleClause_DifferentDimensionalArrays() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim intArray(2), x(1, 1)'BIND:"ReDim intArray(2), x(1, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim intAr ... 2), x(1, 1)') Clauses(2): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1, 1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimClause_FirstClauseFromMultipleClauses() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim intArray(2), x(1, 1)'BIND:"intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of RedimClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimClause_SecondClauseFromMultipleClauses() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim intArray(2), x(1, 1)'BIND:"x(1, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1, 1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of RedimClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_Preserve_SingleClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim Preserve intArray(2)'BIND:"ReDim Preserve intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (Preserve) (OperationKind.ReDim, Type: null) (Syntax: 'ReDim Prese ... intArray(2)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_Preserve_MultipleClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim Preserve intArray(2), x(1, 1)'BIND:"ReDim Preserve intArray(2), x(1, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (Preserve) (OperationKind.ReDim, Type: null) (Syntax: 'ReDim Prese ... 2), x(1, 1)') Clauses(2): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1, 1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NoOperandOrIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() ReDim'BIND:"ReDim" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '') Operand: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: '') Children(1): IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. ReDim'BIND:"ReDim" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_Preserve_NoOperandOrIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() ReDim Preserve'BIND:"ReDim Preserve" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (Preserve) (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim Preserve') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '') Operand: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: '') Children(1): IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. ReDim Preserve'BIND:"ReDim Preserve" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NoIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x() As Integer) ReDim x'BIND:"ReDim x" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x'BIND:"ReDim x"') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x'BIND:"ReDim x"') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(), IsInvalid) (Syntax: 'x') DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30670: 'ReDim' statements require a parenthesized list of the new bounds of each dimension of the array. ReDim x'BIND:"ReDim x" ~~~~~~~~~~~~~~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NoOperand() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() ReDim (1)'BIND:"ReDim (1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim (1)'B ... "ReDim (1)"') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '(1)'BIND:"ReDim (1)"') Operand: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: '(1)') Children(1): IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '(1)') Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30074: Constant cannot be the target of an assignment. ReDim (1)'BIND:"ReDim (1)" ~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NonArrayOperandWithoutIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x As Integer) ReDim x'BIND:"ReDim x" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x'BIND:"ReDim x"') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x'BIND:"ReDim x"') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsInvalid) (Syntax: 'x') DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30049: 'Redim' statement requires an array. ReDim x'BIND:"ReDim x" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NonArrayOperandWithIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x As Integer) ReDim x(1)'BIND:"ReDim x(1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x(1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsInvalid) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30049: 'Redim' statement requires an array. ReDim x(1)'BIND:"ReDim x(1)" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_ChangeArrayDimensions() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) ReDim x(1)'BIND:"ReDim x(1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x(1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,), IsInvalid) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsInvalid, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30415: 'ReDim' cannot change the number of dimensions of an array. ReDim x(1)'BIND:"ReDim x(1)" ~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_MissingIndexArgument() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) ReDim x(1,)'BIND:"ReDim x(1,)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1,)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x(1,)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '') Left: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: '') Children(0) Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30306: Array subscript expression missing. ReDim x(1,)'BIND:"ReDim x(1,)" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_MissingClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x() As Integer) ReDim x(1), 'BIND:"ReDim x(1), " End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1), ') Clauses(2): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '') Operand: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: '') Children(1): IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. ReDim x(1), 'BIND:"ReDim x(1), " ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_NoControlFlow() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x() As Integer, a As Integer)'BIND:"Public Sub M(x() As Integer, a As Integer)" ReDim x(a) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(a)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(a)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a') Left: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInClauseOperand() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a As Integer)" ReDim If(x1, x2)(a) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32(), IsInvalid) (Syntax: 'x1') Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'x1') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsInvalid, IsImplicit) (Syntax: 'x1') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsInvalid, IsImplicit) (Syntax: 'x1') Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32(), IsInvalid) (Syntax: 'x2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim If(x1, x2)(a)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'If(x1, x2)(a)') Operand: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Children(1): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a') Left: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30068: Expression is a value and therefore cannot be the target of an assignment. ReDim If(x1, x2)(a) ~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x(If(a1, a2), b) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(If(a1, a2), b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(If(a1, a2), b)') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInSecondIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x(b, If(a1, a2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [1] [3] Block[B1] - Block Predecessors: [B0] Statements (2) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(b, If(a1, a2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(b, If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'b') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInMultipleDimensionSizes() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)" ReDim x(If(a1, a2), If(b1, b2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [3] [5] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') Next (Regular) Block[B2] Entering: {R2} {R3} .locals {R2} { CaptureIds: [2] .locals {R3} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R3} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R3} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'If(a1, a2)') Value: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R2} Entering: {R4} } .locals {R4} { CaptureIds: [4] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IParameterReferenceOperation: b1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'b1') Jump if True (Regular) to Block[B8] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'b1') Operand: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Leaving: {R4} Next (Regular) Block[B7] Block[B7] - Block Predecessors: [B6] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'b1') Instance Receiver: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Arguments(0) Next (Regular) Block[B9] Leaving: {R4} } Block[B8] - Block Predecessors: [B6] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b2') Value: IParameterReferenceOperation: b2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b2') Next (Regular) Block[B9] Block[B9] - Block Predecessors: [B7] [B8] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(If( ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(If(a1, a2 ... If(b1, b2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Left: IFlowCaptureReferenceOperation: 5 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(b1, b2)') Next (Regular) Block[B10] Leaving: {R1} } Block[B10] - Exit Predecessors: [B9] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInOperandAndDimensionSizes() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1(,) As Integer, x2(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)'BIND:"Public Sub M(x1(,) As Integer, x2(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)" ReDim If(x1, x2)(If(a1, a2), If(b1, b2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} {R3} .locals {R1} { CaptureIds: [2] [5] [7] .locals {R2} { CaptureIds: [1] .locals {R3} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32(,), IsInvalid) (Syntax: 'x1') Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'x1') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsInvalid, IsImplicit) (Syntax: 'x1') Leaving: {R3} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsInvalid, IsImplicit) (Syntax: 'x1') Next (Regular) Block[B4] Leaving: {R3} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32(,), IsInvalid) (Syntax: 'x2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Value: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Children(1): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Next (Regular) Block[B5] Leaving: {R2} Entering: {R4} {R5} } .locals {R4} { CaptureIds: [4] .locals {R5} { CaptureIds: [3] Block[B5] - Block Predecessors: [B4] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B7] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R5} Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B8] Leaving: {R5} } Block[B7] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B6] [B7] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'If(a1, a2)') Value: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B9] Leaving: {R4} Entering: {R6} } .locals {R6} { CaptureIds: [6] Block[B9] - Block Predecessors: [B8] Statements (1) IFlowCaptureOperation: 6 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IParameterReferenceOperation: b1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'b1') Jump if True (Regular) to Block[B11] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'b1') Operand: IFlowCaptureReferenceOperation: 6 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Leaving: {R6} Next (Regular) Block[B10] Block[B10] - Block Predecessors: [B9] Statements (1) IFlowCaptureOperation: 7 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'b1') Instance Receiver: IFlowCaptureReferenceOperation: 6 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Arguments(0) Next (Regular) Block[B12] Leaving: {R6} } Block[B11] - Block Predecessors: [B9] Statements (1) IFlowCaptureOperation: 7 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b2') Value: IParameterReferenceOperation: b2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b2') Next (Regular) Block[B12] Block[B12] - Block Predecessors: [B10] [B11] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim If(x1 ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'If(x1, x2)( ... If(b1, b2))') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') DimensionSizes(2): IFlowCaptureReferenceOperation: 5 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Left: IFlowCaptureReferenceOperation: 7 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(b1, b2)') Next (Regular) Block[B13] Leaving: {R1} } Block[B13] - Exit Predecessors: [B12] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30068: Expression is a value and therefore cannot be the target of an assignment. ReDim If(x1, x2)(If(a1, a2), If(b1, b2)) ~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x1(If(a1, a2)), x2(b) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x1') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... a2)), x2(b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x1(If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x1') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Block Predecessors: [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... a2)), x2(b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x2(b)') Operand: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x2') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B7] Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInSecondClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x1(b), x2(If(a1, a2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(b) ... If(a1, a2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x1(b)') Operand: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x1') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B2] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x2') Next (Regular) Block[B3] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B5] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B6] Leaving: {R2} } Block[B5] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B4] [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(b) ... If(a1, a2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x2(If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x2') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B7] Leaving: {R1} } Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInMultipleClauses() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)" ReDim x1(If(a1, a2)), x2(If(b1, b2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x1') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x1(If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x1') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R1} Entering: {R3} } .locals {R3} { CaptureIds: [3] [5] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x2') Next (Regular) Block[B7] Entering: {R4} .locals {R4} { CaptureIds: [4] Block[B7] - Block Predecessors: [B6] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IParameterReferenceOperation: b1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'b1') Jump if True (Regular) to Block[B9] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'b1') Operand: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Leaving: {R4} Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B7] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'b1') Instance Receiver: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Arguments(0) Next (Regular) Block[B10] Leaving: {R4} } Block[B9] - Block Predecessors: [B7] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b2') Value: IParameterReferenceOperation: b2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b2') Next (Regular) Block[B10] Block[B10] - Block Predecessors: [B8] [B9] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x2(If(b1, b2))') Operand: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x2') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Left: IFlowCaptureReferenceOperation: 5 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(b1, b2)') Next (Regular) Block[B11] Leaving: {R3} } Block[B11] - Exit Predecessors: [B10] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_NoControlFlowPropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer)'BIND:"Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer)" ReDim X(a1)(a2), Y(a3) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (2) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1)(a2), Y(a3)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(a1)(a2)') Operand: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(a1)') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'a1') IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a2') Left: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a2') IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1)(a2), Y(a3)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(a3)') Operand: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a3') Left: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a3') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a3') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstClauseOperand_PropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer?, a2 As Integer, a3 As Integer, a4 As Integer)'BIND:"Public Sub Main(a1 As Integer?, a2 As Integer, a3 As Integer, a4 As Integer)" ReDim X(If(a1, a2))(a3), Y(a4) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(If( ... (a3), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(If(a1, a2))(a3)') Operand: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(If(a1, a2))') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'If(a1, a2)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a3') Left: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a3') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a3') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Block Predecessors: [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(If( ... (a3), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(a4)') Operand: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a4') Left: IParameterReferenceOperation: a4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a4') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a4') Next (Regular) Block[B6] Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstClauseDimension_PropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer, a2 As Integer?, a3 As Integer, a4 As Integer)'BIND:"Public Sub Main(a1 As Integer, a2 As Integer?, a3 As Integer, a4 As Integer)" ReDim X(a1)(If(a2, a3)), Y(a4) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'X(a1)') Value: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(a1)') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'a1') IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a2') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a2') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a2') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a2') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a2') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a3') Value: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a3') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... a3)), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(a1)(If(a2, a3))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'X(a1)') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a2, a3)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a2, a3)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a2, a3)') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Block Predecessors: [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... a3)), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(a4)') Operand: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a4') Left: IParameterReferenceOperation: a4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a4') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a4') Next (Regular) Block[B7] Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInSecondClause_PropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer?, a4 As Integer)'BIND:"Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer?, a4 As Integer)" ReDim X(a1)(a2), Y(If(a3, a4)) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... If(a3, a4))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(a1)(a2)') Operand: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(a1)') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'a1') IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a2') Left: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a2') Next (Regular) Block[B2] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Y') Value: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null Next (Regular) Block[B3] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a3') Value: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a3') Jump if True (Regular) to Block[B5] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a3') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a3') Leaving: {R2} Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a3') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a3') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a3') Arguments(0) Next (Regular) Block[B6] Leaving: {R2} } Block[B5] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a4') Value: IParameterReferenceOperation: a4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a4') Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B4] [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... If(a3, a4))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(If(a3, a4))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'Y') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a3, a4)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a3, a4)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a3, a4)') Next (Regular) Block[B7] Leaving: {R1} } Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlow_PreserveFlag() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim Preserve x(If(a1, a2), b) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (Preserve) (OperationKind.ReDim, Type: null) (Syntax: 'ReDim Prese ... a1, a2), b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(If(a1, a2), b)') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Partial Public Class IOperationTests Inherits SemanticModelTestBase <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_SingleClause_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"ReDim intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim intArray(2)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimClause_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of RedimClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimOperand_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"intArray" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of IdentifierNameSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimSize_SimpleArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim intArray(2)'BIND:"2" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of LiteralExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_SingleClause_MultiDimensionalArray() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1, 1) As Integer ReDim intArray(2, 1)'BIND:"ReDim intArray(2, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim intArray(2, 1)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2, 1)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32(,)) (Syntax: 'intArray') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_MultipleClause_DifferentDimensionalArrays() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim intArray(2), x(1, 1)'BIND:"ReDim intArray(2), x(1, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim intAr ... 2), x(1, 1)') Clauses(2): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1, 1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimClause_FirstClauseFromMultipleClauses() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim intArray(2), x(1, 1)'BIND:"intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of RedimClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimClause_SecondClauseFromMultipleClauses() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim intArray(2), x(1, 1)'BIND:"x(1, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1, 1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of RedimClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_Preserve_SingleClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() Dim intArray(1) As Integer ReDim Preserve intArray(2)'BIND:"ReDim Preserve intArray(2)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (Preserve) (OperationKind.ReDim, Type: null) (Syntax: 'ReDim Prese ... intArray(2)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_Preserve_MultipleClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) Dim intArray(1) As Integer ReDim Preserve intArray(2), x(1, 1)'BIND:"ReDim Preserve intArray(2), x(1, 1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (Preserve) (OperationKind.ReDim, Type: null) (Syntax: 'ReDim Prese ... 2), x(1, 1)') Clauses(2): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'intArray(2)') Operand: ILocalReferenceOperation: intArray (OperationKind.LocalReference, Type: System.Int32()) (Syntax: 'intArray') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: '2') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1, 1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = String.Empty VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NoOperandOrIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() ReDim'BIND:"ReDim" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '') Operand: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: '') Children(1): IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. ReDim'BIND:"ReDim" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_Preserve_NoOperandOrIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() ReDim Preserve'BIND:"ReDim Preserve" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (Preserve) (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim Preserve') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '') Operand: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: '') Children(1): IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. ReDim Preserve'BIND:"ReDim Preserve" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NoIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x() As Integer) ReDim x'BIND:"ReDim x" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x'BIND:"ReDim x"') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x'BIND:"ReDim x"') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(), IsInvalid) (Syntax: 'x') DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30670: 'ReDim' statements require a parenthesized list of the new bounds of each dimension of the array. ReDim x'BIND:"ReDim x" ~~~~~~~~~~~~~~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NoOperand() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M() ReDim (1)'BIND:"ReDim (1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim (1)'B ... "ReDim (1)"') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '(1)'BIND:"ReDim (1)"') Operand: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: '(1)') Children(1): IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '(1)') Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30074: Constant cannot be the target of an assignment. ReDim (1)'BIND:"ReDim (1)" ~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NonArrayOperandWithoutIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x As Integer) ReDim x'BIND:"ReDim x" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x'BIND:"ReDim x"') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x'BIND:"ReDim x"') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsInvalid) (Syntax: 'x') DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30049: 'Redim' statement requires an array. ReDim x'BIND:"ReDim x" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_NonArrayOperandWithIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x As Integer) ReDim x(1)'BIND:"ReDim x(1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x(1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsInvalid) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30049: 'Redim' statement requires an array. ReDim x(1)'BIND:"ReDim x(1)" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_ChangeArrayDimensions() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) ReDim x(1)'BIND:"ReDim x(1)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x(1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,), IsInvalid) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsInvalid, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '1') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30415: 'ReDim' cannot change the number of dimensions of an array. ReDim x(1)'BIND:"ReDim x(1)" ~~~~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_MissingIndexArgument() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer) ReDim x(1,)'BIND:"ReDim x(1,)" End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1,)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'x(1,)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsInvalid, IsImplicit) (Syntax: '') Left: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: '') Children(0) Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '') ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30306: Array subscript expression missing. ReDim x(1,)'BIND:"ReDim x(1,)" ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation)> <Fact, WorkItem(30175, "https://github.com/dotnet/roslyn/issues/30175")> Public Sub ReDimStatement_ErrorCase_MissingClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x() As Integer) ReDim x(1), 'BIND:"ReDim x(1), " End Sub End Class]]>.Value Dim expectedOperationTree = <![CDATA[ IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim x(1), ') Clauses(2): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(1)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: '1') Left: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: '') Operand: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: '') Children(1): IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) DimensionSizes(0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30201: Expression expected. ReDim x(1), 'BIND:"ReDim x(1), " ~ ]]>.Value VerifyOperationTreeAndDiagnosticsForTest(Of ReDimStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_NoControlFlow() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x() As Integer, a As Integer)'BIND:"Public Sub M(x() As Integer, a As Integer)" ReDim x(a) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(a)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(a)') Operand: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a') Left: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInClauseOperand() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a As Integer)" ReDim If(x1, x2)(a) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32(), IsInvalid) (Syntax: 'x1') Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'x1') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsInvalid, IsImplicit) (Syntax: 'x1') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsInvalid, IsImplicit) (Syntax: 'x1') Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32(), IsInvalid) (Syntax: 'x2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim If(x1, x2)(a)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'If(x1, x2)(a)') Operand: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Children(1): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a') Left: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Exit Predecessors: [B4] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30068: Expression is a value and therefore cannot be the target of an assignment. ReDim If(x1, x2)(a) ~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x(If(a1, a2), b) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(If(a1, a2), b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(If(a1, a2), b)') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInSecondIndex() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x(b, If(a1, a2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [1] [3] Block[B1] - Block Predecessors: [B0] Statements (2) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b') Value: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(b, If(a1, a2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(b, If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'b') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInMultipleDimensionSizes() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)" ReDim x(If(a1, a2), If(b1, b2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [3] [5] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') Next (Regular) Block[B2] Entering: {R2} {R3} .locals {R2} { CaptureIds: [2] .locals {R3} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R3} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R3} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'If(a1, a2)') Value: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R2} Entering: {R4} } .locals {R4} { CaptureIds: [4] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IParameterReferenceOperation: b1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'b1') Jump if True (Regular) to Block[B8] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'b1') Operand: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Leaving: {R4} Next (Regular) Block[B7] Block[B7] - Block Predecessors: [B6] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'b1') Instance Receiver: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Arguments(0) Next (Regular) Block[B9] Leaving: {R4} } Block[B8] - Block Predecessors: [B6] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b2') Value: IParameterReferenceOperation: b2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b2') Next (Regular) Block[B9] Block[B9] - Block Predecessors: [B7] [B8] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null) (Syntax: 'ReDim x(If( ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(If(a1, a2 ... If(b1, b2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Left: IFlowCaptureReferenceOperation: 5 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(b1, b2)') Next (Regular) Block[B10] Leaving: {R1} } Block[B10] - Exit Predecessors: [B9] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInOperandAndDimensionSizes() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1(,) As Integer, x2(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)'BIND:"Public Sub M(x1(,) As Integer, x2(,) As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)" ReDim If(x1, x2)(If(a1, a2), If(b1, b2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} {R3} .locals {R1} { CaptureIds: [2] [5] [7] .locals {R2} { CaptureIds: [1] .locals {R3} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32(,), IsInvalid) (Syntax: 'x1') Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'x1') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsInvalid, IsImplicit) (Syntax: 'x1') Leaving: {R3} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x1') Value: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsInvalid, IsImplicit) (Syntax: 'x1') Next (Regular) Block[B4] Leaving: {R3} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32(,), IsInvalid) (Syntax: 'x2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Value: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Children(1): IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') Next (Regular) Block[B5] Leaving: {R2} Entering: {R4} {R5} } .locals {R4} { CaptureIds: [4] .locals {R5} { CaptureIds: [3] Block[B5] - Block Predecessors: [B4] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B7] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R5} Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B8] Leaving: {R5} } Block[B7] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B6] [B7] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'If(a1, a2)') Value: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B9] Leaving: {R4} Entering: {R6} } .locals {R6} { CaptureIds: [6] Block[B9] - Block Predecessors: [B8] Statements (1) IFlowCaptureOperation: 6 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IParameterReferenceOperation: b1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'b1') Jump if True (Regular) to Block[B11] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'b1') Operand: IFlowCaptureReferenceOperation: 6 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Leaving: {R6} Next (Regular) Block[B10] Block[B10] - Block Predecessors: [B9] Statements (1) IFlowCaptureOperation: 7 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'b1') Instance Receiver: IFlowCaptureReferenceOperation: 6 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Arguments(0) Next (Regular) Block[B12] Leaving: {R6} } Block[B11] - Block Predecessors: [B9] Statements (1) IFlowCaptureOperation: 7 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b2') Value: IParameterReferenceOperation: b2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b2') Next (Regular) Block[B12] Block[B12] - Block Predecessors: [B10] [B11] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsInvalid) (Syntax: 'ReDim If(x1 ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null, IsInvalid) (Syntax: 'If(x1, x2)( ... If(b1, b2))') Operand: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'If(x1, x2)') DimensionSizes(2): IFlowCaptureReferenceOperation: 5 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Left: IFlowCaptureReferenceOperation: 7 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(b1, b2)') Next (Regular) Block[B13] Leaving: {R1} } Block[B13] - Exit Predecessors: [B12] Statements (0) ]]>.Value Dim expectedDiagnostics = <![CDATA[ BC30068: Expression is a value and therefore cannot be the target of an assignment. ReDim If(x1, x2)(If(a1, a2), If(b1, b2)) ~~~~~~~~~~ ]]>.Value VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x1(If(a1, a2)), x2(b) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x1') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... a2)), x2(b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x1(If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x1') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Block Predecessors: [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... a2)), x2(b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x2(b)') Operand: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x2') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B7] Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInSecondClause() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim x1(b), x2(If(a1, a2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(b) ... If(a1, a2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x1(b)') Operand: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x1') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B2] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x2') Next (Regular) Block[B3] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B5] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B6] Leaving: {R2} } Block[B5] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B4] [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(b) ... If(a1, a2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x2(If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x2') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B7] Leaving: {R1} } Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInMultipleClauses() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)'BIND:"Public Sub M(x1() As Integer, x2() As Integer, a1 As Integer?, a2 As Integer, b1 As Integer?, b2 As Integer)" ReDim x1(If(a1, a2)), x2(If(b1, b2)) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x1') Value: IParameterReferenceOperation: x1 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x1') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x1(If(a1, a2))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x1') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') Next (Regular) Block[B6] Leaving: {R1} Entering: {R3} } .locals {R3} { CaptureIds: [3] [5] Block[B6] - Block Predecessors: [B5] Statements (1) IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x2') Value: IParameterReferenceOperation: x2 (OperationKind.ParameterReference, Type: System.Int32()) (Syntax: 'x2') Next (Regular) Block[B7] Entering: {R4} .locals {R4} { CaptureIds: [4] Block[B7] - Block Predecessors: [B6] Statements (1) IFlowCaptureOperation: 4 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IParameterReferenceOperation: b1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'b1') Jump if True (Regular) to Block[B9] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'b1') Operand: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Leaving: {R4} Next (Regular) Block[B8] Block[B8] - Block Predecessors: [B7] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'b1') Instance Receiver: IFlowCaptureReferenceOperation: 4 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'b1') Arguments(0) Next (Regular) Block[B10] Leaving: {R4} } Block[B9] - Block Predecessors: [B7] Statements (1) IFlowCaptureOperation: 5 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'b2') Value: IParameterReferenceOperation: b2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b2') Next (Regular) Block[B10] Block[B10] - Block Predecessors: [B8] [B9] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim x1(If ... If(b1, b2))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x2(If(b1, b2))') Operand: IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'x2') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Left: IFlowCaptureReferenceOperation: 5 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(b1, b2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(b1, b2)') Next (Regular) Block[B11] Leaving: {R3} } Block[B11] - Exit Predecessors: [B10] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_NoControlFlowPropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer)'BIND:"Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer)" ReDim X(a1)(a2), Y(a3) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (2) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1)(a2), Y(a3)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(a1)(a2)') Operand: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(a1)') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'a1') IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a2') Left: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a2') IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1)(a2), Y(a3)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(a3)') Operand: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a3') Left: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a3') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a3') Next (Regular) Block[B2] Block[B2] - Exit Predecessors: [B1] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstClauseOperand_PropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer?, a2 As Integer, a3 As Integer, a4 As Integer)'BIND:"Public Sub Main(a1 As Integer?, a2 As Integer, a3 As Integer, a4 As Integer)" ReDim X(If(a1, a2))(a3), Y(a4) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} {R2} .locals {R1} { CaptureIds: [1] .locals {R2} { CaptureIds: [0] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B3] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B4] Leaving: {R2} } Block[B3] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B2] [B3] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(If( ... (a3), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(If(a1, a2))(a3)') Operand: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(If(a1, a2))') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'If(a1, a2)') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a3') Left: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a3') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a3') Next (Regular) Block[B5] Leaving: {R1} } Block[B5] - Block Predecessors: [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(If( ... (a3), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(a4)') Operand: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a4') Left: IParameterReferenceOperation: a4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a4') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a4') Next (Regular) Block[B6] Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInFirstClauseDimension_PropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer, a2 As Integer?, a3 As Integer, a4 As Integer)'BIND:"Public Sub Main(a1 As Integer, a2 As Integer?, a3 As Integer, a4 As Integer)" ReDim X(a1)(If(a2, a3)), Y(a4) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'X(a1)') Value: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(a1)') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'a1') IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a2') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a2') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a2') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a2') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a2') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a3') Value: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a3') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... a3)), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(a1)(If(a2, a3))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'X(a1)') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a2, a3)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a2, a3)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a2, a3)') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Block Predecessors: [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... a3)), Y(a4)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(a4)') Operand: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a4') Left: IParameterReferenceOperation: a4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a4') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a4') Next (Regular) Block[B7] Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlowInSecondClause_PropertyInvocationReturningArray() Dim source = <![CDATA[ Module Module1 Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer?, a4 As Integer)'BIND:"Public Sub Main(a1 As Integer, a2 As Integer, a3 As Integer?, a4 As Integer)" ReDim X(a1)(a2), Y(If(a3, a4)) End Sub Property X(z As Integer) As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property Property Y As Integer() Get Return Nothing End Get Set(value As Integer()) End Set End Property End Module ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Block[B1] - Block Predecessors: [B0] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... If(a3, a4))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'X(a1)(a2)') Operand: IPropertyReferenceOperation: Property Module1.X(z As System.Int32) As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'X(a1)') Instance Receiver: null Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'a1') IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'a2') Left: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'a2') Next (Regular) Block[B2] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Y') Value: IPropertyReferenceOperation: Property Module1.Y As System.Int32() (Static) (OperationKind.PropertyReference, Type: System.Int32()) (Syntax: 'Y') Instance Receiver: null Next (Regular) Block[B3] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a3') Value: IParameterReferenceOperation: a3 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a3') Jump if True (Regular) to Block[B5] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a3') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a3') Leaving: {R2} Next (Regular) Block[B4] Block[B4] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a3') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a3') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a3') Arguments(0) Next (Regular) Block[B6] Leaving: {R2} } Block[B5] - Block Predecessors: [B3] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a4') Value: IParameterReferenceOperation: a4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a4') Next (Regular) Block[B6] Block[B6] - Block Predecessors: [B4] [B5] Statements (1) IReDimOperation (OperationKind.ReDim, Type: null, IsImplicit) (Syntax: 'ReDim X(a1) ... If(a3, a4))') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'Y(If(a3, a4))') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(), IsImplicit) (Syntax: 'Y') DimensionSizes(1): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a3, a4)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a3, a4)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a3, a4)') Next (Regular) Block[B7] Leaving: {R1} } Block[B7] - Exit Predecessors: [B6] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub <CompilerTrait(CompilerFeature.IOperation, CompilerFeature.Dataflow)> <Fact()> Public Sub ReDimStatement_ControlFlow_PreserveFlag() Dim source = <![CDATA[ Imports System Friend Class [Class] Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)'BIND:"Public Sub M(x(,) As Integer, a1 As Integer?, a2 As Integer, b As Integer)" ReDim Preserve x(If(a1, a2), b) End Sub End Class ]]>.Value Dim expectedFlowGraph = <![CDATA[ Block[B0] - Entry Statements (0) Next (Regular) Block[B1] Entering: {R1} .locals {R1} { CaptureIds: [0] [2] Block[B1] - Block Predecessors: [B0] Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') Value: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32(,)) (Syntax: 'x') Next (Regular) Block[B2] Entering: {R2} .locals {R2} { CaptureIds: [1] Block[B2] - Block Predecessors: [B1] Statements (1) IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IParameterReferenceOperation: a1 (OperationKind.ParameterReference, Type: System.Nullable(Of System.Int32)) (Syntax: 'a1') Jump if True (Regular) to Block[B4] IIsNullOperation (OperationKind.IsNull, Type: System.Boolean, IsImplicit) (Syntax: 'a1') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Leaving: {R2} Next (Regular) Block[B3] Block[B3] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a1') Value: IInvocationOperation ( Function System.Nullable(Of System.Int32).GetValueOrDefault() As System.Int32) (OperationKind.Invocation, Type: System.Int32, IsImplicit) (Syntax: 'a1') Instance Receiver: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Nullable(Of System.Int32), IsImplicit) (Syntax: 'a1') Arguments(0) Next (Regular) Block[B5] Leaving: {R2} } Block[B4] - Block Predecessors: [B2] Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a2') Value: IParameterReferenceOperation: a2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a2') Next (Regular) Block[B5] Block[B5] - Block Predecessors: [B3] [B4] Statements (1) IReDimOperation (Preserve) (OperationKind.ReDim, Type: null) (Syntax: 'ReDim Prese ... a1, a2), b)') Clauses(1): IReDimClauseOperation (OperationKind.ReDimClause, Type: null) (Syntax: 'x(If(a1, a2), b)') Operand: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32(,), IsImplicit) (Syntax: 'x') DimensionSizes(2): IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'If(a1, a2)') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'If(a1, a2)') IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.Binary, Type: System.Int32, IsImplicit) (Syntax: 'b') Left: IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'b') Next (Regular) Block[B6] Leaving: {R1} } Block[B6] - Exit Predecessors: [B5] Statements (0) ]]>.Value Dim expectedDiagnostics = String.Empty VerifyFlowGraphAndDiagnosticsForTest(Of MethodBlockSyntax)(source, expectedFlowGraph, expectedDiagnostics) End Sub End Class End Namespace
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxVisitor.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.CSharp { /// <summary> /// Represents a <see cref="CSharpSyntaxNode"/> visitor that visits only the single CSharpSyntaxNode /// passed into its Visit method and produces /// a value of the type specified by the <typeparamref name="TResult"/> parameter. /// </summary> /// <typeparam name="TResult"> /// The type of the return value this visitor's Visit method. /// </typeparam> public abstract partial class CSharpSyntaxVisitor<TResult> { public virtual TResult? Visit(SyntaxNode? node) { if (node != null) { return ((CSharpSyntaxNode)node).Accept(this); } // should not come here too often so we will put this at the end of the method. return default; } public virtual TResult? DefaultVisit(SyntaxNode node) { return default; } } /// <summary> /// Represents a <see cref="CSharpSyntaxNode"/> visitor that visits only the single CSharpSyntaxNode /// passed into its Visit method. /// </summary> public abstract partial class CSharpSyntaxVisitor { public virtual void Visit(SyntaxNode? node) { if (node != null) { ((CSharpSyntaxNode)node).Accept(this); } } public virtual void DefaultVisit(SyntaxNode node) { } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.CSharp { /// <summary> /// Represents a <see cref="CSharpSyntaxNode"/> visitor that visits only the single CSharpSyntaxNode /// passed into its Visit method and produces /// a value of the type specified by the <typeparamref name="TResult"/> parameter. /// </summary> /// <typeparam name="TResult"> /// The type of the return value this visitor's Visit method. /// </typeparam> public abstract partial class CSharpSyntaxVisitor<TResult> { public virtual TResult? Visit(SyntaxNode? node) { if (node != null) { return ((CSharpSyntaxNode)node).Accept(this); } // should not come here too often so we will put this at the end of the method. return default; } public virtual TResult? DefaultVisit(SyntaxNode node) { return default; } } /// <summary> /// Represents a <see cref="CSharpSyntaxNode"/> visitor that visits only the single CSharpSyntaxNode /// passed into its Visit method. /// </summary> public abstract partial class CSharpSyntaxVisitor { public virtual void Visit(SyntaxNode? node) { if (node != null) { ((CSharpSyntaxNode)node).Accept(this); } } public virtual void DefaultVisit(SyntaxNode node) { } } }
-1
dotnet/roslyn
55,614
Move NonRemappableRegions, Capabilities to EditSession
Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
tmat
2021-08-13T18:46:58Z
2021-08-16T16:50:03Z
7fb7af26eafae33fa23ce72a16f42e694e3bc177
612b978e951f219b625f1b117d6d0f0f48a0ca55
Move NonRemappableRegions, Capabilities to EditSession. Removes mutable NonRemappableRegions from DebuggingSession. Makes capabilities lazy - they are only needed when analyzing documents with changes, but not before such document is analyzed. Allows capabilities to change during debugging session - they are still immutable within edit session. When the debugger attaches to a new process it can now restart edit session with new capabilities and active statements. Debugger follow-up: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922
./src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilerDiagnosticAnalyzer.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.Diagnostics { /// <summary> /// DiagnosticAnalyzer for compiler's syntax/semantic/compilation diagnostics. /// </summary> internal abstract partial class CompilerDiagnosticAnalyzer : DiagnosticAnalyzer { internal abstract CommonMessageProvider MessageProvider { get; } internal abstract ImmutableArray<int> GetSupportedErrorCodes(); public sealed override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { // DiagnosticAnalyzer.SupportedDiagnostics should be invoked only once per analyzer, // so we don't need to store the computed descriptors array into a field. var messageProvider = this.MessageProvider; var errorCodes = this.GetSupportedErrorCodes(); var builder = ImmutableArray.CreateBuilder<DiagnosticDescriptor>(errorCodes.Length); foreach (var errorCode in errorCodes) { var descriptor = DiagnosticInfo.GetDescriptor(errorCode, messageProvider); builder.Add(descriptor); } builder.Add(AnalyzerExecutor.GetAnalyzerExceptionDiagnosticDescriptor()); return builder.ToImmutable(); } } public sealed override void Initialize(AnalysisContext context) { context.EnableConcurrentExecution(); context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); context.RegisterCompilationStartAction(c => { var analyzer = new CompilationAnalyzer(c.Compilation); c.RegisterSyntaxTreeAction(analyzer.AnalyzeSyntaxTree); c.RegisterSemanticModelAction(CompilationAnalyzer.AnalyzeSemanticModel); }); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.Diagnostics { /// <summary> /// DiagnosticAnalyzer for compiler's syntax/semantic/compilation diagnostics. /// </summary> internal abstract partial class CompilerDiagnosticAnalyzer : DiagnosticAnalyzer { internal abstract CommonMessageProvider MessageProvider { get; } internal abstract ImmutableArray<int> GetSupportedErrorCodes(); public sealed override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { // DiagnosticAnalyzer.SupportedDiagnostics should be invoked only once per analyzer, // so we don't need to store the computed descriptors array into a field. var messageProvider = this.MessageProvider; var errorCodes = this.GetSupportedErrorCodes(); var builder = ImmutableArray.CreateBuilder<DiagnosticDescriptor>(errorCodes.Length); foreach (var errorCode in errorCodes) { var descriptor = DiagnosticInfo.GetDescriptor(errorCode, messageProvider); builder.Add(descriptor); } builder.Add(AnalyzerExecutor.GetAnalyzerExceptionDiagnosticDescriptor()); return builder.ToImmutable(); } } public sealed override void Initialize(AnalysisContext context) { context.EnableConcurrentExecution(); context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); context.RegisterCompilationStartAction(c => { var analyzer = new CompilationAnalyzer(c.Compilation); c.RegisterSyntaxTreeAction(analyzer.AnalyzeSyntaxTree); c.RegisterSemanticModelAction(CompilationAnalyzer.AnalyzeSemanticModel); }); } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.DocumentChangeTracker.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { internal partial class RequestExecutionQueue { internal interface IDocumentChangeTracker { void StartTracking(Uri documentUri, SourceText initialText); void UpdateTrackedDocument(Uri documentUri, SourceText text); void StopTracking(Uri documentUri); bool IsTracking(Uri documentUri); IEnumerable<(Uri DocumentUri, SourceText Text)> GetTrackedDocuments(); SourceText GetTrackedDocumentSourceText(Uri documentUri); } private class NonMutatingDocumentChangeTracker : IDocumentChangeTracker { private readonly DocumentChangeTracker _tracker; public NonMutatingDocumentChangeTracker(DocumentChangeTracker tracker) { _tracker = tracker; } public IEnumerable<(Uri DocumentUri, SourceText Text)> GetTrackedDocuments() => _tracker.GetTrackedDocuments(); public SourceText GetTrackedDocumentSourceText(Uri documentUri) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } public bool IsTracking(Uri documentUri) => _tracker.IsTracking(documentUri); public void StartTracking(Uri documentUri, SourceText initialText) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } public void StopTracking(Uri documentUri) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } public void UpdateTrackedDocument(Uri documentUri, SourceText text) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } } /// <summary> /// Keeps track of changes to documents that are opened in the LSP client. Calls MUST not overlap, so this /// should be called from a mutating request handler. See <see cref="RequestExecutionQueue"/> for more details. /// </summary> internal class DocumentChangeTracker : IWorkspaceService, IDocumentChangeTracker { private readonly Dictionary<Uri, SourceText> _trackedDocuments = new(); public bool IsTracking(Uri documentUri) => _trackedDocuments.ContainsKey(documentUri); public void StartTracking(Uri documentUri, SourceText initialText) { Contract.ThrowIfTrue(_trackedDocuments.ContainsKey(documentUri), $"didOpen received for {documentUri} which is already open."); _trackedDocuments.Add(documentUri, initialText); } public void UpdateTrackedDocument(Uri documentUri, SourceText text) { Contract.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), $"didChange received for {documentUri} which is not open."); _trackedDocuments[documentUri] = text; } public SourceText GetTrackedDocumentSourceText(Uri documentUri) { Contract.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), "didChange received for a document that isn't open."); return _trackedDocuments[documentUri]; } public void StopTracking(Uri documentUri) { Contract.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), $"didClose received for {documentUri} which is not open."); _trackedDocuments.Remove(documentUri); } public IEnumerable<(Uri DocumentUri, SourceText Text)> GetTrackedDocuments() => _trackedDocuments.Select(k => (k.Key, k.Value)); } internal TestAccessor GetTestAccessor() => new TestAccessor(this); internal readonly struct TestAccessor { private readonly RequestExecutionQueue _queue; public TestAccessor(RequestExecutionQueue queue) => _queue = queue; public List<SourceText> GetTrackedTexts() => _queue._documentChangeTracker.GetTrackedDocuments().Select(i => i.Text).ToList(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { internal partial class RequestExecutionQueue { internal interface IDocumentChangeTracker { void StartTracking(Uri documentUri, SourceText initialText); void UpdateTrackedDocument(Uri documentUri, SourceText text); void StopTracking(Uri documentUri); bool IsTracking(Uri documentUri); IEnumerable<(Uri DocumentUri, SourceText Text)> GetTrackedDocuments(); SourceText GetTrackedDocumentSourceText(Uri documentUri); } private class NonMutatingDocumentChangeTracker : IDocumentChangeTracker { private readonly DocumentChangeTracker _tracker; public NonMutatingDocumentChangeTracker(DocumentChangeTracker tracker) { _tracker = tracker; } public IEnumerable<(Uri DocumentUri, SourceText Text)> GetTrackedDocuments() => _tracker.GetTrackedDocuments(); public SourceText GetTrackedDocumentSourceText(Uri documentUri) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } public bool IsTracking(Uri documentUri) => _tracker.IsTracking(documentUri); public void StartTracking(Uri documentUri, SourceText initialText) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } public void StopTracking(Uri documentUri) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } public void UpdateTrackedDocument(Uri documentUri, SourceText text) { Contract.Fail("Mutating documents not allowed in a non-mutating request handler"); throw new NotImplementedException(); } } /// <summary> /// Keeps track of changes to documents that are opened in the LSP client. Calls MUST not overlap, so this /// should be called from a mutating request handler. See <see cref="RequestExecutionQueue"/> for more details. /// </summary> internal class DocumentChangeTracker : IWorkspaceService, IDocumentChangeTracker { private readonly Dictionary<Uri, SourceText> _trackedDocuments = new(); public bool IsTracking(Uri documentUri) => _trackedDocuments.ContainsKey(documentUri); public void StartTracking(Uri documentUri, SourceText initialText) { Contract.ThrowIfTrue(_trackedDocuments.ContainsKey(documentUri), $"didOpen received for {documentUri} which is already open."); _trackedDocuments.Add(documentUri, initialText); } public void UpdateTrackedDocument(Uri documentUri, SourceText text) { Contract.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), $"didChange received for {documentUri} which is not open."); _trackedDocuments[documentUri] = text; } public SourceText GetTrackedDocumentSourceText(Uri documentUri) { Contract.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), "didChange received for a document that isn't open."); return _trackedDocuments[documentUri]; } public void StopTracking(Uri documentUri) { Contract.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), $"didClose received for {documentUri} which is not open."); _trackedDocuments.Remove(documentUri); } public IEnumerable<(Uri DocumentUri, SourceText Text)> GetTrackedDocuments() => _trackedDocuments.Select(k => (k.Key, k.Value)); } internal TestAccessor GetTestAccessor() => new TestAccessor(this); internal readonly struct TestAccessor { private readonly RequestExecutionQueue _queue; public TestAccessor(RequestExecutionQueue queue) => _queue = queue; public List<SourceText> GetTrackedTexts() => _queue._documentChangeTracker.GetTrackedDocuments().Select(i => i.Text).ToList(); public bool IsComplete() => _queue._queue.IsCompleted && _queue._queue.IsEmpty; } } }
1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Features/LanguageServer/Protocol/LanguageServerTarget.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Protocol; using Roslyn.Utilities; using StreamJsonRpc; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { internal class LanguageServerTarget : ILanguageServerTarget { private readonly ICapabilitiesProvider _capabilitiesProvider; protected readonly JsonRpc JsonRpc; protected readonly RequestDispatcher RequestDispatcher; protected readonly RequestExecutionQueue Queue; protected readonly ILspWorkspaceRegistrationService WorkspaceRegistrationService; protected readonly IAsynchronousOperationListener Listener; protected readonly ILspLogger Logger; protected readonly string? ClientName; /// <summary> /// Server name used when sending error messages to the client. /// </summary> private readonly string _userVisibleServerName; /// <summary> /// Server name used when capturing error telemetry. /// </summary> protected readonly string TelemetryServerName; // Set on first LSP initialize request. protected ClientCapabilities? _clientCapabilities; // Fields used during shutdown. private bool _shuttingDown; private Task? _errorShutdownTask; internal bool HasShutdownStarted => _shuttingDown; internal LanguageServerTarget( AbstractRequestDispatcherFactory requestDispatcherFactory, JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, ILspWorkspaceRegistrationService workspaceRegistrationService, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, ImmutableArray<string> supportedLanguages, string? clientName, string userVisibleServerName, string telemetryServerTypeName) { RequestDispatcher = requestDispatcherFactory.CreateRequestDispatcher(supportedLanguages); _capabilitiesProvider = capabilitiesProvider; WorkspaceRegistrationService = workspaceRegistrationService; Logger = logger; JsonRpc = jsonRpc; JsonRpc.AddLocalRpcTarget(this); Listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); ClientName = clientName; _userVisibleServerName = userVisibleServerName; TelemetryServerName = telemetryServerTypeName; Queue = new RequestExecutionQueue(logger, workspaceRegistrationService, supportedLanguages, userVisibleServerName, TelemetryServerName); Queue.RequestServerShutdown += RequestExecutionQueue_Errored; } /// <summary> /// Handle the LSP initialize request by storing the client capabilities and responding with the server /// capabilities. The specification assures that the initialize request is sent only once. /// </summary> [JsonRpcMethod(Methods.InitializeName, UseSingleObjectParameterDeserialization = true)] public Task<InitializeResult> InitializeAsync(InitializeParams initializeParams, CancellationToken cancellationToken) { try { Logger?.TraceStart("Initialize"); Contract.ThrowIfTrue(_clientCapabilities != null, $"{nameof(InitializeAsync)} called multiple times"); _clientCapabilities = initializeParams.Capabilities; return Task.FromResult(new InitializeResult { Capabilities = _capabilitiesProvider.GetCapabilities(_clientCapabilities), }); } finally { Logger?.TraceStop("Initialize"); } } [JsonRpcMethod(Methods.InitializedName)] public virtual Task InitializedAsync() { return Task.CompletedTask; } [JsonRpcMethod(Methods.ShutdownName)] public Task ShutdownAsync(CancellationToken _) { try { Logger?.TraceStart("Shutdown"); ShutdownImpl(); return Task.CompletedTask; } finally { Logger?.TraceStop("Shutdown"); } } protected virtual void ShutdownImpl() { Contract.ThrowIfTrue(_shuttingDown, "Shutdown has already been called."); _shuttingDown = true; ShutdownRequestQueue(); } [JsonRpcMethod(Methods.ExitName)] public Task ExitAsync(CancellationToken _) { try { Logger?.TraceStart("Exit"); ExitImpl(); return Task.CompletedTask; } finally { Logger?.TraceStop("Exit"); } } private void ExitImpl() { try { ShutdownRequestQueue(); JsonRpc.Dispose(); } catch (Exception e) when (FatalError.ReportAndCatch(e)) { // Swallow exceptions thrown by disposing our JsonRpc object. Disconnected events can potentially throw their own exceptions so // we purposefully ignore all of those exceptions in an effort to shutdown gracefully. } } [JsonRpcMethod(Methods.TextDocumentDefinitionName, UseSingleObjectParameterDeserialization = true)] public Task<LSP.Location[]> GetTextDocumentDefinitionAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, LSP.Location[]>(Queue, Methods.TextDocumentDefinitionName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentRenameName, UseSingleObjectParameterDeserialization = true)] public Task<WorkspaceEdit> GetTextDocumentRenameAsync(RenameParams renameParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<RenameParams, WorkspaceEdit>(Queue, Methods.TextDocumentRenameName, renameParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentReferencesName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalReferenceItem[]?> GetTextDocumentReferencesAsync(ReferenceParams referencesParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<ReferenceParams, VSInternalReferenceItem[]?>(Queue, Methods.TextDocumentReferencesName, referencesParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentCodeActionName, UseSingleObjectParameterDeserialization = true)] public Task<CodeAction[]> GetTextDocumentCodeActionsAsync(CodeActionParams codeActionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<CodeActionParams, CodeAction[]>(Queue, Methods.TextDocumentCodeActionName, codeActionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.CodeActionResolveName, UseSingleObjectParameterDeserialization = true)] public Task<CodeAction> ResolveCodeActionAsync(CodeAction codeAction, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<CodeAction, CodeAction>(Queue, Methods.CodeActionResolveName, codeAction, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentCompletionName, UseSingleObjectParameterDeserialization = true)] public async Task<SumType<CompletionList, CompletionItem[]>> GetTextDocumentCompletionAsync(CompletionParams completionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); // Convert to sumtype before reporting to work around https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1107698 return await RequestDispatcher.ExecuteRequestAsync<CompletionParams, CompletionList>(Queue, Methods.TextDocumentCompletionName, completionParams, _clientCapabilities, ClientName, cancellationToken).ConfigureAwait(false); } [JsonRpcMethod(Methods.TextDocumentCompletionResolveName, UseSingleObjectParameterDeserialization = true)] public Task<CompletionItem> ResolveCompletionItemAsync(CompletionItem completionItem, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<CompletionItem, CompletionItem>(Queue, Methods.TextDocumentCompletionResolveName, completionItem, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentFoldingRangeName, UseSingleObjectParameterDeserialization = true)] public Task<FoldingRange[]> GetTextDocumentFoldingRangeAsync(FoldingRangeParams textDocumentFoldingRangeParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<FoldingRangeParams, FoldingRange[]>(Queue, Methods.TextDocumentFoldingRangeName, textDocumentFoldingRangeParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDocumentHighlightName, UseSingleObjectParameterDeserialization = true)] public Task<DocumentHighlight[]> GetTextDocumentDocumentHighlightsAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, DocumentHighlight[]>(Queue, Methods.TextDocumentDocumentHighlightName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentHoverName, UseSingleObjectParameterDeserialization = true)] public Task<Hover?> GetTextDocumentDocumentHoverAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, Hover?>(Queue, Methods.TextDocumentHoverName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDocumentSymbolName, UseSingleObjectParameterDeserialization = true)] public Task<object[]> GetTextDocumentDocumentSymbolsAsync(DocumentSymbolParams documentSymbolParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentSymbolParams, object[]>(Queue, Methods.TextDocumentDocumentSymbolName, documentSymbolParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentFormattingName, UseSingleObjectParameterDeserialization = true)] public Task<TextEdit[]> GetTextDocumentFormattingAsync(DocumentFormattingParams documentFormattingParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentFormattingParams, TextEdit[]>(Queue, Methods.TextDocumentFormattingName, documentFormattingParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentOnTypeFormattingName, UseSingleObjectParameterDeserialization = true)] public Task<TextEdit[]> GetTextDocumentFormattingOnTypeAsync(DocumentOnTypeFormattingParams documentOnTypeFormattingParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentOnTypeFormattingParams, TextEdit[]>(Queue, Methods.TextDocumentOnTypeFormattingName, documentOnTypeFormattingParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentImplementationName, UseSingleObjectParameterDeserialization = true)] public Task<LSP.Location[]> GetTextDocumentImplementationsAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, LSP.Location[]>(Queue, Methods.TextDocumentImplementationName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentRangeFormattingName, UseSingleObjectParameterDeserialization = true)] public Task<TextEdit[]> GetTextDocumentRangeFormattingAsync(DocumentRangeFormattingParams documentRangeFormattingParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentRangeFormattingParams, TextEdit[]>(Queue, Methods.TextDocumentRangeFormattingName, documentRangeFormattingParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentSignatureHelpName, UseSingleObjectParameterDeserialization = true)] public Task<LSP.SignatureHelp?> GetTextDocumentSignatureHelpAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, LSP.SignatureHelp?>(Queue, Methods.TextDocumentSignatureHelpName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.WorkspaceExecuteCommandName, UseSingleObjectParameterDeserialization = true)] public Task<object> ExecuteWorkspaceCommandAsync(ExecuteCommandParams executeCommandParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<ExecuteCommandParams, object>(Queue, Methods.WorkspaceExecuteCommandName, executeCommandParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.WorkspaceSymbolName, UseSingleObjectParameterDeserialization = true)] public Task<SymbolInformation[]?> GetWorkspaceSymbolsAsync(WorkspaceSymbolParams workspaceSymbolParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<WorkspaceSymbolParams, SymbolInformation[]?>(Queue, Methods.WorkspaceSymbolName, workspaceSymbolParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentSemanticTokensFullName, UseSingleObjectParameterDeserialization = true)] public Task<SemanticTokens> GetTextDocumentSemanticTokensAsync(SemanticTokensParams semanticTokensParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<SemanticTokensParams, SemanticTokens>(Queue, Methods.TextDocumentSemanticTokensFullName, semanticTokensParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentSemanticTokensFullDeltaName, UseSingleObjectParameterDeserialization = true)] public Task<SumType<SemanticTokens, SemanticTokensDelta>> GetTextDocumentSemanticTokensEditsAsync(SemanticTokensDeltaParams semanticTokensEditsParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<SemanticTokensDeltaParams, SumType<SemanticTokens, SemanticTokensDelta>>(Queue, Methods.TextDocumentSemanticTokensFullDeltaName, semanticTokensEditsParams, _clientCapabilities, ClientName, cancellationToken); } // Note: Since a range request is always received in conjunction with a whole document request, we don't need to cache range results. [JsonRpcMethod(Methods.TextDocumentSemanticTokensRangeName, UseSingleObjectParameterDeserialization = true)] public Task<SemanticTokens> GetTextDocumentSemanticTokensRangeAsync(SemanticTokensRangeParams semanticTokensRangeParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<SemanticTokensRangeParams, SemanticTokens>(Queue, Methods.TextDocumentSemanticTokensRangeName, semanticTokensRangeParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDidChangeName, UseSingleObjectParameterDeserialization = true)] public Task<object> HandleDocumentDidChangeAsync(DidChangeTextDocumentParams didChangeParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DidChangeTextDocumentParams, object>(Queue, Methods.TextDocumentDidChangeName, didChangeParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDidOpenName, UseSingleObjectParameterDeserialization = true)] public Task<object?> HandleDocumentDidOpenAsync(DidOpenTextDocumentParams didOpenParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DidOpenTextDocumentParams, object?>(Queue, Methods.TextDocumentDidOpenName, didOpenParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDidCloseName, UseSingleObjectParameterDeserialization = true)] public Task<object?> HandleDocumentDidCloseAsync(DidCloseTextDocumentParams didCloseParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DidCloseTextDocumentParams, object?>(Queue, Methods.TextDocumentDidCloseName, didCloseParams, _clientCapabilities, ClientName, cancellationToken); } private void ShutdownRequestQueue() { Queue.RequestServerShutdown -= RequestExecutionQueue_Errored; // if the queue requested shutdown via its event, it will have already shut itself down, but this // won't cause any problems calling it again Queue.Shutdown(); } private void RequestExecutionQueue_Errored(object? sender, RequestShutdownEventArgs e) { // log message and shut down Logger?.TraceWarning($"Request queue is requesting shutdown due to error: {e.Message}"); var message = new LogMessageParams() { MessageType = MessageType.Error, Message = e.Message }; var asyncToken = Listener.BeginAsyncOperation(nameof(RequestExecutionQueue_Errored)); _errorShutdownTask = Task.Run(async () => { Logger?.TraceInformation("Shutting down language server."); await JsonRpc.NotifyWithParameterObjectAsync(Methods.WindowLogMessageName, message).ConfigureAwait(false); ShutdownImpl(); ExitImpl(); }).CompletesAsyncOperation(asyncToken); } public async ValueTask DisposeAsync() { // if the server shut down due to error, we might not have finished cleaning up if (_errorShutdownTask is not null) await _errorShutdownTask.ConfigureAwait(false); if (Logger is IDisposable disposableLogger) disposableLogger.Dispose(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServer.Protocol; using Roslyn.Utilities; using StreamJsonRpc; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer { internal class LanguageServerTarget : ILanguageServerTarget { private readonly ICapabilitiesProvider _capabilitiesProvider; protected readonly JsonRpc JsonRpc; protected readonly RequestDispatcher RequestDispatcher; protected readonly RequestExecutionQueue Queue; protected readonly ILspWorkspaceRegistrationService WorkspaceRegistrationService; protected readonly IAsynchronousOperationListener Listener; protected readonly ILspLogger Logger; protected readonly string? ClientName; /// <summary> /// Server name used when sending error messages to the client. /// </summary> private readonly string _userVisibleServerName; /// <summary> /// Server name used when capturing error telemetry. /// </summary> protected readonly string TelemetryServerName; // Set on first LSP initialize request. protected ClientCapabilities? _clientCapabilities; // Fields used during shutdown. private bool _shuttingDown; private Task? _errorShutdownTask; internal bool HasShutdownStarted => _shuttingDown; internal LanguageServerTarget( AbstractRequestDispatcherFactory requestDispatcherFactory, JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, ILspWorkspaceRegistrationService workspaceRegistrationService, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, ImmutableArray<string> supportedLanguages, string? clientName, string userVisibleServerName, string telemetryServerTypeName) { RequestDispatcher = requestDispatcherFactory.CreateRequestDispatcher(supportedLanguages); _capabilitiesProvider = capabilitiesProvider; WorkspaceRegistrationService = workspaceRegistrationService; Logger = logger; JsonRpc = jsonRpc; JsonRpc.AddLocalRpcTarget(this); JsonRpc.Disconnected += JsonRpc_Disconnected; Listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); ClientName = clientName; _userVisibleServerName = userVisibleServerName; TelemetryServerName = telemetryServerTypeName; Queue = new RequestExecutionQueue(logger, workspaceRegistrationService, supportedLanguages, userVisibleServerName, TelemetryServerName); Queue.RequestServerShutdown += RequestExecutionQueue_Errored; } /// <summary> /// Handle the LSP initialize request by storing the client capabilities and responding with the server /// capabilities. The specification assures that the initialize request is sent only once. /// </summary> [JsonRpcMethod(Methods.InitializeName, UseSingleObjectParameterDeserialization = true)] public Task<InitializeResult> InitializeAsync(InitializeParams initializeParams, CancellationToken cancellationToken) { try { Logger?.TraceStart("Initialize"); Contract.ThrowIfTrue(_clientCapabilities != null, $"{nameof(InitializeAsync)} called multiple times"); _clientCapabilities = initializeParams.Capabilities; return Task.FromResult(new InitializeResult { Capabilities = _capabilitiesProvider.GetCapabilities(_clientCapabilities), }); } finally { Logger?.TraceStop("Initialize"); } } [JsonRpcMethod(Methods.InitializedName)] public virtual Task InitializedAsync() { return Task.CompletedTask; } [JsonRpcMethod(Methods.ShutdownName)] public Task ShutdownAsync(CancellationToken _) { try { Logger?.TraceStart("Shutdown"); ShutdownImpl(); return Task.CompletedTask; } finally { Logger?.TraceStop("Shutdown"); } } protected virtual void ShutdownImpl() { Contract.ThrowIfTrue(_shuttingDown, "Shutdown has already been called."); _shuttingDown = true; ShutdownRequestQueue(); } [JsonRpcMethod(Methods.ExitName)] public Task ExitAsync(CancellationToken _) { try { Logger?.TraceStart("Exit"); ExitImpl(); return Task.CompletedTask; } finally { Logger?.TraceStop("Exit"); } } private void ExitImpl() { try { ShutdownRequestQueue(); JsonRpc.Disconnected -= JsonRpc_Disconnected; JsonRpc.Dispose(); } catch (Exception e) when (FatalError.ReportAndCatch(e)) { // Swallow exceptions thrown by disposing our JsonRpc object. Disconnected events can potentially throw their own exceptions so // we purposefully ignore all of those exceptions in an effort to shutdown gracefully. } } [JsonRpcMethod(Methods.TextDocumentDefinitionName, UseSingleObjectParameterDeserialization = true)] public Task<LSP.Location[]> GetTextDocumentDefinitionAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, LSP.Location[]>(Queue, Methods.TextDocumentDefinitionName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentRenameName, UseSingleObjectParameterDeserialization = true)] public Task<WorkspaceEdit> GetTextDocumentRenameAsync(RenameParams renameParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<RenameParams, WorkspaceEdit>(Queue, Methods.TextDocumentRenameName, renameParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentReferencesName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalReferenceItem[]?> GetTextDocumentReferencesAsync(ReferenceParams referencesParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<ReferenceParams, VSInternalReferenceItem[]?>(Queue, Methods.TextDocumentReferencesName, referencesParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentCodeActionName, UseSingleObjectParameterDeserialization = true)] public Task<CodeAction[]> GetTextDocumentCodeActionsAsync(CodeActionParams codeActionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<CodeActionParams, CodeAction[]>(Queue, Methods.TextDocumentCodeActionName, codeActionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.CodeActionResolveName, UseSingleObjectParameterDeserialization = true)] public Task<CodeAction> ResolveCodeActionAsync(CodeAction codeAction, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<CodeAction, CodeAction>(Queue, Methods.CodeActionResolveName, codeAction, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentCompletionName, UseSingleObjectParameterDeserialization = true)] public async Task<SumType<CompletionList, CompletionItem[]>> GetTextDocumentCompletionAsync(CompletionParams completionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); // Convert to sumtype before reporting to work around https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1107698 return await RequestDispatcher.ExecuteRequestAsync<CompletionParams, CompletionList>(Queue, Methods.TextDocumentCompletionName, completionParams, _clientCapabilities, ClientName, cancellationToken).ConfigureAwait(false); } [JsonRpcMethod(Methods.TextDocumentCompletionResolveName, UseSingleObjectParameterDeserialization = true)] public Task<CompletionItem> ResolveCompletionItemAsync(CompletionItem completionItem, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<CompletionItem, CompletionItem>(Queue, Methods.TextDocumentCompletionResolveName, completionItem, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentFoldingRangeName, UseSingleObjectParameterDeserialization = true)] public Task<FoldingRange[]> GetTextDocumentFoldingRangeAsync(FoldingRangeParams textDocumentFoldingRangeParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<FoldingRangeParams, FoldingRange[]>(Queue, Methods.TextDocumentFoldingRangeName, textDocumentFoldingRangeParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDocumentHighlightName, UseSingleObjectParameterDeserialization = true)] public Task<DocumentHighlight[]> GetTextDocumentDocumentHighlightsAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, DocumentHighlight[]>(Queue, Methods.TextDocumentDocumentHighlightName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentHoverName, UseSingleObjectParameterDeserialization = true)] public Task<Hover?> GetTextDocumentDocumentHoverAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, Hover?>(Queue, Methods.TextDocumentHoverName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDocumentSymbolName, UseSingleObjectParameterDeserialization = true)] public Task<object[]> GetTextDocumentDocumentSymbolsAsync(DocumentSymbolParams documentSymbolParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentSymbolParams, object[]>(Queue, Methods.TextDocumentDocumentSymbolName, documentSymbolParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentFormattingName, UseSingleObjectParameterDeserialization = true)] public Task<TextEdit[]> GetTextDocumentFormattingAsync(DocumentFormattingParams documentFormattingParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentFormattingParams, TextEdit[]>(Queue, Methods.TextDocumentFormattingName, documentFormattingParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentOnTypeFormattingName, UseSingleObjectParameterDeserialization = true)] public Task<TextEdit[]> GetTextDocumentFormattingOnTypeAsync(DocumentOnTypeFormattingParams documentOnTypeFormattingParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentOnTypeFormattingParams, TextEdit[]>(Queue, Methods.TextDocumentOnTypeFormattingName, documentOnTypeFormattingParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentImplementationName, UseSingleObjectParameterDeserialization = true)] public Task<LSP.Location[]> GetTextDocumentImplementationsAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, LSP.Location[]>(Queue, Methods.TextDocumentImplementationName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentRangeFormattingName, UseSingleObjectParameterDeserialization = true)] public Task<TextEdit[]> GetTextDocumentRangeFormattingAsync(DocumentRangeFormattingParams documentRangeFormattingParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DocumentRangeFormattingParams, TextEdit[]>(Queue, Methods.TextDocumentRangeFormattingName, documentRangeFormattingParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentSignatureHelpName, UseSingleObjectParameterDeserialization = true)] public Task<LSP.SignatureHelp?> GetTextDocumentSignatureHelpAsync(TextDocumentPositionParams textDocumentPositionParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<TextDocumentPositionParams, LSP.SignatureHelp?>(Queue, Methods.TextDocumentSignatureHelpName, textDocumentPositionParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.WorkspaceExecuteCommandName, UseSingleObjectParameterDeserialization = true)] public Task<object> ExecuteWorkspaceCommandAsync(ExecuteCommandParams executeCommandParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<ExecuteCommandParams, object>(Queue, Methods.WorkspaceExecuteCommandName, executeCommandParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.WorkspaceSymbolName, UseSingleObjectParameterDeserialization = true)] public Task<SymbolInformation[]?> GetWorkspaceSymbolsAsync(WorkspaceSymbolParams workspaceSymbolParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<WorkspaceSymbolParams, SymbolInformation[]?>(Queue, Methods.WorkspaceSymbolName, workspaceSymbolParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentSemanticTokensFullName, UseSingleObjectParameterDeserialization = true)] public Task<SemanticTokens> GetTextDocumentSemanticTokensAsync(SemanticTokensParams semanticTokensParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<SemanticTokensParams, SemanticTokens>(Queue, Methods.TextDocumentSemanticTokensFullName, semanticTokensParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentSemanticTokensFullDeltaName, UseSingleObjectParameterDeserialization = true)] public Task<SumType<SemanticTokens, SemanticTokensDelta>> GetTextDocumentSemanticTokensEditsAsync(SemanticTokensDeltaParams semanticTokensEditsParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<SemanticTokensDeltaParams, SumType<SemanticTokens, SemanticTokensDelta>>(Queue, Methods.TextDocumentSemanticTokensFullDeltaName, semanticTokensEditsParams, _clientCapabilities, ClientName, cancellationToken); } // Note: Since a range request is always received in conjunction with a whole document request, we don't need to cache range results. [JsonRpcMethod(Methods.TextDocumentSemanticTokensRangeName, UseSingleObjectParameterDeserialization = true)] public Task<SemanticTokens> GetTextDocumentSemanticTokensRangeAsync(SemanticTokensRangeParams semanticTokensRangeParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<SemanticTokensRangeParams, SemanticTokens>(Queue, Methods.TextDocumentSemanticTokensRangeName, semanticTokensRangeParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDidChangeName, UseSingleObjectParameterDeserialization = true)] public Task<object> HandleDocumentDidChangeAsync(DidChangeTextDocumentParams didChangeParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DidChangeTextDocumentParams, object>(Queue, Methods.TextDocumentDidChangeName, didChangeParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDidOpenName, UseSingleObjectParameterDeserialization = true)] public Task<object?> HandleDocumentDidOpenAsync(DidOpenTextDocumentParams didOpenParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DidOpenTextDocumentParams, object?>(Queue, Methods.TextDocumentDidOpenName, didOpenParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentDidCloseName, UseSingleObjectParameterDeserialization = true)] public Task<object?> HandleDocumentDidCloseAsync(DidCloseTextDocumentParams didCloseParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<DidCloseTextDocumentParams, object?>(Queue, Methods.TextDocumentDidCloseName, didCloseParams, _clientCapabilities, ClientName, cancellationToken); } private void ShutdownRequestQueue() { Queue.RequestServerShutdown -= RequestExecutionQueue_Errored; // if the queue requested shutdown via its event, it will have already shut itself down, but this // won't cause any problems calling it again Queue.Shutdown(); } private void RequestExecutionQueue_Errored(object? sender, RequestShutdownEventArgs e) { // log message and shut down Logger?.TraceWarning($"Request queue is requesting shutdown due to error: {e.Message}"); var message = new LogMessageParams() { MessageType = MessageType.Error, Message = e.Message }; var asyncToken = Listener.BeginAsyncOperation(nameof(RequestExecutionQueue_Errored)); _errorShutdownTask = Task.Run(async () => { Logger?.TraceInformation("Shutting down language server."); await JsonRpc.NotifyWithParameterObjectAsync(Methods.WindowLogMessageName, message).ConfigureAwait(false); ShutdownImpl(); ExitImpl(); }).CompletesAsyncOperation(asyncToken); } /// <summary> /// Cleanup the server if we encounter a json rpc disconnect so that we can be restarted later. /// </summary> private void JsonRpc_Disconnected(object? sender, JsonRpcDisconnectedEventArgs e) { if (_shuttingDown) { // We're already in the normal shutdown -> exit path, no need to do anything. return; } Logger?.TraceWarning($"Encountered unexpected jsonrpc disconnect, Reason={e.Reason}, Description={e.Description}, Exception={e.Exception}"); ShutdownImpl(); ExitImpl(); } public async ValueTask DisposeAsync() { // if the server shut down due to error, we might not have finished cleaning up if (_errorShutdownTask is not null) await _errorShutdownTask.ConfigureAwait(false); if (Logger is IDisposable disposableLogger) disposableLogger.Dispose(); } internal TestAccessor GetTestAccessor() => new TestAccessor(this.Queue); internal readonly struct TestAccessor { private readonly RequestExecutionQueue _queue; public TestAccessor(RequestExecutionQueue queue) => _queue = queue; public RequestExecutionQueue.TestAccessor GetQueueAccessor() => _queue.GetTestAccessor(); } } }
1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/VisualStudio/Core/Def/Implementation/LanguageClient/VisualStudioInProcLanguageServer.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Roslyn.Utilities; using StreamJsonRpc; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Implementation.LanguageClient { /// <summary> /// Implementation of <see cref="LanguageServerTarget"/> that also supports /// VS LSP extension methods. /// </summary> internal class VisualStudioInProcLanguageServer : LanguageServerTarget { /// <summary> /// Legacy support for LSP push diagnostics. /// Work queue responsible for receiving notifications about diagnostic updates and publishing those to /// interested parties. /// </summary> private readonly AsyncBatchingWorkQueue<DocumentId> _diagnosticsWorkQueue; private readonly IDiagnosticService? _diagnosticService; internal VisualStudioInProcLanguageServer( AbstractRequestDispatcherFactory requestDispatcherFactory, JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, ILspWorkspaceRegistrationService workspaceRegistrationService, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, IDiagnosticService? diagnosticService, ImmutableArray<string> supportedLanguages, string? clientName, string userVisibleServerName, string telemetryServerTypeName) : base(requestDispatcherFactory, jsonRpc, capabilitiesProvider, workspaceRegistrationService, listenerProvider, logger, supportedLanguages, clientName, userVisibleServerName, telemetryServerTypeName) { _diagnosticService = diagnosticService; // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue<DocumentId>( TimeSpan.FromMilliseconds(250), (ids, ct) => ProcessDiagnosticUpdatedBatchAsync(_diagnosticService, ids, ct), EqualityComparer<DocumentId>.Default, Listener, Queue.CancellationToken); if (_diagnosticService != null) _diagnosticService.DiagnosticsUpdated += DiagnosticService_DiagnosticsUpdated; } public override Task InitializedAsync() { try { Logger?.TraceStart("Initialized"); // Publish diagnostics for all open documents immediately following initialization. PublishOpenFileDiagnostics(); return Task.CompletedTask; } finally { Logger?.TraceStop("Initialized"); } void PublishOpenFileDiagnostics() { foreach (var workspace in WorkspaceRegistrationService.GetAllRegistrations()) { var solution = workspace.CurrentSolution; var openDocuments = workspace.GetOpenDocumentIds(); foreach (var documentId in openDocuments) DiagnosticService_DiagnosticsUpdated(solution, documentId); } } } [JsonRpcMethod(VSInternalMethods.DocumentPullDiagnosticName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalDiagnosticReport[]?> GetDocumentPullDiagnosticsAsync(VSInternalDocumentDiagnosticsParams diagnosticsParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSInternalDocumentDiagnosticsParams, VSInternalDiagnosticReport[]?>( Queue, VSInternalMethods.DocumentPullDiagnosticName, diagnosticsParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(VSInternalMethods.WorkspacePullDiagnosticName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalWorkspaceDiagnosticReport[]?> GetWorkspacePullDiagnosticsAsync(VSInternalWorkspaceDiagnosticsParams diagnosticsParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSInternalWorkspaceDiagnosticsParams, VSInternalWorkspaceDiagnosticReport[]?>( Queue, VSInternalMethods.WorkspacePullDiagnosticName, diagnosticsParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(VSMethods.GetProjectContextsName, UseSingleObjectParameterDeserialization = true)] public Task<VSProjectContextList?> GetProjectContextsAsync(VSGetProjectContextsParams textDocumentWithContextParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSGetProjectContextsParams, VSProjectContextList?>(Queue, VSMethods.GetProjectContextsName, textDocumentWithContextParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(VSInternalMethods.OnAutoInsertName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalDocumentOnAutoInsertResponseItem?> GetDocumentOnAutoInsertAsync(VSInternalDocumentOnAutoInsertParams autoInsertParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSInternalDocumentOnAutoInsertParams, VSInternalDocumentOnAutoInsertResponseItem?>(Queue, VSInternalMethods.OnAutoInsertName, autoInsertParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentLinkedEditingRangeName, UseSingleObjectParameterDeserialization = true)] public Task<LinkedEditingRanges?> GetLinkedEditingRangesAsync(LinkedEditingRangeParams renameParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<LinkedEditingRangeParams, LinkedEditingRanges?>(Queue, Methods.TextDocumentLinkedEditingRangeName, renameParams, _clientCapabilities, ClientName, cancellationToken); } protected override void ShutdownImpl() { base.ShutdownImpl(); if (_diagnosticService != null) _diagnosticService.DiagnosticsUpdated -= DiagnosticService_DiagnosticsUpdated; } private void DiagnosticService_DiagnosticsUpdated(object _, DiagnosticsUpdatedArgs e) => DiagnosticService_DiagnosticsUpdated(e.Solution, e.DocumentId); private void DiagnosticService_DiagnosticsUpdated(Solution? solution, DocumentId? documentId) { // LSP doesn't support diagnostics without a document. So if we get project level diagnostics without a document, ignore them. if (documentId != null && solution != null) { var document = solution.GetDocument(documentId); if (document == null || document.FilePath == null) return; // Only publish document diagnostics for the languages this provider supports. if (document.Project.Language != CodeAnalysis.LanguageNames.CSharp && document.Project.Language != CodeAnalysis.LanguageNames.VisualBasic) return; _diagnosticsWorkQueue.AddWork(document.Id); } } /// <summary> /// Stores the last published LSP diagnostics with the Roslyn document that they came from. /// This is useful in the following scenario. Imagine we have documentA which has contributions to mapped files m1 and m2. /// dA -> m1 /// And m1 has contributions from documentB. /// m1 -> dA, dB /// When we query for diagnostic on dA, we get a subset of the diagnostics on m1 (missing the contributions from dB) /// Since each publish diagnostics notification replaces diagnostics per document, /// we must union the diagnostics contribution from dB and dA to produce all diagnostics for m1 and publish all at once. /// /// This dictionary stores the previously computed diagnostics for the published file so that we can /// union the currently computed diagnostics (e.g. for dA) with previously computed diagnostics (e.g. from dB). /// </summary> private readonly Dictionary<Uri, Dictionary<DocumentId, ImmutableArray<LSP.Diagnostic>>> _publishedFileToDiagnostics = new(); /// <summary> /// Stores the mapping of a document to the uri(s) of diagnostics previously produced for this document. When /// we get empty diagnostics for the document we need to find the uris we previously published for this /// document. Then we can publish the updated diagnostics set for those uris (either empty or the diagnostic /// contributions from other documents). We use a sorted set to ensure consistency in the order in which we /// report URIs. While it's not necessary to publish a document's mapped file diagnostics in a particular /// order, it does make it much easier to write tests and debug issues if we have a consistent ordering. /// </summary> private readonly Dictionary<DocumentId, ImmutableSortedSet<Uri>> _documentsToPublishedUris = new(); /// <summary> /// Basic comparer for Uris used by <see cref="_documentsToPublishedUris"/> when publishing notifications. /// </summary> private static readonly Comparer<Uri> s_uriComparer = Comparer<Uri>.Create((uri1, uri2) => Uri.Compare(uri1, uri2, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase)); // internal for testing purposes internal async ValueTask ProcessDiagnosticUpdatedBatchAsync( IDiagnosticService? diagnosticService, ImmutableArray<DocumentId> documentIds, CancellationToken cancellationToken) { if (diagnosticService == null) return; foreach (var documentId in documentIds) { cancellationToken.ThrowIfCancellationRequested(); var document = WorkspaceRegistrationService.GetAllRegistrations().Select(w => w.CurrentSolution.GetDocument(documentId)).FirstOrDefault(); if (document != null) { // If this is a `pull` client, and `pull` diagnostics is on, then we should not `publish` (push) the // diagnostics here. var diagnosticMode = document.IsRazorDocument() ? InternalDiagnosticsOptions.RazorDiagnosticMode : InternalDiagnosticsOptions.NormalDiagnosticMode; if (document.Project.Solution.Workspace.IsPushDiagnostics(diagnosticMode)) await PublishDiagnosticsAsync(diagnosticService, document, cancellationToken).ConfigureAwait(false); } } } private async Task PublishDiagnosticsAsync(IDiagnosticService diagnosticService, Document document, CancellationToken cancellationToken) { // Retrieve all diagnostics for the current document grouped by their actual file uri. var fileUriToDiagnostics = await GetDiagnosticsAsync(diagnosticService, document, cancellationToken).ConfigureAwait(false); // Get the list of file uris with diagnostics (for the document). // We need to join the uris from current diagnostics with those previously published // so that we clear out any diagnostics in mapped files that are no longer a part // of the current diagnostics set (because the diagnostics were fixed). // Use sorted set to have consistent publish ordering for tests and debugging. var urisForCurrentDocument = _documentsToPublishedUris.GetValueOrDefault(document.Id, ImmutableSortedSet.Create<Uri>(s_uriComparer)).Union(fileUriToDiagnostics.Keys); // Update the mapping for this document to be the uris we're about to publish diagnostics for. _documentsToPublishedUris[document.Id] = urisForCurrentDocument; // Go through each uri and publish the updated set of diagnostics per uri. foreach (var fileUri in urisForCurrentDocument) { // Get the updated diagnostics for a single uri that were contributed by the current document. var diagnostics = fileUriToDiagnostics.GetValueOrDefault(fileUri, ImmutableArray<LSP.Diagnostic>.Empty); if (_publishedFileToDiagnostics.ContainsKey(fileUri)) { // Get all previously published diagnostics for this uri excluding those that were contributed from the current document. // We don't need those since we just computed the updated values above. var diagnosticsFromOtherDocuments = _publishedFileToDiagnostics[fileUri].Where(kvp => kvp.Key != document.Id).SelectMany(kvp => kvp.Value); // Since diagnostics are replaced per uri, we must publish both contributions from this document and any other document // that has diagnostic contributions to this uri, so union the two sets. diagnostics = diagnostics.AddRange(diagnosticsFromOtherDocuments); } await SendDiagnosticsNotificationAsync(fileUri, diagnostics).ConfigureAwait(false); // There are three cases here -> // 1. There are no diagnostics to publish for this fileUri. We no longer need to track the fileUri at all. // 2. There are diagnostics from the current document. Store the diagnostics for the fileUri and document // so they can be published along with contributions to the fileUri from other documents. // 3. There are no diagnostics contributed by this document to the fileUri (could be some from other documents). // We should clear out the diagnostics for this document for the fileUri. if (diagnostics.IsEmpty) { // We published an empty set of diagnostics for this uri. We no longer need to keep track of this mapping // since there will be no previous diagnostics that we need to clear out. _documentsToPublishedUris.MultiRemove(document.Id, fileUri); // There are not any diagnostics to keep track of for this file, so we can stop. _publishedFileToDiagnostics.Remove(fileUri); } else if (fileUriToDiagnostics.ContainsKey(fileUri)) { // We do have diagnostics from the current document - update the published diagnostics map // to contain the new diagnostics contributed by this document for this uri. var documentsToPublishedDiagnostics = _publishedFileToDiagnostics.GetOrAdd(fileUri, (_) => new Dictionary<DocumentId, ImmutableArray<LSP.Diagnostic>>()); documentsToPublishedDiagnostics[document.Id] = fileUriToDiagnostics[fileUri]; } else { // There were diagnostics from other documents, but none from the current document. // If we're tracking the current document, we can stop. IReadOnlyDictionaryExtensions.GetValueOrDefault(_publishedFileToDiagnostics, fileUri)?.Remove(document.Id); _documentsToPublishedUris.MultiRemove(document.Id, fileUri); } } } private async Task SendDiagnosticsNotificationAsync(Uri uri, ImmutableArray<LSP.Diagnostic> diagnostics) { var publishDiagnosticsParams = new PublishDiagnosticParams { Diagnostics = diagnostics.ToArray(), Uri = uri }; await JsonRpc.NotifyWithParameterObjectAsync(Methods.TextDocumentPublishDiagnosticsName, publishDiagnosticsParams).ConfigureAwait(false); } private async Task<Dictionary<Uri, ImmutableArray<LSP.Diagnostic>>> GetDiagnosticsAsync( IDiagnosticService diagnosticService, Document document, CancellationToken cancellationToken) { var option = document.IsRazorDocument() ? InternalDiagnosticsOptions.RazorDiagnosticMode : InternalDiagnosticsOptions.NormalDiagnosticMode; var pushDiagnostics = await diagnosticService.GetPushDiagnosticsAsync(document.Project.Solution.Workspace, document.Project.Id, document.Id, id: null, includeSuppressedDiagnostics: false, option, cancellationToken).ConfigureAwait(false); var diagnostics = pushDiagnostics.WhereAsArray(IncludeDiagnostic); var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); // Retrieve diagnostics for the document. These diagnostics could be for the current document, or they could map // to a different location in a different file. We need to publish the diagnostics for the mapped locations as well. // An example of this is razor imports where the generated C# document maps to many razor documents. // https://docs.microsoft.com/en-us/aspnet/core/mvc/views/layout?view=aspnetcore-3.1#importing-shared-directives // https://docs.microsoft.com/en-us/aspnet/core/blazor/layouts?view=aspnetcore-3.1#centralized-layout-selection // So we get the diagnostics and group them by the actual mapped path so we can publish notifications // for each mapped file's diagnostics. var fileUriToDiagnostics = diagnostics.GroupBy(diagnostic => GetDiagnosticUri(document, diagnostic)).ToDictionary( group => group.Key, group => group.Select(diagnostic => ConvertToLspDiagnostic(diagnostic, text)).ToImmutableArray()); return fileUriToDiagnostics; static Uri GetDiagnosticUri(Document document, DiagnosticData diagnosticData) { Contract.ThrowIfNull(diagnosticData.DataLocation, "Diagnostic data location should not be null here"); // Razor wants to handle all span mapping themselves. So if we are in razor, return the raw doc spans, and // do not map them. var filePath = diagnosticData.DataLocation.MappedFilePath ?? diagnosticData.DataLocation.OriginalFilePath; return ProtocolConversions.GetUriFromFilePath(filePath); } } private LSP.Diagnostic ConvertToLspDiagnostic(DiagnosticData diagnosticData, SourceText text) { Contract.ThrowIfNull(diagnosticData.DataLocation); var diagnostic = new LSP.Diagnostic { Source = TelemetryServerName, Code = diagnosticData.Id, Severity = Convert(diagnosticData.Severity), Range = GetDiagnosticRange(diagnosticData.DataLocation, text), // Only the unnecessary diagnostic tag is currently supported via LSP. Tags = diagnosticData.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary) ? new DiagnosticTag[] { DiagnosticTag.Unnecessary } : Array.Empty<DiagnosticTag>() }; if (diagnosticData.Message != null) diagnostic.Message = diagnosticData.Message; return diagnostic; } private static LSP.DiagnosticSeverity Convert(CodeAnalysis.DiagnosticSeverity severity) => severity switch { CodeAnalysis.DiagnosticSeverity.Hidden => LSP.DiagnosticSeverity.Hint, CodeAnalysis.DiagnosticSeverity.Info => LSP.DiagnosticSeverity.Hint, CodeAnalysis.DiagnosticSeverity.Warning => LSP.DiagnosticSeverity.Warning, CodeAnalysis.DiagnosticSeverity.Error => LSP.DiagnosticSeverity.Error, _ => throw ExceptionUtilities.UnexpectedValue(severity), }; // Some diagnostics only apply to certain clients and document types, e.g. Razor. // If the DocumentPropertiesService.DiagnosticsLspClientName property exists, we only include the // diagnostic if it directly matches the client name. // If the DocumentPropertiesService.DiagnosticsLspClientName property doesn't exist, // we know that the diagnostic we're working with is contained in a C#/VB file, since // if we were working with a non-C#/VB file, then the property should have been populated. // In this case, unless we have a null client name, we don't want to publish the diagnostic // (since a null client name represents the C#/VB language server). private bool IncludeDiagnostic(DiagnosticData diagnostic) => IReadOnlyDictionaryExtensions.GetValueOrDefault(diagnostic.Properties, nameof(DocumentPropertiesService.DiagnosticsLspClientName)) == ClientName; private static LSP.Range GetDiagnosticRange(DiagnosticDataLocation diagnosticDataLocation, SourceText text) { var linePositionSpan = DiagnosticData.GetLinePositionSpan(diagnosticDataLocation, text, useMapped: true); return ProtocolConversions.LinePositionToRange(linePositionSpan); } internal TestAccessor GetTestAccessor() => new(this); internal readonly struct TestAccessor { private readonly VisualStudioInProcLanguageServer _server; internal TestAccessor(VisualStudioInProcLanguageServer server) { _server = server; } internal ImmutableArray<Uri> GetFileUrisInPublishDiagnostics() => _server._publishedFileToDiagnostics.Keys.ToImmutableArray(); internal ImmutableArray<DocumentId> GetDocumentIdsInPublishedUris() => _server._documentsToPublishedUris.Keys.ToImmutableArray(); internal IImmutableSet<Uri> GetFileUrisForDocument(DocumentId documentId) => _server._documentsToPublishedUris.GetValueOrDefault(documentId, ImmutableSortedSet<Uri>.Empty); internal ImmutableArray<LSP.Diagnostic> GetDiagnosticsForUriAndDocument(DocumentId documentId, Uri uri) { if (_server._publishedFileToDiagnostics.TryGetValue(uri, out var dict) && dict.TryGetValue(documentId, out var diagnostics)) return diagnostics; return ImmutableArray<LSP.Diagnostic>.Empty; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Roslyn.Utilities; using StreamJsonRpc; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.VisualStudio.LanguageServices.Implementation.LanguageClient { /// <summary> /// Implementation of <see cref="LanguageServerTarget"/> that also supports /// VS LSP extension methods. /// </summary> internal class VisualStudioInProcLanguageServer : LanguageServerTarget { /// <summary> /// Legacy support for LSP push diagnostics. /// Work queue responsible for receiving notifications about diagnostic updates and publishing those to /// interested parties. /// </summary> private readonly AsyncBatchingWorkQueue<DocumentId> _diagnosticsWorkQueue; private readonly IDiagnosticService? _diagnosticService; internal VisualStudioInProcLanguageServer( AbstractRequestDispatcherFactory requestDispatcherFactory, JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, ILspWorkspaceRegistrationService workspaceRegistrationService, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, IDiagnosticService? diagnosticService, ImmutableArray<string> supportedLanguages, string? clientName, string userVisibleServerName, string telemetryServerTypeName) : base(requestDispatcherFactory, jsonRpc, capabilitiesProvider, workspaceRegistrationService, listenerProvider, logger, supportedLanguages, clientName, userVisibleServerName, telemetryServerTypeName) { _diagnosticService = diagnosticService; // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue<DocumentId>( TimeSpan.FromMilliseconds(250), (ids, ct) => ProcessDiagnosticUpdatedBatchAsync(_diagnosticService, ids, ct), EqualityComparer<DocumentId>.Default, Listener, Queue.CancellationToken); if (_diagnosticService != null) _diagnosticService.DiagnosticsUpdated += DiagnosticService_DiagnosticsUpdated; } public override Task InitializedAsync() { try { Logger?.TraceStart("Initialized"); // Publish diagnostics for all open documents immediately following initialization. PublishOpenFileDiagnostics(); return Task.CompletedTask; } finally { Logger?.TraceStop("Initialized"); } void PublishOpenFileDiagnostics() { foreach (var workspace in WorkspaceRegistrationService.GetAllRegistrations()) { var solution = workspace.CurrentSolution; var openDocuments = workspace.GetOpenDocumentIds(); foreach (var documentId in openDocuments) DiagnosticService_DiagnosticsUpdated(solution, documentId); } } } [JsonRpcMethod(VSInternalMethods.DocumentPullDiagnosticName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalDiagnosticReport[]?> GetDocumentPullDiagnosticsAsync(VSInternalDocumentDiagnosticsParams diagnosticsParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSInternalDocumentDiagnosticsParams, VSInternalDiagnosticReport[]?>( Queue, VSInternalMethods.DocumentPullDiagnosticName, diagnosticsParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(VSInternalMethods.WorkspacePullDiagnosticName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalWorkspaceDiagnosticReport[]?> GetWorkspacePullDiagnosticsAsync(VSInternalWorkspaceDiagnosticsParams diagnosticsParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSInternalWorkspaceDiagnosticsParams, VSInternalWorkspaceDiagnosticReport[]?>( Queue, VSInternalMethods.WorkspacePullDiagnosticName, diagnosticsParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(VSMethods.GetProjectContextsName, UseSingleObjectParameterDeserialization = true)] public Task<VSProjectContextList?> GetProjectContextsAsync(VSGetProjectContextsParams textDocumentWithContextParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSGetProjectContextsParams, VSProjectContextList?>(Queue, VSMethods.GetProjectContextsName, textDocumentWithContextParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(VSInternalMethods.OnAutoInsertName, UseSingleObjectParameterDeserialization = true)] public Task<VSInternalDocumentOnAutoInsertResponseItem?> GetDocumentOnAutoInsertAsync(VSInternalDocumentOnAutoInsertParams autoInsertParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<VSInternalDocumentOnAutoInsertParams, VSInternalDocumentOnAutoInsertResponseItem?>(Queue, VSInternalMethods.OnAutoInsertName, autoInsertParams, _clientCapabilities, ClientName, cancellationToken); } [JsonRpcMethod(Methods.TextDocumentLinkedEditingRangeName, UseSingleObjectParameterDeserialization = true)] public Task<LinkedEditingRanges?> GetLinkedEditingRangesAsync(LinkedEditingRangeParams renameParams, CancellationToken cancellationToken) { Contract.ThrowIfNull(_clientCapabilities, $"{nameof(InitializeAsync)} has not been called."); return RequestDispatcher.ExecuteRequestAsync<LinkedEditingRangeParams, LinkedEditingRanges?>(Queue, Methods.TextDocumentLinkedEditingRangeName, renameParams, _clientCapabilities, ClientName, cancellationToken); } protected override void ShutdownImpl() { base.ShutdownImpl(); if (_diagnosticService != null) _diagnosticService.DiagnosticsUpdated -= DiagnosticService_DiagnosticsUpdated; } private void DiagnosticService_DiagnosticsUpdated(object _, DiagnosticsUpdatedArgs e) => DiagnosticService_DiagnosticsUpdated(e.Solution, e.DocumentId); private void DiagnosticService_DiagnosticsUpdated(Solution? solution, DocumentId? documentId) { // LSP doesn't support diagnostics without a document. So if we get project level diagnostics without a document, ignore them. if (documentId != null && solution != null) { var document = solution.GetDocument(documentId); if (document == null || document.FilePath == null) return; // Only publish document diagnostics for the languages this provider supports. if (document.Project.Language != CodeAnalysis.LanguageNames.CSharp && document.Project.Language != CodeAnalysis.LanguageNames.VisualBasic) return; _diagnosticsWorkQueue.AddWork(document.Id); } } /// <summary> /// Stores the last published LSP diagnostics with the Roslyn document that they came from. /// This is useful in the following scenario. Imagine we have documentA which has contributions to mapped files m1 and m2. /// dA -> m1 /// And m1 has contributions from documentB. /// m1 -> dA, dB /// When we query for diagnostic on dA, we get a subset of the diagnostics on m1 (missing the contributions from dB) /// Since each publish diagnostics notification replaces diagnostics per document, /// we must union the diagnostics contribution from dB and dA to produce all diagnostics for m1 and publish all at once. /// /// This dictionary stores the previously computed diagnostics for the published file so that we can /// union the currently computed diagnostics (e.g. for dA) with previously computed diagnostics (e.g. from dB). /// </summary> private readonly Dictionary<Uri, Dictionary<DocumentId, ImmutableArray<LSP.Diagnostic>>> _publishedFileToDiagnostics = new(); /// <summary> /// Stores the mapping of a document to the uri(s) of diagnostics previously produced for this document. When /// we get empty diagnostics for the document we need to find the uris we previously published for this /// document. Then we can publish the updated diagnostics set for those uris (either empty or the diagnostic /// contributions from other documents). We use a sorted set to ensure consistency in the order in which we /// report URIs. While it's not necessary to publish a document's mapped file diagnostics in a particular /// order, it does make it much easier to write tests and debug issues if we have a consistent ordering. /// </summary> private readonly Dictionary<DocumentId, ImmutableSortedSet<Uri>> _documentsToPublishedUris = new(); /// <summary> /// Basic comparer for Uris used by <see cref="_documentsToPublishedUris"/> when publishing notifications. /// </summary> private static readonly Comparer<Uri> s_uriComparer = Comparer<Uri>.Create((uri1, uri2) => Uri.Compare(uri1, uri2, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase)); // internal for testing purposes internal async ValueTask ProcessDiagnosticUpdatedBatchAsync( IDiagnosticService? diagnosticService, ImmutableArray<DocumentId> documentIds, CancellationToken cancellationToken) { if (diagnosticService == null) return; foreach (var documentId in documentIds) { cancellationToken.ThrowIfCancellationRequested(); var document = WorkspaceRegistrationService.GetAllRegistrations().Select(w => w.CurrentSolution.GetDocument(documentId)).FirstOrDefault(); if (document != null) { // If this is a `pull` client, and `pull` diagnostics is on, then we should not `publish` (push) the // diagnostics here. var diagnosticMode = document.IsRazorDocument() ? InternalDiagnosticsOptions.RazorDiagnosticMode : InternalDiagnosticsOptions.NormalDiagnosticMode; if (document.Project.Solution.Workspace.IsPushDiagnostics(diagnosticMode)) await PublishDiagnosticsAsync(diagnosticService, document, cancellationToken).ConfigureAwait(false); } } } private async Task PublishDiagnosticsAsync(IDiagnosticService diagnosticService, Document document, CancellationToken cancellationToken) { // Retrieve all diagnostics for the current document grouped by their actual file uri. var fileUriToDiagnostics = await GetDiagnosticsAsync(diagnosticService, document, cancellationToken).ConfigureAwait(false); // Get the list of file uris with diagnostics (for the document). // We need to join the uris from current diagnostics with those previously published // so that we clear out any diagnostics in mapped files that are no longer a part // of the current diagnostics set (because the diagnostics were fixed). // Use sorted set to have consistent publish ordering for tests and debugging. var urisForCurrentDocument = _documentsToPublishedUris.GetValueOrDefault(document.Id, ImmutableSortedSet.Create<Uri>(s_uriComparer)).Union(fileUriToDiagnostics.Keys); // Update the mapping for this document to be the uris we're about to publish diagnostics for. _documentsToPublishedUris[document.Id] = urisForCurrentDocument; // Go through each uri and publish the updated set of diagnostics per uri. foreach (var fileUri in urisForCurrentDocument) { // Get the updated diagnostics for a single uri that were contributed by the current document. var diagnostics = fileUriToDiagnostics.GetValueOrDefault(fileUri, ImmutableArray<LSP.Diagnostic>.Empty); if (_publishedFileToDiagnostics.ContainsKey(fileUri)) { // Get all previously published diagnostics for this uri excluding those that were contributed from the current document. // We don't need those since we just computed the updated values above. var diagnosticsFromOtherDocuments = _publishedFileToDiagnostics[fileUri].Where(kvp => kvp.Key != document.Id).SelectMany(kvp => kvp.Value); // Since diagnostics are replaced per uri, we must publish both contributions from this document and any other document // that has diagnostic contributions to this uri, so union the two sets. diagnostics = diagnostics.AddRange(diagnosticsFromOtherDocuments); } await SendDiagnosticsNotificationAsync(fileUri, diagnostics).ConfigureAwait(false); // There are three cases here -> // 1. There are no diagnostics to publish for this fileUri. We no longer need to track the fileUri at all. // 2. There are diagnostics from the current document. Store the diagnostics for the fileUri and document // so they can be published along with contributions to the fileUri from other documents. // 3. There are no diagnostics contributed by this document to the fileUri (could be some from other documents). // We should clear out the diagnostics for this document for the fileUri. if (diagnostics.IsEmpty) { // We published an empty set of diagnostics for this uri. We no longer need to keep track of this mapping // since there will be no previous diagnostics that we need to clear out. _documentsToPublishedUris.MultiRemove(document.Id, fileUri); // There are not any diagnostics to keep track of for this file, so we can stop. _publishedFileToDiagnostics.Remove(fileUri); } else if (fileUriToDiagnostics.ContainsKey(fileUri)) { // We do have diagnostics from the current document - update the published diagnostics map // to contain the new diagnostics contributed by this document for this uri. var documentsToPublishedDiagnostics = _publishedFileToDiagnostics.GetOrAdd(fileUri, (_) => new Dictionary<DocumentId, ImmutableArray<LSP.Diagnostic>>()); documentsToPublishedDiagnostics[document.Id] = fileUriToDiagnostics[fileUri]; } else { // There were diagnostics from other documents, but none from the current document. // If we're tracking the current document, we can stop. IReadOnlyDictionaryExtensions.GetValueOrDefault(_publishedFileToDiagnostics, fileUri)?.Remove(document.Id); _documentsToPublishedUris.MultiRemove(document.Id, fileUri); } } } private async Task SendDiagnosticsNotificationAsync(Uri uri, ImmutableArray<LSP.Diagnostic> diagnostics) { var publishDiagnosticsParams = new PublishDiagnosticParams { Diagnostics = diagnostics.ToArray(), Uri = uri }; await JsonRpc.NotifyWithParameterObjectAsync(Methods.TextDocumentPublishDiagnosticsName, publishDiagnosticsParams).ConfigureAwait(false); } private async Task<Dictionary<Uri, ImmutableArray<LSP.Diagnostic>>> GetDiagnosticsAsync( IDiagnosticService diagnosticService, Document document, CancellationToken cancellationToken) { var option = document.IsRazorDocument() ? InternalDiagnosticsOptions.RazorDiagnosticMode : InternalDiagnosticsOptions.NormalDiagnosticMode; var pushDiagnostics = await diagnosticService.GetPushDiagnosticsAsync(document.Project.Solution.Workspace, document.Project.Id, document.Id, id: null, includeSuppressedDiagnostics: false, option, cancellationToken).ConfigureAwait(false); var diagnostics = pushDiagnostics.WhereAsArray(IncludeDiagnostic); var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); // Retrieve diagnostics for the document. These diagnostics could be for the current document, or they could map // to a different location in a different file. We need to publish the diagnostics for the mapped locations as well. // An example of this is razor imports where the generated C# document maps to many razor documents. // https://docs.microsoft.com/en-us/aspnet/core/mvc/views/layout?view=aspnetcore-3.1#importing-shared-directives // https://docs.microsoft.com/en-us/aspnet/core/blazor/layouts?view=aspnetcore-3.1#centralized-layout-selection // So we get the diagnostics and group them by the actual mapped path so we can publish notifications // for each mapped file's diagnostics. var fileUriToDiagnostics = diagnostics.GroupBy(diagnostic => GetDiagnosticUri(document, diagnostic)).ToDictionary( group => group.Key, group => group.Select(diagnostic => ConvertToLspDiagnostic(diagnostic, text)).ToImmutableArray()); return fileUriToDiagnostics; static Uri GetDiagnosticUri(Document document, DiagnosticData diagnosticData) { Contract.ThrowIfNull(diagnosticData.DataLocation, "Diagnostic data location should not be null here"); // Razor wants to handle all span mapping themselves. So if we are in razor, return the raw doc spans, and // do not map them. var filePath = diagnosticData.DataLocation.MappedFilePath ?? diagnosticData.DataLocation.OriginalFilePath; return ProtocolConversions.GetUriFromFilePath(filePath); } } private LSP.Diagnostic ConvertToLspDiagnostic(DiagnosticData diagnosticData, SourceText text) { Contract.ThrowIfNull(diagnosticData.DataLocation); var diagnostic = new LSP.Diagnostic { Source = TelemetryServerName, Code = diagnosticData.Id, Severity = Convert(diagnosticData.Severity), Range = GetDiagnosticRange(diagnosticData.DataLocation, text), // Only the unnecessary diagnostic tag is currently supported via LSP. Tags = diagnosticData.CustomTags.Contains(WellKnownDiagnosticTags.Unnecessary) ? new DiagnosticTag[] { DiagnosticTag.Unnecessary } : Array.Empty<DiagnosticTag>() }; if (diagnosticData.Message != null) diagnostic.Message = diagnosticData.Message; return diagnostic; } private static LSP.DiagnosticSeverity Convert(CodeAnalysis.DiagnosticSeverity severity) => severity switch { CodeAnalysis.DiagnosticSeverity.Hidden => LSP.DiagnosticSeverity.Hint, CodeAnalysis.DiagnosticSeverity.Info => LSP.DiagnosticSeverity.Hint, CodeAnalysis.DiagnosticSeverity.Warning => LSP.DiagnosticSeverity.Warning, CodeAnalysis.DiagnosticSeverity.Error => LSP.DiagnosticSeverity.Error, _ => throw ExceptionUtilities.UnexpectedValue(severity), }; // Some diagnostics only apply to certain clients and document types, e.g. Razor. // If the DocumentPropertiesService.DiagnosticsLspClientName property exists, we only include the // diagnostic if it directly matches the client name. // If the DocumentPropertiesService.DiagnosticsLspClientName property doesn't exist, // we know that the diagnostic we're working with is contained in a C#/VB file, since // if we were working with a non-C#/VB file, then the property should have been populated. // In this case, unless we have a null client name, we don't want to publish the diagnostic // (since a null client name represents the C#/VB language server). private bool IncludeDiagnostic(DiagnosticData diagnostic) => IReadOnlyDictionaryExtensions.GetValueOrDefault(diagnostic.Properties, nameof(DocumentPropertiesService.DiagnosticsLspClientName)) == ClientName; private static LSP.Range GetDiagnosticRange(DiagnosticDataLocation diagnosticDataLocation, SourceText text) { var linePositionSpan = DiagnosticData.GetLinePositionSpan(diagnosticDataLocation, text, useMapped: true); return ProtocolConversions.LinePositionToRange(linePositionSpan); } internal new TestAccessor GetTestAccessor() => new(this); internal new readonly struct TestAccessor { private readonly VisualStudioInProcLanguageServer _server; internal TestAccessor(VisualStudioInProcLanguageServer server) { _server = server; } internal ImmutableArray<Uri> GetFileUrisInPublishDiagnostics() => _server._publishedFileToDiagnostics.Keys.ToImmutableArray(); internal ImmutableArray<DocumentId> GetDocumentIdsInPublishedUris() => _server._documentsToPublishedUris.Keys.ToImmutableArray(); internal IImmutableSet<Uri> GetFileUrisForDocument(DocumentId documentId) => _server._documentsToPublishedUris.GetValueOrDefault(documentId, ImmutableSortedSet<Uri>.Empty); internal ImmutableArray<LSP.Diagnostic> GetDiagnosticsForUriAndDocument(DocumentId documentId, Uri uri) { if (_server._publishedFileToDiagnostics.TryGetValue(uri, out var dict) && dict.TryGetValue(documentId, out var diagnostics)) return diagnostics; return ImmutableArray<LSP.Diagnostic>.Empty; } } } }
1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeFixes.Suppression; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.UnitTests.Diagnostics; using Roslyn.Utilities; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics { public abstract class AbstractSuppressionDiagnosticTest : AbstractUserDiagnosticTest { protected AbstractSuppressionDiagnosticTest(ITestOutputHelper logger = null) : base(logger) { } protected abstract int CodeActionIndex { get; } protected virtual bool IncludeSuppressedDiagnostics => false; protected virtual bool IncludeUnsuppressedDiagnostics => true; protected virtual bool IncludeNoLocationDiagnostics => true; protected Task TestAsync(string initial, string expected) => TestAsync(initial, expected, parseOptions: null, index: CodeActionIndex); internal abstract Tuple<DiagnosticAnalyzer, IConfigurationFixProvider> CreateDiagnosticProviderAndFixer(Workspace workspace); protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions) { return actions.SelectMany(a => a is AbstractConfigurationActionWithNestedActions ? a.NestedCodeActions : ImmutableArray.Create(a)).ToImmutableArray(); } private ImmutableArray<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> diagnostics) { if (!IncludeNoLocationDiagnostics) { diagnostics = diagnostics.Where(d => d.Location.IsInSource); } if (!IncludeSuppressedDiagnostics) { diagnostics = diagnostics.Where(d => !d.IsSuppressed); } if (!IncludeUnsuppressedDiagnostics) { diagnostics = diagnostics.Where(d => d.IsSuppressed); } return diagnostics.ToImmutableArray(); } internal override async Task<IEnumerable<Diagnostic>> GetDiagnosticsAsync( TestWorkspace workspace, TestParameters parameters) { var (analyzer, _) = CreateDiagnosticProviderAndFixer(workspace); AddAnalyzerToWorkspace(workspace, analyzer, parameters); var document = GetDocumentAndSelectSpan(workspace, out var span); var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, span); return FilterDiagnostics(diagnostics); } internal override async Task<(ImmutableArray<Diagnostic>, ImmutableArray<CodeAction>, CodeAction actionToInvoke)> GetDiagnosticAndFixesAsync( TestWorkspace workspace, TestParameters parameters) { var (analyzer, fixer) = CreateDiagnosticProviderAndFixer(workspace); AddAnalyzerToWorkspace(workspace, analyzer, parameters); string annotation = null; if (!TryGetDocumentAndSelectSpan(workspace, out var document, out var span)) { document = GetDocumentAndAnnotatedSpan(workspace, out annotation, out span); } var testDriver = new TestDiagnosticAnalyzerDriver(workspace, document.Project, includeSuppressedDiagnostics: IncludeSuppressedDiagnostics); var diagnostics = (await testDriver.GetAllDiagnosticsAsync(document, span)) .Where(d => fixer.IsFixableDiagnostic(d)); var filteredDiagnostics = FilterDiagnostics(diagnostics); var wrapperCodeFixer = new WrapperCodeFixProvider(fixer, filteredDiagnostics.Select(d => d.Id)); return await GetDiagnosticAndFixesAsync( filteredDiagnostics, wrapperCodeFixer, testDriver, document, span, annotation, parameters.index); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeFixes.Suppression; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.UnitTests.Diagnostics; using Roslyn.Utilities; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics { public abstract class AbstractSuppressionDiagnosticTest : AbstractUserDiagnosticTest { protected AbstractSuppressionDiagnosticTest(ITestOutputHelper logger = null) : base(logger) { } protected abstract int CodeActionIndex { get; } protected virtual bool IncludeSuppressedDiagnostics => false; protected virtual bool IncludeUnsuppressedDiagnostics => true; protected virtual bool IncludeNoLocationDiagnostics => true; protected Task TestAsync(string initial, string expected) => TestAsync(initial, expected, parseOptions: null, index: CodeActionIndex); internal abstract Tuple<DiagnosticAnalyzer, IConfigurationFixProvider> CreateDiagnosticProviderAndFixer(Workspace workspace); protected override ImmutableArray<CodeAction> MassageActions(ImmutableArray<CodeAction> actions) { return actions.SelectMany(a => a is AbstractConfigurationActionWithNestedActions ? a.NestedCodeActions : ImmutableArray.Create(a)).ToImmutableArray(); } private ImmutableArray<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> diagnostics) { if (!IncludeNoLocationDiagnostics) { diagnostics = diagnostics.Where(d => d.Location.IsInSource); } if (!IncludeSuppressedDiagnostics) { diagnostics = diagnostics.Where(d => !d.IsSuppressed); } if (!IncludeUnsuppressedDiagnostics) { diagnostics = diagnostics.Where(d => d.IsSuppressed); } return diagnostics.ToImmutableArray(); } internal override async Task<IEnumerable<Diagnostic>> GetDiagnosticsAsync( TestWorkspace workspace, TestParameters parameters) { var (analyzer, _) = CreateDiagnosticProviderAndFixer(workspace); AddAnalyzerToWorkspace(workspace, analyzer, parameters); var document = GetDocumentAndSelectSpan(workspace, out var span); var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, span); return FilterDiagnostics(diagnostics); } internal override async Task<(ImmutableArray<Diagnostic>, ImmutableArray<CodeAction>, CodeAction actionToInvoke)> GetDiagnosticAndFixesAsync( TestWorkspace workspace, TestParameters parameters) { var (analyzer, fixer) = CreateDiagnosticProviderAndFixer(workspace); AddAnalyzerToWorkspace(workspace, analyzer, parameters); string annotation = null; if (!TryGetDocumentAndSelectSpan(workspace, out var document, out var span)) { document = GetDocumentAndAnnotatedSpan(workspace, out annotation, out span); } var testDriver = new TestDiagnosticAnalyzerDriver(workspace, document.Project, includeSuppressedDiagnostics: IncludeSuppressedDiagnostics); var diagnostics = (await testDriver.GetAllDiagnosticsAsync(document, span)) .Where(d => fixer.IsFixableDiagnostic(d)); var filteredDiagnostics = FilterDiagnostics(diagnostics); var wrapperCodeFixer = new WrapperCodeFixProvider(fixer, filteredDiagnostics.Select(d => d.Id)); return await GetDiagnosticAndFixesAsync( filteredDiagnostics, wrapperCodeFixer, testDriver, document, span, annotation, parameters.index); } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/VisualStudio/Core/Def/Implementation/Utilities/IVsLanguageDebugInfo.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Runtime.InteropServices; using Microsoft.VisualStudio.TextManager.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Utilities { [ComImport] [Guid("F30A6A07-5340-4C0E-B312-5772558B0E63")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IVsLanguageDebugInfo { [PreserveSig] int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum); [PreserveSig] int ValidateBreakpointLocation( IVsTextBuffer pBuffer, int iLine, int iCol, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct)] TextSpan[] pCodeSpan); [PreserveSig] int GetNameOfLocation(IVsTextBuffer pBuffer, int iLine, int iCol, [MarshalAs(UnmanagedType.BStr)] out string pbstrName, out int piLineOffset); [PreserveSig] int GetLocationOfName( [MarshalAs(UnmanagedType.LPWStr)] string pszName, [MarshalAs(UnmanagedType.BStr)] out string pbstrMkDoc, out TextSpan pspanLocation); [PreserveSig] int ResolveName([MarshalAs(UnmanagedType.LPWStr)] string pszName, uint dwFlags, out IVsEnumDebugName ppNames); [PreserveSig] int GetLanguageID(IVsTextBuffer pBuffer, int iLine, int iCol, out Guid pguidLanguageID); [PreserveSig] int IsMappedLocation(IVsTextBuffer pBuffer, int iLine, int iCol); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Runtime.InteropServices; using Microsoft.VisualStudio.TextManager.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Utilities { [ComImport] [Guid("F30A6A07-5340-4C0E-B312-5772558B0E63")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IVsLanguageDebugInfo { [PreserveSig] int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum); [PreserveSig] int ValidateBreakpointLocation( IVsTextBuffer pBuffer, int iLine, int iCol, [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct)] TextSpan[] pCodeSpan); [PreserveSig] int GetNameOfLocation(IVsTextBuffer pBuffer, int iLine, int iCol, [MarshalAs(UnmanagedType.BStr)] out string pbstrName, out int piLineOffset); [PreserveSig] int GetLocationOfName( [MarshalAs(UnmanagedType.LPWStr)] string pszName, [MarshalAs(UnmanagedType.BStr)] out string pbstrMkDoc, out TextSpan pspanLocation); [PreserveSig] int ResolveName([MarshalAs(UnmanagedType.LPWStr)] string pszName, uint dwFlags, out IVsEnumDebugName ppNames); [PreserveSig] int GetLanguageID(IVsTextBuffer pBuffer, int iLine, int iCol, out Guid pguidLanguageID); [PreserveSig] int IsMappedLocation(IVsTextBuffer pBuffer, int iLine, int iCol); } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/EditorFeatures/Core/SymbolSearch/IAddReferenceDatabaseWrapper.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Elfie.Model; namespace Microsoft.CodeAnalysis.SymbolSearch { // Wrapper types to ensure we delay load the elfie database. internal interface IAddReferenceDatabaseWrapper { AddReferenceDatabase Database { get; } } internal class AddReferenceDatabaseWrapper : IAddReferenceDatabaseWrapper { public AddReferenceDatabase Database { get; } public AddReferenceDatabaseWrapper(AddReferenceDatabase database) => Database = database; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Elfie.Model; namespace Microsoft.CodeAnalysis.SymbolSearch { // Wrapper types to ensure we delay load the elfie database. internal interface IAddReferenceDatabaseWrapper { AddReferenceDatabase Database { get; } } internal class AddReferenceDatabaseWrapper : IAddReferenceDatabaseWrapper { public AddReferenceDatabase Database { get; } public AddReferenceDatabaseWrapper(AddReferenceDatabase database) => Database = database; } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests { public partial class AsyncLazyTests { [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncReturnsCompletedTaskIfAsyncComputationCompletesImmediately() { // Note, this test may pass even if GetValueAsync posted a task to the threadpool, since the // current thread may context switch out and allow the threadpool to complete the task before // we check the state. However, a failure here definitely indicates a bug in AsyncLazy. var lazy = new AsyncLazy<int>(c => Task.FromResult(5), cacheResult: true); var t = lazy.GetValueAsync(CancellationToken.None); Assert.Equal(TaskStatus.RanToCompletion, t.Status); Assert.Equal(5, t.Result); } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void SynchronousContinuationsDoNotRunWithinGetValueCallForCompletedTask() => SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus.RanToCompletion); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void SynchronousContinuationsDoNotRunWithinGetValueCallForCancelledTask() => SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus.Canceled); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void SynchronousContinuationsDoNotRunWithinGetValueCallForFaultedTask() => SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus.Faulted); private static void SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus expectedTaskStatus) { var synchronousComputationStartedEvent = new ManualResetEvent(initialState: false); var synchronousComputationShouldCompleteEvent = new ManualResetEvent(initialState: false); var requestCancellationTokenSource = new CancellationTokenSource(); // First, create an async lazy that will only ever do synchronous computations. var lazy = new AsyncLazy<int>( asynchronousComputeFunction: c => { throw new Exception("We should not get an asynchronous computation."); }, synchronousComputeFunction: c => { // Notify that the synchronous computation started synchronousComputationStartedEvent.Set(); // And now wait when we should finish synchronousComputationShouldCompleteEvent.WaitOne(); c.ThrowIfCancellationRequested(); if (expectedTaskStatus == TaskStatus.Faulted) { // We want to see what happens if this underlying task faults, so let's fault! throw new Exception("Task blew up!"); } return 42; }, cacheResult: false); // Second, start a synchronous request. While we are in the GetValue, we will record which thread is being occupied by the request Thread synchronousRequestThread = null; Task.Factory.StartNew(() => { try { synchronousRequestThread = Thread.CurrentThread; lazy.GetValue(requestCancellationTokenSource.Token); } finally // we do test GetValue in exceptional scenarios, so we should deal with this { synchronousRequestThread = null; } }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Current); // Wait until this request has actually started synchronousComputationStartedEvent.WaitOne(); // Good, we now have a synchronous request running. An async request should simply create a task that would // be completed when the synchronous request completes. We want to assert that if we were to run a continuation // from this task that's marked ExecuteSynchronously, we do not run it inline atop the synchronous request. bool? asyncContinuationRanSynchronously = null; TaskStatus? observedAntecedentTaskStatus = null; var asyncContinuation = lazy.GetValueAsync(requestCancellationTokenSource.Token).ContinueWith(antecedent => { var currentSynchronousRequestThread = synchronousRequestThread; asyncContinuationRanSynchronously = currentSynchronousRequestThread != null && currentSynchronousRequestThread == Thread.CurrentThread; observedAntecedentTaskStatus = antecedent.Status; }, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); // Excellent, the async continuation is scheduled. Let's complete the underlying computation. if (expectedTaskStatus == TaskStatus.Canceled) { requestCancellationTokenSource.Cancel(); } synchronousComputationShouldCompleteEvent.Set(); // And wait for our continuation to run asyncContinuation.Wait(); Assert.False(asyncContinuationRanSynchronously.Value, "The continuation did not run asynchronously."); Assert.Equal(expectedTaskStatus, observedAntecedentTaskStatus.Value); } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueThrowsCorrectExceptionDuringCancellation() => GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValue(ct), includeSynchronousComputation: false); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueThrowsCorrectExceptionDuringCancellationWithSynchronousComputation() => GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValue(ct), includeSynchronousComputation: true); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncThrowsCorrectExceptionDuringCancellation() { // NOTE: since GetValueAsync inlines the call to the async computation, the GetValueAsync call will throw // immediately instead of returning a task that transitions to the cancelled state GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValueAsync(ct), includeSynchronousComputation: false); } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncThrowsCorrectExceptionDuringCancellationWithSynchronousComputation() { // In theory the synchronous computation isn't used during GetValueAsync, but just in case... GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValueAsync(ct), includeSynchronousComputation: true); } private static void GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation(Action<AsyncLazy<object>, CancellationToken> doGetValue, bool includeSynchronousComputation) { // A call to GetValue/GetValueAsync with a token that is cancelled should throw an OperationCancelledException, but it's // important to make sure the correct token is cancelled. It should be cancelled with the token passed // to GetValue, not the cancellation that was thrown by the computation function var computeFunctionRunning = new ManualResetEvent(initialState: false); AsyncLazy<object> lazy; Func<CancellationToken, object> synchronousComputation = null; if (includeSynchronousComputation) { synchronousComputation = c => { computeFunctionRunning.Set(); while (true) { c.ThrowIfCancellationRequested(); } }; } lazy = new AsyncLazy<object>(c => { computeFunctionRunning.Set(); while (true) { c.ThrowIfCancellationRequested(); } }, synchronousComputeFunction: synchronousComputation, cacheResult: false); var cancellationTokenSource = new CancellationTokenSource(); // Create a task that will cancel the request once it's started Task.Run(() => { computeFunctionRunning.WaitOne(); cancellationTokenSource.Cancel(); }); try { doGetValue(lazy, cancellationTokenSource.Token); AssertEx.Fail(nameof(AsyncLazy<object>.GetValue) + " did not throw an exception."); } catch (OperationCanceledException oce) { Assert.Equal(cancellationTokenSource.Token, oce.CancellationToken); } } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncThatIsCancelledReturnsTaskCancelledWithCorrectToken() { var cancellationTokenSource = new CancellationTokenSource(); var lazy = new AsyncLazy<object>(c => Task.Run((Func<object>)(() => { cancellationTokenSource.Cancel(); while (true) { c.ThrowIfCancellationRequested(); } }), c), cacheResult: true); var task = lazy.GetValueAsync(cancellationTokenSource.Token); // Now wait until the task completes try { task.Wait(); AssertEx.Fail(nameof(AsyncLazy<object>.GetValueAsync) + " did not throw an exception."); } catch (AggregateException ex) { var operationCancelledException = (OperationCanceledException)ex.Flatten().InnerException; Assert.Equal(cancellationTokenSource.Token, operationCancelledException.CancellationToken); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests { public partial class AsyncLazyTests { [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncReturnsCompletedTaskIfAsyncComputationCompletesImmediately() { // Note, this test may pass even if GetValueAsync posted a task to the threadpool, since the // current thread may context switch out and allow the threadpool to complete the task before // we check the state. However, a failure here definitely indicates a bug in AsyncLazy. var lazy = new AsyncLazy<int>(c => Task.FromResult(5), cacheResult: true); var t = lazy.GetValueAsync(CancellationToken.None); Assert.Equal(TaskStatus.RanToCompletion, t.Status); Assert.Equal(5, t.Result); } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void SynchronousContinuationsDoNotRunWithinGetValueCallForCompletedTask() => SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus.RanToCompletion); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void SynchronousContinuationsDoNotRunWithinGetValueCallForCancelledTask() => SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus.Canceled); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void SynchronousContinuationsDoNotRunWithinGetValueCallForFaultedTask() => SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus.Faulted); private static void SynchronousContinuationsDoNotRunWithinGetValueCallCore(TaskStatus expectedTaskStatus) { var synchronousComputationStartedEvent = new ManualResetEvent(initialState: false); var synchronousComputationShouldCompleteEvent = new ManualResetEvent(initialState: false); var requestCancellationTokenSource = new CancellationTokenSource(); // First, create an async lazy that will only ever do synchronous computations. var lazy = new AsyncLazy<int>( asynchronousComputeFunction: c => { throw new Exception("We should not get an asynchronous computation."); }, synchronousComputeFunction: c => { // Notify that the synchronous computation started synchronousComputationStartedEvent.Set(); // And now wait when we should finish synchronousComputationShouldCompleteEvent.WaitOne(); c.ThrowIfCancellationRequested(); if (expectedTaskStatus == TaskStatus.Faulted) { // We want to see what happens if this underlying task faults, so let's fault! throw new Exception("Task blew up!"); } return 42; }, cacheResult: false); // Second, start a synchronous request. While we are in the GetValue, we will record which thread is being occupied by the request Thread synchronousRequestThread = null; Task.Factory.StartNew(() => { try { synchronousRequestThread = Thread.CurrentThread; lazy.GetValue(requestCancellationTokenSource.Token); } finally // we do test GetValue in exceptional scenarios, so we should deal with this { synchronousRequestThread = null; } }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Current); // Wait until this request has actually started synchronousComputationStartedEvent.WaitOne(); // Good, we now have a synchronous request running. An async request should simply create a task that would // be completed when the synchronous request completes. We want to assert that if we were to run a continuation // from this task that's marked ExecuteSynchronously, we do not run it inline atop the synchronous request. bool? asyncContinuationRanSynchronously = null; TaskStatus? observedAntecedentTaskStatus = null; var asyncContinuation = lazy.GetValueAsync(requestCancellationTokenSource.Token).ContinueWith(antecedent => { var currentSynchronousRequestThread = synchronousRequestThread; asyncContinuationRanSynchronously = currentSynchronousRequestThread != null && currentSynchronousRequestThread == Thread.CurrentThread; observedAntecedentTaskStatus = antecedent.Status; }, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); // Excellent, the async continuation is scheduled. Let's complete the underlying computation. if (expectedTaskStatus == TaskStatus.Canceled) { requestCancellationTokenSource.Cancel(); } synchronousComputationShouldCompleteEvent.Set(); // And wait for our continuation to run asyncContinuation.Wait(); Assert.False(asyncContinuationRanSynchronously.Value, "The continuation did not run asynchronously."); Assert.Equal(expectedTaskStatus, observedAntecedentTaskStatus.Value); } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueThrowsCorrectExceptionDuringCancellation() => GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValue(ct), includeSynchronousComputation: false); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueThrowsCorrectExceptionDuringCancellationWithSynchronousComputation() => GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValue(ct), includeSynchronousComputation: true); [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncThrowsCorrectExceptionDuringCancellation() { // NOTE: since GetValueAsync inlines the call to the async computation, the GetValueAsync call will throw // immediately instead of returning a task that transitions to the cancelled state GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValueAsync(ct), includeSynchronousComputation: false); } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncThrowsCorrectExceptionDuringCancellationWithSynchronousComputation() { // In theory the synchronous computation isn't used during GetValueAsync, but just in case... GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation((lazy, ct) => lazy.GetValueAsync(ct), includeSynchronousComputation: true); } private static void GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellation(Action<AsyncLazy<object>, CancellationToken> doGetValue, bool includeSynchronousComputation) { // A call to GetValue/GetValueAsync with a token that is cancelled should throw an OperationCancelledException, but it's // important to make sure the correct token is cancelled. It should be cancelled with the token passed // to GetValue, not the cancellation that was thrown by the computation function var computeFunctionRunning = new ManualResetEvent(initialState: false); AsyncLazy<object> lazy; Func<CancellationToken, object> synchronousComputation = null; if (includeSynchronousComputation) { synchronousComputation = c => { computeFunctionRunning.Set(); while (true) { c.ThrowIfCancellationRequested(); } }; } lazy = new AsyncLazy<object>(c => { computeFunctionRunning.Set(); while (true) { c.ThrowIfCancellationRequested(); } }, synchronousComputeFunction: synchronousComputation, cacheResult: false); var cancellationTokenSource = new CancellationTokenSource(); // Create a task that will cancel the request once it's started Task.Run(() => { computeFunctionRunning.WaitOne(); cancellationTokenSource.Cancel(); }); try { doGetValue(lazy, cancellationTokenSource.Token); AssertEx.Fail(nameof(AsyncLazy<object>.GetValue) + " did not throw an exception."); } catch (OperationCanceledException oce) { Assert.Equal(cancellationTokenSource.Token, oce.CancellationToken); } } [Fact] [Trait(Traits.Feature, Traits.Features.AsyncLazy)] public void GetValueAsyncThatIsCancelledReturnsTaskCancelledWithCorrectToken() { var cancellationTokenSource = new CancellationTokenSource(); var lazy = new AsyncLazy<object>(c => Task.Run((Func<object>)(() => { cancellationTokenSource.Cancel(); while (true) { c.ThrowIfCancellationRequested(); } }), c), cacheResult: true); var task = lazy.GetValueAsync(cancellationTokenSource.Token); // Now wait until the task completes try { task.Wait(); AssertEx.Fail(nameof(AsyncLazy<object>.GetValueAsync) + " did not throw an exception."); } catch (AggregateException ex) { var operationCancelledException = (OperationCanceledException)ex.Flatten().InnerException; Assert.Equal(cancellationTokenSource.Token, operationCancelledException.CancellationToken); } } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Features/CSharp/Portable/Completion/KeywordRecommenders/IfKeywordRecommender.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class IfKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public IfKeywordRecommender() : base(SyntaxKind.IfKeyword, isValidInPreprocessorContext: true) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.IsPreProcessorKeywordContext || context.IsStatementContext || context.IsGlobalStatementContext; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class IfKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public IfKeywordRecommender() : base(SyntaxKind.IfKeyword, isValidInPreprocessorContext: true) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.IsPreProcessorKeywordContext || context.IsStatementContext || context.IsGlobalStatementContext; } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedInteractiveInitializerMethod.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Roslyn.Utilities; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Reflection; using System.Linq; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal sealed class SynthesizedInteractiveInitializerMethod : SynthesizedInstanceMethodSymbol { internal const string InitializerName = "<Initialize>"; private readonly SourceMemberContainerTypeSymbol _containingType; private readonly TypeSymbol _resultType; private readonly TypeSymbol _returnType; private ThreeState _lazyIsNullableAnalysisEnabled; internal SynthesizedInteractiveInitializerMethod(SourceMemberContainerTypeSymbol containingType, BindingDiagnosticBag diagnostics) { Debug.Assert(containingType.IsScriptClass); _containingType = containingType; CalculateReturnType(containingType, diagnostics, out _resultType, out _returnType); } public override string Name { get { return InitializerName; } } internal override bool IsScriptInitializer { get { return true; } } public override int Arity { get { return this.TypeParameters.Length; } } public override Symbol AssociatedSymbol { get { return null; } } public override Symbol ContainingSymbol { get { return _containingType; } } public override Accessibility DeclaredAccessibility { get { return Accessibility.Friend; } } public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations { get { return ImmutableArray<MethodSymbol>.Empty; } } public override bool HidesBaseMethodsByName { get { return false; } } public override bool IsAbstract { get { return false; } } public override bool IsAsync { get { return true; } } public override bool IsExtensionMethod { get { return false; } } public override bool IsExtern { get { return false; } } public override bool IsOverride { get { return false; } } public override bool IsSealed { get { return false; } } public override bool IsStatic { get { return false; } } public override bool IsVararg { get { return false; } } public override RefKind RefKind { get { return RefKind.None; } } public override bool IsVirtual { get { return false; } } public override ImmutableArray<Location> Locations { get { return _containingType.Locations; } } public override MethodKind MethodKind { get { return MethodKind.Ordinary; } } public override ImmutableArray<ParameterSymbol> Parameters { get { return ImmutableArray<ParameterSymbol>.Empty; } } public override bool ReturnsVoid { get { return _returnType.IsVoidType(); } } public override TypeWithAnnotations ReturnTypeWithAnnotations { get { return TypeWithAnnotations.Create(_returnType); } } public override FlowAnalysisAnnotations ReturnTypeFlowAnalysisAnnotations => FlowAnalysisAnnotations.None; public override ImmutableHashSet<string> ReturnNotNullIfParameterNotNull => ImmutableHashSet<string>.Empty; public override ImmutableArray<CustomModifier> RefCustomModifiers { get { return ImmutableArray<CustomModifier>.Empty; } } public override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotations { get { return ImmutableArray<TypeWithAnnotations>.Empty; } } public override ImmutableArray<TypeParameterSymbol> TypeParameters { get { return ImmutableArray<TypeParameterSymbol>.Empty; } } internal override Cci.CallingConvention CallingConvention { get { Debug.Assert(!this.IsStatic); Debug.Assert(!this.IsGenericMethod); return Cci.CallingConvention.HasThis; } } internal override bool GenerateDebugInfo { get { return true; } } internal override bool HasDeclarativeSecurity { get { return false; } } internal override bool HasSpecialName { get { return true; } } internal override MethodImplAttributes ImplementationAttributes { get { return default(MethodImplAttributes); } } internal override bool RequiresSecurityObject { get { return false; } } internal override MarshalPseudoCustomAttributeData ReturnValueMarshallingInformation { get { return null; } } public override DllImportData GetDllImportData() { return null; } internal override ImmutableArray<string> GetAppliedConditionalSymbols() { return ImmutableArray<string>.Empty; } internal override IEnumerable<Cci.SecurityAttribute> GetSecurityInformation() { throw ExceptionUtilities.Unreachable; } internal override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false) { return false; } internal override bool IsMetadataVirtual(bool ignoreInterfaceImplementationChanges = false) { return false; } internal override int CalculateLocalSyntaxOffset(int localPosition, SyntaxTree localTree) { return _containingType.CalculateSyntaxOffsetInSynthesizedConstructor(localPosition, localTree, isStatic: false); } internal TypeSymbol ResultType { get { return _resultType; } } internal override bool IsNullableAnalysisEnabled() { if (_lazyIsNullableAnalysisEnabled == ThreeState.Unknown) { // Return true if nullable is not disabled in compilation options or if enabled // in any syntax tree. This could be refined to ignore top-level methods and // type declarations but this simple approach matches C#8 behavior. var compilation = DeclaringCompilation; bool value = (compilation.Options.NullableContextOptions != NullableContextOptions.Disable) || compilation.SyntaxTrees.Any(tree => ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled(new TextSpan(0, tree.Length)) == true); _lazyIsNullableAnalysisEnabled = value.ToThreeState(); } return _lazyIsNullableAnalysisEnabled == ThreeState.True; } private static void CalculateReturnType( SourceMemberContainerTypeSymbol containingType, BindingDiagnosticBag diagnostics, out TypeSymbol resultType, out TypeSymbol returnType) { CSharpCompilation compilation = containingType.DeclaringCompilation; var submissionReturnTypeOpt = compilation.ScriptCompilationInfo?.ReturnTypeOpt; var taskT = compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T); diagnostics.ReportUseSite(taskT, NoLocation.Singleton); // If no explicit return type is set on ScriptCompilationInfo, default to // System.Object from the target corlib. This allows cross compiling scripts // to run on a target corlib that may differ from the host compiler's corlib. // cf. https://github.com/dotnet/roslyn/issues/8506 resultType = (object)submissionReturnTypeOpt == null ? compilation.GetSpecialType(SpecialType.System_Object) : compilation.GetTypeByReflectionType(submissionReturnTypeOpt, diagnostics); returnType = taskT.Construct(resultType); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Roslyn.Utilities; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Reflection; using System.Linq; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal sealed class SynthesizedInteractiveInitializerMethod : SynthesizedInstanceMethodSymbol { internal const string InitializerName = "<Initialize>"; private readonly SourceMemberContainerTypeSymbol _containingType; private readonly TypeSymbol _resultType; private readonly TypeSymbol _returnType; private ThreeState _lazyIsNullableAnalysisEnabled; internal SynthesizedInteractiveInitializerMethod(SourceMemberContainerTypeSymbol containingType, BindingDiagnosticBag diagnostics) { Debug.Assert(containingType.IsScriptClass); _containingType = containingType; CalculateReturnType(containingType, diagnostics, out _resultType, out _returnType); } public override string Name { get { return InitializerName; } } internal override bool IsScriptInitializer { get { return true; } } public override int Arity { get { return this.TypeParameters.Length; } } public override Symbol AssociatedSymbol { get { return null; } } public override Symbol ContainingSymbol { get { return _containingType; } } public override Accessibility DeclaredAccessibility { get { return Accessibility.Friend; } } public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations { get { return ImmutableArray<MethodSymbol>.Empty; } } public override bool HidesBaseMethodsByName { get { return false; } } public override bool IsAbstract { get { return false; } } public override bool IsAsync { get { return true; } } public override bool IsExtensionMethod { get { return false; } } public override bool IsExtern { get { return false; } } public override bool IsOverride { get { return false; } } public override bool IsSealed { get { return false; } } public override bool IsStatic { get { return false; } } public override bool IsVararg { get { return false; } } public override RefKind RefKind { get { return RefKind.None; } } public override bool IsVirtual { get { return false; } } public override ImmutableArray<Location> Locations { get { return _containingType.Locations; } } public override MethodKind MethodKind { get { return MethodKind.Ordinary; } } public override ImmutableArray<ParameterSymbol> Parameters { get { return ImmutableArray<ParameterSymbol>.Empty; } } public override bool ReturnsVoid { get { return _returnType.IsVoidType(); } } public override TypeWithAnnotations ReturnTypeWithAnnotations { get { return TypeWithAnnotations.Create(_returnType); } } public override FlowAnalysisAnnotations ReturnTypeFlowAnalysisAnnotations => FlowAnalysisAnnotations.None; public override ImmutableHashSet<string> ReturnNotNullIfParameterNotNull => ImmutableHashSet<string>.Empty; public override ImmutableArray<CustomModifier> RefCustomModifiers { get { return ImmutableArray<CustomModifier>.Empty; } } public override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotations { get { return ImmutableArray<TypeWithAnnotations>.Empty; } } public override ImmutableArray<TypeParameterSymbol> TypeParameters { get { return ImmutableArray<TypeParameterSymbol>.Empty; } } internal override Cci.CallingConvention CallingConvention { get { Debug.Assert(!this.IsStatic); Debug.Assert(!this.IsGenericMethod); return Cci.CallingConvention.HasThis; } } internal override bool GenerateDebugInfo { get { return true; } } internal override bool HasDeclarativeSecurity { get { return false; } } internal override bool HasSpecialName { get { return true; } } internal override MethodImplAttributes ImplementationAttributes { get { return default(MethodImplAttributes); } } internal override bool RequiresSecurityObject { get { return false; } } internal override MarshalPseudoCustomAttributeData ReturnValueMarshallingInformation { get { return null; } } public override DllImportData GetDllImportData() { return null; } internal override ImmutableArray<string> GetAppliedConditionalSymbols() { return ImmutableArray<string>.Empty; } internal override IEnumerable<Cci.SecurityAttribute> GetSecurityInformation() { throw ExceptionUtilities.Unreachable; } internal override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false) { return false; } internal override bool IsMetadataVirtual(bool ignoreInterfaceImplementationChanges = false) { return false; } internal override int CalculateLocalSyntaxOffset(int localPosition, SyntaxTree localTree) { return _containingType.CalculateSyntaxOffsetInSynthesizedConstructor(localPosition, localTree, isStatic: false); } internal TypeSymbol ResultType { get { return _resultType; } } internal override bool IsNullableAnalysisEnabled() { if (_lazyIsNullableAnalysisEnabled == ThreeState.Unknown) { // Return true if nullable is not disabled in compilation options or if enabled // in any syntax tree. This could be refined to ignore top-level methods and // type declarations but this simple approach matches C#8 behavior. var compilation = DeclaringCompilation; bool value = (compilation.Options.NullableContextOptions != NullableContextOptions.Disable) || compilation.SyntaxTrees.Any(tree => ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled(new TextSpan(0, tree.Length)) == true); _lazyIsNullableAnalysisEnabled = value.ToThreeState(); } return _lazyIsNullableAnalysisEnabled == ThreeState.True; } private static void CalculateReturnType( SourceMemberContainerTypeSymbol containingType, BindingDiagnosticBag diagnostics, out TypeSymbol resultType, out TypeSymbol returnType) { CSharpCompilation compilation = containingType.DeclaringCompilation; var submissionReturnTypeOpt = compilation.ScriptCompilationInfo?.ReturnTypeOpt; var taskT = compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T); diagnostics.ReportUseSite(taskT, NoLocation.Singleton); // If no explicit return type is set on ScriptCompilationInfo, default to // System.Object from the target corlib. This allows cross compiling scripts // to run on a target corlib that may differ from the host compiler's corlib. // cf. https://github.com/dotnet/roslyn/issues/8506 resultType = (object)submissionReturnTypeOpt == null ? compilation.GetSpecialType(SpecialType.System_Object) : compilation.GetTypeByReflectionType(submissionReturnTypeOpt, diagnostics); returnType = taskT.Construct(resultType); } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Compilers/CSharp/Portable/Emitter/Model/FunctionPointerTypeSymbolAdapter.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Collections.Immutable; using System.Reflection.Metadata; using System.Threading; using Microsoft.Cci; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Symbols; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal sealed partial class #if DEBUG FunctionPointerTypeSymbolAdapter : SymbolAdapter, #else FunctionPointerTypeSymbol : #endif IFunctionPointerTypeReference { private FunctionPointerMethodSignature? _lazySignature; ISignature IFunctionPointerTypeReference.Signature { get { if (_lazySignature is null) { Interlocked.CompareExchange(ref _lazySignature, new FunctionPointerMethodSignature(AdaptedFunctionPointerTypeSymbol.Signature), null); } return _lazySignature; } } void IReference.Dispatch(MetadataVisitor visitor) => visitor.Visit((IFunctionPointerTypeReference)this); bool ITypeReference.IsEnum => false; Cci.PrimitiveTypeCode ITypeReference.TypeCode => Cci.PrimitiveTypeCode.FunctionPointer; TypeDefinitionHandle ITypeReference.TypeDef => default; IGenericMethodParameterReference? ITypeReference.AsGenericMethodParameterReference => null; IGenericTypeInstanceReference? ITypeReference.AsGenericTypeInstanceReference => null; IGenericTypeParameterReference? ITypeReference.AsGenericTypeParameterReference => null; INamespaceTypeReference? ITypeReference.AsNamespaceTypeReference => null; INestedTypeReference? ITypeReference.AsNestedTypeReference => null; ISpecializedNestedTypeReference? ITypeReference.AsSpecializedNestedTypeReference => null; INamespaceTypeDefinition? ITypeReference.AsNamespaceTypeDefinition(EmitContext context) => null; INestedTypeDefinition? ITypeReference.AsNestedTypeDefinition(EmitContext context) => null; ITypeDefinition? ITypeReference.AsTypeDefinition(EmitContext context) => null; ITypeDefinition? ITypeReference.GetResolvedType(EmitContext context) => null; bool ITypeReference.IsValueType => AdaptedFunctionPointerTypeSymbol.IsValueType; IEnumerable<ICustomAttribute> IReference.GetAttributes(EmitContext context) => SpecializedCollections.EmptyEnumerable<ICustomAttribute>(); IDefinition? IReference.AsDefinition(EmitContext context) => null; /// <summary> /// We need to be able to differentiate between a FunctionPointer used as a type and a function pointer used /// as a StandaloneMethodSig. To do this, we wrap the <see cref="FunctionPointerMethodSymbol"/> in a /// <see cref="FunctionPointerMethodSignature"/>, to hide its implementation of <see cref="IMethodSymbol"/>. /// </summary> private sealed class FunctionPointerMethodSignature : ISignature { private readonly FunctionPointerMethodSymbol _underlying; internal ISignature Underlying => _underlying.GetCciAdapter(); internal FunctionPointerMethodSignature(FunctionPointerMethodSymbol underlying) { _underlying = underlying; } public CallingConvention CallingConvention => Underlying.CallingConvention; public ushort ParameterCount => Underlying.ParameterCount; public ImmutableArray<ICustomModifier> ReturnValueCustomModifiers => Underlying.ReturnValueCustomModifiers; public ImmutableArray<ICustomModifier> RefCustomModifiers => Underlying.RefCustomModifiers; public bool ReturnValueIsByRef => Underlying.ReturnValueIsByRef; public ImmutableArray<IParameterTypeInformation> GetParameters(EmitContext context) => Underlying.GetParameters(context); public ITypeReference GetType(EmitContext context) => Underlying.GetType(context); public override bool Equals(object? obj) { // It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used. throw ExceptionUtilities.Unreachable; } // It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used. public override int GetHashCode() => throw ExceptionUtilities.Unreachable; public override string ToString() => _underlying.ToDisplayString(SymbolDisplayFormat.ILVisualizationFormat); } } internal partial class FunctionPointerTypeSymbol { #if DEBUG private FunctionPointerTypeSymbolAdapter? _lazyAdapter; protected sealed override SymbolAdapter GetCciAdapterImpl() => GetCciAdapter(); internal new FunctionPointerTypeSymbolAdapter GetCciAdapter() { if (_lazyAdapter is null) { return InterlockedOperations.Initialize(ref _lazyAdapter, new FunctionPointerTypeSymbolAdapter(this)); } return _lazyAdapter; } #else internal FunctionPointerTypeSymbol AdaptedFunctionPointerTypeSymbol => this; internal new FunctionPointerTypeSymbol GetCciAdapter() { return this; } #endif } #if DEBUG internal partial class FunctionPointerTypeSymbolAdapter { internal FunctionPointerTypeSymbolAdapter(FunctionPointerTypeSymbol underlyingFunctionPointerTypeSymbol) { AdaptedFunctionPointerTypeSymbol = underlyingFunctionPointerTypeSymbol; } internal sealed override Symbol AdaptedSymbol => AdaptedFunctionPointerTypeSymbol; internal FunctionPointerTypeSymbol AdaptedFunctionPointerTypeSymbol { get; } } #endif }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Collections.Immutable; using System.Reflection.Metadata; using System.Threading; using Microsoft.Cci; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Symbols; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal sealed partial class #if DEBUG FunctionPointerTypeSymbolAdapter : SymbolAdapter, #else FunctionPointerTypeSymbol : #endif IFunctionPointerTypeReference { private FunctionPointerMethodSignature? _lazySignature; ISignature IFunctionPointerTypeReference.Signature { get { if (_lazySignature is null) { Interlocked.CompareExchange(ref _lazySignature, new FunctionPointerMethodSignature(AdaptedFunctionPointerTypeSymbol.Signature), null); } return _lazySignature; } } void IReference.Dispatch(MetadataVisitor visitor) => visitor.Visit((IFunctionPointerTypeReference)this); bool ITypeReference.IsEnum => false; Cci.PrimitiveTypeCode ITypeReference.TypeCode => Cci.PrimitiveTypeCode.FunctionPointer; TypeDefinitionHandle ITypeReference.TypeDef => default; IGenericMethodParameterReference? ITypeReference.AsGenericMethodParameterReference => null; IGenericTypeInstanceReference? ITypeReference.AsGenericTypeInstanceReference => null; IGenericTypeParameterReference? ITypeReference.AsGenericTypeParameterReference => null; INamespaceTypeReference? ITypeReference.AsNamespaceTypeReference => null; INestedTypeReference? ITypeReference.AsNestedTypeReference => null; ISpecializedNestedTypeReference? ITypeReference.AsSpecializedNestedTypeReference => null; INamespaceTypeDefinition? ITypeReference.AsNamespaceTypeDefinition(EmitContext context) => null; INestedTypeDefinition? ITypeReference.AsNestedTypeDefinition(EmitContext context) => null; ITypeDefinition? ITypeReference.AsTypeDefinition(EmitContext context) => null; ITypeDefinition? ITypeReference.GetResolvedType(EmitContext context) => null; bool ITypeReference.IsValueType => AdaptedFunctionPointerTypeSymbol.IsValueType; IEnumerable<ICustomAttribute> IReference.GetAttributes(EmitContext context) => SpecializedCollections.EmptyEnumerable<ICustomAttribute>(); IDefinition? IReference.AsDefinition(EmitContext context) => null; /// <summary> /// We need to be able to differentiate between a FunctionPointer used as a type and a function pointer used /// as a StandaloneMethodSig. To do this, we wrap the <see cref="FunctionPointerMethodSymbol"/> in a /// <see cref="FunctionPointerMethodSignature"/>, to hide its implementation of <see cref="IMethodSymbol"/>. /// </summary> private sealed class FunctionPointerMethodSignature : ISignature { private readonly FunctionPointerMethodSymbol _underlying; internal ISignature Underlying => _underlying.GetCciAdapter(); internal FunctionPointerMethodSignature(FunctionPointerMethodSymbol underlying) { _underlying = underlying; } public CallingConvention CallingConvention => Underlying.CallingConvention; public ushort ParameterCount => Underlying.ParameterCount; public ImmutableArray<ICustomModifier> ReturnValueCustomModifiers => Underlying.ReturnValueCustomModifiers; public ImmutableArray<ICustomModifier> RefCustomModifiers => Underlying.RefCustomModifiers; public bool ReturnValueIsByRef => Underlying.ReturnValueIsByRef; public ImmutableArray<IParameterTypeInformation> GetParameters(EmitContext context) => Underlying.GetParameters(context); public ITypeReference GetType(EmitContext context) => Underlying.GetType(context); public override bool Equals(object? obj) { // It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used. throw ExceptionUtilities.Unreachable; } // It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used. public override int GetHashCode() => throw ExceptionUtilities.Unreachable; public override string ToString() => _underlying.ToDisplayString(SymbolDisplayFormat.ILVisualizationFormat); } } internal partial class FunctionPointerTypeSymbol { #if DEBUG private FunctionPointerTypeSymbolAdapter? _lazyAdapter; protected sealed override SymbolAdapter GetCciAdapterImpl() => GetCciAdapter(); internal new FunctionPointerTypeSymbolAdapter GetCciAdapter() { if (_lazyAdapter is null) { return InterlockedOperations.Initialize(ref _lazyAdapter, new FunctionPointerTypeSymbolAdapter(this)); } return _lazyAdapter; } #else internal FunctionPointerTypeSymbol AdaptedFunctionPointerTypeSymbol => this; internal new FunctionPointerTypeSymbol GetCciAdapter() { return this; } #endif } #if DEBUG internal partial class FunctionPointerTypeSymbolAdapter { internal FunctionPointerTypeSymbolAdapter(FunctionPointerTypeSymbol underlyingFunctionPointerTypeSymbol) { AdaptedFunctionPointerTypeSymbol = underlyingFunctionPointerTypeSymbol; } internal sealed override Symbol AdaptedSymbol => AdaptedFunctionPointerTypeSymbol; internal FunctionPointerTypeSymbol AdaptedFunctionPointerTypeSymbol { get; } } #endif }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Compilers/CSharp/Test/Symbol/Symbols/CorLibrary/Choosing.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols.CorLibrary { public class Choosing : CSharpTestBase { [Fact] public void MultipleMscorlibReferencesInMetadata() { var assemblies = MetadataTestHelpers.GetSymbolsForReferences(new[] { TestReferences.SymbolsTests.CorLibrary.GuidTest2.exe, TestMetadata.Net40.mscorlib }); Assert.Same(assemblies[1], assemblies[0].Modules[0].CorLibrary()); } [Fact, WorkItem(760148, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760148")] public void Bug760148_1() { var corLib = CreateEmptyCompilation(@" namespace System { public class Object { } } ", options: TestOptions.ReleaseDll); var obj = corLib.GetSpecialType(SpecialType.System_Object); Assert.False(obj.IsErrorType()); Assert.Same(corLib.Assembly, obj.ContainingAssembly); var consumer = CreateEmptyCompilation(@" public class Test { } ", new[] { new CSharpCompilationReference(corLib) }, options: TestOptions.ReleaseDll); Assert.Same(obj, consumer.GetSpecialType(SpecialType.System_Object)); } [Fact, WorkItem(760148, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760148")] public void Bug760148_2() { var corLib = CreateEmptyCompilation(@" namespace System { class Object { } } ", options: TestOptions.ReleaseDll); var consumer = CreateEmptyCompilation(@" public class Test { } ", new[] { new CSharpCompilationReference(corLib) }, options: TestOptions.ReleaseDll); Assert.True(consumer.GetSpecialType(SpecialType.System_Object).IsErrorType()); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols.CorLibrary { public class Choosing : CSharpTestBase { [Fact] public void MultipleMscorlibReferencesInMetadata() { var assemblies = MetadataTestHelpers.GetSymbolsForReferences(new[] { TestReferences.SymbolsTests.CorLibrary.GuidTest2.exe, TestMetadata.Net40.mscorlib }); Assert.Same(assemblies[1], assemblies[0].Modules[0].CorLibrary()); } [Fact, WorkItem(760148, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760148")] public void Bug760148_1() { var corLib = CreateEmptyCompilation(@" namespace System { public class Object { } } ", options: TestOptions.ReleaseDll); var obj = corLib.GetSpecialType(SpecialType.System_Object); Assert.False(obj.IsErrorType()); Assert.Same(corLib.Assembly, obj.ContainingAssembly); var consumer = CreateEmptyCompilation(@" public class Test { } ", new[] { new CSharpCompilationReference(corLib) }, options: TestOptions.ReleaseDll); Assert.Same(obj, consumer.GetSpecialType(SpecialType.System_Object)); } [Fact, WorkItem(760148, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760148")] public void Bug760148_2() { var corLib = CreateEmptyCompilation(@" namespace System { class Object { } } ", options: TestOptions.ReleaseDll); var consumer = CreateEmptyCompilation(@" public class Test { } ", new[] { new CSharpCompilationReference(corLib) }, options: TestOptions.ReleaseDll); Assert.True(consumer.GetSpecialType(SpecialType.System_Object).IsErrorType()); } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/EditorFeatures/Core.Cocoa/Preview/ICocoaDifferenceViewerExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Differencing; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Projection; using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Preview { internal static class ICocoaDifferenceViewerExtensions { private class SizeToFitHelper : ForegroundThreadAffinitizedObject { private readonly ICocoaDifferenceViewer _diffViewer; private readonly double _minWidth; private double _width; private double _height; public SizeToFitHelper(IThreadingContext threadingContext, ICocoaDifferenceViewer diffViewer, double minWidth) : base(threadingContext) { _diffViewer = diffViewer; _minWidth = minWidth; } public async Task SizeToFitAsync(CancellationToken cancellationToken) { await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); #pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task (containing method uses JTF) await CalculateSizeAsync(cancellationToken); #pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task // We have the height and width required to display the inline diff snapshot now. // Set the height and width of the ICocoaDifferenceViewer accordingly. _diffViewer.VisualElement.SetFrameSize(new CoreGraphics.CGSize(_width, _height)); _diffViewer.VisualElement.Subviews[0].SetFrameSize(new CoreGraphics.CGSize(_width, _height)); } private async Task<IProjectionSnapshot> GetInlineBufferSnapshotAsync(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); if (_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot is { } snapshot) { return snapshot; } var completionSource = new TaskCompletionSource<IProjectionSnapshot>(TaskCreationOptions.RunContinuationsAsynchronously); _diffViewer.DifferenceBuffer.SnapshotDifferenceChanged += HandleSnapshotDifferenceChanged; // Handle cases where the snapshot was set between the previous check and the event registration if (_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot is { } snapshot2) completionSource.SetResult(snapshot2); try { return await completionSource.Task.WithCancellation(cancellationToken).ConfigureAwaitRunInline(); } finally { _diffViewer.DifferenceBuffer.SnapshotDifferenceChanged -= HandleSnapshotDifferenceChanged; } // Local function void HandleSnapshotDifferenceChanged(object sender, SnapshotDifferenceChangeEventArgs e) { // This event handler will only be called when the inline diff snapshot computation is complete. Contract.ThrowIfNull(_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot); completionSource.SetResult(_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot); } } private async Task CalculateSizeAsync(CancellationToken cancellationToken) { await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); ICocoaTextView textView; ITextSnapshot snapshot; if (_diffViewer.ViewMode == DifferenceViewMode.RightViewOnly) { textView = _diffViewer.RightView; snapshot = _diffViewer.DifferenceBuffer.RightBuffer.CurrentSnapshot; } else if (_diffViewer.ViewMode == DifferenceViewMode.LeftViewOnly) { textView = _diffViewer.LeftView; snapshot = _diffViewer.DifferenceBuffer.LeftBuffer.CurrentSnapshot; } else { textView = _diffViewer.InlineView; #pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task (containing method uses JTF) snapshot = await GetInlineBufferSnapshotAsync(cancellationToken); #pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task } // Perform a layout without actually rendering the content on the screen so that // we can calculate the exact height and width required to render the content on // the screen before actually rendering it. This helps us avoiding the flickering // effect that would be caused otherwise when the UI is rendered twice with // different sizes. textView.DisplayTextLineContainingBufferPosition( new SnapshotPoint(snapshot, 0), 0.0, ViewRelativePosition.Top, double.MaxValue, double.MaxValue); _width = Math.Max(textView.MaxTextRightCoordinate * (textView.ZoomLevel / 100), _minWidth); // Width of the widest line. Contract.ThrowIfFalse(IsNormal(_width)); _height = textView.LineHeight * (textView.ZoomLevel / 100) * // Height of each line. snapshot.LineCount; // Number of lines. Contract.ThrowIfFalse(IsNormal(_height)); } private static bool IsNormal(double value) { return !double.IsNaN(value) && !double.IsInfinity(value) && value > 0.0; } } public static Task SizeToFitAsync(this ICocoaDifferenceViewer diffViewer, IThreadingContext threadingContext, double minWidth = 400.0, CancellationToken cancellationToken = default) { var helper = new SizeToFitHelper(threadingContext, diffViewer, minWidth); return helper.SizeToFitAsync(cancellationToken); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Differencing; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Projection; using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Preview { internal static class ICocoaDifferenceViewerExtensions { private class SizeToFitHelper : ForegroundThreadAffinitizedObject { private readonly ICocoaDifferenceViewer _diffViewer; private readonly double _minWidth; private double _width; private double _height; public SizeToFitHelper(IThreadingContext threadingContext, ICocoaDifferenceViewer diffViewer, double minWidth) : base(threadingContext) { _diffViewer = diffViewer; _minWidth = minWidth; } public async Task SizeToFitAsync(CancellationToken cancellationToken) { await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); #pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task (containing method uses JTF) await CalculateSizeAsync(cancellationToken); #pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task // We have the height and width required to display the inline diff snapshot now. // Set the height and width of the ICocoaDifferenceViewer accordingly. _diffViewer.VisualElement.SetFrameSize(new CoreGraphics.CGSize(_width, _height)); _diffViewer.VisualElement.Subviews[0].SetFrameSize(new CoreGraphics.CGSize(_width, _height)); } private async Task<IProjectionSnapshot> GetInlineBufferSnapshotAsync(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); if (_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot is { } snapshot) { return snapshot; } var completionSource = new TaskCompletionSource<IProjectionSnapshot>(TaskCreationOptions.RunContinuationsAsynchronously); _diffViewer.DifferenceBuffer.SnapshotDifferenceChanged += HandleSnapshotDifferenceChanged; // Handle cases where the snapshot was set between the previous check and the event registration if (_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot is { } snapshot2) completionSource.SetResult(snapshot2); try { return await completionSource.Task.WithCancellation(cancellationToken).ConfigureAwaitRunInline(); } finally { _diffViewer.DifferenceBuffer.SnapshotDifferenceChanged -= HandleSnapshotDifferenceChanged; } // Local function void HandleSnapshotDifferenceChanged(object sender, SnapshotDifferenceChangeEventArgs e) { // This event handler will only be called when the inline diff snapshot computation is complete. Contract.ThrowIfNull(_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot); completionSource.SetResult(_diffViewer.DifferenceBuffer.CurrentInlineBufferSnapshot); } } private async Task CalculateSizeAsync(CancellationToken cancellationToken) { await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); ICocoaTextView textView; ITextSnapshot snapshot; if (_diffViewer.ViewMode == DifferenceViewMode.RightViewOnly) { textView = _diffViewer.RightView; snapshot = _diffViewer.DifferenceBuffer.RightBuffer.CurrentSnapshot; } else if (_diffViewer.ViewMode == DifferenceViewMode.LeftViewOnly) { textView = _diffViewer.LeftView; snapshot = _diffViewer.DifferenceBuffer.LeftBuffer.CurrentSnapshot; } else { textView = _diffViewer.InlineView; #pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task (containing method uses JTF) snapshot = await GetInlineBufferSnapshotAsync(cancellationToken); #pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task } // Perform a layout without actually rendering the content on the screen so that // we can calculate the exact height and width required to render the content on // the screen before actually rendering it. This helps us avoiding the flickering // effect that would be caused otherwise when the UI is rendered twice with // different sizes. textView.DisplayTextLineContainingBufferPosition( new SnapshotPoint(snapshot, 0), 0.0, ViewRelativePosition.Top, double.MaxValue, double.MaxValue); _width = Math.Max(textView.MaxTextRightCoordinate * (textView.ZoomLevel / 100), _minWidth); // Width of the widest line. Contract.ThrowIfFalse(IsNormal(_width)); _height = textView.LineHeight * (textView.ZoomLevel / 100) * // Height of each line. snapshot.LineCount; // Number of lines. Contract.ThrowIfFalse(IsNormal(_height)); } private static bool IsNormal(double value) { return !double.IsNaN(value) && !double.IsInfinity(value) && value > 0.0; } } public static Task SizeToFitAsync(this ICocoaDifferenceViewer diffViewer, IThreadingContext threadingContext, double minWidth = 400.0, CancellationToken cancellationToken = default) { var helper = new SizeToFitHelper(threadingContext, diffViewer, minWidth); return helper.SizeToFitAsync(cancellationToken); } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Scripting/CSharpTest.Desktop/CsiTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable extern alias PortableTestUtils; using System; using System.IO; using System.Reflection; using Microsoft.CodeAnalysis.Scripting; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using AssertEx = PortableTestUtils::Roslyn.Test.Utilities.AssertEx; using TestBase = PortableTestUtils::Roslyn.Test.Utilities.TestBase; namespace Microsoft.CodeAnalysis.CSharp.Scripting.Hosting.UnitTests { public class CsiTests : TestBase { private static readonly string s_compilerVersion = CommonCompiler.GetProductVersion(typeof(Csi)); private string CsiPath => typeof(Csi).GetTypeInfo().Assembly.Location; /// <summary> /// csi should use the current working directory of its environment to resolve relative paths specified on command line. /// </summary> [Fact] public void CurrentWorkingDirectory1() { var dir = Temp.CreateDirectory(); dir.CreateFile("a.csx").WriteAllText(@"Console.Write(Environment.CurrentDirectory + ';' + typeof(C).Name);"); dir.CreateFile("C.dll").WriteAllBytes(TestResources.General.C1); var result = ProcessUtilities.Run(CsiPath, "/r:C.dll a.csx", workingDirectory: dir.Path); AssertEx.AssertEqualToleratingWhitespaceDifferences(dir.Path + ";C", result.Output); Assert.False(result.ContainsErrors); } [Fact] public void CurrentWorkingDirectory_Change() { var dir = Temp.CreateDirectory(); dir.CreateFile("a.csx").WriteAllText(@"int X = 1;"); dir.CreateFile("C.dll").WriteAllBytes(TestResources.General.C1); var result = ProcessUtilities.Run(CsiPath, "", stdInput: $@"#load ""a.csx"" #r ""C.dll"" Directory.SetCurrentDirectory(@""{dir.Path}"") #load ""a.csx"" #r ""C.dll"" X new C() Environment.Exit(0) "); var expected = $@" { string.Format(CSharpScriptingResources.LogoLine1, s_compilerVersion) } {CSharpScriptingResources.LogoLine2} {ScriptingResources.HelpPrompt} > > > > > > 1 > C {{ }} > "; // The German translation (and possibly others) contains an en dash (0x2013), // but csi.exe outputs it as a hyphen-minus (0x002d). We need to fix up the // expected string before we can compare it to the actual output. expected = expected.Replace((char)0x2013, (char)0x002d); // EN DASH -> HYPHEN-MINUS AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, result.Output); AssertEx.AssertEqualToleratingWhitespaceDifferences($@" (1,7): error CS1504: { string.Format(CSharpResources.ERR_NoSourceFile, "a.csx", CSharpResources.CouldNotFindFile) } (1,1): error CS0006: { string.Format(CSharpResources.ERR_NoMetadataFile, "C.dll") } ", result.Errors); Assert.Equal(0, result.ExitCode); } /// <summary> /// csi does NOT use LIB environment variable to populate reference search paths. /// </summary> [Fact] public void ReferenceSearchPaths_LIB() { var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(@"Console.Write(typeof(C).Name);"); var dir = Temp.CreateDirectory(); dir.CreateFile("C.dll").WriteAllBytes(TestResources.General.C1); var result = ProcessUtilities.Run(CsiPath, "/r:C.dll a.csx", workingDirectory: cwd.Path, additionalEnvironmentVars: new[] { KeyValuePairUtil.Create("LIB", dir.Path) }); // error CS0006: Metadata file 'C.dll' could not be found Assert.True(result.Errors.StartsWith("error CS0006", StringComparison.Ordinal)); Assert.True(result.ContainsErrors); } /// <summary> /// csi does use SDK path (FX dir) /// </summary> [Fact] public void ReferenceSearchPaths_Sdk() { var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(@"Console.Write(typeof(DataSet).Name);"); var result = ProcessUtilities.Run(CsiPath, "/r:System.Data.dll /u:System.Data;System a.csx", workingDirectory: cwd.Path); AssertEx.AssertEqualToleratingWhitespaceDifferences("DataSet", result.Output); Assert.False(result.ContainsErrors); } [Fact] public void DefaultUsings() { var source = @" dynamic d = new ExpandoObject(); Process p = new Process(); Expression<Func<int>> e = () => 1; var squares = from x in new[] { 1, 2, 3 } select x * x; var sb = new StringBuilder(); var list = new List<int>(); var stream = new MemoryStream(); await Task.Delay(10); Console.Write(""OK""); "; var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(source); var result = ProcessUtilities.Run(CsiPath, "a.csx", workingDirectory: cwd.Path); AssertEx.AssertEqualToleratingWhitespaceDifferences("OK", result.Output); Assert.False(result.ContainsErrors); } [Fact] public void LineNumber_Information_On_Exception() { var source = @"Console.WriteLine(""OK""); throw new Exception(""Error!""); "; var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(source); var result = ProcessUtilities.Run(CsiPath, "a.csx", workingDirectory: cwd.Path); Assert.True(result.ContainsErrors); AssertEx.AssertEqualToleratingWhitespaceDifferences("OK", result.Output); AssertEx.AssertEqualToleratingWhitespaceDifferences($@" System.Exception: Error! + <Initialize>.MoveNext(){string.Format(ScriptingResources.AtFileLine, $"{cwd}{Path.DirectorySeparatorChar}a.csx", "2")} ", result.Errors); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable extern alias PortableTestUtils; using System; using System.IO; using System.Reflection; using Microsoft.CodeAnalysis.Scripting; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using AssertEx = PortableTestUtils::Roslyn.Test.Utilities.AssertEx; using TestBase = PortableTestUtils::Roslyn.Test.Utilities.TestBase; namespace Microsoft.CodeAnalysis.CSharp.Scripting.Hosting.UnitTests { public class CsiTests : TestBase { private static readonly string s_compilerVersion = CommonCompiler.GetProductVersion(typeof(Csi)); private string CsiPath => typeof(Csi).GetTypeInfo().Assembly.Location; /// <summary> /// csi should use the current working directory of its environment to resolve relative paths specified on command line. /// </summary> [Fact] public void CurrentWorkingDirectory1() { var dir = Temp.CreateDirectory(); dir.CreateFile("a.csx").WriteAllText(@"Console.Write(Environment.CurrentDirectory + ';' + typeof(C).Name);"); dir.CreateFile("C.dll").WriteAllBytes(TestResources.General.C1); var result = ProcessUtilities.Run(CsiPath, "/r:C.dll a.csx", workingDirectory: dir.Path); AssertEx.AssertEqualToleratingWhitespaceDifferences(dir.Path + ";C", result.Output); Assert.False(result.ContainsErrors); } [Fact] public void CurrentWorkingDirectory_Change() { var dir = Temp.CreateDirectory(); dir.CreateFile("a.csx").WriteAllText(@"int X = 1;"); dir.CreateFile("C.dll").WriteAllBytes(TestResources.General.C1); var result = ProcessUtilities.Run(CsiPath, "", stdInput: $@"#load ""a.csx"" #r ""C.dll"" Directory.SetCurrentDirectory(@""{dir.Path}"") #load ""a.csx"" #r ""C.dll"" X new C() Environment.Exit(0) "); var expected = $@" { string.Format(CSharpScriptingResources.LogoLine1, s_compilerVersion) } {CSharpScriptingResources.LogoLine2} {ScriptingResources.HelpPrompt} > > > > > > 1 > C {{ }} > "; // The German translation (and possibly others) contains an en dash (0x2013), // but csi.exe outputs it as a hyphen-minus (0x002d). We need to fix up the // expected string before we can compare it to the actual output. expected = expected.Replace((char)0x2013, (char)0x002d); // EN DASH -> HYPHEN-MINUS AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, result.Output); AssertEx.AssertEqualToleratingWhitespaceDifferences($@" (1,7): error CS1504: { string.Format(CSharpResources.ERR_NoSourceFile, "a.csx", CSharpResources.CouldNotFindFile) } (1,1): error CS0006: { string.Format(CSharpResources.ERR_NoMetadataFile, "C.dll") } ", result.Errors); Assert.Equal(0, result.ExitCode); } /// <summary> /// csi does NOT use LIB environment variable to populate reference search paths. /// </summary> [Fact] public void ReferenceSearchPaths_LIB() { var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(@"Console.Write(typeof(C).Name);"); var dir = Temp.CreateDirectory(); dir.CreateFile("C.dll").WriteAllBytes(TestResources.General.C1); var result = ProcessUtilities.Run(CsiPath, "/r:C.dll a.csx", workingDirectory: cwd.Path, additionalEnvironmentVars: new[] { KeyValuePairUtil.Create("LIB", dir.Path) }); // error CS0006: Metadata file 'C.dll' could not be found Assert.True(result.Errors.StartsWith("error CS0006", StringComparison.Ordinal)); Assert.True(result.ContainsErrors); } /// <summary> /// csi does use SDK path (FX dir) /// </summary> [Fact] public void ReferenceSearchPaths_Sdk() { var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(@"Console.Write(typeof(DataSet).Name);"); var result = ProcessUtilities.Run(CsiPath, "/r:System.Data.dll /u:System.Data;System a.csx", workingDirectory: cwd.Path); AssertEx.AssertEqualToleratingWhitespaceDifferences("DataSet", result.Output); Assert.False(result.ContainsErrors); } [Fact] public void DefaultUsings() { var source = @" dynamic d = new ExpandoObject(); Process p = new Process(); Expression<Func<int>> e = () => 1; var squares = from x in new[] { 1, 2, 3 } select x * x; var sb = new StringBuilder(); var list = new List<int>(); var stream = new MemoryStream(); await Task.Delay(10); Console.Write(""OK""); "; var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(source); var result = ProcessUtilities.Run(CsiPath, "a.csx", workingDirectory: cwd.Path); AssertEx.AssertEqualToleratingWhitespaceDifferences("OK", result.Output); Assert.False(result.ContainsErrors); } [Fact] public void LineNumber_Information_On_Exception() { var source = @"Console.WriteLine(""OK""); throw new Exception(""Error!""); "; var cwd = Temp.CreateDirectory(); cwd.CreateFile("a.csx").WriteAllText(source); var result = ProcessUtilities.Run(CsiPath, "a.csx", workingDirectory: cwd.Path); Assert.True(result.ContainsErrors); AssertEx.AssertEqualToleratingWhitespaceDifferences("OK", result.Output); AssertEx.AssertEqualToleratingWhitespaceDifferences($@" System.Exception: Error! + <Initialize>.MoveNext(){string.Format(ScriptingResources.AtFileLine, $"{cwd}{Path.DirectorySeparatorChar}a.csx", "2")} ", result.Errors); } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Analyzers/CSharp/Tests/UseSystemHashCode/UseSystemHashCodeTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.UseSystemHashCode; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseSystemHashCode { public partial class UseSystemHashCodeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { public UseSystemHashCodeTests(ITestOutputHelper logger) : base(logger) { } internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseSystemHashCodeDiagnosticAnalyzer(), new UseSystemHashCodeCodeFixProvider()); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDerivedClassWithFieldWithBase() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int GetHashCode() { return System.HashCode.Combine(base.GetHashCode(), j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDerivedClassWithFieldWithNoBase() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int GetHashCode() { return System.HashCode.Combine(j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDerivedClassWithNoFieldWithBase() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + base.GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int GetHashCode() { return System.HashCode.Combine(base.GetHashCode()); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestFieldAndProp() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestUnchecked() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { unchecked { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnNonGetHashCode() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode1() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithoutReturn() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithoutLocal() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithMultipleLocals() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506, x; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithoutInitializer() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotReturningAccumulator() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return 0; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestAcumulatorInitializedToField() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = i; hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestAcumulatorInitializedToHashedField() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestMissingOnThisGetHashCode() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + this.GetHashCode(); hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestMissingWithNoSystemHashCode() { await TestMissingAsync( @" class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDirectNullCheck1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + (S != null ? S.GetHashCode() : 0); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDirectNullCheck2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + (S == null ? 0 : S.GetHashCode()); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestInt64Pattern() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { long hashCode = -468965076; hashCode = (hashCode * -1521134295 + j.GetHashCode()).GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class C { int j; public override int GetHashCode() { return System.HashCode.Combine(j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestInt64Pattern2() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { long hashCode = -468965076; hashCode = (hashCode * -1521134295 + j.GetHashCode()).GetHashCode(); return (int)hashCode; } }", @"namespace System { public struct HashCode { } } class C { int j; public override int GetHashCode() { return System.HashCode.Combine(j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestTuple() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { return (i, S).GetHashCode(); } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable3() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable4() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_3() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_4() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_3() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_4() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnExistingUsageOfSystemHashCode() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode1() { return HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnExistingUsageOfSystemHashCode2() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode1() { var hash = new HashCode(); hash.Add(i); hash.Add(S); return hash.ToHashCode(); } }"); } [WorkItem(39916, "https://github.com/dotnet/roslyn/issues/39916")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestManyFields_ImplicitType() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + a.GetHashCode(); hashCode = hashCode * -1521134295 + b.GetHashCode(); hashCode = hashCode * -1521134295 + c.GetHashCode(); hashCode = hashCode * -1521134295 + d.GetHashCode(); hashCode = hashCode * -1521134295 + e.GetHashCode(); hashCode = hashCode * -1521134295 + f.GetHashCode(); hashCode = hashCode * -1521134295 + g.GetHashCode(); hashCode = hashCode * -1521134295 + h.GetHashCode(); hashCode = hashCode * -1521134295 + i.GetHashCode(); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int GetHashCode() { var hash = new System.HashCode(); hash.Add(a); hash.Add(b); hash.Add(c); hash.Add(d); hash.Add(e); hash.Add(f); hash.Add(g); hash.Add(h); hash.Add(i); return hash.ToHashCode(); } }", new TestParameters(options: UseVarTestExtensions.PreferImplicitTypeWithInfo(this))); } [WorkItem(39916, "https://github.com/dotnet/roslyn/issues/39916")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestManyFields_ExplicitType() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + a.GetHashCode(); hashCode = hashCode * -1521134295 + b.GetHashCode(); hashCode = hashCode * -1521134295 + c.GetHashCode(); hashCode = hashCode * -1521134295 + d.GetHashCode(); hashCode = hashCode * -1521134295 + e.GetHashCode(); hashCode = hashCode * -1521134295 + f.GetHashCode(); hashCode = hashCode * -1521134295 + g.GetHashCode(); hashCode = hashCode * -1521134295 + h.GetHashCode(); hashCode = hashCode * -1521134295 + i.GetHashCode(); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int GetHashCode() { System.HashCode hash = new System.HashCode(); hash.Add(a); hash.Add(b); hash.Add(c); hash.Add(d); hash.Add(e); hash.Add(f); hash.Add(g); hash.Add(h); hash.Add(i); return hash.ToHashCode(); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnSingleReturnedMember() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { return j; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnSingleMemberWithInvokedGetHashCode() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { return j.GetHashCode(); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnSimpleBaseReturn() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { return base.GetHashCode(); } }"); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.UseSystemHashCode; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseSystemHashCode { public partial class UseSystemHashCodeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { public UseSystemHashCodeTests(ITestOutputHelper logger) : base(logger) { } internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new UseSystemHashCodeDiagnosticAnalyzer(), new UseSystemHashCodeCodeFixProvider()); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDerivedClassWithFieldWithBase() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int GetHashCode() { return System.HashCode.Combine(base.GetHashCode(), j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDerivedClassWithFieldWithNoBase() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int GetHashCode() { return System.HashCode.Combine(j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDerivedClassWithNoFieldWithBase() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + base.GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int GetHashCode() { return System.HashCode.Combine(base.GetHashCode()); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestFieldAndProp() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestUnchecked() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { unchecked { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnNonGetHashCode() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode1() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithoutReturn() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithoutLocal() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithMultipleLocals() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506, x; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotWithoutInitializer() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotReturningAccumulator() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return 0; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestAcumulatorInitializedToField() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = i; hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestAcumulatorInitializedToHashedField() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestMissingOnThisGetHashCode() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + this.GetHashCode(); hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestMissingWithNoSystemHashCode() { await TestMissingAsync( @" class B { public override int GetHashCode() => 0; } class C : B { int j; public override int $$GetHashCode() { var hashCode = 339610899; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + j.GetHashCode(); return hashCode; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDirectNullCheck1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + (S != null ? S.GetHashCode() : 0); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestDirectNullCheck2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + (S == null ? 0 : S.GetHashCode()); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestInt64Pattern() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { long hashCode = -468965076; hashCode = (hashCode * -1521134295 + j.GetHashCode()).GetHashCode(); return hashCode; } }", @"namespace System { public struct HashCode { } } class C { int j; public override int GetHashCode() { return System.HashCode.Combine(j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestInt64Pattern2() { await TestInRegularAndScript1Async( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { long hashCode = -468965076; hashCode = (hashCode * -1521134295 + j.GetHashCode()).GetHashCode(); return (int)hashCode; } }", @"namespace System { public struct HashCode { } } class C { int j; public override int GetHashCode() { return System.HashCode.Combine(j); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestTuple() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode() { return (i, S).GetHashCode(); } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable3() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable4() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_3() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Enable_4() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable enable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_1() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_2() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_3() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNullable_Disable_4() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + i.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer<string?>.Default.GetHashCode(S)!; return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } #nullable disable class C { int i; string? S { get; } public override int GetHashCode() { return System.HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnExistingUsageOfSystemHashCode() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode1() { return HashCode.Combine(i, S); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnExistingUsageOfSystemHashCode2() { await TestMissingAsync( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int i; string S { get; } public override int $$GetHashCode1() { var hash = new HashCode(); hash.Add(i); hash.Add(S); return hash.ToHashCode(); } }"); } [WorkItem(39916, "https://github.com/dotnet/roslyn/issues/39916")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestManyFields_ImplicitType() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + a.GetHashCode(); hashCode = hashCode * -1521134295 + b.GetHashCode(); hashCode = hashCode * -1521134295 + c.GetHashCode(); hashCode = hashCode * -1521134295 + d.GetHashCode(); hashCode = hashCode * -1521134295 + e.GetHashCode(); hashCode = hashCode * -1521134295 + f.GetHashCode(); hashCode = hashCode * -1521134295 + g.GetHashCode(); hashCode = hashCode * -1521134295 + h.GetHashCode(); hashCode = hashCode * -1521134295 + i.GetHashCode(); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int GetHashCode() { var hash = new System.HashCode(); hash.Add(a); hash.Add(b); hash.Add(c); hash.Add(d); hash.Add(e); hash.Add(f); hash.Add(g); hash.Add(h); hash.Add(i); return hash.ToHashCode(); } }", new TestParameters(options: UseVarTestExtensions.PreferImplicitTypeWithInfo(this))); } [WorkItem(39916, "https://github.com/dotnet/roslyn/issues/39916")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestManyFields_ExplicitType() { await TestInRegularAndScript1Async( @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int $$GetHashCode() { var hashCode = -538000506; hashCode = hashCode * -1521134295 + a.GetHashCode(); hashCode = hashCode * -1521134295 + b.GetHashCode(); hashCode = hashCode * -1521134295 + c.GetHashCode(); hashCode = hashCode * -1521134295 + d.GetHashCode(); hashCode = hashCode * -1521134295 + e.GetHashCode(); hashCode = hashCode * -1521134295 + f.GetHashCode(); hashCode = hashCode * -1521134295 + g.GetHashCode(); hashCode = hashCode * -1521134295 + h.GetHashCode(); hashCode = hashCode * -1521134295 + i.GetHashCode(); return hashCode; } }", @"using System.Collections.Generic; namespace System { public struct HashCode { } } class C { int a, b, c, d, e, f, g, h, i; public override int GetHashCode() { System.HashCode hash = new System.HashCode(); hash.Add(a); hash.Add(b); hash.Add(c); hash.Add(d); hash.Add(e); hash.Add(f); hash.Add(g); hash.Add(h); hash.Add(i); return hash.ToHashCode(); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnSingleReturnedMember() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { return j; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnSingleMemberWithInvokedGetHashCode() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { return j.GetHashCode(); } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseSystemHashCode)] public async Task TestNotOnSimpleBaseReturn() { await TestMissingAsync( @"namespace System { public struct HashCode { } } class C { int j; public override int $$GetHashCode() { return base.GetHashCode(); } }"); } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/VisualStudio/Core/Def/Implementation/ProjectSystem/FileChangeWatcher.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.Shell.Interop; using Roslyn.Utilities; using IVsAsyncFileChangeEx = Microsoft.VisualStudio.Shell.IVsAsyncFileChangeEx; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem { /// <summary> /// A service that wraps the Visual Studio file watching APIs to make them more convenient for use. With this, a consumer can create /// an <see cref="IContext"/> which lets you add/remove files being watched, and an event is raised when a file is modified. /// </summary> internal sealed class FileChangeWatcher { internal const uint FileChangeFlags = (uint)(_VSFILECHANGEFLAGS.VSFILECHG_Time | _VSFILECHANGEFLAGS.VSFILECHG_Add | _VSFILECHANGEFLAGS.VSFILECHG_Del | _VSFILECHANGEFLAGS.VSFILECHG_Size); /// <summary> /// Gate that is used to guard modifications to <see cref="_taskQueue"/>. /// </summary> private readonly object _taskQueueGate = new(); /// <summary> /// We create a queue of tasks against the IVsFileChangeEx service for two reasons. First, we are obtaining the service asynchronously, and don't want to /// block on it being available, so anybody who wants to do anything must wait for it. Secondly, the service itself is single-threaded; the entry points /// are asynchronous so we avoid starving the thread pool, but there's still no reason to create a lot more work blocked than needed. Finally, since this /// is all happening async, we generally need to ensure that an operation that happens for an earlier call to this is done before we do later calls. For example, /// if we started a subscription for a file, we need to make sure that's done before we try to unsubscribe from it. /// For performance and correctness reasons, NOTHING should ever do a block on this; figure out how to do your work without a block and add any work to /// the end of the queue. /// </summary> private Task<IVsAsyncFileChangeEx> _taskQueue; private static readonly Func<Task<IVsAsyncFileChangeEx>, object, Task<IVsAsyncFileChangeEx>> _executeActionDelegate = async (precedingTask, state) => { var action = (Func<IVsAsyncFileChangeEx, Task>)state; await action(precedingTask.Result).ConfigureAwait(false); return precedingTask.Result; }; public FileChangeWatcher(Task<IVsAsyncFileChangeEx> fileChangeService) => _taskQueue = fileChangeService; private void EnqueueWork(Func<IVsAsyncFileChangeEx, Task> action) { lock (_taskQueueGate) { _taskQueue = _taskQueue.ContinueWith( _executeActionDelegate, action, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Default).Unwrap(); } } // TODO: remove this when there is a mechanism for a caller of EnqueueWatchingFile // to explicitly wait on that being complete. public void WaitForQueue_TestOnly() { Task queue; lock (_taskQueueGate) { queue = _taskQueue; } queue.Wait(); } public IContext CreateContext(params WatchedDirectory[] watchedDirectories) { return new Context(this, watchedDirectories.ToImmutableArray()); } /// <summary> /// Gives a hint to the <see cref="IContext"/> that we should watch a top-level directory for all changes in addition /// to any files called by <see cref="IContext.EnqueueWatchingFile(string)"/>. /// </summary> /// <remarks> /// This is largely intended as an optimization; consumers should still call <see cref="IContext.EnqueueWatchingFile(string)" /> /// for files they want to watch. This allows the caller to give a hint that it is expected that most of the files being /// watched is under this directory, and so it's more efficient just to watch _all_ of the changes in that directory /// rather than creating and tracking a bunch of file watcher state for each file separately. A good example would be /// just creating a single directory watch on the root of a project for source file changes: rather than creating a file watcher /// for each individual file, we can just watch the entire directory and that's it. /// </remarks> public sealed class WatchedDirectory { public WatchedDirectory(string path, string? extensionFilter) { // We are doing string comparisons with this path, so ensure it has a trailing \ so we don't get confused with sibling // paths that won't actually be covered. if (!path.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { path += System.IO.Path.DirectorySeparatorChar; } if (extensionFilter != null && !extensionFilter.StartsWith(".")) { throw new ArgumentException($"{nameof(extensionFilter)} should start with a period.", nameof(extensionFilter)); } Path = path; ExtensionFilter = extensionFilter; } public string Path { get; } /// <summary> /// If non-null, only watch the directory for changes to a specific extension. String always starts with a period. /// </summary> public string? ExtensionFilter { get; } } /// <summary> /// A context that is watching one or more files. /// </summary> /// <remarks>This is only implemented today by <see cref="Context"/> but we don't want to leak implementation details out.</remarks> public interface IContext : IDisposable { /// <summary> /// Raised when a file has been changed. This may be a file watched explicitly by <see cref="EnqueueWatchingFile(string)"/> or it could be any /// file in the directory if the <see cref="IContext"/> was watching a directory. /// </summary> event EventHandler<string> FileChanged; /// <summary> /// Starts watching a file but doesn't wait for the file watcher to be registered with the operating system. Good if you know /// you'll need a file watched (eventually) but it's not worth blocking yet. /// </summary> IFileWatchingToken EnqueueWatchingFile(string filePath); void StopWatchingFile(IFileWatchingToken token); } /// <summary> /// A marker interface for tokens returned from <see cref="IContext.EnqueueWatchingFile(string)"/>. This is just to ensure type safety and avoid /// leaking the full surface area of the nested types. /// </summary> public interface IFileWatchingToken { } private sealed class Context : IVsFreeThreadedFileChangeEvents2, IContext { private readonly FileChangeWatcher _fileChangeWatcher; private readonly ImmutableArray<WatchedDirectory> _watchedDirectories; private readonly IFileWatchingToken _noOpFileWatchingToken; /// <summary> /// Gate to guard mutable fields in this class and any mutation of any <see cref="FileWatchingToken"/>s. /// </summary> private readonly object _gate = new(); private bool _disposed = false; private readonly HashSet<FileWatchingToken> _activeFileWatchingTokens = new(); /// <summary> /// The list of cookies we used to make watchers for <see cref="_watchedDirectories"/>. /// </summary> /// <remarks> /// This does not need to be used under <see cref="_gate"/>, as it's only used inside the actual queue of file watcher /// actions. /// </remarks> private readonly List<uint> _directoryWatchCookies = new(); public Context(FileChangeWatcher fileChangeWatcher, ImmutableArray<WatchedDirectory> watchedDirectories) { _fileChangeWatcher = fileChangeWatcher; _watchedDirectories = watchedDirectories; _noOpFileWatchingToken = new FileWatchingToken(); foreach (var watchedDirectory in watchedDirectories) { _fileChangeWatcher.EnqueueWork( async service => { var cookie = await service.AdviseDirChangeAsync(watchedDirectory.Path, watchSubdirectories: true, this).ConfigureAwait(false); _directoryWatchCookies.Add(cookie); if (watchedDirectory.ExtensionFilter != null) { await service.FilterDirectoryChangesAsync(cookie, new string[] { watchedDirectory.ExtensionFilter }, CancellationToken.None).ConfigureAwait(false); } }); } } public void Dispose() { lock (_gate) { if (_disposed) { return; } _disposed = true; } _fileChangeWatcher.EnqueueWork( async service => { // This cleanup code all runs in the single queue that we push usages of the file change service into. // Therefore, we know that any advise operations we had done have ran in that queue by now. Since this is also // running after dispose, we don't need to take any locks at this point, since we're taking the general policy // that any use of the type after it's been disposed is simply undefined behavior. // We don't use IAsyncDisposable here simply because we don't ever want to block on the queue if we're // able to avoid it, since that would potentially cause a stall or UI delay on shutting down. foreach (var cookie in _directoryWatchCookies) { await service.UnadviseDirChangeAsync(cookie).ConfigureAwait(false); } // Since this runs after disposal, no lock is needed for _activeFileWatchingTokens foreach (var token in _activeFileWatchingTokens) { await UnsubscribeFileChangeEventsAsync(service, token).ConfigureAwait(false); } }); } public IFileWatchingToken EnqueueWatchingFile(string filePath) { // If we already have this file under our path, we may not have to do additional watching foreach (var watchedDirectory in _watchedDirectories) { if (watchedDirectory != null && filePath.StartsWith(watchedDirectory.Path)) { // If ExtensionFilter is null, then we're watching for all files in the directory so the prior check // of the directory containment was sufficient. If it isn't null, then we have to check the extension // matches. if (watchedDirectory.ExtensionFilter == null || filePath.EndsWith(watchedDirectory.ExtensionFilter)) { return _noOpFileWatchingToken; } } } var token = new FileWatchingToken(); lock (_gate) { _activeFileWatchingTokens.Add(token); } _fileChangeWatcher.EnqueueWork(async service => { token.Cookie = await service.AdviseFileChangeAsync(filePath, _VSFILECHANGEFLAGS.VSFILECHG_Size | _VSFILECHANGEFLAGS.VSFILECHG_Time, this).ConfigureAwait(false); }); return token; } public void StopWatchingFile(IFileWatchingToken token) { var typedToken = token as FileWatchingToken; Contract.ThrowIfNull(typedToken, "The token passed did not originate from this service."); if (typedToken == _noOpFileWatchingToken) { // This file never required a direct file watch, our main subscription covered it. return; } lock (_gate) { Contract.ThrowIfFalse(_activeFileWatchingTokens.Remove(typedToken), "This token was no longer being watched."); } _fileChangeWatcher.EnqueueWork(service => UnsubscribeFileChangeEventsAsync(service, typedToken)); } private Task UnsubscribeFileChangeEventsAsync(IVsAsyncFileChangeEx service, FileWatchingToken typedToken) => service.UnadviseFileChangeAsync(typedToken.Cookie!.Value); public event EventHandler<string>? FileChanged; int IVsFreeThreadedFileChangeEvents.FilesChanged(uint cChanges, string[] rgpszFile, uint[] rggrfChange) { for (var i = 0; i < cChanges; i++) { FileChanged?.Invoke(this, rgpszFile[i]); } return VSConstants.S_OK; } int IVsFreeThreadedFileChangeEvents.DirectoryChanged(string pszDirectory) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFreeThreadedFileChangeEvents2.DirectoryChanged(string pszDirectory) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx(string pszDirectory, string pszFile) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2(string pszDirectory, uint cChanges, string[] rgpszFile, uint[] rggrfChange) { for (var i = 0; i < cChanges; i++) { FileChanged?.Invoke(this, rgpszFile[i]); } return VSConstants.S_OK; } int IVsFileChangeEvents.FilesChanged(uint cChanges, string[] rgpszFile, uint[] rggrfChange) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.FilesChanged, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFileChangeEvents.DirectoryChanged(string pszDirectory) => VSConstants.E_NOTIMPL; public class FileWatchingToken : IFileWatchingToken { /// <summary> /// The cookie we have for requesting a watch on this file. Any files that didn't need /// to be watched specifically are equal to <see cref="_noOpFileWatchingToken"/>, so /// any other instance is something that should be watched. Null means we either haven't /// done the subscription (and it's still in the queue) or we had some sort of error /// subscribing in the first place. /// </summary> public uint? Cookie; } int IVsFreeThreadedFileChangeEvents2.FilesChanged(uint cChanges, string[] rgpszFile, uint[] rggrfChange) { for (var i = 0; i < cChanges; i++) { FileChanged?.Invoke(this, rgpszFile[i]); } return VSConstants.S_OK; } int IVsFreeThreadedFileChangeEvents.DirectoryChangedEx(string pszDirectory, string pszFile) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.Shell.Interop; using Roslyn.Utilities; using IVsAsyncFileChangeEx = Microsoft.VisualStudio.Shell.IVsAsyncFileChangeEx; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem { /// <summary> /// A service that wraps the Visual Studio file watching APIs to make them more convenient for use. With this, a consumer can create /// an <see cref="IContext"/> which lets you add/remove files being watched, and an event is raised when a file is modified. /// </summary> internal sealed class FileChangeWatcher { internal const uint FileChangeFlags = (uint)(_VSFILECHANGEFLAGS.VSFILECHG_Time | _VSFILECHANGEFLAGS.VSFILECHG_Add | _VSFILECHANGEFLAGS.VSFILECHG_Del | _VSFILECHANGEFLAGS.VSFILECHG_Size); /// <summary> /// Gate that is used to guard modifications to <see cref="_taskQueue"/>. /// </summary> private readonly object _taskQueueGate = new(); /// <summary> /// We create a queue of tasks against the IVsFileChangeEx service for two reasons. First, we are obtaining the service asynchronously, and don't want to /// block on it being available, so anybody who wants to do anything must wait for it. Secondly, the service itself is single-threaded; the entry points /// are asynchronous so we avoid starving the thread pool, but there's still no reason to create a lot more work blocked than needed. Finally, since this /// is all happening async, we generally need to ensure that an operation that happens for an earlier call to this is done before we do later calls. For example, /// if we started a subscription for a file, we need to make sure that's done before we try to unsubscribe from it. /// For performance and correctness reasons, NOTHING should ever do a block on this; figure out how to do your work without a block and add any work to /// the end of the queue. /// </summary> private Task<IVsAsyncFileChangeEx> _taskQueue; private static readonly Func<Task<IVsAsyncFileChangeEx>, object, Task<IVsAsyncFileChangeEx>> _executeActionDelegate = async (precedingTask, state) => { var action = (Func<IVsAsyncFileChangeEx, Task>)state; await action(precedingTask.Result).ConfigureAwait(false); return precedingTask.Result; }; public FileChangeWatcher(Task<IVsAsyncFileChangeEx> fileChangeService) => _taskQueue = fileChangeService; private void EnqueueWork(Func<IVsAsyncFileChangeEx, Task> action) { lock (_taskQueueGate) { _taskQueue = _taskQueue.ContinueWith( _executeActionDelegate, action, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Default).Unwrap(); } } // TODO: remove this when there is a mechanism for a caller of EnqueueWatchingFile // to explicitly wait on that being complete. public void WaitForQueue_TestOnly() { Task queue; lock (_taskQueueGate) { queue = _taskQueue; } queue.Wait(); } public IContext CreateContext(params WatchedDirectory[] watchedDirectories) { return new Context(this, watchedDirectories.ToImmutableArray()); } /// <summary> /// Gives a hint to the <see cref="IContext"/> that we should watch a top-level directory for all changes in addition /// to any files called by <see cref="IContext.EnqueueWatchingFile(string)"/>. /// </summary> /// <remarks> /// This is largely intended as an optimization; consumers should still call <see cref="IContext.EnqueueWatchingFile(string)" /> /// for files they want to watch. This allows the caller to give a hint that it is expected that most of the files being /// watched is under this directory, and so it's more efficient just to watch _all_ of the changes in that directory /// rather than creating and tracking a bunch of file watcher state for each file separately. A good example would be /// just creating a single directory watch on the root of a project for source file changes: rather than creating a file watcher /// for each individual file, we can just watch the entire directory and that's it. /// </remarks> public sealed class WatchedDirectory { public WatchedDirectory(string path, string? extensionFilter) { // We are doing string comparisons with this path, so ensure it has a trailing \ so we don't get confused with sibling // paths that won't actually be covered. if (!path.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { path += System.IO.Path.DirectorySeparatorChar; } if (extensionFilter != null && !extensionFilter.StartsWith(".")) { throw new ArgumentException($"{nameof(extensionFilter)} should start with a period.", nameof(extensionFilter)); } Path = path; ExtensionFilter = extensionFilter; } public string Path { get; } /// <summary> /// If non-null, only watch the directory for changes to a specific extension. String always starts with a period. /// </summary> public string? ExtensionFilter { get; } } /// <summary> /// A context that is watching one or more files. /// </summary> /// <remarks>This is only implemented today by <see cref="Context"/> but we don't want to leak implementation details out.</remarks> public interface IContext : IDisposable { /// <summary> /// Raised when a file has been changed. This may be a file watched explicitly by <see cref="EnqueueWatchingFile(string)"/> or it could be any /// file in the directory if the <see cref="IContext"/> was watching a directory. /// </summary> event EventHandler<string> FileChanged; /// <summary> /// Starts watching a file but doesn't wait for the file watcher to be registered with the operating system. Good if you know /// you'll need a file watched (eventually) but it's not worth blocking yet. /// </summary> IFileWatchingToken EnqueueWatchingFile(string filePath); void StopWatchingFile(IFileWatchingToken token); } /// <summary> /// A marker interface for tokens returned from <see cref="IContext.EnqueueWatchingFile(string)"/>. This is just to ensure type safety and avoid /// leaking the full surface area of the nested types. /// </summary> public interface IFileWatchingToken { } private sealed class Context : IVsFreeThreadedFileChangeEvents2, IContext { private readonly FileChangeWatcher _fileChangeWatcher; private readonly ImmutableArray<WatchedDirectory> _watchedDirectories; private readonly IFileWatchingToken _noOpFileWatchingToken; /// <summary> /// Gate to guard mutable fields in this class and any mutation of any <see cref="FileWatchingToken"/>s. /// </summary> private readonly object _gate = new(); private bool _disposed = false; private readonly HashSet<FileWatchingToken> _activeFileWatchingTokens = new(); /// <summary> /// The list of cookies we used to make watchers for <see cref="_watchedDirectories"/>. /// </summary> /// <remarks> /// This does not need to be used under <see cref="_gate"/>, as it's only used inside the actual queue of file watcher /// actions. /// </remarks> private readonly List<uint> _directoryWatchCookies = new(); public Context(FileChangeWatcher fileChangeWatcher, ImmutableArray<WatchedDirectory> watchedDirectories) { _fileChangeWatcher = fileChangeWatcher; _watchedDirectories = watchedDirectories; _noOpFileWatchingToken = new FileWatchingToken(); foreach (var watchedDirectory in watchedDirectories) { _fileChangeWatcher.EnqueueWork( async service => { var cookie = await service.AdviseDirChangeAsync(watchedDirectory.Path, watchSubdirectories: true, this).ConfigureAwait(false); _directoryWatchCookies.Add(cookie); if (watchedDirectory.ExtensionFilter != null) { await service.FilterDirectoryChangesAsync(cookie, new string[] { watchedDirectory.ExtensionFilter }, CancellationToken.None).ConfigureAwait(false); } }); } } public void Dispose() { lock (_gate) { if (_disposed) { return; } _disposed = true; } _fileChangeWatcher.EnqueueWork( async service => { // This cleanup code all runs in the single queue that we push usages of the file change service into. // Therefore, we know that any advise operations we had done have ran in that queue by now. Since this is also // running after dispose, we don't need to take any locks at this point, since we're taking the general policy // that any use of the type after it's been disposed is simply undefined behavior. // We don't use IAsyncDisposable here simply because we don't ever want to block on the queue if we're // able to avoid it, since that would potentially cause a stall or UI delay on shutting down. foreach (var cookie in _directoryWatchCookies) { await service.UnadviseDirChangeAsync(cookie).ConfigureAwait(false); } // Since this runs after disposal, no lock is needed for _activeFileWatchingTokens foreach (var token in _activeFileWatchingTokens) { await UnsubscribeFileChangeEventsAsync(service, token).ConfigureAwait(false); } }); } public IFileWatchingToken EnqueueWatchingFile(string filePath) { // If we already have this file under our path, we may not have to do additional watching foreach (var watchedDirectory in _watchedDirectories) { if (watchedDirectory != null && filePath.StartsWith(watchedDirectory.Path)) { // If ExtensionFilter is null, then we're watching for all files in the directory so the prior check // of the directory containment was sufficient. If it isn't null, then we have to check the extension // matches. if (watchedDirectory.ExtensionFilter == null || filePath.EndsWith(watchedDirectory.ExtensionFilter)) { return _noOpFileWatchingToken; } } } var token = new FileWatchingToken(); lock (_gate) { _activeFileWatchingTokens.Add(token); } _fileChangeWatcher.EnqueueWork(async service => { token.Cookie = await service.AdviseFileChangeAsync(filePath, _VSFILECHANGEFLAGS.VSFILECHG_Size | _VSFILECHANGEFLAGS.VSFILECHG_Time, this).ConfigureAwait(false); }); return token; } public void StopWatchingFile(IFileWatchingToken token) { var typedToken = token as FileWatchingToken; Contract.ThrowIfNull(typedToken, "The token passed did not originate from this service."); if (typedToken == _noOpFileWatchingToken) { // This file never required a direct file watch, our main subscription covered it. return; } lock (_gate) { Contract.ThrowIfFalse(_activeFileWatchingTokens.Remove(typedToken), "This token was no longer being watched."); } _fileChangeWatcher.EnqueueWork(service => UnsubscribeFileChangeEventsAsync(service, typedToken)); } private Task UnsubscribeFileChangeEventsAsync(IVsAsyncFileChangeEx service, FileWatchingToken typedToken) => service.UnadviseFileChangeAsync(typedToken.Cookie!.Value); public event EventHandler<string>? FileChanged; int IVsFreeThreadedFileChangeEvents.FilesChanged(uint cChanges, string[] rgpszFile, uint[] rggrfChange) { for (var i = 0; i < cChanges; i++) { FileChanged?.Invoke(this, rgpszFile[i]); } return VSConstants.S_OK; } int IVsFreeThreadedFileChangeEvents.DirectoryChanged(string pszDirectory) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFreeThreadedFileChangeEvents2.DirectoryChanged(string pszDirectory) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx(string pszDirectory, string pszFile) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2(string pszDirectory, uint cChanges, string[] rgpszFile, uint[] rggrfChange) { for (var i = 0; i < cChanges; i++) { FileChanged?.Invoke(this, rgpszFile[i]); } return VSConstants.S_OK; } int IVsFileChangeEvents.FilesChanged(uint cChanges, string[] rgpszFile, uint[] rggrfChange) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.FilesChanged, this should not be called."); return VSConstants.E_NOTIMPL; } int IVsFileChangeEvents.DirectoryChanged(string pszDirectory) => VSConstants.E_NOTIMPL; public class FileWatchingToken : IFileWatchingToken { /// <summary> /// The cookie we have for requesting a watch on this file. Any files that didn't need /// to be watched specifically are equal to <see cref="_noOpFileWatchingToken"/>, so /// any other instance is something that should be watched. Null means we either haven't /// done the subscription (and it's still in the queue) or we had some sort of error /// subscribing in the first place. /// </summary> public uint? Cookie; } int IVsFreeThreadedFileChangeEvents2.FilesChanged(uint cChanges, string[] rgpszFile, uint[] rggrfChange) { for (var i = 0; i < cChanges; i++) { FileChanged?.Invoke(this, rgpszFile[i]); } return VSConstants.S_OK; } int IVsFreeThreadedFileChangeEvents.DirectoryChangedEx(string pszDirectory, string pszFile) { Debug.Fail("Since we're implementing IVsFreeThreadedFileChangeEvents2.DirectoryChangedEx2, this should not be called."); return VSConstants.E_NOTIMPL; } } } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/VisualStudio/Core/Def/Implementation/AbstractOleCommandTarget.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.OLE.Interop; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.TextManager.Interop; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation { internal abstract partial class AbstractOleCommandTarget : IOleCommandTarget { /// <summary> /// This is set only during Exec. Currently, this is required to disambiguate the editor calls to /// <see cref="IVsTextViewFilter.GetPairExtents(int, int, TextSpan[])"/> between GotoBrace and GotoBraceExt commands. /// </summary> protected uint CurrentlyExecutingCommand { get; private set; } public AbstractOleCommandTarget( IWpfTextView wpfTextView, IComponentModel componentModel) { Contract.ThrowIfNull(wpfTextView); Contract.ThrowIfNull(componentModel); WpfTextView = wpfTextView; ComponentModel = componentModel; } public IComponentModel ComponentModel { get; } public IVsEditorAdaptersFactoryService EditorAdaptersFactory { get { return ComponentModel.GetService<IVsEditorAdaptersFactoryService>(); } } /// <summary> /// The IWpfTextView that this command filter is attached to. /// </summary> public IWpfTextView WpfTextView { get; } /// <summary> /// The next command target in the chain. This is set by the derived implementation of this /// class. /// </summary> [DisallowNull] protected internal IOleCommandTarget? NextCommandTarget { get; set; } internal AbstractOleCommandTarget AttachToVsTextView() { var vsTextView = EditorAdaptersFactory.GetViewAdapter(WpfTextView); Contract.ThrowIfNull(vsTextView); // Add command filter to IVsTextView. If something goes wrong, throw. var returnValue = vsTextView.AddCommandFilter(this, out var nextCommandTarget); Marshal.ThrowExceptionForHR(returnValue); Contract.ThrowIfNull(nextCommandTarget); NextCommandTarget = nextCommandTarget; return this; } protected virtual ITextBuffer? GetSubjectBufferContainingCaret() => WpfTextView.GetBufferContainingCaret(); protected virtual ITextView ConvertTextView() => WpfTextView; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.OLE.Interop; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.TextManager.Interop; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation { internal abstract partial class AbstractOleCommandTarget : IOleCommandTarget { /// <summary> /// This is set only during Exec. Currently, this is required to disambiguate the editor calls to /// <see cref="IVsTextViewFilter.GetPairExtents(int, int, TextSpan[])"/> between GotoBrace and GotoBraceExt commands. /// </summary> protected uint CurrentlyExecutingCommand { get; private set; } public AbstractOleCommandTarget( IWpfTextView wpfTextView, IComponentModel componentModel) { Contract.ThrowIfNull(wpfTextView); Contract.ThrowIfNull(componentModel); WpfTextView = wpfTextView; ComponentModel = componentModel; } public IComponentModel ComponentModel { get; } public IVsEditorAdaptersFactoryService EditorAdaptersFactory { get { return ComponentModel.GetService<IVsEditorAdaptersFactoryService>(); } } /// <summary> /// The IWpfTextView that this command filter is attached to. /// </summary> public IWpfTextView WpfTextView { get; } /// <summary> /// The next command target in the chain. This is set by the derived implementation of this /// class. /// </summary> [DisallowNull] protected internal IOleCommandTarget? NextCommandTarget { get; set; } internal AbstractOleCommandTarget AttachToVsTextView() { var vsTextView = EditorAdaptersFactory.GetViewAdapter(WpfTextView); Contract.ThrowIfNull(vsTextView); // Add command filter to IVsTextView. If something goes wrong, throw. var returnValue = vsTextView.AddCommandFilter(this, out var nextCommandTarget); Marshal.ThrowExceptionForHR(returnValue); Contract.ThrowIfNull(nextCommandTarget); NextCommandTarget = nextCommandTarget; return this; } protected virtual ITextBuffer? GetSubjectBufferContainingCaret() => WpfTextView.GetBufferContainingCaret(); protected virtual ITextView ConvertTextView() => WpfTextView; } }
-1
dotnet/roslyn
55,599
Shutdown LSP server on streamjsonrpc disconnect
Resolves https://github.com/dotnet/roslyn/issues/54823
dibarbet
2021-08-13T02:05:22Z
2021-08-13T21:58:55Z
db6f6fcb9bb28868434176b1401b27ef91613332
0954614a5d74e843916c84f220a65770efe19b20
Shutdown LSP server on streamjsonrpc disconnect. Resolves https://github.com/dotnet/roslyn/issues/54823
./src/Scripting/Core/Script.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #pragma warning disable RS0026 // Do not add multiple public overloads with optional parameters using System; using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Reflection; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis; using Roslyn.Utilities; using Microsoft.CodeAnalysis.Scripting.Hosting; using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.Text; using System.IO; namespace Microsoft.CodeAnalysis.Scripting { /// <summary> /// A class that represents a script that you can run. /// /// Create a script using a language specific script class such as CSharpScript or VisualBasicScript. /// </summary> public abstract class Script { internal readonly ScriptCompiler Compiler; internal readonly ScriptBuilder Builder; private Compilation _lazyCompilation; internal Script(ScriptCompiler compiler, ScriptBuilder builder, SourceText sourceText, ScriptOptions options, Type globalsTypeOpt, Script previousOpt) { Debug.Assert(sourceText != null); Debug.Assert(options != null); Debug.Assert(compiler != null); Debug.Assert(builder != null); Compiler = compiler; Builder = builder; Previous = previousOpt; SourceText = sourceText; Options = options; GlobalsType = globalsTypeOpt; } internal static Script<T> CreateInitialScript<T>(ScriptCompiler compiler, SourceText sourceText, ScriptOptions optionsOpt, Type globalsTypeOpt, InteractiveAssemblyLoader assemblyLoaderOpt) { return new Script<T>(compiler, new ScriptBuilder(assemblyLoaderOpt ?? new InteractiveAssemblyLoader()), sourceText, optionsOpt ?? ScriptOptions.Default, globalsTypeOpt, previousOpt: null); } /// <summary> /// A script that will run first when this script is run. /// Any declarations made in the previous script can be referenced in this script. /// The end state from running this script includes all declarations made by both scripts. /// </summary> public Script Previous { get; } /// <summary> /// The options used by this script. /// </summary> public ScriptOptions Options { get; } /// <summary> /// The source code of the script. /// </summary> public string Code => SourceText.ToString(); /// <summary> /// The <see cref="SourceText"/> of the script. /// </summary> internal SourceText SourceText { get; } /// <summary> /// The type of an object whose members can be accessed by the script as global variables. /// </summary> public Type GlobalsType { get; } /// <summary> /// The expected return type of the script. /// </summary> public abstract Type ReturnType { get; } /// <summary> /// Creates a new version of this script with the specified options. /// </summary> public Script WithOptions(ScriptOptions options) => WithOptionsInternal(options); internal abstract Script WithOptionsInternal(ScriptOptions options); /// <summary> /// Continues the script with given code snippet. /// </summary> public Script<object> ContinueWith(string code, ScriptOptions options = null) => ContinueWith<object>(code, options); /// <summary> /// Continues the script with given <see cref="Stream"/> representing code. /// </summary> /// <exception cref="ArgumentNullException">Stream is null.</exception> /// <exception cref="ArgumentException">Stream is not readable or seekable.</exception> public Script<object> ContinueWith(Stream code, ScriptOptions options = null) => ContinueWith<object>(code, options); /// <summary> /// Continues the script with given code snippet. /// </summary> public Script<TResult> ContinueWith<TResult>(string code, ScriptOptions options = null) { options = options ?? InheritOptions(Options); return new Script<TResult>(Compiler, Builder, SourceText.From(code ?? "", options.FileEncoding), options, GlobalsType, this); } /// <summary> /// Continues the script with given <see cref="Stream"/> representing code. /// </summary> /// <exception cref="ArgumentNullException">Stream is null.</exception> /// <exception cref="ArgumentException">Stream is not readable or seekable.</exception> public Script<TResult> ContinueWith<TResult>(Stream code, ScriptOptions options = null) { if (code == null) throw new ArgumentNullException(nameof(code)); options = options ?? InheritOptions(Options); return new Script<TResult>(Compiler, Builder, SourceText.From(code, options.FileEncoding), options, GlobalsType, this); } private static ScriptOptions InheritOptions(ScriptOptions previous) { // don't inherit references or imports, they have already been applied: return previous. WithReferences(ImmutableArray<MetadataReference>.Empty). WithImports(ImmutableArray<string>.Empty); } /// <summary> /// Get's the <see cref="Compilation"/> that represents the semantics of the script. /// </summary> public Compilation GetCompilation() { if (_lazyCompilation == null) { var compilation = Compiler.CreateSubmission(this); Interlocked.CompareExchange(ref _lazyCompilation, compilation, null); } return _lazyCompilation; } /// <summary> /// Runs the script from the beginning and returns the result of the last code snippet. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values of global variables accessible from the script. /// Must be specified if and only if the script was created with a <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>The result of the last code snippet.</returns> internal Task<object> EvaluateAsync(object globals = null, CancellationToken cancellationToken = default(CancellationToken)) => CommonEvaluateAsync(globals, cancellationToken); internal abstract Task<object> CommonEvaluateAsync(object globals, CancellationToken cancellationToken); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunAsync(object globals, CancellationToken cancellationToken) => CommonRunAsync(globals, null, cancellationToken); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunAsync(object globals = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) => CommonRunAsync(globals, catchException, cancellationToken); internal abstract Task<ScriptState> CommonRunAsync(object globals, Func<Exception, bool> catchException, CancellationToken cancellationToken); /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunFromAsync(ScriptState previousState, CancellationToken cancellationToken) => CommonRunFromAsync(previousState, null, cancellationToken); /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunFromAsync(ScriptState previousState, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) => CommonRunFromAsync(previousState, catchException, cancellationToken); internal abstract Task<ScriptState> CommonRunFromAsync(ScriptState previousState, Func<Exception, bool> catchException, CancellationToken cancellationToken); /// <summary> /// Forces the script through the compilation step. /// If not called directly, the compilation step will occur on the first call to Run. /// </summary> public ImmutableArray<Diagnostic> Compile(CancellationToken cancellationToken = default(CancellationToken)) => CommonCompile(cancellationToken); internal abstract ImmutableArray<Diagnostic> CommonCompile(CancellationToken cancellationToken); internal abstract Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken); // Apply recursive alias <host> to the host assembly reference, so that we hide its namespaces and global types behind it. internal static readonly MetadataReferenceProperties HostAssemblyReferenceProperties = MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("<host>")).WithRecursiveAliases(true); /// <summary> /// Gets the references that need to be assigned to the compilation. /// This can be different than the list of references defined by the <see cref="ScriptOptions"/> instance. /// </summary> internal ImmutableArray<MetadataReference> GetReferencesForCompilation( CommonMessageProvider messageProvider, DiagnosticBag diagnostics, MetadataReference languageRuntimeReferenceOpt = null) { var resolver = Options.MetadataResolver; var references = ArrayBuilder<MetadataReference>.GetInstance(); try { if (Previous == null) { var corLib = MetadataReference.CreateFromAssemblyInternal(typeof(object).GetTypeInfo().Assembly); references.Add(corLib); if (GlobalsType != null) { var globalsAssembly = GlobalsType.GetTypeInfo().Assembly; // If the assembly doesn't have metadata (it's an in-memory or dynamic assembly), // the host has to add reference to the metadata where globals type is located explicitly. if (MetadataReference.HasMetadata(globalsAssembly)) { references.Add(MetadataReference.CreateFromAssemblyInternal(globalsAssembly, HostAssemblyReferenceProperties)); } } if (languageRuntimeReferenceOpt != null) { references.Add(languageRuntimeReferenceOpt); } } // add new references: foreach (var reference in Options.MetadataReferences) { if (reference is UnresolvedMetadataReference unresolved) { var resolved = resolver.ResolveReference(unresolved.Reference, null, unresolved.Properties); if (resolved.IsDefault) { diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MetadataFileNotFound, Location.None, unresolved.Reference)); } else { references.AddRange(resolved); } } else { references.Add(reference); } } return references.ToImmutable(); } finally { references.Free(); } } // TODO: remove internal bool HasReturnValue() { return GetCompilation().HasSubmissionResult(); } } public sealed class Script<T> : Script { private ImmutableArray<Func<object[], Task>> _lazyPrecedingExecutors; private Func<object[], Task<T>> _lazyExecutor; internal Script(ScriptCompiler compiler, ScriptBuilder builder, SourceText sourceText, ScriptOptions options, Type globalsTypeOpt, Script previousOpt) : base(compiler, builder, sourceText, options, globalsTypeOpt, previousOpt) { } public override Type ReturnType => typeof(T); public new Script<T> WithOptions(ScriptOptions options) { return (options == Options) ? this : new Script<T>(Compiler, Builder, SourceText, options, GlobalsType, Previous); } internal override Script WithOptionsInternal(ScriptOptions options) => WithOptions(options); internal override ImmutableArray<Diagnostic> CommonCompile(CancellationToken cancellationToken) { // TODO: avoid throwing exception, report all diagnostics https://github.com/dotnet/roslyn/issues/5949 try { GetPrecedingExecutors(cancellationToken); GetExecutor(cancellationToken); return ImmutableArray.CreateRange(GetCompilation().GetDiagnostics(cancellationToken).Where(d => d.Severity == DiagnosticSeverity.Warning)); } catch (CompilationErrorException e) { return ImmutableArray.CreateRange(e.Diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error || d.Severity == DiagnosticSeverity.Warning)); } } internal override Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken) => GetExecutor(cancellationToken); internal override Task<object> CommonEvaluateAsync(object globals, CancellationToken cancellationToken) => EvaluateAsync(globals, cancellationToken).CastAsync<T, object>(); internal override Task<ScriptState> CommonRunAsync(object globals, Func<Exception, bool> catchException, CancellationToken cancellationToken) => RunAsync(globals, catchException, cancellationToken).CastAsync<ScriptState<T>, ScriptState>(); internal override Task<ScriptState> CommonRunFromAsync(ScriptState previousState, Func<Exception, bool> catchException, CancellationToken cancellationToken) => RunFromAsync(previousState, catchException, cancellationToken).CastAsync<ScriptState<T>, ScriptState>(); /// <exception cref="CompilationErrorException">Compilation has errors.</exception> private Func<object[], Task<T>> GetExecutor(CancellationToken cancellationToken) { if (_lazyExecutor == null) { Interlocked.CompareExchange(ref _lazyExecutor, Builder.CreateExecutor<T>(Compiler, GetCompilation(), Options.EmitDebugInformation, cancellationToken), null); } return _lazyExecutor; } /// <exception cref="CompilationErrorException">Compilation has errors.</exception> private ImmutableArray<Func<object[], Task>> GetPrecedingExecutors(CancellationToken cancellationToken) { if (_lazyPrecedingExecutors.IsDefault) { var preceding = TryGetPrecedingExecutors(null, cancellationToken); Debug.Assert(!preceding.IsDefault); InterlockedOperations.Initialize(ref _lazyPrecedingExecutors, preceding); } return _lazyPrecedingExecutors; } /// <exception cref="CompilationErrorException">Compilation has errors.</exception> private ImmutableArray<Func<object[], Task>> TryGetPrecedingExecutors(Script lastExecutedScriptInChainOpt, CancellationToken cancellationToken) { Script script = Previous; if (script == lastExecutedScriptInChainOpt) { return ImmutableArray<Func<object[], Task>>.Empty; } var scriptsReversed = ArrayBuilder<Script>.GetInstance(); while (script != null && script != lastExecutedScriptInChainOpt) { scriptsReversed.Add(script); script = script.Previous; } if (lastExecutedScriptInChainOpt != null && script != lastExecutedScriptInChainOpt) { scriptsReversed.Free(); return default(ImmutableArray<Func<object[], Task>>); } var executors = ArrayBuilder<Func<object[], Task>>.GetInstance(scriptsReversed.Count); // We need to build executors in the order in which they are chained, // so that assemblies created for the submissions are loaded in the correct order. for (int i = scriptsReversed.Count - 1; i >= 0; i--) { executors.Add(scriptsReversed[i].CommonGetExecutor(cancellationToken)); } return executors.ToImmutableAndFree(); } /// <summary> /// Runs the script from the beginning and returns the result of the last code snippet. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values of global variables accessible from the script. /// Must be specified if and only if the script was created with a <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>The result of the last code snippet.</returns> internal new Task<T> EvaluateAsync(object globals = null, CancellationToken cancellationToken = default(CancellationToken)) => RunAsync(globals, cancellationToken).GetEvaluationResultAsync(); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="CompilationErrorException">Compilation has errors.</exception> /// <exception cref="ArgumentException">The type of <paramref name="globals"/> doesn't match <see cref="Script.GlobalsType"/>.</exception> public new Task<ScriptState<T>> RunAsync(object globals, CancellationToken cancellationToken) => RunAsync(globals, null, cancellationToken); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="CompilationErrorException">Compilation has errors.</exception> /// <exception cref="ArgumentException">The type of <paramref name="globals"/> doesn't match <see cref="Script.GlobalsType"/>.</exception> public new Task<ScriptState<T>> RunAsync(object globals = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) { // The following validation and executor construction may throw; // do so synchronously so that the exception is not wrapped in the task. ValidateGlobals(globals, GlobalsType); var executionState = ScriptExecutionState.Create(globals); var precedingExecutors = GetPrecedingExecutors(cancellationToken); var currentExecutor = GetExecutor(cancellationToken); return RunSubmissionsAsync(executionState, precedingExecutors, currentExecutor, catchException, cancellationToken); } /// <summary> /// Creates a delegate that will run this script from the beginning when invoked. /// </summary> /// <remarks> /// The delegate doesn't hold on this script or its compilation. /// </remarks> public ScriptRunner<T> CreateDelegate(CancellationToken cancellationToken = default(CancellationToken)) { var precedingExecutors = GetPrecedingExecutors(cancellationToken); var currentExecutor = GetExecutor(cancellationToken); var globalsType = GlobalsType; return (globals, token) => { ValidateGlobals(globals, globalsType); return ScriptExecutionState.Create(globals).RunSubmissionsAsync<T>(precedingExecutors, currentExecutor, null, null, token); }; } /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="ArgumentNullException"><paramref name="previousState"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="previousState"/> is not a previous execution state of this script.</exception> public new Task<ScriptState<T>> RunFromAsync(ScriptState previousState, CancellationToken cancellationToken) => RunFromAsync(previousState, null, cancellationToken); /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="ArgumentNullException"><paramref name="previousState"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="previousState"/> is not a previous execution state of this script.</exception> public new Task<ScriptState<T>> RunFromAsync(ScriptState previousState, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) { // The following validation and executor construction may throw; // do so synchronously so that the exception is not wrapped in the task. if (previousState == null) { throw new ArgumentNullException(nameof(previousState)); } if (previousState.Script == this) { // this state is already the output of running this script. return Task.FromResult((ScriptState<T>)previousState); } var precedingExecutors = TryGetPrecedingExecutors(previousState.Script, cancellationToken); if (precedingExecutors.IsDefault) { throw new ArgumentException(ScriptingResources.StartingStateIncompatible, nameof(previousState)); } var currentExecutor = GetExecutor(cancellationToken); ScriptExecutionState newExecutionState = previousState.ExecutionState.FreezeAndClone(); return RunSubmissionsAsync(newExecutionState, precedingExecutors, currentExecutor, catchException, cancellationToken); } private async Task<ScriptState<T>> RunSubmissionsAsync( ScriptExecutionState executionState, ImmutableArray<Func<object[], Task>> precedingExecutors, Func<object[], Task> currentExecutor, Func<Exception, bool> catchExceptionOpt, CancellationToken cancellationToken) { var exceptionOpt = (catchExceptionOpt != null) ? new StrongBox<Exception>() : null; T result = await executionState.RunSubmissionsAsync<T>(precedingExecutors, currentExecutor, exceptionOpt, catchExceptionOpt, cancellationToken).ConfigureAwait(continueOnCapturedContext: false); return new ScriptState<T>(executionState, this, result, exceptionOpt?.Value); } private static void ValidateGlobals(object globals, Type globalsType) { if (globalsType != null) { if (globals == null) { throw new ArgumentException(ScriptingResources.ScriptRequiresGlobalVariables, nameof(globals)); } var runtimeType = globals.GetType().GetTypeInfo(); var globalsTypeInfo = globalsType.GetTypeInfo(); if (!globalsTypeInfo.IsAssignableFrom(runtimeType)) { throw new ArgumentException(string.Format(ScriptingResources.GlobalsNotAssignable, runtimeType, globalsTypeInfo), nameof(globals)); } } else if (globals != null) { throw new ArgumentException(ScriptingResources.GlobalVariablesWithoutGlobalType, nameof(globals)); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable #pragma warning disable RS0026 // Do not add multiple public overloads with optional parameters using System; using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Reflection; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis; using Roslyn.Utilities; using Microsoft.CodeAnalysis.Scripting.Hosting; using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.Text; using System.IO; namespace Microsoft.CodeAnalysis.Scripting { /// <summary> /// A class that represents a script that you can run. /// /// Create a script using a language specific script class such as CSharpScript or VisualBasicScript. /// </summary> public abstract class Script { internal readonly ScriptCompiler Compiler; internal readonly ScriptBuilder Builder; private Compilation _lazyCompilation; internal Script(ScriptCompiler compiler, ScriptBuilder builder, SourceText sourceText, ScriptOptions options, Type globalsTypeOpt, Script previousOpt) { Debug.Assert(sourceText != null); Debug.Assert(options != null); Debug.Assert(compiler != null); Debug.Assert(builder != null); Compiler = compiler; Builder = builder; Previous = previousOpt; SourceText = sourceText; Options = options; GlobalsType = globalsTypeOpt; } internal static Script<T> CreateInitialScript<T>(ScriptCompiler compiler, SourceText sourceText, ScriptOptions optionsOpt, Type globalsTypeOpt, InteractiveAssemblyLoader assemblyLoaderOpt) { return new Script<T>(compiler, new ScriptBuilder(assemblyLoaderOpt ?? new InteractiveAssemblyLoader()), sourceText, optionsOpt ?? ScriptOptions.Default, globalsTypeOpt, previousOpt: null); } /// <summary> /// A script that will run first when this script is run. /// Any declarations made in the previous script can be referenced in this script. /// The end state from running this script includes all declarations made by both scripts. /// </summary> public Script Previous { get; } /// <summary> /// The options used by this script. /// </summary> public ScriptOptions Options { get; } /// <summary> /// The source code of the script. /// </summary> public string Code => SourceText.ToString(); /// <summary> /// The <see cref="SourceText"/> of the script. /// </summary> internal SourceText SourceText { get; } /// <summary> /// The type of an object whose members can be accessed by the script as global variables. /// </summary> public Type GlobalsType { get; } /// <summary> /// The expected return type of the script. /// </summary> public abstract Type ReturnType { get; } /// <summary> /// Creates a new version of this script with the specified options. /// </summary> public Script WithOptions(ScriptOptions options) => WithOptionsInternal(options); internal abstract Script WithOptionsInternal(ScriptOptions options); /// <summary> /// Continues the script with given code snippet. /// </summary> public Script<object> ContinueWith(string code, ScriptOptions options = null) => ContinueWith<object>(code, options); /// <summary> /// Continues the script with given <see cref="Stream"/> representing code. /// </summary> /// <exception cref="ArgumentNullException">Stream is null.</exception> /// <exception cref="ArgumentException">Stream is not readable or seekable.</exception> public Script<object> ContinueWith(Stream code, ScriptOptions options = null) => ContinueWith<object>(code, options); /// <summary> /// Continues the script with given code snippet. /// </summary> public Script<TResult> ContinueWith<TResult>(string code, ScriptOptions options = null) { options = options ?? InheritOptions(Options); return new Script<TResult>(Compiler, Builder, SourceText.From(code ?? "", options.FileEncoding), options, GlobalsType, this); } /// <summary> /// Continues the script with given <see cref="Stream"/> representing code. /// </summary> /// <exception cref="ArgumentNullException">Stream is null.</exception> /// <exception cref="ArgumentException">Stream is not readable or seekable.</exception> public Script<TResult> ContinueWith<TResult>(Stream code, ScriptOptions options = null) { if (code == null) throw new ArgumentNullException(nameof(code)); options = options ?? InheritOptions(Options); return new Script<TResult>(Compiler, Builder, SourceText.From(code, options.FileEncoding), options, GlobalsType, this); } private static ScriptOptions InheritOptions(ScriptOptions previous) { // don't inherit references or imports, they have already been applied: return previous. WithReferences(ImmutableArray<MetadataReference>.Empty). WithImports(ImmutableArray<string>.Empty); } /// <summary> /// Get's the <see cref="Compilation"/> that represents the semantics of the script. /// </summary> public Compilation GetCompilation() { if (_lazyCompilation == null) { var compilation = Compiler.CreateSubmission(this); Interlocked.CompareExchange(ref _lazyCompilation, compilation, null); } return _lazyCompilation; } /// <summary> /// Runs the script from the beginning and returns the result of the last code snippet. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values of global variables accessible from the script. /// Must be specified if and only if the script was created with a <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>The result of the last code snippet.</returns> internal Task<object> EvaluateAsync(object globals = null, CancellationToken cancellationToken = default(CancellationToken)) => CommonEvaluateAsync(globals, cancellationToken); internal abstract Task<object> CommonEvaluateAsync(object globals, CancellationToken cancellationToken); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunAsync(object globals, CancellationToken cancellationToken) => CommonRunAsync(globals, null, cancellationToken); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunAsync(object globals = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) => CommonRunAsync(globals, catchException, cancellationToken); internal abstract Task<ScriptState> CommonRunAsync(object globals, Func<Exception, bool> catchException, CancellationToken cancellationToken); /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunFromAsync(ScriptState previousState, CancellationToken cancellationToken) => CommonRunFromAsync(previousState, null, cancellationToken); /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> public Task<ScriptState> RunFromAsync(ScriptState previousState, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) => CommonRunFromAsync(previousState, catchException, cancellationToken); internal abstract Task<ScriptState> CommonRunFromAsync(ScriptState previousState, Func<Exception, bool> catchException, CancellationToken cancellationToken); /// <summary> /// Forces the script through the compilation step. /// If not called directly, the compilation step will occur on the first call to Run. /// </summary> public ImmutableArray<Diagnostic> Compile(CancellationToken cancellationToken = default(CancellationToken)) => CommonCompile(cancellationToken); internal abstract ImmutableArray<Diagnostic> CommonCompile(CancellationToken cancellationToken); internal abstract Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken); // Apply recursive alias <host> to the host assembly reference, so that we hide its namespaces and global types behind it. internal static readonly MetadataReferenceProperties HostAssemblyReferenceProperties = MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("<host>")).WithRecursiveAliases(true); /// <summary> /// Gets the references that need to be assigned to the compilation. /// This can be different than the list of references defined by the <see cref="ScriptOptions"/> instance. /// </summary> internal ImmutableArray<MetadataReference> GetReferencesForCompilation( CommonMessageProvider messageProvider, DiagnosticBag diagnostics, MetadataReference languageRuntimeReferenceOpt = null) { var resolver = Options.MetadataResolver; var references = ArrayBuilder<MetadataReference>.GetInstance(); try { if (Previous == null) { var corLib = MetadataReference.CreateFromAssemblyInternal(typeof(object).GetTypeInfo().Assembly); references.Add(corLib); if (GlobalsType != null) { var globalsAssembly = GlobalsType.GetTypeInfo().Assembly; // If the assembly doesn't have metadata (it's an in-memory or dynamic assembly), // the host has to add reference to the metadata where globals type is located explicitly. if (MetadataReference.HasMetadata(globalsAssembly)) { references.Add(MetadataReference.CreateFromAssemblyInternal(globalsAssembly, HostAssemblyReferenceProperties)); } } if (languageRuntimeReferenceOpt != null) { references.Add(languageRuntimeReferenceOpt); } } // add new references: foreach (var reference in Options.MetadataReferences) { if (reference is UnresolvedMetadataReference unresolved) { var resolved = resolver.ResolveReference(unresolved.Reference, null, unresolved.Properties); if (resolved.IsDefault) { diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MetadataFileNotFound, Location.None, unresolved.Reference)); } else { references.AddRange(resolved); } } else { references.Add(reference); } } return references.ToImmutable(); } finally { references.Free(); } } // TODO: remove internal bool HasReturnValue() { return GetCompilation().HasSubmissionResult(); } } public sealed class Script<T> : Script { private ImmutableArray<Func<object[], Task>> _lazyPrecedingExecutors; private Func<object[], Task<T>> _lazyExecutor; internal Script(ScriptCompiler compiler, ScriptBuilder builder, SourceText sourceText, ScriptOptions options, Type globalsTypeOpt, Script previousOpt) : base(compiler, builder, sourceText, options, globalsTypeOpt, previousOpt) { } public override Type ReturnType => typeof(T); public new Script<T> WithOptions(ScriptOptions options) { return (options == Options) ? this : new Script<T>(Compiler, Builder, SourceText, options, GlobalsType, Previous); } internal override Script WithOptionsInternal(ScriptOptions options) => WithOptions(options); internal override ImmutableArray<Diagnostic> CommonCompile(CancellationToken cancellationToken) { // TODO: avoid throwing exception, report all diagnostics https://github.com/dotnet/roslyn/issues/5949 try { GetPrecedingExecutors(cancellationToken); GetExecutor(cancellationToken); return ImmutableArray.CreateRange(GetCompilation().GetDiagnostics(cancellationToken).Where(d => d.Severity == DiagnosticSeverity.Warning)); } catch (CompilationErrorException e) { return ImmutableArray.CreateRange(e.Diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error || d.Severity == DiagnosticSeverity.Warning)); } } internal override Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken) => GetExecutor(cancellationToken); internal override Task<object> CommonEvaluateAsync(object globals, CancellationToken cancellationToken) => EvaluateAsync(globals, cancellationToken).CastAsync<T, object>(); internal override Task<ScriptState> CommonRunAsync(object globals, Func<Exception, bool> catchException, CancellationToken cancellationToken) => RunAsync(globals, catchException, cancellationToken).CastAsync<ScriptState<T>, ScriptState>(); internal override Task<ScriptState> CommonRunFromAsync(ScriptState previousState, Func<Exception, bool> catchException, CancellationToken cancellationToken) => RunFromAsync(previousState, catchException, cancellationToken).CastAsync<ScriptState<T>, ScriptState>(); /// <exception cref="CompilationErrorException">Compilation has errors.</exception> private Func<object[], Task<T>> GetExecutor(CancellationToken cancellationToken) { if (_lazyExecutor == null) { Interlocked.CompareExchange(ref _lazyExecutor, Builder.CreateExecutor<T>(Compiler, GetCompilation(), Options.EmitDebugInformation, cancellationToken), null); } return _lazyExecutor; } /// <exception cref="CompilationErrorException">Compilation has errors.</exception> private ImmutableArray<Func<object[], Task>> GetPrecedingExecutors(CancellationToken cancellationToken) { if (_lazyPrecedingExecutors.IsDefault) { var preceding = TryGetPrecedingExecutors(null, cancellationToken); Debug.Assert(!preceding.IsDefault); InterlockedOperations.Initialize(ref _lazyPrecedingExecutors, preceding); } return _lazyPrecedingExecutors; } /// <exception cref="CompilationErrorException">Compilation has errors.</exception> private ImmutableArray<Func<object[], Task>> TryGetPrecedingExecutors(Script lastExecutedScriptInChainOpt, CancellationToken cancellationToken) { Script script = Previous; if (script == lastExecutedScriptInChainOpt) { return ImmutableArray<Func<object[], Task>>.Empty; } var scriptsReversed = ArrayBuilder<Script>.GetInstance(); while (script != null && script != lastExecutedScriptInChainOpt) { scriptsReversed.Add(script); script = script.Previous; } if (lastExecutedScriptInChainOpt != null && script != lastExecutedScriptInChainOpt) { scriptsReversed.Free(); return default(ImmutableArray<Func<object[], Task>>); } var executors = ArrayBuilder<Func<object[], Task>>.GetInstance(scriptsReversed.Count); // We need to build executors in the order in which they are chained, // so that assemblies created for the submissions are loaded in the correct order. for (int i = scriptsReversed.Count - 1; i >= 0; i--) { executors.Add(scriptsReversed[i].CommonGetExecutor(cancellationToken)); } return executors.ToImmutableAndFree(); } /// <summary> /// Runs the script from the beginning and returns the result of the last code snippet. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values of global variables accessible from the script. /// Must be specified if and only if the script was created with a <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>The result of the last code snippet.</returns> internal new Task<T> EvaluateAsync(object globals = null, CancellationToken cancellationToken = default(CancellationToken)) => RunAsync(globals, cancellationToken).GetEvaluationResultAsync(); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="CompilationErrorException">Compilation has errors.</exception> /// <exception cref="ArgumentException">The type of <paramref name="globals"/> doesn't match <see cref="Script.GlobalsType"/>.</exception> public new Task<ScriptState<T>> RunAsync(object globals, CancellationToken cancellationToken) => RunAsync(globals, null, cancellationToken); /// <summary> /// Runs the script from the beginning. /// </summary> /// <param name="globals"> /// An instance of <see cref="Script.GlobalsType"/> holding on values for global variables accessible from the script. /// Must be specified if and only if the script was created with <see cref="Script.GlobalsType"/>. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="CompilationErrorException">Compilation has errors.</exception> /// <exception cref="ArgumentException">The type of <paramref name="globals"/> doesn't match <see cref="Script.GlobalsType"/>.</exception> public new Task<ScriptState<T>> RunAsync(object globals = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) { // The following validation and executor construction may throw; // do so synchronously so that the exception is not wrapped in the task. ValidateGlobals(globals, GlobalsType); var executionState = ScriptExecutionState.Create(globals); var precedingExecutors = GetPrecedingExecutors(cancellationToken); var currentExecutor = GetExecutor(cancellationToken); return RunSubmissionsAsync(executionState, precedingExecutors, currentExecutor, catchException, cancellationToken); } /// <summary> /// Creates a delegate that will run this script from the beginning when invoked. /// </summary> /// <remarks> /// The delegate doesn't hold on this script or its compilation. /// </remarks> public ScriptRunner<T> CreateDelegate(CancellationToken cancellationToken = default(CancellationToken)) { var precedingExecutors = GetPrecedingExecutors(cancellationToken); var currentExecutor = GetExecutor(cancellationToken); var globalsType = GlobalsType; return (globals, token) => { ValidateGlobals(globals, globalsType); return ScriptExecutionState.Create(globals).RunSubmissionsAsync<T>(precedingExecutors, currentExecutor, null, null, token); }; } /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="ArgumentNullException"><paramref name="previousState"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="previousState"/> is not a previous execution state of this script.</exception> public new Task<ScriptState<T>> RunFromAsync(ScriptState previousState, CancellationToken cancellationToken) => RunFromAsync(previousState, null, cancellationToken); /// <summary> /// Run the script from the specified state. /// </summary> /// <param name="previousState"> /// Previous state of the script execution. /// </param> /// <param name="catchException"> /// If specified, any exception thrown by the script top-level code is passed to <paramref name="catchException"/>. /// If it returns true the exception is caught and stored on the resulting <see cref="ScriptState"/>, otherwise the exception is propagated to the caller. /// </param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="ScriptState"/> that represents the state after running the script, including all declared variables and return value.</returns> /// <exception cref="ArgumentNullException"><paramref name="previousState"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="previousState"/> is not a previous execution state of this script.</exception> public new Task<ScriptState<T>> RunFromAsync(ScriptState previousState, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken)) { // The following validation and executor construction may throw; // do so synchronously so that the exception is not wrapped in the task. if (previousState == null) { throw new ArgumentNullException(nameof(previousState)); } if (previousState.Script == this) { // this state is already the output of running this script. return Task.FromResult((ScriptState<T>)previousState); } var precedingExecutors = TryGetPrecedingExecutors(previousState.Script, cancellationToken); if (precedingExecutors.IsDefault) { throw new ArgumentException(ScriptingResources.StartingStateIncompatible, nameof(previousState)); } var currentExecutor = GetExecutor(cancellationToken); ScriptExecutionState newExecutionState = previousState.ExecutionState.FreezeAndClone(); return RunSubmissionsAsync(newExecutionState, precedingExecutors, currentExecutor, catchException, cancellationToken); } private async Task<ScriptState<T>> RunSubmissionsAsync( ScriptExecutionState executionState, ImmutableArray<Func<object[], Task>> precedingExecutors, Func<object[], Task> currentExecutor, Func<Exception, bool> catchExceptionOpt, CancellationToken cancellationToken) { var exceptionOpt = (catchExceptionOpt != null) ? new StrongBox<Exception>() : null; T result = await executionState.RunSubmissionsAsync<T>(precedingExecutors, currentExecutor, exceptionOpt, catchExceptionOpt, cancellationToken).ConfigureAwait(continueOnCapturedContext: false); return new ScriptState<T>(executionState, this, result, exceptionOpt?.Value); } private static void ValidateGlobals(object globals, Type globalsType) { if (globalsType != null) { if (globals == null) { throw new ArgumentException(ScriptingResources.ScriptRequiresGlobalVariables, nameof(globals)); } var runtimeType = globals.GetType().GetTypeInfo(); var globalsTypeInfo = globalsType.GetTypeInfo(); if (!globalsTypeInfo.IsAssignableFrom(runtimeType)) { throw new ArgumentException(string.Format(ScriptingResources.GlobalsNotAssignable, runtimeType, globalsTypeInfo), nameof(globals)); } } else if (globals != null) { throw new ArgumentException(ScriptingResources.GlobalVariablesWithoutGlobalType, nameof(globals)); } } } }
-1