345 references to First
ApplicationModelWebSite (1)
Controllers\HomeController.cs (1)
44var selector = model.Selectors.First(f => f.AttributeRouteModel.Template == "Home/CannotBeRouted");
Aspire.Hosting.Azure.Tests (3)
AzureWebPubSubExtensionsTests.cs (3)
121var hub = infrastructure.GetProvisionableResources().OfType<WebPubSubHub>().First(i => i.BicepIdentifier == hubName); 282var hub = infrastructure.GetProvisionableResources().OfType<WebPubSubHub>().First(i => string.Equals(i.BicepIdentifier, "abc", StringComparison.OrdinalIgnoreCase)); 360var hub = infrastructure.GetProvisionableResources().OfType<WebPubSubHub>().First(i => i.BicepIdentifier == "hub1");
Aspire.Workload.Tests (6)
StarterTemplateRunTestsBase.cs (4)
48string url = resourceRows.First(r => r.Name == "webfrontend") 49.Endpoints.First(e => e.StartsWith(urlPrefix)); 65string url = resourceRows.First(r => r.Name == "apiservice") 66.Endpoints.First(e => e.StartsWith(urlPrefix));
WorkloadTestsBase.cs (2)
299string apiServiceUrl = resourceRows.First(r => r.Name == "apiservice").Endpoints[0]; 302string webFrontEnd = resourceRows.First(r => r.Name == "webfrontend").Endpoints[0];
Binding.Http.IntegrationTests (1)
BasicHttpBindingTests.4.0.0.cs (1)
388new EndpointAddress(app.Urls.First(u => u.StartsWith("http:"))));
CSharpSyntaxGenerator (2)
SourceWriter.cs (2)
1632return nd.Fields.First(f => IsAnyNodeList(f.Type) && !IsAttributeOrModifiersList(f)); 1640return nd.Fields.First(f => IsNode(f.Type) && f.Type != "SyntaxToken");
IdeCoreBenchmarks (2)
ClassificationBenchmarks.cs (1)
96var project = _solution.Projects.First(p => p.AssemblyName == "Microsoft.CodeAnalysis");
FindReferencesBenchmarks.cs (1)
93var project = _solution.Projects.First(p => p.AssemblyName == "Microsoft.CodeAnalysis");
IIS.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\LoggingTests.cs (2)
317var aspnetcorev2Log = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2. Commit:")); 318var aspnetcoreHandlerLog = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2 Request Handler. Commit:"));
IISExpress.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\LoggingTests.cs (2)
317var aspnetcorev2Log = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2. Commit:")); 318var aspnetcoreHandlerLog = TestSink.Writes.First(w => w.Message.Contains("Description: IIS ASP.NET Core Module V2 Request Handler. Commit:"));
illink (1)
InteropClient (4)
InteropClient.cs (4)
582Assert.AreEqual("test_initial_metadata_value", responseHeaders.First((entry) => entry.Key == "x-grpc-test-echo-initial").Value); 583CollectionAssert.AreEqual(new byte[] { 0xab, 0xab, 0xab }, responseTrailers.First((entry) => entry.Key == "x-grpc-test-echo-trailing-bin").ValueBytes); 603Assert.AreEqual("test_initial_metadata_value", responseHeaders.First((entry) => entry.Key == "x-grpc-test-echo-initial").Value); 604CollectionAssert.AreEqual(new byte[] { 0xab, 0xab, 0xab }, responseTrailers.First((entry) => entry.Key == "x-grpc-test-echo-trailing-bin").ValueBytes);
Microsoft.Arcade.Test.Common (1)
AssertEx.cs (1)
270ToString(actual.First(predicate)),
Microsoft.AspNetCore.AsyncState.Tests (2)
AsyncStateHttpContextExtensionsTests.cs (2)
28var serviceDescriptor = services.First(x => x.ServiceType == typeof(IHttpContextAccessor)); 31serviceDescriptor = services.First(x => x.ServiceType == typeof(IAsyncContext<>));
Microsoft.AspNetCore.Components.Tests (48)
RendererTest.cs (48)
555.First(frame => frame.AttributeValue != null) 585.First(frame => frame.AttributeValue != null) 613.First(frame => frame.AttributeValue != null) 636.First(frame => frame.AttributeValue != null) 659.First(frame => frame.AttributeValue != null) 682.First(frame => frame.AttributeValue != null) 708.First(frame => frame.AttributeValue != null) 739.First(frame => frame.AttributeValue != null) 768.First(frame => frame.AttributeValue != null) 808.First(frame => frame.AttributeValue != null) 846.First(frame => frame.AttributeValue != null) 889.First(frame => frame.AttributeValue != null) 932.First(frame => frame.AttributeValue != null) 986.First(frame => frame.AttributeValue != null) 1034.First(frame => frame.AttributeName == "onclickaction") 1078.First(frame => frame.AttributeName == "onclickaction") 1117.First(frame => frame.AttributeName == "onclick") 1158.First(frame => frame.AttributeName == "onclick") 1200.First(frame => frame.AttributeName == "onclick") 1236.First(frame => frame.AttributeName == "onclick") 1277.First(frame => frame.AttributeName == "onclick") 1319.First(frame => frame.AttributeName == "onclick") 1354.First(frame => frame.AttributeName == "onclickaction") 1386.First(frame => frame.AttributeName == "onclick") 1420.First(frame => frame.AttributeName == "onclick") 1455.First(frame => frame.AttributeName == "onclickaction") 1487.First(frame => frame.AttributeName == "onclick") 1522.First(frame => frame.AttributeName == "onclick") 1557.First(frame => frame.AttributeName == "onclickaction") 1589.First(frame => frame.AttributeName == "onclick") 1624.First(frame => frame.AttributeName == "onclick") 1661.First(frame => frame.AttributeName == "onclickaction") 1696.First(frame => frame.AttributeName == "onclick") 1734.First(frame => frame.AttributeName == "onclick") 1773.First(frame => frame.AttributeName == "onclickaction") 1811.First(frame => frame.AttributeName == "onclick") 1852.First(frame => frame.AttributeName == "onclick") 1893.First(frame => frame.AttributeName == "onclickaction") 1930.First(frame => frame.AttributeName == "onclick") 1970.First(frame => frame.AttributeName == "onclick") 3090.First(frame => frame.FrameType == RenderTreeFrameType.Attribute && frame.AttributeEventHandlerId != 0) 3132.First(frame => frame.FrameType == RenderTreeFrameType.Attribute && frame.AttributeEventHandlerId != 0) 3171.First(frame => frame.FrameType == RenderTreeFrameType.Attribute && frame.AttributeEventHandlerId != 0) 3211.First(frame => frame.FrameType == RenderTreeFrameType.Attribute && frame.AttributeEventHandlerId != 0) 3251.First(frame => frame.FrameType == RenderTreeFrameType.Attribute && frame.AttributeEventHandlerId != 0) 3507.First(frame => frame.AttributeValue != null) 4335.First(frame => frame.FrameType == RenderTreeFrameType.Attribute && frame.AttributeEventHandlerId > 0) 4383.First(frame => frame.FrameType == RenderTreeFrameType.Attribute && frame.AttributeEventHandlerId > 0)
Microsoft.AspNetCore.Diagnostics.Tests (1)
StatusCodeMiddlewareTest.cs (1)
63Assert.Equal(expectedUri, response.Headers.First(s => s.Key == "Location").Value.First());
Microsoft.AspNetCore.JsonPatch (1)
JsonPatchDocumentOfT.cs (1)
719.First(jsonProperty => jsonProperty.UnderlyingName == memberExpression.Member.Name)
Microsoft.AspNetCore.Mvc.Core.Test (3)
Formatters\JsonOutputFormatterTestBase.cs (1)
204.First((e) => e.WebName.Equals(encodingAsString, StringComparison.OrdinalIgnoreCase));
Infrastructure\ControllerActionInvokerTest.cs (1)
1389.First(m => m.Name.Equals("ActionMethodWithDefaultValues", StringComparison.Ordinal)),
ModelBinding\Validation\ClientValidatorCacheTest.cs (1)
73var parameter = metadata.BoundConstructor.BoundConstructorParameters.First(f => f.Name == nameof(TestRecordType.Property1));
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (1)
src\Mvc\Mvc.Core\test\Formatters\JsonOutputFormatterTestBase.cs (1)
204.First((e) => e.WebName.Equals(encodingAsString, StringComparison.OrdinalIgnoreCase));
Microsoft.AspNetCore.Shared.Tests (2)
PropertyHelperTest.cs (2)
66instance.GetType()).First(prop => prop.Name == "PropA"); 82instance.GetType()).First(prop => prop.Name == "PropA");
Microsoft.Build (2)
BuildCheck\Infrastructure\BuildEventsProcessor.cs (1)
247: configPerRule.First(r =>
Graph\ProjectGraph.cs (1)
691ProjectGraphNode GetNodeForProject(ProjectInSolution project) => EntryPointNodes.First(node => string.Equals(node.ProjectInstance.FullPath, project.AbsolutePath));
Microsoft.Build.Engine.OM.UnitTests (10)
Construction\SolutionFile_Tests.cs (10)
192ProjectInSolution consoleApplication1 = solution.ProjectsInOrder.First(p => p.ProjectName == "ConsoleApplication1"); 197ProjectInSolution vbClassLibrary = solution.ProjectsInOrder.First(p => p.ProjectName == "vbClassLibrary"); 202ProjectInSolution classLibrary1 = solution.ProjectsInOrder.First(p => p.ProjectName == "ClassLibrary1"); 358var classLibrary1 = solution.ProjectsInOrder.First(p => p.ProjectName == "ClassLibrary1"); 359var classLibrary2 = solution.ProjectsInOrder.First(p => p.ProjectName == "ClassLibrary2"); 360var classLibrary3 = solution.ProjectsInOrder.First(p => p.ProjectName == "ClassLibrary3"); 574ProjectInSolution csharpProject = solution.ProjectsInOrder.First(p => p.ProjectName == "ClassLibrary1"); 575ProjectInSolution vcProject = solution.ProjectsInOrder.First(p => p.ProjectName == "MainApp"); 659ProjectInSolution winFormsApp1 = solution.ProjectsInOrder.First(p => p.ProjectName == "WinFormsApp1"); 660ProjectInSolution classLibrary1 = solution.ProjectsInOrder.First(p => p.ProjectName == "ClassLibrary1");
Microsoft.Build.Engine.UnitTests (20)
BackEnd\BuildManager_Logging_Tests.cs (1)
131allEvents.First(x => x is T).Message.ShouldContain(
BackEnd\BuildManager_Tests.cs (4)
4211var node1 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project1, StringComparison.OrdinalIgnoreCase)); 4215var node2 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project2, StringComparison.OrdinalIgnoreCase)); 4296var node1 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project1, StringComparison.OrdinalIgnoreCase)); 4300var node2 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project2, StringComparison.OrdinalIgnoreCase));
Evaluation\Preprocessor_Tests.cs (1)
994var virtualImport = project.Imports.First(i => i.ImportedProject.FullPath.StartsWith(projectPath + ".SdkResolver"));
Graph\ProjectGraph_Tests.cs (8)
373root1.ProjectReferences.First(r => GetProjectNumber(r) == 3).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor1); 374root1.ProjectReferences.First(r => GetProjectNumber(r) == 4).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor1); 380root2.ProjectReferences.First(r => GetProjectNumber(r) == 4).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor2); 381root2.ProjectReferences.First(r => GetProjectNumber(r) == 5).ProjectInstance.GlobalProperties.ShouldBeSameIgnoringOrder(globalPropertiesFor2); 2105var innerBuildWithCommonReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "a"); 2111var innerBuildWithAdditionalReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "b"); 2138var outerBuild = graph.GraphRoots.First(i => i.ProjectType == ProjectInterpretation.ProjectType.OuterBuild); 2143var referencedInnerBuild = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GetPropertyValue(InnerBuildPropertyName) == "a");
Graph\ResultCacheBasedBuilds_Tests.cs (2)
350var rootNode = topoSortedNodes.First(n => Path.GetFileNameWithoutExtension(n.ProjectInstance.FullPath) == "1"); 389outputCaches.Remove(expectedOutput.Keys.First(n => ProjectNumber(n) == "3"));
Instance\ProjectInstance_Internal_Tests.cs (1)
1033Toolset template = pc.Toolsets.First(t => String.Equals(t.ToolsVersion, pc.DefaultToolsVersion, StringComparison.OrdinalIgnoreCase));
ProjectCache\ProjectCacheTests.cs (3)
1009graphResult.ResultsByNode.First(r => GetProjectNumber(r.Key) == 2).Value.ShouldHaveSucceeded(); 1010graphResult.ResultsByNode.First(r => GetProjectNumber(r.Key) == 1).Value.ShouldHaveFailed(); 1428return buildSession.BuildProjectFileAsync(graph.ProjectNodes.First(n => GetProjectNumber(n) == projectNumber).ProjectInstance.FullPath);
Microsoft.Build.Framework (1)
ChangeWaves.cs (1)
158_cachedWave = AllWaves.First((x) => x > _cachedWave);
Microsoft.Build.Tasks.Core (4)
GetSDKReferenceFiles.cs (4)
342ResolvedRedistFile winner = _resolveRedistFiles.First(x => x.Equals(redist)); 423ResolvedReferenceAssembly winner = _resolvedReferences.First(x => x.Equals(reference)); 595ResolvedReferenceAssembly winner = resolvedFiles.First(x => x.Equals(resolvedReference)); 635ResolvedRedistFile winner = resolvedRedistFiles.First(x => x.Equals(redistFile));
Microsoft.Build.Tasks.UnitTests (2)
MSBuild_Tests.cs (2)
1478var expectedTaskId = logger.TaskStartedEvents.First(t => t.TaskName == "MSBuild").BuildEventContext.TaskId; 1514var expectedTaskId = logger.TaskStartedEvents.First(t => t.TaskName == nameof(BuildProjectFileTask)).BuildEventContext.TaskId;
Microsoft.CodeAnalysis.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ChildSyntaxListExtensions.cs (1)
21return Enumerable.First(childSyntaxList, predicate);
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
155var first = root.DescendantNodesAndSelf().First(x => x.HasAnnotation(annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
139var node = token.Parent!.AncestorsAndSelf().First(a => a.FullSpan.Contains(span));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
76var currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind());
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (22)
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (4)
3185var compilation = await workspace.CurrentSolution.Projects.First(p => p.Name == "P3").GetCompilationAsync(); 3190var p1 = workspace.CurrentSolution.Projects.First(p => p.Name == "P1"); 3195var testDocument = workspace.Documents.First(d => d.Name == "CurrentDocument.cs"); 3249var testDocument = workspace.Documents.First(d => d.Name == "CurrentDocument.cs");
ExtractMethod\MiscTests.cs (2)
49var publicToken = rootWithAnnotation.DescendantTokens().First(t => t.Kind() == SyntaxKind.PublicKeyword); 94var publicToken = rootWithAnnotation.DescendantTokens().First(t => t.Kind() == SyntaxKind.PublicKeyword);
QuickInfo\SemanticQuickInfoSourceTests.cs (1)
271var sourceDocument = workspace.Documents.First(d => d.Name == "SourceDocument");
Workspaces\WorkspaceTests_EditorFeatures.cs (15)
286var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 287var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 325var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 326var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 412var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 434var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 435var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 462var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 463var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 495var id1 = solutionY.Projects.First(p => p.Name == project1.Name).Id; 496var id2 = solutionY.Projects.First(p => p.Name == project2.Name).Id; 549var id1 = solutionY.Projects.First(p => p.Name == project1.Name).Id; 550var id2 = solutionY.Projects.First(p => p.Name == project2.Name).Id; 617var id1 = solutionY.Projects.First(p => p.Name == project1.Name).Id; 618var id2 = solutionY.Projects.First(p => p.Name == project2.Name).Id;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
FirstClassSpanTests.cs (1)
4912.First(s => s.Expression.ToString() == "a");
Microsoft.CodeAnalysis.CSharp.Features (1)
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
76var currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (11)
Semantics\BindingTests.cs (6)
2726.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M0")); 2738.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M1")); 2837.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M0")); 2849.First(x => x.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression) && x.Identifier.ValueText.Equals("M1")); 2931var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName)); 2973var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName));
Semantics\InterceptorsTests.cs (1)
1976var node1 = root.DescendantNodes().First(node => node is IdentifierNameSyntax name && name.Identifier.Text == "Prop");
Semantics\LambdaTests.cs (1)
7011var action = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.ValueText == "Action");
Semantics\NullableReferenceTypesTests.cs (1)
3699var id = lambda.DescendantNodes().First(n => n.IsKind(SyntaxKind.IdentifierName));
Semantics\SwitchTests.cs (1)
1154var node = syntaxTree.GetRoot().DescendantNodes().First(x => x.IsKind(SyntaxKind.SimpleMemberAccessExpression));
Semantics\TopLevelStatementsTests.cs (1)
9677var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (34)
Compilation\GetImportScopesTests.cs (1)
403var reference = comp.References.First(r => r.Display!.StartsWith("System.Core"));
Compilation\GetSemanticInfoTests.cs (1)
1674var varIdentifier = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(n => n.ToString() == "var");
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (3)
4415var lambda = (SimpleLambdaExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(x => x is SimpleLambdaExpressionSyntax); 5357.First(s => s.Left is IdentifierNameSyntax { Identifier.Text: "Thing" }) 5543.First(s => s.Left is IdentifierNameSyntax { Identifier.Text: "Thing" })
DocumentationComments\CrefTests.cs (1)
4559Assert.Equal(SyntaxKind.EndOfFileToken, crefSyntax.Ancestors().First(n => n.IsStructuredTrivia).ParentTrivia.Token.Kind());
Symbols\Source\NullablePublicAPITests.cs (12)
3500.First(i => i.Identifier.ValueText == "o1"); 3507var mDeclaration = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(m => m.Identifier.ValueText == "M"); 3554.First(i => i.Identifier.ValueText == "o1"); 3565.First(i => i.Identifier.ValueText == "o2"); 3615.First(i => i.Identifier.ValueText == "o1"); 3626.First(i => i.Identifier.ValueText == "o2"); 3775.First(i => i.Identifier.ValueText == "o1"); 4124var o2Result = lookupResults.OfType<ILocalSymbol>().First(l => l.Name == "o2"); 4125var o8Result = lookupResults.OfType<ILocalSymbol>().First(l => l.Name == "o8"); 4129var o1Result = lookupResults.OfType<IParameterSymbol>().First(p => p.Name == "o1"); 4130var oResult = lookupResults.OfType<IParameterSymbol>().First(p => p.Name == "o"); 4134var localFunctionResult = lookupResults.OfType<IMethodSymbol>().First(m => m.MethodKind == MethodKind.LocalFunction);
Symbols\SymbolEqualityTests.cs (12)
411var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 449var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 480var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 523var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 554var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 590var create1Syntax = (InvocationExpressionSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.InvocationExpression); 625var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 674var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().Last(sn => sn.Kind() == SyntaxKind.ClassDeclaration).DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 726var member1Syntax = (FieldDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.FieldDeclaration); 776var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration); 827var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration); 888var member1Syntax = (ClassDeclarationSyntax)root.DescendantNodes().First(sn => sn.Kind() == SyntaxKind.ClassDeclaration);
Symbols\SymbolExtensionTests.cs (3)
101var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 119var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 137var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
Symbols\TypeTests.cs (1)
2466var method = typeMembers.OfType<MethodSymbol>().First(m => m is { MethodKind: not MethodKind.Constructor });
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (28)
IncrementalParsing\IncrementalParsingTests.cs (1)
3055var tempToken = tempRoot.DescendantTokens().First(t => t.Kind() == SyntaxKind.IdentifierToken);
Syntax\SyntaxAnnotationTests.cs (4)
161var node = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 193var token = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsToken).AsToken(); 284var firstNode = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 295var firstNodeInNewTree = GetAllNodesAndTokens(newRoot).First(t => t.IsNode).AsNode();
Syntax\SyntaxNodeTests.cs (13)
85var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 103var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 122var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 2231var bToken = expr.DescendantTokens().First(t => t.Text == "b"); 2268var identifierC = cu.DescendantTokens().First(t => t.Text == "C"); 2299var identifierC = cu.DescendantTokens().First(t => t.Text == "C"); 2317var token = expr.DescendantTokens().First(t => t.IsMissing); 2332var token = tokens.First(t => t.Kind() == SyntaxKind.EndOfDocumentationCommentToken); 2372var trivia = expr.DescendantTokens().First(t => t.Text == "a").TrailingTrivia[0]; 3499var node = (SyntaxNode)children.First(n => n.IsNode); 3503var token = (SyntaxToken)children.First(n => n.IsToken); 3819var a = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 3820var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e");
Syntax\TrackNodeTests.cs (10)
24var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 35var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 47var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 56var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 66var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 81var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 97var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 109var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 122var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 134var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a");
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
CodeGeneration\SyntaxGeneratorTests.cs (2)
2647var newDecl = Generator.RemoveNode(declaration, Generator.GetNamespaceImports(declaration).First(m => Generator.GetName(m) == name)); 2855var newDecl = Generator.RemoveNode(declaration, Generator.GetMembers(declaration).First(m => Generator.GetName(m) == name));
Formatting\FormattingElasticTriviaTests.cs (1)
111var decl = generator.GetDeclaration(root.DescendantNodes().OfType<VariableDeclaratorSyntax>().First(vd => vd.Identifier.Text == "f2"));
Microsoft.CodeAnalysis.EditorFeatures (1)
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (1)
740: _openTextBufferManager._referenceSpanToLinkedRenameSpanMap.First(kvp => kvp.Key.OverlapsWith(span)).Value.TrackingSpan.GetEndPoint(snapshot);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (13)
AbstractCommandHandlerTestState.cs (2)
77var cursorDocument = Workspace.Documents.First(d => d.CursorPosition.HasValue || d.SelectedSpans.Any(ss => ss.IsEmpty)); 81var cursorPosition = cursorDocument.CursorPosition ?? cursorDocument.SelectedSpans.First(ss => ss.IsEmpty).Start;
Completion\AbstractCompletionProviderTests.cs (4)
472var firstItem = items.First(i => CompareItems(i.DisplayText, itemToCommit)); 595var firstItem = items.First(i => CompareItems(i.DisplayText + i.DisplayTextSuffix, itemToCommit)); 828var item = completionList.ItemsList.First(c => CompareItems(c.DisplayText, expectedItem)); 1100var item = completionList.ItemsList.First(i => i.DisplayText.StartsWith(textTypedSoFar));
LanguageServer\AbstractLspBuildOnlyDiagnosticsTests.cs (1)
37var enumMember = enumMembers.First(m => Convert.ToInt32(m.GetValue(null)) == codeValue);
Semantics\SpeculationAnalyzerTestsBase.cs (2)
36var initialNode = initialTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? initialExpression)); 39var replacementNode = replacementTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? replacementExpression));
SignatureHelp\AbstractSignatureHelpProviderTests.cs (3)
348var cursorPosition = testWorkspace.Documents.First(d => d.Name == "SourceDocument").CursorPosition.Value; 349var documentId = testWorkspace.Documents.First(d => d.Name == "SourceDocument").Id; 358var selectedSpans = testWorkspace.Documents.First(d => d.Name == "SourceDocument").SelectedSpans;
Workspaces\TestWorkspaceFixture.cs (1)
43_currentDocument = _workspace.Documents.First(d => d.CursorPosition.HasValue);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
SymbolFinder\DependentTypeFinderTests.cs (1)
647var firstDecl = csRoot.DescendantNodes().First(d => d is CSharp.Syntax.TypeDeclarationSyntax);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
Debugger\Engine\DkmClrRuntimeInstance.cs (1)
76var module = this.Modules.First(m => m.Assembly == assembly);
Microsoft.CodeAnalysis.Features (1)
ExtractMethod\SelectionValidator.cs (1)
126firstStatement = spine.First(s => CanMergeExistingSpineWithCurrent(syntaxFacts, s, stmt));
Microsoft.CodeAnalysis.Test.Utilities (1)
Assert\AssertEx.cs (1)
512ToString(actual.First(predicate)),
Microsoft.CodeAnalysis.UnitTests (2)
CommonSyntaxTests.cs (2)
210var exprB = expr.DescendantNodes().OfType<CSharp.Syntax.IdentifierNameSyntax>().First(n => n.Identifier.ToString() == "b"); 231var exprB = expr.DescendantNodes().OfType<CSharp.Syntax.IdentifierNameSyntax>().First(n => n.Identifier.ToString() == "b");
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (4)
Syntax\SyntaxAnnotationTests.vb (4)
147Dim node = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode() 178Dim token = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsToken).AsToken() 266Dim firstNode = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode() 277Dim firstNodeInNewTree = GetAllNodesAndTokens(newRoot).First(Function(t) t.IsNode).AsNode()
Microsoft.CodeAnalysis.Workspaces (4)
Editing\SyntaxGenerator.cs (1)
1446? original.First(tk => tk.RawKind == token.RawKind)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ChildSyntaxListExtensions.cs (1)
21return Enumerable.First(childSyntaxList, predicate);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
155var first = root.DescendantNodesAndSelf().First(x => x.HasAnnotation(annotation));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
139var node = token.Parent!.AncestorsAndSelf().First(a => a.FullSpan.Contains(span));
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
MSBuild\ProjectFile\ProjectFile.cs (2)
522item = references.First(it => PathUtilities.PathsEqual(it.EvaluatedInclude, relativePath) 526item ??= references.First(it => string.Compare(projectName, it.GetMetadataValue(MetadataNames.Name), StringComparison.OrdinalIgnoreCase) == 0);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (36)
MSBuildWorkspaceTestBase.cs (3)
117var p1 = sol.Projects.First(p => p.Language == LanguageNames.CSharp); 118var p2 = sol.Projects.First(p => p.Language == LanguageNames.VisualBasic); 136var solutionFileName = files.First(t => t.fileName.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)).fileName;
NetCoreTests.cs (7)
90var document = project.Documents.First(d => d.Name == "Program.cs"); 115var document = libraryProject.Documents.First(d => d.Name == "Class1.cs"); 155var document = project.Documents.First(d => d.Name == "Program.cs"); 215var document = project.Documents.First(d => d.Name == "Program.cs"); 327document = project.Documents.First(d => d.Name == "Program.cs"); 331document = project.Documents.First(d => d.Name == "Class1.cs"); 506var document = project.Documents.First(d => d.Name == "Program.vb");
SolutionGeneration.cs (1)
95var referencedProject = projectBuilders.First(p => p.Name == projectReference.ProjectName);
VisualStudioMSBuildWorkspaceTests.cs (25)
62var type = tree.GetRoot().DescendantTokens().First(t => t.ToString() == "class").Parent; 75var vbProject = solution.Projects.First(p => p.Language == LanguageNames.VisualBasic); 243var p1 = sol.Projects.First(p => p.Language == LanguageNames.CSharp); 244var p2 = sol.Projects.First(p => p.Language == LanguageNames.VisualBasic); 258var p1 = sol.Projects.First(p => p.Language == LanguageNames.CSharp); 259var p2 = sol.Projects.First(p => p.Language == LanguageNames.VisualBasic); 297var project = sol.Projects.First(p => p.Language == language); 312var p1 = sol.Projects.First(p => p.Language == LanguageNames.CSharp); 313var p2 = sol.Projects.First(p => p.Language == LanguageNames.VisualBasic); 335var p1 = sol.Projects.First(p => p.Language == LanguageNames.CSharp); 345var p2 = p1.Solution.Projects.First(p => p.Language == LanguageNames.VisualBasic); 440var type = tree.GetRoot().DescendantTokens().First(t => t.ToString() == "class").Parent; 955var doc = solution.Projects.First().Documents.First(d => d.FilePath == sourceFile); 989var doc = solution.Projects.First().Documents.First(d => d.FilePath == sourceFile); 2393var adoc = proj.AdditionalDocuments.First(a => a.Name == "XamlFile.xaml"); 2569var project = solution.Projects.First(p => p.Language == LanguageNames.VisualBasic); 2587var csproject = workspace.CurrentSolution.Projects.First(p => p.Language == LanguageNames.CSharp); 2595var vbproject = workspace.CurrentSolution.Projects.First(p => p.Language == LanguageNames.VisualBasic); 2793var document = project.Documents.First(d => d.Name == "class1.cs"); 2812var document = project.Documents.First(d => d.Name == "class1.cs"); 2831var document = project.Documents.First(d => d.Name == "class1.cs"); 2848var type = tree.GetRoot().DescendantTokens().First(t => t.ToString() == "class").Parent; 2880var document = project.Documents.First(d => d.Name == "class1.cs"); 2963var project = solution.Projects.First(p => p.Language == LanguageNames.VisualBasic); 3308var document = project.Documents.First(d => d.Name == "class1.cs");
Microsoft.CodeAnalysis.Workspaces.UnitTests (7)
CommandLineProject\CommandLineProjectWorkspaceTests.cs (3)
38var gooDoc = project.Documents.First(d => d.Name == "CSharpClass.cs"); 66var gooDoc = project.Documents.First(d => d.Name == "goo.cs"); 70var barDoc = project.Documents.First(d => d.Name == "bar.cs");
FindReferencesTests.cs (2)
388var netCoreProject = solution.Projects.First(p => p.Name == "NetCoreProject"); 389var netStandardProject = solution.Projects.First(p => p.Name == "NetStandardProject");
SolutionTests\ProjectDependencyGraphTests.cs (1)
615var firstBToC = b.ProjectReferences.First(reference => reference.ProjectId == c.Id);
SymbolKeyTests.cs (1)
760var outer = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().First(s => s.Name == "A");
Microsoft.DotNet.Build.Tasks.Feed.Tests (3)
SetupTargetFeedConfigV3Tests.cs (3)
173var channelConfig = PublishingConstants.ChannelInfos.First(c => c.Id == 2); 282var channelConfig = PublishingConstants.ChannelInfos.First(c => c.Id == 2); 390var channelConfig = PublishingConstants.ChannelInfos.First(c => c.Id == 2);
Microsoft.DotNet.NuGetRepack.Tests (1)
TestHelpers\AssertEx.cs (1)
286ToString(actual.First(predicate)),
Microsoft.DotNet.SignCheckLibrary (1)
Verification\Jar\JarManifestFileBase.cs (1)
95ZipArchiveEntry manifestArchiveEntry = archive.Entries.First(a => String.Equals(a.FullName, ManifestPath, StringComparison.OrdinalIgnoreCase));
Microsoft.DotNet.VersionTools (1)
Automation\NupkgInfoFactory.cs (1)
65return el.Descendants().First(c => c.Name.LocalName.ToString() == name);
Microsoft.Extensions.AsyncState.Tests (3)
AsyncContextServiceCollectionExtensionsTests.cs (3)
29var serviceDescriptor = services.First(x => x.ServiceType == typeof(IAsyncContext<>)); 32serviceDescriptor = services.First(x => x.ServiceType == typeof(IAsyncState)); 35serviceDescriptor = services.First(x => x.ServiceType == typeof(IAsyncLocalContext<>));
Microsoft.ML.AutoML (2)
Experiment\Runners\CrossValSummaryRunner.cs (1)
70var firstException = trainResults.First(r => r.exception != null).exception;
TransformInference\TransformPostTrainerInference.cs (1)
34var labelColumn = columns.First(c => c.Purpose == ColumnPurpose.Label);
Microsoft.ML.AutoML.Tests (10)
ColumnInferenceTests.cs (10)
62var labelCol = result.TextLoaderOptions.Columns.First(c => c.Source[0].Min == 14 && c.Source[0].Max == 14); 72var labelCol = result.TextLoaderOptions.Columns.First(c => c.Source[0].Min == DatasetUtil.IrisDatasetLabelColIndex && 82var emptyColumn = result.TextLoaderOptions.Columns.First(c => c.Name == "Empty"); 92var boolColumn = result.TextLoaderOptions.Columns.First(c => c.Name == "Bool"); 119var labelColumn = result.TextLoaderOptions.Columns.First(c => c.Name == "col0"); 120var userColumn = result.TextLoaderOptions.Columns.First(c => c.Name == "col1"); 121var itemColumn = result.TextLoaderOptions.Columns.First(c => c.Name == "col2"); 122var ignoreColumn = result.TextLoaderOptions.Columns.First(c => c.Name == "col4"); 139var nameColumn = result.TextLoaderOptions.Columns.First(c => c.Name == "Username"); 192var labelCol = result.TextLoaderOptions.Columns.First(c => c.Name == DatasetUtil.MlNetGeneratedRegressionLabel);
Microsoft.ML.Core (2)
ComponentModel\ComponentCatalog.cs (1)
428throw Contracts.Except("Component '{0}' has an invalid alias '{1}'", Name, Aliases.First(x => !IsValidName(x)));
Utilities\ReservoirSampler.cs (1)
196var tmp = _counts.Select((count, i) => new KeyValuePair<int, int>(count, i)).First(kvp => kvp.Key == 0);
Microsoft.ML.FastTree (2)
Dataset\Dataset.cs (2)
823bool isQuery = partsDatas.First(pd => pd.Data != null).IsQueryLevel; 841Type t = arrays.First(x => x != null).GetType().GetElementType();
Microsoft.ML.IntegrationTests (1)
ModelFiles.cs (1)
64var versionPath = archive.Entries.First(x => x.FullName == versionFileName);
Microsoft.ML.TestFramework (1)
DataPipe\TestDataPipe.cs (1)
1060var entry = zip.Entries.First(source => source.Name == "word_topic_summary-Result.txt");
Microsoft.VisualStudio.LanguageServices (2)
FindReferences\IFindAllReferencesWindowExtensions.cs (1)
15return (ColumnState2)window.TableControl.ColumnStates.First(
UnusedReferences\Dialog\UnusedReferencesTableProvider.DataSource.cs (1)
36var project = solution.Projects.First(project => projectFilePath.Equals(project.FilePath, StringComparison.OrdinalIgnoreCase));
Microsoft.VisualStudio.LanguageServices.CSharp (1)
CodeModel\CSharpCodeModelService.cs (1)
1662var attribute = (AttributeSyntax)argument.Ancestors().First(n => n.Kind() == SyntaxKind.Attribute);
MSBuildTaskHost (1)
ChangeWaves.cs (1)
158_cachedWave = AllWaves.First((x) => x > _cachedWave);
Mvc.Api.Analyzers.Test (1)
MvcFactsTest.cs (1)
185var method = typeSymbol.GetMembers(nameof(IDisposable.Dispose)).OfType<IMethodSymbol>().First(f => !f.ReturnsVoid);
RazorPagesWebSite (1)
ModelWithPageFilter.cs (1)
30context.HandlerMethod = context.ActionDescriptor.HandlerMethods.First(m => m.Name == "Edit");
Roslyn.VisualStudio.Next.UnitTests (4)
Services\ServiceHubServicesTests.cs (4)
1636var project = solution.Projects.First(p => string.Equals(p.Name, projectName, StringComparison.OrdinalIgnoreCase)); 1637var document = project.Documents.First(d => string.Equals(d.Name, documentName, StringComparison.OrdinalIgnoreCase)); 1644var project = solution.Projects.First(p => string.Equals(p.Name, projectName, StringComparison.OrdinalIgnoreCase)); 1646documentName => project.Documents.First(d => string.Equals(d.Name, documentName, StringComparison.OrdinalIgnoreCase)));
System.Linq.Parallel (1)
System\Linq\ParallelEnumerable.cs (1)
5453.First(ExceptionAggregator.WrapFunc<TSource, bool>(predicate, settings.CancellationState));
System.Windows.Forms.Design.Tests (1)
SystemDesignMetadataReader.cs (1)
20Assembly systemDesign = AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == "System.Design");
Templates.Blazor.Tests (1)
src\ProjectTemplates\Shared\Project.cs (1)
44.First(attribute => attribute.Key == "DotNetEfFullPath")
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\ProjectTemplates\Shared\Project.cs (1)
44.First(attribute => attribute.Key == "DotNetEfFullPath")
Templates.Blazor.WebAssembly.Tests (1)
src\ProjectTemplates\Shared\Project.cs (1)
44.First(attribute => attribute.Key == "DotNetEfFullPath")
Templates.Mvc.Tests (1)
src\ProjectTemplates\Shared\Project.cs (1)
44.First(attribute => attribute.Key == "DotNetEfFullPath")
Templates.Tests (1)
src\ProjectTemplates\Shared\Project.cs (1)
44.First(attribute => attribute.Key == "DotNetEfFullPath")
XmlFileLogger (2)
ObjectModel\Project.cs (1)
81return _targetNameToTargetMap.Values.First(t => t.Id == id);
ObjectModel\Target.cs (1)
75return GetChildrenOfType<Task>().First(t => t.Id == taskId);