490 references to Compilation
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (1)
192SourceReferenceResolver? sourceReferenceResolver = invocation.SemanticModel?.Compilation.Options.SourceReferenceResolver;
ILLink.CodeFixProvider (2)
BaseAttributeCodeFixProvider.cs (1)
64 if (model.Compilation.GetBestTypeByMetadataName (FullyQualifiedAttributeName) is not { } attributeSymbol)
DynamicallyAccessedMembersCodeFixProvider.cs (1)
130 if (model.Compilation.GetBestTypeByMetadataName (FullyQualifiedAttributeName) is not { } attributeSymbol)
Microsoft.Analyzers.Extra (4)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (4)
87var comp = sm.Compilation; 145var comp = sm.Compilation; 473var comp = sm.Compilation; 583var comp = sm.Compilation;
Microsoft.AspNetCore.App.Analyzers (9)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (2)
130var wellKnownTypes = WellKnownTypes.GetOrCreate(semanticModel.Compilation); 231var routeUsageCache = RouteUsageCache.GetOrCreate(semanticModel.Compilation);
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (2)
277var delegateSymbol = semanticModel.Compilation.GetSpecialType(SpecialType.System_Delegate); 290var stringSymbol = semanticModel.Compilation.GetSpecialType(SpecialType.System_String);
RouteEmbeddedLanguage\RoutePatternAnalyzer.cs (1)
34var routeUsageCache = RouteUsageCache.GetOrCreate(context.SemanticModel.Compilation);
RouteEmbeddedLanguage\RoutePatternBraceMatcher.cs (1)
21var routeUsageCache = RouteUsageCache.GetOrCreate(semanticModel.Compilation);
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
114var routeUsageCache = RouteUsageCache.GetOrCreate(semanticModel.Compilation);
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (1)
24var routeUsageCache = RouteUsageCache.GetOrCreate(semanticModel.Compilation);
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
138=> SymbolEqualityComparer.Default.Equals(type, semanticModel.Compilation.GetTypeByMetadataName(typeName));
Microsoft.AspNetCore.App.Analyzers.Test (1)
Infrastructure\WellKnownTypesTests.cs (1)
115var wellKnownTypes = WellKnownTypes.GetOrCreate(semanticModel.Compilation);
Microsoft.AspNetCore.App.CodeFixes (4)
Dependencies\AddPackageFixer.cs (1)
43var wellKnownTypes = WellKnownTypes.GetOrCreate(semanticModel.Compilation);
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
53var wellKnownTypes = WellKnownTypes.GetOrCreate(semanticModel.Compilation);
Http\HeaderDictionaryAddFixer.cs (1)
42var wellKnownTypes = WellKnownTypes.GetOrCreate(semanticModel.Compilation);
RouteParameterUnusedParameterFixer.cs (1)
43var routeUsageCache = RouteUsageCache.GetOrCreate(semanticModel.Compilation);
Microsoft.AspNetCore.Http.RequestDelegateGenerator (5)
RequestDelegateGenerator.cs (1)
27var wellKnownTypes = WellKnownTypes.GetOrCreate(context.SemanticModel.Compilation);
RequestDelegateGeneratorSuppressor.cs (1)
59var wellKnownTypes = WellKnownTypes.GetOrCreate(semanticModel.Compilation);
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
138=> SymbolEqualityComparer.Default.Equals(type, semanticModel.Compilation.GetTypeByMetadataName(typeName));
StaticRouteHandlerModel\Endpoint.cs (1)
166var filePath = operation.Syntax.SyntaxTree.GetInterceptorFilePath(operation.SemanticModel?.Compilation.Options.SourceReferenceResolver);
StaticRouteHandlerModel\InvocationOperationExtensions.cs (1)
112var targetSemanticModel = semanticModel?.Compilation.GetSemanticModel(expr.SyntaxTree);
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
AddResponseTypeAttributeCodeFixAction.cs (2)
135var statusCodesType = semanticModel.Compilation.GetTypeByMetadataName(ApiSymbolNames.HttpStatusCodes); 138if (!ApiControllerSymbolCache.TryCreate(semanticModel.Compilation, out var symbolCache))
Microsoft.CodeAnalysis (13)
DiagnosticAnalyzer\AnalysisContextInfo.cs (1)
28this(model.Compilation, new SourceOrAdditionalFile(model.SyntaxTree))
DiagnosticAnalyzer\AnalyzerExecutor.cs (3)
675var operationContext = new OperationAnalysisContext(operation, containingSymbol, semanticModel.Compilation, 823operationBlockScope, operationBlocks, declaredSymbol, semanticModel.Compilation, AnalyzerOptions, 908var context = new OperationBlockAnalysisContext(operationBlocks, declaredSymbol, semanticModel.Compilation,
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (4)
752DiagnosticAnalysisContextHelpers.VerifyArguments(diagnostic, _semanticModel.Compilation, _isSupportedDiagnostic, _cancellationToken); 1213DiagnosticAnalysisContextHelpers.VerifyArguments(diagnostic, _semanticModel.Compilation, _isSupportedDiagnostic, _cancellationToken); 1686public Compilation Compilation => _semanticModel?.Compilation ?? throw new InvalidOperationException(); 1756DiagnosticAnalysisContextHelpers.VerifyArguments(diagnostic, _semanticModel.Compilation, _isSupportedDiagnostic, _cancellationToken);
Operations\ControlFlowGraphBuilder.cs (3)
114var builder = new ControlFlowGraphBuilder(((Operation)body).OwningSemanticModel!.Compilation, captureIdDispenser, blocks); 7857Debug.Assert(operation == null || ((Operation)operation).OwningSemanticModel!.Compilation == _compilation); 7865Debug.Assert(operation == null || ((Operation)operation).OwningSemanticModel!.Compilation == _compilation);
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (1)
111targetNode is ICompilationUnitSyntax compilationUnit ? semanticModel.Compilation.Assembly :
src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (1)
56var assemblyToScope = model.Compilation.Assembly;
Microsoft.CodeAnalysis.CodeStyle (21)
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (2)
91=> ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, notification, context.CancellationToken); 100=> ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, notification, context.CancellationToken);
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
143semanticModel.Compilation.GetBestTypeByMetadataName(typeof(Enumerable).FullName!) != null;
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
454Debug.Assert(semanticModel.Compilation.Options.ReportSuppressedDiagnostics); 742var suppressMessageAttributeType = semanticModel.Compilation.SuppressMessageAttributeType();
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
175=> semanticModel.Compilation.GetTypeByMetadataName(typeof(T).FullName!);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (3)
272if (!this.SupportsFieldExpression(semanticModel.Compilation)) 288if (!this.SupportsFieldExpression(semanticModel.Compilation)) 341var compilation = semanticModel.Compilation;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
109var nullableType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Nullable<>).FullName!);
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (1)
69!AreEqualOrHaveImplicitConversion(trueAssignment.Type, falseAssignment.Type, trueAssignment.SemanticModel!.Compilation))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
401var compilation = firstBlock.SemanticModel!.Compilation;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (3)
84(ISymbol)semanticModel.Compilation.Assembly; 190var enumerableType = semanticModel.Compilation.IEnumerableOfTType(); 244return symbolInfo.GetAnySymbol().ConvertToType(semanticModel.Compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
267SymbolKey.Equals(semanticModel.Compilation, symbol.Name, localName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (3)
854return originalThrowExpressionType.IsOrDerivesFromExceptionType(this.OriginalSemanticModel.Compilation) != 855newThrowExpressionType.IsOrDerivesFromExceptionType(this.SpeculativeSemanticModel.Compilation); 943IsReferenceConversion(this.OriginalSemanticModel.Compilation, newSymbol.ContainingType, symbol.ContainingType))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (2)
36if (!s_treeAliasMap.TryGetValue(semanticModel.Compilation, out var treeMap) || 52var treeMap = s_treeAliasMap.GetValue(semanticModel.Compilation, static _ => new TreeMap());
Microsoft.CodeAnalysis.CodeStyle.Fixes (31)
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (1)
147var secondConversion = semanticModel.Compilation.ClassifyCommonConversion(castType, conversionType);
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
170&& semanticModel.Compilation.ClassifyCommonConversion(argumentType, parameterType).IsIdentity)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
438var compilation = semanticModel.Compilation;
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
49var compilation = semanticModel.Compilation;
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (2)
67var enumerableType = semanticModel.Compilation.GetBestTypeByMetadataName(typeof(Enumerable).FullName!); 74var conversion = semanticModel.Compilation.ClassifyCommonConversion(elementType, variableDeclarator.Symbol.Type);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
295var compilation = semanticModel.Compilation;
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
91var constructorInCompilation = (IMethodSymbol?)SymbolKey.Create(constructor).Resolve(semanticModel.Compilation).Symbol;
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceService.cs (1)
49var implementDisposePattern = ShouldImplementDisposePattern(model.Compilation, state.Info, explicitly: false);
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
47var compilation = semanticModel.Compilation; 119var knownTypes = new KnownTaskTypes(semanticModel.Compilation);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (3)
182select CreateSwitchArm(generator, semanticModel.Compilation, caseLabel); 187newArms.Add(CreateNullSwitchArm(generator, semanticModel.Compilation)); 193newArms.Add(CreateDefaultSwitchArm(generator, semanticModel.Compilation));
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
71var compilation = semanticModel.Compilation;
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (1)
42var expressionTypeOpt = semanticModel.Compilation.ExpressionOfTType();
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (1)
43var expressionTypeOpt = semanticModel.Compilation.ExpressionOfTType();
src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (2)
48if (!HashCodeAnalyzer.TryGetAnalyzer(semanticModel.Compilation, out var analyzer)) 76generatorInternal, semanticModel.Compilation, containingType, members, justMemberReference: true);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (2)
136if (addImportsService.HasExistingImport(model.Compilation, root, node, namespaceSyntax, generator)) 161model.Compilation, root, context, importsToAdd, generator, options, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (3)
49var delegateTypes = types.Select(t => t.GetDelegateType(semanticModel.Compilation)); 77return objectAsDefault ? semanticModel.Compilation.ObjectType : null; 107return objectAsDefault ? semanticModel.Compilation.ObjectType : null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (2)
414factory, semanticModel.Compilation, parameter, fieldAccess)); 463var throwStatement = factory.CreateThrowArgumentNullExceptionStatement(semanticModel.Compilation, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
74factory, generatorInternal, semanticModel.Compilation, semanticModel.SyntaxTree.Options, containingType, symbols);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
41protected Compilation Compilation => SemanticModel.Compilation;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (1)
48? [semanticModel.Compilation.GetSpecialType(SpecialType.System_Boolean)]
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (2)
70var typeSymbol = SymbolAnnotation.GetSymbol(annotation1, semanticModel.Compilation); 81var typeSymbol = semanticModel.Compilation.GetSpecialType(specialType);
Microsoft.CodeAnalysis.CSharp (5)
Operations\CSharpOperationFactory.cs (5)
1228IMethodSymbol? constructMethod = getConstructMethod((CSharpCompilation)_semanticModel.Compilation, expr).GetPublicSymbol(); 1895var compilation = (CSharpCompilation)_semanticModel.Compilation; 2012ITypeSymbol exceptionType = boundCatchBlock.ExceptionTypeOpt.GetPublicSymbol() ?? _semanticModel.Compilation.ObjectType; 2075bool legacyMode = _semanticModel.Compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_Threading_Monitor__Enter2) == null; 2078TypeWithAnnotations.Create(((CSharpCompilation)_semanticModel.Compilation).GetSpecialType(SpecialType.System_Boolean)),
Microsoft.CodeAnalysis.CSharp.CodeStyle (23)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (1)
77var entryPointMethod = semanticModel.Compilation.GetEntryPoint(cancellationToken);
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
60var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
152var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
105var compilationOptions = ((CSharpCompilationOptions)context.SemanticModel.Compilation.Options).NullableContextOptions; 329(defaultCompleted, options: ((CSharpCompilationOptions)semanticModel.Compilation.Options).NullableContextOptions, cancellationToken));
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
109semanticModel.Compilation, ienumerableType.TypeArguments.Single()))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
158var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
41var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (3)
90var compilation = semanticModel.Compilation; 887var compilation = semanticModel.Compilation; 1055var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
69var expressionType = semanticModel.Compilation.ExpressionOfTType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
1043var ienumerableType = semanticModel.Compilation.IEnumerableOfTType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
511return languageVersion >= LanguageVersion.CSharp11 && semanticModel.Compilation.SupportsRuntimeCapability(RuntimeCapability.NumericIntPtr);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
285var type = model.Compilation.TryGetCallingConventionSymbol(syntax.Name.ValueText); 408=> model.Compilation.CreatePreprocessingSymbol(identifier.ValueText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
510originalSemanticModel.Compilation.ClassifyConversion(castedExpressionType, isType).Exists) 662namedCastedType.OriginalDefinition.Equals(originalSemanticModel.Compilation.ListOfTType())) 1502var convertedType = originalConversion.IsIdentity ? originalConvertedType : originalSemanticModel.Compilation.ObjectType; 1547if (originalSemanticModel.Compilation.LanguageVersion() < LanguageVersion.CSharp9 &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
938=> model.Compilation.ClassifyConversion(originalType, targetType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
196var newSemanticModel = semanticModel.Compilation.ReplaceSyntaxTree(tree, newTree).GetSemanticModel(newTree); 318if (!conversion.Exists && expression is LambdaExpressionSyntax && semanticModel.Compilation.LanguageVersion() >= LanguageVersion.CSharp10)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (28)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (1)
102var conversion = semanticModel.Compilation.ClassifyConversion(rightType, leftType);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
197var conversion = _semanticModel.Compilation.ClassifyConversion(typeInfo.Type, typeInfo.ConvertedType);
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (2)
156var compilation = semanticModel.Compilation; 177inferredTupleTypes[i] = type is null ? semanticModel.Compilation.ObjectType : type;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (1)
55type: semanticModel.GetTypeInfo(((ConstantPatternSyntax)positionalPattern.Subpatterns[i].Pattern).Expression, cancellationToken).Type ?? semanticModel.Compilation.GetSpecialType(SpecialType.System_Object),
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (7)
118var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 119var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!); 120var ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName!); 121var ienumeratorGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator<>).FullName!); 153if (!model.Compilation.ClassifyConversion(typeArgument, returnExpressionType).Exists) 191var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 192var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
116ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 117ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName!);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
87if (IsFlagsEnum(type, semanticModel.Compilation) && 92else if (type.Equals(semanticModel.Compilation.GetTypeByMetadataName(typeof(CancellationToken).FullName!)))
src\Analyzers\CSharp\CodeFixes\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (2)
37if (semanticModel.Compilation.HasImplicitConversion(leftPartTypeSymbol, rightPartTypeSymbol) || 38semanticModel.Compilation.HasImplicitConversion(rightPartTypeSymbol, leftPartTypeSymbol))
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
101var taskType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Task).FullName!);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
70InfoCache.TryCreate(semanticModel.Compilation, out var infoCache) &&
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
84var compilation = semanticModel.Compilation;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (1)
62return model.Compilation.GetCompilationNamespace(ns);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
116targetType = semanticModel.Compilation.GetSpecialType(SpecialType.System_Object);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (2)
29return typeInfo.Type?.IsErrorType() == false ? typeInfo.Type : semanticModel.Compilation.ObjectType; 37return semanticModel.Compilation.ObjectType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (3)
46if (semanticModel.Compilation.LanguageVersion().MapSpecifiedToEffectiveVersion() >= LanguageVersion.CSharp8) 68var isLanguageVersionGreaterOrEqualToCSharp8 = (semanticModel.Compilation as CSharpCompilation)?.LanguageVersion >= LanguageVersion.CSharp8; 142return FindDisposeMethod(semanticModel.Compilation, type, isAsync);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (8)
Semantics\OutVarTests.cs (8)
1058var conversion = model.ClassifyConversion(decl, model.Compilation.ObjectType, false); 1060Assert.Equal(conversion, model.ClassifyConversion(decl, model.Compilation.ObjectType, true)); 1061Assert.Equal(conversion, ((CSharpSemanticModel)model).ClassifyConversion(decl, model.Compilation.ObjectType, false)); 1062Assert.Equal(conversion, ((CSharpSemanticModel)model).ClassifyConversion(decl, model.Compilation.ObjectType, true)); 1063Assert.Equal(conversion, model.ClassifyConversion(decl.Position, decl, model.Compilation.ObjectType, false)); 1064Assert.Equal(conversion, model.ClassifyConversion(decl.Position, decl, model.Compilation.ObjectType, true)); 1065Assert.Equal(conversion, ((CSharpSemanticModel)model).ClassifyConversion(decl.Position, decl, model.Compilation.ObjectType, false)); 1066Assert.Equal(conversion, ((CSharpSemanticModel)model).ClassifyConversion(decl.Position, decl, model.Compilation.ObjectType, true));
Microsoft.CodeAnalysis.CSharp.Features (62)
AddImport\CSharpAddImportFeatureService.cs (3)
386semanticModel.Compilation, root, contextNode, newImports, generator, options, cancellationToken); 493return (usingDirective, addImportService.HasExistingImport(semanticModel.Compilation, root, contextNode, usingDirective, generator)); 565var metadataReference = semanticModel.Compilation.GetMetadataReference(namespaceSymbol.ContainingAssembly);
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (1)
243return attributeType.GetAttributeNamedParameters(semanticModel.Compilation, within);
Completion\CompletionProviders\AwaitCompletionProvider.cs (1)
87var taskLikeTypes = new KnownTaskTypes(semanticModel.Compilation);
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (1)
74var (type, plural) = UnwrapType(nameInfo.Type, semanticModel.Compilation, wasPlural: false, seenTypes: []);
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (4)
132TryGetCompletionListType(type, enclosingNamedType, semanticModel.Compilation); 158if (!type.IsEditorBrowsable(hideAdvancedMembers, semanticModel.Compilation)) 193if (!field.IsEditorBrowsable(hideAdvancedMembers, semanticModel.Compilation)) 247!staticSymbol.IsEditorBrowsable(hideAdvancedMembers, semanticModel.Compilation))
Completion\CompletionProviders\FunctionPointerUnmanagedCallingConventionCompletionProvider.cs (1)
97var compilerServicesNamespace = semanticModel.Compilation.GlobalNamespace.GetQualifiedNamespace("System.Runtime.CompilerServices");
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (2)
70model.Compilation.GetSpecialType(SpecialType.System_Object); 90model.Compilation.GetSpecialType(SpecialType.System_Int32).GenerateTypeSyntax(),
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
354=> Equals(typeSymbol?.OriginalDefinition, semanticModel.Compilation.ListOfTType());
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
372=> Equals(typeSymbol.OriginalDefinition, _semanticModel.Compilation.GetTypeByMetadataName(typeof(List<>).FullName));
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (2)
59if (ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, GetAllNotifications(options), cancellationToken)) 70if (ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, GetAllNotifications(options), context.CancellationToken))
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (2)
40var compilation = semanticModel.Compilation; 114var compilation = semanticModel.Compilation;
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
107IsCoClassImplicitConversion(info, conv, semanticModel.Compilation.CoClassType()))
GenerateType\CSharpGenerateTypeService.cs (1)
812property = CreatePropertySymbol(propertyName, semanticModel.Compilation.ObjectType);
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
138var namedParameters = constructor.ContainingType.GetAttributeNamedParameters(semanticModel.Compilation, within)
Snippets\AbstractCSharpForLoopSnippetProvider.cs (1)
48var compilation = semanticModel.Compilation;
Snippets\AbstractCSharpMainMethodSnippetProvider.cs (1)
44return semanticModel.Compilation.GetTopLevelStatementsMethod() is null;
Snippets\CSharpConsoleSnippetProvider.cs (1)
29var consoleSymbol = GetConsoleSymbolFromMetaDataName(semanticModel.Compilation);
Snippets\CSharpForEachLoopSnippetProvider.cs (2)
70(isAsync ? symbolType.CanBeAsynchronouslyEnumerated(semanticModel.Compilation) : symbolType.CanBeEnumerated()) && 83typeInfo.Type!.CanBeAsynchronouslyEnumerated(semanticModel.Compilation))
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (1)
77var entryPointMethod = semanticModel.Compilation.GetEntryPoint(cancellationToken);
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
60var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
152var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
105var compilationOptions = ((CSharpCompilationOptions)context.SemanticModel.Compilation.Options).NullableContextOptions; 329(defaultCompleted, options: ((CSharpCompilationOptions)semanticModel.Compilation.Options).NullableContextOptions, cancellationToken));
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
109semanticModel.Compilation, ienumerableType.TypeArguments.Single()))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
158var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
41var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (3)
90var compilation = semanticModel.Compilation; 887var compilation = semanticModel.Compilation; 1055var compilation = semanticModel.Compilation;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
69var expressionType = semanticModel.Compilation.ExpressionOfTType();
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (1)
102var conversion = semanticModel.Compilation.ClassifyConversion(rightType, leftType);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
197var conversion = _semanticModel.Compilation.ClassifyConversion(typeInfo.Type, typeInfo.ConvertedType);
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (2)
156var compilation = semanticModel.Compilation; 177inferredTupleTypes[i] = type is null ? semanticModel.Compilation.ObjectType : type;
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateDeconstructMethodService.cs (1)
55type: semanticModel.GetTypeInfo(((ConstantPatternSyntax)positionalPattern.Subpatterns[i].Pattern).Expression, cancellationToken).Type ?? semanticModel.Compilation.GetSpecialType(SpecialType.System_Object),
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (7)
118var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 119var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!); 120var ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName!); 121var ienumeratorGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator<>).FullName!); 153if (!model.Compilation.ClassifyConversion(typeArgument, returnExpressionType).Exists) 191var ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 192var ienumeratorSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerator).FullName!);
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (2)
116ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName!); 117ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName!);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
87if (IsFlagsEnum(type, semanticModel.Compilation) && 92else if (type.Equals(semanticModel.Compilation.GetTypeByMetadataName(typeof(CancellationToken).FullName!)))
src\Analyzers\CSharp\CodeFixes\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (2)
37if (semanticModel.Compilation.HasImplicitConversion(leftPartTypeSymbol, rightPartTypeSymbol) || 38semanticModel.Compilation.HasImplicitConversion(rightPartTypeSymbol, leftPartTypeSymbol))
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeActionHelpers.cs (1)
101var taskType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Task).FullName!);
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
70InfoCache.TryCreate(semanticModel.Compilation, out var infoCache) &&
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
84var compilation = semanticModel.Compilation;
UseNamedArguments\CSharpUseNamedArgumentsCodeRefactoringProvider.cs (1)
49var conversion = semanticModel.Compilation.ClassifyConversion(argType, parameters[0].Type);
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
245var updatedCompilation = semanticModel.Compilation.ReplaceSyntaxTree(
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\DelegateTypeTests.cs (1)
14381var expectedBaseType = ((CSharpCompilation)model.Compilation).GetSpecialType(SpecialType.System_MulticastDelegate);
Semantics\SuppressAccessibilityChecksTests.cs (1)
61semanticModel = semanticModel.Compilation.GetSemanticModel(semanticModel.SyntaxTree);
SourceGeneration\SyntaxAwareGeneratorTests.cs (1)
790var dType = ctx.SemanticModel.Compilation.GetTypeByMetadataName("D");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Compilation\GetSemanticInfoTests.cs (3)
648var conversion = info.Type != null && info.ConvertedType != null ? model.Compilation.ClassifyConversion(info.Type, info.ConvertedType) : Conversion.NoConversion; 649Assert.Equal(conversion.IsImplicit, model.Compilation.HasImplicitConversion(info.Type, info.ConvertedType)); 863var act2 = semanticModel.Compilation.ClassifyConversion(info.Type, info.ConvertedType);
Symbols\Source\DeclaringSyntaxNodeTests.cs (1)
338AssertDeclaringSyntaxNodes(((CSharp.Symbols.PublicModel.Symbol)localType).UnderlyingSymbol, (CSharpCompilation)model.Compilation, anonObjectCreation);
Microsoft.CodeAnalysis.CSharp.Workspaces (20)
Classification\SyntaxClassification\FunctionPointerUnmanagedCallingConventionClassifier.cs (1)
42return semanticModel.Compilation.TryGetCallingConventionSymbol(name) is not null;
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
429if (!containingType.IsEditorBrowsable(hideAdvancedMembers: true, semanticModel.Compilation, includingSourceSymbols: true))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
1043var ienumerableType = semanticModel.Compilation.IEnumerableOfTType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
511return languageVersion >= LanguageVersion.CSharp11 && semanticModel.Compilation.SupportsRuntimeCapability(RuntimeCapability.NumericIntPtr);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (2)
285var type = model.Compilation.TryGetCallingConventionSymbol(syntax.Name.ValueText); 408=> model.Compilation.CreatePreprocessingSymbol(identifier.ValueText);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
510originalSemanticModel.Compilation.ClassifyConversion(castedExpressionType, isType).Exists) 662namedCastedType.OriginalDefinition.Equals(originalSemanticModel.Compilation.ListOfTType())) 1502var convertedType = originalConversion.IsIdentity ? originalConvertedType : originalSemanticModel.Compilation.ObjectType; 1547if (originalSemanticModel.Compilation.LanguageVersion() < LanguageVersion.CSharp9 &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
938=> model.Compilation.ClassifyConversion(originalType, targetType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
196var newSemanticModel = semanticModel.Compilation.ReplaceSyntaxTree(tree, newTree).GetSemanticModel(newTree); 318if (!conversion.Exists && expression is LambdaExpressionSyntax && semanticModel.Compilation.LanguageVersion() >= LanguageVersion.CSharp10)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (1)
62return model.Compilation.GetCompilationNamespace(ns);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
116targetType = semanticModel.Compilation.GetSpecialType(SpecialType.System_Object);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\InternalExtensions.cs (2)
29return typeInfo.Type?.IsErrorType() == false ? typeInfo.Type : semanticModel.Compilation.ObjectType; 37return semanticModel.Compilation.ObjectType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (3)
46if (semanticModel.Compilation.LanguageVersion().MapSpecifiedToEffectiveVersion() >= LanguageVersion.CSharp8) 68var isLanguageVersionGreaterOrEqualToCSharp8 = (semanticModel.Compilation as CSharpCompilation)?.LanguageVersion >= LanguageVersion.CSharp8; 142return FindDisposeMethod(semanticModel.Compilation, type, isAsync);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
CodeGeneration\CodeGenerationTests.cs (3)
658attributes: default, RefKind.None, isParams, GetTypeSymbol(s.Compilation, type), name, 665attributes: default, RefKind.None, isParams, GetTypeSymbol(s.Compilation, typeFullName, typeArrayRank), parameterName, 723=> s => s?.Compilation.GetTypeByMetadataName(typeMetadataName);
Microsoft.CodeAnalysis.Features (83)
AddImport\SymbolReferenceFinder.cs (5)
93=> _semanticModel.Compilation.GetCompilationNamespace(containingNamespace) ?? containingNamespace; 208var editorBrowserInfo = new EditorBrowsableInfo(_semanticModel.Compilation); 214s.Symbol.IsEditorBrowsable(_options.MemberDisplayOptions.HideAdvancedMembers, _semanticModel.Compilation, editorBrowserInfo)); 244if (!symbol.IsAccessibleWithin(_semanticModel.Compilation.Assembly)) 401s.Symbol.IsAccessibleWithin(_semanticModel.Compilation.Assembly));
ChangeSignature\AbstractChangeSignatureService.cs (2)
962if (semanticModel.Compilation.ClassifyCommonConversion(symbolType, addedParameter.Type).IsImplicit) 1063return !semanticModel.Compilation.HasImplicitConversion(fromType.Type, toType);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (1)
339targetSymbol ??= semanticModel.Compilation.Assembly;
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
89typeConvertibilityCache[type] = CompletionUtilities.IsTypeImplicitlyConvertible(semanticModel.Compilation, type, inferredTypes);
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (7)
129.FilterToVisibleAndBrowsableSymbols(hideAdvancedMembers, _originatingSemanticModel.Compilation); 174var originatingAssembly = _originatingSemanticModel.Compilation.Assembly; 180? _originatingSemanticModel.Compilation 228_originatingSemanticModel.Compilation.GetAssemblyOrModuleSymbol(peReference) is not IAssemblySymbol assembly) 234var internalsVisible = _originatingSemanticModel.Compilation.Assembly.IsSameAssemblyOrHasFriendAccessTo(assembly); 251var declaredReceiverTypeInOriginatingCompilation = SymbolFinder.FindSimilarSymbols(declaredReceiverType, _originatingSemanticModel.Compilation, cancellationToken).FirstOrDefault(); 275foreach (var methodInOriginatingCompilation in methodSymbols.Select(s => SymbolFinder.FindSimilarSymbols(s, _originatingSemanticModel.Compilation).FirstOrDefault()).WhereNotNull())
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (8)
227if (!IsExchangable(array.ElementType, foreachType, model.Compilation)) 241var charType = model.Compilation.GetSpecialType(SpecialType.System_Char); 242if (!IsExchangable(charType, foreachType, model.Compilation)) 254if (collectionType.OriginalDefinition.Equals(model.Compilation.GetTypeByMetadataName(typeof(ImmutableArray<>).FullName!))) 259if (!IsExchangable(indexer.ReturnType, foreachType, model.Compilation)) 273model.Compilation.GetTypeByMetadataName).Where(t => !IsNullOrErrorType(t)); 283IsExchangable(indexer.ReturnType, foreachType, model.Compilation)) 314if (!IsExchangable(indexerImpl.ReturnType, foreachType, model.Compilation))
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
869model.Compilation.GetSpecialType(SpecialType.System_Void),
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (3)
305AppendTextFromNode(state, summaryElement, state.SemanticModel.Compilation); 453var symbol = DocumentationCommentId.GetFirstSymbolForDeclarationId(crefAttribute.Value, semanticModel.Compilation); 502var symbol = DocumentationCommentId.GetFirstSymbolForDeclarationId(crefValue, semanticModel.Compilation);
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionAnalyzer.cs (1)
54var detector = JsonLanguageDetector.GetOrCreate(context.SemanticModel.Compilation, _info);
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDiagnosticAnalyzer.cs (1)
47var detector = JsonLanguageDetector.GetOrCreate(context.SemanticModel.Compilation, _info);
EmbeddedLanguages\Json\LanguageServices\JsonBraceMatcher.cs (1)
47var detector = JsonLanguageDetector.GetOrCreate(semanticModel.Compilation, info);
EmbeddedLanguages\Json\LanguageServices\JsonClassifier.cs (1)
50var detector = JsonLanguageDetector.GetOrCreate(semanticModel.Compilation, info);
EmbeddedLanguages\RegularExpressions\LanguageServices\AbstractRegexDiagnosticAnalyzer.cs (1)
49var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, _info);
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexBraceMatcher.cs (1)
50var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info);
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexClassifier.cs (1)
54var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info);
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexDocumentHighlighter.cs (1)
42var detector = RegexLanguageDetector.GetOrCreate(semanticModel.Compilation, info);
ExtractMethod\Extensions.cs (1)
42var typeSymbol = (T?)symbol.GetSymbolKey().Resolve(semanticModel.Compilation).GetAnySymbol();
ExtractMethod\MethodExtractor.Analyzer.cs (9)
182returnType = returnTypeHasAnonymousType ? returnType.RemoveAnonymousTypes(model.Compilation) : returnType; 211var taskType = model.Compilation.TaskType(); 214returnType = model.Compilation.GetSpecialType(SpecialType.System_Void); 218var genericTaskType = model.Compilation.TaskOfTType(); 233var taskType = model.Compilation.TaskType(); 235if (taskType is object && returnType.Equals(model.Compilation.GetSpecialType(SpecialType.System_Void))) 250var genericTaskType = model.Compilation.TaskOfTType(); 266var compilation = model.Compilation; 1035var compilation = semanticModel.Compilation;
FullyQualify\AbstractFullyQualifyService.cs (4)
126var editorBrowserInfo = new EditorBrowsableInfo(semanticModel.Compilation); 137s.IsEditorBrowsable(hideAdvancedMembers, semanticModel.Compilation, editorBrowserInfo)) 246if (!searchResult.IsAccessibleWithin(semanticModel.Compilation.Assembly)) 291=> Enumerable.Any(@namespace.GetAllTypes(cancellationToken), t => t.IsAccessibleWithin(model.Compilation.Assembly));
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (1)
143var equatableTypeOpt = semanticModel.Compilation.GetTypeByMetadataName(typeof(IEquatable<>).FullName!);
GenerateType\AbstractGenerateTypeService.State.cs (2)
170IsAttribute = BaseTypeOrInterfaceOpt != null && BaseTypeOrInterfaceOpt.Equals(semanticModel.Compilation.AttributeType()); 171IsException = BaseTypeOrInterfaceOpt != null && BaseTypeOrInterfaceOpt.Equals(semanticModel.Compilation.ExceptionType());
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (2)
346(s, g) => CreateStringCheckStatement(s.Compilation, g, parameter, methodName, options), 388(TStatementSyntax)generator.CreateThrowArgumentNullExceptionStatement(semanticModel.Compilation, parameter),
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
427return semanticModel.Compilation.GetSpecialType(SpecialType.System_Object);
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (1)
148=> _semanticModel.Compilation;
Shared\Extensions\ISymbolExtensions_2.cs (1)
184=> formatter.Format(GetAppropriateDocumentationComment(symbol, semanticModel.Compilation, cancellationToken).SummaryText,
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (1)
53return IsValidAccessingType(type, semanticModel.Compilation);
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (2)
91=> ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, notification, context.CancellationToken); 100=> ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, notification, context.CancellationToken);
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
143semanticModel.Compilation.GetBestTypeByMetadataName(typeof(Enumerable).FullName!) != null;
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
454Debug.Assert(semanticModel.Compilation.Options.ReportSuppressedDiagnostics); 742var suppressMessageAttributeType = semanticModel.Compilation.SuppressMessageAttributeType();
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
175=> semanticModel.Compilation.GetTypeByMetadataName(typeof(T).FullName!);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (3)
272if (!this.SupportsFieldExpression(semanticModel.Compilation)) 288if (!this.SupportsFieldExpression(semanticModel.Compilation)) 341var compilation = semanticModel.Compilation;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
109var nullableType = semanticModel.Compilation.GetTypeByMetadataName(typeof(Nullable<>).FullName!);
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (1)
69!AreEqualOrHaveImplicitConversion(trueAssignment.Type, falseAssignment.Type, trueAssignment.SemanticModel!.Compilation))
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (1)
147var secondConversion = semanticModel.Compilation.ClassifyCommonConversion(castType, conversionType);
src\Analyzers\Core\CodeFixes\AddExplicitCast\Fixer.cs (1)
170&& semanticModel.Compilation.ClassifyCommonConversion(argumentType, parameterType).IsIdentity)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
438var compilation = semanticModel.Compilation;
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (2)
67var enumerableType = semanticModel.Compilation.GetBestTypeByMetadataName(typeof(Enumerable).FullName!); 74var conversion = semanticModel.Compilation.ClassifyCommonConversion(elementType, variableDeclarator.Symbol.Type);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
295var compilation = semanticModel.Compilation;
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (2)
42var compilation = semanticModel.Compilation; 91var constructorInCompilation = (IMethodSymbol?)SymbolKey.Create(constructor).Resolve(semanticModel.Compilation).Symbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateDeconstructMethodService.State.cs (1)
75returnType: semanticModel.Compilation.GetSpecialType(SpecialType.System_Void),
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (3)
182select CreateSwitchArm(generator, semanticModel.Compilation, caseLabel); 187newArms.Add(CreateNullSwitchArm(generator, semanticModel.Compilation)); 193newArms.Add(CreateDefaultSwitchArm(generator, semanticModel.Compilation));
src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (1)
56var assemblyToScope = model.Compilation.Assembly;
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
EditAndContinue\EditAndContinueTestVerifier.cs (2)
175VerifySemanticEdits(expectedResult.SemanticEdits, result.SemanticEdits, oldModel.Compilation, newModel.Compilation, oldRoot, newRoot, assertMessagePrefix);
Microsoft.CodeAnalysis.Test.Utilities (7)
CommonTestBase.cs (2)
664var original = OperationTreeVerifier.GetOperationTree(model.Compilation, operation); 665var cloned = OperationTreeVerifier.GetOperationTree(model.Compilation, clonedOperation);
Compilation\SemanticModelExtensions.cs (1)
25string operationTree = OperationTreeVerifier.GetOperationTree(model.Compilation, operation, initialIndent);
Compilation\TestOperationVisitor.cs (2)
815semanticModel.Compilation.CreateBuiltinOperator(symbol.Name, method.ReturnType, method.Parameters[0].Type); 818semanticModel.Compilation.CreateBuiltinOperator(symbol.Name, method.ReturnType, method.Parameters[0].Type, method.Parameters[1].Type);
Diagnostics\CommonDiagnosticAnalyzers.cs (2)
2745ReportDiagnosticsInAllTrees("RegisterSemanticModelAction", semanticModelContext.SemanticModel.SyntaxTree, semanticModelContext.SemanticModel.Compilation, semanticModelContext.ReportDiagnostic)); 2946context.RegisterSemanticModelAction(context => HandleCallback(context.SemanticModel.SyntaxTree.GetRoot().GetLocation(), context.SemanticModel.Compilation, context.ReportDiagnostic, context.CancellationToken));
Microsoft.CodeAnalysis.UnitTests (3)
Diagnostics\AnalysisContextInfoTests.cs (3)
72c.RegisterCodeBlockAction(b => ThrowIfMatch(nameof(c.RegisterCodeBlockAction), new AnalysisContextInfo(b.SemanticModel.Compilation, b.OwningSymbol, b.CodeBlock))); 73c.RegisterCodeBlockStartAction<SyntaxKind>(b => ThrowIfMatch(nameof(c.RegisterCodeBlockStartAction), new AnalysisContextInfo(b.SemanticModel.Compilation, b.OwningSymbol, b.CodeBlock))); 80c.RegisterSyntaxNodeAction(b => ThrowIfMatch(nameof(c.RegisterSyntaxNodeAction), new AnalysisContextInfo(b.SemanticModel.Compilation, b.Node)), SyntaxKind.ReturnStatement);
Microsoft.CodeAnalysis.VisualBasic (5)
Operations\VisualBasicOperationFactory.vb (5)
1199DirectCast(_semanticModel.Compilation, VisualBasicCompilation), 1287Dim exceptionType As ITypeSymbol = If(boundCatchBlock.ExceptionSourceOpt?.Type, DirectCast(_semanticModel.Compilation, VisualBasicCompilation).GetWellKnownType(WellKnownType.System_Exception)) 1413Dim legacyMode = _semanticModel.Compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_Threading_Monitor__Enter2) Is Nothing 1417DirectCast(_semanticModel.Compilation.GetSpecialType(SpecialType.System_Boolean), TypeSymbol), 1663Dim method = DirectCast(DirectCast(_semanticModel.Compilation, VisualBasicCompilation).
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (4)
112Return semanticModel.Compilation.ObjectType 122Return symbol.ConvertToType(semanticModel.Compilation) 136Return semanticModel.Compilation.ObjectType 183Return semanticModel.Compilation.CreateArrayTypeSymbol(type, rank)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (3)
77Dim updatedCompilation = model.Compilation.ReplaceSyntaxTree(model.SyntaxTree, updatedSyntaxTree) 122Dim compilation = semanticModel.Compilation 145Dim compilation = semanticModel.Compilation
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (1)
308Return model.Compilation.CreatePreprocessingSymbol(token.ValueText)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\CastAnalyzer.vb (2)
41Dim conversion = _semanticModel.Compilation.ClassifyConversion(castType, parameterType) 46Dim conversionElementType = _semanticModel.Compilation.ClassifyConversion(castType, parameterType.ElementType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (1)
617Return model.Compilation.ClassifyConversion(originalType, targetType)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (4)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicCommonGenerationServiceMethods.vb (1)
20Dim options = TryCast(semanticModel.Compilation.Options, VisualBasicCompilationOptions)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
65Dim ienumerableSymbol = model.Compilation.GetTypeByMetadataName(GetType(IEnumerable(Of)).FullName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (1)
53Return model.Compilation.GetCompilationNamespace(ns)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (1)
157Return FindDisposeMethod(semanticModel.Compilation, type, isAsync:=False)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
EndConstructGeneration\EndConstructStatementVisitor.vb (1)
134If boundConstructor.ContainingType.IsDesignerGeneratedTypeWithInitializeComponent(_semanticModel.Compilation) Then
Microsoft.CodeAnalysis.VisualBasic.Features (20)
AddImport\VisualBasicAddImportFeatureService.vb (1)
201addImportService.HasExistingImport(semanticModel.Compilation, root, root, importsStatement, generator))
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (5)
143returnType:=semanticModel.Compilation.GetSpecialType(SpecialType.System_Void), 194targetType = DirectCast(targetType.GetSymbolKey().Resolve(semanticModel.Compilation).Symbol, INamedTypeSymbol) 285semanticModel.Compilation.GetSpecialType(SpecialType.System_Void)) 363targetType = DirectCast(targetType.GetSymbolKey(cancellationToken).Resolve(semanticModel.Compilation, cancellationToken:=cancellationToken).Symbol, INamedTypeSymbol) 392returnType:=semanticModel.Compilation.GetSpecialType(SpecialType.System_Void),
Completion\CompletionProviders\ImplementsClauseCompletionProvider.vb (1)
216defaultListing.Add(semanticModel.Compilation.GlobalNamespace)
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (1)
162Dim namedParameters = attributeType.GetAttributeNamedParameters(semanticModel.Compilation, within)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (1)
85For Each aliasSymbol In semanticModel.Compilation.AliasImports()
Diagnostics\Analyzers\VisualBasicSimplifyTypeNamesDiagnosticAnalyzer.vb (2)
45If (ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, GetAllNotifications(simplifierOptions), cancellationToken)) Then 56If (ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, GetAllNotifications(simplifierOptions), context.CancellationToken)) Then
GenerateType\VisualBasicGenerateTypeService.vb (1)
706propertySymbol = GenerateProperty(propertyName, semanticModel.Compilation.ObjectType)
QuickInfo\VisualBasicSemanticQuickInfoProvider.vb (1)
63Dim documentation = New PredefinedCastExpressionDocumentation(predefinedCastExpression.Keyword.Kind, semanticModel.Compilation)
SignatureHelp\AttributeSignatureHelpProvider.vb (2)
75FilterToVisibleAndBrowsableSymbolsAndNotUnsafeSymbols(options.HideAdvancedMembers, semanticModel.Compilation). 113Dim namedParameters = constructor.ContainingType.GetAttributeNamedParameters(semanticModel.Compilation, within).
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (1)
78FilterToVisibleAndBrowsableSymbolsAndNotUnsafeSymbols(options.HideAdvancedMembers, semanticModel.Compilation).
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.NormalType.vb (1)
27FilterToVisibleAndBrowsableSymbolsAndNotUnsafeSymbols(options.HideAdvancedMembers, semanticModel.Compilation).
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
90FilterToVisibleAndBrowsableSymbolsAndNotUnsafeSymbols(options.HideAdvancedMembers, semanticModel.Compilation).
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicCommonGenerationServiceMethods.vb (1)
20Dim options = TryCast(semanticModel.Compilation.Options, VisualBasicCompilationOptions)
src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
65Dim ienumerableSymbol = model.Compilation.GetTypeByMetadataName(GetType(IEnumerable(Of)).FullName)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (19)
Classification\SyntaxClassification\NameSyntaxClassifier.vb (1)
157If symbol.IsMyNamespace(semanticModel.Compilation) Then
CodeCleanup\AsyncOrIteratorFunctionReturnTypeFixer.vb (4)
86Dim taskType = semanticModel.Compilation.GetTypeByMetadataName(GetType(Task).FullName) 96Dim taskOfT = semanticModel.Compilation.GetTypeByMetadataName(GetType(Task(Of)).FullName) 121Dim iEnumerableType = semanticModel.Compilation.GetTypeByMetadataName(GetType(IEnumerable).FullName) 137Dim iEnumerableOfT = semanticModel.Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (4)
112Return semanticModel.Compilation.ObjectType 122Return symbol.ConvertToType(semanticModel.Compilation) 136Return semanticModel.Compilation.ObjectType 183Return semanticModel.Compilation.CreateArrayTypeSymbol(type, rank)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (3)
77Dim updatedCompilation = model.Compilation.ReplaceSyntaxTree(model.SyntaxTree, updatedSyntaxTree) 122Dim compilation = semanticModel.Compilation 145Dim compilation = semanticModel.Compilation
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (1)
308Return model.Compilation.CreatePreprocessingSymbol(token.ValueText)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\CastAnalyzer.vb (2)
41Dim conversion = _semanticModel.Compilation.ClassifyConversion(castType, parameterType) 46Dim conversionElementType = _semanticModel.Compilation.ClassifyConversion(castType, parameterType.ElementType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (1)
617Return model.Compilation.ClassifyConversion(originalType, targetType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (1)
53Return model.Compilation.GetCompilationNamespace(ns)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSemanticFactsService.vb (1)
157Return FindDisposeMethod(semanticModel.Compilation, type, isAsync:=False)
Utilities\IntrinsicOperators\AbstractIntrinsicOperatorDocumentation.vb (1)
53Dim returnType = semanticModel.Compilation.GetTypeByMetadataName(ReturnTypeMetadataName)
Microsoft.CodeAnalysis.Workspaces (30)
Recommendations\AbstractRecommendationService.cs (4)
34namedSymbols = namedSymbols.FilterToVisibleAndBrowsableSymbols(options.HideAdvancedMembers, semanticModel.Compilation); 35unnamedSymbols = unnamedSymbols.FilterToVisibleAndBrowsableSymbols(options.HideAdvancedMembers, semanticModel.Compilation); 114_context.SemanticModel.Compilation.Assembly, 137return namespaceSymbol.ContainsAccessibleTypesOrNamespaces(_context.SemanticModel.Compilation.Assembly);
Recommendations\AbstractRecommendationServiceRunner.cs (4)
192var expressionSymbol = _context.SemanticModel.Compilation.GetTypeByMetadataName(typeof(Expression<>).FullName); 279var containingNamespaceSymbol = semanticModel.Compilation.GetCompilationNamespace( 293: semanticModel.LookupNamespacesAndTypes(_context.Position, semanticModel.Compilation.GlobalNamespace, nameof(System)) 325specialTypeSymbol ??= _context.SemanticModel.Compilation.GetSpecialType(specialType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
401var compilation = firstBlock.SemanticModel!.Compilation;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (3)
84(ISymbol)semanticModel.Compilation.Assembly; 190var enumerableType = semanticModel.Compilation.IEnumerableOfTType(); 244return symbolInfo.GetAnySymbol().ConvertToType(semanticModel.Compilation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (1)
267SymbolKey.Equals(semanticModel.Compilation, symbol.Name, localName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (3)
854return originalThrowExpressionType.IsOrDerivesFromExceptionType(this.OriginalSemanticModel.Compilation) != 855newThrowExpressionType.IsOrDerivesFromExceptionType(this.SpeculativeSemanticModel.Compilation); 943IsReferenceConversion(this.OriginalSemanticModel.Compilation, newSymbol.ContainingType, symbol.ContainingType))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (2)
36if (!s_treeAliasMap.TryGetValue(semanticModel.Compilation, out var treeMap) || 52var treeMap = s_treeAliasMap.GetValue(semanticModel.Compilation, static _ => new TreeMap());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (2)
136if (addImportsService.HasExistingImport(model.Compilation, root, node, namespaceSyntax, generator)) 161model.Compilation, root, context, importsToAdd, generator, options, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (3)
49var delegateTypes = types.Select(t => t.GetDelegateType(semanticModel.Compilation)); 77return objectAsDefault ? semanticModel.Compilation.ObjectType : null; 107return objectAsDefault ? semanticModel.Compilation.ObjectType : null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (2)
414factory, semanticModel.Compilation, parameter, fieldAccess)); 463var throwStatement = factory.CreateThrowArgumentNullExceptionStatement(semanticModel.Compilation, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
74factory, generatorInternal, semanticModel.Compilation, semanticModel.SyntaxTree.Options, containingType, symbols);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
41protected Compilation Compilation => SemanticModel.Compilation;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (1)
48? [semanticModel.Compilation.GetSpecialType(SpecialType.System_Boolean)]
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (2)
70var typeSymbol = SymbolAnnotation.GetSymbol(annotation1, semanticModel.Compilation); 81var typeSymbol = semanticModel.Compilation.GetSpecialType(specialType);
Microsoft.Interop.ComInterfaceGenerator (2)
Analyzers\AddGeneratedComClassFixer.cs (1)
28var attribute = gen.Attribute(gen.TypeExpression(editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute)).WithAdditionalAnnotations(Simplifier.AddImportsAnnotation));
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (1)
75var comp = editor.SemanticModel.Compilation;
Microsoft.Interop.LibraryImportGenerator (45)
Analyzers\ConvertToLibraryImportFixer.cs (13)
205INamedTypeSymbol? dllImportAttrType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.DllImportAttribute); 210INamedTypeSymbol libraryImportAttrType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.LibraryImportAttribute)!; 251editor.Generator.TypeExpression(editor.SemanticModel.Compilation.GetSpecialType(SpecialType.System_Int32))); 404editor.SemanticModel.Compilation.GetBestTypeByMetadataName( 456ITypeSymbol stringMarshallingType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.StringMarshalling)!; 465ITypeSymbol stringMarshallingType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.StringMarshalling)!; 473generator.TypeOfExpression(generator.TypeExpression(editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.AnsiStringMarshaller))))); 577if (editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.UnmanagedCallConvAttribute) is null) 593CallingConvention.Cdecl => editor.SemanticModel.Compilation.ObjectType.ContainingAssembly. 595CallingConvention.StdCall => editor.SemanticModel.Compilation.ObjectType.ContainingAssembly. 597CallingConvention.ThisCall => editor.SemanticModel.Compilation.ObjectType.ContainingAssembly. 599CallingConvention.FastCall => editor.SemanticModel.Compilation.ObjectType.ContainingAssembly. 620generator.TypeExpression(editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Type)),
Analyzers\CustomMarshallerAttributeFixer.cs (32)
167ManualTypeMarshallingHelper.TryResolveManagedType(entryPointTypeSymbol, ManualTypeMarshallingHelper.ReplaceGenericPlaceholderInType(managedTypeSymbolInAttribute, entryPointTypeSymbol, model.Compilation), isLinearCollectionMarshaller, IgnoreArityMismatch, out ITypeSymbol managedType); 208var (_, methods) = StatelessMarshallerShapeHelper.GetShapeForType(marshallerType, managedType, isLinearCollectionMarshaller, editor.SemanticModel.Compilation); 209INamedTypeSymbol spanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Span_Metadata)!; 210INamedTypeSymbol readOnlySpanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 228statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 240statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 248gen.TypeExpression(editor.SemanticModel.Compilation.GetSpecialType(SpecialType.System_Int32)), 251gen.GetAccessorDeclaration(statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) }))); 267statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 283statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 298statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 314statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 330statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 345statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 382return gen.TypeExpression(editor.SemanticModel.Compilation.GetSpecialType(SpecialType.System_IntPtr)); 396return editor.SemanticModel.Compilation.GetSpecialType(SpecialType.System_IntPtr); 404var (_, methods) = StatefulMarshallerShapeHelper.GetShapeForType(marshallerType, managedType, isLinearCollectionMarshaller, editor.SemanticModel.Compilation); 405INamedTypeSymbol spanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Span_Metadata)!; 406INamedTypeSymbol readOnlySpanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 422statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 432statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 442statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 452statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 460gen.TypeExpression(editor.SemanticModel.Compilation.GetSpecialType(SpecialType.System_Int32)), 463gen.GetAccessorDeclaration(statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) }))); 473statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 483statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 497statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 511statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 520statements: new[] { DefaultMethodStatement(gen, editor.SemanticModel.Compilation) })); 549return gen.TypeExpression(editor.SemanticModel.Compilation.GetSpecialType(SpecialType.System_IntPtr)); 563return editor.SemanticModel.Compilation.GetSpecialType(SpecialType.System_IntPtr);
Microsoft.Interop.SourceGeneration (1)
IncrementalGeneratorInitializationContextExtensions.cs (1)
37(context, ct) => SymbolEqualityComparer.Default.Equals(context.Attributes[0].AttributeClass.ContainingAssembly, context.SemanticModel.Compilation.GetSpecialType(SpecialType.System_Object).ContainingAssembly))
Microsoft.ML.InternalCodeAnalyzer (1)
BestFriendAnalyzer.cs (1)
51var comp = model.Compilation;
Microsoft.VisualStudio.LanguageServices.CSharp (1)
CodeModel\CSharpCodeModelService.cs (1)
977return semanticModel.Compilation.GetSpecialType(specialType).GetEscapedFullName();
Microsoft.VisualStudio.LanguageServices.VisualBasic (3)
CodeModel\MethodXML\MethodXmlBuilder.vb (2)
515Dim type = GetTypeFromPredefinedCastKeyword(SemanticModel.Compilation, predefinedCastExpression.Keyword.Kind) 542GenerateNumber(upperBound, SemanticModel.Compilation.GetSpecialType(SpecialType.System_Int32))
CodeModel\VisualBasicCodeModelService.vb (1)
3486Return semanticModel.Compilation.GetSpecialType(specialType).GetEscapedFullName()
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
299model = model.Compilation.GetSemanticModel(arrowExpression.SyntaxTree);
System.Text.RegularExpressions.Generator (2)
RegexGenerator.Parser.cs (1)
41Compilation compilation = sm.Compilation;
UpgradeToGeneratedRegexCodeFixer.cs (1)
83Compilation compilation = semanticModel.Compilation;