209 references to FirstOrDefault
ConfigurationSchemaGenerator (2)
ConfigSchemaEmitter.cs (1)
384propertySymbol = typeSymbol.GetMembers(property.Name).FirstOrDefault() as IPropertySymbol;
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
675string configKeyName = attributeData?.ConstructorArguments.FirstOrDefault().Value as string ?? propertyName;
ILLink.RoslynAnalyzer (3)
TrimAnalysis\SingleValueExtensions.cs (1)
17 var underlyingType = (type as INamedTypeSymbol)?.TypeArguments.FirstOrDefault ();
TrimAnalysis\TrimDataFlowAnalysis.cs (2)
93 if (block.Block.Operations.FirstOrDefault () is not IOperation op) 115 if (block.Block.Operations.FirstOrDefault () is IOperation firstBlockOp) {
Microsoft.Analyzers.Local (7)
ApiLifecycle\ApiLifecycleAnalyzer.cs (7)
76context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 113context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, symbol.Locations.FirstOrDefault(), symbol)); 120context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 127context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 135context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 156context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, type.Locations.FirstOrDefault(), type)); 160context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, type.Locations.FirstOrDefault(), type));
Microsoft.AspNetCore.App.Analyzers (6)
Kestrel\ListenOnIPv6AnyAnalyzer.cs (2)
47var addressArgument = kestrelOptionsListenInvocation?.Arguments.FirstOrDefault(); 79var localVariableDeclaration = localReferenceOperation.Local.DeclaringSyntaxReferences.FirstOrDefault();
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (1)
99.Where(i => semanticModel.GetSymbolInfo(i) is var symbolInfo && SymbolEqualityComparer.Default.Equals(symbolInfo.Symbol ?? symbolInfo.CandidateSymbols.FirstOrDefault(), matchingParameter));
RouteHandlers\DetectMismatchedParameterOptionality.cs (1)
35var location = parameter.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation();
src\Shared\Roslyn\CodeAnalysisExtensions.cs (1)
187var firstArg = invocation.Arguments.FirstOrDefault();
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
162=> info.Symbol ?? info.CandidateSymbols.FirstOrDefault();
Microsoft.AspNetCore.Components.Analyzers (3)
ComponentParameterAnalyzer.cs (1)
76var propertyLocation = property.Locations.FirstOrDefault();
InternalUsageAnalyzer.cs (2)
168symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None, 178symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None,
Microsoft.AspNetCore.Components.SdkAnalyzers (3)
ComponentParameterAnalyzer.cs (1)
70var propertyLocation = property.Locations.FirstOrDefault();
InternalUsageAnalyzer.cs (2)
168symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None, 178symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None,
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
162=> info.Symbol ?? info.CandidateSymbols.FirstOrDefault();
StaticRouteHandlerModel\EndpointParameter.cs (1)
158var constructorArgument = keyedServicesAttribute.ConstructorArguments.FirstOrDefault();
Microsoft.AspNetCore.Mvc.Analyzers (1)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (1)
187var firstArg = invocation.Arguments.FirstOrDefault();
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (1)
187var firstArg = invocation.Arguments.FirstOrDefault();
Microsoft.CodeAnalysis (1)
InternalUtilities\OneOrMany.cs (1)
140=> HasOneItem ? _one : _many.FirstOrDefault();
Microsoft.CodeAnalysis.CodeStyle (14)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (1)
43if (objectType?.GetMembers(nameof(GetHashCode)).FirstOrDefault() is not IMethodSymbol objectGetHashCodeMethod)
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (2)
60var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 88if (symbol?.Locations.FirstOrDefault()?.SourceTree is not { } sourceTree)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
263var methodSyntax = method.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken);
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (1)
140=> HasOneItem ? _one : _many.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolInfoExtensions.cs (1)
22=> info.Symbol ?? info.CandidateSymbols.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Simplification\SymbolAnnotation.cs (1)
21=> GetSymbols(annotation, compilation).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AliasSymbolKey.cs (1)
22visitor.WriteString(symbol.DeclaringSyntaxReferences.FirstOrDefault()?.SyntaxTree.FilePath ?? "");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
26var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
32locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
100Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 104=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 114return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 292=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
Microsoft.CodeAnalysis.CodeStyle.Fixes (7)
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
38var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
354AfterThisLocation ??= previousAssignedSymbol?.Locations.FirstOrDefault(); 355BeforeThisLocation ??= nextAssignedSymbol?.Locations.FirstOrDefault();
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (1)
110return types.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
80.Single(m => containingType.Equals(m.Parameters.FirstOrDefault()?.Type));
Microsoft.CodeAnalysis.CSharp (19)
Binder\Binder_Statements.cs (1)
3332LocalSymbol local = locals.FirstOrDefault();
BoundTree\BoundExpressionExtensions.cs (1)
196var ctor = expr.Type.GetMembers(WellKnownMemberNames.InstanceConstructorName).FirstOrDefault();
Compilation\CSharpCompilation.cs (2)
4696bool value = SyntaxTrees.FirstOrDefault()?.Options?.Features?.ContainsKey("nullablePublicOnly") == true; 4803CSharpSyntaxTree? firstTree = (CSharpSyntaxTree?)SyntaxTrees.FirstOrDefault();
Compilation\CSharpSemanticModel.cs (2)
3281LocalSymbol local = foreachBinder.GetDeclaredLocalsForScope(forEachStatement).FirstOrDefault(); 3320LocalSymbol local = catchBinder.GetDeclaredLocalsForScope(catchClause).FirstOrDefault();
FlowAnalysis\DataFlowsOutWalker.cs (1)
161var local = ((BoundCatchBlock)node).Locals.FirstOrDefault();
FlowAnalysis\NullableWalker.cs (1)
8547tupleType.GetMembers(NamedTypeSymbol.ValueTupleRestFieldName).FirstOrDefault() is FieldSymbol restField)
FlowAnalysis\VariablesDeclaredWalker.cs (1)
148var local = catchBlock.Locals.FirstOrDefault();
Symbols\Source\SourceEventSymbol.cs (1)
767EventSymbol? explicitlyImplementedEvent = ExplicitInterfaceImplementations.FirstOrDefault();
Symbols\Source\SourceMemberContainerSymbol.cs (1)
1989Symbol? lastSym = GetTypeMembers(name).FirstOrDefault();
Symbols\Source\SourceModuleSymbol.cs (1)
600var options = (CSharpParseOptions?)compilation.SyntaxTrees.FirstOrDefault()?.Options;
Symbols\Source\SourceNamedTypeSymbol.cs (1)
1818if (Indexers.FirstOrDefault() is PropertySymbol indexerSymbol)
Symbols\Source\SourcePropertyAccessorSymbol.cs (2)
608PropertySymbol? explicitlyImplementedPropertyOpt = IsExplicitInterfaceImplementation ? _property.ExplicitInterfaceImplementations.FirstOrDefault() : null; 682PropertySymbol? explicitlyImplementedPropertyOpt = _property.ExplicitInterfaceImplementations.FirstOrDefault();
Symbols\Source\SourcePropertySymbolBase.cs (1)
993PropertySymbol? explicitlyImplementedProperty = ExplicitInterfaceImplementations.FirstOrDefault();
Symbols\Source\SourceSimpleParameterSymbol.cs (1)
27: this(owner, parameterType, ordinal, refKind, name, locations.FirstOrDefault())
Symbols\SymbolExtensions.cs (2)
363SyntaxReference? reference = symbol.DeclaringSyntaxReferences.FirstOrDefault(); 370reference = containingSymbol.DeclaringSyntaxReferences.FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.CodeStyle (5)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
139var localReference = outLocalSymbol.DeclaringSyntaxReferences.FirstOrDefault();
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticHelper.cs (1)
32var node = calledLocationFunction.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax();
src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (1)
31&& symbol.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is ParameterSyntax
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
323declarator = localSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() as VariableDeclaratorSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
53c => c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (11)
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
76var methodReference = methodSymbol.DeclaringSyntaxReferences.FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (6)
315=> member.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() == 316param.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax()); 540else if (TryGetAssignmentFromParameterWithExplicitCast(bodyOps.FirstOrDefault(), parameter, out otherC)) 968if (bodyOps.FirstOrDefault() is not IConditionalOperation 1103equatableType.GetMembers(nameof(Equals)).FirstOrDefault() is IMethodSymbol equatableEquals && 1110var objectEquals = objectType?.GetMembers(nameof(Equals)).FirstOrDefault() as IMethodSymbol;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
135typeToGenerateIn = symbolInfo.CandidateSymbols.FirstOrDefault().ContainingSymbol as INamedTypeSymbol;
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
304if (parameterSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken) is ParameterSyntax parameterSyntax &&
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
88type.GetMembers("None").FirstOrDefault() is IFieldSymbol field && IsZero(field.ConstantValue))
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
120.Where(a => a.Initializer?.ElementValues.FirstOrDefault()?.Syntax.SpanStart == diagnostic.Location.SourceSpan.Start)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
GoToBase\CSharpGoToBaseService.cs (1)
29if (constructor.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken) is not ConstructorDeclarationSyntax constructorDeclaration)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (9)
SymbolKey\SymbolKeyCompilationsTests.cs (7)
131var type = ns.GetTypeMembers("C1").FirstOrDefault(); 158var type = ns.GetTypeMembers("C1").FirstOrDefault(); 186var type = ns.GetTypeMembers("C1").FirstOrDefault(); 464var typeSym00 = namespace1.GetTypeMembers("C1").FirstOrDefault(); 467var typeSym01 = namespace2.GetTypeMembers("C1").FirstOrDefault(); 572var typeSym01 = namespace1.GetTypeMembers("C1").FirstOrDefault(); 575var typeSym02 = namespace2.GetTypeMembers("C1").FirstOrDefault();
SymbolKey\SymbolKeyMetadataVsSourceTests.cs (2)
71var typesym = comp2.SourceModule.GlobalNamespace.GetTypeMembers("App").FirstOrDefault(); 254var typeTest = comp40.SourceModule.GlobalNamespace.GetTypeMembers("Test").FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (12)
CodeGen\CodeGenTupleTest.cs (12)
5883Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5960Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5979Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 5998Assert.All(tupleWithSomeNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6016Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6041Assert.All(tuple8WithoutNames.TupleElements.Select(f => f.Locations.FirstOrDefault()), 6068Assert.All(tuple8WithoutNames.GetMembers().OfType<IFieldSymbol>().Where(f => f.Name != "Rest").Select(f => f.Locations.FirstOrDefault()), 6093Assert.All(tuple8WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6118Assert.All(tuple9WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6144Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6176Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 6200Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\EditAndContinue\EditAndContinueTestBase.cs (1)
266var previousParseOptions = (CSharpParseOptions)compilation.SyntaxTrees.FirstOrDefault()?.Options;
Microsoft.CodeAnalysis.CSharp.Features (22)
ChangeSignature\CSharpChangeSignatureService.cs (1)
184return (symbolInfo.Symbol ?? symbolInfo.CandidateSymbols.FirstOrDefault(), parameterIndex);
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (1)
82if (statements.FirstOrDefault() == null)
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (1)
72return property.ContainingType.GetMembers(accessedMemberName).FirstOrDefault() as IFieldSymbol;
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (2)
69return symbol.Locations.FirstOrDefault()?.SourceSpan.Start ?? 0; 84return target.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax()?.SpanStart;
LanguageServices\CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs (1)
256var syntax = method.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax();
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (1)
215expressionType = errorType.CandidateSymbols.FirstOrDefault().GetSymbolType()
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
139var localReference = outLocalSymbol.DeclaringSyntaxReferences.FirstOrDefault();
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticHelper.cs (1)
32var node = calledLocationFunction.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax();
src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (1)
31&& symbol.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is ParameterSyntax
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
323declarator = localSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() as VariableDeclaratorSyntax;
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
76var methodReference = methodSymbol.DeclaringSyntaxReferences.FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (6)
315=> member.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() == 316param.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax()); 540else if (TryGetAssignmentFromParameterWithExplicitCast(bodyOps.FirstOrDefault(), parameter, out otherC)) 968if (bodyOps.FirstOrDefault() is not IConditionalOperation 1103equatableType.GetMembers(nameof(Equals)).FirstOrDefault() is IMethodSymbol equatableEquals && 1110var objectEquals = objectType?.GetMembers(nameof(Equals)).FirstOrDefault() as IMethodSymbol;
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
135typeToGenerateIn = symbolInfo.CandidateSymbols.FirstOrDefault().ContainingSymbol as INamedTypeSymbol;
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
304if (parameterSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken) is ParameterSyntax parameterSyntax &&
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
88type.GetMembers("None").FirstOrDefault() is IFieldSymbol field && IsZero(field.ConstantValue))
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
120.Where(a => a.Initializer?.ElementValues.FirstOrDefault()?.Syntax.SpanStart == diagnostic.Location.SourceSpan.Start)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (10)
Compilation\CompilationAPITests.cs (4)
641Assert.Equal(430, errs.FirstOrDefault().Code); 709Assert.Equal(430, errs.FirstOrDefault().Code); 2613Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 2649Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()),
Compilation\GetSemanticInfoTests.cs (1)
389var tsym = comp.SourceModule.GlobalNamespace.GetTypeMembers("Test").FirstOrDefault();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
3144var prop = typeA.GetMembers("Prop1").FirstOrDefault() as IPropertySymbol; 3152prop = typeA.GetMembers("Prop2").FirstOrDefault() as IPropertySymbol;
DocumentationComments\CrefTests.cs (1)
6630return references.FirstOrDefault();
Symbols\TypeTests.cs (2)
1504var topType = comp.SourceModule.GlobalNamespace.GetTypeMembers("NullableTest").FirstOrDefault(); 1611var topType = comp.SourceModule.GlobalNamespace.GetTypeMembers("S").FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
144var syntaxRef = aliasReplacement.DeclaringSyntaxReferences.FirstOrDefault();
Simplification\Simplifiers\NameSimplifier.cs (2)
120var syntaxRef = aliasReplacement.DeclaringSyntaxReferences.FirstOrDefault(); 448var argumentDecl = argument.DeclaringSyntaxReferences.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
53c => c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeSyntaxExtensions.cs (1)
45var firstSymbol = symbols.FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures (2)
EditAndContinue\ActiveStatementTrackingService.cs (1)
315documentId ??= solution.GetDocumentIdsWithFilePath(filePath).FirstOrDefault();
EditorConfigSettings\DataProvider\SettingsProviderBase.cs (1)
56var project = projects.FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
PullMemberUp\TestPullMemberUpService.cs (1)
44destination = allInterfaces.FirstOrDefault() ?? baseClass;
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
Peek\PeekableItemFactory.cs (1)
86var firstLocation = symbol.Locations.FirstOrDefault();
Microsoft.CodeAnalysis.Features (17)
ChangeSignature\AbstractChangeSignatureService.cs (2)
155var declarationLocation = symbol.Locations.FirstOrDefault(); 166var reference = symbol.DeclaringSyntaxReferences.FirstOrDefault();
ChangeSignature\DelegateInvokeMethodReferenceFinder.cs (1)
48var beginInvoke = symbol.ContainingType.GetMembers(WellKnownMemberNames.DelegateBeginInvokeName).FirstOrDefault();
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (1)
69var editor = Editor.GetEditor(operationKind, (TService)this, state, suggestedFileNames.FirstOrDefault(), cancellationToken);
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
151var member = symbols.FirstOrDefault();
FullyQualify\AbstractFullyQualifyService.cs (1)
206var member = container.GetMembers(name).FirstOrDefault();
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (1)
57.Select(symbol => symbol.Locations.FirstOrDefault())
QuickInfo\CommonSemanticQuickInfoProvider.cs (1)
135&& !ErrorVisitor.ContainsError(symbols.FirstOrDefault());
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (1)
43if (objectType?.GetMembers(nameof(GetHashCode)).FirstOrDefault() is not IMethodSymbol objectGetHashCodeMethod)
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (2)
60var sourceTree = symbolContext.Symbol.Locations.FirstOrDefault()?.SourceTree; 88if (symbol?.Locations.FirstOrDefault()?.SourceTree is not { } sourceTree)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
263var methodSyntax = method.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
38var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (2)
354AfterThisLocation ??= previousAssignedSymbol?.Locations.FirstOrDefault(); 355BeforeThisLocation ??= nextAssignedSymbol?.Locations.FirstOrDefault();
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.FirstOrDefault();
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
DocumentChanges\DocumentChangesTests.cs (6)
82var document = testLspServer.GetTrackedTexts().FirstOrDefault(); 203var document = testLspServer.GetTrackedTexts().FirstOrDefault(); 281var document = testLspServer.GetTrackedTexts().FirstOrDefault(); 320var document = testLspServer.GetTrackedTexts().FirstOrDefault(); 360var document = testLspServer.GetTrackedTexts().FirstOrDefault(); 444var document = testLspServer.GetTrackedTexts().FirstOrDefault();
Microsoft.CodeAnalysis.Test.Utilities (4)
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (2)
295context.ReportDiagnostic(Diagnostic.Create(descriptor, local.Locations.FirstOrDefault(), local, moreSpecificType)); 300context.ReportDiagnostic(Diagnostic.Create(descriptor, field.Locations.FirstOrDefault(), field, moreSpecificType));
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
144context.ReportDiagnostic(Diagnostic.Create(descriptor, field.Locations.FirstOrDefault()));
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
135context.ReportDiagnostic(Diagnostic.Create(descriptor, local.Locations.FirstOrDefault()));
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1419Assert.True(symbols.FirstOrDefault() == null,
Microsoft.CodeAnalysis.VisualBasic (3)
CommandLine\VisualBasicCommandLineArguments.vb (1)
113Dim defaultCorLibrary = ResolveMetadataReference(Me.DefaultCoreLibraryReference.Value, metadataResolver, diagnostics, messageProvider).FirstOrDefault()
Symbols\AliasSymbol.vb (2)
245Equals(Me.Locations.FirstOrDefault(), other.Locations.FirstOrDefault()) AndAlso
Microsoft.CodeAnalysis.Workspaces (19)
CodeFixes\FixAllOccurrences\FixAllState.cs (1)
70var diagnosticSpan = diagnosticsToFix.First().Value.FirstOrDefault()?.Location.SourceSpan;
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
289var typeNameConstant = attr.ConstructorArguments.FirstOrDefault();
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (1)
37var location = symbol.Locations.FirstOrDefault();
Shared\Extensions\ISolutionExtensions.cs (1)
49var documentId = solution.GetDocumentIdsWithFilePath(location.GetLineSpan().Path).FirstOrDefault();
Shared\Extensions\ISymbolExtensions.cs (3)
485return methodSymbol.ExplicitOrImplicitInterfaceImplementations().FirstOrDefault(); 498return typeSymbol.Interfaces.FirstOrDefault(); 507return memberSymbol.ExplicitOrImplicitInterfaceImplementations().FirstOrDefault();
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (1)
140=> HasOneItem ? _one : _many.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolInfoExtensions.cs (1)
22=> info.Symbol ?? info.CandidateSymbols.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Simplification\SymbolAnnotation.cs (1)
21=> GetSymbols(annotation, compilation).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AliasSymbolKey.cs (1)
22visitor.WriteString(symbol.DeclaringSyntaxReferences.FirstOrDefault()?.SyntaxTree.FilePath ?? "");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
26var propertyLocations = properties.SelectAsArray(p => p.Locations.FirstOrDefault());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
32locations.Add(element.Locations.FirstOrDefault() ?? Location.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (4)
100Hash.Combine(x.Locations.FirstOrDefault(), currentHash)); 104=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 114return Hash.Combine(x.Locations.FirstOrDefault(), currentHash); 292=> Hash.Combine(x.Locations.FirstOrDefault(), currentHash);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (1)
110return types.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
80.Single(m => containingType.Equals(m.Parameters.FirstOrDefault()?.Type));
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (1)
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (1)
140=> HasOneItem ? _one : _many.FirstOrDefault();
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
UtilityTest\DocumentationCommentIdTests.cs (1)
56var sym = DocumentationCommentId.GetSymbolsForReferenceId(id, compilation).FirstOrDefault();
Microsoft.Interop.ComInterfaceGenerator (2)
ComMethodInfo.cs (2)
119return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.MethodNotDeclaredInAttributedInterface, method.Locations.FirstOrDefault(), method.ToDisplayString())); 135return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.CannotAnalyzeMethodPattern, method.Locations.FirstOrDefault(), method.ToDisplayString()));
Microsoft.VisualStudio.LanguageServices (3)
ProjectSystem\VisualStudioWorkspaceImpl.cs (1)
717var documentId = documentTrackingService.TryGetActiveDocument() ?? documentTrackingService.GetVisibleDocuments().FirstOrDefault();
ProjectSystem\VisualStudioWorkspaceImpl.RenameDocumentUndoUnit.cs (1)
33var documentId = _workspace.CurrentSolution.GetDocumentIdsWithFilePath(_filePath).FirstOrDefault();
Snippets\SnippetExpansionClient.cs (1)
841var firstField = _state._method?.Parameters.FirstOrDefault()?.Name ?? PlaceholderSnippetField;
Microsoft.VisualStudio.LanguageServices.LiveShare (2)
Client\RemoteLanguageServiceWorkspace.cs (2)
241var docId = CurrentSolution.GetDocumentIdsWithFilePath(filePath).FirstOrDefault(); 279var docId = CurrentSolution.GetDocumentIdsWithFilePath(filePath).FirstOrDefault();
System.Windows.Forms.PrivateSourceGenerators.Tests (1)
EnumValidationTests.cs (1)
309Assert.False(diagnostics.Any(d => d.Severity == DiagnosticSeverity.Error), $"Failed: {diagnostics.FirstOrDefault()?.GetMessage()}");