63124 references to Debug
aspire (40)
Backchannel\ExtensionBackchannel.cs (2)
100Debug.Assert(endpoint is not null); 725Debug.Assert(!string.IsNullOrEmpty(serverCertificate));
Certificates\CertificateGeneration\CertificateManager.cs (1)
762Debug.Assert(pemEnvelope != null);
Certificates\CertificateGeneration\MacOSCertificateManager.cs (1)
90Debug.Assert(oldTrustLevel == TrustLevel.Full); // Mac trust is all or nothing
Certificates\CertificateGeneration\UnixCertificateManager.cs (1)
353Debug.Assert(IsCommandAvailable(OpenSslCommand), "How did we trust without the openssl command?");
Commands\ConfigCommand.cs (1)
61Debug.Assert(cmd.Description is not null);
Commands\PipelineCommandBase.cs (1)
594Debug.Assert(stepId != null, "Activity data should have a StepId for task activities.");
Commands\RunCommand.cs (1)
141Debug.Assert(_startDebugSessionOption is not null);
Interaction\ExtensionInteractionService.cs (21)
70Debug.Assert(result); 80Debug.Assert(result); 87Debug.Assert(result); 97Debug.Assert(result); 301Debug.Assert(result); 309Debug.Assert(result); 316Debug.Assert(result); 323Debug.Assert(result); 330Debug.Assert(result); 342Debug.Assert(result); 350Debug.Assert(result); 357Debug.Assert(result); 364Debug.Assert(result); 371Debug.Assert(result); 377Debug.Assert(result); 390Debug.Assert(result); 399Debug.Assert(result); 407Debug.Assert(result); 429Debug.Assert(result); 445Debug.Assert(result); 461Debug.Assert(result);
Mcp\McpResourceToolRefreshService.cs (1)
96Debug.Assert(resource.McpServer is not null);
src\Shared\CircularBuffer.cs (2)
129Debug.Assert(!_buffer.Contains(removedItem), "Item was not correctly removed."); 202Debug.Assert(!_buffer.Contains(removedItem), "Item was not correctly removed.");
src\Shared\ConsoleLogs\LogEntries.cs (4)
85Debug.Assert(logLine.Timestamp == null || logLine.Timestamp.Value.Kind == DateTimeKind.Utc, "Timestamp should always be UTC."); 188Debug.Assert(BaseLineNumber != null, "Should be set before this method is run."); 193Debug.Assert(pause.EndTime is not null, "Pause should have ended before trying to insert another log."); 211Debug.Assert(BaseLineNumber is not null);
src\Shared\ConsoleLogs\SharedAIHelpers.cs (1)
700Debug.Assert(totalValues >= values.Count, "Total values should be large or equal to the values passed into the method.");
src\Shared\Otlp\OtlpHelpers.cs (1)
108Debug.Assert(result, "Guid.TryFormat not successful.");
src\Shared\PathLookupHelper.cs (1)
37Debug.Assert(!string.IsNullOrWhiteSpace(command));
Telemetry\AspireCliTelemetry.cs (1)
168Debug.WriteLine("No reported activity found to record the error event.");
Aspire.Azure.AI.Inference (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.AI.OpenAI (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Data.Tables (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Messaging.EventHubs (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Messaging.ServiceBus (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Messaging.WebPubSub (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Npgsql (2)
AspireAzureNpgsqlExtensions.cs (2)
38Debug.Assert(azureSettings != null); 67Debug.Assert(azureSettings != null);
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (2)
AspireAzureEFPostgreSqlExtensions.cs (2)
59Debug.Assert(azureSettings != null); 84Debug.Assert(azureSettings != null);
Aspire.Azure.Search.Documents (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Security.KeyVault (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Storage.Blobs (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Storage.Files.DataLake (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Azure.Storage.Queues (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Confluent.Kafka (2)
KafkaConsumerSettings.cs (1)
50Debug.Assert(Config is not null);
KafkaProducerSettings.cs (1)
50Debug.Assert(Config is not null);
Aspire.Dashboard (60)
Components\Controls\Chart\ChartBase.cs (2)
490Debug.Assert(InstrumentViewModel.MatchedDimensions != null); 491Debug.Assert(InstrumentViewModel.Instrument != null);
Components\Controls\Chart\MetricTable.razor.cs (2)
47Debug.Assert(_jsModule != null, "The module should be initialized before chart data is sent to control."); 217Debug.Assert(exemplars.Count == newMetrics.Sum(m => m.Value.Exemplars.Count), $"Expected {exemplars.Count} exemplars but got {newMetrics.Sum(m => m.Value.Exemplars.Count)} exemplars.");
Components\Controls\Chart\PlotlyChart.razor.cs (1)
60Debug.Assert(_jsModule != null, "The module should be initialized before chart data is sent to control.");
Components\Controls\PropertyValues\ResourceNameButtonValue.razor.cs (1)
52Debug.Assert(_resource != null, "Should only get here if there is a matched resource.");
Components\Controls\ResourceDetails.razor.cs (1)
349Debug.Assert(_isMaskAllChecked != null);
Components\Dialogs\McpServerDialog.razor.cs (1)
104Debug.Assert(_mcpUrl != null);
Components\Interactions\InteractionsProvider.cs (2)
283Debug.Assert(currentDialogReference != null, "Dialog should have been created in UI thread."); 473Debug.Assert(message != null, "Message should have been created in UI thread.");
Components\Pages\ConsoleLogs.razor.cs (3)
248Debug.Assert(added, "Should not receive duplicate resources in initial snapshot data."); 346Debug.Assert(_resources is not null); 859Debug.Assert(removed, "Cannot remove unknown resource.");
Components\Pages\Resources.razor.cs (2)
301Debug.Assert(added, "Should not receive duplicate resources in initial snapshot data."); 336Debug.Assert(removed, "Cannot remove unknown resource.");
Components\Pages\TraceDetail.razor.cs (2)
188Debug.Assert(_spanWaterfallViewModels != null); 418Debug.Assert(_layout is not null);
Configuration\DashboardOptions.cs (6)
105Debug.Assert(_primaryApiKeyBytes is not null, "Should have been parsed during validation."); 174Debug.Assert(_primaryApiKeyBytes is not null, "Should have been parsed during validation."); 234Debug.Assert(_primaryApiKeyBytes is not null, "Should have been parsed during validation."); 301Debug.Assert(_parsedEndpointAddresses is not null, "Should have been parsed during validation."); 401Debug.Assert(_nameClaimTypes is not null, "Should have been parsed during validation."); 407Debug.Assert(_usernameClaimTypes is not null, "Should have been parsed during validation.");
DashboardWebApplication.cs (2)
950Debug.Assert(_validationFailures.Count == 0, "Validation failures: " + Environment.NewLine + string.Join(Environment.NewLine, _validationFailures)); 956Debug.Assert(_validationFailures.Count == 0, "Validation failures: " + Environment.NewLine + string.Join(Environment.NewLine, _validationFailures));
Model\Assistant\AssistantChatViewModel.cs (7)
587Debug.Assert(_currentAssistantResponse != null); 688Debug.Assert(_currentAssistantResponse != null); 781Debug.Assert(Monitor.IsEntered(_lock)); 805Debug.Assert(_currentAssistantResponse != null); 806Debug.Assert(Monitor.IsEntered(_lock)); 817Debug.Assert(_currentAssistantResponse != null); 818Debug.Assert(Monitor.IsEntered(_lock));
Model\Assistant\ChatClientFactory.cs (1)
91Debug.Assert(_endpoint is not null && _credential is not null && _httpClient is not null);
Model\ConsoleLogsManager.cs (1)
40Debug.Assert(_filters != null, "There should be filters if manager has been initialized.");
Model\PauseManager.cs (2)
62Debug.Assert(intervals.Length > 0, "There should be at least one interval."); 64Debug.Assert(lastInterval.End is null, "The last interval should not have an end time if unpausing.");
Model\ResourceOutgoingPeerResolver.cs (2)
43Debug.Assert(added, "Should not receive duplicate resources in initial snapshot data."); 70Debug.Assert(removed, "Cannot remove unknown resource.");
Model\ResourceViewModel.cs (2)
206Debug.Assert(x != null); 207Debug.Assert(y != null);
Model\ThemeManager.cs (1)
98Debug.Assert(_effectiveTheme != null, "There should be an effective theme if theme manager has been initialized.");
Otlp\Storage\TelemetryRepository.cs (4)
996Debug.Assert(_tracesLock.IsReadLockHeld || _tracesLock.IsWriteLockHeld, $"Must get lock before calling {nameof(GetTraceUnsynchronized)}."); 1011Debug.Assert(_tracesLock.IsReadLockHeld || _tracesLock.IsWriteLockHeld, $"Must get lock before calling {nameof(GetTraceAndCloneUnsynchronized)}."); 1020Debug.Assert(_tracesLock.IsReadLockHeld || _tracesLock.IsWriteLockHeld, $"Must get lock before calling {nameof(GetSpanAndCloneUnsynchronized)}."); 1255Debug.Assert(_traces.Contains(trace), "Trace not found in traces collection.");
ServiceClient\DashboardClient.cs (4)
179Debug.Assert( 191Debug.Assert( 349Debug.Assert(Monitor.IsEntered(_lock), "Caller must hold _lock."); 413Debug.Fail("Attempt to remove an unknown resource view model.");
src\Shared\CircularBuffer.cs (2)
129Debug.Assert(!_buffer.Contains(removedItem), "Item was not correctly removed."); 202Debug.Assert(!_buffer.Contains(removedItem), "Item was not correctly removed.");
src\Shared\CompareHelpers.cs (1)
30Debug.Assert(encodedByteCount == requestBytesSpan.Length, "Should match because span was previously trimmed to byte count value.");
src\Shared\ConsoleLogs\LogEntries.cs (4)
85Debug.Assert(logLine.Timestamp == null || logLine.Timestamp.Value.Kind == DateTimeKind.Utc, "Timestamp should always be UTC."); 188Debug.Assert(BaseLineNumber != null, "Should be set before this method is run."); 193Debug.Assert(pause.EndTime is not null, "Pause should have ended before trying to insert another log."); 211Debug.Assert(BaseLineNumber is not null);
src\Shared\ConsoleLogs\SharedAIHelpers.cs (1)
700Debug.Assert(totalValues >= values.Count, "Total values should be large or equal to the values passed into the method.");
src\Shared\Otlp\OtlpHelpers.cs (1)
108Debug.Assert(result, "Guid.TryFormat not successful.");
Telemetry\DashboardTelemetrySender.cs (2)
43Debug.Assert(Client is not null, "HttpClient must be initialized."); 92Debug.Assert(State == TelemetrySessionState.Uninitialized, "Telemetry session has already been started.");
Aspire.Hosting (39)
ApplicationModel\ResourceLoggerService.cs (4)
449Debug.Assert(_backlog.EntriesCount == 0, "The backlog should be empty if there are no subscribers."); 488Debug.Assert(Monitor.IsEntered(_lock)); 499Debug.Assert(Monitor.IsEntered(_lock)); 514Debug.Assert(Monitor.IsEntered(_lock));
ApplicationModel\UserSecretsParameterDefault.cs (1)
31Debug.WriteLine($"Failed to set value for parameter '{parameterName}' in application '{applicationName}' to user secrets.");
Dashboard\DashboardEventHandlers.cs (3)
66Debug.Assert(executionContext.IsRunMode, "Dashboard resource should only be added in run mode"); 546Debug.Assert(options.DashboardUrl is not null, "DashboardUrl should not be null"); 547Debug.Assert(options.OtlpGrpcEndpointUrl is not null || options.OtlpHttpEndpointUrl is not null, "OtlpGrpcEndpointUrl and OtlpHttpEndpointUrl should not both be null");
Dcp\DcpExecutor.cs (3)
147Debug.Assert(_dcpInfo is not null, "DCP info should not be null at this point"); 411Debug.Assert(!entry.LogsAvailable.HasValue || entry.LogsAvailable.Value, "entry.LogsAvailable should never be 'false'"); 2481Debug.Assert(ea.IsProxied);
Dcp\OtlpEndpointReferenceGatherer.cs (3)
52Debug.Fail("Dashboard does not have any endpoints??"); 68Debug.Assert(endpointReference != null, "Dashboard should have at least one matching OTLP endpoint"); 74Debug.Assert(url is not null, $"We should be able to get a URL value from the reference dashboard endpoint '{endpointReference.EndpointName}'");
Exec\ExecResourceManager.cs (2)
237Debug.Assert(command[0] == '"' && command[^1] == '"'); 267Debug.Assert(command[0] == '"' && command[^1] == '"');
ExternalServiceBuilderExtensions.cs (2)
78Debug.Assert(uri is not null || urlParameter is not null, "Either uri or urlParameter must be provided."); 145Debug.Assert(uri is not null, "URI must be set at this point.");
IInteractionService.cs (1)
160Debug.Assert(Monitor.IsEntered(_lock));
InteractionService.cs (1)
273Debug.Assert(
Orchestrator\ApplicationOrchestrator.cs (2)
189Debug.Assert(context.DcpResourceName is not null, "Container that is starting should always include the DCP name."); 227Debug.Assert(endpoint.AllocatedEndpoint is not null, "Endpoint should be allocated at this point as we're calling this from ResourceEndpointsAllocatedEvent handler.");
Pipelines\Internal\DeploymentStateManagerBase.cs (2)
206Debug.Assert(_state is not null); 226Debug.Assert(_state is not null);
ProjectResourceBuilderExtensions.cs (1)
1010Debug.Assert(!e.EndpointAnnotation.FromLaunchProfile, "Endpoints from launch profile should never make it here");
src\Shared\CircularBuffer.cs (2)
129Debug.Assert(!_buffer.Contains(removedItem), "Item was not correctly removed."); 202Debug.Assert(!_buffer.Contains(removedItem), "Item was not correctly removed.");
src\Shared\CompareHelpers.cs (1)
30Debug.Assert(encodedByteCount == requestBytesSpan.Length, "Should match because span was previously trimmed to byte count value.");
src\Shared\ConsoleLogs\LogEntries.cs (4)
85Debug.Assert(logLine.Timestamp == null || logLine.Timestamp.Value.Kind == DateTimeKind.Utc, "Timestamp should always be UTC."); 188Debug.Assert(BaseLineNumber != null, "Should be set before this method is run."); 193Debug.Assert(pause.EndTime is not null, "Pause should have ended before trying to insert another log."); 211Debug.Assert(BaseLineNumber is not null);
src\Shared\PasswordGenerator.cs (1)
80Debug.Assert(destination.Length >= minValues);
src\Shared\PathLookupHelper.cs (1)
37Debug.Assert(!string.IsNullOrWhiteSpace(command));
UserSecrets\NoopUserSecretsManager.cs (3)
29Debug.WriteLine($"User secrets are not enabled. Cannot set secret '{name}'."); 35Debug.WriteLine($"User secrets are not enabled. Generating and adding secret '{name}' to configuration in-memory."); 42Debug.WriteLine("User secrets are not enabled. Cannot save state.");
UserSecrets\UserSecretsManagerFactory.cs (1)
132Debug.WriteLine($"Failed to save value to application user secrets.");
VersionChecking\VersionCheckService.cs (1)
85Debug.Assert(_appHostVersion != null);
Aspire.Hosting.Analyzers (1)
Infrastructure\WellKnownTypes.cs (1)
43Debug.Assert(name == typeIdName, $"Enum name ({typeIdName}) and type name ({name}) must match at {i}");
Aspire.Hosting.Azure (2)
AzureProvisioningResource.cs (1)
92Debug.Assert(compilation.Count == 1);
src\Shared\PathLookupHelper.cs (1)
37Debug.Assert(!string.IsNullOrWhiteSpace(command));
Aspire.Hosting.Azure.AppContainers (3)
AzureContainerAppExtensions.cs (3)
263Debug.Assert(resourceToken is not null); 300Debug.Assert(resourceToken is not null); 323Debug.Assert(resourceToken is not null);
Aspire.Hosting.Azure.CosmosDB (2)
AzureCosmosDBResource.cs (1)
197Debug.Assert(!UseAccessKeyAuthentication, "AddRoleAssignments should not be called when using AccessKeyAuthentication");
src\Shared\Cosmos\CosmosUtils.cs (1)
76Debug.Assert(accountEndpoint is not null ^ connectionString is not null, "only one should be set.");
Aspire.Hosting.Azure.PostgreSQL (1)
AzurePostgresFlexibleServerResource.cs (1)
274Debug.Assert(!UsePasswordAuthentication, "AddRoleAssignments should not be called when using UsePasswordAuthentication");
Aspire.Hosting.Azure.Redis (2)
AzureManagedRedisResource.cs (1)
203Debug.Assert(!UseAccessKeyAuthentication, "AddRoleAssignments should not be called when using AccessKeyAuthentication");
AzureRedisCacheResource.cs (1)
137Debug.Assert(!UseAccessKeyAuthentication, "AddRoleAssignments should not be called when using AccessKeyAuthentication");
Aspire.Hosting.Integration.Analyzers (1)
src\Aspire.Hosting.Analyzers\Infrastructure\WellKnownTypes.cs (1)
43Debug.Assert(name == typeIdName, $"Enum name ({typeIdName}) and type name ({name}) must match at {i}");
Aspire.Hosting.RemoteHost (2)
Ats\AtsCallbackProxyFactory.cs (1)
374Debug.Assert(originalArgs.Length == argTypes.Length, "originalArgs and argTypes must have the same length");
AtsCapabilityScanner.cs (1)
2700System.Diagnostics.Debug.WriteLine($"Failed to load XML documentation for {location}: {ex.Message}");
Aspire.Microsoft.Azure.Cosmos (1)
src\Shared\Cosmos\CosmosUtils.cs (1)
76Debug.Assert(accountEndpoint is not null ^ connectionString is not null, "only one should be set.");
Aspire.Microsoft.EntityFrameworkCore.Cosmos (1)
src\Shared\Cosmos\CosmosUtils.cs (1)
76Debug.Assert(accountEndpoint is not null ^ connectionString is not null, "only one should be set.");
Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration (1)
src\Components\Common\AzureComponent.cs (1)
66Debug.Assert(settings is IConnectionStringSettings, $"The settings object should implement {nameof(IConnectionStringSettings)}.");
Aspire.Playground.Tests (2)
src\Shared\PasswordGenerator.cs (1)
80Debug.Assert(destination.Length >= minValues);
src\Shared\PathLookupHelper.cs (1)
37Debug.Assert(!string.IsNullOrWhiteSpace(command));
Aspire.RabbitMQ.Client (5)
src\Components\Aspire.RabbitMQ.Client\RabbitMQEventSourceLogForwarder.cs (5)
48Debug.Assert( 103Debug.Assert(EventData.PayloadNames?.Count == 2 && EventData.Payload?.Count == 2); 104Debug.Assert(EventData.PayloadNames[0] == "message"); 105Debug.Assert(EventData.PayloadNames[1] == "ex"); 111Debug.Assert(exData is not null && exData.Count == 4);
Aspire.TestUtilities (1)
src\Shared\PathLookupHelper.cs (1)
37Debug.Assert(!string.IsNullOrWhiteSpace(command));
CodeStyleConfigFileGenerator (5)
Program.cs (3)
49Debug.Assert(language is "CSharp" or "VisualBasic"); 122Debug.Assert(sortedRulesById.Count > 0); 160Debug.Assert(rule.CustomTags.Any(c => c == s_neverTag || c == s_whenExplicitlyEnabledTag || c == s_recommendedTag || c == s_highlyRecommendedTag),
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
ConfigurationSchemaGenerator (31)
ConfigurationBindingGenerator.ForSchemaGeneration.cs (2)
66Debug.Assert(_typesToParse.Count == 1, "there should only be one type to parse to start."); 86Debug.Assert(result is not null);
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (8)
83Debug.Assert(invocation is not null); 86Debug.Assert(targetMethod.IsExtensionMethod); 139Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & overload) is not 0); 195Debug.Assert(spec is ArraySpec or UnsupportedTypeSpec); 370Debug.Assert(spec is DictionarySpec or UnsupportedTypeSpec); 375Debug.Assert(spec is EnumerableSpec or UnsupportedTypeSpec); 657Debug.Assert(initExceptionMessage is not null); 692Debug.Assert(ctor is not null);
RuntimeSource\Configuration.Binder\Parser\BinderInvocation.cs (1)
25Debug.Assert(IsCandidateSyntaxNode(context.Node));
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (2)
258Debug.Assert((MethodsToGen.ConfigBinder_Any & overload) is not 0); 270Debug.Assert((MethodsToGen.ConfigBinder_Get & overload) is not 0 ||
RuntimeSource\Configuration.Binder\Parser\OptionsBuilderConfigurationExtensions.cs (4)
30Debug.Assert(typeSymbol?.IsValueType is not true); 49Debug.Assert(paramCount >= 2); 76Debug.Assert(paramCount >= 2); 89Debug.Assert((MethodsToGen.OptionsBuilderExt_Any & overload) is not 0);
RuntimeSource\Configuration.Binder\Parser\OptionsConfigurationServiceCollectionExtensions.cs (3)
68Debug.Assert(paramCount is 4); 74Debug.Assert(typeSymbol?.IsValueType is not true); 92Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & overload) is not 0);
RuntimeSource\Configuration.Binder\Specs\BindingHelperInfo.cs (1)
175Debug.Assert(registeredForBindCore);
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (6)
31Debug.Assert((MethodsToGen.ConfigBinder_Bind & interceptor) is 0); 44Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & interceptor) is not 0); 65Debug.Assert((MethodsToGen.ConfigBinder_Bind & overload) is not 0); 91Debug.Assert((MethodsToGen.ConfigBinder_Bind & overload) is 0); 103Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & overload) is not 0); 171Debug.Assert(BinderInvocation.IsBindingOperation(invocation));
RuntimeSource\Configuration.Binder\Specs\Members\MemberSpec.cs (1)
14Debug.Assert(member is IPropertySymbol or IParameterSymbol);
RuntimeSource\Configuration.Binder\Specs\TypeIndex.cs (3)
82Debug.Assert(castType is not CollectionPopulationCastType.NotApplicable); 110Debug.Assert(type.StringParsableTypeKind is not StringParsableTypeKind.AssignFromSectionValue); 125Debug.Assert(displayString.Length > 0);
crossgen2 (9)
Program.cs (1)
616System.Diagnostics.Debug.Assert(inputModules.Count == 1);
src\runtime\src\coreclr\tools\Common\InstructionSetHelpers.cs (8)
138Debug.Assert((cpuidInfo.Edx & (1 << 15)) != 0); // CMOV 265Debug.Assert(InstructionSet.X64_AVX == InstructionSet.X86_AVX); 266Debug.Assert(InstructionSet.X64_AVX2 == InstructionSet.X86_AVX2); 286Debug.Assert(InstructionSet.X64_AVX512 == InstructionSet.X86_AVX512); 322Debug.Assert(InstructionSet.X86_AVX512 == InstructionSet.X64_AVX512); 325Debug.Assert(InstructionSet.X86_Vector256 == InstructionSet.X64_Vector256); 326Debug.Assert(InstructionSet.X86_VectorT256 == InstructionSet.X64_VectorT256); 327Debug.Assert(InstructionSet.X86_VectorT512 == InstructionSet.X64_VectorT512);
csc (12)
src\roslyn\src\Compilers\Shared\BuildClient.cs (4)
155Debug.Assert(serverResult.Value.RanOnServer); 238Debug.Assert(buildResponse != null); 273Debug.Assert(false); 353Debug.Assert(PlatformInformation.IsWindows);
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (3)
73Debug.Assert(!string.IsNullOrWhiteSpace(CompilerHash), "A hash value is required to communicate with the server"); 85Debug.Assert(!string.IsNullOrWhiteSpace(compilerHash), "CompilerHash is required to send request to the build server"); 506Debug.Assert(reason is object);
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (4)
79Debug.Assert(workingDirectory is object); 199Debug.Assert(pipeName is object); 833Debug.Assert(Stream is null); 871Debug.Assert(Stream is not null);
src\roslyn\src\Compilers\Shared\CompilerServerLogger.cs (1)
138Debug.Assert(false, e.Message);
CSharpSyntaxGenerator (7)
SourceWriter.cs (1)
1640System.Diagnostics.Debug.Assert(!IsRequiredFactoryField(nd, field));
src\roslyn\src\Compilers\CSharp\Portable\Syntax\SyntaxKindFacts.cs (6)
22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1247Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i));
dotnet (84)
CommandInvocation.cs (1)
29Debug.Assert(parseResult.CanBeInvoked());
Commands\DotNetCommandFactory.cs (2)
29Debug.Assert(framework == null, "BuiltInCommand doesn't support the 'framework' argument."); 30Debug.Assert(configuration == Constants.DefaultConfiguration, "BuiltInCommand doesn't support the 'configuration' argument.");
Commands\Package\Add\PackageAddCommand.cs (2)
31Debug.Assert(isFileBasedApp || allowedAppKinds.HasFlag(AppKinds.ProjectBased)); 36Debug.Assert(!isFileBasedApp);
Commands\Package\List\PackageListCommand.cs (1)
28Debug.Assert(isFileBasedApp || allowedAppKinds.HasFlag(AppKinds.ProjectBased));
Commands\Package\Remove\PackageRemoveCommand.cs (2)
35Debug.Assert(isFileBasedApp || allowedAppKinds.HasFlag(AppKinds.ProjectBased)); 40Debug.Assert(!isFileBasedApp);
Commands\Package\VirtualProjectPackageReflector.cs (1)
31Debug.Assert(!string.IsNullOrEmpty(item.Include), "Expected only PackageReference Include items in virtual project.");
Commands\Project\Convert\ProjectConvertCommand.cs (1)
488Debug.Assert(project.ExpandedName != null && project.ProjectFilePath != null && project.ProjectFilePath == project.Name);
Commands\Run\CSharpCompilerCommand.cs (2)
334Debug.Assert(!optionName.StartsWith('/') && optionName.EndsWith(':')); 350Debug.Assert(!string.IsNullOrWhiteSpace(result));
Commands\Run\FileBasedAppRunPlan.cs (4)
227Debug.Assert(cache.PreviousEntry != null); 252Debug.Assert(cacheEntry.ImplicitBuildFiles.Count != 0); 392Debug.Assert(entryPointFileDirectory != null); 435Debug.Assert(!cache.TriedDeserializingPreviousEntry);
Commands\Run\FileBasedAppSourceEditor.cs (3)
38Debug.Assert(!field.IsDefault); 160Debug.Assert(!trivia.IsKind(SyntaxKind.SingleLineCommentTrivia), 262Debug.Assert(startBeforeWhiteSpace > 0);
Commands\Run\RunCommand.cs (12)
124Debug.Assert(projectFileFullPath is null ^ entryPointFileFullPath is null); 125Debug.Assert(!readCodeFromStdin || entryPointFileFullPath is not null); 193Debug.Assert(!ReadCodeFromStdin); 342Debug.Assert(EntryPointFileFullPath is not null); 436Debug.Assert(ProjectFileFullPath is not null); 480Debug.Assert(EntryPointFileFullPath != null); 535Debug.Assert(EntryPointFileFullPath is not null); 700Debug.Assert(projectFileOrDirectoryPath == null); 859Debug.Assert(projectFilePath is null && entryPointFilePath is "-"); 883Debug.Assert(nonLoggerArgs[0] == "-"); 1045Debug.Assert(EntryPointFileFullPath != null); 1084Debug.Assert(ProjectFileFullPath != null);
Commands\Run\RunFileBuildCacheEntry.cs (1)
85Debug.Assert(globalProperties.Comparer == GlobalPropertiesComparer);
Commands\Run\VirtualProjectBuildingCommand.cs (10)
73Debug.Assert(!field.IsDefault); 128Debug.Assert(!NoRestore); 160Debug.Assert(cache is not null); 191Debug.Assert(result != 0); 198Debug.Assert(buildLevel is BuildLevel.All or BuildLevel.Csc); 278Debug.Assert(buildRequest.ProjectInstance != null); 430Debug.Assert(cache.CurrentEntry.AdditionalSources.Count == 0); 486Debug.Assert(cache.CurrentEntry.AdditionalSources.Count == 0); 489Debug.Assert(entryPointFileDirectory != null); 586Debug.Assert(buildOrRestoreResult != null);
Commands\Solution\Add\SolutionAddCommand.cs (2)
96Debug.Assert(relativeSolutionFolderPath is not null); 132Debug.Assert(solution.SerializerExtension is not null);
Commands\Test\MTP\IPC\Serializers\AzureDevOpsLogMessageSerializer.cs (1)
68Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\CommandLineOptionMessagesSerializer.cs (1)
125Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\DiscoveredTestMessagesSerializer.cs (1)
251Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\DisplayMessageSerializer.cs (1)
86Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\FileArtifactMessagesSerializer.cs (1)
157Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\HandshakeMessageSerializer.cs (1)
29Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\TestInProgressMessagesSerializer.cs (1)
117Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\TestResultMessagesSerializer.cs (1)
348Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\IPC\Serializers\TestSessionEventSerializer.cs (1)
68Debug.Assert(stream.CanSeek, "We expect a seekable stream.");
Commands\Test\MTP\Models.cs (2)
44Debug.Assert(Module is not null); 89Debug.Assert(_group.Module is not null);
Commands\Test\MTP\SolutionAndProjectUtility.cs (1)
178Debug.Assert(projectFilePath is not null);
Commands\Test\MTP\Terminal\FileUtilities.cs (1)
33Debug.Fail("Casing test failed: " + exc);
Commands\Test\MTP\TestResultsDirectoryResolver.cs (1)
105Debug.Assert(IsUnderRoot(resolved, resultsDirectory), $"'{resolved}' escaped the results directory '{resultsDirectory}'.");
Commands\Test\VSTest\TestCommand.cs (1)
75Debug.Assert(settings[0] == "--", "Settings should start with --");
Commands\Tool\Install\ToolInstallGlobalOrToolPathCommand.cs (2)
146Debug.Assert(_store != null); 160Debug.Assert(_packageIdentityWithRange.HasValue);
Commands\Tool\Install\ToolInstallLocalCommand.cs (1)
93Debug.Assert(_packageIdentityWithRange != null);
ReleasePropertyProjectLocator.cs (1)
51Debug.Assert(propertyToCheck == MSBuildPropertyNames.PUBLISH_RELEASE || propertyToCheck == MSBuildPropertyNames.PACK_RELEASE, "Only PackRelease or PublishRelease are currently expected.");
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.11.0-1.26407.111\contentFiles\cs\net11.0\BuildProtocol.cs (3)
73Debug.Assert(!string.IsNullOrWhiteSpace(CompilerHash), "A hash value is required to communicate with the server"); 85Debug.Assert(!string.IsNullOrWhiteSpace(compilerHash), "CompilerHash is required to send request to the build server"); 506Debug.Assert(reason is object);
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.11.0-1.26407.111\contentFiles\cs\net11.0\BuildServerConnection.cs (4)
79Debug.Assert(workingDirectory is object); 199Debug.Assert(pipeName is object); 833Debug.Assert(Stream is null); 871Debug.Assert(Stream is not null);
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.11.0-1.26407.111\contentFiles\cs\net11.0\CompilerServerLogger.cs (1)
138Debug.Assert(false, e.Message);
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.11.0-1.26407.111\contentFiles\cs\net11.0\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
Telemetry\ExternalTelemetryProperties.cs (4)
36Debug.Assert(e is ArgumentException | e is SecurityException | e is InvalidCastException); 68Debug.Assert(false, $"Unexpected exception from GetProductInfo: ${e.GetType().Name}: ${e.Message}"); 99Debug.Assert(e is DllNotFoundException || e is EntryPointNotFoundException); 123Debug.Assert(e is DllNotFoundException || e is EntryPointNotFoundException);
Telemetry\TelemetryClient.cs (1)
314Debug.Fail(e.ToString());
dotnet-aot (18)
NativeEntryPoint.cs (4)
159Debug.WriteLine($"Failed to initialize telemetry in the native entry point: {ex}"); 204Debug.WriteLine($"First-run setup failed in the AOT entry point; deferring to the managed CLI: {ex}"); 329Debug.WriteLine($"AOT external command resolution failed; falling back to managed CLI: {ex}"); 421Debug.WriteLine($"Failed to emit AOT parser telemetry: {ex}");
SdkRootLocator.cs (1)
74Debug.Assert(
src\sdk\src\Cli\dotnet\CommandInvocation.cs (1)
29Debug.Assert(parseResult.CanBeInvoked());
src\sdk\src\Cli\dotnet\Commands\DotNetCommandFactory.cs (2)
29Debug.Assert(framework == null, "BuiltInCommand doesn't support the 'framework' argument."); 30Debug.Assert(configuration == Constants.DefaultConfiguration, "BuiltInCommand doesn't support the 'configuration' argument.");
src\sdk\src\Cli\dotnet\Commands\Run\FileBasedAppRunPlan.cs (4)
227Debug.Assert(cache.PreviousEntry != null); 252Debug.Assert(cacheEntry.ImplicitBuildFiles.Count != 0); 392Debug.Assert(entryPointFileDirectory != null); 435Debug.Assert(!cache.TriedDeserializingPreviousEntry);
src\sdk\src\Cli\dotnet\Commands\Run\RunFileBuildCacheEntry.cs (1)
85Debug.Assert(globalProperties.Comparer == GlobalPropertiesComparer);
src\sdk\src\Cli\dotnet\Telemetry\ExternalTelemetryProperties.cs (4)
36Debug.Assert(e is ArgumentException | e is SecurityException | e is InvalidCastException); 68Debug.Assert(false, $"Unexpected exception from GetProductInfo: ${e.GetType().Name}: ${e.Message}"); 99Debug.Assert(e is DllNotFoundException || e is EntryPointNotFoundException); 123Debug.Assert(e is DllNotFoundException || e is EntryPointNotFoundException);
src\sdk\src\Cli\dotnet\Telemetry\TelemetryClient.cs (1)
314Debug.Fail(e.ToString());
dotnet-dev-certs (3)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (1)
765Debug.Assert(pemEnvelope != null);
src\aspnetcore\src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
91Debug.Assert(oldTrustLevel == TrustLevel.Full); // Mac trust is all or nothing
src\aspnetcore\src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
354Debug.Assert(IsCommandAvailable(OpenSslCommand), "How did we trust without the openssl command?");
dotnet-format (3)
Analyzers\AnalyzerRunner.cs (1)
109Debug.Assert(referencedProject is not null);
CodeFormatter.cs (2)
237Debug.WriteLine($"Including generated file '{document.FilePath}'."); 262Debug.WriteLine($"Including source generated file '{generatedDocument.FilePath}'.");
dotnet-sourcelink (1)
dotnet-svcutil-lib (1435)
Bootstrapper\SvcutilBootstrapper.cs (3)
67Debug.Fail($"The NoBootstrapping property is not set, this would cause infinite bootstrapping recursion!"); 73Debug.Fail("Bootstrapping is enabled for the bootstrapper! This would cause an infinite bootstrapping recursion!"); 111Debug.Assert(frameworkInfo.IsDnx, "The bootstrapper has been enabled for a non-DNX platform!");
CmdCredentialsProvider.cs (2)
188System.Diagnostics.Debug.Assert(_serviceUri == null, "provider already started for the specified service URI"); 199System.Diagnostics.Debug.Assert(_serviceUri == serviceUri, "provider not statrted for the specified service URI");
CodeDomFixup\CodeDomVisitors\AttributeFixer.cs (1)
43System.Diagnostics.Debug.Assert(generator != null);
CodeDomFixup\CodeDomVisitors\CreateCallbackImpl.cs (2)
234System.Diagnostics.Debug.Assert(!methodNames.ContainsKey(method.Name), $"Key '{method.Name}' already added to dictionary!"); 452System.Diagnostics.Debug.Assert((IsSyncOperationContract(method)), "Only support sync callback on immersive project");
CodeDomFixup\CodeDomVisitors\SpecialIXmlSerializableRemapper.cs (1)
101System.Diagnostics.Debug.Assert(!_specialIXmlSerializableTypes.ContainsKey(typeName), $"Key '{typeName}' already added to dictionary!");
CodeDomFixup\CodeDomVisitors\TypeDeclCollection.cs (1)
45System.Diagnostics.Debug.Assert(!AllTypeDecls.ContainsKey(fullName), $"Key '{fullName}' already added to dictionary!");
CodeDomFixup\EndpointSelector.cs (1)
274System.Diagnostics.Debug.Assert(singleSignedEncryptedParam, "Unexpected number of SignedEncrypted token parameters in transport security binding!");
CodeDomFixup\MethodCreationHelper.cs (1)
2172System.Diagnostics.Debug.Assert(endpointNames.Count == 1, "have and only have on endpoint has to exist for a given client type");
CommandLineParser.cs (1)
59System.Diagnostics.Debug.Assert(!s_allSwitches.Any(s => s.Equals(this)), $"A switch with name or abbreviation '{name}+{abbreviation}' has already been crated!");
CommandProcessorOptions.cs (3)
323Debug.Assert(this.ToolContext.HasValue, $"{nameof(ToolContext)} is not initialized!"); 324Debug.Assert(this.Verbosity.HasValue, $"{nameof(Verbosity)} is not initialized!"); 700Debug.Assert(this.BootstrapPath != null, $"{nameof(this.BootstrapPath)} is not initialized!");
FrameworkFork\Microsoft.CodeDom\Compiler\CompilerInfo.cs (1)
75Debug.Assert(_providerOptions != null, "Created CompilerInfo w/ null _providerOptions");
FrameworkFork\Microsoft.CodeDom\Compiler\IndentTextWriter.cs (1)
95Debug.Assert(value >= 0, "Bogus Indent... probably caused by mismatched Indent++ and Indent--");
FrameworkFork\Microsoft.CodeDom\Microsoft\CSharpCodeProvider.cs (1)
3269Debug.Assert(names.Length > 0);
FrameworkFork\Microsoft.CodeDom\Microsoft\VBCodeProvider.cs (7)
370Debug.Assert(IsKeyword("for")); 371Debug.Assert(IsKeyword("foR")); 372Debug.Assert(IsKeyword("cdec")); 373Debug.Assert(!IsKeyword("cdab")); 374Debug.Assert(!IsKeyword("cdum")); 2858Debug.Assert(names.Length > 0); 3175Debug.Assert(_statementDepth >= 0, "statementDepth >= 0");
FrameworkFork\Microsoft.CodeDom\System\CodeTypeReference.cs (1)
265Debug.Assert(q.Count == 1, "We should have one and only one in the rank queue.");
FrameworkFork\Microsoft.CodeDom\System\FixedStringLookup.cs (2)
48Debug.Assert(value.Length == i + 1, "Lookup table contains an item in the wrong subtable. Item name: " + value); 51Debug.Assert(string.Compare(lastValue, value, ((ignoreCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal)) < 0,
FrameworkFork\Microsoft.Xml\Xml\Base64Decoder.cs (7)
128Debug.Assert(buffer != null); 129Debug.Assert(count >= 0); 130Debug.Assert(index >= 0); 131Debug.Assert(buffer.Length - index >= count); 132Debug.Assert((buffer as byte[]) != null); 162Debug.Assert(pCharsEndPos - pChars >= 0); 163Debug.Assert(pBytesEndPos - pBytes >= 0);
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (24)
143Debug.Assert(rguiData.Length == 4); 168Debug.Assert(rgulU.Length == s_cNumeMax); 175Debug.Assert(iulD != 0, "iulD != 0", "Divided by zero!"); 176Debug.Assert(iulD > 0, "iulD > 0", "Invalid data: less than zero"); 177Debug.Assert(ciulU > 0, "ciulU > 0", "No data in the array"); 313Debug.Assert(dwlAccum < s_ulInt32Base, "dwlAccum < x_lInt32Base", ""); 338Debug.Assert(dwlAccum < s_ulInt32Base); 357Debug.Assert(dwlAccum < s_ulInt32Base, "dwlAccum < x_dwlBaseUI4", "Integer overflow"); 407Debug.Assert(dwlAccum < dwlDivisor); 409Debug.Assert((dwlAccum / dwlDivisor) < s_ulInt32Base); 433Debug.Assert(dwlAccum < s_ulInt32Base); 452Debug.Assert(bPrec <= s_maxPrecision && bPrec > 0, "bPrec <= MaxPrecision && bPrec > 0", "Invalid numeric precision"); 458Debug.Assert(uiDigit < 10); 572Debug.Assert(m_bScale <= s_NUMERIC_MAX_PRECISION, "m_bScale <= NUMERIC_MAX_PRECISION", "In AssertValid"); 573Debug.Assert(m_bScale <= m_bPrec, "m_bScale <= m_bPrec", "In AssertValid"); 574Debug.Assert(m_bScale >= 0, "m_bScale >= 0", "In AssertValid"); 575Debug.Assert(m_bPrec > 0, "m_bPrec > 0", "In AssertValid"); 576Debug.Assert(CLenFromPrec(m_bPrec) >= m_bLen, "CLenFromPrec(m_bPrec) >= m_bLen", "In AssertValid"); 577Debug.Assert(m_bLen <= s_cNumeMax, "m_bLen <= x_cNumeMax", "In AssertValid"); 584Debug.Assert(m_bLen == 1, "m_bLen == 1", "In AssertValid"); 589Debug.Assert(rglData[iulData] == 0, "rglData[iulData] == 0", "In AssertValid"); 644Debug.Assert(val >= 0 && val < 100); 650Debug.Assert(val > -10000 && val < 10000); 662Debug.Assert(val >= 0 && val < 1000);
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\XmlBinaryReader.cs (29)
388Debug.Assert(len >= 2 && (data[0] == 0xdf && data[1] == 0xff)); 830Debug.Fail("Unexpected parent NodeType"); 925Debug.Assert(decl != null); 1135Debug.Fail("should never happen"); 1225Debug.Fail("should never happen"); 1320Debug.Fail("should never happen"); 1415Debug.Fail("should never happen"); 1510Debug.Fail("should never happen"); 1605Debug.Fail("should never happen"); 1700Debug.Fail("should never happen"); 2015Debug.Assert(_mark <= _end, "Mark should never be past End"); 2016Debug.Assert(_mark <= _pos, "Mark should never be after Pos"); 2036Debug.Assert((_attributes[i].contentPos >= 0) && (_attributes[i].contentPos <= (end))); 2044Debug.Assert(_attrCount == 0); 2062Debug.Assert((_pos + require) >= _end); 2102Debug.Assert(0 != (b & 0x80)); 2335Debug.Assert(pos >= 0 && cch >= 0); 2352Debug.Assert((offset & 1) == 0); 2772Debug.Assert(_stringValue == null, "this.stringValue == null"); 2773Debug.Assert(_token == BinXmlToken.CData, "this.token == BinXmlToken.CData"); 2971Debug.Assert(_mark < 0); 3096Debug.Assert(_pos >= 3); 3101Debug.Assert(_pos >= 1); 3107Debug.Assert(_pos >= 2); 3505Debug.Assert(_checkCharacters, "this.checkCharacters"); 3507Debug.Assert(0 == ((_pos - _tokDataPos) & 1), "Data size should not be odd"); 3567Debug.Assert(!_checkCharacters, "!this.checkCharacters"); 3570Debug.Assert(0 == ((_pos - _tokDataPos) & 1), "Data size should not be odd"); 4481System.Diagnostics.Debug.WriteLine("Unhandled token: " + token.ToString());
FrameworkFork\Microsoft.Xml\Xml\BinHexDecoder.cs (7)
123Debug.Assert(buffer != null); 124Debug.Assert(count >= 0); 125Debug.Assert(index >= 0); 126Debug.Assert(buffer.Length - index >= count); 127Debug.Assert((buffer as byte[]) != null); 189Debug.Assert(pCharsEndPos - pChars >= 0); 190Debug.Assert(pBytesEndPos - pBytes >= 0);
FrameworkFork\Microsoft.Xml\Xml\BitStack.cs (2)
51Debug.Assert(_curr != 0x1, "Stack empty"); 72Debug.Assert(_curr != 0x1, "Stack empty");
FrameworkFork\Microsoft.Xml\Xml\BufferBuilder.cs (3)
433Debug.Assert(_lastBuffer == null); 481Debug.Assert(_buffers != null); 532Debug.Assert(newLength <= _length);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathDocumentBuilder.cs (22)
148Debug.Assert(prefix != null && localName != null && ns != null && localName.Length != 0 && baseUri != null); 209Debug.Assert(_pageParent[_idxParent].NodeType == XPathNodeType.Element); 283Debug.Assert(!prefix.Equals("xmlns")); 284Debug.Assert(_idxParent == 0 || _pageParent[_idxParent].NodeType == XPathNodeType.Element); 285Debug.Assert(_idxSibling == 0 || _pageSibling[_idxSibling].NodeType == XPathNodeType.Attribute); 302Debug.Assert(_pageSibling[_idxSibling].NodeType == XPathNodeType.Attribute); 313Debug.Assert(_idxParent != 0, "ID attribute must have an element parent"); 475Debug.Assert(_pageParent[_idxParent].NodeType == XPathNodeType.Element); 486Debug.Assert(_idxSibling == 0 || _pageSibling[_idxSibling].NodeType == XPathNodeType.Attribute); 487Debug.Assert(!prefix.Equals("xmlns") && !namespaceName.Equals(XmlReservedNs.NsXmlNs)); 488Debug.Assert(_idxParent == 0 || _idxNmsp != 0); 489Debug.Assert(_idxParent == 0 || _pageParent[_idxParent].NodeType == XPathNodeType.Element); 543Debug.Assert(prefix.Equals("xml"), "xmlns:xml namespace declaration should always be present in the list."); 622Debug.Assert(pageElem == null || pageElem[idxElem].NodeType == XPathNodeType.Element); 652Debug.Assert(xptyp != XPathNodeType.Namespace); 695Debug.Assert(_lineInfo.HasLineInfo(), "HasLineInfo should have been checked before this."); 723Debug.Assert(xptyp != XPathNodeType.Root && xptyp != XPathNodeType.Namespace); 739Debug.Assert(_idxParent + 1 == idxNew || idxNew == 1); 759Debug.Assert(_textBldr.HasText || (_idxSibling == 0 && _idxParent == 0), "Cannot create empty text node unless it's a top-level text node."); 760Debug.Assert(_idxSibling == 0 || !_pageSibling[_idxSibling].IsText, "Cannot create adjacent text nodes."); 889Debug.Assert((int)XPathNodeType.Text < (int)XPathNodeType.SignificantWhitespace); 890Debug.Assert((int)XPathNodeType.SignificantWhitespace < (int)XPathNodeType.Whitespace);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathDocumentNavigator.cs (10)
40Debug.Assert(pageCurrent != null && idxCurrent != 0); 41Debug.Assert((pageParent == null) == (idxParent == 0)); 87Debug.Assert(false, "ReadStringValue() should have taken care of these node types."); 91Debug.Assert(_idxParent != 0 && _pageParent[_idxParent].HasCollapsedText, 100Debug.Assert(_pageCurrent[_idxCurrent].NodeType == XPathNodeType.Text); 119Debug.Assert(page[idx].NodeType == XPathNodeType.Element || page[idx].IsText); 453Debug.Assert(_pageParent != null); 494Debug.Assert(page[idx].NodeType == XPathNodeType.Element); 690Debug.Assert(page[idx].HasCollapsedText); 698Debug.Assert(page[idx].IsText);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNode.cs (13)
158Debug.Assert(HasCollapsedText, "Do not call CollapsedLinePosition unless HasCollapsedText is true."); 213Debug.Assert(localName == null || (object)Document.NameTable.Get(localName) == (object)localName, "localName must be atomized."); 225Debug.Assert(localName == null || (object)Document.NameTable.Get(localName) == (object)localName, "localName must be atomized."); 363Debug.Assert(info != null && idxParent <= UInt16.MaxValue); 374Debug.Assert(lineNumOffset >= 0 && lineNumOffset <= MaxLineNumberOffset, "Line number offset too large or small: " + lineNumOffset); 375Debug.Assert(linePosOffset >= 0 && linePosOffset <= MaxLinePositionOffset, "Line position offset too large or small: " + linePosOffset); 385Debug.Assert(posOffset >= 0 && posOffset <= MaxCollapsedPositionOffset, "Collapsed text line position offset too large or small: " + posOffset); 402Debug.Assert(NodeType == XPathNodeType.Element); 413Debug.Assert(NodeType == XPathNodeType.Element); 441Debug.Assert(pageSibling != null && idxSibling != 0 && idxSibling <= UInt16.MaxValue, "Bad argument"); 442Debug.Assert(_idxSibling == 0, "SetSibling should not be called more than once."); 460Debug.Assert(pageSimilar != null && idxSimilar != 0 && idxSimilar <= UInt16.MaxValue, "Bad argument"); 461Debug.Assert(_idxSimilar == 0, "SetSimilarElement should not be called more than once.");
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNodeHelper.cs (32)
30Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element); 74Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 79Debug.Assert(pageNode[idxNode].NodeType == XPathNodeType.Attribute); 93Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 113Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 123Debug.Assert(idx != 0); 141Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 164Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 182Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 183Debug.Assert(idxNode <= UInt16.MaxValue); 184Debug.Assert(pageNode[0].PageInfo.PageNumber <= Int16.MaxValue); 197Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 203Debug.Assert(idx != 0); 231Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 264Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 302Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 315Debug.Assert(typ != XPathNodeType.Attribute && typ != XPathNodeType.Namespace); 334Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 335Debug.Assert(pageNode[idxNode].NodeType != XPathNodeType.Attribute); 371Debug.Assert(idxAnc != 0 && pageAnc != null); 397Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 427Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 454Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)"); 516Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)"); 613Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)"); 614Debug.Assert(typ != XPathNodeType.Text, "Text should be handled by GetTextFollowing in order to take into account collapsed text."); 615Debug.Assert(page[idx].NodeType != XPathNodeType.Attribute, "Current node should never be an attribute or namespace--caller should handle this case."); 652Debug.Assert(!page[idx].IsAttrNmsp, "GetContentFollowing should never return attributes or namespaces."); 671Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)"); 672Debug.Assert(!page[idx].IsAttrNmsp, "Current node should never be an attribute or namespace--caller should handle this case."); 749Debug.Assert(pageNode[idxNode].HasAttribute || pageNode[idxNode].HasContentChild, "Caller must check HasAttribute/HasContentChild on parent before calling GetChild."); 750Debug.Assert(pageNode[idxNode].HasAttribute || !pageNode[idxNode].HasCollapsedText, "Text child is virtualized and therefore is not present in the physical node page.");
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNodeInfoAtom.cs (4)
125Debug.Assert(localName != null && namespaceUri != null && prefix != null && doc != null); 286Debug.Assert(that != null); 287Debug.Assert((object)_doc == (object)that._doc); 288Debug.Assert(_pageInfo == null);
FrameworkFork\Microsoft.Xml\Xml\Core\CharEntityEncoderFallback.cs (2)
165Debug.Assert(_charEntityIndex < _charEntity.Length); 180Debug.Assert(_charEntityIndex <= _charEntity.Length);
FrameworkFork\Microsoft.Xml\Xml\Core\HtmlEncodedRawTextWriter.cs (20)
79Debug.Assert(name != null && name.Length > 0); 126Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 132Debug.Assert(prefix.Length == 0); 171Debug.Assert(prefix.Length == 0); 196Debug.Assert(prefix.Length == 0); 316Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 320Debug.Assert(prefix.Length == 0); 383Debug.Assert(target != null && target.Length != 0 && text != null); 405Debug.Assert(text != null); 440Debug.Assert(buffer != null); 441Debug.Assert(index >= 0); 442Debug.Assert(count >= 0 && index + count <= buffer.Length); 465Debug.Assert((int)ElementProperties.URI_PARENT == (int)AttributeProperties.URI); 466Debug.Assert((int)ElementProperties.BOOL_PARENT == (int)AttributeProperties.BOOLEAN); 467Debug.Assert((int)ElementProperties.NAME_PARENT == (int)AttributeProperties.NAME); 602Debug.Assert(pSrc <= pSrcEnd); 690Debug.Assert(pSrc <= pSrcEnd); 858Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 866Debug.Assert(prefix.Length == 0); 922Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\HtmlUtf8RawTextWriter.cs (20)
78Debug.Assert(name != null && name.Length > 0); 125Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 131Debug.Assert(prefix.Length == 0); 170Debug.Assert(prefix.Length == 0); 195Debug.Assert(prefix.Length == 0); 315Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 319Debug.Assert(prefix.Length == 0); 382Debug.Assert(target != null && target.Length != 0 && text != null); 404Debug.Assert(text != null); 439Debug.Assert(buffer != null); 440Debug.Assert(index >= 0); 441Debug.Assert(count >= 0 && index + count <= buffer.Length); 464Debug.Assert((int)ElementProperties.URI_PARENT == (int)AttributeProperties.URI); 465Debug.Assert((int)ElementProperties.BOOL_PARENT == (int)AttributeProperties.BOOLEAN); 466Debug.Assert((int)ElementProperties.NAME_PARENT == (int)AttributeProperties.NAME); 599Debug.Assert(pSrc <= pSrcEnd); 687Debug.Assert(pSrc <= pSrcEnd); 854Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 862Debug.Assert(prefix.Length == 0); 918Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\IncrementalReadDecoders.cs (15)
70Debug.Assert(chars != null); 71Debug.Assert(len >= 0); 72Debug.Assert(startPos >= 0); 73Debug.Assert(chars.Length - startPos >= len); 75Debug.Assert(len > 0); 90Debug.Assert(str != null); 91Debug.Assert(len >= 0); 92Debug.Assert(startPos >= 0); 93Debug.Assert(str.Length - startPos >= len); 95Debug.Assert(len > 0); 114Debug.Assert(buffer != null); 115Debug.Assert(count >= 0); 116Debug.Assert(index >= 0); 117Debug.Assert(buffer.Length - index >= count); 119Debug.Assert((buffer as char[]) != null);
FrameworkFork\Microsoft.Xml\Xml\Core\QueryOutputWriter.cs (2)
137Debug.Assert(!_outputDocType); 350Debug.Assert(!_inCDataSection);
FrameworkFork\Microsoft.Xml\Xml\Core\QueryOutputWriterV1.cs (2)
134Debug.Assert(!_outputDocType); 313Debug.Assert(!_inCDataSection);
FrameworkFork\Microsoft.Xml\Xml\Core\ReadContentAsBinaryHelper.cs (11)
110Debug.Assert(false); 114Debug.Assert(_state == State.InReadContent); 166Debug.Assert(false); 170Debug.Assert(_state == State.InReadContent); 222Debug.Assert(false); 226Debug.Assert(_state == State.InReadElementContent); 278Debug.Assert(false); 282Debug.Assert(_state == State.InReadElementContent); 333Debug.Assert(_reader.NodeType == XmlNodeType.Element); 387Debug.Assert(_decoder != null); 412Debug.Assert(_valueOffset == _valueChunkLength);
FrameworkFork\Microsoft.Xml\Xml\Core\ReadContentAsBinaryHelperAsync.cs (11)
60Debug.Assert(false); 64Debug.Assert(_state == State.InReadContent); 116Debug.Assert(false); 120Debug.Assert(_state == State.InReadContent); 172Debug.Assert(false); 176Debug.Assert(_state == State.InReadElementContent); 228Debug.Assert(false); 232Debug.Assert(_state == State.InReadElementContent); 276Debug.Assert(_reader.NodeType == XmlNodeType.Element); 304Debug.Assert(_decoder != null); 329Debug.Assert(_valueOffset == _valueChunkLength);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlAsyncCheckReader.cs (3)
43Debug.Assert(!(reader is IXmlSchemaInfo)); 50Debug.Assert(!(reader is IXmlSchemaInfo)); 55Debug.Assert(!(reader is IXmlSchemaInfo));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlAutoDetectWriter.cs (6)
35Debug.Assert(writerSettings.OutputMethod == XmlOutputMethod.AutoDetect); 107Debug.Assert(_wrapped != null); 310Debug.Assert(_wrapped != null); 316Debug.Assert(_wrapped != null); 322Debug.Assert(_wrapped != null); 414Debug.Assert(_wrapped == null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingReader.cs (3)
58Debug.Assert(checkCharacters || ignoreWhitespace || ignoreComments || ignorePis || (int)dtdProcessing != -1); 200Debug.Assert(false); 685Debug.Assert(readerAsNSResolver != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingReaderAsync.cs (1)
51Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingWriter.cs (1)
65Debug.Assert(checkValues || replaceNewLines);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlEncodedRawTextWriter.cs (45)
136Debug.Assert(writer != null && settings != null); 154Debug.Assert(stream != null && settings != null); 263Debug.Assert(name != null && name.Length > 0); 304Debug.Assert(localName != null && localName.Length > 0); 305Debug.Assert(prefix != null); 336Debug.Assert(localName != null && localName.Length > 0); 337Debug.Assert(prefix != null); 368Debug.Assert(localName != null && localName.Length > 0); 369Debug.Assert(prefix != null); 388Debug.Assert(localName != null && localName.Length > 0); 389Debug.Assert(prefix != null); 421Debug.Assert(prefix != null && namespaceName != null); 438Debug.Assert(prefix != null); 474Debug.Assert(text != null); 481Debug.Assert(bufPos >= 4); 511Debug.Assert(text != null); 530Debug.Assert(name != null && name.Length > 0); 531Debug.Assert(text != null); 552Debug.Assert(name != null && name.Length > 0); 599Debug.Assert(ws != null); 620Debug.Assert(text != null); 656Debug.Assert(buffer != null); 657Debug.Assert(index >= 0); 658Debug.Assert(count >= 0 && index + count <= buffer.Length); 680Debug.Assert(buffer != null); 681Debug.Assert(index >= 0); 682Debug.Assert(count >= 0 && index + count <= buffer.Length); 698Debug.Assert(data != null); 796Debug.Assert(stream != null || writer != null); 816Debug.Assert(_textContentMarks[0] == 1); 878Debug.Assert(bufPos == 1); 917Debug.Assert(pSrc <= pSrcEnd); 1023Debug.Assert(pSrc <= pSrcEnd); 1106Debug.Assert(s != null); 1136Debug.Assert(pSrc <= pSrcEnd); 1183Debug.Assert(pSrc <= pSrcEnd); 1285Debug.Assert(pSrc <= pSrcEnd); 1418Debug.Assert(pSrc <= pSrcEnd); 1508Debug.Assert(XmlCharType.IsSurrogate(*pSrc)); 1534Debug.Assert(!xmlCharType.IsWhiteSpace((char)ch)); 1535Debug.Assert(!xmlCharType.IsAttributeValueChar((char)ch)); 1566Debug.Assert(inTextContent != value); 1567Debug.Assert(inTextContent || ((_lastMarkPos & 1) == 0)); 1578Debug.Assert(_lastMarkPos + 1 == _textContentMarks.Length); 1845Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlEventCache.cs (5)
128Debug.Assert(idxPage + 1 == _pages.Count); 248Debug.Assert(false, "Unknown event: " + page[idxEvent].EventType); 254Debug.Assert(false, "Unknown event should be added to end of event sequence."); 286Debug.Assert(idxPage + 1 == _pages.Count); 311Debug.Assert(false, "Unknown event should be added to end of event sequence.");
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReader.cs (59)
1066Debug.Assert(parentDepth == 0); 1090Debug.Assert(NodeType == XmlNodeType.EndElement || NodeType == XmlNodeType.None || ReadState == ReadState.Error); 1112Debug.Assert(parentDepth == 0); 1137Debug.Assert(NodeType == XmlNodeType.EndElement); 1260Debug.Assert(xtw is XmlTextWriter); 1442Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.None))); 1443Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Element))); 1444Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Attribute))); 1445Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Text))); 1446Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.CDATA))); 1447Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.EntityReference))); 1448Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Entity))); 1449Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.ProcessingInstruction))); 1450Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Comment))); 1451Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Document))); 1452Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentType))); 1453Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentFragment))); 1454Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Notation))); 1455Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Whitespace))); 1456Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.SignificantWhitespace))); 1457Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.EndElement))); 1458Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.EndEntity))); 1459Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.XmlDeclaration))); 1469Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.None))); 1470Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Element))); 1471Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Attribute))); 1472Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Text))); 1473Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.CDATA))); 1474Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.EntityReference))); 1475Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Entity))); 1476Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.ProcessingInstruction))); 1477Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Comment))); 1478Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Document))); 1479Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.DocumentType))); 1480Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.DocumentFragment))); 1481Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Notation))); 1482Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Whitespace))); 1483Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.SignificantWhitespace))); 1484Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.EndElement))); 1485Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.EndEntity))); 1486Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.XmlDeclaration))); 1496Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.None))); 1497Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Element))); 1498Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Attribute))); 1499Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Text))); 1500Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.CDATA))); 1501Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.EntityReference))); 1502Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Entity))); 1503Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.ProcessingInstruction))); 1504Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Comment))); 1505Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Document))); 1506Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.DocumentType))); 1507Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.DocumentFragment))); 1508Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Notation))); 1509Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Whitespace))); 1510Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.SignificantWhitespace))); 1511Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.EndElement))); 1512Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.EndEntity))); 1513Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.XmlDeclaration)));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReaderAsync.cs (1)
233Debug.Assert(xtw is XmlTextWriter);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReader.cs (49)
426Debug.Assert(reader.NodeType == XmlNodeType.Element); 451Debug.Assert(_curNode.type == XmlNodeType.Attribute); 473Debug.Assert(reader.Depth >= _initialDepth); 483Debug.Assert(reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement); 527Debug.Assert(false); 544Debug.Assert(reader.Depth >= _initialDepth); 581Debug.Assert(reader.Depth >= _initialDepth); 595Debug.Assert(reader.NodeType == XmlNodeType.EndElement || 610Debug.Assert(reader.Depth >= _initialDepth); 646Debug.Assert(false); 867Debug.Assert(AttributeCount > 0); 870Debug.Assert(false); 893Debug.Assert(false); 950Debug.Assert(false); 1003Debug.Assert(AttributeCount > 0); 1006Debug.Assert(false); 1029Debug.Assert(false); 1085Debug.Assert(false); 1144Debug.Assert(false); 1319Debug.Assert(_state == State.ClearNsAttributes || _state == State.Interactive || _state == State.PopNamespaceScope); 1347Debug.Assert(index >= 0 && index <= _nsAttrCount); 1380Debug.Assert(_state == State.Interactive); 1387Debug.Assert(_state == State.ReadElementContentAsBase64 || _state == State.ReadElementContentAsBinHex); 1421Debug.Assert(_state == State.ReadContentAsBase64 || _state == State.ReadContentAsBinHex); 1451Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.Initial))); 1452Debug.Assert(0 != (AttributeActiveStates & (1 << (int)State.Interactive))); 1453Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.Error))); 1454Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.EndOfFile))); 1455Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.Closed))); 1456Debug.Assert(0 != (AttributeActiveStates & (1 << (int)State.PopNamespaceScope))); 1457Debug.Assert(0 != (AttributeActiveStates & (1 << (int)State.ClearNsAttributes))); 1458Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadElementContentAsBase64))); 1459Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadElementContentAsBinHex))); 1460Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadContentAsBase64))); 1461Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadContentAsBinHex))); 1472Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.Initial))); 1473Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.Interactive))); 1474Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.Error))); 1475Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.EndOfFile))); 1476Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.Closed))); 1477Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.PopNamespaceScope))); 1478Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ClearNsAttributes))); 1479Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadElementContentAsBase64))); 1480Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadElementContentAsBinHex))); 1481Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadContentAsBase64))); 1482Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadContentAsBinHex))); 1490Debug.Assert(_tmpNode.localName == string.Empty && _tmpNode.prefix == string.Empty && _tmpNode.name == string.Empty && _tmpNode.namespaceUri == string.Empty); 1533Debug.Assert(false); 1541Debug.Assert(_state == State.Interactive ||
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReaderAsync.cs (19)
47Debug.Assert(reader.Depth >= _initialDepth); 57Debug.Assert(reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement); 101Debug.Assert(false); 118Debug.Assert(reader.Depth >= _initialDepth); 132Debug.Assert(reader.NodeType == XmlNodeType.EndElement || 147Debug.Assert(reader.Depth >= _initialDepth); 183Debug.Assert(false); 284Debug.Assert(AttributeCount > 0); 287Debug.Assert(false); 310Debug.Assert(false); 367Debug.Assert(false); 420Debug.Assert(AttributeCount > 0); 423Debug.Assert(false); 446Debug.Assert(false); 502Debug.Assert(false); 553Debug.Assert(false); 584Debug.Assert(_state == State.Interactive); 591Debug.Assert(_state == State.ReadElementContentAsBase64 || _state == State.ReadElementContentAsBinHex); 625Debug.Assert(_state == State.ReadContentAsBase64 || _state == State.ReadContentAsBinHex);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextEncoder.cs (2)
233Debug.Assert((ch < 0x20 && !_xmlCharType.IsWhiteSpace(ch)) || (ch > 0xFFFD)); 392Debug.Assert((ch < 0x20 && !_xmlCharType.IsWhiteSpace(ch)) || (ch > 0xFFFD));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImpl.cs (200)
323Debug.Assert(nt != null); 343Debug.Assert(_index == 0); 387Debug.Assert(_nameTableFromSettings == false); 408Debug.Assert(_index == 0); 457Debug.Assert(false); 621Debug.Assert(baseUri == null); 714Debug.Assert(baseUri == null); 774Debug.Assert(baseUriStr == string.Empty, "BaseURI can come either from XmlParserContext or from the constructor argument, not from both"); 822Debug.Assert(xmlFragment != null); 848default: Debug.Assert(false); goto case XmlNodeType.None; 1218Debug.Assert(false, "Invalid InitInputType"); 1242Debug.Assert(_nextParsingFunction == ParsingFunction.DocumentContent); 1245Debug.Assert(!_ps.appendMode); 1273Debug.Assert(_parsingFunction == ParsingFunction.ElementContent || 1278Debug.Assert(_curNode.type == XmlNodeType.Element); 1342Debug.Assert(false); 1370Debug.Assert(false); 1402Debug.Assert(_curNode.type == XmlNodeType.EndElement); 1403Debug.Assert(_parsingFunction != ParsingFunction.Eof); 1505Debug.Assert(_parsingMode == ParsingMode.Full); 1524Debug.Assert(false); 1550Debug.Assert(false); 1566Debug.Assert(value is XmlTextReader); 1585Debug.Assert(_outerReader is XmlTextReaderImpl); 2071Debug.Assert(_v1Compat, "XmlTextReaderImpl.Normalization property cannot be accessed on reader created via XmlReader.Create."); 2076Debug.Assert(_v1Compat, "XmlTextReaderImpl.Normalization property cannot be changed on reader created via XmlReader.Create."); 2104Debug.Assert(_v1Compat, "XmlTextReaderImpl.WhitespaceHandling property cannot be accessed on reader created via XmlReader.Create."); 2109Debug.Assert(_v1Compat, "XmlTextReaderImpl.WhitespaceHandling property cannot be changed on reader created via XmlReader.Create."); 2128Debug.Assert(_v1Compat, "XmlTextReaderImpl.DtdProcessing property cannot be accessed on reader created via XmlReader.Create."); 2133Debug.Assert(_v1Compat, "XmlTextReaderImpl.DtdProcessing property cannot be changed on reader created via XmlReader.Create."); 2185Debug.Assert(_v1Compat, "XmlTextReaderImpl.ResetState cannot be called on reader created via XmlReader.Create."); 2226Debug.Assert(_v1Compat, "XmlTextReaderImpl.GetRemainder cannot be called on reader created via XmlReader.Create."); 2228Debug.Assert(_stringBuilder.Length == 0); 2268Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadChars cannot be called on reader created via XmlReader.Create."); 2269Debug.Assert(_outerReader is XmlTextReader); 2310Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadBase64 cannot be called on reader created via XmlReader.Create."); 2311Debug.Assert(_outerReader is XmlTextReader); 2347Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadBinHex cannot be called on reader created via XmlReader.Create."); 2348Debug.Assert(_outerReader is XmlTextReader); 2479Debug.Assert(value >= 0 && value <= _ps.charsUsed); 2566Debug.Assert(_parsingMode == ParsingMode.Full); 2655Debug.Assert(_parsingStatesStackTop == -1); 2656Debug.Assert((systemId != null && systemId.Length > 0) || (publicId != null && publicId.Length > 0)); 2671Debug.Assert(_ps.appendMode); 2687Debug.Assert(_parsingStatesStackTop == -1); 2688Debug.Assert(internalDtd != null); 2845Debug.Assert(InAttributeValueIterator); 2881Debug.Assert(baseUriStr != null); 2887Debug.Assert(baseUri != null); 2898Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.textReader == null); 2899Debug.Assert(baseUriStr != null); 2900Debug.Assert(baseUri == null || (baseUri.ToString().Equals(baseUriStr))); 2991Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null); 2992Debug.Assert(baseUriStr != null); 3022Debug.Assert(_ps.stream == null && _ps.textReader == null); 3023Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0); 3024Debug.Assert(baseUriStr != null); 3025Debug.Assert(str != null); 3080Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl); 3084Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl); 3085Debug.Assert(_nextParsingFunction == ParsingFunction.DocumentContent); 3109Debug.Assert(context != null && context.HasDtdInfo); 3123Debug.Assert(false, "Unhandled DtdProcessing enumeration value."); 3133Debug.Assert(_url != null && _url.Length > 0); 3140Debug.Assert(_xmlResolver != null || !Microsoft.Xml.XmlReaderSettings.EnableLegacyXmlSettings()); 3166Debug.Assert(_ps.bytes != null); 3167Debug.Assert(_ps.bytePos == 0); 3251Debug.Assert(_ps.charPos == 0); 3279Debug.Assert(_ps.stream != null); 3337Debug.Assert(newEncoding.EncodingName != "UTF-8"); 3351Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3352Debug.Assert(_ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false"); 3354Debug.Assert(_ps.charsUsed >= _ps.charPos, "The current position must be in the valid character range."); 3362Debug.Assert(_charactersInDocument >= _ps.charsUsed - _ps.charPos, 3370Debug.Assert(_charactersFromEntities >= _ps.charsUsed - _ps.charPos, 3533Debug.Assert(_ps.charsUsed < _ps.chars.Length); 3543Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3544Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1); 3568Debug.Assert(maxCharsCount >= charsCount); 3587Debug.Assert(false, "We should get an exception again."); 3660Debug.Assert(_stringBuilder.Length == 0 || isTextDecl); 3881Debug.Assert(!isTextDecl); 3891Debug.Assert(false); 4147Debug.Assert(pos == _ps.charsUsed && !_ps.isEof); 4171Debug.Assert(_index == 0); 4545Debug.Assert(_curNode.type == XmlNodeType.Element); 4724Debug.Assert(false, "We should never get to this point."); 4733Debug.Assert(_index > 0); 4738Debug.Assert(_curNode == startTagNode); 4765Debug.Assert(startTag.type == XmlNodeType.EntityReference); 4777Debug.Assert(_attrCount == 0); 4837Debug.Assert(_curNode.type == XmlNodeType.Element); 4845Debug.Assert(_curNode.type == XmlNodeType.Element); 4966Debug.Assert(attrNameLineNo == _ps.LineNo); 5015Debug.Assert(val == XmlComplianceUtil.CDataNormalize(val), "The attribute value is not CDATA normalized!"); 5090Debug.Assert(_curNode.type == XmlNodeType.Element); 5227Debug.Assert(_stringBuilder.Length == 0); 5438Debug.Assert(false, "We should never get to this point."); 5441Debug.Assert(_ps.isEof); 5459Debug.Assert(false); 5499Debug.Assert(attr.nextAttrValueChunk == null); 5528Debug.Assert(_stringBuilder.Length == 0); 5542Debug.Assert(endPos - startPos > 0); 5565Debug.Assert(_stringBuilder.Length > 0); 5586Debug.Assert(endPos - startPos > 0); 5853Debug.Assert(_ps.isEof); 5895Debug.Assert(_stringBuilder.Length == 0); 5896Debug.Assert(_parsingFunction == ParsingFunction.PartialTextValue || 5910Debug.Assert(_stringBuilder.Length > 0); 5964Debug.Assert(_parsingFunction == ParsingFunction.PartialTextValue || _parsingFunction == ParsingFunction.InReadValueChunk || 5976Debug.Assert(_parsingFunction == ParsingFunction.InReadValueChunk); 5981Debug.Assert((_index > 0) ? _nextParsingFunction == ParsingFunction.ElementContent : _nextParsingFunction == ParsingFunction.DocumentContent); 5993Debug.Assert(_parsingFunction == ParsingFunction.InReadContentAsBinary || _parsingFunction == ParsingFunction.InReadElementContentAsBinary); 5998Debug.Assert((_index > 0) ? _nextParsingFunction == ParsingFunction.ElementContent : _nextParsingFunction == ParsingFunction.DocumentContent); 6026Debug.Assert(_stringBuilder.Length == 0); 6067Debug.Assert(_ps.chars[_ps.charPos] == '&'); 6076Debug.Assert(_ps.chars[_ps.charPos] == '&'); 6091Debug.Assert(entityType == EntityType.CharacterDec || entityType == EntityType.CharacterHex); 6243Debug.Assert(false); 6284Debug.Assert(_lastEntity != null); 6290Debug.Assert(_curNode.depth == _index); 6303Debug.Assert(_curNode.type == XmlNodeType.EntityReference); 6304Debug.Assert(Ref.Equal(_lastEntity.Name, _curNode.localName)); 6323Debug.Assert(_stringBuilder.Length == 0); 6349Debug.Assert(_ps.charPos < _ps.charsUsed); 6393Debug.Assert(_stringBuilder.Length == 0); 6451Debug.Assert(!_ps.eolNormalized); 6598Debug.Assert(_stringBuilder.Length == 0); 6659Debug.Assert(!_ps.eolNormalized); 6838Debug.Assert(_dtdProcessing == DtdProcessing.Ignore); 7166Debug.Assert(false, "We should never get to this point."); 7169Debug.Assert(_ps.isEof); 7272Debug.Assert(false, "We should never get to this point."); 7275Debug.Assert(_ps.isEof); 7284Debug.Assert(_ps.chars[startPos] == '&'); 7316Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7336Debug.Assert(_ps.chars[startPos] == '&' && _ps.chars[startPos + 1] == '#'); 7449Debug.Assert(pos > 0); 7485Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7505Debug.Assert(startPos < _ps.charsUsed); 7506Debug.Assert(_ps.chars[startPos] == '&'); 7507Debug.Assert(_ps.chars[startPos + 1] != '#'); 7615Debug.Assert(pos > 0); 7771Debug.Assert(nodeIndex < _nodes.Length); 7772Debug.Assert(_nodes[_nodes.Length - 1] == null); 7785Debug.Assert(nodeIndex < _nodes.Length); 7792Debug.Assert(nodeIndex < _nodes.Length); 7865Debug.Assert(attr.type == XmlNodeType.Attribute); 7899Debug.Assert(_ps.isEof); 7960Debug.Assert(_xmlContext.defaultNamespace == uri); 7996Debug.Assert(_curNode.xmlContextPushed); 8093Debug.Assert(_xmlResolver != null); 8110Debug.Assert(_xmlResolver.SupportsType(uri, typeof(Stream)), "Stream must always be a supported type in XmlResolver"); 8131Debug.Assert(entity.IsExternal); 8144Debug.Assert(_ps.appendMode); 8173Debug.Assert(!entity.IsExternal); 8243Debug.Assert(_parsingStatesStackTop == -1); 8259Debug.Assert(_parsingStatesStackTop >= 0); 8360Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 2, 2, "?>")); 8368Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 3, 3, "-->")); 8376Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 3, 3, "]]>")); 8400Debug.Assert(false); 8403Debug.Assert(_incReadState == IncrementalReadState.Text || 8515Debug.Assert(_ps.charPos - pos == 0); 8516Debug.Assert(_ps.charPos - startPos == 0); 8555Debug.Assert(_ps.charPos - pos == 0); 8556Debug.Assert(_ps.charPos - startPos == 0); 8653Debug.Assert(count == charsParsed || _incReadDecoder.IsFull, "Check if decoded consumed all characters unless it's full."); 8670Debug.Assert(IncrementalRead() == 0, "Previous call of IncrementalRead should eat up all characters!"); 8676Debug.Assert(_fragmentType == XmlNodeType.Attribute); 8693Debug.Assert(_parsingFunction == ParsingFunction.InReadAttributeValue); 8720Debug.Assert(_stringBuilder.Length == 0); 8734Debug.Assert(_ps.eolNormalized, "Entity replacement text for attribute values should be EOL-normalized!"); 8788Debug.Assert(false, "We should never get to this point."); 8843Debug.Assert(false, "We should never get to this point."); 8931Debug.Assert(_ps.charPos < _ps.charsUsed); 9000Debug.Assert(_dtdInfo == null && _fragmentParserContext != null && _fragmentParserContext.HasDtdInfo); 9016Debug.Assert(_parsingFunction != ParsingFunction.InReadContentAsBinary); 9042Debug.Assert(_parsingFunction != ParsingFunction.InReadElementContentAsBinary); 9043Debug.Assert(_curNode.type == XmlNodeType.Element); 9121Debug.Assert(context != null); 9142Debug.Assert(nt != null); 9143Debug.Assert(context.NameTable == null || context.NameTable == nt, "This check should have been done in XmlParserContext constructor."); 9159Debug.Assert(_nameTableFromSettings == false); 9187Debug.Assert(_dtdInfo == null); 9246Debug.Assert(_curNode.type == XmlNodeType.Whitespace && newNodeType == XmlNodeType.SignificantWhitespace, "Incorrect node type change!"); 9348Debug.Assert(attr != null); 9373Debug.Assert(prefix != null); 9394Debug.Assert(attr != null); 9426Debug.Assert(_nodes[_index].type == XmlNodeType.Element); 9444Debug.Assert(_nodes[_index].type == XmlNodeType.Element); 9478Debug.Assert(_incReadDecoder != null); 9587Debug.Assert(_parsingFunction != ParsingFunction.InReadElementContentAsBinary); 9646Debug.Assert(characters >= 0); 9688Debug.Assert(startPos >= 0); 9689Debug.Assert(endPos < chars.Length); 9690Debug.Assert(startPos <= endPos); 9700Debug.Assert(startPos >= 0); 9701Debug.Assert(endPos < str.Length); 9702Debug.Assert(startPos <= endPos);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImplHelpers.cs (19)
293Debug.Assert(internalDtd != null); 435Debug.Assert(type == XmlNodeType.Element); 448Debug.Assert(type == XmlNodeType.Attribute); 465Debug.Assert(_valueStartPos >= 0 || _value != null, "Value not ready."); 518Debug.Assert(value != null); 544Debug.Assert(localName != null); 545Debug.Assert(localName.Length > 0); 574Debug.Assert(_valueStartPos != -1); 575Debug.Assert(_chars != null); 585Debug.Assert(_valueStartPos != -1); 586Debug.Assert(_chars != null); 606Debug.Assert(_valueStartPos != -1); 607Debug.Assert(_chars != null); 632Debug.Assert(_valueStartPos != -1); 633Debug.Assert(_chars != null); 673Debug.Assert(nameWPrefix == null); 708Debug.Assert(false, "We should never get to this point."); 730Debug.Assert(x == null || x is NodeData || x is IDtdDefaultAttributeInfo); 731Debug.Assert(y == null || y is NodeData || y is IDtdDefaultAttributeInfo);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextWriter.cs (5)
973Debug.Assert(false); 1423Debug.Assert(declared == true, "Unexpected situation!!"); 1433Debug.Assert(false, "Should have never come here"); 1509Debug.Assert(_useNsHashtable); 1512Debug.Assert(_nsHashtable.ContainsKey(_nsStack[i].prefix));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlUtf8RawTextWriter.cs (40)
120Debug.Assert(stream != null && settings != null); 215Debug.Assert(name != null && name.Length > 0); 254Debug.Assert(localName != null && localName.Length > 0); 255Debug.Assert(prefix != null); 284Debug.Assert(localName != null && localName.Length > 0); 285Debug.Assert(prefix != null); 314Debug.Assert(localName != null && localName.Length > 0); 315Debug.Assert(prefix != null); 332Debug.Assert(localName != null && localName.Length > 0); 333Debug.Assert(prefix != null); 362Debug.Assert(prefix != null && namespaceName != null); 379Debug.Assert(prefix != null); 411Debug.Assert(text != null); 416Debug.Assert(bufPos >= 4); 446Debug.Assert(text != null); 463Debug.Assert(name != null && name.Length > 0); 464Debug.Assert(text != null); 483Debug.Assert(name != null && name.Length > 0); 526Debug.Assert(ws != null); 546Debug.Assert(text != null); 580Debug.Assert(buffer != null); 581Debug.Assert(index >= 0); 582Debug.Assert(count >= 0 && index + count <= buffer.Length); 602Debug.Assert(buffer != null); 603Debug.Assert(index >= 0); 604Debug.Assert(count >= 0 && index + count <= buffer.Length); 618Debug.Assert(data != null); 688Debug.Assert(stream != null); 752Debug.Assert(pSrc <= pSrcEnd); 858Debug.Assert(pSrc <= pSrcEnd); 941Debug.Assert(s != null); 971Debug.Assert(pSrc <= pSrcEnd); 1018Debug.Assert(pSrc <= pSrcEnd); 1120Debug.Assert(pSrc <= pSrcEnd); 1253Debug.Assert(pSrc <= pSrcEnd); 1350Debug.Assert(XmlCharType.IsSurrogate(*pSrc)); 1382Debug.Assert(!xmlCharType.IsWhiteSpace((char)ch)); 1383Debug.Assert(!xmlCharType.IsAttributeValueChar((char)ch)); 1421Debug.Assert(ch >= 0x80 && !XmlCharType.IsSurrogate(ch)); 1720Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlValidatingReaderImpl.cs (5)
581Debug.Assert(false); 747Debug.Assert(value is XmlValidatingReader); 1010Debug.Assert(_parserContext != null); 1011Debug.Assert(_coreReaderImpl.DtdInfo == null); 1049Debug.Assert(_coreReader.NodeType == XmlNodeType.EntityReference);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWellformedWriter.cs (18)
254Debug.Assert(writer != null); 255Debug.Assert(settings != null); 256Debug.Assert(MaxNamespacesWalkCount <= 3); 314Debug.Assert(false, "Expected currentState <= State.Error "); 484Debug.Assert(prefix.Length == 0); 1346Debug.Assert(i >= 0); 1357Debug.Assert(i >= 0); 1634Debug.Assert(false, "State.Attribute == currentState || State.RootLevelAttr == currentState"); 1681Debug.Assert(_stateTable == s_stateTableAuto); 1725Debug.Assert(prefix == "xmlns"); 1913Debug.Assert(_useNsHashtable); 1914Debug.Assert(indexFrom <= indexTo); 1917Debug.Assert(_nsHashtable.ContainsKey(_nsStack[i].prefix)); 2061Debug.Assert(false, "We should not get to this point."); 2091Debug.Assert(false, "We should never get to this point. State = " + state); 2144Debug.Assert(ncname != null && ncname.Length > 0); 2249Debug.Assert(_attrHashTable.Count == 0); 2291Debug.Assert(prev >= 0 && _attrStack[prev].localName == localName);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWellformedWriterHelpers.cs (4)
100Debug.Assert(kind == NamespaceKind.NeedToWrite); 386Debug.Assert(false, "Unexpected ItemType value."); 499Debug.Assert(_singleStringValue != null); 500Debug.Assert(_lastItem == -1);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWrappingReader.cs (1)
30Debug.Assert(baseReader != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWrappingWriter.cs (1)
61Debug.Assert(baseWriter != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWriter.cs (1)
539Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWriterSettings.cs (5)
330Debug.Assert(_cdataSections != null); 502Debug.Assert(Encoding.UTF8.WebName == "utf-8"); 535Debug.Assert(false, "Invalid XmlOutputMethod setting."); 571Debug.Assert(false, "Invalid XmlOutputMethod setting."); 632Debug.Assert(false, "Invalid XmlOutputMethod setting.");
FrameworkFork\Microsoft.Xml\Xml\Core\XsdCachingReader.cs (8)
495Debug.Assert(_coreReader.NodeType == XmlNodeType.EndElement || (_coreReader.NodeType == XmlNodeType.Element && _coreReader.IsEmptyElement)); 500Debug.Assert(endElementNode.NodeType == XmlNodeType.EndElement); 508Debug.Assert(_coreReader.NodeType == XmlNodeType.EndElement || (_coreReader.NodeType == XmlNodeType.Element && _coreReader.IsEmptyElement)); 573Debug.Assert(_cacheState == CachingReaderState.Replay); 603Debug.Assert(_cacheState == CachingReaderState.Replay); 664Debug.Assert(attIndex <= _attributeEvents.Length); 688Debug.Assert(_contentIndex <= _contentEvents.Length); 714Debug.Assert(_coreReader.NodeType == XmlNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdCachingReaderAsync.cs (1)
133Debug.Assert(_cacheState == CachingReaderState.Replay);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReader.cs (17)
1148Debug.Assert(attNode != null); 1199Debug.Assert(_attributePSVI != null); 1304Debug.Assert(moveTo); 1896Debug.Assert(_attributePSVI != null); 2035Debug.Assert(_atomicValue != null); 2123Debug.Assert(_coreReaderNameTable.Get(localName) != null); 2124Debug.Assert(_coreReaderNameTable.Get(ns) != null); 2165Debug.Assert(_coreReaderNameTable.Get(attrLocalName) != null); 2166Debug.Assert(_coreReaderNameTable.Get(ns) != null); 2186Debug.Assert(attIndex <= _attributePSVINodes.Length); 2215Debug.Assert(_inlineSchemaParser != null); 2323Debug.Assert(this.NodeType == XmlNodeType.Element); 2450Debug.Assert(_coreReader.NodeType == XmlNodeType.EndElement); 2461Debug.Assert(false); //Should not happen as the caching reader does not cache elements in simple content 2514Debug.Assert(false); //Should not happen as the caching reader does not cache elements in simple content 2572Debug.Assert(xmlType != null && xmlType.Datatype != null); 2586Debug.Assert(NodeType != XmlNodeType.Attribute);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReaderAsync.cs (3)
611Debug.Assert(_atomicValue != null); 627Debug.Assert(_inlineSchemaParser != null); 750Debug.Assert(this.NodeType == XmlNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentSchemaValidator.cs (16)
73Debug.Assert(schemas != null && schemas.Count > 0); 95Debug.Assert(nodeToValidate.SchemaInfo != null); 121Debug.Assert(schemaElement.ElementSchemaType == schemaInfo.SchemaType); 346Debug.Assert(elementNode != null); 360Debug.Assert(_nameTable.Get(attr.NamespaceURI) != null); 361Debug.Assert(_nameTable.Get(attr.LocalName) != null); 444Debug.Assert(schemaAttribute != null); 461Debug.Assert(_attributeSchemaInfo != null); 473Debug.Assert(simpleValue != null); 510Debug.Assert(elementToValidate.ParentNode.NodeType != XmlNodeType.Document); //Handle if it is the documentElement seperately 635Debug.Assert(_nodeSequenceToValidate[0] == elementToValidate.ParentNode); 702Debug.Assert(elementNode != null); 716Debug.Assert(_nameTable.Get(attr.NamespaceURI) != null); 717Debug.Assert(_nameTable.Get(attr.LocalName) != null); 783Debug.Assert(child == childToStopAt); 816Debug.Assert(ex != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentXmlWriter.cs (3)
427Debug.Assert(elem != null); 432Debug.Assert(attr != null); 443Debug.Assert(attr != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentXPathNavigator.cs (33)
530Debug.Assert(false); 538Debug.Assert(attributes != null); 558Debug.Assert(attributes != null && attributes.parent != null); 590Debug.Assert(_namespaceParent != null); 644Debug.Assert(false); 652Debug.Assert(attributes != null); 653Debug.Assert(0 <= index && index < attributes.Count); 673Debug.Assert(attributes != null && attributes.parent != null); 735Debug.Assert(parent != null); 771Debug.Assert(parent != null); 799Debug.Assert(sibling != null); 1324Debug.Assert(node1 != null); 1325Debug.Assert(node2 != null); 1326Debug.Assert(node1 != node2, "Should be handled by ComparePosition()"); 1328Debug.Assert(OwnerNode(node1) == OwnerNode(node2)); 1410Debug.Assert(node1 != node2); 1451Debug.Assert(node1 != node2); 1471Debug.Assert(this.NodeType != XPathNodeType.Attribute && this.NodeType != XPathNodeType.Namespace && this.NodeType != XPathNodeType.All); 1861Debug.Assert(node != null, "Undefined navigator position"); 1862Debug.Assert(node == _document || node.OwnerDocument == _document, "Navigator switched documents"); 2281Debug.Assert(((XmlNode)nav.UnderlyingObject).NodeType != XmlNodeType.Attribute); 2294Debug.Assert(node != null); 2335Debug.Assert(((XmlNode)nav.UnderlyingObject).NodeType != XmlNodeType.Attribute); 2336Debug.Assert(Ref.Equal(nav.NameTable.Get(nsAtom), nsAtom)); 2350Debug.Assert(node != null); 2351Debug.Assert(node.NodeType == XmlNodeType.Element); 2393Debug.Assert(((XmlNode)nav.UnderlyingObject).NodeType != XmlNodeType.Attribute); 2394Debug.Assert(Ref.Equal(nav.NameTable.Get(localNameAtom), localNameAtom)); 2395Debug.Assert(Ref.Equal(nav.NameTable.Get(nsAtom), nsAtom)); 2396Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_NoLocalName class for special magic value of localNameAtom 2415Debug.Assert(node != null); 2416Debug.Assert(node.NodeType == XmlNodeType.Element); 2426Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_AndSelf_NoLocalName if localName == String.Empty
FrameworkFork\Microsoft.Xml\Xml\Dom\DomNameTable.cs (1)
30Debug.Assert((_entries.Length & _mask) == 0); // entries.Length must be a power of two
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlAttribute.cs (3)
21Debug.Assert(name != null); 22Debug.Assert(doc != null); 54Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlAttributeCollection.cs (10)
191Debug.Assert(offset != -1); // the if statement above guarantees that the ref node is in the collection 220Debug.Assert(offset != -1); // the if statement above guarantees that the ref node is in the collection 297Debug.Assert(retNode is XmlAttribute); 313Debug.Assert(retNode is XmlAttribute); 377Debug.Assert(parentElem != null); 379Debug.Assert(doc != null); 393Debug.Assert(parentElem != null); 395Debug.Assert(doc != null); 408Debug.Assert(-1 == FindNodeOffset(node)); 411Debug.Assert(retNode is XmlAttribute);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlCDATASection.cs (1)
74Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlCharacterData.cs (1)
202Debug.Assert(XmlDocument.IsTextNode(node.NodeType) || (node.ParentNode != null && node.ParentNode.NodeType == XmlNodeType.EntityReference));
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlComment.cs (1)
40Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDeclaration.cs (1)
152Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDocument.cs (12)
141Debug.Assert((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix)); 142Debug.Assert(n.LocalName == localName); 143Debug.Assert((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI)); 150Debug.Assert(n == null || ((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix))); 151Debug.Assert(n == null || n.LocalName == localName); 152Debug.Assert(n == null || ((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI))); 159Debug.Assert((prefix == null) ? (xmlName.Prefix.Length == 0) : (prefix == xmlName.Prefix)); 160Debug.Assert(xmlName.LocalName == localName); 161Debug.Assert((namespaceURI == null) ? (xmlName.NamespaceURI.Length == 0) : (xmlName.NamespaceURI == namespaceURI)); 912Debug.Assert(((XmlAttribute)node).Specified); 977Debug.Assert(toNode.NodeType != XmlNodeType.EntityReference); 1723Debug.Assert(doc == this);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDocumentFragment.cs (3)
113Debug.Assert(OwnerDocument != null); 159Debug.Assert(newChild != null); //should be checked that newChild is not null before this function call 175Debug.Assert(newChild != null); //should be checked that newChild is not null before this function call
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDocumentType.cs (2)
34Debug.Assert(doc != null); 65Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlElement.cs (5)
25Debug.Assert(name != null); 55Debug.Assert(OwnerDocument != null); 478Debug.Assert(n != null); 491Debug.Assert(n != null); 497Debug.Assert(n != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlElementList.cs (11)
31Debug.Assert(parent != null); 32Debug.Assert(parent.NodeType == XmlNodeType.Element || parent.NodeType == XmlNodeType.Document); 34Debug.Assert(parent.Document != null); 72Debug.Assert(parent.Document != null); 74Debug.Assert(nt != null); 83Debug.Assert(parent.Document != null); 85Debug.Assert(nt != null); 107Debug.Assert(curNode != null); 134Debug.Assert(curNode != null); 179Debug.Assert(n != null); 193Debug.Assert(n != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlEntityReference.cs (1)
87Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlLoader.cs (18)
61Debug.Assert(_reader != null); 62Debug.Assert(parentDoc != null); 154Debug.Assert(parent.NodeType == XmlNodeType.Element); 176Debug.Assert(parent == null); 231Debug.Assert(node != null); 256Debug.Assert(_reader.NodeType == XmlNodeType.Attribute); 295Debug.Assert(node != null); 304Debug.Assert(_reader.IsDefault); 354Debug.Assert(node != null); 362Debug.Assert(_reader.NodeType == XmlNodeType.EntityReference); 385Debug.Assert(_reader.NodeType == XmlNodeType.XmlDeclaration); 408Debug.Assert(false); 423Debug.Assert(_reader.NodeType == XmlNodeType.DocumentType); 498Debug.Assert(parent.NodeType == XmlNodeType.Element); 552Debug.Assert(node != null); 756Debug.Assert(parentNode.NodeType != XmlNodeType.Document); 758Debug.Assert(_doc != null); 948Debug.Assert(tr.EntityHandling == EntityHandling.ExpandCharEntities);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlName.cs (2)
92Debug.Assert(_prefix != null); 115Debug.Assert(Ref.Equal(_name, ownerDoc.NameTable.Get(_name)));
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlNode.cs (9)
42Debug.Assert(doc != null); 115Debug.Assert(parentNode != null); 172Debug.Assert(parentNode != null); 777Debug.Assert(firstNode.NodeType == XmlNodeType.Text 795Debug.Assert(true, "shouldn't have fall through here."); 1407Debug.Assert(prevNode.IsText); 1408Debug.Assert(nextNode.IsText); 1415Debug.Assert(prevNode.IsText); 1416Debug.Assert(nextNode.IsText);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlNodeReader.cs (11)
110Debug.Assert(nt == XmlNodeType.XmlDeclaration || nt == XmlNodeType.DocumentType); 131Debug.Assert(_curNode.NodeType == XmlNodeType.XmlDeclaration || _curNode.NodeType == XmlNodeType.DocumentType); 136Debug.Assert(_nAttrInd >= 0 && _nAttrInd < AttributeCount); 232Debug.Assert(_curNode.NodeType == XmlNodeType.XmlDeclaration || _curNode.NodeType == XmlNodeType.DocumentType); 233Debug.Assert(_nAttrInd >= 0 && _nAttrInd < AttributeCount); 252Debug.Assert(nt == XmlNodeType.XmlDeclaration || nt == XmlNodeType.DocumentType); 253Debug.Assert(_nAttrInd >= 0 && _nAttrInd < AttributeCount); 618Debug.Assert(IsOnDeclOrDocType); 1061Debug.Assert(_curNode.NodeType == XmlNodeType.XmlDeclaration || _curNode.NodeType == XmlNodeType.DocumentType); 1091Debug.Assert(_curNode != null); 1639Debug.Assert(_curDepth == 0);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlProcessingInstruction.cs (1)
90Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlSignificantWhitespace.cs (1)
75Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlText.cs (1)
77Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlWhitespace.cs (1)
91Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Ref.cs (1)
21Debug.Assert(false, "Ref.Equal: Object comparison used for non-atomized string '" + strA + "'");
FrameworkFork\Microsoft.Xml\Xml\Resolvers\XmlPreloadedResolver.cs (2)
214Debug.Assert(s_rss091_Dtd.Length == 1); 361Debug.Assert(uri != null);
FrameworkFork\Microsoft.Xml\Xml\schema\BaseProcessor.cs (2)
29Debug.Assert(nameTable != null); 160Debug.Assert(item is XmlSchemaElement);
FrameworkFork\Microsoft.Xml\Xml\schema\basevalidator.cs (2)
49Debug.Assert(schemaCollection == null || schemaCollection.NameTable == reader.NameTable); 185Debug.Assert(names.Count > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\BitSet.cs (1)
82Debug.Assert(startFrom >= -1 && startFrom <= _count);
FrameworkFork\Microsoft.Xml\Xml\schema\ChameleonKey.cs (1)
70Debug.Assert((chameleonLocation.OriginalString.Length == 0 && originalSchema != null)
FrameworkFork\Microsoft.Xml\Xml\schema\CompiledIdentityConstraint.cs (1)
66Debug.Assert(fields.Count > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\ConstraintStruct.cs (3)
214Debug.Assert(_dstruct != null); 222Debug.Assert(_dstruct != null); 399Debug.Assert(dim > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\ContentValidator.cs (15)
97Debug.Assert(_particles.Count == _last + 1); 137Debug.Assert(_particles.Count == _last + 1); 990Debug.Assert(parent is SequenceNode); 991Debug.Assert(this == parent.RightChild); 1318Debug.Assert(ContentType == XmlSchemaContentType.ElementOnly || ContentType == XmlSchemaContentType.Mixed); 1330Debug.Assert(!IsOpen); 1432Debug.Assert(lrNode != null); 1450Debug.Assert(lrNode1 != null); 1566Debug.Assert(state == (int)stateTable[statePosSet]); // just make sure that statePosSet is for correct state 1957Debug.Assert(_minMaxNodesCount != 0); 2067Debug.Assert(_minMaxNodesCount > 0); 2092Debug.Assert(lrNode != null); 2184Debug.Assert(runningPositions[i].curpos != null); 2229Debug.Assert(runningPositions[i].curpos != null); 2288Debug.Assert(_elements.Count > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\DatatypeImplementation.cs (7)
178Debug.Assert(qname != null && dataType != null); 194Debug.Assert(derivedType != null && baseType != null); 367Debug.Assert(currentType != null); 987Debug.Assert(arr1 != null && arr2 != null); 997Debug.Assert(atomicValues2 != null); 1065Debug.Assert(valuesToCheck != null); 1162Debug.Assert(array.GetType() == ListValueType);
FrameworkFork\Microsoft.Xml\Xml\schema\DtdParser.cs (37)
217Debug.Assert((int)Token.CDATA == (int)XmlTokenizedType.CDATA && (int)XmlTokenizedType.CDATA == 0); 218Debug.Assert((int)Token.ID == (int)XmlTokenizedType.ID && (int)XmlTokenizedType.ID == 1); 219Debug.Assert((int)Token.IDREF == (int)XmlTokenizedType.IDREF && (int)XmlTokenizedType.IDREF == 2); 220Debug.Assert((int)Token.IDREFS == (int)XmlTokenizedType.IDREFS && (int)XmlTokenizedType.IDREFS == 3); 221Debug.Assert((int)Token.ENTITY == (int)XmlTokenizedType.ENTITY && (int)XmlTokenizedType.ENTITY == 4); 222Debug.Assert((int)Token.ENTITIES == (int)XmlTokenizedType.ENTITIES && (int)XmlTokenizedType.ENTITIES == 5); 223Debug.Assert((int)Token.NMTOKEN == (int)XmlTokenizedType.NMTOKEN && (int)XmlTokenizedType.NMTOKEN == 6); 224Debug.Assert((int)Token.NMTOKENS == (int)XmlTokenizedType.NMTOKENS && (int)XmlTokenizedType.NMTOKENS == 7); 225Debug.Assert((int)Token.NOTATION == (int)XmlTokenizedType.NOTATION && (int)XmlTokenizedType.NOTATION == 8); 244Debug.Assert(readerAdapter != null); 504Debug.Assert(ParsingInternalSubset); 510Debug.Assert(_externalEntitiesDepth == 0); 531Debug.Assert(_readerAdapter.EntityStackLength == 0 || 601Debug.Assert(_curPos > 0 && _chars[_curPos - 1] == ']'); 613Debug.Assert(_readerAdapter.EntityStackLength == 0 || 633Debug.Assert(false); 637Debug.Assert(_scanningFunction == ScanningFunction.SubsetContent); 1518Debug.Assert(idTokenType == Token.PUBLIC); 1680Debug.Assert(false); 2418Debug.Assert(_chars[_curPos] == '"' || _chars[_curPos] == '\''); 2637Debug.Assert(_curPos - _tokenStartPos == 0); 3183Debug.Assert(_chars[_curPos] == 'P'); 3203Debug.Assert(_chars[_curPos] == 'S'); 3226Debug.Assert(_curPos - _tokenStartPos > 0); 3248Debug.Assert(_curPos - _tokenStartPos > 0); 3271Debug.Assert(_curPos == 0 || _chars[_curPos - 1] == '"' || _chars[_curPos - 1] == '\''); 3304Debug.Assert(_internalSubsetValueSb != null); 3320Debug.Assert(_chars[_curPos] == '&' || _chars[_curPos] == '%'); 3328Debug.Assert(_chars[_curPos - 1] == ';'); 3393Debug.Assert(!ParsingInternalSubset || _freeFloatingDtd); 3394Debug.Assert(_currentEntityId == 0); 3418Debug.Assert(_chars[_curPos - 1] == ';'); 3474Debug.Assert(_validate); 3480Debug.Assert(_validate); 3486Debug.Assert(_validate); 3526Debug.Assert(false, "This is an unexpected error that should have been handled in the ScanXXX methods."); 3613Debug.Assert(startPos < _charsUsed);
FrameworkFork\Microsoft.Xml\Xml\schema\dtdvalidator.cs (2)
43Debug.Assert(reader != null); 146Debug.Assert(reader.NodeType == XmlNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\schema\FacetChecker.cs (2)
463Debug.Assert(false); 1648Debug.Assert(values != null);
FrameworkFork\Microsoft.Xml\Xml\schema\Inference\infer.cs (10)
276Debug.Assert(_rootSchema != null, "rootSchema is null"); 301Debug.Assert(compiledAttributes != null); //AttributeUses is never null 502Debug.Assert(targetNS == null || targetNS.Length > 0, "targetns for schema is empty"); 1022Debug.Assert(elem.ElementDecl == null); 1225Debug.Assert(_xtr.NodeType == XmlNodeType.Attribute); 1265Debug.Assert(ct != null); 1276Debug.Assert(ct != null); //either the user-defined type itself is a complex type or we switched from a simple type to a complex type 1280Debug.Assert(sce != null); 1753Debug.Assert(false, "Expected type not matched"); 2399Debug.Assert(false, "Expected date, time or dateTime");
FrameworkFork\Microsoft.Xml\Xml\schema\NamespaceList.cs (7)
34Debug.Assert(targetNamespace != null); 74Debug.Assert(_set != null); 117Debug.Assert(false); 162Debug.Assert(false); 184Debug.Assert(super._type == ListType.Set); 202Debug.Assert(o1 != o2); 320Debug.Assert(o1 != o2); //clause 1
FrameworkFork\Microsoft.Xml\Xml\schema\Parser.cs (8)
94Debug.Assert(_schemaType == SchemaType.XDR); 142Debug.Assert(false); 246Debug.Assert(_parentNode != null); 327Debug.Assert(currentNode != null); 328Debug.Assert(_parentNode != null); 336Debug.Assert(_reader.NodeType == XmlNodeType.Element); 421Debug.Assert(_reader.NodeType == XmlNodeType.Attribute); 447Debug.Assert(_reader.NodeType == XmlNodeType.EntityReference);
FrameworkFork\Microsoft.Xml\Xml\schema\ParserAsync.cs (1)
59Debug.Assert(_schemaType == SchemaType.XDR);
FrameworkFork\Microsoft.Xml\Xml\schema\Preprocessor.cs (4)
324Debug.Assert(import != null); 730Debug.Assert(false); 856Debug.Assert(_currentSchema != null); 1013Debug.Assert((currentSchemaObject as XmlSchema) == null); //The current object should not be schema
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaCollectionCompiler.cs (9)
53Debug.Assert(!members.Contains(element)); 504Debug.Assert(group.CanonicalParticle != null); 1020Debug.Assert(baseType.ElementDecl.ContentValidator != null); 1405Debug.Assert(false); 1860Debug.Assert(attribute.Use != XmlSchemaUse.Prohibited); 2333Debug.Assert(xe.ElementSchemaType != null); 2577Debug.Assert(particle == XmlSchemaParticle.Empty); 2624Debug.Assert(!p.IsEmpty); 2643Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaInfo.cs (1)
330Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaSetCompiler.cs (13)
118Debug.Assert(_schemaForSchema != null); 482Debug.Assert(examplar != null); //Headelement presence is checked while building subst groups 585Debug.Assert(group.CanonicalParticle != null); 1630Debug.Assert(false); 2207Debug.Assert(attribute.Use != XmlSchemaUse.Prohibited); 2764Debug.Assert(xe.ElementSchemaType != null); 2785Debug.Assert(decl != null); 3020Debug.Assert(particle == XmlSchemaParticle.Empty); 3068Debug.Assert(!((XmlSchemaParticle)particles[i]).IsEmpty); 3087Debug.Assert(false); 3244Debug.Assert(baseFixedValue != null); 3249Debug.Assert(derivedFixedValue != null); 3265Debug.Assert(simpleFixedValue != null);
FrameworkFork\Microsoft.Xml\Xml\schema\XdrBuilder.cs (1)
634Debug.Assert(_GroupDef != null);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlAtomicValue.cs (9)
159Debug.Assert(qname != null); //string representation is handled in a different overload 221default: Debug.Assert(false, "Should never get here"); break; 243default: Debug.Assert(false, "Should never get here"); break; 266default: Debug.Assert(false, "Should never get here"); break; 290default: Debug.Assert(false, "Should never get here"); break; 313default: Debug.Assert(false, "Should never get here"); break; 336default: Debug.Assert(false, "Should never get here"); break; 360default: Debug.Assert(false, "Should never get here"); break; 382default: Debug.Assert(false, "Should never get here"); break;
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchema.cs (2)
272Debug.Assert(_isPreprocessed); 702Debug.Assert(extList != null && schema != null);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaComplexType.cs (1)
408System.Diagnostics.Debug.Assert(false, "Should never call Clone() on XmlSchemaComplexType. Call Clone(XmlSchema) instead.");
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaElement.cs (1)
358System.Diagnostics.Debug.Assert(false, "Should never call Clone() on XmlSchemaElement. Call Clone(XmlSchema) instead.");
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaException.cs (1)
41Debug.Assert(message == null || !message.StartsWith("Sch_", StringComparison.Ordinal), "Do not pass a resource here!");
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaGroup.cs (1)
91System.Diagnostics.Debug.Assert(false, "Should never call Clone() on XmlSchemaGroup. Call Clone(XmlSchema) instead.");
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaObject.cs (4)
91get { Debug.Assert(false); return null; } 92set { Debug.Assert(false); } 101get { Debug.Assert(false); return null; } 102set { Debug.Assert(false); }
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaObjectTable.cs (11)
27Debug.Assert(!_table.ContainsKey(name), "XmlSchemaObjectTable.Add: entry already exists"); 38Debug.Assert(oldValue != null); 40Debug.Assert(matchedIndex >= 0); 42Debug.Assert(_entries[matchedIndex].qname == name); 57Debug.Assert(oldValue != null); 59Debug.Assert(_entries[matchedIndex].qname == name); 77Debug.Assert(matchedIndex >= 0); 78Debug.Assert(_entries[matchedIndex].qname == name); 100Debug.Assert(_table.Count == _entries.Count); 223Debug.Assert(array.Length >= _size, "array is not big enough to hold all the items in the ICollection"); 278Debug.Assert(array.Length >= _size, "array is not big enough to hold all the items in the ICollection");
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaSet.cs (2)
1022Debug.Assert(ns != null); 1033Debug.Assert(schema.BaseUri.Equals(schemaUri));
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaSimpleType.cs (1)
29Debug.Assert(SchemaContentType == XmlSchemaContentType.TextOnly);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaValidator.cs (35)
345Debug.Assert(_validatedNamespaces != null); 628Debug.Assert(_currentState == ValidatorState.TopLevelAttribute); //Re-set state back to start on error with partial validation type 638Debug.Assert(currentElementDecl != null); 640Debug.Assert(ct != null); 657Debug.Assert(attributeDef != null); 677Debug.Assert(simpleValue != null); 828Debug.Assert(names.Count > 0); 960Debug.Assert(_context.Validity != XmlSchemaValidity.Valid); 1090Debug.Assert(attSchemaInfo != null); 1454Debug.Assert(currentElementDecl.Datatype != null); 1515Debug.Assert(simpleValue != null); 1527Debug.Assert(decl != null && decl.SchemaType != null); 1567Debug.Assert(_validationStack.Length > 1); 1646Debug.Assert(_partialValidationType is XmlSchemaAttribute); 1683Debug.Assert(elementDecl.DefaultValueTyped != null); 1837Debug.Assert(elementDecl.ContentValidator.ContentType == XmlSchemaContentType.Mixed && elementDecl.DefaultValueTyped != null); 1850Debug.Assert(decl != null); 1863Debug.Assert(_xmlResolver != null); 1959Debug.Assert(dtype != null); 1996Debug.Assert(dtype != null); 2130Debug.Assert(currentElementDecl != null); 2268Debug.WriteLine("Selector Match!"); 2269Debug.WriteLine("Name: " + localName + "\t|\tURI: " + namespaceUri + "\n"); 2283Debug.WriteLine("Element Field Match!"); 2327Debug.WriteLine("Attribute Field Match!"); 2330Debug.WriteLine("Attribute Field Filling Value!"); 2331Debug.WriteLine("Name: " + name + "\t|\tURI: " + ns + "\t|\tValue: " + obj + "\n"); 2340Debug.Assert(datatype != null); 2375Debug.WriteLine("Element Field Filling Value!"); 2376Debug.WriteLine("Name: " + localName + "\t|\tURI: " + namespaceUri + "\t|\tValue: " + typedValue + "\n"); 2534Debug.Assert(contentValidator is DfaContentValidator || contentValidator is NfaContentValidator || contentValidator is RangeContentValidator || contentValidator is AllElementsContentValidator); 2558Debug.Assert(names.Count > 0); 2608Debug.Assert(names.Count > 0); 2647Debug.Assert(builder.Length != 0); 2756Debug.Assert(nsList.Length > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlValueConverter.cs (8)
287Debug.Assert(schemaType != null && datatype != null, "schemaType or schemaType.Datatype may not be null"); 297Debug.Assert(schemaType.Datatype.Variety != XmlSchemaDatatypeVariety.List, "schemaType must be list's item type, not list itself"); 321Debug.Assert(false, "Type code " + typeCode + " is not supported."); 529Debug.Assert(_typeCode == XmlTypeCode.Item, "If SchemaType is null, then TypeCode may only be Item, Node, or AnyAtomicType"); 3451Debug.Assert(!(atomicConverter is XmlListConverter) || ((XmlListConverter)atomicConverter).atomicConverter == null, 3583Debug.Assert(enumSrc != null, "Value passed to ToArray must implement IEnumerable"); 3611Debug.Assert(enumSrc != null, "Value passed to ToArray must implement IEnumerable"); 3678Debug.Assert(schemaType.DerivedBy == XmlSchemaDerivationMethod.Union);
FrameworkFork\Microsoft.Xml\Xml\schema\XsdBuilder.cs (7)
712Debug.Assert(_currentEntry.InitFunc != null); 715Debug.Assert(_xso != null); 975Debug.Assert(false, "State is " + state); 1100Debug.Assert(false, "State is " + state); 1340Debug.Assert(false); 2381Debug.Assert(false); 2430Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDateTime.cs (3)
163Debug.Assert(Bits.ExactlyOne((uint)kinds), "Only one DateTime type code can be set."); 178Debug.Assert(dateTime.Kind == DateTimeKind.Local, "Unknown DateTimeKind: " + dateTime.Kind); 207Debug.Assert(Bits.ExactlyOne((uint)kinds), "Only one DateTime type code can be set.");
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDuration.cs (1)
115Debug.Assert(durationType == DurationType.Duration || durationType == DurationType.DayTimeDuration);
FrameworkFork\Microsoft.Xml\Xml\schema\xsdvalidator.cs (9)
502Debug.Assert(attnDef.SchemaType != null); 944Debug.WriteLine("Selector Match!"); 945Debug.WriteLine("Name: " + reader.LocalName + "\t|\tURI: " + reader.NamespaceURI + "\n"); 958Debug.WriteLine("Element Field Match!"); 1003Debug.WriteLine("Attribute Field Match!"); 1006Debug.WriteLine("Attribute Field Filling Value!"); 1007Debug.WriteLine("Name: " + name + "\t|\tURI: " + ns + "\t|\tValue: " + obj + "\n"); 1057Debug.WriteLine("Element Field Filling Value!"); 1058Debug.WriteLine("Name: " + reader.LocalName + "\t|\tURI: " + reader.NamespaceURI + "\t|\tValue: " + reader.TypedValueObject + "\n");
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeExporter.cs (1)
176Debug.Assert(comments != null);
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeGenerator.cs (32)
47System.Diagnostics.Debug.Assert(typeBuilder != null); 123System.Diagnostics.Debug.Assert(false, msg); 129System.Diagnostics.Debug.Assert(_argList != null && _argList.ContainsKey(name)); 135System.Diagnostics.Debug.Assert(_currentScope != null && _currentScope.ContainsKey(name)); 182System.Diagnostics.Debug.Assert(false); 226Debug.Assert(_currentScope.parent != null); 235Debug.Assert(_freeLocals != null); 257Debug.Assert(!_currentScope.ContainsKey(name)); 273Debug.Assert(local.LocalType == type); 314Debug.Assert(forState != null); 636Debug.Assert(methodInfo != null); 645Debug.Assert(ctor != null); 651Debug.Assert(constructorInfo != null); 802System.Diagnostics.Debug.Assert(getMethod != null); 839System.Diagnostics.Debug.Assert(getMethod != null); 877System.Diagnostics.Debug.Assert(setMethod != null); 1141Debug.Assert(false, "Char is not a valid schema primitive and should be treated as int in DataContract"); 1192Debug.Assert(false, "UnknownConstantType"); 1288Debug.Assert(_currentScope.ContainsKey(name)); 1300Debug.Assert(local.LocalType == type); 1311Debug.Assert(_currentScope.ContainsKey(name)); 1313Debug.Assert(local.LocalType == type); 1529Debug.Assert(!opCode.Equals(OpCodes.Nop)); 1849Debug.Assert(ifState != null); 2043Debug.Assert(_initElseIfStack == -1); 2053Debug.Assert(_initIfStack == -1); 2073Debug.Assert(_initIfStack == -1 && _initElseIfStack == -1); 2094Debug.Assert(_initIfStack == -1 && _initElseIfStack == -1); 2878Debug.Assert(this.MethodBuilder.ReturnType == returnType); 2879Debug.Assert(this.MethodBuilder.Attributes == attributes); 2880Debug.Assert(this.ParameterTypes.Length == parameterTypes.Length); 2883Debug.Assert(this.ParameterTypes[i] == parameterTypes[i]);
FrameworkFork\Microsoft.Xml\Xml\Serialization\SourceInfo.cs (4)
115Debug.Assert(get_Item != null); 192Debug.Assert(match.Groups["arg"].Value == Arg); 193Debug.Assert(match.Groups["cast"].Value == CodeIdentifier.GetCSharpName(Type)); 218System.Diagnostics.Debug.Assert(targetType == nullableType || targetType.IsAssignableFrom(nullableType.GetGenericArguments()[0]));
FrameworkFork\Microsoft.Xml\Xml\Serialization\Types.cs (2)
1136Debug.Assert(propertyInfo != null); 1137Debug.Assert(typeDesc != null);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationILGen.cs (5)
47System.Diagnostics.Debug.Assert(access == "public"); 62get { System.Diagnostics.Debug.Assert(_moduleBuilder != null); return _moduleBuilder; } 63set { System.Diagnostics.Debug.Assert(_moduleBuilder == null && value != null); _moduleBuilder = value; } 107System.Diagnostics.Debug.Assert(_methodBuilders.ContainsKey(methodName)); 572System.Diagnostics.Debug.Assert(memberInfos.ContainsKey(source.Substring(3)));
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriterILGen.cs (11)
1093System.Diagnostics.Debug.Assert(xmlnsSource.StartsWith("o.@", StringComparison.Ordinal)); 1444System.Diagnostics.Debug.Assert(parent == "o" || parent == "p"); 2316Debug.Assert(!local.LocalType.GetTypeInfo().IsValueType); 2516Debug.Assert(type.GetTypeInfo().IsValueType); 2600Debug.Assert(initValue.MemberInfo != null); 2601Debug.Assert(initValue.MemberInfo.Name == initValue.Arg.Substring(3)); 2646Debug.Assert(typeName == arrayTypeDesc.CSharpName || typeName == arrayTypeDesc.CSharpName + "[]"); 2658Debug.Assert(type != null); 2659Debug.Assert(ilg != null); 2667Debug.Assert(arrayType != null); 2668Debug.Assert(ilg != null);
FrameworkFork\Microsoft.Xml\Xml\ValidateNames.cs (7)
42Debug.Assert(s != null && offset <= s.Length); 78Debug.Assert(s != null && offset <= s.Length); 121Debug.Assert(s != null && offset <= s.Length); 181Debug.Assert(s != null && offset <= s.Length); 400Debug.Assert(offsetBadChar < s.Length); 420Debug.Assert(offsetBadChar < s.Length); 491Debug.Assert(prefix != null && localName != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\XmlCharType.cs (8)
472Debug.Assert(s_CharProperties != null); 704Debug.Assert(str != null); 705Debug.Assert(startPos + len <= str.Length); 706Debug.Assert(startPos <= str.Length); 720Debug.Assert(chars != null); 721Debug.Assert(startPos + len <= chars.Length); 722Debug.Assert(startPos <= chars.Length); 752Debug.Assert(start <= end);
FrameworkFork\Microsoft.Xml\Xml\XmlEncoding.cs (2)
433Debug.Assert(i == 1); 484Debug.Assert(i == 1);
FrameworkFork\Microsoft.Xml\Xml\XmlException.cs (5)
41Debug.Assert(message == null || !message.StartsWith("Xml_", StringComparison.Ordinal), "Do not pass a resource here!"); 200Debug.Assert(invCharIndex < data.Length); 201Debug.Assert(invCharIndex < length); 202Debug.Assert(length <= data.Length); 267Debug.Assert(e != null, "Unexpected null exception");
FrameworkFork\Microsoft.Xml\Xml\XmlNamespaceManager.cs (4)
124Debug.Assert(decl >= 2); 187Debug.Assert(_hashTable == null); 251Debug.Assert(i >= 2); 262Debug.Assert(prefix != null);
FrameworkFork\Microsoft.Xml\Xml\XmlQualifiedName.cs (3)
175Debug.Assert(name != null && ns != null); 183Debug.Assert(ns != null); 198Debug.Assert(_name != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\AttributeQuery.cs (1)
50Debug.Assert(!currentNode.NamespaceURI.Equals(XmlReservedNs.NsXmlNs));
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\Axis.cs (2)
43Debug.Assert(prefix != null); 44Debug.Assert(name != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\baseaxisquery.cs (3)
38Debug.Assert(qyInput != null); 68Debug.Assert(context != null); 125Debug.Assert(this is AttributeQuery || this is ChildrenQuery);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\BooleanExpr.cs (2)
22Debug.Assert(op == Operator.Op.AND || op == Operator.Op.OR); 23Debug.Assert(opnd1 != null && opnd2 != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\BooleanFunctions.cs (1)
68Debug.Assert(result is XPathNavigator, "Unknown value type");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CacheAxisQuery.cs (2)
43Debug.Assert(0 <= count && count <= outputBuffer.Count); 55Debug.Assert(0 <= count && count <= outputBuffer.Count);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CacheChildrenQuery.cs (1)
104Debug.Assert(order == XmlNodeOrder.Before, "Algorith error. Nodes expected to be DocOrderDistinct");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CacheOutputQuery.cs (2)
53Debug.Assert(0 <= count && count <= outputBuffer.Count); 65Debug.Assert(0 <= count && count <= outputBuffer.Count);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CompiledXpathExpr.cs (2)
47Debug.Assert(_query != null, "In case of error in XPath we create ErrorXPathExpression"); 123Debug.Assert(prefix != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\DescendantOverDescendantQuery.cs (1)
95Debug.Assert(result, "Algorithm error, We always should be able to move up if level > 0");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\FilterQuery.cs (1)
74Debug.Assert(value is XPathNavigator, "Unknown value type");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\ForwardPositionQuery.cs (1)
16Debug.Assert(input != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\LogicalExpr.cs (7)
22Debug.Assert( 93Debug.Assert(op == Operator.Op.EQ || op == Operator.Op.NE); 126Debug.Assert( 250Debug.Assert(op == Operator.Op.EQ || op == Operator.Op.NE, 324Debug.Fail("Unexpected Operator.op code in cmpNumberNumber()"); 336Debug.Fail("Unexpected Operator.op code in cmpNumberNumberO()"); 362Debug.Assert(op == Operator.Op.EQ || op == Operator.Op.NE,
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\NamespaceQuery.cs (2)
62Debug.Assert(e.NodeType == XPathNodeType.Namespace); 65Debug.Assert(e.LocalName.Length == 0, "Only xmlns='' can have empty string as a value");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\NumericExpr.cs (3)
22Debug.Assert( 27Debug.Assert(opnd1 != null && opnd2 != null); 62Debug.Assert(op == Operator.Op.PLUS || op == Operator.Op.MINUS || op == Operator.Op.MOD || op == Operator.Op.DIV || op == Operator.Op.MUL);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\Operator.cs (1)
52Debug.Assert(Op.EQ <= op && op <= Op.GE);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\precedingquery.cs (2)
89Debug.Assert(qyInput.Advance() == null, "we read all qyInput.Advance() already"); 100Debug.Fail("Algorithm error: we missed the centinel node");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\precedingsibling.cs (2)
70Debug.Assert(test, "We just moved to parent, how we can not have first child?"); 79Debug.Fail("We managed to miss sentinel node (input)");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\Query.cs (9)
156Debug.Assert(0 <= l && l < r); 189Debug.Assert(0 <= pos && pos <= buffer.Count, "Algorithm error: Insert()"); 194Debug.Assert(cmp == XmlNodeOrder.Before, "Algorithm error: Insert()"); 199Debug.Assert(cmp == XmlNodeOrder.Before, "Algorithm error: Insert()"); 206Debug.Assert(query != null, "AssertQuery(): query == null"); 217Debug.Assert(curr == query.Current, "AssertQuery(): query.Advance() != query.Current"); 229Debug.Assert(cmp == XmlNodeOrder.Before, "AssertQuery(): Wrong node order"); 235Debug.Assert(actualSize == querySize, "AssertQuery(): actualSize != querySize"); 254Debug.Assert(value is XPathNavigator, "Unknown value type");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\querybuilder.cs (2)
466Debug.Assert(root != null, "root != null"); 496Debug.Assert(false, "Unknown QueryType encountered!!");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\SortQuery.cs (9)
23Debug.Assert(qyInput != null, "Sort Query needs an input query tree to work on"); 55Debug.Assert(numSorts > 0, "Why was the sort query created?"); 83Debug.Assert(0 <= count && count <= _results.Count); 95Debug.Assert(0 <= count && count <= _results.Count); 168Debug.Assert(_expressions.Length == _comparers.Length); 169Debug.Assert(0 < _expressions.Length); 170Debug.Assert(0 <= _numSorts && _numSorts <= _expressions.Length); 184Debug.Assert(_numSorts < _expressions.Length); 206Debug.Assert(x != null && y != null, "Oops!! what happened?");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\StringFunctions.cs (2)
23Debug.Assert(argList != null, "Use 'new Query[]{}' instead."); 94Debug.Assert(GetXPathType(argVal) == XPathResultType.Number);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathArrayIterator.cs (2)
54Debug.Assert(index <= list.Count); 69Debug.Assert(index <= list.Count);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathMultyIterator.cs (3)
101Debug.Assert(firstNotEmpty <= item && item < arr.Length); 157Debug.Assert(position != 0, "MoveNext() wasn't called"); 158Debug.Assert(firstNotEmpty < arr.Length, "MoveNext() returned false");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathParser.cs (5)
424Debug.Assert(nodeType != XPathNodeType.Root); 477Debug.Assert(IsPrimaryExpr(_scanner)); 511Debug.Assert(opnd != null, "IsPrimaryExpr() was true. We should recognize this lex."); 668Debug.Assert(_scanner.CanBeFunction); 880Debug.Assert(scaner.Kind == XPathScanner.LexKind.Axe);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathScanner.cs (15)
45Debug.Assert(0 <= _xpathExprIndex && _xpathExprIndex <= _xpathExpr.Length); 77Debug.Assert(_kind == LexKind.Name || _kind == LexKind.Axe); 78Debug.Assert(_name != null); 87Debug.Assert(_kind == LexKind.Name); 88Debug.Assert(_prefix != null); 97Debug.Assert(_kind == LexKind.String); 98Debug.Assert(_stringValue != null); 107Debug.Assert(_kind == LexKind.Number); 108Debug.Assert(_numberValue != double.NaN); 119Debug.Assert(_kind == LexKind.Name); 288Debug.Assert(this.CurerntChar == '.' || XmlCharType.IsDigit(this.CurerntChar)); 308Debug.Assert(XmlCharType.IsDigit(this.CurerntChar)); 310Debug.Assert(0 <= start && _xpathExpr[start] == '.'); 333Debug.Assert(this.CurerntChar == endChar); 340Debug.Assert(_xmlCharType.IsStartNCNameSingleChar(this.CurerntChar)
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathSingletonIterator.cs (1)
20Debug.Assert(nav != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathDocument.cs (5)
189Debug.Assert((object)_nameTable.Get(string.Empty) == (object)string.Empty, "NameTable must contain atomized string.Empty"); 221Debug.Assert(reader.LocalName == "xmlns"); 226Debug.Assert(reader.Prefix == "xmlns"); 396Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element && pageNmsp[idxNmsp].NodeType == XPathNodeType.Namespace); 410Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathNavigator.cs (10)
1029Debug.Assert(CompareSiblings(n1.Clone(), n2.Clone()) != CompareSiblings(n2.Clone(), n1.Clone()), "IsSamePosition() on custom navigator returns incosistent results"); 1098Debug.Assert(schemaType != null || this.NodeType == XPathNodeType.Root, "schemaType != null || this.NodeType == XPathNodeType.Root"); 1126Debug.Assert(schemas != null, "schemas != null"); 1150Debug.Assert(args != null); 1917Debug.Assert(!n1.IsSamePosition(n2)); 1919Debug.Assert(p1.MoveToParent() && p2.MoveToParent() && p1.IsSamePosition(p2)); 2154Debug.Assert(reader.LocalName == "xmlns"); 2159Debug.Assert(reader.Prefix == "xmlns"); 2216Debug.Assert(reader.LocalName == "xmlns"); 2221Debug.Assert(reader.Prefix == "xmlns");
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathNavigatorReader.cs (4)
520Debug.Assert(value == null); 646Debug.Assert(XPathNodeType.Namespace == _nav.NodeType); 669Debug.Fail("Couldn't find Namespace Node! Should not happen!"); 1033Debug.Assert(_nav.NodeType == XPathNodeType.Element, _nav.NodeType.ToString() + " == XPathNodeType.Element");
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeGenerator.cs (5)
39Debug.Assert(s_getTypeFromHandle != null); 63Debug.Assert(s_objectEquals != null); 86Debug.Assert(s_arraySetValue != null); 103Debug.Assert(s_objectToString != null); 118Debug.Assert(s_stringFormat != null);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CollectionDataContract.cs (1)
550Debug.Assert(AddMethod != null || Kind == CollectionKind.Array, "Add method cannot be null if the collection is being used as a get-only property");
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DiagnosticUtility.cs (1)
21Debug.Assert(condition, message);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\Globals.cs (3)
1051Debug.Assert(s_typeOfScriptObject != null); 1069Debug.Assert(s_serializeFunc != null); 1075Debug.Assert(s_deserializeFunc != null);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatGeneratorStatics.cs (65)
34Debug.Assert(s_writeStartElementMethod2 != null); 50Debug.Assert(s_writeStartElementMethod3 != null); 66Debug.Assert(s_writeEndElementMethod != null); 82Debug.Assert(s_writeNamespaceDeclMethod != null); 112Debug.Assert(s_ienumeratorMoveNextMethod != null); 128Debug.Assert(s_ienumeratorGetCurrentMethod != null); 144Debug.Assert(s_getItemContractMethod != null); 160Debug.Assert(s_isStartElementMethod2 != null); 176Debug.Assert(s_isStartElementMethod0 != null); 192Debug.Assert(s_getUninitializedObjectMethod != null); 208Debug.Assert(s_nodeTypeProperty != null); 237Debug.Assert(s_getStreamingContextMethod != null); 253Debug.Assert(s_getCollectionMemberMethod != null); 269Debug.Assert(s_storeCollectionMemberInfoMethod != null); 285Debug.Assert(s_storeIsGetOnlyCollectionMethod != null); 301Debug.Assert(s_throwNullValueReturnedForGetOnlyCollectionExceptionMethod != null); 316Debug.Assert(s_throwArrayExceededSizeExceptionMethod != null); 332Debug.Assert(s_incrementItemCountMethod != null); 349Debug.Assert(s_internalDeserializeMethod != null); 365Debug.Assert(s_moveToNextElementMethod != null); 381Debug.Assert(s_getMemberIndexMethod != null); 397Debug.Assert(s_getMemberIndexWithRequiredMembersMethod != null); 413Debug.Assert(s_throwRequiredMemberMissingExceptionMethod != null); 429Debug.Assert(s_skipUnknownElementMethod != null); 445Debug.Assert(s_readIfNullOrRefMethod != null); 461Debug.Assert(s_readAttributesMethod != null); 477Debug.Assert(s_resetAttributesMethod != null); 493Debug.Assert(s_getObjectIdMethod != null); 509Debug.Assert(s_getArraySizeMethod != null); 525Debug.Assert(s_addNewObjectMethod != null); 541Debug.Assert(s_addNewObjectWithIdMethod != null); 557Debug.Assert(s_getExistingObjectMethod != null); 573Debug.Assert(s_ensureArraySizeMethod != null); 589Debug.Assert(s_trimArraySizeMethod != null); 605Debug.Assert(s_checkEndOfArrayMethod != null); 622Debug.Assert(s_getArrayLengthMethod != null); 638Debug.Assert(s_createSerializationExceptionMethod != null); 654Debug.Assert(s_createUnexpectedStateExceptionMethod != null); 670Debug.Assert(s_internalSerializeReferenceMethod != null); 686Debug.Assert(s_internalSerializeMethod != null); 702Debug.Assert(s_writeNullMethod != null); 718Debug.Assert(s_incrementArrayCountMethod != null); 734Debug.Assert(s_incrementCollectionCountMethod != null); 750Debug.Assert(s_incrementCollectionCountGenericMethod != null); 766Debug.Assert(s_getDefaultValueMethod != null); 782Debug.Assert(s_getNullableValueMethod != null); 798Debug.Assert(s_throwRequiredMemberMustBeEmittedMethod != null); 814Debug.Assert(s_getHasValueMethod != null); 832Debug.Assert(s_isMemberTypeSameAsMemberValue != null); 848Debug.Assert(s_writeXmlValueMethod != null); 864Debug.Assert(s_readXmlValueMethod != null); 880Debug.Assert(s_namespaceProperty != null); 896Debug.Assert(s_contractNamespacesField != null); 912Debug.Assert(s_memberNamesField != null); 928Debug.Assert(s_childElementNamespacesProperty != null); 944Debug.Assert(s_collectionItemNameProperty != null); 960Debug.Assert(s_childElementNamespaceProperty != null); 976Debug.Assert(s_getDateTimeOffsetMethod != null); 992Debug.Assert(s_getDateTimeOffsetAdapterMethod != null); 1007Debug.Assert(s_getTypeHandleMethod != null); 1021Debug.Assert(s_getTypeMethod != null); 1037Debug.Assert(s_throwInvalidDataContractExceptionMethod != null); 1053Debug.Assert(s_serializeReadOnlyTypesProperty != null); 1069Debug.Assert(s_classSerializationExceptionMessageProperty != null); 1085Debug.Assert(s_collectionSerializationExceptionMessageProperty != null);
FrameworkFork\System.ServiceModel\Internals\System\Runtime\AssertHelper.cs (1)
22Debug.Assert(false, message);
FrameworkFork\System.Web.Services\Services\Description\ServiceDescription.cs (2)
1322Debug.Assert(isInput == true, "Oneway flow cannot have an output message"); 1330Debug.Assert(false, "Unknown message flow");
HelpGenerator.cs (1)
219Debug.Assert(!string.IsNullOrEmpty(name), "Help category name should have a valid value!");
ImportModule.cs (3)
278Debug.Assert(false, "Unrecognized serializer option!"); 299Debug.Assert(false, "Unrecognized serializer option!"); 325Debug.Assert(!dcOptions.Namespaces.ContainsKey(namespaceMapping.Key), $"Key '{namespaceMapping.Key}' already added to dictionary!");
Metadata\MetadataDocumentSaver.cs (1)
120Debug.Fail("Unknown metadata found: " + typeName);
Metadata\MetadataFileInfo.cs (1)
20Debug.Assert(metadata != null && filePath != null && write != null, "One or more parameters null!");
OutputPathHelper.cs (1)
19Debug.Assert(!string.IsNullOrWhiteSpace(filePath), "filePath must have a valid value!");
Shared\Utilities\AsyncHelper.cs (1)
60System.Diagnostics.Debug.Assert(finishedTask != taskCompletionSrc.Task, "Unexpected completion task!");
Tool.cs (1)
334Debug.Assert(ex != null, "exception should not be null!");
dotnet-watch (12)
Program.cs (2)
233Debug.Assert(options.ProjectPath != null); 349Debug.Assert(mainProjectOptions.Representation.PhysicalPath != null);
Watch\BuildEvaluator.cs (4)
34Debug.Assert(context.MainProjectOptions != null); 46Debug.Assert(MainProjectOptions.Representation.PhysicalPath != null); 125Debug.Assert(_evaluationResult != null); 152Debug.Assert(_msbuildFileTimestamps != null);
Watch\DotNetWatcher.cs (3)
73Debug.Assert(context.MainProjectOptions != null); 146Debug.Assert(finishedTask == fileSetTask); 148Debug.Assert(changedFile != null, "ChangedFile should only be null when cancelled");
Watch\MsBuildFileSetFactory.cs (3)
91Debug.Assert(result != null); 128Debug.Assert(fileItems.Values.All(f => Path.IsPathRooted(f.FilePath)), "All files should be rooted paths"); 186Debug.Assert(assemblyDir != null);
DotNetWatchTasks (1)
FileSetSerializer.cs (1)
59Debug.Assert(existingStaticWebAssetPath == staticWebAssetPath);
GenerateDocumentationAndConfigFiles (560)
JsonWriter.cs (1)
127Debug.Assert(_pending is Pending.NewLineAndIndent or Pending.CommaNewLineAndIndent);
Program.cs (14)
419Debug.Assert(!args.ContainsPortedFxCopRules); 420Debug.Assert(string.IsNullOrEmpty(args.PropsFileToDisableNetAnalyzersInNuGetPackageName)); 440Debug.Assert(Version.TryParse(args.AnalyzerVersion, out _)); 466Debug.Assert(args.AnalyzerPackageName is NetAnalyzersPackageName or TextAnalyzersPackageName); 487Debug.Assert(!args.ContainsPortedFxCopRules); 539Debug.Assert(!args.ContainsPortedFxCopRules); 625Debug.Assert(!args.ContainsPortedFxCopRules); 761Debug.Assert(false); 771Debug.Assert(!args.ContainsPortedFxCopRules); 1230Debug.Assert(category == null || customTag == null); 1231Debug.Assert(category != null == (rulesetKind == RulesetKind.CategoryDefault || rulesetKind == RulesetKind.CategoryEnabled)); 1232Debug.Assert(customTag != null == (rulesetKind == RulesetKind.CustomTagDefault || rulesetKind == RulesetKind.CustomTagEnabled)); 1388Debug.Assert(fileName.EndsWith(".globalconfig", StringComparison.Ordinal)); 1442Debug.Assert(sortedRulesById.Count > 0);
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 160Debug.Assert(cfg.Parent != null); 161Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 162Debug.Assert(parentAnalysisData != null); 319Debug.Assert(lambdaOrLocalFunctionCfg != null); 329Debug.Assert(anonymousFunctionCfg != null); 338Debug.Assert(localFunction.IsLocalFunction()); 346Debug.Assert(localFunctionCfg != null); 362Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 503Debug.Assert(localFunction.IsLocalFunction()); 504Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 594Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\roslyn\src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\roslyn\src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (13)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 280Debug.Assert(_value is V, "Item must be a a V"); 309Debug.Assert(this.Count >= 1); 315Debug.Assert(_value is V, "_value must be a V"); 343Debug.Assert(_count >= 1);
src\roslyn\src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
410Debug.Assert(!IsUnixLikePlatform); 428Debug.Assert(IsAbsolute(root)); 884Debug.Assert(parts[toSkip - 1] == string.Empty);
src\roslyn\src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 87Debug.Assert(tail != null); 98Debug.Assert(this != Empty); 108Debug.Assert(this != Empty);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (2)
151Debug.Assert(e.InnerException is object); 153Debug.Assert(false, "Unreachable");
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\roslyn\src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
85Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (1)
714Debug.Assert(data.All(d => d.Count() == count));
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\roslyn\src\Dependencies\Collections\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\roslyn\src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\roslyn\src\Dependencies\Collections\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\roslyn\src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\roslyn\src\Dependencies\Collections\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\roslyn\src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.Analyzers\Core\MetaAnalyzers\ReleaseTrackingHelper.cs (1)
482Debug.Assert(kind is ReleaseTrackingRuleEntryKind.New or ReleaseTrackingRuleEntryKind.Removed);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
495Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 507Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (7)
210Debug.Assert(isInsideAnonymousObjectInitializer == 288Debug.Assert(success); 289Debug.Assert(cfg != null); 320Debug.Assert(operation.Kind is OperationKind.None or OperationKind.Attribute, $"Unexpected root operation kind: {operation.Kind}"); 333Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 495Debug.Assert(parameterIndex >= 0); 496Debug.Assert(parameterIndex < arguments.Length);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
61Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (12)
80Debug.Assert(expectedValueText == actualValueText); 86Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 90Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 99Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 108Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 147Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics."); 153Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (4)
100Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 101Debug.Assert(_span.End == virtualChars._span.Start); 111Debug.Assert(chars1._leafCharacters == chars2._leafCharacters); 175Debug.Assert(chars1._tokenStart == chars2._tokenStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
119Debug.Fail("Unhandled declaration pattern context"); 153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
248Debug.Fail("Could not find common ancestor."); 271Debug.Fail("Could not find common ancestor.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 216Debug.Assert(branch.Destination == null); 221Debug.Assert(branch.Destination == null); 227Debug.Assert(branch.Destination != null); 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 262Debug.Assert(enclosing.NestedRegions[0] == region); 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 325Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 337Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 375Debug.Assert(startAt > 0); 376Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 391Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\LValueFlowCaptureProvider.cs (1)
76Debug.Assert(kind == FlowCaptureKind.LValueAndRValueCapture || !rvalueFlowCaptureIds.Contains(captureId), "Flow capture used as both an r-value and an l-value, but with incorrect flow capture kind");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (1)
411Debug.Assert(s_serializationVersion == 5, "After increasing the serialization version, add an upgrade path here.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (5)
92Debug.Assert(BitConverter.IsLittleEndian); 185Debug.Assert(value == null || !value.GetType().GetTypeInfo().IsEnum, "Enum should not be written with WriteValue. Write them as ints instead."); 195Debug.Assert(!typeInfo.IsEnum, "Enums should not be written with WriteObject. Write them out as integers instead."); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (18)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1072Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1073Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1157Debug.Assert(parameter1.HasExplicitDefaultValue, "Expected all unspecified parameter to have default values"); 1158Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\LightweightOverloadResolution.cs (3)
114Debug.Assert(foundParameterIndex < parameters.Length); 239Debug.Assert(parameterIndex >= 0); 240Debug.Assert(parameterIndex < method.Parameters.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (4)
34Debug.Assert(span.Start >= start, "Bad generator."); 86Debug.Assert(current < length); 108Debug.Assert(current < length); 127Debug.Assert(char.IsUpper(identifier[current - 1]));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
155Debug.Assert(similarityWeight <= _threshold);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
342Debug.Assert(type is null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
53Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 58Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
26Debug.Fail("Unhandled symbol kind in RequiresUnsafeModifierVisitor: " + node.Kind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
540Debug.Assert(isTypeParameter2);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
60Debug.Fail("FixAllScope.ContainingMember and FixAllScope.ContainingType are not supported in CodeStyle layer");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
206Debug.Assert(false, message + ". " + diagnostics);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
34Debug.Assert(diagnostic != null); 88Debug.Assert(analyzerConfigPath != null); 89Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\AbstractSemanticModelReuseLanguageService.cs (4)
102Debug.Fail("Previous container didn't map back to a normal accessor container."); 111Debug.Fail("Accessor count shouldn't have changed as there were no top level edits."); 132Debug.Fail("Member count shouldn't have changed as there were no top level edits."); 139Debug.Fail("Child at indicated index should be a node as there were no top level edits.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (3)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel); 227Debug.Assert(replacedParent.GetAnnotatedNodesAndTokens(annotation).Count() == 1); 246Debug.Assert(newRoot.GetAnnotatedNodesAndTokens(marker).Count() == 1);
GetDocument.Insider (1)
src\db4096461e91d616\HostFactoryResolver.cs (1)
304Debug.Assert(_hostTcs.Task.IsCompleted);
ILAssembler (13)
GrammarVisitor.cs (13)
556Debug.Assert(_currentAssemblyOrRef is not null); 1313Debug.Assert(resolutionContext is null); 3006Debug.Assert(opcode == ILOpCode.Ldc_i8); 3097Debug.Assert(opcode == ILOpCode.Ldstr); 3115Debug.Assert(userString is not null); 3211Debug.Assert(context.id() is not null); 3612Debug.Assert(_currentMethod is not null); 3991Debug.Assert(child is CILParser.DottedNameContext); 4207Debug.Assert(strings.Length == 2); 4798Debug.Assert(context.className() is not null); 4816Debug.Assert(context.OBJECT() is not null); 5336Debug.Assert(context.type() != null); 5360Debug.Assert(childToken.Symbol.Type == CILParser.REF);
ilc (11)
Program.cs (1)
26using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\InstructionSetHelpers.cs (8)
138Debug.Assert((cpuidInfo.Edx & (1 << 15)) != 0); // CMOV 265Debug.Assert(InstructionSet.X64_AVX == InstructionSet.X86_AVX); 266Debug.Assert(InstructionSet.X64_AVX2 == InstructionSet.X86_AVX2); 286Debug.Assert(InstructionSet.X64_AVX512 == InstructionSet.X86_AVX512); 322Debug.Assert(InstructionSet.X86_AVX512 == InstructionSet.X64_AVX512); 325Debug.Assert(InstructionSet.X86_Vector256 == InstructionSet.X64_Vector256); 326Debug.Assert(InstructionSet.X86_VectorT256 == InstructionSet.X64_VectorT256); 327Debug.Assert(InstructionSet.X86_VectorT512 == InstructionSet.X64_VectorT512);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (2)
10using Debug = System.Diagnostics.Debug; 57Debug.Assert(method.Signature.Length == 0 && method.Signature.IsStatic);
ILCompiler.Compiler (1360)
Compiler\AnalysisBasedMetadataManager.cs (10)
12using Debug = System.Diagnostics.Debug; 76Debug.Assert((refMethod.Category & MetadataCategory.Description) == 0 78Debug.Assert((refMethod.Category & MetadataCategory.RuntimeMapping) == 0 87Debug.Assert((refField.Category & MetadataCategory.Description) == 0 89Debug.Assert((refField.Category & MetadataCategory.RuntimeMapping) == 0 110Debug.Assert((GetMetadataCategory(refType.Entity.GetTypeDefinition()) & MetadataCategory.Description) 113Debug.Assert((refType.Category & MetadataCategory.Description) == 0 || 121Debug.Assert((GetMetadataCategory(refMethod.Entity.GetTypicalMethodDefinition()) & MetadataCategory.Description) 125Debug.Assert(GetMetadataCategory(refMethod.Entity) == GetMetadataCategory(refMethod.Entity.GetCanonMethodTarget(CanonicalFormKind.Specific))); 132Debug.Assert((GetMetadataCategory(refField.Entity.GetTypicalFieldDefinition()) & MetadataCategory.Description)
Compiler\BodySubstitution.cs (3)
24Debug.Assert(_value != Throw); 43Debug.Assert(method.Signature.ReturnType.IsVoid); 48Debug.Assert(_value is int);
Compiler\BodySubstitutionParser.cs (1)
51Debug.Assert(ShouldProcessElement(nav));
Compiler\Compilation.cs (10)
19using Debug = System.Diagnostics.Debug; 176Debug.Assert(intrinsicMethod.IsIntrinsic); 192Debug.Assert(callsiteModule is IAssemblyDesc, "Multi-module assemblies"); 204Debug.Assert(callsiteModule is IAssemblyDesc, "Multi-module assemblies"); 285Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any) || type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); 398Debug.Assert(contextMethod.AcquiresInstMethodTableFromThis()); 483Debug.Assert(calledMethod.HasInstantiation && calledMethod.IsVirtual); 486Debug.Assert(!calledMethod.IsCanonicalMethod(CanonicalFormKind.Specific)); 524Debug.Assert(!runtimeDeterminedOwningType.IsInterface); 540Debug.Assert(runtimeDeterminedOwningType.HasInstantiation);
Compiler\CompilerMetadataFieldLayoutAlgorithm.cs (2)
6using Debug = System.Diagnostics.Debug; 39Debug.Assert(layout.ThreadNonGcStatics.Size == LayoutInt.Zero);
Compiler\CompilerTypeSystemContext.Aot.cs (2)
131Debug.Assert(field.IsStatic); 271Debug.Assert(type is DefType);
Compiler\CompilerTypeSystemContext.BoxedTypes.cs (14)
13using Debug = System.Diagnostics.Debug; 56Debug.Assert(targetMethod.IsSharedByGenericInstantiations); 57Debug.Assert(!targetMethod.Signature.IsStatic); 58Debug.Assert(!targetMethod.HasInstantiation); 61Debug.Assert(owningType.IsValueType); 76Debug.Assert(owningType != owningTypeDefinition); 80Debug.Assert(!thunk.HasInstantiation); 88Debug.Assert(owningType.IsValueType); 259Debug.Assert(valuetype.IsTypeDefinition); 261Debug.Assert(valuetype.IsValueType); 358Debug.Assert(targetMethod.OwningType.IsValueType); 359Debug.Assert(!targetMethod.Signature.IsStatic); 447Debug.Assert(targetMethod.OwningType.IsValueType); 448Debug.Assert(!targetMethod.Signature.IsStatic);
Compiler\CompilerTypeSystemContext.GeneratedAssembly.cs (3)
14using Debug = System.Diagnostics.Debug; 66Debug.Fail("Resolving a TypeRef in the compiler generated assembly?"); 138Debug.Assert(!HasInstantiation, "Why is this generic?");
Compiler\CompilerTypeSystemContext.GetFieldMethodOverrides.cs (3)
10using Debug = System.Diagnostics.Debug; 114Debug.Assert(type.IsValueType); 159Debug.Assert(Type.IsValueType);
Compiler\CompilerTypeSystemContext.InterfaceThunks.cs (10)
11using Debug = System.Diagnostics.Debug; 72Debug.Assert(targetMethod.IsSharedByGenericInstantiations); 73Debug.Assert(!targetMethod.Signature.IsStatic); 74Debug.Assert(!targetMethod.HasInstantiation); 75Debug.Assert(interfaceOnDefinition.GetTypeDefinition() == targetMethod.OwningType.GetTypeDefinition()); 76Debug.Assert(targetMethod.OwningType.IsInterface); 81Debug.Assert(((MetadataType)implementingClass).IsDynamicInterfaceCastableImplementation()); 92Debug.Assert(interfaceIndex >= 0); 176Debug.Assert(targetMethod.OwningType.IsInterface); 177Debug.Assert(!targetMethod.Signature.IsStatic);
Compiler\Dataflow\ArrayValue.cs (1)
98System.Diagnostics.Debug.Assert(v is not ArrayValue);
Compiler\Dataflow\AsyncMaskingILProvider.cs (4)
9using Debug = System.Diagnostics.Debug; 24Debug.Assert(wrappedProvider is not AsyncMaskingILProvider); 30Debug.Assert(!method.IsAsyncVariant()); 76Debug.Assert(_wrappedIL.GetMethodILDefinition() == _wrappedIL);
Compiler\Dataflow\AttributeDataFlow.cs (1)
82Debug.Assert(namedArgument.Kind == CustomAttributeNamedArgumentKind.Property);
Compiler\Dataflow\CompilerGeneratedCallGraph.cs (10)
31Debug.Assert(fromMethod.IsTypicalMethodDefinition); 32Debug.Assert(toMethod.IsTypicalMethodDefinition); 33Debug.Assert(CompilerGeneratedNames.IsLambdaOrLocalFunction(toMethod.Name.AsSpan())); 39Debug.Assert(fromMethod.IsTypicalMethodDefinition); 40Debug.Assert(toType.IsTypeDefinition); 41Debug.Assert(CompilerGeneratedNames.IsStateMachineType(toType.Name.AsSpan())); 47Debug.Assert(fromType.IsTypeDefinition); 48Debug.Assert(toMethod.IsTypicalMethodDefinition); 49Debug.Assert(CompilerGeneratedNames.IsStateMachineType(fromType.Name.AsSpan())); 50Debug.Assert(CompilerGeneratedNames.IsLambdaOrLocalFunction(toMethod.Name.AsSpan()));
Compiler\Dataflow\CompilerGeneratedState.cs (20)
119Debug.Assert(type == type.GetTypeDefinition()); 120Debug.Assert(!CompilerGeneratedNames.IsStateMachineOrDisplayClass(type.Name.AsSpan())); 139Debug.Assert(method == method.GetTypicalMethodDefinition()); 148Debug.Assert(added); 155Debug.Assert(!isStateMachineMember); 188Debug.Assert(generatedType.IsTypeDefinition); 229Debug.Assert(generatedType.IsTypeDefinition); 251Debug.Assert(stateMachineType.ContainingType == type || 254Debug.Assert(stateMachineType == stateMachineType.GetTypeDefinition()); 328Debug.Assert(CompilerGeneratedNames.IsLambdaOrLocalFunction(nestedFunction.Name.AsSpan())); 343Debug.Assert(CompilerGeneratedNames.IsStateMachineType(stateMachineType.Name.AsSpan())); 355Debug.Assert(generatedType == generatedType.GetTypeDefinition()); 395Debug.Assert(CompilerGeneratedNames.IsStateMachineOrDisplayClass(generatedType.Name.AsSpan())); 396Debug.Assert(generatedType == generatedType.GetTypeDefinition()); 449Debug.Fail("This should be impossible in valid code"); 632Debug.Assert(type.IsTypeDefinition); 685Debug.Assert(CompilerGeneratedNames.IsStateMachineOrDisplayClass(generatedType.Name.AsSpan())); 746Debug.Assert(sourceMember is not MethodDesc sourceMethod || sourceMethod.IsTypicalMethodDefinition); 756Debug.Assert(userMethodCandidate != member); 763Debug.Assert(!IsNestedFunctionOrStateMachineMember(userMethod));
Compiler\Dataflow\FlowAnnotations.cs (5)
19using Debug = System.Diagnostics.Debug; 189Debug.Assert(ecmaGenericParameter.Kind == GenericParameterKind.Method); 315Debug.Assert(blobReader.Length == 8); 341Debug.Assert(key.IsTypeDefinition); 657Debug.Assert(attrs is null || attrs.Count == typeDef.Instantiation.Length);
Compiler\Dataflow\GenericArgumentDataFlow.cs (1)
101Debug.Assert(genericParameterValue.DynamicallyAccessedMemberTypes != DynamicallyAccessedMemberTypes.None);
Compiler\Dataflow\HandleCallAction.cs (2)
469Debug.Assert(staticType is MetadataType || staticType.IsArray); 570Debug.Assert(contextMethod.GetTypicalMethodDefinition() == contextMethod);
Compiler\Dataflow\HoistedLocalKey.cs (1)
22Debug.Assert(CompilerGeneratedState.IsHoistedLocal(field));
Compiler\Dataflow\InterproceduralState.cs (3)
66Debug.Assert(methodBody.GetMethodILDefinition() == methodBody); 70Debug.Assert(!MethodBodies.IsUnknown()); 81Debug.Assert(!CompilerGeneratedNames.IsLambdaOrLocalFunction(stateMachineMethod.Name.AsSpan()));
Compiler\Dataflow\MethodBodyScanner.cs (6)
289Debug.Assert(startingMethod.IsTypicalMethodDefinition); 293Debug.Assert(!CompilerGeneratedState.IsNestedFunctionOrStateMachineMember(startingMethod)); 309Debug.Assert(!oldInterproceduralState.MethodBodies.IsUnknown()); 328Debug.Assert(!interproceduralState.MethodBodies.IsUnknown()); 329Debug.Assert(interproceduralState.MethodBodies.GetKnownValues().Count() == 1); 988Debug.Assert(operand is FieldDesc);
Compiler\Dataflow\MethodReturnValue.cs (1)
23Debug.Assert(!isNewObj || method.IsConstructor, "isNewObj can only be true for constructors");
Compiler\Dataflow\ReflectionMarker.cs (3)
295Debug.Assert(entity is MethodDesc or FieldDesc); 344Debug.Assert(entity is MethodDesc or FieldDesc); 351Debug.Assert(_typeHierarchyDataFlowOrigin != null);
Compiler\Dataflow\ReflectionMethodBodyScanner.cs (5)
144Debug.Assert(annotation != DynamicallyAccessedMemberTypes.None); 212Debug.Fail("Invalid IL or a bug in the scanner"); 291Debug.Assert(callingMethodIL.OwningMethod == _origin.MemberDefinition); 341Debug.Assert(callingMethodDefinition == diagnosticContext.Origin.MemberDefinition); 345Debug.Assert(
Compiler\Dataflow\TrimAnalysisAssignmentPattern.cs (2)
40Debug.Assert(Origin == other.Origin); 41Debug.Assert(ParameterIndex == other.ParameterIndex);
Compiler\Dataflow\TrimAnalysisMethodCallPattern.cs (7)
36Debug.Assert(origin.MemberDefinition is MethodDesc); 58Debug.Assert(MethodBody.OwningMethod == other.MethodBody.OwningMethod); 59Debug.Assert(Operation == other.Operation); 60Debug.Assert(Offset == other.Offset); 61Debug.Assert(Origin == other.Origin); 62Debug.Assert(CalledMethod == other.CalledMethod); 63Debug.Assert(Arguments.Length == other.Arguments.Length);
Compiler\Dataflow\TrimAnalysisTokenAccessPattern.cs (1)
39Debug.Fail($"Unsupported entity for reflection access pattern: {Entity}");
Compiler\DelegateCreationInfo.cs (12)
11using Debug = System.Diagnostics.Debug; 47Debug.Assert(_constrainedType == null); 95Debug.Assert(_targetMethod.IsRuntimeDeterminedExactMethod || _constrainedType.IsRuntimeDeterminedSubtype); 99Debug.Assert(false); 111Debug.Assert(NeedsRuntimeLookup); 124Debug.Assert(false); 135Debug.Assert(!NeedsRuntimeLookup); 148Debug.Fail("Need to do runtime lookup"); 152Debug.Assert(false); 172Debug.Assert(targetKind != TargetKind.VTableLookup 206Debug.Assert(paramCountDelegateClosed == paramCountTargetMethod + 1); 289Debug.Assert(constrainedType == null);
Compiler\DependencyAnalysis\AddressTakenMethodNode.cs (1)
76Debug.Assert(!_methodNode.RepresentsIndirectionCell);
Compiler\DependencyAnalysis\ArrayOfFrozenObjectsNode.cs (1)
37Debug.Assert(node is not FrozenObjectNode frozenObj || !frozenObj.ObjectType.RequiresAlign8());
Compiler\DependencyAnalysis\AsyncContinuationEETypeNode.cs (5)
8using Debug = System.Diagnostics.Debug; 39Debug.Assert(continuationBaseType.InstanceByteCountUnaligned.AsInt == baseSize * pointerSize); 45Debug.Assert(dataOffsetField.IsLiteral); 49Debug.Assert(constant.TypeCode == System.Reflection.Metadata.ConstantTypeCode.Int32); 52Debug.Assert(baseSize * pointerSize == expectedDataOffset);
Compiler\DependencyAnalysis\CanonicalDefinitionEETypeNode.cs (1)
15Debug.Assert(type.IsCanonicalDefinitionType(CanonicalFormKind.Any));
Compiler\DependencyAnalysis\ClassConstructorContextMap.cs (2)
10using Debug = System.Diagnostics.Debug; 52Debug.Assert(factory.PreinitializationManager.HasLazyStaticConstructor(type));
Compiler\DependencyAnalysis\ConstructedEETypeNode.cs (2)
15Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); 75Debug.Assert(!_type.IsCanonicalSubtype(CanonicalFormKind.Any));
Compiler\DependencyAnalysis\CustomAttributeBasedDependencyAlgorithm.cs (2)
179Debug.Assert(decodedArgument.Kind == CustomAttributeNamedArgumentKind.Property); 289Debug.Assert(value is TypeDesc);
Compiler\DependencyAnalysis\DataflowAnalyzedMethodNode.cs (2)
26Debug.Assert(methodIL.OwningMethod.IsTypicalMethodDefinition); 27Debug.Assert(!CompilerGeneratedState.IsNestedFunctionOrStateMachineMember(methodIL.OwningMethod));
Compiler\DependencyAnalysis\DataflowAnalyzedTypeDefinitionNode.cs (1)
24Debug.Assert(typeDefinition.IsTypeDefinition);
Compiler\DependencyAnalysis\DataOnlyEETypeNode.cs (2)
10using Debug = System.Diagnostics.Debug; 84Debug.Assert(dataBuilder.CountBytes == ((ISymbolDefinitionNode)this).Offset);
Compiler\DependencyAnalysis\DehydratedDataNode.cs (4)
12using Debug = System.Diagnostics.Debug; 141Debug.Assert(reloc.Offset >= sourcePosition); 207Debug.Assert(sourcePosition == reloc.Offset); 307Debug.Assert(sourcePosition == o.Data.Length);
Compiler\DependencyAnalysis\DelegateMarshallingDataNode.cs (2)
10using Debug = System.Diagnostics.Debug; 25Debug.Assert(type.IsDelegate);
Compiler\DependencyAnalysis\DelegateTargetVirtualMethodNode.cs (3)
23Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 49Debug.Assert(declaration.GetCanonMethodTarget(CanonicalFormKind.Specific) == declaration); 50Debug.Assert(implementation.GetCanonMethodTarget(CanonicalFormKind.Specific) == implementation);
Compiler\DependencyAnalysis\DictionaryLayoutNode.cs (7)
40Debug.Assert(type.IsCanonicalSubtype(CanonicalFormKind.Any)); 41Debug.Assert(type.IsDefType); 46Debug.Assert(method != null && method.IsSharedByGenericInstantiations); 61Debug.Assert(_owningMethodOrType is MethodDesc); 135Debug.Assert(builder.CountBytes - offsetBefore == factory.Target.PointerSize); 156Debug.Assert(HasFixedSlots); 284Debug.Assert(_layout == null, "Trying to add entry but layout already computed");
Compiler\DependencyAnalysis\DispatchCellNode.cs (4)
30Debug.Assert(targetMethod.HasInstantiation || targetMethod.OwningType.IsInterface); 31Debug.Assert(!targetMethod.IsSharedByGenericInstantiations); 54Debug.Assert(_offset != InvalidOffset); 73Debug.Assert(_offset == InvalidOffset);
Compiler\DependencyAnalysis\DynamicDependencyAttributesOnEntityNode.cs (5)
33Debug.Assert(entity is EcmaMethod || entity is EcmaField); 147Debug.Fail("Did we introduce a new overload?"); 196Debug.Fail("Did we introduce a new overload?"); 214Debug.Fail("Did we introduce a new overload?"); 218Debug.Assert(members.Any());
Compiler\DependencyAnalysis\EETypeNode.cs (19)
13using Debug = System.Diagnostics.Debug; 87Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any) || type == type.ConvertToCanonForm(CanonicalFormKind.Specific)); 88Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any) || !type.IsMdArray); // MDArray doesn't have type loader templates 89Debug.Assert(!type.IsGenericParameter); 90Debug.Assert(!type.IsRuntimeDeterminedSubtype); 422Debug.Assert( 439Debug.Assert(defTypeDefinitionRuntimeInterfaces.Length == defTypeRuntimeInterfaces.Length); 445Debug.Assert(interfaceType.IsInterface); 478Debug.Assert(!implMethod.IsVirtual); 700Debug.Assert(objData.CountBytes - ((ISymbolDefinitionNode)this).Offset == GetVTableOffset(objData.TargetPointerSize)); 751Debug.Assert(GCDescSize == 0); 828Debug.Assert(!_type.IsCanonicalSubtype(CanonicalFormKind.Any)); 888Debug.Assert(EmitVirtualSlots); 896Debug.Assert(templateType.BaseType != null); 975Debug.Assert(!declType.IsObject || declMethod.Name != "Finalize"u8); 978Debug.Assert(!declMethod.HasInstantiation); 1229Debug.Assert(_type.IsTypeDefinition || !_type.HasSameTypeDefinition(context.ArrayOfTClass), "Asking for Array<T> MethodTable"); 1254Debug.Assert(bytesEmitted % builder.TargetPointerSize == 0); 1298Debug.Assert(builder.CountBytes == WritableData.GetSize(factory.Target.PointerSize));
Compiler\DependencyAnalysis\EmbeddedObjectNode.cs (5)
8using Debug = System.Diagnostics.Debug; 29Debug.Assert(_offset != InvalidOffset); 38Debug.Assert(_index != InvalidOffset); 45Debug.Assert(_offset == InvalidOffset || _offset == offset); 51Debug.Assert(_index == InvalidOffset || _index == index);
Compiler\DependencyAnalysis\ExactMethodInstantiationsEntryNode.cs (5)
10using Debug = System.Diagnostics.Debug; 20Debug.Assert(!method.IsAbstract); 21Debug.Assert(method.HasInstantiation); 22Debug.Assert(!method.GetCanonMethodTarget(CanonicalFormKind.Specific).IsCanonicalMethod(CanonicalFormKind.Any)); 32Debug.Assert(dependencies != null);
Compiler\DependencyAnalysis\ExternalReferencesTableNode.cs (2)
9using Debug = System.Diagnostics.Debug; 48Debug.Assert(node.Marked);
Compiler\DependencyAnalysis\ExternalTypeMapNode.cs (1)
92Debug.Assert(targetNode.Marked);
Compiler\DependencyAnalysis\ExternalTypeMapRequestNode.cs (1)
8using Debug = System.Diagnostics.Debug;
Compiler\DependencyAnalysis\FatFunctionPointerNode.cs (4)
7using Debug = System.Diagnostics.Debug; 26Debug.Assert(methodRepresented.GetCanonMethodTarget(CanonicalFormKind.Specific) != methodRepresented); 64Debug.Assert(factory.Target.MinimumFunctionAlignment <= factory.Target.PointerSize); 85Debug.Assert(canonMethod.RequiresInstMethodTableArg());
Compiler\DependencyAnalysis\FieldMetadataNode.cs (4)
12using Debug = System.Diagnostics.Debug; 32Debug.Assert(field.IsTypicalFieldDefinition); 78Debug.Assert(!factory.MetadataManager.IsReflectionBlocked(_field)); 79Debug.Assert(factory.MetadataManager.CanGenerateMetadata(_field));
Compiler\DependencyAnalysis\FieldRvaDataNode.cs (2)
10using Debug = System.Diagnostics.Debug; 22Debug.Assert(field.HasRva);
Compiler\DependencyAnalysis\FrozenObjectNode.cs (2)
9using Debug = System.Diagnostics.Debug; 43Debug.Assert(dataBuilder.CountBytes == sizeBefore + ContentSize);
Compiler\DependencyAnalysis\FrozenRuntimeTypeNode.cs (2)
8using Debug = System.Diagnostics.Debug; 19Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any));
Compiler\DependencyAnalysis\GCStaticsNode.cs (3)
9using Debug = System.Diagnostics.Debug; 21Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Specific)); 22Debug.Assert(!type.IsGenericDefinition);
Compiler\DependencyAnalysis\GCStaticsPreInitDataNode.cs (5)
7using Debug = System.Diagnostics.Debug; 23Debug.Assert(!preinitializationInfo.Type.IsCanonicalSubtype(CanonicalFormKind.Specific)); 70Debug.Assert(padding >= 0); 79Debug.Assert(builder.CountBytes - currentOffset == field.FieldType.GetElementSize().AsInt); 83Debug.Assert(pad >= 0);
Compiler\DependencyAnalysis\GenericDefinitionEETypeNode.cs (2)
9using Debug = System.Diagnostics.Debug; 17Debug.Assert(type.IsGenericDefinition);
Compiler\DependencyAnalysis\GenericDictionaryNode.cs (8)
169Debug.Assert(!owningType.IsCanonicalSubtype(CanonicalFormKind.Any)); 170Debug.Assert(!owningType.IsRuntimeDeterminedSubtype); 171Debug.Assert(owningType.HasInstantiation); 172Debug.Assert(owningType.ConvertToCanonForm(CanonicalFormKind.Specific) != owningType); 263Debug.Assert(builder.CountBytes == ((ISymbolDefinitionNode)this).Offset); 276Debug.Assert(!owningMethod.IsSharedByGenericInstantiations); 277Debug.Assert(owningMethod.HasInstantiation); 278Debug.Assert(owningMethod.GetCanonMethodTarget(CanonicalFormKind.Specific) != owningMethod);
Compiler\DependencyAnalysis\GenericLookupResult.cs (49)
30Debug.Assert(owningTypeDefinition.Instantiation.Length == TypeInstantiation.Length); 31Debug.Assert(MethodInstantiation.IsNull || MethodInstantiation.Length == 0); 36Debug.Assert(_canonicalOwner is MethodDesc); 38Debug.Assert(owningMethodDefinition.Instantiation.Length == MethodInstantiation.Length); 44Debug.Assert(owningType.Instantiation.Length == TypeInstantiation.Length); 49Debug.Assert(owningMethodDefinition.OwningType.Instantiation.IsNull 120Debug.Assert(InstantiationIsConcrete(dictionary.TypeInstantiation)); 121Debug.Assert(InstantiationIsConcrete(dictionary.MethodInstantiation)); 167Debug.Assert(x.GetType() == y.GetType()); 172Debug.Assert(result != 0); 178Debug.Assert(x.GetType() != y.GetType()); 196Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?"); 208Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 255Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?"); 266Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 313Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?"); 324Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 371Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?"); 387Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 434Debug.Assert(method.IsRuntimeDeterminedExactMethod, "Concrete method in a generic dictionary?"); 447Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any)); 499Debug.Assert(field.OwningType.IsRuntimeDeterminedSubtype, "Concrete field in a generic dictionary?"); 510Debug.Assert(!instantiatedField.OwningType.IsCanonicalSubtype(CanonicalFormKind.Any)); 555Debug.Assert(method.IsRuntimeDeterminedExactMethod, "Concrete method in a generic dictionary?"); 569Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any)); 620Debug.Assert(method.IsRuntimeDeterminedExactMethod); 638Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any)); 703Debug.Assert(method.IsRuntimeDeterminedExactMethod); 704Debug.Assert(method.IsVirtual); 705Debug.Assert(method.HasInstantiation || method.OwningType.IsInterface); 733Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any)); 783Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete static base in a generic dictionary?"); 784Debug.Assert(type is MetadataType); 795Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 840Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete static base in a generic dictionary?"); 841Debug.Assert(type is MetadataType); 852Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 896Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete static base in a generic dictionary?"); 897Debug.Assert(type is MetadataType); 908Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 953Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?"); 964Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 1005Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?"); 1016Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any)); 1064Debug.Assert(_constraintType.IsRuntimeDeterminedSubtype || _constrainedMethod.IsRuntimeDeterminedExactMethod, "Concrete type in a generic dictionary?"); 1065Debug.Assert(!_constrainedMethod.HasInstantiation || !_directCall, "Direct call to constrained generic method isn't supported"); 1094Debug.Assert(!instantiatedConstrainedMethod.IsCanonicalMethod(CanonicalFormKind.Any)); 1095Debug.Assert(!instantiatedConstraintType.IsCanonicalSubtype(CanonicalFormKind.Any)); 1134Debug.Assert(instantiatedConstraintType.IsValueType || (instantiatedConstrainedMethod.OwningType.IsInterface && instantiatedConstrainedMethod.Signature.IsStatic));
Compiler\DependencyAnalysis\GenericMethodsHashtableEntryNode.cs (2)
10using Debug = System.Diagnostics.Debug; 29Debug.Assert(dependencies != null);
Compiler\DependencyAnalysis\GenericMethodsHashtableNode.cs (2)
53Debug.Assert(method.HasInstantiation && !method.IsCanonicalMethod(CanonicalFormKind.Any)); 100Debug.Assert(method.HasInstantiation && !method.IsCanonicalMethod(CanonicalFormKind.Any));
Compiler\DependencyAnalysis\GenericMethodsTemplateMap.cs (2)
57Debug.Assert(layoutNode.Marked); 96Debug.Assert(method == method.GetCanonMethodTarget(CanonicalFormKind.Specific));
Compiler\DependencyAnalysis\GenericStaticBaseInfoNode.cs (2)
22Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any)); 23Debug.Assert(type.HasInstantiation);
Compiler\DependencyAnalysis\GenericTypesTemplateMap.cs (2)
91Debug.Assert(type.Instantiation.Length == 1); 118Debug.Assert(type == type.ConvertToCanonForm(CanonicalFormKind.Specific));
Compiler\DependencyAnalysis\GenericVarianceNode.cs (6)
9using Debug = System.Diagnostics.Debug; 79Debug.Assert(typeDefinition.IsTypeDefinition); 80Debug.Assert(typeDefinition.HasInstantiation); 82Debug.Assert((byte)Internal.TypeSystem.GenericVariance.Contravariant == (byte)GenericVariance.Contravariant); 83Debug.Assert((byte)Internal.TypeSystem.GenericVariance.Covariant == (byte)GenericVariance.Covariant); 125Debug.Assert(Equals(other));
Compiler\DependencyAnalysis\GenericVirtualMethodImplNode.cs (3)
22Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 23Debug.Assert(method.HasInstantiation); 27Debug.Assert(method.IsVirtual || (method.Signature.IsStatic && !method.IsAbstract));
Compiler\DependencyAnalysis\GenericVirtualMethodTableNode.cs (3)
48Debug.Assert(!callingMethod.OwningType.IsInterface); 62Debug.Assert(!callingMethod.OwningType.IsInterface); 102Debug.Assert(!gvmEntry.Key.OwningType.IsInterface);
Compiler\DependencyAnalysis\ILScanNodeFactory.cs (2)
6using Debug = System.Diagnostics.Debug; 47Debug.Assert(!method.Signature.IsStatic);
Compiler\DependencyAnalysis\InterfaceDispatchMapNode.cs (8)
23Debug.Assert(!type.IsArrayTypeWithoutGenericInterfaces()); 24Debug.Assert(MightHaveInterfaceDispatchMap(type, factory)); 25Debug.Assert(type.ConvertToCanonForm(CanonicalFormKind.Specific) == type); 104Debug.Assert(declMethod.IsVirtual); 148Debug.Assert(declTypeRuntimeInterfaces.Length == declTypeDefinitionRuntimeInterfaces.Length); 165Debug.Assert(interfaceType.IsInterface); 267Debug.Assert(providingInterfaceDefinitionType != null); 276Debug.Assert(indexOfInterface >= 0);
Compiler\DependencyAnalysis\InterfaceGenericVirtualMethodTableNode.cs (7)
50Debug.Assert(callingMethod.OwningType.IsInterface); 83Debug.Assert(callingMethod.OwningType.IsInterface); 116Debug.Assert(numIfacesAdded > 0); 147Debug.Assert(gvmEntry.Key.OwningType.IsInterface); 173Debug.Assert(impl is DefaultInterfaceMethodResolution); 187Debug.Assert(_interfaceImpls.ContainsKey(impl)); 207Debug.Assert(((uint)ifaceId) < implementationType.RuntimeInterfaces.Length);
Compiler\DependencyAnalysis\InterfaceUseNode.cs (3)
10using Debug = System.Diagnostics.Debug; 25Debug.Assert(type.IsTypeDefinition); 26Debug.Assert(type.IsInterface);
Compiler\DependencyAnalysis\ManagedDataDescriptorNode.cs (1)
83Debug.Assert(builder.CountBytes == headerSize);
Compiler\DependencyAnalysis\MetadataEETypeNode.cs (1)
15Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any));
Compiler\DependencyAnalysis\MethodAssociatedDataNode.cs (3)
30Debug.Assert(!methodNode.Method.IsAbstract); 31Debug.Assert(methodNode.Method.GetCanonMethodTarget(CanonicalFormKind.Specific) == methodNode.Method); 66Debug.Assert(MethodHasAssociatedData(_methodNode));
Compiler\DependencyAnalysis\MethodExceptionHandlingInfoNode.cs (1)
21Debug.Assert(data.DefinedSymbols == null || data.DefinedSymbols.Length == 0);
Compiler\DependencyAnalysis\MethodMetadataNode.cs (4)
14using Debug = System.Diagnostics.Debug; 36Debug.Assert(method.IsTypicalMethodDefinition); 142Debug.Assert(!factory.MetadataManager.IsReflectionBlocked(_method)); 143Debug.Assert(factory.MetadataManager.CanGenerateMetadata(_method));
Compiler\DependencyAnalysis\ModuleMetadataNode.cs (2)
10using Debug = System.Diagnostics.Debug; 27Debug.Assert(module is IAssemblyDesc, "Multi-module assemblies?");
Compiler\DependencyAnalysis\NativeLayoutVertexNode.cs (46)
39Debug.Assert(Marked); 87Debug.Assert(SavedVertex == null || ReferenceEquals(SavedVertex, value)); 163Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 171Debug.Assert(_instantiationArgsSig == null || (_instantiationArgsSig != null && _method.Instantiation.Length == _instantiationArgsSig.Length)); 284Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 295Debug.Assert(_signature.Length == _parametersSig.Length); 337Debug.Assert(type.IsDefType); 361Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 386Debug.Fail("UNREACHABLE"); 405Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 422Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 433Debug.Fail("UNREACHABLE"); 445Debug.Assert(type.HasInstantiation && !type.IsGenericDefinition); 465Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 480Debug.Assert(!type.IsRuntimeDeterminedSubtype); 481Debug.Assert(!type.HasInstantiation || type.IsGenericDefinition); 497Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 527Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 644Debug.Assert(method.HasInstantiation); 666Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 674Debug.Assert(NeedsEntrypoint(_method)); 709Debug.Assert(nodeFactory.LazyGenericsPolicy.UsesLazyGenerics(owningMethod)); 710Debug.Assert(owningMethod.IsCanonicalMethod(CanonicalFormKind.Any)); 711Debug.Assert(owningMethod.HasInstantiation); 716Debug.Assert(nodeFactory.LazyGenericsPolicy.UsesLazyGenerics(owningType)); 717Debug.Assert(owningType.IsCanonicalSubtype(CanonicalFormKind.Any)); 727Debug.Assert(owningMethod.HasInstantiation); 765Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 770Debug.Assert(associatedLayout.Marked); 809Debug.Assert(method.HasInstantiation); 810Debug.Assert(!method.IsGenericMethodDefinition); 811Debug.Assert(method.IsCanonicalMethod(CanonicalFormKind.Any)); 812Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method, "Assert that the canonical method passed in is in standard canonical form"); 849Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 886Debug.Assert(type.IsCanonicalSubtype(CanonicalFormKind.Any)); 887Debug.Assert(type.ConvertToCanonForm(CanonicalFormKind.Specific) == type, "Assert that the canonical type passed in is in standard canonical form"); 897Debug.Assert(GenericTypesTemplateMap.IsArrayTypeEligibleForTemplate(type)); 899Debug.Assert(defType.Instantiation.Length == 1); 1007Debug.Assert(Marked, "WriteVertex should only happen for marked vertices"); 1288Debug.Assert(method.HasInstantiation); 1331Debug.Assert(method.HasInstantiation); 1371Debug.Assert(field.OwningType.IsRuntimeDeterminedSubtype); 1465Debug.Assert(_constrainedMethod.OwningType.IsInterface); 1466Debug.Assert(!_constrainedMethod.HasInstantiation || !directCall); 1531Debug.Assert(SignatureKind is FixupSignatureKind.GenericConstrainedMethod); 1537Debug.Assert(SignatureKind is FixupSignatureKind.NonGenericStaticConstrainedMethod or FixupSignatureKind.NonGenericInstanceConstrainedMethod);
Compiler\DependencyAnalysis\NodeFactory.cs (34)
197Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); 228Debug.Assert(gcStaticsNode is GCStaticsNode); 423Debug.Assert(method.OwningType.IsGenericDefinition || !VTable(method.OwningType).HasKnownVirtualMethodUse); 520Debug.Assert(method.IsStaticConstructor); 521Debug.Assert(PreinitializationManager.HasEagerStaticConstructor((MetadataType)method.OwningType)); 551Debug.Assert(CompilationModuleGroup.ContainsTypeDictionary(type)); 552Debug.Assert(!this.LazyGenericsPolicy.UsesLazyGenerics(type)); 648Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); 673Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); 674Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); 696Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); 697Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); 698Debug.Assert(!type.IsGenericDefinition); 757Debug.Assert(!TypeCannotHaveEEType(type)); 783Debug.Assert(type is not AsyncContinuationType); 785Debug.Assert(!TypeCannotHaveEEType(type)); 810Debug.Assert(!TypeCannotHaveEEType(type)); 829Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); 837Debug.Assert(!TypeCannotHaveEEType(type)); 845Debug.Assert(!TypeCannotHaveEEType(type)); 864Debug.Assert(_compilationModuleGroup.ContainsType(type)); 1118Debug.Assert(!unboxingStub); 1128Debug.Assert(!unboxingStub); 1390Debug.Assert(!_factory.VTable(key.OwningType).HasKnownVirtualMethodUse); 1445Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1455Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1465Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1475Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1485Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1495Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1505Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1521Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1531Debug.Assert(MetadataManager is UsageBasedMetadataManager); 1823Debug.Assert(ownerType.HasStaticConstructor);
Compiler\DependencyAnalysis\NonGCStaticsNode.cs (7)
10using Debug = System.Diagnostics.Debug; 27Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Specific)); 28Debug.Assert(!type.IsGenericDefinition); 200Debug.Assert(classConstructorContextStorageSize >= GetClassConstructorContextSize(_type.Context.Target)); 236Debug.Assert(padding >= 0); 242Debug.Assert(builder.CountBytes - currentOffset == field.FieldType.GetElementSize().AsInt); 246Debug.Assert(pad >= 0);
Compiler\DependencyAnalysis\NotReadOnlyFieldNode.cs (2)
10using Debug = System.Diagnostics.Debug; 23Debug.Assert(!field.OwningType.IsCanonicalSubtype(CanonicalFormKind.Any)
Compiler\DependencyAnalysis\PInvokeMethodFixupNode.cs (2)
83Debug.Assert((charsetFlags & MethodFixupCellFlagsConstants.CharSetMask) == charsetFlags); 93Debug.Assert((objcFunctionFlags & MethodFixupCellFlagsConstants.ObjectiveCMessageSendFunctionMask) == objcFunctionFlags);
Compiler\DependencyAnalysis\PInvokeModuleFixupNode.cs (2)
10using Debug = System.Diagnostics.Debug; 63Debug.Assert((dllImportSearchPath & InteropDataConstants.HasDllImportSearchPath) == 0);
Compiler\DependencyAnalysis\ProxyTypeMapNode.cs (1)
75Debug.Assert(valueNode.Marked);
Compiler\DependencyAnalysis\ProxyTypeMapRequestNode.cs (1)
8using Debug = System.Diagnostics.Debug;
Compiler\DependencyAnalysis\ReadyToRunGenericHelperNode.cs (4)
36Debug.Assert(factory.MarkingComplete); 42Debug.Assert( 64Debug.Assert(factory.GenericLookup.Type((TypeDesc)target) != factory.GenericLookup.UnwrapNullableType((TypeDesc)target)); 263Debug.Assert(templateLayout != null);
Compiler\DependencyAnalysis\ReadyToRunHeaderNode.cs (1)
9using Debug = System.Diagnostics.Debug;
Compiler\DependencyAnalysis\ReadyToRunHelperNode.cs (2)
10using Debug = System.Diagnostics.Debug; 79Debug.Assert(!method.IsCanonicalMethod(CanonicalFormKind.Any) ||
Compiler\DependencyAnalysis\ReflectedDelegateNode.cs (3)
10using Debug = System.Diagnostics.Debug; 23Debug.Assert(delegateType is null || delegateType.IsDelegate); 29Debug.Assert(delegateType is null
Compiler\DependencyAnalysis\ReflectedFieldNode.cs (3)
10using Debug = System.Diagnostics.Debug; 26Debug.Assert(!field.OwningType.IsCanonicalSubtype(CanonicalFormKind.Any) 35Debug.Assert(!factory.MetadataManager.IsReflectionBlocked(_field.GetTypicalFieldDefinition()));
Compiler\DependencyAnalysis\ReflectedMethodNode.cs (3)
10using Debug = System.Diagnostics.Debug; 27Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 35Debug.Assert(!factory.MetadataManager.IsReflectionBlocked(_method.GetTypicalMethodDefinition()));
Compiler\DependencyAnalysis\ReflectedTypeNode.cs (2)
10using Debug = System.Diagnostics.Debug; 28Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any)
Compiler\DependencyAnalysis\ReflectionInvokeMapNode.cs (4)
10using Debug = System.Diagnostics.Debug; 42Debug.Assert(factory.MetadataManager.IsReflectionInvokable(method)); 43Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 141Debug.Assert(method == method.GetCanonMethodTarget(CanonicalFormKind.Specific));
Compiler\DependencyAnalysis\ReflectionVirtualInvokeMapNode.cs (3)
74Debug.Assert(declaringMethodForSlot != null); 127Debug.Assert(!mappingEntry.Entity.IsAsyncVariant()); 190Debug.Assert(slot != -1);
Compiler\DependencyAnalysis\ResourceDataNode.cs (1)
128Debug.Assert(currentPos == indexData.NativeOffset);
Compiler\DependencyAnalysis\RuntimeFieldHandleNode.cs (2)
17Debug.Assert(!targetField.OwningType.IsCanonicalSubtype(CanonicalFormKind.Any)); 18Debug.Assert(!targetField.OwningType.IsRuntimeDeterminedSubtype);
Compiler\DependencyAnalysis\RuntimeMethodHandleNode.cs (3)
20Debug.Assert(!targetMethod.IsSharedByGenericInstantiations); 21Debug.Assert(!targetMethod.IsAsyncVariant()); 24Debug.Assert((targetMethod.HasInstantiation && targetMethod.IsMethodDefinition)
Compiler\DependencyAnalysis\ScannedMethodNode.cs (4)
13using Debug = System.Diagnostics.Debug; 33Debug.Assert(!method.IsAbstract); 34Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 81Debug.Assert(_dependencies != null);
Compiler\DependencyAnalysis\SealedVTableNode.cs (7)
25Debug.Assert(!type.IsArrayTypeWithoutGenericInterfaces()); 26Debug.Assert(!type.IsRuntimeDeterminedSubtype); 153Debug.Assert(declTypeRuntimeInterfaces.Length == declTypeDefinitionRuntimeInterfaces.Length); 305Debug.Assert(interfaceDefinition == null || method.GetTypicalMethodDefinition().OwningType == interfaceDefinition.GetTypeDefinition()); 330Debug.Assert(_interfaceDefinition == null || !method.IsCanonicalMethod(CanonicalFormKind.Any)); 339Debug.Assert(method.GetTypicalMethodDefinition().OwningType == interfaceDefinition.GetTypeDefinition()); 340Debug.Assert(interfaceDefinition.IsInterface);
Compiler\DependencyAnalysis\StackTraceLineNumbersNode.cs (3)
12using Debug = System.Diagnostics.Debug; 74Debug.Assert((factory.MetadataManager.StackTracePolicy.GetMethodVisibility(mapping.Method) & MethodStackTraceVisibilityFlags.HasLineNumbers) != 0); 106Debug.Assert(currentDocument == null || currentNativeOffset != sequencePoint.NativeOffset);
Compiler\DependencyAnalysis\StackTraceMethodMappingNode.cs (2)
11using Debug = System.Diagnostics.Debug; 74Debug.Assert(x.MethodInstantiationArgumentCollectionHandle == y.MethodInstantiationArgumentCollectionHandle);
Compiler\DependencyAnalysis\StaticsInfoHashtableNode.cs (1)
45Debug.Assert(metadataType.HasInstantiation && !metadataType.IsCanonicalSubtype(CanonicalFormKind.Any));
Compiler\DependencyAnalysis\StringAllocatorMethodNode.cs (2)
12using Debug = System.Diagnostics.Debug; 38Debug.Assert(constructorMethod.IsConstructor && constructorMethod.OwningType.IsString);
Compiler\DependencyAnalysis\Target_ARM\ARMReadyToRunGenericHelperNode.cs (7)
10using Debug = System.Diagnostics.Debug; 67Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 93Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 126Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 169Debug.Assert(contextRegister == encoder.TargetRegister.Arg2); 177Debug.Assert(target.Constructor.Method.Signature.Length == 3); 182Debug.Assert(target.Constructor.Method.Signature.Length == 2);
Compiler\DependencyAnalysis\Target_ARM\ARMReadyToRunHelperNode.cs (6)
97Debug.Assert(!target.TargetMethod.CanMethodBeInSealedVTable(factory)); 105Debug.Assert(slot != -1); 116Debug.Assert(target.Constructor.Method.Signature.Length == 3); 121Debug.Assert(target.Constructor.Method.Signature.Length == 2); 143Debug.Assert(!targetMethod.CanMethodBeInSealedVTable(factory)); 146Debug.Assert(slot != -1);
Compiler\DependencyAnalysis\Target_ARM64\ARM64ReadyToRunGenericHelperNode.cs (7)
10using Debug = System.Diagnostics.Debug; 66Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 92Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 124Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 167Debug.Assert(contextRegister == encoder.TargetRegister.Arg2); 175Debug.Assert(target.Constructor.Method.Signature.Length == 3); 180Debug.Assert(target.Constructor.Method.Signature.Length == 2);
Compiler\DependencyAnalysis\Target_ARM64\ARM64ReadyToRunHelperNode.cs (6)
112Debug.Assert(!target.TargetMethod.CanMethodBeInSealedVTable(factory)); 120Debug.Assert(slot != -1); 131Debug.Assert(target.Constructor.Method.Signature.Length == 3); 136Debug.Assert(target.Constructor.Method.Signature.Length == 2); 158Debug.Assert(!targetMethod.CanMethodBeInSealedVTable(factory)); 161Debug.Assert(slot != -1);
Compiler\DependencyAnalysis\Target_LoongArch64\LoongArch64ReadyToRunGenericHelperNode.cs (7)
10using Debug = System.Diagnostics.Debug; 66Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 93Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 126Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 169Debug.Assert(contextRegister == encoder.TargetRegister.Arg2); 177Debug.Assert(target.Constructor.Method.Signature.Length == 3); 182Debug.Assert(target.Constructor.Method.Signature.Length == 2);
Compiler\DependencyAnalysis\Target_LoongArch64\LoongArch64ReadyToRunHelperNode.cs (6)
104Debug.Assert(!target.TargetMethod.CanMethodBeInSealedVTable(factory)); 112Debug.Assert(slot != -1); 123Debug.Assert(target.Constructor.Method.Signature.Length == 3); 128Debug.Assert(target.Constructor.Method.Signature.Length == 2); 150Debug.Assert(!targetMethod.CanMethodBeInSealedVTable(factory)); 153Debug.Assert(slot != -1);
Compiler\DependencyAnalysis\Target_RiscV64\RiscV64ReadyToRunGenericHelperNode.cs (7)
10using Debug = System.Diagnostics.Debug; 65Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 91Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 123Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 166Debug.Assert(contextRegister == encoder.TargetRegister.Arg2); 174Debug.Assert(target.Constructor.Method.Signature.Length == 3); 179Debug.Assert(target.Constructor.Method.Signature.Length == 2);
Compiler\DependencyAnalysis\Target_RiscV64\RiscV64ReadyToRunHelperNode.cs (6)
102Debug.Assert(!target.TargetMethod.CanMethodBeInSealedVTable(factory)); 110Debug.Assert(slot != -1); 121Debug.Assert(target.Constructor.Method.Signature.Length == 3); 126Debug.Assert(target.Constructor.Method.Signature.Length == 2); 148Debug.Assert(!targetMethod.CanMethodBeInSealedVTable(factory)); 151Debug.Assert(slot != -1);
Compiler\DependencyAnalysis\Target_X64\X64ReadyToRunGenericHelperNode.cs (7)
10using Debug = System.Diagnostics.Debug; 68Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 96Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 131Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); 177Debug.Assert(contextRegister == encoder.TargetRegister.Arg2); 185Debug.Assert(target.Constructor.Method.Signature.Length == 3); 190Debug.Assert(target.Constructor.Method.Signature.Length == 2);
Compiler\DependencyAnalysis\Target_X64\X64ReadyToRunHelperNode.cs (6)
116Debug.Assert(!target.TargetMethod.CanMethodBeInSealedVTable(factory)); 125Debug.Assert(slot != -1); 136Debug.Assert(target.Constructor.Method.Signature.Length == 3); 141Debug.Assert(target.Constructor.Method.Signature.Length == 2); 164Debug.Assert(!targetMethod.CanMethodBeInSealedVTable(factory)); 167Debug.Assert(slot != -1);
Compiler\DependencyAnalysis\Target_X86\X86ReadyToRunGenericHelperNode.cs (3)
10using Debug = System.Diagnostics.Debug; 174Debug.Assert(target.Constructor.Method.Signature.Length == 3); 183Debug.Assert(target.Constructor.Method.Signature.Length == 2);
Compiler\DependencyAnalysis\Target_X86\X86ReadyToRunHelperNode.cs (6)
120Debug.Assert(!target.TargetMethod.CanMethodBeInSealedVTable(factory)); 129Debug.Assert(slot != -1); 141Debug.Assert(target.Constructor.Method.Signature.Length == 3); 149Debug.Assert(target.Constructor.Method.Signature.Length == 2); 173Debug.Assert(!targetMethod.CanMethodBeInSealedVTable(factory)); 176Debug.Assert(slot != -1);
Compiler\DependencyAnalysis\TentativeInstanceMethodNode.cs (3)
7using Debug = System.Diagnostics.Debug; 27Debug.Assert(!methodNode.Method.Signature.IsStatic); 28Debug.Assert(!methodNode.Method.OwningType.IsValueType);
Compiler\DependencyAnalysis\TentativeMethodNode.cs (2)
12using Debug = System.Diagnostics.Debug; 82Debug.Assert(!_methodNode.RepresentsIndirectionCell);
Compiler\DependencyAnalysis\ThreadStaticsNode.cs (4)
23Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Specific)); 24Debug.Assert(!type.IsGenericDefinition); 110Debug.Assert(_type != null); 143Debug.Assert(other != null);
Compiler\DependencyAnalysis\TypeGVMEntriesNode.cs (2)
48Debug.Assert(associatedType.IsTypeDefinition); 49Debug.Assert(!associatedType.IsInterface);
Compiler\DependencyAnalysis\TypeMetadataNode.cs (5)
10using Debug = System.Diagnostics.Debug; 30Debug.Assert(type.IsTypeDefinition); 138Debug.Assert(type.IsDefType); 185Debug.Assert(!factory.MetadataManager.IsReflectionBlocked(_type)); 186Debug.Assert(factory.MetadataManager.CanGenerateMetadata(_type));
Compiler\DependencyAnalysis\TypeThreadStaticIndexNode.cs (1)
75Debug.Assert(_inlinedThreadStatics.IndexFromBeginningOfArray == 0);
Compiler\DependencyAnalysis\UnboxingStubNode.cs (3)
7using Debug = System.Diagnostics.Debug; 28Debug.Assert(target.GetCanonMethodTarget(CanonicalFormKind.Specific) == target); 29Debug.Assert(target.OwningType.IsValueType);
Compiler\DependencyAnalysis\VariantInterfaceMethodUseNode.cs (10)
10using Debug = System.Diagnostics.Debug; 28Debug.Assert(!decl.IsRuntimeDeterminedExactMethod); 29Debug.Assert(decl.IsVirtual); 30Debug.Assert(decl.OwningType.IsInterface); 35Debug.Assert(MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(decl) == decl); 38Debug.Assert(!decl.HasInstantiation); 41Debug.Assert(decl.IsTypicalMethodDefinition); 48Debug.Assert(implementedInterface.IsInterface); 49Debug.Assert(!implementedInterface.IsGenericDefinition); 97Debug.Assert(calledMethod.IsVirtual);
Compiler\DependencyAnalysis\VTableSliceNode.cs (10)
10using Debug = System.Diagnostics.Debug; 24Debug.Assert(!type.IsArray, "Wanted to call GetClosestDefType?"); 25Debug.Assert(!type.IsGenericDefinition); 125Debug.Assert(Array.IndexOf(_slots, slot) >= 0); 178Debug.Assert(Array.IndexOf(_slots, slot) >= 0); 197Debug.Assert(!virtualMethod.HasInstantiation); 198Debug.Assert(virtualMethod.IsVirtual); 199Debug.Assert(virtualMethod.OwningType == _type); 200Debug.Assert(Array.IndexOf(_slots, virtualMethod) >= 0); 202Debug.Assert(!_isLocked);
Compiler\DescriptorMarker.cs (2)
142Debug.Fail(member.GetType().ToString()); 178Debug.Assert(ShouldProcessElement(nav));
Compiler\GenericDictionaryLookup.cs (7)
9using Debug = System.Diagnostics.Debug; 41Debug.Assert(_offset1 == UseHelperOffset); 53Debug.Assert(_offset1 == UseHelperOffset); 84Debug.Assert(!UseHelper && !UseNull); 93Debug.Assert(!UseHelper && !UseNull); 94Debug.Assert(index < NumberOfIndirections); 118Debug.Assert(offset1 != UseHelperOffset);
Compiler\HardwareIntrinsicHelpers.Aot.cs (5)
11using Debug = System.Diagnostics.Debug; 28Debug.Assert(IsIsSupportedMethod(method)); 29Debug.Assert(isSupportedField.IsStatic && isSupportedField.FieldType.IsWellKnownType(WellKnownType.Int32)); 45Debug.Fail("Unsupported Architecture"); 97Debug.Fail("Unsupported Architecture");
Compiler\ILScanner.cs (13)
19using Debug = System.Diagnostics.Debug; 199Debug.Assert(mangledName != null || methodDesc != null); 446Debug.Assert(methodOrType is MethodDesc); 678Debug.Assert(!implType.IsInterface); 753Debug.Assert(type.NormalizeInstantiation() == type); 754Debug.Assert(ConstructedEETypeNode.CreationAllowed(type)); 760Debug.Assert(type.NormalizeInstantiation() == type); 761Debug.Assert(ConstructedEETypeNode.CreationAllowed(type)); 767Debug.Assert(type.NormalizeInstantiation() == type); 768Debug.Assert(ConstructedEETypeNode.CreationAllowed(type)); 774Debug.Assert(type.IsGenericDefinition); 920Debug.Assert(t.ThreadGcStaticFieldAlignment.AsInt <= factory.Target.PointerSize); 985Debug.Assert(type.IsCanonicalSubtype(CanonicalFormKind.Any));
Compiler\LibraryInitializers.cs (2)
9using Debug = System.Diagnostics.Debug; 46Debug.Assert(_libraryInitializerMethods == null);
Compiler\Logger.cs (1)
272Debug.Assert(owningMethod != originMember);
Compiler\Logging\DocumentationSignatureGenerator.PartVisitor.cs (1)
133Debug.Assert(genericParameter.Kind == GenericParameterKind.Type);
Compiler\Logging\DocumentationSignatureParser.cs (14)
60Debug.Assert(results.Count <= 1); 98Debug.Assert(results.Count == 0); 168Debug.Assert(results.Count <= 1); 173Debug.Assert(result is TypeDesc); 284Debug.Assert(results.Count == 0); 294Debug.Assert(results.Count == 0); 317Debug.Assert(bounds > 0); 352Debug.Assert(PeekNextChar(id, index) == '`'); 355Debug.Assert( 396Debug.Assert(results.Count == 0); 424Debug.Assert(typeArguments != null && typeArguments.Count != 0); 529Debug.Assert(module != null); 560Debug.Assert(nestedType.Namespace.IsEmpty); 735Debug.Assert(typeParameterContext != null);
Compiler\Logging\MessageContainer.cs (2)
11using Debug = System.Diagnostics.Debug; 185Debug.Assert(declaringAssembly != null);
Compiler\Logging\MessageOrigin.cs (1)
99Debug.Assert(methodBody.OwningMethod == MemberDefinition);
Compiler\Logging\NativeAotFatalErrorException.cs (4)
23Debug.Assert(message.Category == MessageCategory.Error, $"'{nameof(NativeAotFatalErrorException)}' ought to be used for errors only"); 24Debug.Assert(message.Code != null && message.Code.Value != 0, $"'{nameof(NativeAotFatalErrorException)}' must have a code that indicates a failure"); 33Debug.Assert(message.Category == MessageCategory.Error, $"'{nameof(NativeAotFatalErrorException)}' ought to be used for errors only"); 34Debug.Assert(message.Code != null && message.Code.Value != 0, $"'{nameof(NativeAotFatalErrorException)}' must have a code that indicates failure");
Compiler\Logging\UnconditionalSuppressMessageAttributeState.cs (5)
83Debug.Assert(owningMethod != provider); 127Debug.Assert(property.OwningType == method.OwningType); 133Debug.Assert(@event.OwningType == method.OwningType); 232Debug.Assert(provider is not ModuleDesc); 327Debug.Fail("Trying to operate with unsupported TypeSystemEntity " + entity.GetType().ToString());
Compiler\MetadataBlockingPolicy.cs (4)
6using Debug = System.Diagnostics.Debug; 36Debug.Assert(type.IsTypeDefinition); 42Debug.Assert(method.IsTypicalMethodDefinition); 48Debug.Assert(field.IsTypicalFieldDefinition);
Compiler\MetadataManager.cs (15)
15using Debug = System.Diagnostics.Debug; 131Debug.Assert(comparer.Compare(_dehydratableData[i - 1].Node, _dehydratableData[i].Node) < 0); 146Debug.Assert(result <= ReadyToRunSectionType.ReadonlyBlobRegionEnd); 426Debug.Assert(!method.IsAsyncVariant()); 680Debug.Assert(IsReflectionInvokable(method)); 863Debug.Assert(!factory.CompilationModuleGroup.IsSingleFileCompilation); 868Debug.Assert(record != null); 869Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 874Debug.Assert(!method.IsGenericMethodDefinition && !method.OwningType.IsGenericDefinition); 875Debug.Assert(!IsReflectionBlocked(method)); 932Debug.Assert((stackTraceRecord.Flags & StackTraceRecordFlags.IsHidden) != 0); 1140Debug.Assert(type.IsTypeDefinition); 1194Debug.Assert(type.IsDefType); 1270Debug.Assert(method.IsTypicalMethodDefinition); 1276Debug.Assert(field.IsTypicalFieldDefinition);
Compiler\MstatObjectDumper.cs (3)
20using Debug = System.Diagnostics.Debug; 123Debug.Assert(_frozenObjects.Offset == 0); 146Debug.Assert(_manifestResources.Offset == 0);
Compiler\MultiFileCompilationModuleGroup.cs (1)
55Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method);
Compiler\ObjectWriter\CodeView\CodeViewSymbolsBuilder.cs (1)
216Debug.Fail("Unknown variable location type");
Compiler\ObjectWriter\CodeView\CodeViewTypesBuilder.cs (12)
85Debug.Assert(type.IsPrimitive, "it is not a primitive type"); 203Debug.Assert(classDescriptor.IsStruct == 0); 206Debug.Assert(memberCount <= ushort.MaxValue); 207Debug.Assert(arrayDescriptor.Size <= ushort.MaxValue); 243Debug.Assert(typeRecords.Length <= ushort.MaxValue); 328Debug.Assert(memberCount <= ushort.MaxValue); 359Debug.Assert(memberDescriptor.NumberOfArguments <= ushort.MaxValue); 415Debug.Assert(length <= ushort.MaxValue); 500Debug.Assert(_leafRecordType == LF_FIELDLIST || _leafRecordType == LF_METHODLIST); 508Debug.Assert(_leafRecordType == LF_FIELDLIST || _leafRecordType == LF_METHODLIST); 509Debug.Assert(_lastListMemberStart > 0); 519Debug.Assert(_lastListMemberStart > sizeof(ushort));
Compiler\ObjectWriter\Dwarf\DwarfBuilder.cs (1)
267Debug.Assert(type.IsPrimitive, "it is not a primitive type");
Compiler\ObjectWriter\Dwarf\DwarfFde.cs (1)
72Debug.Assert(diff <= 0xFF);
Compiler\ObjectWriter\Dwarf\DwarfInfo.cs (1)
546Debug.Assert(loc.LocationType != VarLocType.VLT_FIXED_VA);
Compiler\ObjectWriter\Dwarf\DwarfInfoWriter.cs (7)
104Debug.Assert(stringsOffset < uint.MaxValue); 113Debug.Assert(stringsOffset < uint.MaxValue); 119Debug.Assert(offset < uint.MaxValue); 142Debug.Assert(offset >= 0); 148Debug.Assert(offset < uint.MaxValue); 168Debug.Assert(offset < uint.MaxValue); 189Debug.Assert(offset < uint.MaxValue);
Compiler\ObjectWriter\Dwarf\DwarfLineSequenceWriter.cs (1)
31Debug.Assert(DwarfLineProgramTableWriter.MaximumOperationsPerInstruction == 1);
Compiler\ObjectWriter\Eabi\EabiUnwindConverter.cs (7)
35Debug.Assert(blobData.Length % 8 == 0); 81Debug.Assert(popOffset == 0); 89Debug.Assert(dwarfReg != 13); // SP 90Debug.Assert(dwarfReg < 15); 98Debug.Assert(cfiOffset == popOffset); 112Debug.Fail("Unknown register"); 162Debug.Assert((pendingSpAdjustment & 3) == 0);
Compiler\ObjectWriter\ElfObjectWriter.Aot.cs (1)
125Debug.Assert(armUnwindInfo.Length <= 1024);
Compiler\ObjectWriter\MachObjectWriter.Aot.cs (2)
125Debug.Assert(blobData.Length % 8 == 0); 183Debug.Assert(cfaRegister == spReg);
Compiler\ObjectWriter\UnixObjectWriter.Aot.cs (6)
14using Debug = System.Diagnostics.Debug; 125Debug.Assert(IsCacheable(x)); 126Debug.Assert(IsCacheable(y)); 139Debug.Assert(IsCacheable(obj)); 155Debug.Assert(IsCacheable(nodeWithCodeInfo)); 161Debug.Assert(IsCacheable(nodeWithCodeInfo));
Compiler\PreinitializationManager.cs (3)
47Debug.Assert(type is MetadataType); 68Debug.Assert(type is MetadataType); 168Debug.Assert(info.IsPreinitialized ||
Compiler\ReachabilityInstrumentationProvider.cs (1)
265Debug.Assert(this == other);
Compiler\RootingServiceProvider.cs (5)
10using Debug = System.Diagnostics.Debug; 82Debug.Assert(o is IDependencyNode<NodeFactory>); 88Debug.Assert(!type.IsGenericDefinition); 103Debug.Assert(!type.IsGenericDefinition); 118Debug.Assert(!type.IsGenericDefinition);
Compiler\SingleFileCompilationModuleGroup.cs (1)
29Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method);
Compiler\SingleMethodCompilationModuleGroup.cs (1)
38Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method);
Compiler\SubstitutedILProvider.cs (6)
17using Debug = System.Diagnostics.Debug; 514Debug.Assert((flags[srcPos] & OpcodeFlags.InstructionStart) != 0); 515Debug.Assert((flags[srcPos] & OpcodeFlags.VisibleBasicBlockStart) != 0); 649Debug.Assert(newBody[offset] == (byte)ILOpcode.call); 767Debug.Assert(stack.Count == 1); 958Debug.Assert(argIndex != 0);
Compiler\SubstitutionProvider.cs (2)
17using Debug = System.Diagnostics.Debug; 137Debug.Assert(method.Name.StartsWith("get_"u8));
Compiler\TypePreinit.cs (45)
70Debug.Assert(type.HasStaticConstructor); 71Debug.Assert(!type.IsGenericDefinition); 72Debug.Assert(!type.IsRuntimeDeterminedSubtype); 467Debug.Assert(opcode == ILOpcode.ldsflda); 824Debug.Assert(popped.Value is ByRefValueBase); 1281Debug.Assert(normalizedOpcode == ILOpcode.br_s); 1323Debug.Assert(ehRegion.Kind != ILExceptionRegionKind.Finally); 1902Debug.Assert(locationType.IsValueType || locationType.IsPointer || locationType.IsFunctionPointer); 2346Debug.Assert(type.IsValueType || type.IsPointer || type.IsFunctionPointer); 2449Debug.Assert(IsCompatible(type, out _)); 2450Debug.Assert(IsComInterfaceEntryType(entryType)); 2451Debug.Assert(((MetadataType)type).InstanceFieldSize.AsInt % ((MetadataType)entryType).InstanceFieldSize.AsInt == 0); 2507Debug.Assert(_entryType.GetField("IID"u8).Offset.AsInt == 0); 2510Debug.Assert(_entryType.GetField("Vtable"u8).Offset.AsInt == _guidBytes[i].Length); 2517Debug.Assert(targetField.IsStatic && !targetField.HasGCStaticBase && !targetField.IsThreadStatic && !targetField.HasRva); 2631Debug.Assert(IsCompatible(type)); 2632Debug.Assert(type.InstanceFieldSize.AsInt % type.Context.Target.PointerSize == 0); 2779Debug.Assert(field.Offset.AsInt % _parent._type.Context.Target.PointerSize == 0 && field.FieldType.IsFunctionPointer); 2938Debug.Assert(index <= bytes.Length); 2939Debug.Assert(length <= bytes.Length - index); 3020Debug.Assert(field.Name == "_reference"u8); 3042Debug.Assert(field.Name == "_reference"u8); 3212Debug.Assert(type.HasStaticConstructor); 3299Debug.Assert(_methodPointed.Signature.IsStatic == (_target == null)); 3303Debug.Assert(!creationInfo.TargetNeedsVTableLookup); 3307Debug.Assert(!node.RepresentsIndirectionCell); // Shouldn't have allowed this 3312Debug.Assert(creationInfo.Constructor.Method.Name == "InitializeOpenStaticThunk"u8); 3321Debug.Assert(creationInfo.Thunk != null); 3329Debug.Assert(creationInfo.Constructor.Method.Name == "InitializeClosedInstance"u8); 3394Debug.Assert(valueToStore.InstanceBytes.Length == _elementSize); 3422Debug.Assert(!node.RepresentsIndirectionCell); // Arrays are always local 3429Debug.Assert(pointerSize == 8 || pointerSize == 4); 3509Debug.Assert(lengthField.FieldType.IsWellKnownType(WellKnownType.Int32) 3512Debug.Assert(success); 3515Debug.Assert(firstCharField.FieldType.IsWellKnownType(WellKnownType.Char) 3606Debug.Assert(!node.RepresentsIndirectionCell); // Shouldn't have allowed preinitializing this 3652Debug.Assert(!field.IsStatic); 3653Debug.Assert(!field.FieldType.IsGCPointer); 3666Debug.Assert(!field.IsStatic); 3672Debug.Assert(value == null); 3704Debug.Assert(!field.IsStatic); 3705Debug.Assert(!field.FieldType.IsGCPointer); 3806Debug.Assert(IsPreinitialized); 3807Debug.Assert(field.OwningType == Type); 3808Debug.Assert(field.IsStatic && !field.HasRva && !field.IsThreadStatic && !field.IsLiteral);
Compiler\UnixNodeMangler.cs (1)
17Debug.Assert(type.IsValueType);
Compiler\UsageBasedInteropStubManager.cs (2)
11using Debug = System.Diagnostics.Debug; 57Debug.Assert(method.HasInstantiation);
Compiler\UsageBasedMetadataManager.cs (5)
25using Debug = System.Diagnostics.Debug; 165Debug.Assert((GetMetadataCategory(field) & MetadataCategory.RuntimeMapping) != 0); 634Debug.Assert(decl.IsVirtual 655Debug.Assert(methodIL != null || method.IsAbstract || method.IsPInvoke || method.IsInternalCall); 946Debug.Assert(userMethod != methodILDefinition.OwningMethod);
Compiler\UserDefinedTypeDescriptor.cs (9)
50Debug.Assert(type.IsValueType); 59Debug.Assert(type.IsDefType); 351Debug.Fail("Unhandled UserDefinedTypeDescriptor type: {type}"); 401Debug.Assert(type.IsEnum, "GetEnumTypeIndex was called with wrong type"); 403Debug.Assert(defType != null, "GetEnumTypeIndex was called with non def type"); 433Debug.Assert(type.IsArray, "GetArrayTypeIndex was called with wrong type"); 502Debug.Assert(false); 556Debug.Assert(defType != null, "GetClassTypeIndex was called with non def type"); 846Debug.Assert(type.IsPrimitive, "it is not a primitive type");
Compiler\VectorOfTFieldLayoutAlgorithm.cs (2)
8using Debug = System.Diagnostics.Debug; 48Debug.Assert(targetDetails.MaximumSimdVectorLength == SimdVectorLength.None);
Compiler\VirtualMethodCallHelper.cs (3)
15Debug.Assert(method.GetTypicalMethodDefinition().OwningType == interfaceOnDefinition.GetTypeDefinition()); 44Debug.Assert(!implType.IsArrayTypeWithoutGenericInterfaces()); 183Debug.Assert(type.HasGenericDictionarySlot());
Compiler\WindowsNodeMangler.cs (2)
31Debug.Assert(type.IsValueType); 107Debug.Assert(method is Internal.TypeSystem.Ecma.EcmaMethod ecmaMethod && (ecmaMethod.GetRuntimeImportName() != null || ecmaMethod.GetRuntimeExportName() != null));
IL\ILImporter.Scanner.cs (17)
13using Debug = System.Diagnostics.Debug; 228Debug.Assert(lookup.UseHelper); 236Debug.Assert(_canonMethod.RequiresInstArg() || _canonMethod.AcquiresInstMethodTableFromThis()); 598Debug.Assert(false); break; 755Debug.Assert(!methodAfterConstraintResolution.OwningType.IsInterface 765Debug.Assert(method.OwningType.IsInterface); 798Debug.Assert(targetMethod.IsVirtual && targetMethod.OwningType.IsInterface); 843Debug.Assert(targetMethod.OwningType.IsValueType || targetMethod.Signature.IsStatic); 856Debug.Assert(targetOfLookup.GetCanonMethodTarget(CanonicalFormKind.Specific) == targetMethod.GetCanonMethodTarget(CanonicalFormKind.Specific)); 919Debug.Assert(targetMethod.AcquiresInstMethodTableFromThis()); 932Debug.Assert(!forceUseRuntimeLookup); 974Debug.Assert(targetMethod.OwningType.IsInterface && targetMethod.IsVirtual && _constrained != null); 983Debug.Assert(targetMethod.OwningType.IsInterface && targetMethod.IsVirtual && _constrained != null); 1064Debug.Assert(!_asyncDependenciesReported); 1265Debug.Assert(opCode == ILOpcode.unbox_any); 1336Debug.Assert(_methodIL.OwningMethod.Name == "GetCanonType"u8); 1551Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any));
IL\Stubs\PInvokeILProvider.cs (3)
7using Debug = System.Diagnostics.Debug; 43Debug.Assert(directCall); 44Debug.Assert(externName != null);
IL\Stubs\StartupCode\NativeLibraryStartupMethod.Sorting.cs (2)
6using Debug = System.Diagnostics.Debug; 17Debug.Assert(this == other);
IL\Stubs\StartupCode\StartupCodeMainMethod.cs (2)
9using Debug = System.Diagnostics.Debug; 147Debug.Assert((setLatchedExitCode != null) == (shutdown != null));
src\runtime\src\coreclr\tools\Common\Compiler\AsyncContinuationType.cs (1)
59Debug.Assert(_continuationBaseType == ((AsyncContinuationType)other)._continuationBaseType);
src\runtime\src\coreclr\tools\Common\Compiler\AsyncMethodVariant.cs (6)
21Debug.Assert(wrappedMethod.Signature.ReturnsTaskOrValueTask()); 37Debug.Assert(signature.ReturnsTaskOrValueTask()); 89Debug.Assert(!asyncVariant.Signature.ReturnType.IsVoid); 181Debug.Assert(!method.IsAsyncVariant()); 187Debug.Assert(method.IsAsyncVariant()); 193Debug.Assert(method.IsReturnDroppingAsyncThunk());
src\runtime\src\coreclr\tools\Common\Compiler\AsyncMethodVariant.Mangling.cs (1)
7using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Compiler\CachingVirtualMethodAlgorithm.cs (1)
26Debug.Assert(type.IsTypeDefinition);
src\runtime\src\coreclr\tools\Common\Compiler\CompilerTypeSystemContext.Async.cs (7)
10using Debug = System.Diagnostics.Debug; 39Debug.Assert(originalMethod.Signature.ReturnsTaskOrValueTask()); 40Debug.Assert(resolvedMethod.Signature.ReturnsTaskOrValueTask()); 193Debug.Assert(taskReturningMethod.Signature.ReturnsTaskOrValueTask()); 212Debug.Assert(returnDroppingThunk.IsReturnDroppingAsyncThunk()); 243Debug.Assert(asyncVariantMethod.IsAsyncVariant()); 244Debug.Assert(!asyncVariantMethod.Signature.ReturnType.IsVoid);
src\runtime\src\coreclr\tools\Common\Compiler\CompilerTypeSystemContext.cs (6)
53Debug.Fail("CreateValueFromKey not supported"); 81Debug.Fail("CreateValueFromKey not supported"); 286Debug.Assert(!type.IsArray, "Wanted to call GetClosestMetadataType?"); 296Debug.Assert(_genericsMode == SharedGenericsMode.Disabled); 306Debug.Assert(_genericsMode == SharedGenericsMode.Disabled); 315Debug.Assert(_genericsMode == SharedGenericsMode.Disabled);
src\runtime\src\coreclr\tools\Common\Compiler\CompilerTypeSystemContext.Validation.cs (6)
9using Debug = System.Diagnostics.Debug; 104Debug.Assert(!OtherTypesToMarkAsSuccessfullyLoaded.Contains(type)); 146Debug.Assert(typeLoadCheckInProgressStackOffset != -1); 184Debug.Assert(EmptyList.Count == 0); 192Debug.Assert(typeLoadabilityCheck.OtherTypesToMarkAsSuccessfullyLoaded.Count == 0); 306Debug.Assert(type.IsDefType);
src\runtime\src\coreclr\tools\Common\Compiler\Dataflow\EcmaExtensions.cs (2)
14using Debug = System.Diagnostics.Debug; 52Debug.Assert(signature == null);
src\runtime\src\coreclr\tools\Common\Compiler\DecimalFieldLayoutAlgorithm.cs (6)
6using Debug = System.Diagnostics.Debug; 26Debug.Assert(IsDecimalFloatingPointType(defType)); 61Debug.Assert(!_fallbackAlgorithm.ComputeContainsGCPointers(type)); 67Debug.Assert(!_fallbackAlgorithm.ComputeContainsByRefs(type)); 73Debug.Assert(!_fallbackAlgorithm.ComputeIsUnsafeValueType(type)); 79Debug.Assert(_fallbackAlgorithm.ComputeValueTypeShapeCharacteristics(type) == ValueTypeShapeCharacteristics.None);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\CompilerComparer.cs (3)
25Debug.Assert(x.GetType() == y.GetType()); 30Debug.Assert(result != 0); 36Debug.Assert(x.GetType() != y.GetType());
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\GVMDependenciesNode.cs (4)
32Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 33Debug.Assert(method.HasInstantiation); 34Debug.Assert(method.IsVirtual); 35Debug.Assert(MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(method.GetMethodDefinition()) == method.GetMethodDefinition());
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\MethodReadOnlyDataNode.cs (1)
43Debug.Assert(_data == null);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\MethodReadWriteDataNode.cs (1)
43Debug.Assert(_data == null);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\ObjectDataBuilder.cs (8)
9using Debug = System.Diagnostics.Debug; 120Debug.Assert(_target.PointerSize == 4); 133Debug.Assert(_target.PointerSize == 4); 209Debug.Assert(_numReservations > 0); 261Debug.Assert(node.Marked); 308Debug.Assert(delta == 0); 335Debug.Assert(_numReservations == 0); 355Debug.Assert((align == 2) || (align == 4) || (align == 8) || (align == 16));
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Relocation.cs (44)
160Debug.Assert(((uint)Opcode0 & 0xFBF0) == 0xF240); 161Debug.Assert(((uint)Opcode1 & 0xFBF0) == 0xF2C0); 174Debug.Assert(((uint)Opcode0 & 0xFBF0) == 0xF240); 175Debug.Assert(((uint)Opcode1 & 0xFBF0) == 0xF2C0); 182Debug.Assert((uint)GetThumb2Mov32(p) == imm32); 222Debug.Assert(FitsInThumb2BlRel24(imm24)); 226Debug.Assert((imm24 & 1/*THUMB_CODE*/) == 0); 243Debug.Assert(GetThumb2BlRel24(p) == imm24); 278Debug.Assert(FitsInRel21(imm21)); 282Debug.Assert((adrpInstr & 0x9F000000) == 0x90000000); 291Debug.Assert(GetArm64Rel21(pCode) == imm21); 321Debug.Assert(FitsInRel12(imm12)); 325Debug.Assert((addInstr & 0xFFC00000) == 0x91000000); 332Debug.Assert(GetArm64Rel12(pCode) == imm12); 343Debug.Assert(FitsInRel12(imm12)); 347Debug.Assert((addInstr & 0xFFC00000) == 0x91400000); 354Debug.Assert(GetArm64Rel12(pCode) == imm12); 380Debug.Assert(FitsInRel12(imm12)); 381Debug.Assert((imm12 & 7) == 0, "LDR offset must be 8-byte aligned"); 385Debug.Assert((ldrInstr & 0xFFC00000) == 0xF9400000); 397Debug.Assert(GetArm64Rel12Ldr(pCode) == imm12); 419Debug.Assert(FitsInArm64Rel28(imm28)); 421Debug.Assert((imm28 & 0x3) == 0); // the low two bits must be zero 427Debug.Assert((branchInstr & 0x7FFFFFFF) == 0x14000000); // Must be B or BL 434Debug.Assert(GetArm64Rel28(pCode) == imm28); 460Debug.Assert((int)imm == imm); 464Debug.Assert((pcInstr & 0xFE000000) == 0x1a000000); // Must be pcalau12i 480Debug.Assert(GetLoongArch64PC12(pCode) == imm); 500Debug.Assert((imm38 >= -0x2000000000L) && (imm38 < 0x2000000000L)); 502Debug.Assert((imm38 & 0x3) == 0); // the low two bits must be zero 506Debug.Assert(pcInstr == 0x1e000010); // Must be pcaddu18i t4, 0 526Debug.Assert(GetLoongArch64JIR(pCode) == imm38); 544Debug.Assert((auipc & OpcodeMask) == OpcodeAuipc); 546Debug.Assert(auipcRegDest != 0); 553Debug.Assert(opcode == OpcodeLoad || opcode == OpcodeStore || opcode == OpcodeLoadFp || opcode == OpcodeStoreFp || 555Debug.Assert(isStype == (opcode == OpcodeStore || opcode == OpcodeStoreFp)); 557Debug.Assert(auipcRegDest == addrReg); 581Debug.Assert((long)lo12 + (long)hi20 == offset); 600Debug.Assert(GetRiscV64AuipcCombo(pCode, isStype) == offset); 605Debug.Assert(target != null); 694Debug.Fail("Invalid RelocType: " + relocType); 783Debug.Assert((GetArm64Rel12((uint*)location) & 0xFF) == 0); 787Debug.Assert((GetArm64Rel21((uint*)location) & 0xFF) == 0); 819Debug.Fail("Invalid RelocType: " + relocType);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\ShadowConcreteMethodNode.cs (2)
11using Debug = System.Diagnostics.Debug; 24Debug.Assert(!method.IsSharedByGenericInstantiations);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\ShadowMethodNode.cs (5)
11using Debug = System.Diagnostics.Debug; 47Debug.Assert(!method.IsRuntimeDeterminedExactMethod); 48Debug.Assert(canonicalMethod.Method == method.GetCanonMethodTarget(CanonicalFormKind.Specific)); 49Debug.Assert(canonicalMethod.Method.IsSharedByGenericInstantiations); 99Debug.Assert(canonDep.OtherReasonNode is not INodeWithRuntimeDeterminedDependencies);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\ShadowNonConcreteMethodNode.cs (2)
11using Debug = System.Diagnostics.Debug; 24Debug.Assert(method.IsSharedByGenericInstantiations);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\SortableDependencyNode.cs (3)
185Debug.Assert(x.GetType() == y.GetType() || 192Debug.Assert(result != 0 || x == y); 198Debug.Assert(x.GetType() != y.GetType());
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_ARM\ARMEmitter.cs (18)
40Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 49Debug.Assert(IsValidReg(reg)); 60Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 69Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 78Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 100Debug.Assert(reg >= Register.R0 && (reg <= Register.R12 || reg == TargetRegister.LR)); 110Debug.Assert(IsValidReg(reg) && reg != TargetRegister.SP); 120Debug.Assert(IsValidReg(destination) && IsValidReg(source)); 136Debug.Assert(IsValidReg(destination) && IsValidReg(source)); 150Debug.Assert(IsValidReg(destination) && IsValidReg(source)); 170Debug.Assert(encode >= 8); 171Debug.Assert((imm8 & 0x80) > 0); 179Debug.Assert(offset >= -255 && offset <= 4095); 198Debug.Assert(destination >= Register.R0 && (destination <= Register.R12 || destination == TargetRegister.LR)); 217Debug.Assert(!symbol.RepresentsIndirectionCell); 229Debug.Assert(IsValidReg(destination)); 243Debug.Assert(immediate >= -256 && immediate <= 254); 255Debug.Assert(immediate >= -256 && immediate <= 254);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_ARM64\ARM64Emitter.cs (14)
29Debug.Assert((uint)regDst <= 0x1f); 36Debug.Assert((uint)regDst <= 0x1f); 55Debug.Assert((uint)regDst <= 0x1f); 63Debug.Assert((uint)regDst <= 0x1f); 64Debug.Assert((offset & 3) == 0); 73Debug.Assert((uint)regDst <= 0x1f); 74Debug.Assert((uint)regAddr <= 0x1f); 83Debug.Assert(offset % 8 == 0); 104Debug.Assert((uint)regDst <= 0x1f); 105Debug.Assert((uint)regAddr <= 0x1f); 113Debug.Assert((uint)regDst <= 0x1f); 114Debug.Assert((uint)regAddr <= 0x1f); 141Debug.Assert(immediate % 4 == 0); 155Debug.Assert(immediate % 4 == 0);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_LoongArch64\LoongArch64Emitter.cs (8)
29Debug.Assert((uint)regDst <= 0x1f); 30Debug.Assert(imm16 <= 0xfff); 53Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 60Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 67Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 74Debug.Assert((imm >= -2048) && (imm <= 2047)); 82Debug.Assert((imm >= 0) && (imm <= 0xfff)); 90Debug.Assert((offset >= -2048) && (offset <= 2047));
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_RiscV64\RiscV64Emitter.cs (8)
35Debug.Assert((offset >= -2048) && (offset <= 2047)); 56Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 63Debug.Assert((uint)regDst <= 0x1f); 64Debug.Assert((uint)regSrc <= 0x1f); 65Debug.Assert((offset >= -2048) && (offset <= 2047)); 72Debug.Assert((offset >= -2048) && (offset <= 2047)); 79Debug.Assert((offset >= -2048) && (offset <= 2047)); 86Debug.Assert((offset >= -2048) && (offset <= 2047));
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_Wasm\WasmTypes.cs (3)
162Debug.Assert(!result || FuncType.Equals(other.FuncType), 175Debug.Assert(result != 0 || FuncType.Equals(other.FuncType), 248Debug.Assert(totalSize == 1 + paramSize + returnSize);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_X64\X64Emitter.cs (3)
69Debug.Assert(addrMode.Size != AddrModeSize.Int8 && 236Debug.Assert(addrMode.BaseReg >= Register.RegDirect); 396Debug.Assert(addrMode.Size != 0);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_X86\X86Emitter.cs (4)
22Debug.Assert(addrMode.Size != AddrModeSize.Int8 && addrMode.Size != AddrModeSize.Int16); 28Debug.Assert(addrMode.Size != AddrModeSize.Int8 && addrMode.Size != AddrModeSize.Int16); 47Debug.Assert(addrMode.Size != AddrModeSize.Int8 && addrMode.Size != AddrModeSize.Int16); 224Debug.Assert(addrMode.BaseReg >= Register.RegDirect);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\VirtualMethodUseNode.cs (5)
10using Debug = System.Diagnostics.Debug; 30Debug.Assert(!decl.IsRuntimeDeterminedExactMethod); 31Debug.Assert(decl.IsVirtual); 36Debug.Assert(MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(decl) == decl); 39Debug.Assert(!decl.HasInstantiation);
src\runtime\src\coreclr\tools\Common\Compiler\DevirtualizationManager.cs (3)
6using Debug = System.Diagnostics.Debug; 33Debug.Assert(type.IsDefType); 58Debug.Assert(declMethod.IsVirtual);
src\runtime\src\coreclr\tools\Common\Compiler\DisplayNameHelpers.cs (1)
65Debug.Assert(typicalMethod == @event.RaiseMethod);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\Graph.Cycles.cs (1)
353Debug.Assert(alreadySeen[idx].Destination == vertex);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.cs (2)
12using Debug = System.Diagnostics.Debug; 226Debug.Assert(!typeContext.IsNull);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.ForEach.cs (1)
53Debug.Assert(type.IsDefType);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.MethodCall.cs (1)
37Debug.Assert(genericTypeParameters.Length == genericTypeArguments.Length);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\ModuleCycleInfo.cs (2)
15using Debug = System.Diagnostics.Debug; 37Debug.Assert(owner is EcmaMethod || owner is EcmaType);
src\runtime\src\coreclr\tools\Common\Compiler\HardwareIntrinsicHelpers.cs (3)
56Debug.Fail("Probably unimplemented"); 143Debug.Assert(InstructionSet.X64_AES == InstructionSet.X86_AES); 144Debug.Assert(InstructionSet.X64_AVX2 == InstructionSet.X86_AVX2);
src\runtime\src\coreclr\tools\Common\Compiler\InstructionSetSupport.cs (18)
115Debug.Assert(InstructionSet.X64_VectorT128 == InstructionSet.X86_VectorT128); 116Debug.Assert(InstructionSet.X64_VectorT256 == InstructionSet.X86_VectorT256); 117Debug.Assert(InstructionSet.X64_VectorT512 == InstructionSet.X86_VectorT512); 121Debug.Assert(!IsInstructionSetOptimisticallySupported(InstructionSet.X64_VectorT128)); 122Debug.Assert(!IsInstructionSetOptimisticallySupported(InstructionSet.X64_VectorT256)); 127Debug.Assert(!IsInstructionSetOptimisticallySupported(InstructionSet.X64_VectorT128)); 168Debug.Assert(false); // Unknown architecture 210Debug.Assert(support[instructionSet.Name] == instructionSet.InstructionSet); 397Debug.Assert(InstructionSet.X86_X86Base == InstructionSet.X64_X86Base); 398Debug.Assert(InstructionSet.X86_AVX2 == InstructionSet.X64_AVX2); 399Debug.Assert(InstructionSet.X86_AVX512 == InstructionSet.X64_AVX512); 401Debug.Assert(InstructionSet.X86_VectorT128 == InstructionSet.X64_VectorT128); 402Debug.Assert(InstructionSet.X86_VectorT256 == InstructionSet.X64_VectorT256); 403Debug.Assert(InstructionSet.X86_VectorT512 == InstructionSet.X64_VectorT512); 408Debug.Assert(supportedInstructionSets.HasInstructionSet(InstructionSet.X86_X86Base)); 409Debug.Assert((maxVectorTBitWidth == 0) || (maxVectorTBitWidth >= 128)); 427Debug.Assert(supportedInstructionSets.HasInstructionSet(InstructionSet.ARM64_AdvSimd)); 428Debug.Assert((maxVectorTBitWidth == 0) || (maxVectorTBitWidth >= 128));
src\runtime\src\coreclr\tools\Common\Compiler\Int128FieldLayoutAlgorithm.cs (7)
8using Debug = System.Diagnostics.Debug; 26Debug.Assert(IsIntegerType(defType)); 29Debug.Assert((name == "Int128") || (name == "UInt128")); 62Debug.Assert(!_fallbackAlgorithm.ComputeContainsGCPointers(type)); 68Debug.Assert(!_fallbackAlgorithm.ComputeContainsByRefs(type)); 74Debug.Assert(!_fallbackAlgorithm.ComputeIsUnsafeValueType(type)); 80Debug.Assert(_fallbackAlgorithm.ComputeValueTypeShapeCharacteristics(type) == ValueTypeShapeCharacteristics.None);
src\runtime\src\coreclr\tools\Common\Compiler\MethodExtensions.cs (2)
10using Debug = System.Diagnostics.Debug; 110Debug.Assert(!method.OwningType.ContainsSignatureVariables(treatGenericParameterLikeSignatureVariable: true));
src\runtime\src\coreclr\tools\Common\Compiler\NativeAotNameMangler.cs (2)
31Debug.Assert(!_compilationUnitPrefix.IsNull); 158Debug.Assert(b);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectDataInterner.cs (2)
8using Debug = System.Diagnostics.Debug; 38Debug.Assert(factory.MarkingComplete);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\CoffObjectWriter.cs (7)
164Debug.Assert(alignment > 0 && BitOperations.IsPow2((uint)alignment)); 429Debug.Assert(section.Header.VirtualAddress == 0); 450Debug.Assert(outputFileStream.Position == section.Header.PointerToRawData); 474Debug.Assert(outputFileStream.Position == coffHeader.PointerToSymbolTable); 566Debug.Assert(SizeOfOptionalHeader == 0); 567Debug.Assert(Characteristics == 0); 792Debug.Assert(SectionIndex == uint.MaxValue || SectionIndex < ushort.MaxValue);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\Eabi\EabiAttributesBuilder.cs (6)
39Debug.Assert(_sectionSize is null); 40Debug.Assert(_subsectionSize is null); 57Debug.Assert(_sectionSize is not null); 58Debug.Assert(_subsectionSize is not null); 69Debug.Assert(_subsectionSize is not null); 77Debug.Assert(_subsectionSize is not null);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ElfObjectWriter.cs (2)
227Debug.Assert(addend >= short.MinValue && addend <= short.MaxValue); 394Debug.Fail("Unsupported architecture");
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\MachObjectWriter.cs (11)
391Debug.Assert(BitOperations.IsPow2(alignment)); 456Debug.Assert(IsSectionSymbolName(symbolName)); 457Debug.Assert(relocType == IMAGE_REL_BASED_DIR64); 485Debug.Assert(!section.IsExecutable, "Executable sections cannot contain RELPTR32 relocations on Mach-O."); 489Debug.Assert(!section.IsZeroFill, "Uninitialized sections cannot contain RELPTR32 relocations on Mach-O."); 677Debug.Assert(FitsInSigned20Bits(inlineAddend), "The RELPTR32 addend cannot fit in ld-prime's signed 20-bit inline encoding."); 818Debug.Assert(_symbolNameToIndex.ContainsKey(_baseSymbolName.Value)); 971Debug.Assert(_symbolNameToIndex.ContainsKey(_baseSymbolName.Value)); 1058Debug.Assert(encoded); 1142Debug.Assert(encoded); 1144Debug.Assert(encoded);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ObjectWriter.cs (7)
421Debug.Assert(codeNode.Signature != null, $"Wasm code node {codeNode.GetType()} has null signature"); 432Debug.Assert(((ulong)thumbBit & (ulong)(uint)n.Offset) == 0); 486Debug.Assert(reloc.Offset % _nodeFactory.Target.PointerSize == 0); 489Debug.Assert(!hasPointerRelocs || (nodeContents.Alignment % _nodeFactory.Target.PointerSize) == 0); 622Debug.Assert(LayoutMode == CodeDataLayout.Separate); 627Debug.Assert(LayoutMode == CodeDataLayout.Separate); 729Debug.Assert(b);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (3)
684Debug.Assert(writer.SectionIndex == _sections.Count - 1, "The .reloc section must be the last section we emit."); 725Debug.Assert(DosHeader.Length == DosHeaderSize); 828Debug.Assert(outputFileStream.Position <= section.Header.PointerToRawData);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\UnixObjectWriter.cs (1)
13using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Compiler\ProcessLinkerXmlBase.cs (5)
165Debug.Assert(_owningModule != null); 173Debug.Assert(!processAllAssemblies); 174Debug.Assert(_owningModule != null); 185Debug.Assert(!processAllAssemblies); 787Debug.Assert(!string.IsNullOrEmpty(fullName));
src\runtime\src\coreclr\tools\Common\Compiler\PseudoDescExtensions.cs (1)
7using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Compiler\TypeExtensions.cs (14)
9using Debug = System.Diagnostics.Debug; 23Debug.Assert(type.IsArray, "IsSealed on a type with no virtual methods?"); 213Debug.Assert(inst1.Length == inst2.Length); 262Debug.Assert(ta.IsDefType); 263Debug.Assert(tb.IsDefType); 337Debug.Assert(ta != null); 344Debug.Assert(ta.IsArray && tb.IsArray && ta != tb); 354Debug.Assert(taElem != tbElem); 544Debug.Assert(!method.OwningType.IsInterface); 550Debug.Assert(potentialMatchingInterfaces != 0); 555Debug.Assert(interfaceType.HasInstantiation); 641Debug.Assert(method.Signature.IsStatic); 645Debug.Assert(method != null); 795Debug.Assert(interfaceType.IsInterface);
src\runtime\src\coreclr\tools\Common\Compiler\TypeMapMetadata.cs (2)
292Debug.Assert(assemblyTargetsMode == TypeMapAssemblyTargetsMode.Traverse, "We should only have pending maps with target modules when we're traversing for type map groups, as opposed to just recording targets."); 387Debug.Fail($"Unexpected TypeMapAttributeKind: {attrKind}");
src\runtime\src\coreclr\tools\Common\Compiler\VectorFieldLayoutAlgorithm.cs (6)
8using Debug = System.Diagnostics.Debug; 26Debug.Assert(IsVectorType(defType)); 79Debug.Assert(defType.Name == "Vector512`1"u8); 131Debug.Assert(!_fallbackAlgorithm.ComputeContainsGCPointers(type)); 137Debug.Assert(!_fallbackAlgorithm.ComputeContainsByRefs(type)); 143Debug.Assert(!_fallbackAlgorithm.ComputeIsUnsafeValueType(type));
src\runtime\src\coreclr\tools\Common\Compiler\Win32Resources\ResourceData.cs (1)
195Debug.Assert(dataBuilder.CountBytes == 0);
src\runtime\src\coreclr\tools\Common\Compiler\Win32Resources\ResourceData.UpdateResourceDataModel.cs (4)
30Debug.Assert(type is string); 50Debug.Assert(name is string); 71Debug.Assert(type is string); 86Debug.Assert(name is string);
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatWriter.Primitives.cs (2)
168Debug.Assert(offset < _size); 181Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\Internal\Runtime\DehydratedData.cs (4)
7using Debug = System.Diagnostics.Debug; 38Debug.Assert((command & DehydratedDataCommandMask) == command); 39Debug.Assert(commandData <= MaxShortPayload); 45Debug.Assert((command & DehydratedDataCommandMask) == command);
src\runtime\src\coreclr\tools\Common\Internal\Runtime\EETypeBuilderHelpers.cs (15)
27Debug.Assert((int)TypeFlags.Void == (int)EETypeElementType.Void); 28Debug.Assert((int)TypeFlags.IntPtr == (int)EETypeElementType.IntPtr); 29Debug.Assert((int)TypeFlags.Single == (int)EETypeElementType.Single); 30Debug.Assert((int)TypeFlags.UInt32 == (int)EETypeElementType.UInt32); 31Debug.Assert((int)TypeFlags.Pointer == (int)EETypeElementType.Pointer); 32Debug.Assert((int)TypeFlags.Array == (int)EETypeElementType.Array); 37Debug.Assert(elementType != EETypeElementType.SystemArray); 38Debug.Assert(elementType <= EETypeElementType.FunctionPointer); 226Debug.Assert(numInstanceFieldBytes >= 1); 240Debug.Assert(int.TrailingZeroCount((int)EETypeFlagsEx.ValueTypeFieldPaddingMask) == ValueTypeFieldPaddingConsts.Shift); 241Debug.Assert((valueTypeFieldPadding & ((int)EETypeFlagsEx.ValueTypeFieldPaddingMask >> ValueTypeFieldPaddingConsts.Shift)) == valueTypeFieldPadding); 252Debug.Assert(nullableValueOffset > 0); 255Debug.Assert((nullableValueOffset & (nullableValueOffset - 1)) == 0); 259Debug.Assert(int.TrailingZeroCount((int)EETypeFlagsEx.NullableValueOffsetMask) == NullableValueOffsetConsts.Shift); 260Debug.Assert((log2nullableOffset & ((int)EETypeFlagsEx.NullableValueOffsetMask >> NullableValueOffsetConsts.Shift)) == log2nullableOffset);
src\runtime\src\coreclr\tools\Common\Internal\Runtime\GCDescEncoder.cs (9)
6using Debug = System.Diagnostics.Debug; 43Debug.Assert(numSeries > 0); 55Debug.Assert(numSeries > 0); 117Debug.Assert(initialBuilderPosition + GetGCDescSize(type) == builder.CountBytes); 123Debug.Assert(size >= map.Size); 148Debug.Assert(numSeries > 0); 200Debug.Assert(pointerCount < 64 * 1024); 203Debug.Assert(nonPointerCount * pointerSize < 64 * 1024); 214Debug.Assert(numSeries > 0);
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8StringBuilder.cs (3)
36Debug.Assert(newLength <= _length); 61Debug.Assert(Ascii.IsValid(value)); 71Debug.Assert(Ascii.IsValid(value), "Non-ASCII character detected");
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoTypes.cs (1)
274Debug.Assert(sizeof(CORINFO_RUNTIME_LOOKUP) >= sizeof(CORINFO_CONST_LOOKUP));
src\runtime\src\coreclr\tools\Common\Microsoft\SourceLink\Tools\SourceLinkMap.cs (1)
188Debug.Assert(mappedUri.Suffix.Length == 0);
src\runtime\src\coreclr\tools\Common\Pgo\PgoFormat.cs (3)
425Debug.Assert(modifyMask != InstrumentationDataProcessingState.Done); 665Debug.Assert(PgoSchemaMergeComparer.Singleton.Compare(schema, mergedElem) == 0); 666Debug.Assert(PgoSchemaMergeComparer.Singleton.Equals(schema, mergedElem));
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (4)
6using Debug = System.Diagnostics.Debug; 73Debug.Assert(length > 0); 74Debug.Assert(newItems.Length >= offset + length); 92Debug.Assert(numItems >= 0);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\DelegateInfo.cs (4)
10using Debug = System.Diagnostics.Debug; 108Debug.Assert(delegateType.IsDelegate); 109Debug.Assert(delegateType.IsTypeDefinition); 179Debug.Assert(firstParam.IsDefType);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (2)
10using Debug = System.Diagnostics.Debug; 57Debug.Assert(method.Signature.Length == 0 && method.Signature.IsStatic);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (2)
9using Debug = System.Diagnostics.Debug; 156Debug.Assert((currentOpcode >= ILOpcode.br && currentOpcode <= ILOpcode.blt_un)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\NativeAotILProvider.cs (7)
13using Debug = System.Diagnostics.Debug; 24Debug.Assert(method.IsRuntimeImplemented); 48Debug.Assert(method.IsIntrinsic); 94Debug.Assert(method.IsIntrinsic); 200Debug.Assert(((DefType)elementType).InstanceFieldSize.AsInt == 8); 235Debug.Assert(elementType.IsValueType); 376Debug.Assert(!(method is PInvokeTargetNativeMethod), "Who is asking for IL of PInvokeTargetNativeMethod?");
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\ArrayMethodILEmitter.cs (3)
8using Debug = System.Diagnostics.Debug; 23Debug.Assert(method.Kind != ArrayMethodKind.Address, "Should be " + nameof(ArrayMethodKind.AddressWithHiddenArg)); 72Debug.Assert(_method.OwningType.IsMdArray);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\AsyncResumptionStub.cs (2)
11using Debug = System.Diagnostics.Debug; 24Debug.Assert(targetMethod.IsAsyncCall());
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\CalliMarshallingMethodThunk.Mangling.cs (1)
28Debug.Assert((_targetSignature.Flags & MethodSignatureFlags.UnmanagedCallingConventionMask) == MethodSignatureFlags.UnmanagedCallingConvention);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\ComparerIntrinsics.cs (9)
10using Debug = System.Diagnostics.Debug; 54Debug.Assert(!methodBeingGenerated.IsTypicalMethodDefinition); 65Debug.Assert(comparerType != null); 135Debug.Assert(type.IsCanonicalSubtype(CanonicalFormKind.Any)); 179Debug.Assert(context.IsCanonicalDefinitionType(nullableType, CanonicalFormKind.Universal)); 232Debug.Assert(type.CanCastTo(interfaceType.MakeInstantiatedType(type))); 252Debug.Assert(type.IsValueType); 296Debug.Assert(fieldType.IsValueType); 342Debug.Assert(fieldType.IsValueType);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\DelegateMarshallingMethodThunk.cs (4)
12using Debug = System.Diagnostics.Debug; 185Debug.Assert(parameterIndex == parameterMetadataArray.Length || sequence <= parameterMetadataArray[parameterIndex].Index); 193Debug.Assert(sequence == parameterMetadataArray[parameterIndex].Index); 247Debug.Fail("Unexpected DelegateMarshallingMethodThunkKind.");
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\DelegateMethodILEmitter.cs (4)
8using Debug = System.Diagnostics.Debug; 16Debug.Assert(method.OwningType.IsDelegate); 17Debug.Assert(method.OwningType.IsTypeDefinition); 18Debug.Assert(method.IsRuntimeImplemented);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\DelegateThunks.cs (4)
9using Debug = System.Diagnostics.Debug; 158Debug.Assert(specializedMethod.GetTypicalMethodDefinition() == this); 172Debug.Assert(Signature.Length > 0); 493Debug.Assert(specializedMethod.GetTypicalMethodDefinition() == this);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\DynamicInvokeMethodThunk.cs (2)
9using Debug = System.Diagnostics.Debug; 58Debug.Assert(!type.ContainsSignatureVariables(treatGenericParameterLikeSignatureVariable: true));
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\GetCanonTypeIntrinsic.cs (3)
7using Debug = System.Diagnostics.Debug; 18Debug.Assert(target.Signature.Length == 0); 25Debug.Assert(target.Signature.ReturnType == runtimeTypeHandleType);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\GetFieldHelperMethodOverride.cs (2)
12using Debug = System.Diagnostics.Debug; 71Debug.Assert(specializedMethod.GetTypicalMethodDefinition() == this);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\InterlockedIntrinsics.cs (4)
8using Debug = System.Diagnostics.Debug; 23Debug.Assert(((MetadataType)method.OwningType).Name == "Interlocked"u8); 24Debug.Assert(!method.IsGenericMethodDefinition); 47Debug.Assert(size is 1 or 2 or 4 or 8);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\MethodBaseGetCurrentMethodThunk.cs (2)
9using Debug = System.Diagnostics.Debug; 22Debug.Assert(method.IsTypicalMethodDefinition);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\PInvokeILEmitter.cs (9)
8using Debug = System.Diagnostics.Debug; 27Debug.Assert(targetMethod.IsPInvoke || targetMethod is DelegateMarshallingMethodThunk || targetMethod is CalliMarshallingMethodThunk); 84Debug.Assert(parameterIndex == parameterMetadataArray.Length || i <= parameterMetadataArray[parameterIndex].Index); 92Debug.Assert(i == parameterMetadataArray[parameterIndex].Index); 105Debug.Assert(direction == MarshalDirection.Forward); 157Debug.Assert(delegateMethod != null); 257Debug.Fail("Unexpected DelegateMarshallingMethodThunkKind"); 453Debug.Assert(!string.IsNullOrEmpty(ex.Message)); 460Debug.Assert(_targetMethod.IsPInvoke || _targetMethod is DelegateMarshallingMethodThunk || _targetMethod is CalliMarshallingMethodThunk);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\PInvokeLazyFixupField.cs (2)
9using Debug = System.Diagnostics.Debug; 26Debug.Assert(targetMethod.IsPInvoke);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\RuntimeHelpersIntrinsics.cs (2)
9using Debug = System.Diagnostics.Debug; 20Debug.Assert(((MetadataType)method.OwningType).Name == "RuntimeHelpers"u8);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\StreamIntrinsics.cs (2)
8using Debug = System.Diagnostics.Debug; 19Debug.Assert(((MetadataType)method.OwningType).Name == "Stream"u8);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\StructMarshallingThunk.cs (11)
14using Debug = System.Diagnostics.Debug; 100Debug.Fail("Unexpected Struct marshalling thunk type"); 122Debug.Fail("Unexpected Struct marshalling thunk type"); 146Debug.Assert(_interopStateManager != null); 213Debug.Assert(notEmpty); 216Debug.Assert(nativeField != null); 231Debug.Assert(byValMarshaller != null); 259Debug.Assert(!nativeEnumerator.MoveNext()); 280Debug.Assert(notEmpty); 283Debug.Assert(nativeField != null); 320Debug.Assert(!string.IsNullOrEmpty(ex.Message));
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\TypeGetTypeMethodThunk.cs (5)
9using Debug = System.Diagnostics.Debug; 75Debug.Assert(Signature[0] == _helperMethod.Signature[0]); 78Debug.Assert(_helperMethod.Signature[1].IsString); 92Debug.Assert(_helperMethod.Signature[i] == Signature[i - 1]); 98Debug.Assert(_helperMethod.Signature[i].IsWellKnownType(WellKnownType.Boolean));
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\TypeSystemThrowingILEmitter.cs (2)
8using Debug = System.Diagnostics.Debug; 78Debug.Assert(helper.Signature.Length == exception.Arguments.Count + 1);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\UnsafeIntrinsics.cs (7)
8using Debug = System.Diagnostics.Debug; 19Debug.Assert(((MetadataType)method.OwningType).Name == "Unsafe"u8); 101Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 2); 119Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 2); 139Debug.Assert(method.Signature.IsStatic && method.Signature.Length == (write ? 2 : 1)); 157Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 2); 212Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 1);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\InlineArrayType.cs (4)
12using Debug = System.Diagnostics.Debug; 175Debug.Assert(elementType.IsTypeDefinition); 176Debug.Assert(elementType.IsValueType); 177Debug.Assert(!elementType.IsGenericDefinition);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\MarshalHelpers.Aot.cs (3)
7using Debug = System.Diagnostics.Debug; 98Debug.Assert(nativeType.IsPointer || nativeType.IsFunctionPointer); 103Debug.Assert(marshalAs != null && marshalAs.SizeConst.HasValue);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\MarshalHelpers.cs (4)
5using Debug = System.Diagnostics.Debug; 78Debug.Assert(interopStateManager is not null, "An InteropStateManager is required to look up the native representation of a non-blittable struct or class with layout."); 120Debug.Assert(arrayType != null, "Expecting array"); 156Debug.Assert(arrayType != null, "Expecting array");
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\Marshaller.Aot.cs (8)
9using Debug = System.Diagnostics.Debug; 360Debug.Assert(MarshalAsDescriptor.SizeConst.HasValue); 378Debug.Assert(MarshalAsDescriptor.SizeConst.HasValue); 406Debug.Assert(nativeArrayType != null); 407Debug.Assert(ManagedType is ArrayType); 484Debug.Assert(ManagedType is ArrayType); 487Debug.Assert(nativeArrayType != null); 570Debug.Assert(nativeArrayType != null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\Marshaller.cs (17)
9using Debug = System.Diagnostics.Debug; 60Debug.Assert(_nativeType != null); 160Debug.Assert(false); 182Debug.Assert(false); 192Debug.Fail("Unexpectting setting value on non-byref arg"); 201Debug.Assert(false); 397Debug.Assert(parameterIndex == parameterMetadataArray.Length || i <= parameterMetadataArray[parameterIndex].Index); 407Debug.Assert(i == parameterMetadataArray[parameterIndex].Index); 448Debug.Assert(targetMethod.IsPInvoke); 467Debug.Assert(targetMethod.IsPInvoke); 631Debug.Assert(Return || IsHRSwappedRetVal); 937Debug.Assert(codeStream != null); 952Debug.Assert(codeStream != null); 1024Debug.Assert(Return); 1102Debug.Assert(ManagedType is ArrayType); 1112Debug.Assert(NativeType is PointerType); 1807Debug.Assert(_marshallerInstance is null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\NativeStructType.cs (3)
11using Debug = System.Diagnostics.Debug; 182Debug.Assert(!managedStructType.IsGenericDefinition); 202Debug.Assert(popped == managedStructType);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\PInvokeDelegateWrapper.cs (3)
11using Debug = System.Diagnostics.Debug; 164Debug.Assert(delegateType.IsDelegate); 266Debug.Assert((int)kind < _methods.Length);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\InteropStateManager.cs (9)
6using Debug = System.Diagnostics.Debug; 51Debug.Assert(delegateType is MetadataType); 69Debug.Assert(delegateType is MetadataType); 87Debug.Assert(delegateType is MetadataType); 100Debug.Assert(delegateType is MetadataType); 125Debug.Assert(managedType is MetadataType); 140Debug.Assert(managedType is MetadataType); 156Debug.Assert(managedType is MetadataType); 172Debug.Assert(managedType is MetadataType);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\UnmanagedCallingConventions.cs (8)
57Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl 60Debug.Assert(unmanagedCallconv != 0); 97Debug.Assert(method.IsUnmanagedCallersOnly); 104Debug.Assert(method.IsPInvoke); 114Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl 140Debug.Assert(delegateType.IsDelegate); 147Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl 257Debug.Assert(index == count);
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (1)
140Debug.Assert(hashCode == NameHashCode("System.Array`1"u8));
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (6)
39Debug.Assert(value >= 0); 40Debug.Assert(value <= _chars.Length); 50Debug.Assert(capacity >= 0); 82Debug.Assert(index < _pos); 252Debug.Assert(additionalCapacityBeyondPos > 0); 253Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed.");
src\runtime\src\tools\illink\src\ILLink.Shared\Annotations.cs (1)
54Debug.Assert(memberTypes != DynamicallyAccessedMemberTypes.None);
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\CompilerGeneratedNames.cs (1)
180Debug.Assert(ch < 0x80);
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\ForwardDataFlowAnalysis.cs (9)
70Debug.Assert(entryOut != null); 202Debug.Assert(successor.ConditionKind is ConditionKind.WhenTrue or ConditionKind.WhenFalse); 325Debug.Assert(isPredecessorInFinally); 393Debug.Assert(result); 405Debug.Assert(exceptionState != null); 406Debug.Assert(oldExceptionState != null); 413Debug.Assert(enclosingTryOrCatch.Kind != RegionKind.Filter); 445Debug.Assert(finallyExit != null); 448Debug.Assert(finallyExit.Value.ConditionKind == ConditionKind.Unconditional);
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\ValueSet.cs (4)
190Debug.Assert(other._values == UnknownSentinel); 206Debug.Assert(other._values == UnknownSentinel); 212Debug.Assert(_values == UnknownSentinel); 242Debug.Assert(_values == UnknownSentinel);
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\ArrayOfAnnotatedSystemTypeValue.cs (1)
34Debug.Assert(!IsModified);
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\HandleCallAction.cs (4)
95Debug.Assert(requiresDataFlowAnalysis || annotatedMethodReturnValue.DynamicallyAccessedMemberTypes == DynamicallyAccessedMemberTypes.None); 100Debug.Assert(instanceValue.IsEmpty()); 101Debug.Assert(argumentValues.Count == 1); 525Debug.Fail("Unreachable.");
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\NullableSystemTypeValue.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\NullableValueWithDynamicallyAccessedMembers.cs (1)
23Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\RuntimeTypeHandleForNullableSystemTypeValue.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\RuntimeTypeHandleForNullableValueWithDynamicallyAccessedMembers.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
ILCompiler.DependencyAnalysisFramework (16)
ComputedStaticDependencyNode.cs (3)
18Debug.Assert(_dependencies == null); 19Debug.Assert(_conditionalDependencies == null); 20Debug.Assert(dependencies != null);
DependencyAnalyzer.cs (3)
94Debug.Assert(dependency.OtherReasonNode is null || dependency.OtherReasonNode.Marked); 246Debug.Assert(currentNode.Marked); 320Debug.Assert(node.StaticDependenciesAreComputed);
DependencyNode.cs (2)
18Debug.Assert(mark != null); 19Debug.Assert(_mark == null);
DgmlWriter.cs (1)
114Debug.Assert(!_nodeMappings.ContainsKey(node));
FirstMarkLogStrategy.cs (3)
50Debug.Assert(reason != null); 101Debug.Assert(markData.Reason1 != null); 110Debug.Assert(markData.Reason != null);
FullGraphLogStrategy.cs (3)
121Debug.Assert(reason != null); 175Debug.Assert(markData.Reason1 != null); 184Debug.Assert(markData.Reason != null);
src\runtime\src\coreclr\tools\Common\Sorting\ICompareAsEqualAction.cs (1)
17Debug.Assert(false);
ILCompiler.MetadataTransform (181)
ILCompiler\Metadata\MetadataTransformResult.cs (5)
8using Debug = System.Diagnostics.Debug; 55Debug.Assert(type.IsTypeDefinition); 72Debug.Assert(type.IsTypeDefinition); 89Debug.Assert(method.IsTypicalMethodDefinition); 113Debug.Assert(field.OwningType.IsTypeDefinition);
ILCompiler\Metadata\Transform.cs (2)
5using Debug = System.Diagnostics.Debug; 50Debug.Assert(type.IsDefType);
ILCompiler\Metadata\Transform.CustomAttribute.cs (3)
12using Debug = System.Diagnostics.Debug; 51Debug.Assert(prolog == 1); 87Debug.Assert((int)Cts.TypeFlags.Boolean == (int)Ecma.SerializationTypeCode.Boolean);
ILCompiler\Metadata\Transform.Field.cs (4)
12using Debug = System.Diagnostics.Debug; 42Debug.Assert(field.GetTypicalFieldDefinition() == field); 43Debug.Assert(_policy.GeneratesMetadata(field)); 91Debug.Assert(header.Kind == Ecma.SignatureKind.Field);
ILCompiler\Metadata\Transform.Method.cs (11)
12using Debug = System.Diagnostics.Debug; 49Debug.Assert(rec is QualifiedMethod || rec is MemberReference || rec is MethodInstantiation); 56Debug.Assert(method.IsTypicalMethodDefinition); 57Debug.Assert(_policy.GeneratesMetadata(method)); 132Debug.Assert(method.IsMethodDefinition); 239Debug.Assert((int)Cts.MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)SignatureCallingConvention.Cdecl); 240Debug.Assert((int)Cts.MethodSignatureFlags.UnmanagedCallingConventionThisCall == (int)SignatureCallingConvention.ThisCall); 241Debug.Assert((int)Cts.MethodSignatureFlags.UnmanagedCallingConventionMask == (int)SignatureCallingConvention.UnmanagedCallingConventionMask); 256Debug.Assert((int)Ecma.SignatureCallingConvention.CDecl == (int)SignatureCallingConvention.Cdecl); 257Debug.Assert((int)Ecma.SignatureCallingConvention.ThisCall == (int)SignatureCallingConvention.ThisCall); 258Debug.Assert((int)Ecma.SignatureCallingConvention.Unmanaged == (int)SignatureCallingConvention.Unmanaged);
ILCompiler\Metadata\Transform.Namespace.cs (2)
10using Debug = System.Diagnostics.Debug; 20Debug.Assert(namespaceString != null);
ILCompiler\Metadata\Transform.Scope.cs (1)
15using Debug = System.Diagnostics.Debug;
ILCompiler\Metadata\Transform.Type.cs (7)
11using Debug = System.Diagnostics.Debug; 67Debug.Assert(type.IsDefType); 80Debug.Assert(!_policy.IsBlocked(metadataType)); 92Debug.Assert(rec is TypeDefinition || rec is TypeReference || rec is TypeSpecification); 194Debug.Assert(parentRecord is TypeDefinition); 215Debug.Assert(entity.IsTypeDefinition); 231Debug.Assert(entity.IsTypeDefinition);
ILCompiler\Metadata\Transform.TypeForwarders.cs (2)
12using Debug = System.Diagnostics.Debug; 42Debug.Fail("Multi-module assemblies");
Internal\Metadata\NativeFormat\Writer\MdBinaryWriter.cs (2)
5using Debug = System.Diagnostics.Debug; 58Debug.Assert(value != null);
Internal\Metadata\NativeFormat\Writer\MdBinaryWriterGen.cs (1)
14using Debug = System.Diagnostics.Debug;
Internal\Metadata\NativeFormat\Writer\NativeFormatWriterGen.cs (36)
17using Debug = System.Diagnostics.Debug; 71Debug.Assert(ElementType == null || 146Debug.Assert(Type == null || 1635Debug.Assert(Value.TrueForAll(handle => handle == null || 2159Debug.Assert(Object.ReferenceEquals(other, popped)); 2187Debug.Assert(Constructor == null || 2191Debug.Assert(FixedArguments.TrueForAll(handle => handle == null || 2311Debug.Assert(Type == null || 2404Debug.Assert(DefaultValue == null || 2509Debug.Assert(Type == null || 2660Debug.Assert(Constraints.TrueForAll(handle => handle == null || 2741Debug.Assert(Parent == null || 2747Debug.Assert(Signature == null || 2915Debug.Assert(Method == null || 2919Debug.Assert(GenericTypeArguments.TrueForAll(handle => handle == null || 3075Debug.Assert(ReturnType == null || 3081Debug.Assert(Parameters.TrueForAll(handle => handle == null || 3087Debug.Assert(VarArgParameters.TrueForAll(handle => handle == null || 3229Debug.Assert(ModifierType == null || 3234Debug.Assert(Type == null || 3315Debug.Assert(Type == null || 3320Debug.Assert(Value == null || 3427Debug.Assert(ParentScopeOrNamespace == null || 3505Debug.Assert(ParentScopeOrNamespace == null || 3586Debug.Assert(DefaultValue == null || 3689Debug.Assert(Type == null || 3782Debug.Assert(DefaultValue == null || 3895Debug.Assert(Type == null || 3901Debug.Assert(Parameters.TrueForAll(handle => handle == null || 4110Debug.Assert(ElementType == null || 4418Debug.Assert(BaseType == null || 4434Debug.Assert(Interfaces.TrueForAll(handle => handle == null || 4592Debug.Assert(GenericType == null || 4597Debug.Assert(GenericTypeArguments.TrueForAll(handle => handle == null || 4670Debug.Assert(ParentNamespaceOrType == null || 4739Debug.Assert(Signature == null ||
Internal\Metadata\NativeFormat\Writer\NativeMetadataWriter.cs (5)
8using Debug = System.Diagnostics.Debug; 177Debug.Assert(rec.GetType() == pooledRecord.GetType()); 330Debug.Assert(realRec.Handle.Offset != 0); 506Debug.Assert(!_gettingHashCode); 513Debug.Assert(_gettingHashCode);
src\runtime\src\coreclr\tools\Common\Internal\LowLevelLinq\LowLevelEnumerable.cs (4)
14Debug.Assert(values != null); 22Debug.Assert(values != null); 31Debug.Assert(source != null); 32Debug.Assert(filter != null);
src\runtime\src\coreclr\tools\Common\Internal\Metadata\NativeFormat\MdBinaryReaderGen.cs (1)
13using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Internal\Metadata\NativeFormat\NativeFormatReaderGen.cs (63)
74Debug.Assert(hType == HandleType.ArraySignature || hType == HandleType.Null); 155Debug.Assert(hType == HandleType.ByReferenceSignature || hType == HandleType.Null); 235Debug.Assert(hType == HandleType.ConstantBooleanArray || hType == HandleType.Null); 315Debug.Assert(hType == HandleType.ConstantBooleanValue || hType == HandleType.Null); 395Debug.Assert(hType == HandleType.ConstantByteArray || hType == HandleType.Null); 475Debug.Assert(hType == HandleType.ConstantByteValue || hType == HandleType.Null); 555Debug.Assert(hType == HandleType.ConstantCharArray || hType == HandleType.Null); 635Debug.Assert(hType == HandleType.ConstantCharValue || hType == HandleType.Null); 715Debug.Assert(hType == HandleType.ConstantDoubleArray || hType == HandleType.Null); 795Debug.Assert(hType == HandleType.ConstantDoubleValue || hType == HandleType.Null); 879Debug.Assert(hType == HandleType.ConstantEnumArray || hType == HandleType.Null); 963Debug.Assert(hType == HandleType.ConstantEnumValue || hType == HandleType.Null); 1043Debug.Assert(hType == HandleType.ConstantHandleArray || hType == HandleType.Null); 1123Debug.Assert(hType == HandleType.ConstantInt16Array || hType == HandleType.Null); 1203Debug.Assert(hType == HandleType.ConstantInt16Value || hType == HandleType.Null); 1283Debug.Assert(hType == HandleType.ConstantInt32Array || hType == HandleType.Null); 1363Debug.Assert(hType == HandleType.ConstantInt32Value || hType == HandleType.Null); 1443Debug.Assert(hType == HandleType.ConstantInt64Array || hType == HandleType.Null); 1523Debug.Assert(hType == HandleType.ConstantInt64Value || hType == HandleType.Null); 1599Debug.Assert(hType == HandleType.ConstantReferenceValue || hType == HandleType.Null); 1679Debug.Assert(hType == HandleType.ConstantSByteArray || hType == HandleType.Null); 1759Debug.Assert(hType == HandleType.ConstantSByteValue || hType == HandleType.Null); 1839Debug.Assert(hType == HandleType.ConstantSingleArray || hType == HandleType.Null); 1919Debug.Assert(hType == HandleType.ConstantSingleValue || hType == HandleType.Null); 2000Debug.Assert(hType == HandleType.ConstantStringArray || hType == HandleType.Null); 2082Debug.Assert(hType == HandleType.ConstantStringValue || hType == HandleType.Null); 2162Debug.Assert(hType == HandleType.ConstantUInt16Array || hType == HandleType.Null); 2242Debug.Assert(hType == HandleType.ConstantUInt16Value || hType == HandleType.Null); 2322Debug.Assert(hType == HandleType.ConstantUInt32Array || hType == HandleType.Null); 2402Debug.Assert(hType == HandleType.ConstantUInt32Value || hType == HandleType.Null); 2482Debug.Assert(hType == HandleType.ConstantUInt64Array || hType == HandleType.Null); 2562Debug.Assert(hType == HandleType.ConstantUInt64Value || hType == HandleType.Null); 2652Debug.Assert(hType == HandleType.CustomAttribute || hType == HandleType.Null); 2749Debug.Assert(hType == HandleType.Event || hType == HandleType.Null); 2850Debug.Assert(hType == HandleType.Field || hType == HandleType.Null); 2931Debug.Assert(hType == HandleType.FieldSignature || hType == HandleType.Null); 3011Debug.Assert(hType == HandleType.FunctionPointerSignature || hType == HandleType.Null); 3112Debug.Assert(hType == HandleType.GenericParameter || hType == HandleType.Null); 3202Debug.Assert(hType == HandleType.MemberReference || hType == HandleType.Null); 3306Debug.Assert(hType == HandleType.Method || hType == HandleType.Null); 3392Debug.Assert(hType == HandleType.MethodInstantiation || hType == HandleType.Null); 3476Debug.Assert(hType == HandleType.MethodSemantics || hType == HandleType.Null); 3575Debug.Assert(hType == HandleType.MethodSignature || hType == HandleType.Null); 3655Debug.Assert(hType == HandleType.MethodTypeVariableSignature || hType == HandleType.Null); 3745Debug.Assert(hType == HandleType.ModifiedType || hType == HandleType.Null); 3839Debug.Assert(hType == HandleType.NamedArgument || hType == HandleType.Null); 3936Debug.Assert(hType == HandleType.NamespaceDefinition || hType == HandleType.Null); 4021Debug.Assert(hType == HandleType.NamespaceReference || hType == HandleType.Null); 4118Debug.Assert(hType == HandleType.Parameter || hType == HandleType.Null); 4199Debug.Assert(hType == HandleType.PointerSignature || hType == HandleType.Null); 4300Debug.Assert(hType == HandleType.Property || hType == HandleType.Null); 4390Debug.Assert(hType == HandleType.PropertySignature || hType == HandleType.Null); 4474Debug.Assert(hType == HandleType.QualifiedField || hType == HandleType.Null); 4558Debug.Assert(hType == HandleType.QualifiedMethod || hType == HandleType.Null); 4639Debug.Assert(hType == HandleType.SZArraySignature || hType == HandleType.Null); 4779Debug.Assert(hType == HandleType.ScopeDefinition || hType == HandleType.Null); 4887Debug.Assert(hType == HandleType.ScopeReference || hType == HandleType.Null); 5025Debug.Assert(hType == HandleType.TypeDefinition || hType == HandleType.Null); 5113Debug.Assert(hType == HandleType.TypeForwarder || hType == HandleType.Null); 5199Debug.Assert(hType == HandleType.TypeInstantiationSignature || hType == HandleType.Null); 5284Debug.Assert(hType == HandleType.TypeReference || hType == HandleType.Null); 5365Debug.Assert(hType == HandleType.TypeSpecification || hType == HandleType.Null); 5445Debug.Assert(hType == HandleType.TypeVariableSignature || hType == HandleType.Null);
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatReader.cs (7)
19Debug.Assert(false); 228Debug.Assert(base_ <= base_ + size); 244Debug.Assert((byte*)address >= _base); 245Debug.Assert((byte*)address <= _base + _size); 251Debug.Assert(offset < _size); 258Debug.Assert(false); 392Debug.Assert(value < _reader.Size);
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatReader.Primitives.cs (4)
105Debug.Assert(false); 150Debug.Assert(false); 173Debug.Assert(false); 196Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatWriter.cs (19)
39Debug.Assert(_offset >= 0); 72Debug.Assert(vertex._offset == Vertex.NotPlaced); 83Debug.Assert(vertex._offset == Vertex.Placed); 241Debug.Assert(val._offset != Vertex.NotPlaced); 330Debug.Assert(vertex._offset == GetCurrentOffset()); 379Debug.Assert(vertex._offset == GetCurrentOffset()); 406Debug.Assert(vertex._offset == Vertex.NotPlaced); 922Debug.Assert(args != null && args.Length > 0); 924Debug.Assert(fptrReferenceId == 0); 1316Debug.Assert(bounds != null && lowerBounds != null); 1575Debug.Assert(writer.GetCurrentOffset() > existingOffset); 1658Debug.Assert(delta >= 0); 1731Debug.Assert(pop == tree); 1740Debug.Assert(pop == second); 1744Debug.Assert(pop == tree); 1757Debug.Assert(pop == tree); 1814Debug.Assert(offset >= 0); 1915Debug.Assert(_nBuckets == 0); 2013Debug.Assert(iEntry == nEntries);
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatWriter.Primitives.cs (2)
168Debug.Assert(offset < _size); 181Debug.Assert(false);
ILCompiler.ReadyToRun (884)
Compiler\AssemblyExtensions.cs (1)
11using Debug = System.Diagnostics.Debug;
Compiler\CompilationModuleGroup.ReadyToRun.cs (1)
96Debug.Assert(VersionsWithModule((ModuleDesc)module) || module is MutableModule);
Compiler\DependencyAnalysis\ArrayInterfaceMethodsNode.cs (1)
29Debug.Assert(arrayType.IsSzArray);
Compiler\DependencyAnalysis\EmbeddedObjectNode.cs (5)
8using Debug = System.Diagnostics.Debug; 29Debug.Assert(_offset != InvalidOffset); 38Debug.Assert(_index != InvalidOffset); 45Debug.Assert(_offset == InvalidOffset || _offset == offset); 51Debug.Assert(_index == InvalidOffset || _index == index);
Compiler\DependencyAnalysis\ImportReferenceProvider.cs (1)
26Debug.Assert(module is IEcmaModule);
Compiler\DependencyAnalysis\InheritedVirtualMethodsNode.cs (4)
29Debug.Assert(type.IsDefType && !type.IsInterface); 30Debug.Assert(!type.IsGenericDefinition); 31Debug.Assert(type == type.ConvertToCanonForm(CanonicalFormKind.Specific)); 70Debug.Assert(!canonImpl.OwningType.IsGenericDefinition);
Compiler\DependencyAnalysis\ReadyToRun\AttributePresenceFilterNode.cs (5)
248Debug.Assert(customAttributeConstructorReferenceParentHandle.Kind == HandleKind.TypeSpecification); 261Debug.Assert(firstTypeHandle.Kind == HandleKind.TypeReference); 269Debug.Assert(false); 357Debug.Assert(bucketAIndex == (bucketBIndex ^ (fingerprintHash % bucketCount))); 396Debug.Fail("Not possible to reach here");
Compiler\DependencyAnalysis\ReadyToRun\CopiedCorHeaderNode.cs (4)
10using Debug = System.Diagnostics.Debug; 137Debug.Assert(reader.Offset - headerSize == _module.PEReader.PEHeaders.CorHeaderStartOffset); 138Debug.Assert(builder.CountBytes == headerSize); 139Debug.Assert(headerSize == Size);
Compiler\DependencyAnalysis\ReadyToRun\CopiedFieldRvaNode.cs (3)
13using Debug = System.Diagnostics.Debug; 105Debug.Assert(field.HasRva); 111Debug.Assert(size > 0);
Compiler\DependencyAnalysis\ReadyToRun\CopiedMetadataBlobNode.cs (7)
11using Debug = System.Diagnostics.Debug; 51Debug.Assert(builder.CountBytes == reader.Offset); 82Debug.Assert(builder.CountBytes == reader.Offset); 98Debug.Assert(fieldDesc.HasRva); 142Debug.Assert(builder.CountBytes == metadataBlob.Length); 143Debug.Assert(builder.CountBytes == metadataBlob.Offset); 144Debug.Assert(builder.CountBytes == Size);
Compiler\DependencyAnalysis\ReadyToRun\CopiedMethodILNode.cs (2)
11using Debug = System.Diagnostics.Debug; 25Debug.Assert(!method.IsAbstract);
Compiler\DependencyAnalysis\ReadyToRun\DebugDirectoryEntryNode.cs (7)
125Debug.Assert(builder.CountBytes <= PerfMapEntrySize); 195Debug.Assert(builder.CountBytes <= RSDSSize); 208Debug.Assert(hash.Length >= 16); 219Debug.Assert(rsdsEntry.Length <= RSDSSize); 249Debug.Assert(checksumLocation.Length == ChecksumSize); 293Debug.Assert(debugEntryIndex >= 0); 311Debug.Assert(entries != null && _debugEntryIndex < entries.Length);
Compiler\DependencyAnalysis\ReadyToRun\DebugDirectoryNode.cs (1)
150Debug.Assert(builder.CountBytes == Size);
Compiler\DependencyAnalysis\ReadyToRun\DebugInfoTableNode.cs (2)
239Debug.Assert(bitsInProgressCount < 8); 317Debug.Assert(offset % 4 == 0);
Compiler\DependencyAnalysis\ReadyToRun\DeferredTillPhaseNode.cs (1)
19Debug.Assert(phase > 0);
Compiler\DependencyAnalysis\ReadyToRun\DelayLoadHelperImport.cs (1)
96Debug.Assert(Table.EntrySize == factory.Target.PointerSize);
Compiler\DependencyAnalysis\ReadyToRun\EnclosingTypeMapNode.cs (1)
52Debug.Assert(_metadata.TypeDefinitions.Count <= (int)ReadyToRunEnclosingTypeMap.MaxTypeCount);
Compiler\DependencyAnalysis\ReadyToRun\ExceptionInfoLookupTableNode.cs (1)
11using Debug = System.Diagnostics.Debug;
Compiler\DependencyAnalysis\ReadyToRun\GCRefMapBuilder.cs (3)
106Debug.Assert(hasAsyncContinuation ? !isUnboxingStub : true); 306Debug.Assert(type is MetadataType); 325Debug.Assert(field.Offset.AsInt == 0);
Compiler\DependencyAnalysis\ReadyToRun\GCRefMapNode.cs (1)
108Debug.Assert(nextOffsetIndex == offsets.Length);
Compiler\DependencyAnalysis\ReadyToRun\GenericLookupSignature.cs (2)
37Debug.Assert(typeArgument != null || methodArgument != null || fieldArgument != null); 108Debug.Assert(_methodArgument.Unboxing == false);
Compiler\DependencyAnalysis\ReadyToRun\HotColdMapNode.cs (1)
20Debug.Assert(_mapping == null);
Compiler\DependencyAnalysis\ReadyToRun\ILBodyFixupSignature.cs (3)
47Debug.Assert(signatureMethod.IsTypicalMethodDefinition); 48Debug.Assert(!signatureMethod.IsCompilerGeneratedILBodyForAsync()); 49Debug.Assert(signatureMethod.GetPrimaryMethodDesc() is EcmaMethod);
Compiler\DependencyAnalysis\ReadyToRun\ImportThunk.cs (1)
99Debug.Assert(base.ComputeNonRelocationBasedDependencies(factory) == null);
Compiler\DependencyAnalysis\ReadyToRun\InliningInfoNode.cs (13)
39Debug.Assert(module == null); // Cross module inlining always covers all modules 43Debug.Assert(module != null); // InliningInfo2 is restricted to a single module at a time 84Debug.Assert(AllowCrossModuleInlines || (inlinerDefinition.Module == _module)); 118Debug.Assert(factory.CompilationModuleGroup.CrossModuleInlineable(inlineeDefinition)); 171Debug.Assert(_module != null); 198Debug.Assert(result != 0); 208Debug.Assert(ridDelta >= 0); 241Debug.Assert(_module == null); 243Debug.Assert(!isCrossModuleInlinee || factory.CompilationModuleGroup.CrossModuleInlineable(inlinee)); 268Debug.Assert(indexA != indexB); 282Debug.Assert(result != 0); 292Debug.Assert(factory.CompilationModuleGroup.CrossModuleInlineable(method)); 344Debug.Assert(!isForeignInliner || crossModuleMultiModuleFormat);
Compiler\DependencyAnalysis\ReadyToRun\InstanceEntryPointTableNode.cs (2)
70Debug.Assert(handle.HasValue); 113Debug.Assert(method.Method.HasInstantiation || method.Method.OwningType.HasInstantiation || method.Method.IsAsyncVariant());
Compiler\DependencyAnalysis\ReadyToRun\InstrumentationDataTableNode.cs (1)
195Debug.Assert(schema != null);
Compiler\DependencyAnalysis\ReadyToRun\ManifestAssemblyMvidHeaderNode.cs (1)
11using Debug = System.Diagnostics.Debug;
Compiler\DependencyAnalysis\ReadyToRun\ManifestMetadataTableNode.cs (6)
16using Debug = System.Diagnostics.Debug; 177Debug.Assert(oldModuleToIndexCount == _assemblyRefToModuleIdMap.Count); 220Debug.Assert(module != null); 224Debug.Assert(module == _mutableModule); 306Debug.Assert(handle.HasValue); 307Debug.Assert(((handle.Value & 0xFFFFFF) + (_assemblyRefCount)) == (idAndAssemblyName.Key - 1));
Compiler\DependencyAnalysis\ReadyToRun\MethodColdCodeNode.cs (1)
57Debug.Assert(_methodColdCode == null);
Compiler\DependencyAnalysis\ReadyToRun\MethodEntryPointTableNode.cs (3)
53Debug.Assert(method.Method is EcmaMethod); 55Debug.Assert(ecmaMethod.Module == _module); 59Debug.Assert(rid != 0);
Compiler\DependencyAnalysis\ReadyToRun\MethodGCInfoNode.cs (2)
124Debug.Assert(bytes != null); 132Debug.Assert(symbol != null);
Compiler\DependencyAnalysis\ReadyToRun\MethodWithGCInfo.cs (15)
38Debug.Assert(!methodDesc.IsUnboxingThunk()); 78Debug.Assert(inlinee.IsNonVersionable()); 90Debug.Assert(_methodCode == null); 224Debug.Assert(cell.ImportOffset % factory.Target.PointerSize == 0); 230Debug.Assert(cell.TableIndex > curTableIndex); 251Debug.Assert(delta > 0); 325Debug.Assert(_frameInfos == null); 342Debug.Assert(_coldFrameInfos == null); 349Debug.Assert(_gcInfo == null); 355Debug.Assert(_ehInfo == null); 365Debug.Assert(_debugLocInfos == null); 373Debug.Assert(_debugVarInfos == null); 381Debug.Assert(_debugEHClauseInfos == null); 449Debug.Assert(resumptionStub.TargetMethod is not AsyncResumptionStub); 461Debug.Assert(_inlinedMethods == null);
Compiler\DependencyAnalysis\ReadyToRun\NibbleWriter.cs (2)
61Debug.Assert((nibble & ~0xF) == 0); 169Debug.Assert(startOffset == totalBytes);
Compiler\DependencyAnalysis\ReadyToRun\ReadyToRunHeaderNode.cs (1)
53Debug.Assert(otherModuleSpecificHeaderTableNode._module != null);
Compiler\DependencyAnalysis\ReadyToRun\ReadyToRunHelperSignature.cs (1)
18Debug.Assert(helper < ReadyToRunHelper.FirstFakeHelper);
Compiler\DependencyAnalysis\ReadyToRun\RuntimeFunctionsTableNode.cs (7)
11using Debug = System.Diagnostics.Debug; 42Debug.Assert(_nodeFactory.MarkingComplete); 43Debug.Assert(method.Marked); 156Debug.Assert((method.FrameInfos.Length + method.ColdFrameInfos.Length) == funcletOffsets.Length); 194Debug.Assert(frameInfo.StartOffset != frameInfo.EndOffset); 211Debug.Assert((mapping.Count == 0), "HotColdMap is null, but mapping is not empty"); 245Debug.Assert(_tableSize >= 0);
Compiler\DependencyAnalysis\ReadyToRun\SignatureBuilder.cs (9)
15using Debug = System.Diagnostics.Debug; 145Debug.Assert(udata <= 0x7f); 153Debug.Assert(udata <= 0x3fff); 162Debug.Assert(udata <= 0x1FFFFFFF); 402Debug.Assert(type.IsSzArray); 409Debug.Assert(type.IsArray && !type.IsSzArray); 459Debug.Assert(methodDefToken.TokenType == CorTokenType.mdtMethodDef); 465Debug.Assert(memberRefToken.TokenType == CorTokenType.mdtMemberRef); 487Debug.Assert(!methodToken.IsNull);
Compiler\DependencyAnalysis\ReadyToRun\StringDiscoverableAssemblyStubNode.cs (2)
35Debug.Assert(!string.IsNullOrEmpty(LookupString), "LookupString must be non-empty"); 36Debug.Assert(!LookupString.Contains('\0'), "LookupString must not contain embedded null characters");
Compiler\DependencyAnalysis\ReadyToRun\TypeFixupSignature.cs (3)
54Debug.Assert(_typeDesc.IsValueType); 75Debug.Assert(type.IsValueType); 146Debug.Assert(alignment == pointerSize);
Compiler\DependencyAnalysis\ReadyToRun\TypeHandle.cs (2)
85Debug.Assert(IsHomogeneousAggregate()); 144Debug.Assert(IsValueType());
Compiler\DependencyAnalysis\ReadyToRun\TypeValidationChecker.cs (1)
666Debug.Assert(type.IsGenericParameter);
Compiler\DependencyAnalysis\ReadyToRun\WasmImportThunk.cs (2)
148Debug.Assert(_thunkKind == ImportThunkKind.DelayLoadHelper); 149Debug.Assert(!instructionEncoder.Is64Bit); // We currently only support 32-bit, and the thunk logic is currently tied to that assumption
Compiler\DependencyAnalysis\ReadyToRun\WasmImportThunkPortableEntrypoint.cs (3)
23Debug.Assert(!import.UseVirtualCall); // We don't currently support these for WASM, so detect them early so we can diagnose issues faster. 24Debug.Assert(import.HelperId != ReadyToRunHelper.GetString); 26Debug.Assert(import.Signature is MethodFixupSignature || import.Signature is GenericLookupSignature);
Compiler\DependencyAnalysis\ReadyToRun\WasmInterpreterToR2RThunkNode.cs (2)
113Debug.Assert(!instructionEncoder.Is64Bit); 278Debug.Assert(targetFuncType.Returns.Types.Length == 1, "Expected exactly one wasm return type");
Compiler\DependencyAnalysis\ReadyToRun\WasmR2RToInterpreterThunkNode.cs (2)
122Debug.Assert(!instructionEncoder.Is64Bit); 374Debug.Assert(_typeNode.Type.Returns.Types.Length == 1, "Expected exactly one wasm return type");
Compiler\DependencyAnalysis\ReadyToRunCodegenNodeFactory.cs (11)
134Debug.Assert(CompilationModuleGroup.ContainsMethodBody(method, false)); 135Debug.Assert(method == method.GetCanonMethodTarget(CanonicalFormKind.Specific)); 191Debug.Assert(method.IsVirtual); 201Debug.Assert(method.IsVirtual); 202Debug.Assert(!method.HasInstantiation); 589Debug.Assert(!key.IsJumpableImportRequired); 611Debug.Assert(!isJumpableImportRequired || !isPrecodeImportRequired); 643Debug.Assert(methodCodeNodeDebug == methodCodeNode); 656Debug.Assert(MarkingComplete); 792Debug.Assert(method.IsTypicalMethodDefinition); 1306Debug.Assert(field.HasRva);
Compiler\DependencyAnalysis\ReadyToRunSymbolNodeFactory.cs (1)
514Debug.Assert(method.IsTypicalMethodDefinition);
Compiler\ExternalReferenceTokenManager.cs (5)
35Debug.Assert(_mutableModule.ModuleThatIsCurrentlyTheSourceOfNewReferences == null); 36Debug.Assert(!_mutableModule.CreatingTokensForAsyncMethod); 60Debug.Assert(_mutableModule.ModuleThatIsCurrentlyTheSourceOfNewReferences == null); 61Debug.Assert(!_mutableModule.CreatingTokensForAsyncMethod); 77Debug.Assert(_mutableModule.ModuleThatIsCurrentlyTheSourceOfNewReferences != null);
Compiler\FileLayoutOptimizer.cs (2)
318Debug.Assert(outputMethods.Count == methodsToPlace.Count); 365Debug.Assert(components.SelectMany(l => l).OrderBy(i => i).SequenceEqual(Enumerable.Range(0, methodsToPlace.Count)));
Compiler\PettisHansenSort\PettisHansen.cs (9)
55Debug.Assert(phEdges[kvp.Key][i] == phEdges[i][kvp.Key]); 80Debug.Assert(phEdges[from][to] == phEdges[to][from]); 114Debug.Assert(wfl >= wff && wfl >= wlf && wfl >= wll); 123Debug.Assert(phEdges[loser].Count(e => unionFind.FindSet(e.Key) == winner) == 1); 134Debug.Assert(removed); 152Debug.Assert(unionFind.FindSet(i) == i && unionFind.FindSet(edge.Key) == edge.Key); 153Debug.Assert(phEdges[edge.Key][i] == phEdges[i][edge.Key]); 171Debug.Assert(components.SelectMany(l => l).OrderBy(i => i).SequenceEqual(Enumerable.Range(0, graph.Count))); 177Debug.Assert(component[0] > prev);
Compiler\ProfileDataManager.cs (3)
263Debug.Assert(_gdvEntityFinder != null); 271Debug.Assert(_gdvEntityFinder != null); 284Debug.Assert(value is MethodDesc or TypeDesc);
Compiler\R2RTypeExtensions.cs (1)
9using Debug = System.Diagnostics.Debug;
Compiler\ReadyToRunCodegenCompilation.cs (4)
653Debug.Assert(!type.IsValueType); 679Debug.Assert(type != null); 702Debug.Assert(method.IsMethodDefinition); 938Debug.Assert((_nodeFactory.CompilationCurrentPhase == 0) || ((_nodeFactory.CompilationCurrentPhase == 2) && !_finishedFirstCompilationRunInPhase2));
Compiler\ReadyToRunCompilationModuleGroupBase.cs (6)
16using Debug = System.Diagnostics.Debug; 81Debug.Assert(_isCompositeBuildMode || _compilationModuleSet.Count == 1); 107Debug.Assert(_tokenResolver == null); 720Debug.Assert(!VersionsWithType(type)); 868Debug.Fail("Unhandled form of type in VersionsWithTypeReference"); 903Debug.Assert(instType.IsString || instType.IsObject);
Compiler\ReadyToRunCompilerContext.cs (4)
8using Debug = System.Diagnostics.Debug; 29Debug.Assert(type is DefType); 138Debug.Assert(_r2rFieldLayoutAlgorithm != null); 167Debug.Assert(field.IsStatic);
Compiler\ReadyToRunMetadataFieldLayoutAlgorithm.cs (1)
543Debug.Assert(TargetDetails.MaximumLog2PrimitiveSize == 3);
Compiler\ReadyToRunSingleAssemblyCompilationModuleGroup.cs (2)
10using Debug = System.Diagnostics.Debug; 60Debug.Assert(_profileGuidedCompileRestrictionSet);
Compiler\ReadyToRunStandaloneMethodMetadata.cs (1)
114Debug.Assert(expectedFinalSize == _nonCodeAlternateBlob.Count);
Compiler\ReadyToRunTableManager.cs (4)
14using Debug = System.Diagnostics.Debug; 80Debug.Assert(!_sortedMethods); 116Debug.Assert((nodeComparerResult == methodOnlyResult) || 172Debug.Assert(methodCategory == CompiledMethodCategory.NonInstantiated);
Compiler\SystemObjectFieldLayoutAlgorithm.cs (2)
6using Debug = System.Diagnostics.Debug; 30Debug.Assert(0 == layoutFromMetadata.Offsets.Length, "Incompatible system library. The CoreCLR System.Private.CoreLib must be used when compiling in ready-to-run mode.");
Compiler\VersionResilientHashCode.ReadyToRun.cs (1)
21Debug.Assert(assembly == module);
IBC\IBCProfileParser.cs (1)
748Debug.Assert(instantiationArgumentCount > 0);
IBC\MIbcProfileParser.cs (1)
203Debug.Assert(mibcGroupName == "");
IL\ReadyToRunILProvider.cs (7)
149Debug.Assert(method.IsTypicalMethodDefinition); 150Debug.Assert(_manifestMutableModule != null); 153Debug.Assert(!_compilationModuleGroup.VersionsWithMethodBody(method) && 182Debug.Assert(method.IsTypicalMethodDefinition); 200Debug.Assert(method.IsAsync && method is EcmaMethod); 297Debug.Assert(mutableModule.ModuleThatIsCurrentlyTheSourceOfNewReferences == null); 326Debug.Assert(ReadyToRunStandaloneMethodMetadata.Compute((EcmaMethod)_owningMethod.GetPrimaryMethodDesc().GetTypicalMethodDefinition()) != null);
IL\Stubs\PInvokeILEmitter.cs (2)
15using Debug = System.Diagnostics.Debug; 31Debug.Assert(targetMethod.IsPInvoke);
JitInterface\CorInfoImpl.ReadyToRun.cs (40)
153Debug.Assert(!method.IsUnboxingThunk()); 154Debug.Assert(genericContextObject is null or MethodDesc or TypeDesc); 190Debug.Assert(moduleToken.TokenType == CorTokenType.mdtMemberRef); 198Debug.Assert(devirtualizedMethodOwner == null); // Devirtualization is expected to always use a methoddef token 251Debug.Assert(false); // This is expected to fire if and only if we implement devirtualization to default interface methods 317Debug.Assert(false); 908Debug.Assert(type.IsDefType); 918Debug.Assert(type.IsSzArray); 980Debug.Assert(!targetMethodDesc.IsUnboxingThunk()); 1462Debug.Assert(resultMethod is EcmaMethod); 1479Debug.Assert(resultField is EcmaField); 1503Debug.Assert(sigMethod.Index == 0); 1529Debug.Assert(methodIL.GetMethodILScopeDefinition() is IEcmaMethodIL 1594Debug.Assert(_debugVarInfos == null); 1614Debug.Assert(_debugLocInfos == null); 1754Debug.Assert(((int)flags & ((int)CORINFO_ACCESS_FLAGS.CORINFO_ACCESS_GET | 2013Debug.Assert(methodOnUnderlyingType != null); 2036Debug.Assert(!moduleToken.IsNull); 2061Debug.Assert(!methodAfterConstraintResolution.OwningType.IsInterface || (isStaticVirtual && methodAfterConstraintResolution.Signature.IsStatic)); 2563Debug.Assert(pResult->codePointerOrStubLookup.lookupKind.needsRuntimeLookup); 2644Debug.Assert(!pResult->sig.hasTypeArg() || _compilation.NodeFactory.Target.IsWasm); 2688Debug.Assert(callerHandle != null); 2728Debug.Assert(templateMethod != null); 2775Debug.Assert(MethodBeingCompiled is not AsyncResumptionStub); 2782Debug.Assert(!strippedInstantiation); 2818Debug.Assert(md.OwningType == td); 2863Debug.Assert(pResult.compileTimeHandle != null); 2914Debug.Assert(typeHandleImport.RepresentsIndirectionCell); 2923Debug.Assert(pResult.compileTimeHandle != null); 3106Debug.Assert(pResult->offset >= (uint)fieldBaseOffset); 3193Debug.Assert(dataBlobNode != null, "Data location without a data blob"); 3266Debug.Assert(_compilation.CompilationModuleGroup.VersionsWithMethodBody(methodDesc)); 3311Debug.Assert(!_compilation.NodeFactory.CompilationModuleGroup.GeneratesPInvoke(method)); 3376Debug.Assert(clauseType.IsObject); 3445Debug.Assert(typicalMethod.IsMethodDefinition); 3451Debug.Assert(_compilation.CompilationModuleGroup.CrossModuleInlineable(ecmaMethod) || 3478Debug.Assert(typicalMethod.IsMethodDefinition); 3502Debug.Assert(imp.GetType() == typeof(DelayLoadMethodImport)); 3521Debug.Assert(fieldHandle != null); 3599Debug.Assert(method != null);
ObjectWriter\MapFileBuilder.cs (1)
53Debug.Assert(Name.AsSpan().SequenceEqual(node.Name.AsSpan()));
src\runtime\src\coreclr\tools\Common\CallingConvention\ArgIterator.cs (34)
134Debug.Assert(IsStructPassedInRegs()); 141Debug.Assert(IsStructPassedInRegs()); 152Debug.Assert(IsStructPassedInRegs()); 169Debug.Assert(eightByteSize == 8); 170Debug.Assert((genRegDest & 7) == 0); 318Debug.Assert(argNum >= 0); 391Debug.Assert(_SIZE_OF_ARG_STACK_COMPUTED); 392Debug.Assert((_nSizeOfArgStack % _transitionBlock.PointerSize) == 0); 412Debug.Assert((size % _transitionBlock.PointerSize) == 0); 474Debug.Assert(!_argTypeHandle.IsNull()); 481Debug.Assert(!_argTypeHandle.IsNull()); 488Debug.Assert(!_argTypeHandle.IsNull()); 528Debug.Assert(IsVarArg); 557Debug.Assert(HasParamType); 600Debug.Assert(HasAsyncContinuation); 677Debug.Assert(!IsVarArg || !HasParamType); 785Debug.Assert(argOfs >= _transitionBlock.OffsetOfArgs); 832Debug.Assert(false); 1004Debug.Assert((cbArg % _transitionBlock.PointerSize) == 0); 1188Debug.Assert(_transitionBlock.IsAppleArm64ABI || (cbArg % _transitionBlock.PointerSize) == 0); 1227Debug.Assert((cbArg & (cbArg - 1)) == 0); 1296Debug.Assert(cFPRegs == 1); 1297Debug.Assert((info.flags & (FpStruct.OnlyOne | FpStruct.BothFloat)) == 0); 1326Debug.Assert((info.flags & (FpStruct.OnlyOne | FpStruct.BothFloat)) != 0); 1340Debug.Assert((cbArg % _transitionBlock.PointerSize) == 0); 1353Debug.Assert(regSlots == 2); 1355Debug.Assert(_rvLa64IdxGenReg == lastReg, "pass head in last register"); 1356Debug.Assert(_rvLa64OfsStack == 0, "pass tail in first stack slot"); 1414Debug.Assert(!_ITERATION_STARTED); 1595Debug.Assert((floatRegOfsInBytes % _transitionBlock.FloatRegisterSize) == 0); 1634Debug.Assert((floatRegOfsInBytes % _transitionBlock.FloatRegisterSize) == 0); 1685Debug.Assert((floatRegOfsInBytes % _transitionBlock.FloatRegisterSize) == 0); 1732Debug.Assert(false); 1741Debug.Assert((floatRegOfsInBytes % _transitionBlock.FloatRegisterSize) == 0);
src\runtime\src\coreclr\tools\Common\CallingConvention\TransitionBlock.cs (18)
147Debug.Assert(!IsX64UnixABI || offset != StructInRegsOffset); 155Debug.Assert(!IsX86); 157Debug.Assert((offset % PointerSize) == 0); 163Debug.Assert(!IsX86); 169Debug.Assert(!IsX86); 188Debug.Assert(IsX86); 240Debug.Assert(IsX64); 306Debug.Assert(!thRetType.IsNull() && thRetType.IsValueType()); 469Debug.Assert(!th.IsNull()); 470Debug.Assert(th.IsValueType()); 588Debug.Assert(!th.IsNull()); 589Debug.Assert(th.IsValueType()); 616Debug.Assert((parmSize & (parmSize - 1)) == 0); 622Debug.Assert((parmSize % 4) == 0); 653Debug.Assert(!th.IsNull()); 654Debug.Assert(th.IsValueType()); 697Debug.Assert(!th.IsNull()); 698Debug.Assert(th.IsValueType());
src\runtime\src\coreclr\tools\Common\Compiler\AsyncContinuationType.cs (1)
59Debug.Assert(_continuationBaseType == ((AsyncContinuationType)other)._continuationBaseType);
src\runtime\src\coreclr\tools\Common\Compiler\AsyncMethodVariant.cs (6)
21Debug.Assert(wrappedMethod.Signature.ReturnsTaskOrValueTask()); 37Debug.Assert(signature.ReturnsTaskOrValueTask()); 89Debug.Assert(!asyncVariant.Signature.ReturnType.IsVoid); 181Debug.Assert(!method.IsAsyncVariant()); 187Debug.Assert(method.IsAsyncVariant()); 193Debug.Assert(method.IsReturnDroppingAsyncThunk());
src\runtime\src\coreclr\tools\Common\Compiler\AsyncMethodVariant.Mangling.cs (1)
7using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Compiler\CachingVirtualMethodAlgorithm.cs (1)
26Debug.Assert(type.IsTypeDefinition);
src\runtime\src\coreclr\tools\Common\Compiler\CompilerTypeSystemContext.Async.cs (7)
10using Debug = System.Diagnostics.Debug; 39Debug.Assert(originalMethod.Signature.ReturnsTaskOrValueTask()); 40Debug.Assert(resolvedMethod.Signature.ReturnsTaskOrValueTask()); 193Debug.Assert(taskReturningMethod.Signature.ReturnsTaskOrValueTask()); 212Debug.Assert(returnDroppingThunk.IsReturnDroppingAsyncThunk()); 243Debug.Assert(asyncVariantMethod.IsAsyncVariant()); 244Debug.Assert(!asyncVariantMethod.Signature.ReturnType.IsVoid);
src\runtime\src\coreclr\tools\Common\Compiler\CompilerTypeSystemContext.cs (6)
53Debug.Fail("CreateValueFromKey not supported"); 81Debug.Fail("CreateValueFromKey not supported"); 286Debug.Assert(!type.IsArray, "Wanted to call GetClosestMetadataType?"); 296Debug.Assert(_genericsMode == SharedGenericsMode.Disabled); 306Debug.Assert(_genericsMode == SharedGenericsMode.Disabled); 315Debug.Assert(_genericsMode == SharedGenericsMode.Disabled);
src\runtime\src\coreclr\tools\Common\Compiler\CompilerTypeSystemContext.Validation.cs (6)
9using Debug = System.Diagnostics.Debug; 104Debug.Assert(!OtherTypesToMarkAsSuccessfullyLoaded.Contains(type)); 146Debug.Assert(typeLoadCheckInProgressStackOffset != -1); 184Debug.Assert(EmptyList.Count == 0); 192Debug.Assert(typeLoadabilityCheck.OtherTypesToMarkAsSuccessfullyLoaded.Count == 0); 306Debug.Assert(type.IsDefType);
src\runtime\src\coreclr\tools\Common\Compiler\Dataflow\EcmaExtensions.cs (2)
14using Debug = System.Diagnostics.Debug; 52Debug.Assert(signature == null);
src\runtime\src\coreclr\tools\Common\Compiler\DecimalFieldLayoutAlgorithm.cs (6)
6using Debug = System.Diagnostics.Debug; 26Debug.Assert(IsDecimalFloatingPointType(defType)); 61Debug.Assert(!_fallbackAlgorithm.ComputeContainsGCPointers(type)); 67Debug.Assert(!_fallbackAlgorithm.ComputeContainsByRefs(type)); 73Debug.Assert(!_fallbackAlgorithm.ComputeIsUnsafeValueType(type)); 79Debug.Assert(_fallbackAlgorithm.ComputeValueTypeShapeCharacteristics(type) == ValueTypeShapeCharacteristics.None);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\CompilerComparer.cs (3)
25Debug.Assert(x.GetType() == y.GetType()); 30Debug.Assert(result != 0); 36Debug.Assert(x.GetType() != y.GetType());
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\GVMDependenciesNode.cs (4)
32Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 33Debug.Assert(method.HasInstantiation); 34Debug.Assert(method.IsVirtual); 35Debug.Assert(MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(method.GetMethodDefinition()) == method.GetMethodDefinition());
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\MethodReadOnlyDataNode.cs (1)
43Debug.Assert(_data == null);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\MethodReadWriteDataNode.cs (1)
43Debug.Assert(_data == null);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\ObjectDataBuilder.cs (8)
9using Debug = System.Diagnostics.Debug; 120Debug.Assert(_target.PointerSize == 4); 133Debug.Assert(_target.PointerSize == 4); 209Debug.Assert(_numReservations > 0); 261Debug.Assert(node.Marked); 308Debug.Assert(delta == 0); 335Debug.Assert(_numReservations == 0); 355Debug.Assert((align == 2) || (align == 4) || (align == 8) || (align == 16));
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Relocation.cs (44)
160Debug.Assert(((uint)Opcode0 & 0xFBF0) == 0xF240); 161Debug.Assert(((uint)Opcode1 & 0xFBF0) == 0xF2C0); 174Debug.Assert(((uint)Opcode0 & 0xFBF0) == 0xF240); 175Debug.Assert(((uint)Opcode1 & 0xFBF0) == 0xF2C0); 182Debug.Assert((uint)GetThumb2Mov32(p) == imm32); 222Debug.Assert(FitsInThumb2BlRel24(imm24)); 226Debug.Assert((imm24 & 1/*THUMB_CODE*/) == 0); 243Debug.Assert(GetThumb2BlRel24(p) == imm24); 278Debug.Assert(FitsInRel21(imm21)); 282Debug.Assert((adrpInstr & 0x9F000000) == 0x90000000); 291Debug.Assert(GetArm64Rel21(pCode) == imm21); 321Debug.Assert(FitsInRel12(imm12)); 325Debug.Assert((addInstr & 0xFFC00000) == 0x91000000); 332Debug.Assert(GetArm64Rel12(pCode) == imm12); 343Debug.Assert(FitsInRel12(imm12)); 347Debug.Assert((addInstr & 0xFFC00000) == 0x91400000); 354Debug.Assert(GetArm64Rel12(pCode) == imm12); 380Debug.Assert(FitsInRel12(imm12)); 381Debug.Assert((imm12 & 7) == 0, "LDR offset must be 8-byte aligned"); 385Debug.Assert((ldrInstr & 0xFFC00000) == 0xF9400000); 397Debug.Assert(GetArm64Rel12Ldr(pCode) == imm12); 419Debug.Assert(FitsInArm64Rel28(imm28)); 421Debug.Assert((imm28 & 0x3) == 0); // the low two bits must be zero 427Debug.Assert((branchInstr & 0x7FFFFFFF) == 0x14000000); // Must be B or BL 434Debug.Assert(GetArm64Rel28(pCode) == imm28); 460Debug.Assert((int)imm == imm); 464Debug.Assert((pcInstr & 0xFE000000) == 0x1a000000); // Must be pcalau12i 480Debug.Assert(GetLoongArch64PC12(pCode) == imm); 500Debug.Assert((imm38 >= -0x2000000000L) && (imm38 < 0x2000000000L)); 502Debug.Assert((imm38 & 0x3) == 0); // the low two bits must be zero 506Debug.Assert(pcInstr == 0x1e000010); // Must be pcaddu18i t4, 0 526Debug.Assert(GetLoongArch64JIR(pCode) == imm38); 544Debug.Assert((auipc & OpcodeMask) == OpcodeAuipc); 546Debug.Assert(auipcRegDest != 0); 553Debug.Assert(opcode == OpcodeLoad || opcode == OpcodeStore || opcode == OpcodeLoadFp || opcode == OpcodeStoreFp || 555Debug.Assert(isStype == (opcode == OpcodeStore || opcode == OpcodeStoreFp)); 557Debug.Assert(auipcRegDest == addrReg); 581Debug.Assert((long)lo12 + (long)hi20 == offset); 600Debug.Assert(GetRiscV64AuipcCombo(pCode, isStype) == offset); 605Debug.Assert(target != null); 694Debug.Fail("Invalid RelocType: " + relocType); 783Debug.Assert((GetArm64Rel12((uint*)location) & 0xFF) == 0); 787Debug.Assert((GetArm64Rel21((uint*)location) & 0xFF) == 0); 819Debug.Fail("Invalid RelocType: " + relocType);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\ShadowConcreteMethodNode.cs (2)
11using Debug = System.Diagnostics.Debug; 24Debug.Assert(!method.IsSharedByGenericInstantiations);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\ShadowMethodNode.cs (5)
11using Debug = System.Diagnostics.Debug; 47Debug.Assert(!method.IsRuntimeDeterminedExactMethod); 48Debug.Assert(canonicalMethod.Method == method.GetCanonMethodTarget(CanonicalFormKind.Specific)); 49Debug.Assert(canonicalMethod.Method.IsSharedByGenericInstantiations); 99Debug.Assert(canonDep.OtherReasonNode is not INodeWithRuntimeDeterminedDependencies);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\SortableDependencyNode.cs (3)
185Debug.Assert(x.GetType() == y.GetType() || 192Debug.Assert(result != 0 || x == y); 198Debug.Assert(x.GetType() != y.GetType());
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_ARM\ARMEmitter.cs (18)
40Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 49Debug.Assert(IsValidReg(reg)); 60Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 69Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 78Debug.Assert(IsLowReg(reg) && !IsBitNumOverflow(immediate, 8)); 100Debug.Assert(reg >= Register.R0 && (reg <= Register.R12 || reg == TargetRegister.LR)); 110Debug.Assert(IsValidReg(reg) && reg != TargetRegister.SP); 120Debug.Assert(IsValidReg(destination) && IsValidReg(source)); 136Debug.Assert(IsValidReg(destination) && IsValidReg(source)); 150Debug.Assert(IsValidReg(destination) && IsValidReg(source)); 170Debug.Assert(encode >= 8); 171Debug.Assert((imm8 & 0x80) > 0); 179Debug.Assert(offset >= -255 && offset <= 4095); 198Debug.Assert(destination >= Register.R0 && (destination <= Register.R12 || destination == TargetRegister.LR)); 217Debug.Assert(!symbol.RepresentsIndirectionCell); 229Debug.Assert(IsValidReg(destination)); 243Debug.Assert(immediate >= -256 && immediate <= 254); 255Debug.Assert(immediate >= -256 && immediate <= 254);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_ARM64\ARM64Emitter.cs (14)
29Debug.Assert((uint)regDst <= 0x1f); 36Debug.Assert((uint)regDst <= 0x1f); 55Debug.Assert((uint)regDst <= 0x1f); 63Debug.Assert((uint)regDst <= 0x1f); 64Debug.Assert((offset & 3) == 0); 73Debug.Assert((uint)regDst <= 0x1f); 74Debug.Assert((uint)regAddr <= 0x1f); 83Debug.Assert(offset % 8 == 0); 104Debug.Assert((uint)regDst <= 0x1f); 105Debug.Assert((uint)regAddr <= 0x1f); 113Debug.Assert((uint)regDst <= 0x1f); 114Debug.Assert((uint)regAddr <= 0x1f); 141Debug.Assert(immediate % 4 == 0); 155Debug.Assert(immediate % 4 == 0);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_LoongArch64\LoongArch64Emitter.cs (8)
29Debug.Assert((uint)regDst <= 0x1f); 30Debug.Assert(imm16 <= 0xfff); 53Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 60Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 67Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 74Debug.Assert((imm >= -2048) && (imm <= 2047)); 82Debug.Assert((imm >= 0) && (imm <= 0xfff)); 90Debug.Assert((offset >= -2048) && (offset <= 2047));
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_RiscV64\RiscV64Emitter.cs (8)
35Debug.Assert((offset >= -2048) && (offset <= 2047)); 56Debug.Assert((uint)regDst > 0 && (uint)regDst < 32); 63Debug.Assert((uint)regDst <= 0x1f); 64Debug.Assert((uint)regSrc <= 0x1f); 65Debug.Assert((offset >= -2048) && (offset <= 2047)); 72Debug.Assert((offset >= -2048) && (offset <= 2047)); 79Debug.Assert((offset >= -2048) && (offset <= 2047)); 86Debug.Assert((offset >= -2048) && (offset <= 2047));
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_Wasm\WasmTypes.cs (3)
162Debug.Assert(!result || FuncType.Equals(other.FuncType), 175Debug.Assert(result != 0 || FuncType.Equals(other.FuncType), 248Debug.Assert(totalSize == 1 + paramSize + returnSize);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_X64\X64Emitter.cs (3)
69Debug.Assert(addrMode.Size != AddrModeSize.Int8 && 236Debug.Assert(addrMode.BaseReg >= Register.RegDirect); 396Debug.Assert(addrMode.Size != 0);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\Target_X86\X86Emitter.cs (4)
22Debug.Assert(addrMode.Size != AddrModeSize.Int8 && addrMode.Size != AddrModeSize.Int16); 28Debug.Assert(addrMode.Size != AddrModeSize.Int8 && addrMode.Size != AddrModeSize.Int16); 47Debug.Assert(addrMode.Size != AddrModeSize.Int8 && addrMode.Size != AddrModeSize.Int16); 224Debug.Assert(addrMode.BaseReg >= Register.RegDirect);
src\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\VirtualMethodUseNode.cs (5)
10using Debug = System.Diagnostics.Debug; 30Debug.Assert(!decl.IsRuntimeDeterminedExactMethod); 31Debug.Assert(decl.IsVirtual); 36Debug.Assert(MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(decl) == decl); 39Debug.Assert(!decl.HasInstantiation);
src\runtime\src\coreclr\tools\Common\Compiler\DevirtualizationManager.cs (3)
6using Debug = System.Diagnostics.Debug; 33Debug.Assert(type.IsDefType); 58Debug.Assert(declMethod.IsVirtual);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\Graph.Cycles.cs (1)
353Debug.Assert(alreadySeen[idx].Destination == vertex);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.cs (2)
12using Debug = System.Diagnostics.Debug; 226Debug.Assert(!typeContext.IsNull);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.ForEach.cs (1)
53Debug.Assert(type.IsDefType);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\GraphBuilder.MethodCall.cs (1)
37Debug.Assert(genericTypeParameters.Length == genericTypeArguments.Length);
src\runtime\src\coreclr\tools\Common\Compiler\GenericCycleDetection\ModuleCycleInfo.cs (2)
15using Debug = System.Diagnostics.Debug; 37Debug.Assert(owner is EcmaMethod || owner is EcmaType);
src\runtime\src\coreclr\tools\Common\Compiler\HardwareIntrinsicHelpers.cs (3)
56Debug.Fail("Probably unimplemented"); 143Debug.Assert(InstructionSet.X64_AES == InstructionSet.X86_AES); 144Debug.Assert(InstructionSet.X64_AVX2 == InstructionSet.X86_AVX2);
src\runtime\src\coreclr\tools\Common\Compiler\InstructionSetSupport.cs (18)
115Debug.Assert(InstructionSet.X64_VectorT128 == InstructionSet.X86_VectorT128); 116Debug.Assert(InstructionSet.X64_VectorT256 == InstructionSet.X86_VectorT256); 117Debug.Assert(InstructionSet.X64_VectorT512 == InstructionSet.X86_VectorT512); 121Debug.Assert(!IsInstructionSetOptimisticallySupported(InstructionSet.X64_VectorT128)); 122Debug.Assert(!IsInstructionSetOptimisticallySupported(InstructionSet.X64_VectorT256)); 127Debug.Assert(!IsInstructionSetOptimisticallySupported(InstructionSet.X64_VectorT128)); 168Debug.Assert(false); // Unknown architecture 210Debug.Assert(support[instructionSet.Name] == instructionSet.InstructionSet); 397Debug.Assert(InstructionSet.X86_X86Base == InstructionSet.X64_X86Base); 398Debug.Assert(InstructionSet.X86_AVX2 == InstructionSet.X64_AVX2); 399Debug.Assert(InstructionSet.X86_AVX512 == InstructionSet.X64_AVX512); 401Debug.Assert(InstructionSet.X86_VectorT128 == InstructionSet.X64_VectorT128); 402Debug.Assert(InstructionSet.X86_VectorT256 == InstructionSet.X64_VectorT256); 403Debug.Assert(InstructionSet.X86_VectorT512 == InstructionSet.X64_VectorT512); 408Debug.Assert(supportedInstructionSets.HasInstructionSet(InstructionSet.X86_X86Base)); 409Debug.Assert((maxVectorTBitWidth == 0) || (maxVectorTBitWidth >= 128)); 427Debug.Assert(supportedInstructionSets.HasInstructionSet(InstructionSet.ARM64_AdvSimd)); 428Debug.Assert((maxVectorTBitWidth == 0) || (maxVectorTBitWidth >= 128));
src\runtime\src\coreclr\tools\Common\Compiler\Int128FieldLayoutAlgorithm.cs (7)
8using Debug = System.Diagnostics.Debug; 26Debug.Assert(IsIntegerType(defType)); 29Debug.Assert((name == "Int128") || (name == "UInt128")); 62Debug.Assert(!_fallbackAlgorithm.ComputeContainsGCPointers(type)); 68Debug.Assert(!_fallbackAlgorithm.ComputeContainsByRefs(type)); 74Debug.Assert(!_fallbackAlgorithm.ComputeIsUnsafeValueType(type)); 80Debug.Assert(_fallbackAlgorithm.ComputeValueTypeShapeCharacteristics(type) == ValueTypeShapeCharacteristics.None);
src\runtime\src\coreclr\tools\Common\Compiler\MethodExtensions.cs (1)
10using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Compiler\NativeAotNameMangler.cs (2)
31Debug.Assert(!_compilationUnitPrefix.IsNull); 158Debug.Assert(b);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectDataInterner.cs (2)
8using Debug = System.Diagnostics.Debug; 38Debug.Assert(factory.MarkingComplete);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\CoffObjectWriter.cs (7)
164Debug.Assert(alignment > 0 && BitOperations.IsPow2((uint)alignment)); 429Debug.Assert(section.Header.VirtualAddress == 0); 450Debug.Assert(outputFileStream.Position == section.Header.PointerToRawData); 474Debug.Assert(outputFileStream.Position == coffHeader.PointerToSymbolTable); 566Debug.Assert(SizeOfOptionalHeader == 0); 567Debug.Assert(Characteristics == 0); 792Debug.Assert(SectionIndex == uint.MaxValue || SectionIndex < ushort.MaxValue);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\Eabi\EabiAttributesBuilder.cs (6)
39Debug.Assert(_sectionSize is null); 40Debug.Assert(_subsectionSize is null); 57Debug.Assert(_sectionSize is not null); 58Debug.Assert(_subsectionSize is not null); 69Debug.Assert(_subsectionSize is not null); 77Debug.Assert(_subsectionSize is not null);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ElfObjectWriter.cs (2)
227Debug.Assert(addend >= short.MinValue && addend <= short.MaxValue); 394Debug.Fail("Unsupported architecture");
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\MachObjectWriter.cs (11)
391Debug.Assert(BitOperations.IsPow2(alignment)); 456Debug.Assert(IsSectionSymbolName(symbolName)); 457Debug.Assert(relocType == IMAGE_REL_BASED_DIR64); 485Debug.Assert(!section.IsExecutable, "Executable sections cannot contain RELPTR32 relocations on Mach-O."); 489Debug.Assert(!section.IsZeroFill, "Uninitialized sections cannot contain RELPTR32 relocations on Mach-O."); 677Debug.Assert(FitsInSigned20Bits(inlineAddend), "The RELPTR32 addend cannot fit in ld-prime's signed 20-bit inline encoding."); 818Debug.Assert(_symbolNameToIndex.ContainsKey(_baseSymbolName.Value)); 971Debug.Assert(_symbolNameToIndex.ContainsKey(_baseSymbolName.Value)); 1058Debug.Assert(encoded); 1142Debug.Assert(encoded); 1144Debug.Assert(encoded);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ObjectWriter.cs (7)
421Debug.Assert(codeNode.Signature != null, $"Wasm code node {codeNode.GetType()} has null signature"); 432Debug.Assert(((ulong)thumbBit & (ulong)(uint)n.Offset) == 0); 486Debug.Assert(reloc.Offset % _nodeFactory.Target.PointerSize == 0); 489Debug.Assert(!hasPointerRelocs || (nodeContents.Alignment % _nodeFactory.Target.PointerSize) == 0); 622Debug.Assert(LayoutMode == CodeDataLayout.Separate); 627Debug.Assert(LayoutMode == CodeDataLayout.Separate); 729Debug.Assert(b);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (3)
684Debug.Assert(writer.SectionIndex == _sections.Count - 1, "The .reloc section must be the last section we emit."); 725Debug.Assert(DosHeader.Length == DosHeaderSize); 828Debug.Assert(outputFileStream.Position <= section.Header.PointerToRawData);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\UnixObjectWriter.cs (1)
13using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\Wasm\WasmDataSection.cs (3)
47Debug.Assert(headerBuffer.Slice(1).Length == Relocation.WASM_PADDED_RELOC_SIZE_32); 49Debug.Assert((int)readCheck == ContentSize); 93Debug.Assert(wroteHeaderSize == HeaderSize);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\Wasm\WasmDataSegment.cs (4)
71Debug.Assert(_paddingSet); 88Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32); 97Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32, $"{headerBuffer.Slice(len).Length} != {Relocation.WASM_PADDED_RELOC_SIZE_32}"); 111Debug.Assert(headerSize == HeaderSize);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\Wasm\WasmSection.cs (2)
33Debug.Assert(_dataStream != null, $"{this.Name} has null data stream"); 39Debug.Assert(value != null);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\Wasm\WasmSections.cs (1)
24Debug.Assert(_sections.Count == sectionIndex);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmInstructions.cs (16)
220Debug.Assert(adjustSize == encodeSizeExpected); 257Debug.Assert(relocsEncoded == expr.EncodeRelocationCount()); 292Debug.Assert(buffer.Length >= EncodeRelocationCount()); 345Debug.Assert(buffer.Length >= relocSize); 519Debug.Assert(localIndex >= 0); 520Debug.Assert(kind.IsLocalVarExpr()); 544Debug.Assert(globalIndex >= 0); 545Debug.Assert(kind.IsGlobalVarExpr()); 567Debug.Assert(kind.IsBinaryExpr()); 591Debug.Assert(dstMemoryIndex >= 0); 592Debug.Assert(srcMemoryIndex >= 0); 623Debug.Assert(memoryIndex >= 0); 650Debug.Assert(dataSegmentIndex >= 0); 651Debug.Assert(memoryIndex >= 0); 682Debug.Assert(tableIndex >= 0); 683Debug.Assert(elemIndex >= 0);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmObjectWriter.cs (29)
92Debug.Assert(added, 189Debug.Assert(bytesWritten == encodeSize); 280Debug.Assert(section != null || alignment == 1, $"Section: {sectionIndex} is not a WebcilSection but alignment {alignment} requested"); 422Debug.Assert(BitOperations.IsPow2(webcilSection.MinAlignment) && BitOperations.IsPow2(WebcilSectionAlignment) && 456Debug.Assert(peCliHeaderRva != 0); 462Debug.Assert(peDebugRva != 0); 469Debug.Assert(webcilSections.Length > 0); 470Debug.Assert(webcilSections[webcilSections.Length - 1].Name.ToString() == "reloc"); 520Debug.Assert(_sections.Sections.Count == sectionIndex); 537Debug.Assert(MethodCount == totalMethodCount); 560Debug.Assert(added, $"Duplicate global name: {name}"); 565Debug.Assert(written == size); 618Debug.Assert(writer.SectionIndex == _sections.Count - 1, "The .reloc section must be the last section we emit."); 648Debug.Assert(outputFileStream.CanSeek, $"EmitObjectFile requires seekable output stream"); 724Debug.Assert(section.Header.SizeOfRawData - bytesWritten == section.Padding, $"Unexpected padding: {section.Header.SizeOfRawData - bytesWritten} != {section.Padding}"); 742Debug.Assert(webcilStream.Position == _webcilSegment.GetFlatMappedSize(), $"Total Size Mismatch: {webcilStream.Position} != {_webcilSegment.GetFlatMappedSize()}"); 791Debug.Assert(_sections[sectionIndex] is WebcilSection); 825Debug.Assert(_sections[pending.SectionIndex] is WebcilSection); 827Debug.Assert(pending.Offset >= 0, "Pending base relocation has a negative offset."); 833Debug.Assert(targetRva != 0); // this section should have been assigned a non-zero VirtualAddress at this point. 870Debug.Assert(curSectionAsWebcil is null || sectionStart != 0); 887Debug.Assert(IsWithinSection(virtualRelocOffset, curSectionAsWebcil)); 901Debug.Assert(IsWithinSection(virtualSymbolImageOffset, symbolWebcilSection)); 939Debug.Assert(symbolWebcilSection != null); 943Debug.Assert(symbolWebcilSection != null); 948Debug.Assert(symbolWebcilSection != null); 952Debug.Assert(symbolWebcilSection != null); 993Debug.Assert(symbol.IndexSpace == WasmIndexSpace.Tag); 1088Debug.Assert(_definedGlobals.ContainsKey("webcilVersion"));
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmSymbolManager.cs (3)
65Debug.Assert(!_importsFrozen[indexSpace]); 67Debug.Assert(!expectedIndex.HasValue || expectedIndex.Value == ordinal); 137Debug.Assert((uint)indexSpace < (uint)WasmIndexSpace.Count);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WebcilEncoder.cs (1)
33Debug.Assert(size == 28);
src\runtime\src\coreclr\tools\Common\Compiler\ProcessLinkerXmlBase.cs (5)
165Debug.Assert(_owningModule != null); 173Debug.Assert(!processAllAssemblies); 174Debug.Assert(_owningModule != null); 185Debug.Assert(!processAllAssemblies); 787Debug.Assert(!string.IsNullOrEmpty(fullName));
src\runtime\src\coreclr\tools\Common\Compiler\PseudoDescExtensions.cs (1)
7using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\Compiler\TypeExtensions.cs (14)
9using Debug = System.Diagnostics.Debug; 23Debug.Assert(type.IsArray, "IsSealed on a type with no virtual methods?"); 213Debug.Assert(inst1.Length == inst2.Length); 262Debug.Assert(ta.IsDefType); 263Debug.Assert(tb.IsDefType); 337Debug.Assert(ta != null); 344Debug.Assert(ta.IsArray && tb.IsArray && ta != tb); 354Debug.Assert(taElem != tbElem); 544Debug.Assert(!method.OwningType.IsInterface); 550Debug.Assert(potentialMatchingInterfaces != 0); 555Debug.Assert(interfaceType.HasInstantiation); 641Debug.Assert(method.Signature.IsStatic); 645Debug.Assert(method != null); 795Debug.Assert(interfaceType.IsInterface);
src\runtime\src\coreclr\tools\Common\Compiler\TypeMapMetadata.cs (2)
292Debug.Assert(assemblyTargetsMode == TypeMapAssemblyTargetsMode.Traverse, "We should only have pending maps with target modules when we're traversing for type map groups, as opposed to just recording targets."); 387Debug.Fail($"Unexpected TypeMapAttributeKind: {attrKind}");
src\runtime\src\coreclr\tools\Common\Compiler\VectorFieldLayoutAlgorithm.cs (6)
8using Debug = System.Diagnostics.Debug; 26Debug.Assert(IsVectorType(defType)); 79Debug.Assert(defType.Name == "Vector512`1"u8); 131Debug.Assert(!_fallbackAlgorithm.ComputeContainsGCPointers(type)); 137Debug.Assert(!_fallbackAlgorithm.ComputeContainsByRefs(type)); 143Debug.Assert(!_fallbackAlgorithm.ComputeIsUnsafeValueType(type));
src\runtime\src\coreclr\tools\Common\Compiler\Win32Resources\ResourceData.cs (1)
195Debug.Assert(dataBuilder.CountBytes == 0);
src\runtime\src\coreclr\tools\Common\Compiler\Win32Resources\ResourceData.UpdateResourceDataModel.cs (4)
30Debug.Assert(type is string); 50Debug.Assert(name is string); 71Debug.Assert(type is string); 86Debug.Assert(name is string);
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatWriter.cs (19)
39Debug.Assert(_offset >= 0); 72Debug.Assert(vertex._offset == Vertex.NotPlaced); 83Debug.Assert(vertex._offset == Vertex.Placed); 241Debug.Assert(val._offset != Vertex.NotPlaced); 330Debug.Assert(vertex._offset == GetCurrentOffset()); 379Debug.Assert(vertex._offset == GetCurrentOffset()); 406Debug.Assert(vertex._offset == Vertex.NotPlaced); 922Debug.Assert(args != null && args.Length > 0); 924Debug.Assert(fptrReferenceId == 0); 1316Debug.Assert(bounds != null && lowerBounds != null); 1575Debug.Assert(writer.GetCurrentOffset() > existingOffset); 1658Debug.Assert(delta >= 0); 1731Debug.Assert(pop == tree); 1740Debug.Assert(pop == second); 1744Debug.Assert(pop == tree); 1757Debug.Assert(pop == tree); 1814Debug.Assert(offset >= 0); 1915Debug.Assert(_nBuckets == 0); 2013Debug.Assert(iEntry == nEntries);
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatWriter.Primitives.cs (2)
168Debug.Assert(offset < _size); 181Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\Internal\Runtime\RiscVLoongArch64FpStruct.cs (30)
61Debug.Assert(index < 2); 63Debug.Assert(size == sizeof(float) || size == sizeof(double)); 65Debug.Assert(size >= 1 && size <= 8); 66Debug.Assert((size & (size - 1)) == 0, "size needs to be a power of 2"); 72Debug.Assert((int)PosIntFloat == (int)PosFloatInt + 1, "FloatInt and IntFloat need to be adjacent"); 73Debug.Assert((int)PosSizeShift2nd == (int)PosSizeShift1st + 2, "SizeShift1st and 2nd need to be adjacent"); 87Debug.Assert(nElements == 1, "HasImpliedRepeatedFields must have returned a false, it can't be an array"); 91Debug.Assert(nFlattenedFieldsPerElement == 1 || nFlattenedFieldsPerElement == 2); 101Debug.Assert(elementTypeIndex == 0); 102Debug.Assert(typeIndex == 1); 105Debug.Assert((int)FpStruct.IntFloat == ((int)FpStruct.FloatInt << 1), 107Debug.Assert((int)FpStruct.SizeShift2ndMask == ((int)FpStruct.SizeShift1stMask << 2), 115Debug.Assert(info.Size1st() == info.Size2nd()); 176Debug.Assert(nFields == 1); 182Debug.Assert(nElements > 0, "InlineArray length must be > 0"); 196Debug.Assert(arch is TargetArchitecture.RiscV64 or TargetArchitecture.LoongArch64); 209Debug.Assert(nFields == 1 || nFields == 2); 221Debug.Assert((info.flags & (OnlyOne | BothFloat)) == 0); 222Debug.Assert((info.flags & FloatInt) == 0 || info.Size1st() == sizeof(float) || info.Size1st() == sizeof(double)); 223Debug.Assert((info.flags & IntFloat) == 0 || info.Size2nd() == sizeof(float) || info.Size2nd() == sizeof(double)); 227Debug.Assert(nFields == 2); 232Debug.Assert((info.flags & FloatInt) != 0); 233Debug.Assert((info.flags & (IntFloat | SizeShift2ndMask)) == 0); 234Debug.Assert(info.offset2nd == 0); 237Debug.Assert(nFields == ((info.flags & OnlyOne) != 0 ? 1 : 2)); 239Debug.Assert(floatFlags != 0); 240Debug.Assert(((uint)floatFlags & ((uint)floatFlags - 1)) == 0, 246Debug.Assert(end1st <= info.offset2nd || end2nd <= info.offset1st, "fields must not overlap"); 248Debug.Assert(info.offset1st + info.Size1st() <= td.GetElementSize().AsInt); 249Debug.Assert(info.offset2nd + info.Size2nd() <= td.GetElementSize().AsInt);
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8StringBuilder.cs (3)
36Debug.Assert(newLength <= _length); 61Debug.Assert(Ascii.IsValid(value)); 71Debug.Assert(Ascii.IsValid(value), "Non-ASCII character detected");
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (75)
137Debug.Assert(_this is CorInfoImpl); 427Debug.Assert(codeSize != 0); 473Debug.Assert(clause.TryLength >= clause.TryOffset); 474Debug.Assert(clause.HandlerLength >= clause.HandlerOffset); 550Debug.Assert(_stashedPrecodeFixups.Count == 0); 576Debug.Assert(_compilation.NodeFactory.InstrumentationDataTable != null, "Expected InstrumentationDataTable to be non-null with synthesized PGO data to embed"); 745Debug.Assert(obj is not MethodILScope); 765Debug.Assert(handle != null); 976Debug.Assert((CorInfoType)TypeFlags.Void == CorInfoType.CORINFO_TYPE_VOID); 977Debug.Assert((CorInfoType)TypeFlags.Double == CorInfoType.CORINFO_TYPE_DOUBLE); 1090Debug.Assert(!method.Signature.IsStatic); 1288Debug.Assert(type.HasSameTypeDefinition(method.OwningType)); 1311Debug.Assert(method.GetTypicalMethodDefinition() == methodFromCtx.GetTypicalMethodDefinition()); 1439Debug.Assert(ownerTypeDesc is InstantiatedType); 1458Debug.Assert(info->detail != CORINFO_DEVIRTUALIZATION_DETAIL.CORINFO_DEVIRTUALIZATION_UNKNOWN); 1661Debug.Assert(false); // This should never happen, but we protect against total failure with the throw below. 1739Debug.Assert(sig != null); 1757Debug.Assert(methodDesc.IsUnmanagedCallersOnly); 1869Debug.Assert(typeContext.HasSameTypeDefinition(owningMethod.OwningType) || typeContext.IsArray); 1881Debug.Assert((methodContext.HasInstantiation && !owningMethod.HasInstantiation) || 1885Debug.Assert(methodContext.OwningType.HasSameTypeDefinition(owningMethod.OwningType)); 1932Debug.Assert(((MethodDesc)result).IsRuntimeDeterminedExactMethod); 1941Debug.Assert(((FieldDesc)result).OwningType.IsRuntimeDeterminedSubtype); 1951Debug.Assert(((TypeDesc)result).IsRuntimeDeterminedSubtype || 1999Debug.Assert(!strippedInstantiation); 2059Debug.Assert(!strippedInstantiation); 2158Debug.Assert(size >= 0); 2159Debug.Assert(startIndex >= 0); 2175Debug.Assert(handle != null); 2406Debug.Assert(!type.IsValueType); 2407Debug.Assert(type.IsDefType); 2408Debug.Assert(!type.IsString); 2410Debug.Assert(_compilation.IsInheritanceChainLayoutFixedInCurrentVersionBubble(type)); 2420Debug.Assert(!type.IsValueType); 2421Debug.Assert(type.IsDefType); 2539Debug.Assert(*gcPtrs == (byte)gcType); 2582Debug.Assert(field.Offset.AsInt % PointerSize == 0); 2598Debug.Assert(field.Offset.AsInt == 0); 2782Debug.Assert(fd.Offset != FieldAndOffset.InvalidOffset); 2788Debug.Assert(fieldType is MetadataType); 2916Debug.Assert(fd == null || fd.IsStatic); 2985Debug.Assert(!typeToInit.IsBeforeFieldInit); 3259Debug.Assert(!type.IsGenericParameter); 3266Debug.Assert(cls != null); 3274Debug.Assert(!type.IsGenericParameter); 3416Debug.Assert(fieldDesc.Offset != FieldAndOffset.InvalidOffset); 3423Debug.Assert(field.IsIntrinsic); 3577Debug.Fail("CorInfoImpl.runWithErrorTrap should not be called"); 3587Debug.Fail("CorInfoImpl.runWithSPMIErrorTrap should not be called"); 3672Debug.Assert(caller.SupportsAsyncVersionCodegen()); 3751Debug.Assert(awaitAwaiterMethod.Instantiation.Length == 1); 3819Debug.Assert(objRefsSize == (dataSize + (nuint)(PointerSize - 1)) / (nuint)PointerSize); 3999Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 0 * 2 == (int)CorInfoType.CORINFO_TYPE_BYTE); 4000Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 1 * 2 == (int)CorInfoType.CORINFO_TYPE_SHORT); 4001Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 2 * 2 == (int)CorInfoType.CORINFO_TYPE_INT); 4002Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 3 * 2 == (int)CorInfoType.CORINFO_TYPE_LONG); 4130Debug.Assert(method.AcquiresInstMethodTableFromThis()); 4275Debug.Assert(chunk.alignment == 1); 4320Debug.Assert(offset <= roDataSize); 4345Debug.Assert(offset <= rwDataSize); 4377Debug.Assert(FrameInfoFlags.Filter == (FrameInfoFlags)CorJitFuncKind.CORJIT_FUNC_FILTER); 4378Debug.Assert(FrameInfoFlags.Handler == (FrameInfoFlags)CorJitFuncKind.CORJIT_FUNC_HANDLER); 4606Debug.Assert(locationBlock != BlockType.Unknown, "BlockType.Unknown not expected"); 4634Debug.Assert(_methodColdCodeNode != null); 4739Debug.Assert(!field.IsStatic); 4803Debug.Assert(InstructionSet.X86_X86Base == InstructionSet.X64_X86Base); 4804Debug.Assert(_compilation.InstructionSetSupport.IsInstructionSetSupported(InstructionSet.X86_X86Base)); 4808Debug.Assert(_compilation.InstructionSetSupport.IsInstructionSetSupported(InstructionSet.ARM64_AdvSimd)); 4902Debug.Assert((bwInstrumentationData.BaseStream.Position % 8) == 0); 5018Debug.Assert(!_compilation.InstructionSetSupport.NonSpecifiableFlags.HasInstructionSet(instructionSet)); 5092Debug.Assert(buffer != null); 5093Debug.Assert(bufferSize > 0); 5094Debug.Assert(valueOffset >= 0); 5095Debug.Assert(field.IsStatic); 5096Debug.Assert(field.HasRva);
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoTypes.cs (1)
274Debug.Assert(sizeof(CORINFO_RUNTIME_LOOKUP) >= sizeof(CORINFO_CONST_LOOKUP));
src\runtime\src\coreclr\tools\Common\JitInterface\JitConfigProvider.cs (1)
24Debug.Assert(s_instance != null);
src\runtime\src\coreclr\tools\Common\JitInterface\JitTypeNameFormatter.cs (2)
35Debug.Fail("Unexpected signature type variable in JitTypeNameFormatter"); 40Debug.Fail("Unexpected signature method variable in JitTypeNameFormatter");
src\runtime\src\coreclr\tools\Common\JitInterface\SwiftPhysicalLowering.cs (3)
89Debug.Assert(PointerSize == 8, "Swift interop is only supported on 64-bit platforms."); 96Debug.Assert(fieldType.IsPrimitiveNumeric); 217Debug.Fail("Non-unmanaged types should not be passed directly to a Swift function.");
src\runtime\src\coreclr\tools\Common\JitInterface\SystemVStructClassificator.cs (25)
87Debug.Assert(structPassInRegDescPtr.eightByteCount <= CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS); 136Debug.Fail($"Type {typeDesc} with unexpected category {typeDesc.Category}"); 147Debug.Assert((newFieldClassification == SystemVClassificationTypeInteger) || 156Debug.Assert((originalClassification == SystemVClassificationTypeInteger) || 163Debug.Assert((originalClassification == SystemVClassificationTypeInteger) || 177Debug.Assert(originalClassification == SystemVClassificationTypeIntegerReference); 182Debug.Assert(originalClassification == SystemVClassificationTypeIntegerByRef); 186Debug.Assert(false); // Unexpected type. 233Debug.Assert(mdType != null); 253Debug.Assert(fieldIndex < numIntroducedFields); 263Debug.Fail("Invalid struct size. The size of fields and overall size don't agree"); 328Debug.Assert(helper.FieldClassifications[helper.CurrentUniqueOffsetField] == SystemVClassificationTypeNoClass); 331Debug.Assert((fieldClassificationType == SystemVClassificationTypeInteger) || 340Debug.Assert(helper.CurrentUniqueOffsetField < SYSTEMV_MAX_NUM_FIELDS_IN_REGISTER_PASSED_STRUCT); 355Debug.Assert(CLR_SYSTEMV_MAX_BYTES_TO_PASS_IN_REGISTERS == SYSTEMV_MAX_NUM_FIELDS_IN_REGISTER_PASSED_STRUCT); 360Debug.Assert(largestFieldOffset != -1); 374Debug.Assert(helper.FieldOffsets[i] < CLR_SYSTEMV_MAX_BYTES_TO_PASS_IN_REGISTERS); 375Debug.Assert(sortedFieldOrder[helper.FieldOffsets[i]] == -1); // we haven't seen this field offset yet. 384Debug.Assert(offsetAfterLastFieldByte <= helper.StructSize); 421Debug.Assert(fieldSize > 0); 424Debug.Assert(fieldClassificationType != SystemVClassificationTypeMemory && fieldClassificationType != SystemVClassificationTypeUnknown); 430Debug.Assert(fieldEndEightByte < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS); 447Debug.Assert((fieldClassificationType != SystemVClassificationTypeIntegerReference) && 503Debug.Assert(helper.EightByteCount <= CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS); 508Debug.Assert(helper.EightByteClassifications[i] != SystemVClassificationTypeNoClass);
src\runtime\src\coreclr\tools\Common\JitInterface\UnboxingMethodDesc.cs (2)
25Debug.Assert(wrappedMethod.OwningType.IsValueType); 26Debug.Assert(!wrappedMethod.Signature.IsStatic);
src\runtime\src\coreclr\tools\Common\JitInterface\WasmLowering.cs (9)
19Debug.Assert(signature.Context.GetWellKnownType(WellKnownType.String).GetMethod(".ctor"u8, signature) != null); 20Debug.Assert(signature.GenericParameterCount == 0); 21Debug.Assert(signature.Flags == 0); 137Debug.Assert(!isV128 || ((DefType)type).InstanceFieldAlignment.AsInt == 16, 232Debug.Assert(sig[pos] == 'S'); 258Debug.Assert(returnType is not null, $"No cached struct of size {structSize} for return type in signature '{sig}'"); 307Debug.Assert(emptyStruct is not null, "Encountered 'e' in signature but no empty struct was cached during lowering"); 315Debug.Assert(cachedStruct is not null, $"No cached struct of size {structSize} for parameter in signature '{sig}'"); 342Debug.Assert(roundtrippedStr.Equals(wasmSignature.SignatureString, StringComparison.Ordinal),
src\runtime\src\coreclr\tools\Common\Pgo\PgoFormat.cs (3)
425Debug.Assert(modifyMask != InstrumentationDataProcessingState.Done); 665Debug.Assert(PgoSchemaMergeComparer.Singleton.Compare(schema, mergedElem) == 0); 666Debug.Assert(PgoSchemaMergeComparer.Singleton.Equals(schema, mergedElem));
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (4)
6using Debug = System.Diagnostics.Debug; 73Debug.Assert(length > 0); 74Debug.Assert(newItems.Length >= offset + length); 92Debug.Assert(numItems >= 0);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (2)
10using Debug = System.Diagnostics.Debug; 57Debug.Assert(method.Signature.Length == 0 && method.Signature.IsStatic);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (2)
9using Debug = System.Diagnostics.Debug; 156Debug.Assert((currentOpcode >= ILOpcode.br && currentOpcode <= ILOpcode.blt_un)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\AsyncResumptionStub.cs (2)
11using Debug = System.Diagnostics.Debug; 24Debug.Assert(targetMethod.IsAsyncCall());
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\ComparerIntrinsics.cs (9)
10using Debug = System.Diagnostics.Debug; 54Debug.Assert(!methodBeingGenerated.IsTypicalMethodDefinition); 65Debug.Assert(comparerType != null); 135Debug.Assert(type.IsCanonicalSubtype(CanonicalFormKind.Any)); 179Debug.Assert(context.IsCanonicalDefinitionType(nullableType, CanonicalFormKind.Universal)); 232Debug.Assert(type.CanCastTo(interfaceType.MakeInstantiatedType(type))); 252Debug.Assert(type.IsValueType); 296Debug.Assert(fieldType.IsValueType); 342Debug.Assert(fieldType.IsValueType);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\InterlockedIntrinsics.cs (4)
8using Debug = System.Diagnostics.Debug; 23Debug.Assert(((MetadataType)method.OwningType).Name == "Interlocked"u8); 24Debug.Assert(!method.IsGenericMethodDefinition); 47Debug.Assert(size is 1 or 2 or 4 or 8);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\RuntimeHelpersIntrinsics.cs (2)
9using Debug = System.Diagnostics.Debug; 20Debug.Assert(((MetadataType)method.OwningType).Name == "RuntimeHelpers"u8);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\UnsafeIntrinsics.cs (7)
8using Debug = System.Diagnostics.Debug; 19Debug.Assert(((MetadataType)method.OwningType).Name == "Unsafe"u8); 101Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 2); 119Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 2); 139Debug.Assert(method.Signature.IsStatic && method.Signature.Length == (write ? 2 : 1)); 157Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 2); 212Debug.Assert(method.Signature.IsStatic && method.Signature.Length == 1);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\MarshalHelpers.cs (2)
5using Debug = System.Diagnostics.Debug; 120Debug.Assert(arrayType != null, "Expecting array");
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\IL\Marshaller.cs (17)
9using Debug = System.Diagnostics.Debug; 60Debug.Assert(_nativeType != null); 160Debug.Assert(false); 182Debug.Assert(false); 192Debug.Fail("Unexpectting setting value on non-byref arg"); 201Debug.Assert(false); 397Debug.Assert(parameterIndex == parameterMetadataArray.Length || i <= parameterMetadataArray[parameterIndex].Index); 407Debug.Assert(i == parameterMetadataArray[parameterIndex].Index); 448Debug.Assert(targetMethod.IsPInvoke); 467Debug.Assert(targetMethod.IsPInvoke); 631Debug.Assert(Return || IsHRSwappedRetVal); 937Debug.Assert(codeStream != null); 952Debug.Assert(codeStream != null); 1024Debug.Assert(Return); 1102Debug.Assert(ManagedType is ArrayType); 1112Debug.Assert(NativeType is PointerType); 1807Debug.Assert(_marshallerInstance is null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\UnmanagedCallingConventions.cs (8)
57Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl 60Debug.Assert(unmanagedCallconv != 0); 97Debug.Assert(method.IsUnmanagedCallersOnly); 104Debug.Assert(method.IsPInvoke); 114Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl 140Debug.Assert(delegateType.IsDelegate); 147Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl 257Debug.Assert(index == count);
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (1)
140Debug.Assert(hashCode == NameHashCode("System.Array`1"u8));
TypeSystem\Mutable\MutableModule.cs (4)
42Debug.Assert(_mutableModule.ModuleThatIsCurrentlyTheSourceOfNewReferences != null && 56Debug.Assert(index != -1); 64Debug.Assert(index != -1); 178Debug.Assert(handle == ExistingEntities[entry.Item2]);
TypeSystem\Mutable\MutableModule.Sorting.cs (2)
4using Debug = System.Diagnostics.Debug; 13Debug.Assert(this == other);
ILCompiler.RyuJit (249)
Compiler\DependencyAnalysis\MethodCodeNode.cs (13)
34Debug.Assert(!method.IsAbstract); 35Debug.Assert(!method.IsGenericMethodDefinition && !method.OwningType.IsGenericDefinition); 36Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method); 42Debug.Assert(_methodCode == null); 111Debug.Assert(IsSpecialUnboxingThunk); 134Debug.Assert(_frameInfos == null); 140Debug.Assert(_gcInfo == null); 146Debug.Assert(_ehInfo == null); 159Debug.Assert(_debugLocInfos == null); 165Debug.Assert(_debugVarInfos == null); 171Debug.Assert(_debugInfo == null); 177Debug.Assert(_localTypes == null); 183Debug.Assert(_debugEHClauseInfos == null);
Compiler\DependencyAnalysis\RyuJitNodeFactory.cs (3)
6using Debug = System.Diagnostics.Debug; 41Debug.Assert(!Internal.JitInterface.UnboxingMethodDescExtensions.IsUnboxingThunk(method)); 55Debug.Assert(!method.Signature.IsStatic);
JitInterface\CorInfoImpl.RyuJit.cs (56)
90Debug.Assert(expectedeetype == eetype); 119Debug.Assert(blobData.Length % 8 == 0); 168Debug.Assert(cfaRegister == spReg); 192Debug.Assert(cfaRegister == spReg); 193Debug.Assert(cfaOffset == 0); 196Debug.Assert(spOffset == 0); 268Debug.Assert(contextSource == GenericContextSource.ThisObject); 280Debug.Assert(callerHandle != null); 367Debug.Assert(pResolvedToken.token == 0 && pResolvedToken.tokenScope == null); 368Debug.Assert(MethodBeingCompiled.IsSharedByGenericInstantiations); 371Debug.Assert(typeToInitialize.IsCanonicalSubtype(CanonicalFormKind.Any)); 403Debug.Assert(targetMethod.IsVirtual && targetMethod.Signature.IsStatic 426Debug.Assert(directMethod.OwningType.IsValueType || directMethod.Signature.IsStatic); 427Debug.Assert(!forceRuntimeLookup); 454Debug.Assert(expectedTargetMethod.GetCanonMethodTarget(CanonicalFormKind.Specific) == targetMethod.GetCanonMethodTarget(CanonicalFormKind.Specific)); 831Debug.Assert(mangledName != null || methodDesc != null); 1018Debug.Assert(_debugLocInfos == null); 1075Debug.Assert(runtimeLookupKind == CORINFO_RUNTIME_LOOKUP_KIND.CORINFO_LOOKUP_METHODPARAM); 1124Debug.Assert(CorInfoHelpFunc.CORINFO_HELP_ISINSTANCEOFINTERFACE + delta 1126Debug.Assert(CorInfoHelpFunc.CORINFO_HELP_ISINSTANCEOFARRAY + delta 1128Debug.Assert(CorInfoHelpFunc.CORINFO_HELP_ISINSTANCEOFCLASS + delta 1141Debug.Assert(!type.IsString && !type.IsArray && !type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); 1166Debug.Assert(type.IsArray); 1273Debug.Assert(!methodAfterConstraintResolution.OwningType.IsInterface 1284Debug.Assert(method.OwningType.IsInterface); 1344Debug.Assert(targetMethod.IsVirtual && targetMethod.OwningType.IsInterface); 1411Debug.Assert(targetMethod.OwningType.GetTypeDefinition() == constrainedType.GetTypeDefinition()); 1425Debug.Assert(lookupMethod.GetCanonMethodTarget(CanonicalFormKind.Specific) == targetMethod.GetCanonMethodTarget(CanonicalFormKind.Specific)); 1447Debug.Assert((flags & CORINFO_CALLINFO_FLAGS.CORINFO_CALLINFO_LDFTN) != 0); 1527Debug.Assert(!forceUseRuntimeLookup); 1563Debug.Assert(targetMethod.OwningType.IsInterface && targetMethod.IsVirtual && constrainedType != null); 1571Debug.Assert(targetMethod.OwningType.IsInterface && targetMethod.IsVirtual && constrainedType != null); 1617Debug.Assert(pResult->codePointerOrStubLookup.lookupKind.needsRuntimeLookup); 1650Debug.Assert(pResult->codePointerOrStubLookup.lookupKind.needsRuntimeLookup); 1764Debug.Assert(md.OwningType == td); 1772Debug.Assert((pResolvedToken.tokenType & CorInfoTokenKind.CORINFO_TOKENKIND_Method) != 0); 1786Debug.Assert(pResolvedToken.tokenType == CorInfoTokenKind.CORINFO_TOKENKIND_Ldtoken); 1801Debug.Assert(fEmbedParent); 1809Debug.Assert(obj is FieldDesc); 1855Debug.Assert(pResult.compileTimeHandle != null); 1887Debug.Assert(!methodDesc.CanMethodBeInSealedVTable(_compilation.NodeFactory)); 1928Debug.Fail("Unexpected raw handle intrinsic"); 1984Debug.Assert(!IsPInvokeStubRequired(stub)); 2111Debug.Assert(((int)flags & ((int)CORINFO_ACCESS_FLAGS.CORINFO_ACCESS_GET | 2183Debug.Assert(contextMethod.RequiresInstMethodDescArg()); 2338Debug.Assert(!implClass.IsCanonicalSubtype(CanonicalFormKind.Any)); 2342Debug.Assert(index <= maxExactClasses); 2348Debug.Assert(fieldHandle != null); 2349Debug.Assert(buffer != null); 2350Debug.Assert(bufferSize > 0); 2351Debug.Assert(valueOffset >= 0); 2354Debug.Assert(field.IsStatic); 2426Debug.Assert(objPtr != null); 2427Debug.Assert(buffer != null); 2428Debug.Assert(bufferSize >= 0); 2429Debug.Assert(valueOffset >= 0);
src\runtime\src\coreclr\tools\aot\ILCompiler.ReadyToRun\Compiler\FileLayoutOptimizer.cs (1)
365Debug.Assert(components.SelectMany(l => l).OrderBy(i => i).SequenceEqual(Enumerable.Range(0, methodsToPlace.Count)));
src\runtime\src\coreclr\tools\aot\ILCompiler.ReadyToRun\Compiler\PettisHansenSort\PettisHansen.cs (9)
55Debug.Assert(phEdges[kvp.Key][i] == phEdges[i][kvp.Key]); 80Debug.Assert(phEdges[from][to] == phEdges[to][from]); 114Debug.Assert(wfl >= wff && wfl >= wlf && wfl >= wll); 123Debug.Assert(phEdges[loser].Count(e => unionFind.FindSet(e.Key) == winner) == 1); 134Debug.Assert(removed); 152Debug.Assert(unionFind.FindSet(i) == i && unionFind.FindSet(edge.Key) == edge.Key); 153Debug.Assert(phEdges[edge.Key][i] == phEdges[i][edge.Key]); 171Debug.Assert(components.SelectMany(l => l).OrderBy(i => i).SequenceEqual(Enumerable.Range(0, graph.Count))); 177Debug.Assert(component[0] > prev);
src\runtime\src\coreclr\tools\aot\ILCompiler.ReadyToRun\IBC\MIbcProfileParser.cs (1)
203Debug.Assert(mibcGroupName == "");
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmInstructions.cs (16)
220Debug.Assert(adjustSize == encodeSizeExpected); 257Debug.Assert(relocsEncoded == expr.EncodeRelocationCount()); 292Debug.Assert(buffer.Length >= EncodeRelocationCount()); 345Debug.Assert(buffer.Length >= relocSize); 519Debug.Assert(localIndex >= 0); 520Debug.Assert(kind.IsLocalVarExpr()); 544Debug.Assert(globalIndex >= 0); 545Debug.Assert(kind.IsGlobalVarExpr()); 567Debug.Assert(kind.IsBinaryExpr()); 591Debug.Assert(dstMemoryIndex >= 0); 592Debug.Assert(srcMemoryIndex >= 0); 623Debug.Assert(memoryIndex >= 0); 650Debug.Assert(dataSegmentIndex >= 0); 651Debug.Assert(memoryIndex >= 0); 682Debug.Assert(tableIndex >= 0); 683Debug.Assert(elemIndex >= 0);
src\runtime\src\coreclr\tools\Common\Internal\Runtime\RiscVLoongArch64FpStruct.cs (30)
61Debug.Assert(index < 2); 63Debug.Assert(size == sizeof(float) || size == sizeof(double)); 65Debug.Assert(size >= 1 && size <= 8); 66Debug.Assert((size & (size - 1)) == 0, "size needs to be a power of 2"); 72Debug.Assert((int)PosIntFloat == (int)PosFloatInt + 1, "FloatInt and IntFloat need to be adjacent"); 73Debug.Assert((int)PosSizeShift2nd == (int)PosSizeShift1st + 2, "SizeShift1st and 2nd need to be adjacent"); 87Debug.Assert(nElements == 1, "HasImpliedRepeatedFields must have returned a false, it can't be an array"); 91Debug.Assert(nFlattenedFieldsPerElement == 1 || nFlattenedFieldsPerElement == 2); 101Debug.Assert(elementTypeIndex == 0); 102Debug.Assert(typeIndex == 1); 105Debug.Assert((int)FpStruct.IntFloat == ((int)FpStruct.FloatInt << 1), 107Debug.Assert((int)FpStruct.SizeShift2ndMask == ((int)FpStruct.SizeShift1stMask << 2), 115Debug.Assert(info.Size1st() == info.Size2nd()); 176Debug.Assert(nFields == 1); 182Debug.Assert(nElements > 0, "InlineArray length must be > 0"); 196Debug.Assert(arch is TargetArchitecture.RiscV64 or TargetArchitecture.LoongArch64); 209Debug.Assert(nFields == 1 || nFields == 2); 221Debug.Assert((info.flags & (OnlyOne | BothFloat)) == 0); 222Debug.Assert((info.flags & FloatInt) == 0 || info.Size1st() == sizeof(float) || info.Size1st() == sizeof(double)); 223Debug.Assert((info.flags & IntFloat) == 0 || info.Size2nd() == sizeof(float) || info.Size2nd() == sizeof(double)); 227Debug.Assert(nFields == 2); 232Debug.Assert((info.flags & FloatInt) != 0); 233Debug.Assert((info.flags & (IntFloat | SizeShift2ndMask)) == 0); 234Debug.Assert(info.offset2nd == 0); 237Debug.Assert(nFields == ((info.flags & OnlyOne) != 0 ? 1 : 2)); 239Debug.Assert(floatFlags != 0); 240Debug.Assert(((uint)floatFlags & ((uint)floatFlags - 1)) == 0, 246Debug.Assert(end1st <= info.offset2nd || end2nd <= info.offset1st, "fields must not overlap"); 248Debug.Assert(info.offset1st + info.Size1st() <= td.GetElementSize().AsInt); 249Debug.Assert(info.offset2nd + info.Size2nd() <= td.GetElementSize().AsInt);
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (68)
137Debug.Assert(_this is CorInfoImpl); 427Debug.Assert(codeSize != 0); 473Debug.Assert(clause.TryLength >= clause.TryOffset); 474Debug.Assert(clause.HandlerLength >= clause.HandlerOffset); 745Debug.Assert(obj is not MethodILScope); 765Debug.Assert(handle != null); 976Debug.Assert((CorInfoType)TypeFlags.Void == CorInfoType.CORINFO_TYPE_VOID); 977Debug.Assert((CorInfoType)TypeFlags.Double == CorInfoType.CORINFO_TYPE_DOUBLE); 1090Debug.Assert(!method.Signature.IsStatic); 1288Debug.Assert(type.HasSameTypeDefinition(method.OwningType)); 1311Debug.Assert(method.GetTypicalMethodDefinition() == methodFromCtx.GetTypicalMethodDefinition()); 1439Debug.Assert(ownerTypeDesc is InstantiatedType); 1458Debug.Assert(info->detail != CORINFO_DEVIRTUALIZATION_DETAIL.CORINFO_DEVIRTUALIZATION_UNKNOWN); 1739Debug.Assert(sig != null); 1757Debug.Assert(methodDesc.IsUnmanagedCallersOnly); 1869Debug.Assert(typeContext.HasSameTypeDefinition(owningMethod.OwningType) || typeContext.IsArray); 1881Debug.Assert((methodContext.HasInstantiation && !owningMethod.HasInstantiation) || 1885Debug.Assert(methodContext.OwningType.HasSameTypeDefinition(owningMethod.OwningType)); 1932Debug.Assert(((MethodDesc)result).IsRuntimeDeterminedExactMethod); 1941Debug.Assert(((FieldDesc)result).OwningType.IsRuntimeDeterminedSubtype); 1951Debug.Assert(((TypeDesc)result).IsRuntimeDeterminedSubtype || 2158Debug.Assert(size >= 0); 2159Debug.Assert(startIndex >= 0); 2175Debug.Assert(handle != null); 2406Debug.Assert(!type.IsValueType); 2407Debug.Assert(type.IsDefType); 2408Debug.Assert(!type.IsString); 2420Debug.Assert(!type.IsValueType); 2421Debug.Assert(type.IsDefType); 2539Debug.Assert(*gcPtrs == (byte)gcType); 2582Debug.Assert(field.Offset.AsInt % PointerSize == 0); 2598Debug.Assert(field.Offset.AsInt == 0); 2782Debug.Assert(fd.Offset != FieldAndOffset.InvalidOffset); 2788Debug.Assert(fieldType is MetadataType); 2916Debug.Assert(fd == null || fd.IsStatic); 2985Debug.Assert(!typeToInit.IsBeforeFieldInit); 3259Debug.Assert(!type.IsGenericParameter); 3266Debug.Assert(cls != null); 3274Debug.Assert(!type.IsGenericParameter); 3416Debug.Assert(fieldDesc.Offset != FieldAndOffset.InvalidOffset); 3423Debug.Assert(field.IsIntrinsic); 3577Debug.Fail("CorInfoImpl.runWithErrorTrap should not be called"); 3587Debug.Fail("CorInfoImpl.runWithSPMIErrorTrap should not be called"); 3672Debug.Assert(caller.SupportsAsyncVersionCodegen()); 3751Debug.Assert(awaitAwaiterMethod.Instantiation.Length == 1); 3819Debug.Assert(objRefsSize == (dataSize + (nuint)(PointerSize - 1)) / (nuint)PointerSize); 3999Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 0 * 2 == (int)CorInfoType.CORINFO_TYPE_BYTE); 4000Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 1 * 2 == (int)CorInfoType.CORINFO_TYPE_SHORT); 4001Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 2 * 2 == (int)CorInfoType.CORINFO_TYPE_INT); 4002Debug.Assert((int)CorInfoType.CORINFO_TYPE_BYTE + 3 * 2 == (int)CorInfoType.CORINFO_TYPE_LONG); 4130Debug.Assert(method.AcquiresInstMethodTableFromThis()); 4275Debug.Assert(chunk.alignment == 1); 4320Debug.Assert(offset <= roDataSize); 4345Debug.Assert(offset <= rwDataSize); 4377Debug.Assert(FrameInfoFlags.Filter == (FrameInfoFlags)CorJitFuncKind.CORJIT_FUNC_FILTER); 4378Debug.Assert(FrameInfoFlags.Handler == (FrameInfoFlags)CorJitFuncKind.CORJIT_FUNC_HANDLER); 4606Debug.Assert(locationBlock != BlockType.Unknown, "BlockType.Unknown not expected"); 4739Debug.Assert(!field.IsStatic); 4803Debug.Assert(InstructionSet.X86_X86Base == InstructionSet.X64_X86Base); 4804Debug.Assert(_compilation.InstructionSetSupport.IsInstructionSetSupported(InstructionSet.X86_X86Base)); 4808Debug.Assert(_compilation.InstructionSetSupport.IsInstructionSetSupported(InstructionSet.ARM64_AdvSimd)); 4902Debug.Assert((bwInstrumentationData.BaseStream.Position % 8) == 0); 5084Debug.Assert(!_compilation.InstructionSetSupport.NonSpecifiableFlags.HasInstructionSet(instructionSet)); 5092Debug.Assert(buffer != null); 5093Debug.Assert(bufferSize > 0); 5094Debug.Assert(valueOffset >= 0); 5095Debug.Assert(field.IsStatic); 5096Debug.Assert(field.HasRva);
src\runtime\src\coreclr\tools\Common\JitInterface\JitConfigProvider.cs (1)
24Debug.Assert(s_instance != null);
src\runtime\src\coreclr\tools\Common\JitInterface\JitTypeNameFormatter.cs (2)
35Debug.Fail("Unexpected signature type variable in JitTypeNameFormatter"); 40Debug.Fail("Unexpected signature method variable in JitTypeNameFormatter");
src\runtime\src\coreclr\tools\Common\JitInterface\SwiftPhysicalLowering.cs (3)
89Debug.Assert(PointerSize == 8, "Swift interop is only supported on 64-bit platforms."); 96Debug.Assert(fieldType.IsPrimitiveNumeric); 217Debug.Fail("Non-unmanaged types should not be passed directly to a Swift function.");
src\runtime\src\coreclr\tools\Common\JitInterface\SystemVStructClassificator.cs (25)
87Debug.Assert(structPassInRegDescPtr.eightByteCount <= CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS); 136Debug.Fail($"Type {typeDesc} with unexpected category {typeDesc.Category}"); 147Debug.Assert((newFieldClassification == SystemVClassificationTypeInteger) || 156Debug.Assert((originalClassification == SystemVClassificationTypeInteger) || 163Debug.Assert((originalClassification == SystemVClassificationTypeInteger) || 177Debug.Assert(originalClassification == SystemVClassificationTypeIntegerReference); 182Debug.Assert(originalClassification == SystemVClassificationTypeIntegerByRef); 186Debug.Assert(false); // Unexpected type. 233Debug.Assert(mdType != null); 253Debug.Assert(fieldIndex < numIntroducedFields); 263Debug.Fail("Invalid struct size. The size of fields and overall size don't agree"); 328Debug.Assert(helper.FieldClassifications[helper.CurrentUniqueOffsetField] == SystemVClassificationTypeNoClass); 331Debug.Assert((fieldClassificationType == SystemVClassificationTypeInteger) || 340Debug.Assert(helper.CurrentUniqueOffsetField < SYSTEMV_MAX_NUM_FIELDS_IN_REGISTER_PASSED_STRUCT); 355Debug.Assert(CLR_SYSTEMV_MAX_BYTES_TO_PASS_IN_REGISTERS == SYSTEMV_MAX_NUM_FIELDS_IN_REGISTER_PASSED_STRUCT); 360Debug.Assert(largestFieldOffset != -1); 374Debug.Assert(helper.FieldOffsets[i] < CLR_SYSTEMV_MAX_BYTES_TO_PASS_IN_REGISTERS); 375Debug.Assert(sortedFieldOrder[helper.FieldOffsets[i]] == -1); // we haven't seen this field offset yet. 384Debug.Assert(offsetAfterLastFieldByte <= helper.StructSize); 421Debug.Assert(fieldSize > 0); 424Debug.Assert(fieldClassificationType != SystemVClassificationTypeMemory && fieldClassificationType != SystemVClassificationTypeUnknown); 430Debug.Assert(fieldEndEightByte < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS); 447Debug.Assert((fieldClassificationType != SystemVClassificationTypeIntegerReference) && 503Debug.Assert(helper.EightByteCount <= CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS); 508Debug.Assert(helper.EightByteClassifications[i] != SystemVClassificationTypeNoClass);
src\runtime\src\coreclr\tools\Common\JitInterface\UnboxingMethodDesc.cs (2)
25Debug.Assert(wrappedMethod.OwningType.IsValueType); 26Debug.Assert(!wrappedMethod.Signature.IsStatic);
src\runtime\src\coreclr\tools\Common\JitInterface\WasmLowering.cs (9)
19Debug.Assert(signature.Context.GetWellKnownType(WellKnownType.String).GetMethod(".ctor"u8, signature) != null); 20Debug.Assert(signature.GenericParameterCount == 0); 21Debug.Assert(signature.Flags == 0); 137Debug.Assert(!isV128 || ((DefType)type).InstanceFieldAlignment.AsInt == 16, 232Debug.Assert(sig[pos] == 'S'); 258Debug.Assert(returnType is not null, $"No cached struct of size {structSize} for return type in signature '{sig}'"); 307Debug.Assert(emptyStruct is not null, "Encountered 'e' in signature but no empty struct was cached during lowering"); 315Debug.Assert(cachedStruct is not null, $"No cached struct of size {structSize} for parameter in signature '{sig}'"); 342Debug.Assert(roundtrippedStr.Equals(wasmSignature.SignatureString, StringComparison.Ordinal),
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (4)
6using Debug = System.Diagnostics.Debug; 73Debug.Assert(length > 0); 74Debug.Assert(newItems.Length >= offset + length); 92Debug.Assert(numItems >= 0);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (2)
10using Debug = System.Diagnostics.Debug; 57Debug.Assert(method.Signature.Length == 0 && method.Signature.IsStatic);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (2)
9using Debug = System.Diagnostics.Debug; 156Debug.Assert((currentOpcode >= ILOpcode.br && currentOpcode <= ILOpcode.blt_un)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\TypeSystemThrowingILEmitter.cs (2)
8using Debug = System.Diagnostics.Debug; 78Debug.Assert(helper.Signature.Length == exception.Arguments.Count + 1);
ILCompiler.TypeSystem (310)
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (4)
6using Debug = System.Diagnostics.Debug; 73Debug.Assert(length > 0); 74Debug.Assert(newItems.Length >= offset + length); 92Debug.Assert(numItems >= 0);
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\CanonTypes.cs (2)
10using Debug = System.Diagnostics.Debug; 111Debug.Assert(kind == CanonicalFormKind.Specific);
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\CanonTypes.Metadata.cs (1)
10using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\CanonTypes.Sorting.cs (2)
4using Debug = System.Diagnostics.Debug; 14Debug.Assert(this == other);
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\GenericParameterDesc.Canon.cs (3)
4using Debug = System.Diagnostics.Debug; 13Debug.Fail("IsCanonicalSubtype of an indefinite type"); 19Debug.Fail("ConvertToCanonFormImpl for an indefinite type");
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\InstantiatedMethod.Canon.cs (5)
4using Debug = System.Diagnostics.Debug; 66Debug.Fail("Invalid CanonicalFormKind: " + kind); 76Debug.Assert(_specificCanonCache == null || _specificCanonCache == value); 81Debug.Assert(_universalCanonCache == null || _universalCanonCache == value); 86Debug.Fail("Invalid CanonicalFormKind: " + kind);
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\SignatureVariable.Canon.cs (5)
4using Debug = System.Diagnostics.Debug; 13Debug.Fail("IsCanonicalSubtype of an indefinite type"); 19Debug.Fail("ConvertToCanonFormImpl for an indefinite type"); 29Debug.Fail("IsCanonicalSubtype of an indefinite type"); 35Debug.Fail("ConvertToCanonFormImpl for an indefinite type");
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\StandardCanonicalizationAlgorithm.cs (2)
4using Debug = System.Diagnostics.Debug; 134Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\TypeDesc.Canon.cs (5)
4using Debug = System.Diagnostics.Debug; 29Debug.Fail("Invalid CanonicalFormKind: " + kind); 39Debug.Assert(_specificCanonCache == null || _specificCanonCache == value); 44Debug.Assert(_universalCanonCache == null || _universalCanonCache == value); 49Debug.Fail("Invalid CanonicalFormKind: " + kind);
src\runtime\src\coreclr\tools\Common\TypeSystem\Canon\TypeSystemContext.Canon.cs (2)
5using Debug = System.Diagnostics.Debug; 61Debug.Assert(kind == CanonicalFormKind.Universal);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\AlignmentHelper.cs (4)
4using Debug = System.Diagnostics.Debug; 12Debug.Assert(val >= 0 && alignment >= 0); 15Debug.Assert(0 == (alignment & (alignment - 1))); 17Debug.Assert(result >= val); // check for overflow
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\ArrayOfTRuntimeInterfacesAlgorithm.cs (3)
4using Debug = System.Diagnostics.Debug; 25Debug.Assert(!(arrayOfTType is InstantiatedType)); 31Debug.Assert(arrayType.IsSzArray);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\CastingHelper.cs (6)
4using Debug = System.Diagnostics.Debug; 122Debug.Assert(fn1Ttype.IsFunctionPointer && fn2Type.IsFunctionPointer); 252Debug.Assert(thisType.IsDefType); 393Debug.Assert(!type.IsEnum); 496Debug.Assert(instantiationThis.Length == instantiationTarget.Length && 526Debug.Assert(variance == GenericVariance.None);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\CastingHelper.TypeEquivalence.cs (4)
9using Debug = System.Diagnostics.Debug; 52Debug.Assert(thisType.IsDefType); 102Debug.Assert(type1.GetTypeDefinition() == type1); 103Debug.Assert(type2.GetTypeDefinition() == type2);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\ConstructedTypeRewritingHelpers.cs (2)
123Debug.Fail("Unknown form of type"); 175Debug.Assert(method is InstantiatedMethod);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\DefType.FieldLayout.cs (2)
534Debug.Assert(fieldAndOffset.Field.OwningType == this); 569Debug.Assert(fieldAndOffset.Field.OwningType == this);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\ExplicitLayoutValidator.cs (1)
68Debug.Fail("We should recurse on value types with GC pointers or byrefs");
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\FieldDesc.cs (2)
7using Debug = System.Diagnostics.Debug; 30Debug.Assert(o is not FieldDesc || ReferenceEquals(((FieldDesc)o).Context, this.Context));
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\FieldDesc.FieldLayout.cs (3)
27Debug.Assert(_offset != FieldAndOffset.InvalidOffset); 40Debug.Assert(IsStatic); 47Debug.Assert(_offset == FieldAndOffset.InvalidOffset || _offset == offset);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\FieldForInstantiatedType.cs (2)
8using Debug = System.Diagnostics.Debug; 22Debug.Assert(fieldDef.GetTypicalFieldDefinition() == fieldDef);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\FieldForInstantiatedType.FieldLayout.cs (1)
4using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\FieldLayoutIntervalCalculator.cs (4)
33Debug.Assert(Size >= 0); 76Debug.Fail(fieldType.ToString()); 238Debug.Assert(nextInterval.Start <= expandedInterval.EndSentinel); 268Debug.Assert(previousInterval.EndSentinel <= expandedInterval.Start);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\InstantiatedMethod.cs (2)
21Debug.Assert(!(methodDef is InstantiatedMethod)); 24Debug.Assert(instantiation.Length > 0);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\InstantiatedType.cs (3)
22Debug.Assert(!(typeDef is InstantiatedType)); 25Debug.Assert(instantiation.Length > 0); 220Debug.Assert(typeInHierarchy is InstantiatedType);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\LayoutInt.cs (3)
41Debug.Assert(output.IsIndeterminate); 153Debug.Assert(alignment._value <= target.MaximumAlignment); // Assert that the alignment handling for indeterminate types is safe 154Debug.Assert(alignment._value >= 1 || ((value._value == 0) && (alignment._value == 0))); // Alignment to less than one doesn't make sense, except for 0 to 0 alignment
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\MetadataFieldLayoutAlgorithm.cs (10)
5using Debug = System.Diagnostics.Debug; 126Debug.Assert(instanceField == null, "Unexpected extra instance field"); 131Debug.Assert(instanceField != null, "Null instance field"); 784Debug.Assert(fieldType.IsPrimitive || fieldType.IsPointer || fieldType.IsFunctionPointer || fieldType.IsEnum || fieldType.IsByRef); 854Debug.Assert(fieldType.IsPrimitive || fieldType.IsPointer || fieldType.IsFunctionPointer || fieldType.IsEnum || fieldType.IsByRef); 947Debug.Assert(instanceNonGCPointerFieldsCount[i] < instanceNonGCPointerFieldsArr[i].Length 1086Debug.Assert(size > 0); 1089Debug.Assert(0 == (size & (size - 1))); 1176Debug.Assert(fieldType.IsPointer || fieldType.IsFunctionPointer || fieldType.IsByRef); 1280Debug.Assert(type.IsValueType);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\MetadataTypeSystemContext.cs (3)
6using Debug = System.Diagnostics.Debug; 66Debug.Assert(s_wellKnownTypeNames[(int)WellKnownType.MulticastDelegate - 1] == "MulticastDelegate"); 86Debug.Assert(_wellKnownTypes != null, "Forgot to call SetSystemModule?");
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\MetadataVirtualMethodAlgorithm.cs (13)
28Debug.Assert(key.Context == value.Context); 34Debug.Assert(value1.Context == value2.Context); 311Debug.Assert(decl.OwningType.IsInterface); 340Debug.Assert(foundMethodImplsOnDefinition.Length == foundMethodImpls.Length); 347Debug.Assert(index >= 0); 445Debug.Assert(method.GetMethodDefinition() == method); 541Debug.Assert(unificationGroup.IsInGroupOrIsDefiningSlot(originalDefiningMethod)); 607Debug.Assert( 700Debug.Assert(!interfaceMethod.Signature.IsStatic); 773Debug.Assert(!interfaceMethod.Signature.IsStatic); 791Debug.Assert(implMethod != null); 1030Debug.Assert(candidatesCount < candidateInterfaces.Length); 1195Debug.Assert(interfaceMethod.Signature.IsStatic);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\MethodDesc.cs (3)
77Debug.Assert(parameters != null, "Parameters must not be null"); 477Debug.Assert(hashcode == ComputeHashCode()); 506Debug.Assert(o is not MethodDesc || ReferenceEquals(((MethodDesc)o).Context, this.Context));
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\MethodForInstantiatedType.cs (2)
8using Debug = System.Diagnostics.Debug; 21Debug.Assert(typicalMethodDef.GetTypicalMethodDefinition() == typicalMethodDef);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\SimpleArrayOfTRuntimeInterfacesAlgorithm.cs (1)
47Debug.Assert(arrayType.IsSzArray);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TargetDetails.cs (2)
5using Debug = System.Diagnostics.Debug; 349Debug.Assert(Architecture == TargetArchitecture.ARM ||
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\ThrowHelper.Common.cs (2)
6using Debug = System.Diagnostics.Debug; 72Debug.Fail("Multi-module assemblies");
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeDesc.cs (6)
29Debug.Assert(o is not TypeDesc || ReferenceEquals(((TypeDesc)o).Context, this.Context)); 37Debug.Assert(left is null || right is null || ReferenceEquals(left.Context, right.Context)); 44Debug.Assert(left is null || right is null || ReferenceEquals(left.Context, right.Context)); 142Debug.Assert((flags & mask) != 0); 411Debug.Assert((flags >= TypeFlags.Array && flags <= TypeFlags.Pointer) == (this is ParameterizedType)); 424Debug.Assert(GetTypeFlags(TypeFlags.CategoryMask) <= TypeFlags.Interface == this is DefType);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeDesc.TypeEquivalence.cs (3)
4using Debug = System.Diagnostics.Debug; 13Debug.Assert(scope != null); 14Debug.Assert(name != null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeSystemConstraintsHelpers.cs (1)
125Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeSystemContext.cs (5)
247Debug.Assert((signature.Flags & MethodSignatureFlags.UnmanagedCallingConventionMask) is 0 or MethodSignatureFlags.UnmanagedCallingConvention); 248Debug.Assert(!signature.HasEmbeddedSignatureData); 444Debug.Assert(!(methodDef is InstantiatedMethod)); 517Debug.Assert(!(typicalMethodDef is MethodForInstantiatedType)); 518Debug.Assert(!(typicalMethodDef is InstantiatedMethod));
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeSystemContext.Resolution.cs (1)
23Debug.Assert(SystemModule == null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeSystemHelpers.cs (11)
105Debug.Assert(instantiatedType.GetTypeDefinition() == methodTypicalDefinition.OwningType); 110Debug.Assert(method.OwningType.IsArray); 115Debug.Assert(type == methodTypicalDefinition.OwningType); 158Debug.Fail("method has no related type in the type hierarchy of type"); 233Debug.Assert(!type.HasInstantiation); 254Debug.Assert(field.GetTypicalFieldDefinition() == field); 273Debug.Assert(method.IsMethodDefinition && !method.HasInstantiation); 292Debug.Assert(interfaceMethodToResolve.OwningType.IsInterface); 312Debug.Assert(interfaceMethodToResolve.OwningType.IsInterface); 358Debug.Assert(thisType is DefType); 392Debug.Assert(isMethodImpl);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeWithRepeatedFields.cs (1)
59Debug.Assert(firstField is not null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\CustomAttributeTypeNameFormatter.cs (2)
7using Debug = System.Diagnostics.Debug; 142Debug.Assert(mdType.Module is IAssemblyDesc, "Multi-module?");
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\CustomAttributeTypeNameParser.cs (1)
134Debug.Fail("Expected to be unreachable");
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\GCPointerMap.Algorithm.cs (5)
5using Debug = System.Diagnostics.Debug; 16Debug.Assert(type.ContainsGCPointers); 89Debug.Assert(fieldType.IsValueType); 100Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.GCStaticFieldSize.AsInt); 138Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.ThreadGcStaticFieldSize.AsInt);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\GCPointerMap.cs (11)
7using Debug = System.Diagnostics.Debug; 90Debug.Assert(numCells <= gcFlags.Length << 5); 144Debug.Assert(Equals(other)); 190Debug.Assert(offset >= 0); 194Debug.Assert(absoluteOffset % _pointerSize == 0); 195Debug.Assert(absoluteOffset <= (_limit - _pointerSize)); 204Debug.Assert(offset >= 0); 208Debug.Assert(absoluteOffset + size <= _limit); 221Debug.Assert(_delta == 0); 249Debug.Assert(startBit >= 0 && numBits >= 0); 250Debug.Assert(startBit + numBits <= buffer.Length << 5);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\LockFreeReaderHashtable.cs (4)
9using Debug = System.Diagnostics.Debug; 160Debug.Assert(!foundAOne); 185Debug.Assert(hashTableLocal.Length > 0); 607Debug.Assert(hashTableLocal.Length > 0);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\TypeNameFormatter.cs (2)
6using Debug = System.Diagnostics.Debug; 42Debug.Assert(type.IsDefType);
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\CachingMetadataStringDecoder.cs (3)
5using Debug = System.Diagnostics.Debug; 39Debug.Assert((size & (size - 1)) == 0, "The cache size must be power of 2"); 109Debug.Assert((ascii[i] & 0x80) == 0, "The byte* input to this method must be valid ASCII.");
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\CustomAttributeTypeProvider.cs (4)
7using Debug = System.Diagnostics.Debug; 38Debug.Assert(reader == _module.MetadataReader); 44Debug.Assert(reader == _module.MetadataReader); 50Debug.Assert(reader == _module.MetadataReader);
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaField.cs (5)
141Debug.Assert(fieldType == FieldType); 198Debug.Assert((flags & mask) != 0); 202Debug.Assert((flags & mask) != 0); 322Debug.Assert(field.HasRva); 331Debug.Assert(field.HasRva);
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaGenericParameter.cs (4)
8using Debug = System.Diagnostics.Debug; 76Debug.Assert(parameter.Parent.Kind == HandleKind.TypeDefinition); 105Debug.Assert((int)GenericVariance.Contravariant == (int)GenericParameterAttributes.Contravariant); 115Debug.Assert((int)GenericConstraints.DefaultConstructorConstraint == (int)GenericParameterAttributes.DefaultConstructorConstraint);
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaMethod.cs (11)
214Debug.Assert((flags & mask) != 0); 509Debug.Assert((int)MethodImportAttributes.CallingConventionStdCall == (int)PInvokeAttributes.CallingConventionStdCall); 510Debug.Assert((int)MethodImportAttributes.CharSetAuto == (int)PInvokeAttributes.CharSetAuto); 511Debug.Assert((int)MethodImportAttributes.CharSetUnicode == (int)PInvokeAttributes.CharSetUnicode); 512Debug.Assert((int)MethodImportAttributes.SetLastError == (int)PInvokeAttributes.SetLastError); 568Debug.Assert((int)ParameterAttributes.In == (int)ParameterMetadataAttributes.In); 569Debug.Assert((int)ParameterAttributes.Out == (int)ParameterMetadataAttributes.Out); 570Debug.Assert((int)ParameterAttributes.Optional == (int)ParameterMetadataAttributes.Optional); 571Debug.Assert((int)ParameterAttributes.HasDefault == (int)ParameterMetadataAttributes.HasDefault); 572Debug.Assert((int)ParameterAttributes.HasFieldMarshal == (int)ParameterMetadataAttributes.HasFieldMarshal); 595Debug.Assert(marshalAs != null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaModule.cs (3)
14using Debug = System.Diagnostics.Debug; 498Debug.Assert(_metadataReader.GetFieldDefinition(handle).GetDeclaringType() == owningType.Handle); 508Debug.Assert(_metadataReader.GetMethodDefinition(handle).GetDeclaringType() == owningType.Handle);
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaModule.Sorting.cs (3)
7using Debug = System.Diagnostics.Debug; 31Debug.Assert(compare != 0); 39Debug.Assert(!StringComparer.Ordinal.Equals(thisName, otherName));
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaSignatureParser.cs (7)
363Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)SignatureCallingConvention.CDecl); 364Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionStdCall == (int)SignatureCallingConvention.StdCall); 365Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionThisCall == (int)SignatureCallingConvention.ThisCall); 366Debug.Assert((int)MethodSignatureFlags.CallingConventionVarargs == (int)SignatureCallingConvention.VarArgs); 367Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConvention == (int)SignatureCallingConvention.Unmanaged); 542Debug.Assert(_reader.RemainingBytes != 0); 651Debug.Assert(_reader.RemainingBytes == 0);
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaType.MethodImpls.cs (2)
10using Debug = System.Diagnostics.Debug; 97Debug.Fail("unexpected methodDeclHandleKind");
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\EcmaMethodIL.cs (1)
157Debug.Assert(method.IsTypicalMethodDefinition);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\HelperExtensions.cs (2)
10using Debug = System.Diagnostics.Debug; 57Debug.Assert(method.Signature.Length == 0 && method.Signature.IsStatic);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILDisassembler.cs (3)
10using Debug = System.Diagnostics.Debug; 181Debug.Assert(obj is string, "NYI: " + obj.GetType()); 610Debug.Assert(owningModule is IAssemblyDesc);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILOpcodeHelper.cs (4)
4using Debug = System.Diagnostics.Debug; 20Debug.Assert((uint)opcode < (uint)s_opcodeSizes.Length); 22Debug.Assert(result != VariableSize); 23Debug.Assert(result != Invalid);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILReader.cs (2)
9using Debug = System.Diagnostics.Debug; 156Debug.Assert((currentOpcode >= ILOpcode.br && currentOpcode <= ILOpcode.blt_un)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILStackHelper.cs (12)
71Debug.Assert(stackHeights[currentOffset] == StackHeightNotSet 171Debug.Assert(stackHeight > 0); 176Debug.Assert(stackHeight > 0); 230Debug.Assert(stackHeight >= adjustment); 233Debug.Assert(stackHeights[target] == StackHeightNotSet 271Debug.Assert(stackHeight >= adjustment); 282Debug.Assert(stackHeight == 0); 299Debug.Assert(stackHeight > 1); 314Debug.Assert(stackHeight > 2); 329Debug.Assert(stackHeight > 0); 400Debug.Assert(stackHeight > 0); 404Debug.Fail("Unknown instruction");
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILTokenReplacer.cs (1)
25Debug.Assert((offsetAfter - offsetBefore) == 5 || (offsetAfter - offsetBefore) == 6);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\InstantiatedMethodIL.cs (3)
6using Debug = System.Diagnostics.Debug; 19Debug.Assert(methodIL.GetMethodILDefinition() == methodIL); 20Debug.Assert(owningMethod.HasInstantiation || owningMethod.OwningType.HasInstantiation);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\ILEmitter.cs (20)
10using Debug = System.Diagnostics.Debug; 47Debug.Assert(_startOffsetForLinking != StartOffsetNotSet); 115Debug.Assert(index >= 0); 129Debug.Assert(index >= 0); 200Debug.Assert(opcode == ILOpcode.br || opcode == ILOpcode.brfalse || 286Debug.Fail("Unexpected TypeDesc category"); 335Debug.Fail("Unexpected TypeDesc category"); 385Debug.Fail("Unexpected TypeDesc category"); 435Debug.Fail("Unexpected TypeDesc category"); 447Debug.Assert(builder._beginTryStream == null); 454Debug.Assert(builder._endTryStream == null); 461Debug.Assert(builder._beginHandlerStream == null); 468Debug.Assert(builder._endHandlerStream == null); 479Debug.Assert(patch.Label.IsPlaced); 480Debug.Assert(_startOffsetForLinking != StartOffsetNotSet); 527Debug.Assert((exceptionRegionKind == ILExceptionRegionKind.Catch && catchExceptionType != null) 662Debug.Assert(IsPlaced); 673Debug.Assert(!IsPlaced); 705Debug.Assert(value != null); 818Debug.Assert(region.IsDefined);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\UnsafeAccessors.cs (16)
22Debug.Assert(method != null); 301Debug.Assert(dd.kind == EmbeddedSignatureDataKind.UnmanagedCallConv); 303Debug.Assert(tmp.Length == 2); 391Debug.Assert(declaration != null); 392Debug.Assert(targetType != null); 393Debug.Assert(targetMethod != null); 487Debug.Assert(targetMaybe is not null); 539Debug.Assert(!replacementType.IsValueType); 766Debug.Assert(context.TargetMethod != null); 770Debug.Assert(context.TargetMethod != null); 774Debug.Assert(context.TargetMethod != null); 778Debug.Assert(context.TargetField != null); 782Debug.Assert(context.TargetField != null); 786Debug.Fail("Unknown UnsafeAccessorKind"); 838Debug.Assert(result is SetTargetResult.Missing); 855Debug.Assert(thrower != null);
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\MarshalAsDescriptor.cs (2)
62Debug.Assert(Type == NativeTypeKind.CustomMarshaler, "Marshaller type can be set only when using for CustomMarshaller"); 71Debug.Assert(Type == NativeTypeKind.CustomMarshaler, "Cookie can be set only when using for CustomMarshaller");
src\runtime\src\coreclr\tools\Common\TypeSystem\Interop\MethodDesc.Interop.cs (1)
191System.Diagnostics.Debug.Fail("Unexpected Unmanaged Calling Convention.");
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\FunctionPointerType.RuntimeDetermined.cs (1)
4using Debug = System.Diagnostics.Debug;
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\GenericParameterDesc.RuntimeDetermined.cs (3)
4using Debug = System.Diagnostics.Debug; 14Debug.Fail("IsRuntimeDeterminedSubtype of an indefinite type"); 21Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\MethodForRuntimeDeterminedType.cs (1)
18Debug.Assert(typicalMethodDef.IsTypicalMethodDefinition);
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\RuntimeDeterminedCanonicalizationAlgorithm.cs (3)
4using Debug = System.Diagnostics.Debug; 118Debug.Assert(((RuntimeDeterminedType)typeToConvert).CanonicalType == context.UniversalCanonType); 145Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\RuntimeDeterminedType.cs (3)
9using Debug = System.Diagnostics.Debug; 164Debug.Assert((flags & mask) != 0); 202Debug.Assert(_runtimeDeterminedDetailsType.Kind == GenericParameterKind.Method);
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\RuntimeDeterminedTypeUtilities.cs (4)
4using Debug = System.Diagnostics.Debug; 12Debug.Assert(instantiation.Length == openInstantiation.Length); 30Debug.Assert(openInstantiation[instantiationIndex] is GenericParameterDesc); 34Debug.Assert(canonForm is DefType);
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\SignatureVariable.RuntimeDetermined.cs (3)
4using Debug = System.Diagnostics.Debug; 14Debug.Fail("IsRuntimeDeterminedSubtype of an indefinite type"); 21Debug.Assert(false);
src\runtime\src\coreclr\tools\Common\TypeSystem\RuntimeDetermined\TypeSystemContext.RuntimeDetermined.cs (2)
135Debug.Assert(!(typicalMethodDef is MethodForRuntimeDeterminedType)); 136Debug.Assert(typicalMethodDef.IsTypicalMethodDefinition);
src\runtime\src\coreclr\tools\Common\TypeSystem\Sorting\TypeSystemComparer.cs (12)
6using Debug = System.Diagnostics.Debug; 42Debug.Assert(x.GetType() == y.GetType()); 47Debug.Assert(result != 0); 53Debug.Assert(x.GetType() != y.GetType()); 60Debug.Assert(x.GetType() == y.GetType()); 68Debug.Assert(result != 0); 84Debug.Assert(x.GetType() == y.GetType()); 89Debug.Assert(result != 0); 95Debug.Assert(x.GetType() != y.GetType()); 111Debug.Assert(x.GetType() == y.GetType()); 116Debug.Assert(result != 0); 122Debug.Assert(x.GetType() != y.GetType());
src\runtime\src\libraries\Common\src\Internal\VersionResilientHashCode.cs (1)
140Debug.Assert(hashCode == NameHashCode("System.Array`1"u8));
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (6)
39Debug.Assert(value >= 0); 40Debug.Assert(value <= _chars.Length); 50Debug.Assert(capacity >= 0); 82Debug.Assert(index < _pos); 252Debug.Assert(additionalCapacityBeyondPos > 0); 253Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed.");
illink (215)
ILLink.RoslynAnalyzer (121)
DataFlow\ControlFlowGraphExtensions.cs (2)
18Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 25Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
DataFlow\ControlFlowGraphProxy.cs (2)
66Debug.Assert(region != null); 174Debug.Assert(enclosingRegion.Kind == ControlFlowRegionKind.TryAndCatch);
DataFlow\InterproceduralState.cs (1)
54Debug.Assert(!Methods.IsUnknown());
DataFlow\LocalDataFlowAnalysis.cs (2)
89Debug.Assert(Context.OwningSymbol is not IMethodSymbol methodSymbol || 98Debug.Assert(!oldInterproceduralState.Methods.IsUnknown());
DataFlow\LocalDataFlowVisitor.cs (24)
104Debug.Assert(OwningSymbol is IMethodSymbol or IFieldSymbol or IPropertySymbol, 112Debug.Assert(OwningSymbol is IMethodSymbol, 180Debug.Assert(assemblyType != null); 184Debug.Assert(method != null); 206Debug.Assert(local.ContainingSymbol is IMethodSymbol or IFieldSymbol, // backing field for property initializers 402Debug.Assert(targetOperation is not IFlowCaptureReferenceOperation); 487Debug.Assert(IsLValueFlowCapture(flowCaptureReference.Id)); 488Debug.Assert(flowCaptureReference.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Write)); 490Debug.Assert(!capturedReferences.IsUnknown()); 529Debug.Assert(addMethod != null); 537Debug.Assert(removeMethod != null); 546Debug.Assert(!IsLValueFlowCapture(operation.Id), 548Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Read), 568Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Write), 570Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Reference), 607Debug.Assert(operation.Value is not IFlowCaptureReferenceOperation); 631Debug.Assert(!capturedReferences.IsUnknown()); 683Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 740Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Read)); 755Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Reference)); 790Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Read)); 834Debug.Assert(operation.Symbol.ContainingSymbol is IMethodSymbol or IFieldSymbol); 836Debug.Assert(lambda.MethodKind == MethodKind.LambdaMethod); 975Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction);
DataFlow\LValueFlowCaptureProvider.cs (1)
86Debug.Assert(kind == FlowCaptureKind.LValueAndRValueCapture || !rvalueFlowCaptureIds.Contains(captureId), "Flow capture used as both an r-value and an l-value, but with incorrect flow capture kind");
DataFlow\MethodBodyValue.cs (2)
23Debug.Assert(owningSymbol is (IMethodSymbol or IFieldSymbol or IPropertySymbol)); 33Debug.Assert(ControlFlowGraph == other.ControlFlowGraph);
DynamicallyAccessedMembersAnalyzer.cs (1)
81Debug.Assert((int)first < (int)last);
IOperationExtensions.cs (2)
104Debug.Fail("Unhandled declaration pattern context"); 125Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\runtime\src\libraries\Common\src\System\Buffers\SearchValuesPolyfills.cs (1)
65Debug.Assert(_nonAscii.Length < 10, "Expected few non-ASCII characters at most.");
src\runtime\src\libraries\Common\src\System\HexConverter.cs (6)
189Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 206Debug.Assert(destination.Length >= (source.Length * 2)); 458Debug.Assert((utf8Source.Length % 2) == 0, "Un-even number of characters provided"); 459Debug.Assert((utf8Source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters"); 493Debug.Assert((source.Length % 2) == 0, "Un-even number of characters provided"); 494Debug.Assert((source.Length / 2) == destination.Length, "Target buffer not right-sized for provided characters");
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (1)
23Debug.Assert(name.Length != 0);
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (1)
66Debug.Assert(input.Length > 0);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (6)
39Debug.Assert(value >= 0); 40Debug.Assert(value <= _chars.Length); 50Debug.Assert(capacity >= 0); 82Debug.Assert(index < _pos); 252Debug.Assert(additionalCapacityBeyondPos > 0); 253Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed.");
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeName.cs (3)
231Debug.Fail("Pre-allocated full name should have been provided in the ctor"); 345Debug.Assert(_fullName is not null); 391Debug.Assert(rootTypeName._fullName is not null);
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParser.cs (2)
64Debug.Assert(parsedName.GetNodeCount() == recursiveDepth, $"Node count mismatch for '{typeName.ToString()}'"); 275Debug.Assert(nestedNameLength > 0, "TryGetTypeNameInfo should return error on zero lengths");
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParserHelpers.cs (7)
180Debug.Assert(rankOrModifier >= 2); 360Debug.Fail("Expected to be unreachable"); 371Debug.Fail("Expected to be unreachable"); 382Debug.Fail("Expected to be unreachable"); 393Debug.Fail("Expected to be unreachable"); 404Debug.Fail("Expected to be unreachable"); 415Debug.Fail("Expected to be unreachable");
src\runtime\src\tools\illink\src\ILLink.Shared\Annotations.cs (1)
54Debug.Assert(memberTypes != DynamicallyAccessedMemberTypes.None);
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\CompilerGeneratedNames.cs (1)
180Debug.Assert(ch < 0x80);
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\ForwardDataFlowAnalysis.cs (9)
70Debug.Assert(entryOut != null); 202Debug.Assert(successor.ConditionKind is ConditionKind.WhenTrue or ConditionKind.WhenFalse); 325Debug.Assert(isPredecessorInFinally); 393Debug.Assert(result); 405Debug.Assert(exceptionState != null); 406Debug.Assert(oldExceptionState != null); 413Debug.Assert(enclosingTryOrCatch.Kind != RegionKind.Filter); 445Debug.Assert(finallyExit != null); 448Debug.Assert(finallyExit.Value.ConditionKind == ConditionKind.Unconditional);
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\ValueSet.cs (4)
190Debug.Assert(other._values == UnknownSentinel); 206Debug.Assert(other._values == UnknownSentinel); 212Debug.Assert(_values == UnknownSentinel); 242Debug.Assert(_values == UnknownSentinel);
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\ArrayOfAnnotatedSystemTypeValue.cs (1)
34Debug.Assert(!IsModified);
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\HandleCallAction.cs (4)
95Debug.Assert(requiresDataFlowAnalysis || annotatedMethodReturnValue.DynamicallyAccessedMemberTypes == DynamicallyAccessedMemberTypes.None); 100Debug.Assert(instanceValue.IsEmpty()); 101Debug.Assert(argumentValues.Count == 1); 525Debug.Fail("Unreachable.");
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\NullableSystemTypeValue.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\NullableValueWithDynamicallyAccessedMembers.cs (1)
23Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\RuntimeTypeHandleForNullableSystemTypeValue.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\RuntimeTypeHandleForNullableValueWithDynamicallyAccessedMembers.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
TrimAnalysis\ArrayValue.cs (1)
80System.Diagnostics.Debug.Assert(v is not ArrayValue);
TrimAnalysis\DiagnosticContext.cs (1)
48Debug.Assert(Location != null);
TrimAnalysis\FlowAnnotations.cs (2)
188Debug.Assert(property != null); 211Debug.Assert(property != null);
TrimAnalysis\HandleCallAction.cs (1)
353Debug.Assert(property != null);
TrimAnalysis\MethodReturnValue.cs (1)
23Debug.Assert(!isNewObj || methodSymbol.MethodKind == MethodKind.Constructor, "isNewObj can only be true for constructors");
TrimAnalysis\ParameterProxy.cs (1)
34Debug.Fail($"Unexpected RefKind {ParameterSymbol!.RefKind} found on parameter {GetDisplayName()}");
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
123Debug.Assert(member is IMethodSymbol or IFieldSymbol); 130Debug.Assert(_typeHierarchyType is not null);
TrimAnalysis\TrimAnalysisAssignmentPattern.cs (2)
44Debug.Assert(Operation == other.Operation); 45Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisBackingFieldAccessPattern.cs (3)
37Debug.Assert(SymbolEqualityComparer.Default.Equals(Property, other.Property)); 38Debug.Assert(Operation == other.Operation); 39Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisFieldAccessPattern.cs (3)
36Debug.Assert(SymbolEqualityComparer.Default.Equals(Field, other.Field)); 37Debug.Assert(Operation == other.Operation); 38Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisGenericInstantiationPattern.cs (3)
37Debug.Assert(Operation == other.Operation); 38Debug.Assert(SymbolEqualityComparer.Default.Equals(GenericInstantiation, other.GenericInstantiation)); 39Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisMethodCallPattern.cs (4)
58Debug.Assert(Operation == other.Operation); 59Debug.Assert(SymbolEqualityComparer.Default.Equals(CalledMethod, other.CalledMethod)); 60Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol)); 61Debug.Assert(Arguments.Length == other.Arguments.Length);
TrimAnalysis\TrimAnalysisPatternStore.cs (1)
122Debug.Assert(existingPattern == pattern, "Return values should be identical");
TrimAnalysis\TrimAnalysisReflectionAccessPattern.cs (3)
35Debug.Assert(SymbolEqualityComparer.Default.Equals(ReferencedMethod, other.ReferencedMethod)); 36Debug.Assert(Operation == other.Operation); 37Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisVisitor.cs (2)
413Debug.Assert(OwningSymbol is IMethodSymbol); 429Debug.Assert(OwningSymbol is IMethodSymbol);
TrimAnalysis\TrimDataFlowAnalysis.cs (2)
149Debug.WriteLine(tracingInfo); 168Debug.Write(tracingInfo);
TrimAnalysis\TypeNameResolver.cs (1)
90Debug.Fail("Unreachable");
Microsoft.Analyzers.Local.Tests (1)
InternalReferencedInPublicDocAnalyzerTests.cs (1)
459Debug.Assert(lineNumbers.Length == detectedTexts.Length, "Line numbers and texts should be the same length");
Microsoft.AspNetCore (6)
BootstrapHostBuilder.cs (1)
111Debug.Assert(descriptor.ImplementationType?.Name == "GenericWebHostService");
WebApplicationBuilder.cs (5)
89Debug.Assert(slim, "should only be called with slim: true"); 159Debug.Assert(!slim, "should only be called with slim: false"); 160Debug.Assert(empty, "should only be called with empty: true"); 416Debug.Assert(_builtApplication is not null); 598Debug.Assert(_builtApplication is not null);
Microsoft.AspNetCore.Analyzers (3)
BuildServiceProviderAnalyzer.cs (1)
21Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType);
UseAuthorizationAnalyzer.cs (1)
22Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType);
UseMvcAnalyzer.cs (1)
21Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType);
Microsoft.AspNetCore.Antiforgery (25)
Internal\BinaryBlob.cs (2)
62Debug.Assert(_data.Length == other._data.Length); 75Debug.Assert(_data != null && _data.Length >= (32 / 8));
Internal\DefaultAntiforgery.cs (7)
54Debug.Assert(antiforgeryFeature.NewCookieTokenString != null); 180Debug.Assert(!string.IsNullOrEmpty(antiforgeryTokenSet.CookieToken)); 181Debug.Assert(!string.IsNullOrEmpty(antiforgeryTokenSet.RequestToken)); 280Debug.Assert(antiforgeryFeature.HaveDeserializedCookieToken); 309Debug.Assert(_tokenGenerator.IsCookieTokenValid(newCookieToken)); 403Debug.Assert(antiforgeryFeature.HaveGeneratedNewCookieToken); 404Debug.Assert(antiforgeryFeature.NewRequestToken != null);
Internal\DefaultAntiforgeryTokenStore.cs (4)
24Debug.Assert(httpContext != null); 38Debug.Assert(httpContext != null); 81Debug.Assert(httpContext != null); 82Debug.Assert(token != null);
Internal\DefaultClaimUidExtractor.cs (2)
19Debug.Assert(claimsPrincipal != null); 116Debug.Assert(destination.Length >= SHA256.HashSizeInBytes);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (9)
56Debug.Assert(_index >= 0); 84Debug.Assert(_index >= 0); 99Debug.Assert(_index >= 0); 137Debug.Assert(_rentedBuffer.Length - _index > 0); 138Debug.Assert(_rentedBuffer.Length - _index >= sizeHint); 157Debug.Assert(oldBuffer.Length >= _index); 158Debug.Assert(_rentedBuffer.Length >= _index); 166Debug.Assert(_rentedBuffer.Length - _index > 0); 167Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (1)
155Debug.Assert(arraySizeRequired % 4 == 0, "Invariant: Array length must be a multiple of 4.");
Microsoft.AspNetCore.App.Analyzers (84)
Infrastructure\EmbeddedSyntax\EmbeddedSeparatedSyntaxNodeList.cs (4)
26Debug.Assert(!nodesAndTokens.IsDefault); 44Debug.Assert(NodesAndTokens[i].IsNode); 45Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 50Debug.Assert(!NodesAndTokens[i].IsNode);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNode.cs (1)
25Debug.Assert((int)(object)kind != 0);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNodeOrToken.cs (2)
25Debug.Assert((int)(object)token.Kind != 0); 33Debug.Assert(Node == null);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxToken.cs (1)
30Debug.Assert(!diagnostics.IsDefault);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxTrivia.cs (1)
27Debug.Assert(virtualChars.Length > 0);
Infrastructure\RoutePattern\RoutePatternNodes.cs (20)
19Debug.Assert(parts != null); 20Debug.Assert(endOfFileToken.Kind == RoutePatternKind.EndOfFile); 72Debug.Assert(openBracketToken.Kind == RoutePatternKind.OpenBracketToken); 73Debug.Assert(textToken.Kind == RoutePatternKind.ReplacementToken); 74Debug.Assert(closeBracketToken.Kind == RoutePatternKind.CloseBracketToken); 108Debug.Assert(openBraceToken.Kind == RoutePatternKind.OpenBraceToken); 109Debug.Assert(closeBraceToken.Kind == RoutePatternKind.CloseBraceToken); 146Debug.Assert(literalToken.Kind == RoutePatternKind.Literal); 170Debug.Assert(separatorToken.Kind == RoutePatternKind.DotToken); 194Debug.Assert(separatorToken.Kind == RoutePatternKind.SlashToken); 218Debug.Assert(asteriskToken.Kind == RoutePatternKind.AsteriskToken); 242Debug.Assert(questionMarkToken.Kind == RoutePatternKind.QuestionMarkToken); 266Debug.Assert(equalsToken.Kind == RoutePatternKind.EqualsToken); 267Debug.Assert(defaultValueToken.Kind == RoutePatternKind.DefaultValueToken); 294Debug.Assert(parameterNameToken.Kind == RoutePatternKind.ParameterNameToken); 318Debug.Assert(colonToken.Kind == RoutePatternKind.ColonToken); 345Debug.Assert(openParenToken.Kind == RoutePatternKind.OpenParenToken); 346Debug.Assert(argumentToken.Kind == RoutePatternKind.PolicyFragmentToken); 347Debug.Assert(closeParenToken.Kind == RoutePatternKind.CloseParenToken); 377Debug.Assert(argumentToken.Kind == RoutePatternKind.PolicyFragmentToken);
Infrastructure\RoutePattern\RoutePatternParser.cs (3)
65Debug.Assert(_lexer.Position == _lexer.Text.Length); 66Debug.Assert(_currentToken.Kind == RoutePatternKind.EndOfFile); 439Debug.Assert(_routePatternOptions.SupportTokenReplacement);
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (13)
76Debug.Assert(expectedValueText == actualValueText); 82Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 86Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 95Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 104Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching."); 114Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 132Debug.Assert(!token.ContainsDiagnostics); 136Debug.Assert(startDelimiter == ""); 137Debug.Assert(endDelimiter == ""); 144Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics."); 150Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics."); 218Debug.Assert(char.IsSurrogate(ch));
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (18)
58Debug.Assert(!token.ContainsDiagnostics); 250Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 256Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 341Debug.Assert(char.IsSurrogate(ch)); 351Debug.Assert(tokenText[index] == '\\'); 364Debug.Assert(tokenText[index] == '\\'); 397Debug.Assert(tokenText[index] == '\\'); 407Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 416Debug.Assert(tokenText[index] == '\\'); 427Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 436Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 447Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 461Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 479Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 488Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 501Debug.Assert(character == 'x'); 507Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 533Debug.Assert(IsHexDigit(c));
Infrastructure\VirtualChars\VirtualCharSequence.Chunks.cs (2)
72Debug.Assert(index >= 0); 150Debug.Assert(index + 1 >= _underlyingData.Length ||
Infrastructure\VirtualChars\VirtualCharSequence.cs (3)
214Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 215Debug.Assert(_span.End == virtualChars._span.Start); 226Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
Mvc\DetectAmbiguousActionRoutes.cs (1)
110Debug.Assert(!httpMethods.IsDefault);
Mvc\DetectOverriddenAuthorizeAttribute.cs (3)
29Debug.Assert(authorizeAttributes.Count is 0); 59Debug.Assert(authorizeAttributes.Count is 0); 109Debug.Assert(currentMethod is null);
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
549Debug.Assert(token.IsKind(SyntaxKind.StringLiteralToken));
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
401Debug.Assert(token.IsKind(SyntaxKind.StringLiteralToken));
RouteHandlers\DetectAmbiguousRoutes.cs (1)
153Debug.Assert(!httpMethods.IsDefault);
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
30Debug.Fail("Expected a single top-level BlockOperation for all lambdas.");
src\aspnetcore\src\Shared\Diagnostics\AnalyzerDebug.cs (4)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b); 16/// <inheritdoc cref="Debug.Assert(bool, string)"/> 19=> Debug.Assert(b, message);
src\aspnetcore\src\Shared\Roslyn\CodeAnalysisExtensions.cs (3)
34Debug.Assert(methodSymbol != null); 159Debug.Assert(method.PartialImplementationPart == null && !SymbolEqualityComparer.Default.Equals(method.PartialDefinitionPart, method)); 165Debug.Assert(!SymbolEqualityComparer.Default.Equals(method.PartialImplementationPart, method));
src\aspnetcore\src\Shared\RoslynUtils\WellKnownTypes.cs (1)
47Debug.Assert(name == typeIdName, $"Enum name ({typeIdName}) and type name ({name}) must match at {i}");
Microsoft.AspNetCore.App.CodeFixes (2)
Authorization\AddAuthorizationBuilderFixer.cs (2)
76Debug.Assert(false, "AddAuthorizationBuilderAnalyzer should not have emitted a diagnostic."); 110Debug.Assert(false, "AddAuthorizationBuilderAnalyzer should not have emitted a diagnostic.");
Microsoft.AspNetCore.Authentication (1)
RemoteAuthenticationHandler.cs (1)
145Debug.Assert(ticket != null);
Microsoft.AspNetCore.Authentication.Cookies (2)
CookieAuthenticationHandler.cs (1)
213Debug.Assert(result.Ticket != null);
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
26Debug.Assert(path.HasValue);
Microsoft.AspNetCore.Authentication.Negotiate (5)
Internal\LdapAdapter.cs (1)
72Debug.Assert(settings.LdapConnection != null);
NegotiateHandler.cs (3)
137Debug.Assert(exception != null); 206Debug.Assert(object.ReferenceEquals(persistence?.State, _negotiateState), 398Debug.Assert(!items.ContainsKey(AuthPersistenceKey), "This should only be registered once per connection");
PostConfigureNegotiateOptions.cs (1)
49Debug.Assert(_serverAuth.AuthenticationScheme != null);
Microsoft.AspNetCore.Components (59)
ComponentsMetrics.cs (1)
40Debug.Assert(meterFactory != null);
PersistentComponentState.cs (1)
86Debug.Assert(CurrentContext != null);
PersistentState\PersistentStateValueProviderKeyResolver.cs (3)
80Debug.Assert(written == 0); 100Debug.Assert(written == 0); 115Debug.Assert(hashSucceeded);
Rendering\ComponentState.cs (1)
365Debug.Assert(currentFrame.FrameType != RenderTreeFrameType.Component || currentFrame.Component != null, "GetComponentKey is being invoked too soon, ComponentState is not fully constructed.");
Rendering\RenderTreeBuilder.cs (2)
823Debug.Assert(_hasSeenAddMultipleAttributes); 845Debug.Assert(frame.FrameTypeField == RenderTreeFrameType.Attribute, $"Frame type is {frame.FrameTypeField} at {i}");
RenderTree\Renderer.cs (2)
337Debug.Assert(_pendingTasks == null); 394Debug.Assert(_pendingTasks is null || _pendingTasks.Count == 0);
RenderTree\RenderTreeDiffBuilder.cs (1)
174Debug.Assert(action switch
Routing\SupplyParameterFromQueryValueProvider.cs (2)
55Debug.Assert(_subscribers is not null); 113Debug.Assert(_subscribers is not null);
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
182Debug.Assert(newCapacity > _items.Length);
src\aspnetcore\src\Components\Shared\src\QueryParameterValueSupplier.cs (1)
65Debug.Assert(url is not null);
src\aspnetcore\src\Http\Http.Abstractions\src\Routing\RouteValueDictionary.cs (1)
489Debug.Assert(_arrayStorage != null);
src\aspnetcore\src\Http\Routing\src\Constraints\RegexRouteConstraint.cs (1)
68Debug.Assert(_regexFactory is not null);
src\aspnetcore\src\Http\Routing\src\ParameterPolicyActivator.cs (1)
161Debug.Assert(constructors.Count > 0);
src\aspnetcore\src\Http\Routing\src\PathTokenizer.cs (3)
47Debug.Assert(_path[0] == '/'); 89Debug.Assert(_path[_path.Length - 1] != '/'); 90Debug.Assert(currentSegmentIndex == index);
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePattern.cs (5)
45Debug.Assert(defaults != null); 46Debug.Assert(parameterPolicies != null); 47Debug.Assert(parameters != null); 48Debug.Assert(requiredValues != null); 49Debug.Assert(pathSegments != null);
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternLiteralPart.cs (1)
22Debug.Assert(!string.IsNullOrEmpty(content));
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternMatcher.cs (9)
111Debug.Assert(pathSegment != null); 168Debug.Assert(pathSegment != null); 169Debug.Assert(pathSegment.IsSimple); 172Debug.Assert(part.IsParameter); 240Debug.Assert(!pathSegment.IsSimple); 338Debug.Assert(routeSegment != null); 339Debug.Assert(routeSegment.Parts.Count > 1); 361Debug.Assert(part.IsLiteral || part.IsSeparator); 434Debug.Assert(false, "indexOfLastSegementUsed should always be 0 from the check above");
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternParser.cs (8)
51Debug.Assert(context.AtEnd() || context.Current == Separator); 73Debug.Assert(context != null); 74Debug.Assert(segments != null); 145Debug.Assert(context.Current == OpenBrace); 445Debug.Assert(context != null); 446Debug.Assert(literal != null); 485Debug.Assert(template != null); 526Debug.Assert(_index >= 0);
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternSeparatorPart.cs (1)
39Debug.Assert(!string.IsNullOrEmpty(content));
src\aspnetcore\src\Http\Routing\src\Template\RoutePrecedence.cs (3)
69Debug.Assert(digit >= 0 && digit < 10); 125Debug.Assert(digit >= 0 && digit < 10); 191Debug.Assert(parameterPart != null);
src\aspnetcore\src\Http\Routing\src\Tree\TreeEnumerator.cs (1)
94Debug.Assert(next.Depth < _tokenizer.Count);
src\aspnetcore\src\Http\Routing\src\Tree\UrlMatchingTree.cs (2)
98Debug.Assert(segment.Parts.Count == 1); 231Debug.Fail("We shouldn't get here.");
src\aspnetcore\src\Shared\Components\ComponentsActivityLinkStore.cs (1)
36Debug.Assert(_store != null, "Activity links store should not be null.");
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (6)
93Debug.Assert(_rentedBuffer != null); 172Debug.Assert(_rentedBuffer != null); 196Debug.Assert(oldBuffer.Length >= _index); 197Debug.Assert(_rentedBuffer.Length >= _index); 205Debug.Assert(_rentedBuffer.Length - _index > 0); 206Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
105Debug.Assert(success);
Microsoft.AspNetCore.Components.Endpoints (40)
Builder\RazorComponentEndpointDataSource.cs (4)
77Debug.Assert(_changeToken != null); 78Debug.Assert(_endpoints != null); 208Debug.Assert(_changeToken != null); 209Debug.Assert(_endpoints != null);
CacheView\CacheViewKeyResolver.cs (1)
89Debug.Assert(hashSucceeded);
FormMapping\Factories\NullableConverterFactory.cs (3)
26Debug.Assert(underlyingType != null); 29Debug.Assert(underlyingConverter != null); 32Debug.Assert(expectedConverterType != null);
FormMapping\FormDataReader.cs (3)
195Debug.Assert(_currentDepth >= 0); 199Debug.Assert(_currentPrefixBuffer.Length >= keyLength); 228Debug.Assert(_prefixBuffer.Length >= (_currentPrefixBuffer.Length + separator.Length));
FormMapping\HttpContextFormValueMapper.cs (1)
88Debug.Assert(deserializer != null);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (9)
56Debug.Assert(_index >= 0); 84Debug.Assert(_index >= 0); 99Debug.Assert(_index >= 0); 137Debug.Assert(_rentedBuffer.Length - _index > 0); 138Debug.Assert(_rentedBuffer.Length - _index >= sizeHint); 157Debug.Assert(oldBuffer.Length >= _index); 158Debug.Assert(_rentedBuffer.Length >= _index); 166Debug.Assert(_rentedBuffer.Length - _index > 0); 167Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\Shared\Components\ComponentsActivityLinkStore.cs (1)
36Debug.Assert(_store != null, "Activity links store should not be null.");
src\aspnetcore\src\Shared\PropertyHelper\PropertyHelper.cs (18)
161Debug.Assert(propertyInfo != null); 181Debug.Assert(propertyInfo != null); 195Debug.Assert(propertyInfo != null); 198Debug.Assert(propertyGetterWrapperMethod != null); 199Debug.Assert(propertyGetterWrapperMethod.IsGenericMethodDefinition); 200Debug.Assert(propertyGetterWrapperMethod.GetParameters().Length == 2); 203Debug.Assert(propertyGetterByRefWrapperMethod != null); 204Debug.Assert(propertyGetterByRefWrapperMethod.IsGenericMethodDefinition); 205Debug.Assert(propertyGetterByRefWrapperMethod.GetParameters().Length == 2); 208Debug.Assert(getMethod != null); 209Debug.Assert(!getMethod.IsStatic); 210Debug.Assert(getMethod.GetParameters().Length == 0); 274Debug.Assert(propertyInfo != null); 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 278Debug.Assert(setMethod != null); 279Debug.Assert(!setMethod.IsStatic); 280Debug.Assert(setMethod.ReturnType == typeof(void)); 282Debug.Assert(parameters.Length == 1);
Microsoft.AspNetCore.Components.Media (1)
MediaComponentBase.cs (1)
164Debug.Assert(_renderHandle.IsInitialized);
Microsoft.AspNetCore.Components.QuickGrid (2)
src\aspnetcore\src\Components\Shared\src\QueryParameterValueSupplier.cs (1)
65Debug.Assert(url is not null);
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
105Debug.Assert(success);
Microsoft.AspNetCore.Components.Server (30)
BlazorPack\SequenceOfT.cs (3)
168Debug.Assert(last != null, "Cannot advance before acquiring memory."); 407Debug.Assert(segment != null, "Null not allowed."); 433Debug.Assert(offset >= this.Start, "Trying to rewind.");
Circuits\CircuitMetrics.cs (1)
21Debug.Assert(meterFactory != null);
Circuits\CircuitRegistry.cs (3)
136Debug.Assert(result, "This operation operates inside of a lock. We expect the previously inspected value to be still here."); 279Debug.Fail($"Unexpected {nameof(EvictionReason)} {reason}"); 362Debug.Assert(removeResult, "This operation operates inside of a lock. We expect the previously inspected value to be still here.");
Circuits\DefaultInMemoryCircuitPersistenceProvider.cs (1)
94Debug.Fail($"Unexpected {nameof(EvictionReason)} {reason}");
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
182Debug.Assert(newCapacity > _items.Length);
src\aspnetcore\src\Shared\Components\ComponentsActivityLinkStore.cs (1)
36Debug.Assert(_store != null, "Activity links store should not be null.");
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (6)
93Debug.Assert(_rentedBuffer != null); 172Debug.Assert(_rentedBuffer != null); 196Debug.Assert(oldBuffer.Length >= _index); 197Debug.Assert(_rentedBuffer.Length >= _index); 205Debug.Assert(_rentedBuffer.Length - _index > 0); 206Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\SignalR\common\Protocols.MessagePack\src\Protocol\MessagePackHubProtocolWorker.cs (1)
376Debug.Assert(written == prefixLength);
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackReader.cs (1)
268Debug.Fail("Missing handler for code: " + code);
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReader.cs (9)
263Debug.Assert(this.usingSequence, "usingSequence"); 270Debug.Assert(this.usingSequence, "usingSequence"); 305Debug.Assert(this.usingSequence, "usingSequence"); 365Debug.Assert(count >= 0, "count >= 0"); 382Debug.Assert(count >= 0, "count >= 0"); 387Debug.Assert(this.CurrentSpanIndex < this.CurrentSpan.Length, "this.CurrentSpanIndex < this.CurrentSpan.Length"); 408Debug.Assert(this.usingSequence, "usingSequence"); 430Debug.Assert(count >= 0, "count >= 0"); 474Debug.Assert(firstSpan.Length < destination.Length, "firstSpan.Length < destination.Length");
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReaderExtensions.cs (1)
72Debug.Assert(reader.UnreadSpan.Length < sizeof(T), "reader.UnreadSpan.Length < sizeof(T)");
Microsoft.AspNetCore.Components.Web (9)
Forms\EditForm.cs (2)
133Debug.Assert(_editContext != null); 202Debug.Assert(_editContext != null);
Forms\InputDate.cs (1)
115Debug.Assert(result != null);
Forms\InputRadio.cs (1)
63Debug.Assert(Context != null);
Forms\InputRadioGroup.cs (1)
71Debug.Assert(_context != null);
Forms\Mapping\SupplyParameterFromFormValueProvider.cs (1)
74Debug.Assert(mappingContext != null);
HtmlRendering\StaticHtmlRenderer.HtmlWriting.cs (2)
162Debug.Assert(afterElement == position + frame.ElementSubtreeLength); 177Debug.Assert(afterAttributes == position + frame.ElementSubtreeLength);
Virtualization\Virtualize.cs (1)
425Debug.Assert(refreshTask.IsCompletedSuccessfully);
Microsoft.AspNetCore.Components.WebAssembly (2)
Services\WebAssemblyConsoleLogger.cs (1)
95Debug.Assert(logLevel != LogLevel.None, "This method is never called with LogLevel.None.");
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
182Debug.Assert(newCapacity > _items.Length);
Microsoft.AspNetCore.Components.WebView (1)
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
182Debug.Assert(newCapacity > _items.Length);
Microsoft.AspNetCore.CookiePolicy (1)
ResponseCookiesWrapper.cs (1)
98Debug.Assert(key != null);
Microsoft.AspNetCore.Cryptography.Internal (6)
CryptoUtil.cs (1)
61Debug.Fail(message);
SafeHandles\BCryptAlgorithmHandle.cs (1)
45Debug.Assert(pbKey != null);
UnsafeNativeMethods.cs (1)
479Debug.Assert(lastError != 0, "This method should only be called if there was an error.");
WeakReferenceHelpers.cs (3)
38Debug.Assert(newTarget != null); 41Debug.Assert(newWeakRef != null); 53Debug.Assert(currentWeakRef != null);
Microsoft.AspNetCore.Cryptography.KeyDerivation (17)
PBKDF2\ManagedPbkdf2Provider.cs (5)
19Debug.Assert(password != null); 20Debug.Assert(salt != null); 21Debug.Assert(iterationCount > 0); 22Debug.Assert(numBytesRequested > 0); 96Debug.Assert(src.Length == dest.Length);
PBKDF2\NetCorePbkdf2Provider.cs (4)
19Debug.Assert(password != null); 20Debug.Assert(salt != null); 21Debug.Assert(iterationCount > 0); 22Debug.Assert(numBytesRequested > 0);
PBKDF2\Win7Pbkdf2Provider.cs (4)
18Debug.Assert(password != null); 19Debug.Assert(salt != null); 20Debug.Assert(iterationCount > 0); 21Debug.Assert(numBytesRequested > 0);
PBKDF2\Win8Pbkdf2Provider.cs (4)
20Debug.Assert(password != null); 21Debug.Assert(salt != null); 22Debug.Assert(iterationCount > 0); 23Debug.Assert(numBytesRequested > 0);
Microsoft.AspNetCore.DataProtection (70)
AuthenticatedEncryption\AuthenticatedEncryptorFactory.cs (1)
82Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (1)
43Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (1)
44Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
Cng\DpapiSecretSerializerHelper.cs (9)
45Debug.Assert(secret != null); 120Debug.Assert(secret != null); 121Debug.Assert(protectionDescriptorHandle != null); 146Debug.Assert(protectionDescriptorHandle != null); 147Debug.Assert(pbData != null); 198Debug.Assert(protectedSecret != null); 261Debug.Assert(protectedData != null); 274Debug.Assert(pbData != null); 322Debug.Assert(protectedData != null);
DataProtectionServiceCollectionExtensions.cs (1)
64Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
EphemeralDataProtectionProvider.cs (2)
50Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); 103Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
KeyManagement\Key.cs (4)
135Debug.Assert(_descriptorException is null); // Mutually exclusive with _descriptor 151Debug.Assert(_descriptorFactory is not null, "Key constructed without either descriptor or descriptor factory"); 171Debug.Fail("ResetDescriptor called with descriptor available"); 172Debug.Assert(_descriptorException is null); // Mutually exclusive with _descriptor
KeyManagement\KeyRingBasedDataProtector.cs (5)
40Debug.Assert(keyRingProvider != null); 200Debug.Assert(protectedData != null); 308Debug.Assert(success, "Failed to write Guid."); 339Debug.Assert(existingTemplate.Length >= sizeof(uint) /* MAGIC_HEADER */ + sizeof(Guid) /* keyId */); 415Debug.Assert(index == targetArr.Length);
KeyManagement\KeyRingBasedSpanDataProtector.cs (1)
53Debug.Assert(writeKeyIdResult, "Failed to write Guid to destination.");
KeyManagement\KeyRingProvider.cs (12)
173Debug.Assert(defaultKey != null); 176Debug.Assert(defaultKey.CreateEncryptor() != null); 228Debug.Assert(utcNow.Kind == DateTimeKind.Utc); 312Debug.Assert(existingCacheableKeyRing != null); 328Debug.Assert(utcNow.Kind == DateTimeKind.Utc); 372Debug.Assert(taskKeyRing is not null, "How did _cacheableKeyRingTask change while we were holding the lock?"); 425Debug.Assert(CacheableKeyRing.IsValid(newCacheableKeyRing, utcNow), "GetCacheableKeyRing produced a ring that is already invalid at utcNow."); 459Debug.Assert(!forceRefresh, "A forced refresh should have produced a fresh key ring inline."); 460Debug.Assert(existingCacheableKeyRing is not null, "Should have refreshed inline when there was no cached key ring."); 461Debug.Assert(!CacheableKeyRing.IsValid(existingCacheableKeyRing, utcNow), "Should have returned a valid cached key ring above"); 475Debug.Assert(task.IsCompleted); 476Debug.Assert(!task.IsCanceled, "How did a task with no cancellation token get canceled?");
KeyManagement\XmlKeyManager.cs (10)
283Debug.Assert(_cacheExpirationTokenSource != null, $"{nameof(TriggerAndResetCacheExpirationToken)} must have been called first."); 290Debug.Assert(keyElement.Name == KeyElementName); 336Debug.Assert(_knownKeyMap.TryGetValue(key.KeyId, out var existingKey)); 337Debug.Assert(existingKey.CreationDate == key.CreationDate); 338Debug.Assert(existingKey.ActivationDate == key.ActivationDate); 339Debug.Assert(existingKey.ExpirationDate == key.ExpirationDate); 346Debug.Assert(revocationElement.Name == RevocationElementName); 668Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); // Hint for the platform compatibility analyzer. 693Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); // Hint for the platform compatibility analyzer. 698Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); // Hint for the platform compatibility analyzer.
Managed\ManagedAuthenticatedEncryptor.cs (2)
430Debug.Assert(success); 432Debug.Assert(bytesWritten == hashSize);
Repositories\DefaultKeyStorageDirectories.cs (1)
74Debug.Assert(retVal != null);
Repositories\FileSystemXmlRepository.cs (1)
209Debug.Assert(fileSystemInfo.Exists, "Having previously been deleted should not have caused an exception");
SP800_108\ManagedSP800_108_CTR_HMACSHA512.cs (2)
139Debug.Assert(success); 140Debug.Assert(bytesWritten == prfOutputSizeInBytes);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (9)
56Debug.Assert(_index >= 0); 84Debug.Assert(_index >= 0); 99Debug.Assert(_index >= 0); 137Debug.Assert(_rentedBuffer.Length - _index > 0); 138Debug.Assert(_rentedBuffer.Length - _index >= sizeHint); 157Debug.Assert(oldBuffer.Length >= _index); 158Debug.Assert(_rentedBuffer.Length >= _index); 166Debug.Assert(_rentedBuffer.Length - _index > 0); 167Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (6)
93Debug.Assert(_rentedBuffer != null); 172Debug.Assert(_rentedBuffer != null); 196Debug.Assert(oldBuffer.Length >= _index); 197Debug.Assert(_rentedBuffer.Length >= _index); 205Debug.Assert(_rentedBuffer.Length - _index > 0); 206Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
XmlEncryption\XmlEncryptionExtensions.cs (2)
62Debug.Assert(placeholderReplacements.Count > 0); 143Debug.Assert(placeholderReplacements.Count > 0);
Microsoft.AspNetCore.DataProtection.Abstractions (3)
CryptoUtil.cs (1)
21Debug.Fail(message);
DataProtectionCommonExtensions.cs (1)
53Debug.Assert(retVal is IDataProtector); // CreateProtector is supposed to return an instance of this interface
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (1)
155Debug.Assert(arraySizeRequired % 4 == 0, "Invariant: Array length must be a multiple of 4.");
Microsoft.AspNetCore.DataProtection.MicroBenchmarks (15)
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (9)
56Debug.Assert(_index >= 0); 84Debug.Assert(_index >= 0); 99Debug.Assert(_index >= 0); 137Debug.Assert(_rentedBuffer.Length - _index > 0); 138Debug.Assert(_rentedBuffer.Length - _index >= sizeHint); 157Debug.Assert(oldBuffer.Length >= _index); 158Debug.Assert(_rentedBuffer.Length >= _index); 166Debug.Assert(_rentedBuffer.Length - _index > 0); 167Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (6)
93Debug.Assert(_rentedBuffer != null); 172Debug.Assert(_rentedBuffer != null); 196Debug.Assert(oldBuffer.Length >= _index); 197Debug.Assert(_rentedBuffer.Length >= _index); 205Debug.Assert(_rentedBuffer.Length - _index > 0); 206Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
Microsoft.AspNetCore.DeveloperCertificates.XPlat (3)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (1)
765Debug.Assert(pemEnvelope != null);
src\aspnetcore\src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
91Debug.Assert(oldTrustLevel == TrustLevel.Full); // Mac trust is all or nothing
src\aspnetcore\src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
354Debug.Assert(IsCommandAvailable(OpenSslCommand), "How did we trust without the openssl command?");
Microsoft.AspNetCore.Diagnostics (12)
src\aspnetcore\src\Shared\Diagnostics\AnalyzerDebug.cs (4)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b); 16/// <inheritdoc cref="Debug.Assert(bool, string)"/> 19=> Debug.Assert(b, message);
src\aspnetcore\src\Shared\Diagnostics\BaseView.cs (3)
110Debug.Assert(string.IsNullOrEmpty(AttributeEnding)); 118Debug.Assert(AttributeValues != null); 119Debug.Assert(!string.IsNullOrEmpty(AttributeEnding));
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (3)
150Debug.Assert(string.IsNullOrEmpty(AttributeEnding)); 158Debug.Assert(AttributeValues != null); 159Debug.Assert(!string.IsNullOrEmpty(AttributeEnding));
src\aspnetcore\src\Shared\StackTrace\StackFrame\StackTraceHelper.cs (2)
198Debug.Assert(method != null); 199Debug.Assert(method.DeclaringType != null);
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (10)
src\aspnetcore\src\Shared\Diagnostics\AnalyzerDebug.cs (4)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b); 16/// <inheritdoc cref="Debug.Assert(bool, string)"/> 19=> Debug.Assert(b, message);
src\aspnetcore\src\Shared\Diagnostics\BaseView.cs (3)
110Debug.Assert(string.IsNullOrEmpty(AttributeEnding)); 118Debug.Assert(AttributeValues != null); 119Debug.Assert(!string.IsNullOrEmpty(AttributeEnding));
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (3)
150Debug.Assert(string.IsNullOrEmpty(AttributeEnding)); 158Debug.Assert(AttributeValues != null); 159Debug.Assert(!string.IsNullOrEmpty(AttributeEnding));
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (3)
Logging\ApiRoutingController.cs (3)
26Debug.Assert(userId != null, "Test"); 27Debug.Assert(noDataClassification != null, "Test"); 28Debug.Assert(noRedaction != null, "Test");
Microsoft.AspNetCore.Grpc.JsonTranscoding (5)
Internal\Json\MessageTypeInfoResolver.cs (1)
148Debug.Assert(!field.IsRepeated && !field.IsMap, "Collections shouldn't have a setter.");
Internal\JsonRequestHelpers.cs (1)
357Debug.Assert(read == data.Length);
src\aspnetcore\src\Grpc\JsonTranscoding\src\Shared\HttpRoutePatternParser.cs (3)
343Debug.Assert(CurrentVariable.FieldPath.Any()); 344Debug.Assert(CurrentVariable.StartSegment < CurrentVariable.EndSegment); 345Debug.Assert(CurrentVariable.EndSegment <= _segments.Count);
Microsoft.AspNetCore.Hosting (18)
Http\DefaultHttpContextFactory.cs (2)
56Debug.Assert(featureCollection != null); 57Debug.Assert(httpContext != null);
Internal\ConfigureContainerBuilder.cs (1)
24Debug.Assert(MethodInfo != null, "Shouldn't be called when there is no Configure method.");
Internal\HostingApplicationDiagnostics.cs (2)
175Debug.Assert(context.MetricsTagsFeature != null, "MetricsTagsFeature should be set if MetricsEnabled is true."); 408Debug.Assert(ActivityCreator.IsActivityCreated(_activitySource, diagnosticsOrLoggingEnabled),
Internal\HostingRequestFinishedLog.cs (2)
28Debug.Assert(_context.HttpContext != null); 62Debug.Assert(_context.HttpContext != null);
Internal\StartupMethods.cs (2)
14Debug.Assert(configure != null); 15Debug.Assert(configureServices != null);
Internal\WebHost.cs (4)
82Debug.Assert(_applicationServices != null, "Initialize must be called before accessing services."); 127Debug.Assert(_applicationServices != null, "Initialize must be called first."); 203Debug.Assert(_applicationServices != null, "Initialize must be called first."); 256Debug.Assert(_applicationServices != null, "Initialize must be called first.");
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (3)
150Debug.Assert(string.IsNullOrEmpty(AttributeEnding)); 158Debug.Assert(AttributeValues != null); 159Debug.Assert(!string.IsNullOrEmpty(AttributeEnding));
src\aspnetcore\src\Shared\StackTrace\StackFrame\StackTraceHelper.cs (2)
198Debug.Assert(method != null); 199Debug.Assert(method.DeclaringType != null);
Microsoft.AspNetCore.Html.Abstractions (2)
HtmlFormattableString.cs (2)
89Debug.Assert(formatProvider != null); 90Debug.Assert(encoder != null);
Microsoft.AspNetCore.Http (12)
src\aspnetcore\src\Http\Shared\StreamCopyOperationInternal.cs (4)
39Debug.Assert(source != null); 40Debug.Assert(destination != null); 41Debug.Assert(!bytesRemaining.HasValue || bytesRemaining.GetValueOrDefault() >= 0); 42Debug.Assert(buffer != null);
src\aspnetcore\src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (8)
228Debug.Assert(_arrayStorage == null); 514Debug.Assert(_arrayStorage != null); 544Debug.Assert(_arrayStorage is not null); 545Debug.Assert(_count <= _arrayStorage.Length); 554Debug.Assert(_dictionaryStorage == null); 555Debug.Assert(_arrayStorage != null); 575Debug.Assert(_dictionaryStorage == null); 576Debug.Assert(_arrayStorage != null);
Microsoft.AspNetCore.Http.Abstractions (26)
Extensions\UseMiddlewareExtensions.cs (2)
202Debug.Assert(!RuntimeFeature.IsDynamicCodeSupported, "Use reflection fallback when dynamic code is not supported."); 267Debug.Assert(RuntimeFeature.IsDynamicCodeSupported, "Use compiled expression when dynamic code is supported.");
PathString.cs (2)
161Debug.Assert(count > 0); 162Debug.Assert(buffer is not null);
Routing\RouteValueDictionary.cs (3)
489Debug.Assert(_arrayStorage != null); 772Debug.Assert(_propertyStorage != null); 885Debug.Assert(value != null);
src\aspnetcore\src\Shared\PropertyHelper\PropertyHelper.cs (18)
161Debug.Assert(propertyInfo != null); 181Debug.Assert(propertyInfo != null); 195Debug.Assert(propertyInfo != null); 198Debug.Assert(propertyGetterWrapperMethod != null); 199Debug.Assert(propertyGetterWrapperMethod.IsGenericMethodDefinition); 200Debug.Assert(propertyGetterWrapperMethod.GetParameters().Length == 2); 203Debug.Assert(propertyGetterByRefWrapperMethod != null); 204Debug.Assert(propertyGetterByRefWrapperMethod.IsGenericMethodDefinition); 205Debug.Assert(propertyGetterByRefWrapperMethod.GetParameters().Length == 2); 208Debug.Assert(getMethod != null); 209Debug.Assert(!getMethod.IsStatic); 210Debug.Assert(getMethod.GetParameters().Length == 0); 274Debug.Assert(propertyInfo != null); 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 278Debug.Assert(setMethod != null); 279Debug.Assert(!setMethod.IsStatic); 280Debug.Assert(setMethod.ReturnType == typeof(void)); 282Debug.Assert(parameters.Length == 1);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueListBuilder.cs (1)
47Debug.Assert(_pos == _span.Length);
Microsoft.AspNetCore.Http.Connections (7)
Internal\HttpConnectionContext.cs (2)
649Debug.Assert(Status == HttpConnectionStatus.Disposed); 756Debug.Assert(TransportType != HttpTransportType.None, "Transport has not been initialized yet");
Internal\HttpConnectionsMetrics.cs (1)
58Debug.Assert(transportType != HttpTransportType.None);
Internal\Transports\WebSocketsServerTransport.cs (1)
39Debug.Assert(context.WebSockets.IsWebSocketRequest, "Not a websocket request");
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (1)
155Debug.Assert(arraySizeRequired % 4 == 0, "Invariant: Array length must be a multiple of 4.");
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
Microsoft.AspNetCore.Http.Connections.Client (10)
Internal\Constants.cs (1)
24Debug.Assert(assemblyVersion != null);
Internal\LongPollingTransport.cs (2)
73Debug.Assert(_application != null); 143Debug.Assert(_application != null);
Internal\ServerSentEventsTransport.cs (2)
90Debug.Assert(_application != null); 128Debug.Assert(_application != null);
Internal\WebSocketsTransport.cs (4)
339Debug.Assert(_application != null); 349Debug.Assert(_notifyOnReconnect is not null); 435Debug.Assert(_application != null); 532Debug.Assert(_application != null);
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
105Debug.Assert(success);
Microsoft.AspNetCore.Http.Connections.Common (3)
NegotiateProtocol.cs (2)
66Debug.Assert(writer.CurrentDepth == 0); 140Debug.Assert(writer.CurrentDepth == 0);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
132Debug.Assert(charsUsed == 1);
Microsoft.AspNetCore.Http.Extensions (34)
RequestDelegateFactory.cs (11)
246Debug.Assert(untargetableRequestDelegate is not null); 258Debug.Assert(targetableRequestDelegate is not null); 423Debug.Assert(factoryContext.EndpointBuilder.FilterFactories.Count > 0); 1306Debug.Assert(factoryContext.JsonRequestBodyParameter is not null, "factoryContext.JsonRequestBodyParameter is null for a JSON body."); 1313Debug.Assert(parameterName is not null, "CreateArgument() should throw if parameter.Name is null."); 1463Debug.Assert(factoryContext.FirstFormRequestBodyParameter is not null, "factoryContext.FirstFormRequestBodyParameter is null for a form body."); 1470Debug.Assert(parameterName is not null, "CreateArgument() should throw if parameter.Name is null."); 1619Debug.Assert(parameterInfo.Name != null, "Parameter name must be set for parameters resolved from properties."); 1644Debug.Assert(parameterInfo.Name != null, "Parameter name must be set for parameters resolved from properties."); 2059Debug.Assert(bindAsyncMethod.Expression is not null); 2358Debug.Assert(parameterName is not null, "CreateArgument() should throw if parameter.Name is null.");
src\aspnetcore\src\Components\Endpoints\src\FormMapping\Factories\NullableConverterFactory.cs (3)
26Debug.Assert(underlyingType != null); 29Debug.Assert(underlyingConverter != null); 32Debug.Assert(expectedConverterType != null);
src\aspnetcore\src\Components\Endpoints\src\FormMapping\FormDataReader.cs (3)
195Debug.Assert(_currentDepth >= 0); 199Debug.Assert(_currentPrefixBuffer.Length >= keyLength); 228Debug.Assert(_prefixBuffer.Length >= (_currentPrefixBuffer.Length + separator.Length));
src\aspnetcore\src\Http\Shared\StreamCopyOperationInternal.cs (4)
39Debug.Assert(source != null); 40Debug.Assert(destination != null); 41Debug.Assert(!bytesRemaining.HasValue || bytesRemaining.GetValueOrDefault() >= 0); 42Debug.Assert(buffer != null);
src\aspnetcore\src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (3)
66Debug.Assert(isTrimAotCompatible, "isTrimAotCompatible should always be true."); 149Debug.Assert(_executor != null, "Sync execution is not supported."); 178Debug.Assert(_executorAsync != null, "Async execution is not supported.");
src\aspnetcore\src\Shared\ParameterBindingMethodCache.cs (2)
525Debug.Fail("No suitable System.Enum.TryParse method found."); 725Debug.Assert(obj is ParameterLookupKey);
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (1)
24Debug.Assert(propertyInfo != null, "PropertyInfo must be provided.");
src\aspnetcore\src\Shared\ValueStringBuilder\ValueListBuilder.cs (1)
47Debug.Assert(_pos == _span.Length);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (6)
37Debug.Assert(value >= 0); 38Debug.Assert(value <= _chars.Length); 48Debug.Assert(capacity >= 0); 86Debug.Assert(index < _pos); 289Debug.Assert(additionalCapacityBeyondPos > 0); 290Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed.");
Microsoft.AspNetCore.Http.RequestDelegateGenerator (5)
src\aspnetcore\src\Shared\Diagnostics\AnalyzerDebug.cs (4)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b); 16/// <inheritdoc cref="Debug.Assert(bool, string)"/> 19=> Debug.Assert(b, message);
src\aspnetcore\src\Shared\RoslynUtils\WellKnownTypes.cs (1)
47Debug.Assert(name == typeIdName, $"Enum name ({typeIdName}) and type name ({name}) must match at {i}");
Microsoft.AspNetCore.Http.Results (7)
ResultsOfTHelper.cs (1)
44Debug.Assert(populateMetadataMethod != null, $"Couldn't find PopulateMetadata method on {typeof(TTarget)}.");
src\aspnetcore\src\Http\Shared\StreamCopyOperationInternal.cs (4)
39Debug.Assert(source != null); 40Debug.Assert(destination != null); 41Debug.Assert(!bytesRemaining.HasValue || bytesRemaining.GetValueOrDefault() >= 0); 42Debug.Assert(buffer != null);
src\aspnetcore\src\Shared\RangeHelper\RangeHelper.cs (1)
67Debug.Assert(rangeHeader.Ranges.Count == 1);
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
26Debug.Assert(path.HasValue);
Microsoft.AspNetCore.HttpLogging (21)
BufferingStream.cs (1)
147Debug.Assert(_tail != null);
src\aspnetcore\src\Shared\Buffers\BufferSegment.cs (4)
27Debug.Assert(value <= AvailableMemory.Length); 64Debug.Assert(_memoryOwner != null); 102Debug.Assert(segment != null); 103Debug.Assert(Next == null);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (9)
56Debug.Assert(_index >= 0); 84Debug.Assert(_index >= 0); 99Debug.Assert(_index >= 0); 137Debug.Assert(_rentedBuffer.Length - _index > 0); 138Debug.Assert(_rentedBuffer.Length - _index >= sizeHint); 157Debug.Assert(oldBuffer.Length >= _index); 158Debug.Assert(_rentedBuffer.Length >= _index); 166Debug.Assert(_rentedBuffer.Length - _index > 0); 167Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueListBuilder.cs (1)
47Debug.Assert(_pos == _span.Length);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (6)
37Debug.Assert(value >= 0); 38Debug.Assert(value <= _chars.Length); 48Debug.Assert(capacity >= 0); 86Debug.Assert(index < _pos); 289Debug.Assert(additionalCapacityBeyondPos > 0); 290Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed.");
Microsoft.AspNetCore.Identity (66)
_generated\0\GeneratedRouteBuilderExtensions.g.cs (60)
70Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 71Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 83Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 84Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 85Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 86Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 189Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 190Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 203Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 204Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 205Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 206Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 375Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 376Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 387Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 388Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 389Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 390Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 491Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 492Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 504Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 505Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 506Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 507Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 637Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 638Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 650Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 651Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 652Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 653Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 756Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 757Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 768Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 769Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 770Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 771Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 872Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 873Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 884Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 885Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 886Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 887Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 988Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 989Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 1001Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 1002Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 1003Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 1004Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 1107Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 1108Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 1118Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 1119Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 1120Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 1121Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found."); 1209Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 1210Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 1223Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 1224Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 1225Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 1226Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
IdentityApiEndpointRouteBuilderExtensions.cs (1)
433Debug.Assert(!result.Succeeded);
PasskeyHandler.cs (1)
435Debug.Assert(originalUserId is not null);
Passkeys\AuthenticatorData.cs (1)
99Debug.Assert(MinLength == 37);
Passkeys\BufferSourceJsonConverter.cs (3)
63Debug.Assert(bytesConsumed == utf8Unescaped.Length); 85Debug.Assert(status == OperationStatus.Done); 86Debug.Assert(bytesConsumed == bytes.Length);
Microsoft.AspNetCore.Mvc.Abstractions (11)
ModelBinding\ModelMetadata.cs (7)
167Debug.Assert(BoundConstructor != null, "This API can be only called for types with bound constructors."); 182Debug.Assert(BoundConstructor != null, "This API can be only called for types with bound constructors."); 661Debug.Assert(_parameterMapping != null); 662Debug.Assert(_boundConstructorPropertyMapping != null); 749Debug.Assert(ModelType != null); 776Debug.Assert(ModelType != null); 790Debug.Assert(
ModelBinding\ModelStateDictionary.cs (2)
552Debug.Assert(key != null); 930Debug.Assert(ChildNodes != null);
src\aspnetcore\src\Shared\ParameterBindingMethodCache.cs (2)
525Debug.Fail("No suitable System.Enum.TryParse method found."); 725Debug.Assert(obj is ParameterLookupKey);
Microsoft.AspNetCore.Mvc.Analyzers (3)
src\aspnetcore\src\Shared\Roslyn\CodeAnalysisExtensions.cs (3)
34Debug.Assert(methodSymbol != null); 159Debug.Assert(method.PartialImplementationPart == null && !SymbolEqualityComparer.Default.Equals(method.PartialDefinitionPart, method)); 165Debug.Assert(!SymbolEqualityComparer.Default.Equals(method.PartialImplementationPart, method));
Microsoft.AspNetCore.Mvc.ApiExplorer (2)
ApiResponseTypeProvider.cs (1)
274Debug.Assert(attributeScope <= existingScope);
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (1)
24Debug.Assert(propertyInfo != null, "PropertyInfo must be provided.");
Microsoft.AspNetCore.Mvc.Core (245)
ActionConstraints\ActionConstraintCache.cs (1)
95Debug.Assert(entry.ActionConstraints != null || entry.Items != null);
ApplicationModels\ApplicationModelFactory.cs (1)
79Debug.Assert(result != null);
ApplicationModels\ControllerActionDescriptorBuilder.cs (1)
134Debug.Assert(IsAttributeRouted(actionDescriptor));
Authorization\AuthorizeFilter.cs (1)
204Debug.Assert(AuthorizeData != null);
Controllers\ControllerBinderDelegateProvider.cs (1)
60Debug.Assert(valueProvider is not null);
Filters\DefaultFilterProvider.cs (2)
68Debug.Assert(actualFilter != null, "actualFilter should not be null"); 69Debug.Assert(filterMetadata != null, "filterMetadata should not be null");
Formatters\AcceptHeaderParser.cs (3)
43Debug.Fail("ParseAcceptHeader should advance charIndex, this is a bug."); 124Debug.Assert(input != null); 125Debug.Assert(startIndex <= input.Length); // it's OK if index == value.Length.
Infrastructure\ActionSelectionTable.cs (2)
178Debug.Assert(matches != null); 179Debug.Assert(matches.Count >= 0);
Infrastructure\ControllerActionInvoker.cs (16)
118Debug.Assert(state != null); 119Debug.Assert(_actionExecutingContext != null); 142Debug.Assert(state != null); 143Debug.Assert(_actionExecutingContext != null); 173Debug.Assert(state != null); 174Debug.Assert(_actionExecutingContext != null); 222Debug.Assert(state != null); 223Debug.Assert(_actionExecutingContext != null); 224Debug.Assert(_actionExecutedContext != null); 316Debug.Assert(_actionExecutedContext != null); 338Debug.Assert(invoker._actionExecutedContext != null); 344Debug.Assert(_actionExecutingContext != null); 357Debug.Assert(_actionExecutedContext != null); 364Debug.Assert(invoker._actionExecutedContext != null); 525Debug.Assert(_cacheEntry.ControllerBinderDelegate != null); 540Debug.Assert(actionParameters != null, "Expect arguments to be initialized.");
Infrastructure\DefaultActionDescriptorCollectionProvider.cs (4)
57Debug.Assert(_collection != null); 58Debug.Assert(_changeToken != null); 72Debug.Assert(_collection != null); 73Debug.Assert(_changeToken != null);
Infrastructure\ObjectResultExecutor.cs (1)
125Debug.Assert(result.ContentTypes != null);
Infrastructure\ResourceInvoker.cs (50)
339Debug.Assert(state != null); 340Debug.Assert(_authorizationContext != null); 363Debug.Assert(state != null); 364Debug.Assert(_authorizationContext != null); 385Debug.Assert(state != null); 386Debug.Assert(_authorizationContext != null); 415Debug.Assert(state != null); 416Debug.Assert(_authorizationContext != null); 417Debug.Assert(_authorizationContext.Result != null); 475Debug.Assert(state != null); 476Debug.Assert(_resourceExecutingContext != null); 499Debug.Assert(state != null); 500Debug.Assert(_resourceExecutingContext != null); 534Debug.Assert(state != null); 535Debug.Assert(_resourceExecutingContext != null); 577Debug.Assert(state != null); 578Debug.Assert(_resourceExecutingContext != null); 579Debug.Assert(_resourceExecutedContext != null); 603Debug.Assert(state != null); 604Debug.Assert(_resourceExecutingContext != null); 605Debug.Assert(_resourceExecutedContext != null); 651Debug.Assert(scope == Scope.Invoker || scope == Scope.Resource); 670Debug.Assert(state != null); 700Debug.Assert(state != null); 701Debug.Assert(_exceptionContext != null); 737Debug.Assert(state != null); 786Debug.Assert(state != null); 787Debug.Assert(_exceptionContext != null); 826Debug.Fail("unreachable"); 860Debug.Assert(scope == Scope.Invoker || scope == Scope.Resource); 893Debug.Assert(scope == Scope.Invoker); 912Debug.Assert(_resourceExecutingContext != null); 926Debug.Assert(_resourceExecutedContext != null); 933Debug.Assert(invoker._resourceExecutedContext != null); 975Debug.Assert(_resourceExecutedContext != null); 997Debug.Assert(invoker._resourceExecutedContext != null); 1172Debug.Assert(state != null); 1173Debug.Assert(_resultExecutingContext != null); 1196Debug.Assert(state != null); 1197Debug.Assert(_resultExecutingContext != null); 1229Debug.Assert(state != null); 1230Debug.Assert(_resultExecutingContext != null); 1278Debug.Assert(state != null); 1279Debug.Assert(_resultExecutingContext != null); 1280Debug.Assert(_resultExecutedContext != null); 1377Debug.Assert(_resultExecutedContext != null); 1400Debug.Assert(invoker._resultExecutedContext != null); 1408Debug.Assert(_resultExecutingContext != null); 1422Debug.Assert(_resultExecutedContext != null); 1429Debug.Assert(invoker._resultExecutedContext != null);
ModelBinding\Binders\ArrayModelBinder.cs (2)
94Debug.Assert(targetType == typeof(TElement[]), "GenericModelBinder only creates this binder for arrays."); 102Debug.Assert(targetType == typeof(TElement?[]), "GenericModelBinder only creates this binder for arrays.");
ModelBinding\Binders\CollectionModelBinder.cs (2)
168Debug.Assert(model != null); 472Debug.Assert(targetCollection != null, "This binder is instantiated only for ICollection<T> model types.");
ModelBinding\Binders\ComplexObjectModelBinder.cs (3)
68Debug.Assert(propertyData == GreedyPropertiesMayHaveData || propertyData == ValueProviderDataAvailable); 440Debug.Assert(property.MetadataKind == ModelMetadataKind.Property); 485Debug.Assert(parameter.MetadataKind == ModelMetadataKind.Parameter);
ModelBinding\Binders\ComplexTypeModelBinder.cs (1)
97Debug.Assert(propertyData == GreedyPropertiesMayHaveData || propertyData == ValueProviderDataAvailable);
ModelBinding\Binders\DictionaryModelBinder.cs (1)
119Debug.Assert(result.Model != null);
ModelBinding\Binders\FormFileModelBinder.cs (2)
105Debug.Assert(postedFiles is List<IFormFile>); 110Debug.Assert(postedFiles is List<IFormFile>);
ModelBinding\Binders\HeaderModelBinder.cs (1)
194Debug.Assert(values != null);
ModelBinding\Metadata\DefaultModelMetadataProvider.cs (2)
227Debug.Fail($"Unable to find property '{propertyKey.Name}' on type '{propertyKey.ContainerType}."); 358Debug.Assert(propertyKey.MetadataKind == ModelMetadataKind.Property);
ModelBinding\ModelBinderFactory.cs (4)
79Debug.Assert(!(binder is PlaceholderBinder)); 176Debug.Assert(metadata != null); 177Debug.Assert(binder != null); 189Debug.Assert(metadata != null);
ModelBinding\PlaceholderBinder.cs (1)
20Debug.Assert(Inner is not null, "Inner must be resolved before BindModelAsync can be called.");
ModelBinding\PrefixContainer.cs (2)
202Debug.Assert(candidate.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)); 259Debug.Assert(candidate.StartsWith(prefix, StringComparison.OrdinalIgnoreCase));
ModelBinding\SuppressChildValidationMetadataProvider.cs (2)
80Debug.Fail("We shouldn't get here."); 85Debug.Assert(FullTypeName != null);
ModelBinding\Validation\ClientValidatorCache.cs (1)
83Debug.Assert(entry.Items != null);
ModelBinding\Validation\ValidationStack.cs (1)
56Debug.Assert(ReferenceEquals(List[List.Count - 1], model));
ModelBinding\Validation\ValidationVisitor.cs (3)
203Debug.Assert(Key != null); 204Debug.Assert(Metadata != null); 422Debug.Assert(Metadata is not null && Key is not null && Model is not null);
ModelBinding\Validation\ValidatorCache.cs (1)
73Debug.Assert(entry.Items != null);
MvcCoreDiagnosticListenerExtensions.cs (100)
26Debug.Assert(diagnosticListener != null); 27Debug.Assert(actionDescriptor != null); 28Debug.Assert(httpContext != null); 29Debug.Assert(routeData != null); 54Debug.Assert(diagnosticListener != null); 55Debug.Assert(actionDescriptor != null); 56Debug.Assert(httpContext != null); 57Debug.Assert(routeData != null); 81Debug.Assert(diagnosticListener != null); 82Debug.Assert(authorizationContext != null); 83Debug.Assert(filter != null); 111Debug.Assert(diagnosticListener != null); 112Debug.Assert(authorizationContext != null); 113Debug.Assert(filter != null); 141Debug.Assert(diagnosticListener != null); 142Debug.Assert(authorizationContext != null); 143Debug.Assert(filter != null); 171Debug.Assert(diagnosticListener != null); 172Debug.Assert(authorizationContext != null); 173Debug.Assert(filter != null); 201Debug.Assert(diagnosticListener != null); 202Debug.Assert(resourceExecutingContext != null); 203Debug.Assert(filter != null); 231Debug.Assert(diagnosticListener != null); 232Debug.Assert(resourceExecutedContext != null); 233Debug.Assert(filter != null); 261Debug.Assert(diagnosticListener != null); 262Debug.Assert(resourceExecutingContext != null); 263Debug.Assert(filter != null); 291Debug.Assert(diagnosticListener != null); 292Debug.Assert(resourceExecutingContext != null); 293Debug.Assert(filter != null); 321Debug.Assert(diagnosticListener != null); 322Debug.Assert(resourceExecutedContext != null); 323Debug.Assert(filter != null); 351Debug.Assert(diagnosticListener != null); 352Debug.Assert(resourceExecutedContext != null); 353Debug.Assert(filter != null); 381Debug.Assert(diagnosticListener != null); 382Debug.Assert(exceptionContext != null); 383Debug.Assert(filter != null); 411Debug.Assert(diagnosticListener != null); 412Debug.Assert(exceptionContext != null); 413Debug.Assert(filter != null); 441Debug.Assert(diagnosticListener != null); 442Debug.Assert(exceptionContext != null); 443Debug.Assert(filter != null); 471Debug.Assert(diagnosticListener != null); 472Debug.Assert(exceptionContext != null); 473Debug.Assert(filter != null); 501Debug.Assert(diagnosticListener != null); 502Debug.Assert(actionExecutingContext != null); 503Debug.Assert(filter != null); 531Debug.Assert(diagnosticListener != null); 532Debug.Assert(actionExecutedContext != null); 533Debug.Assert(filter != null); 561Debug.Assert(diagnosticListener != null); 562Debug.Assert(actionExecutingContext != null); 563Debug.Assert(filter != null); 591Debug.Assert(diagnosticListener != null); 592Debug.Assert(actionExecutingContext != null); 593Debug.Assert(filter != null); 621Debug.Assert(diagnosticListener != null); 622Debug.Assert(actionExecutedContext != null); 623Debug.Assert(filter != null); 651Debug.Assert(diagnosticListener != null); 652Debug.Assert(actionExecutedContext != null); 653Debug.Assert(filter != null); 682Debug.Assert(diagnosticListener != null); 683Debug.Assert(actionContext != null); 684Debug.Assert(actionArguments != null); 685Debug.Assert(controller != null); 728Debug.Assert(diagnosticListener != null); 729Debug.Assert(actionContext != null); 730Debug.Assert(actionArguments != null); 731Debug.Assert(controller != null); 774Debug.Assert(diagnosticListener != null); 775Debug.Assert(resultExecutingContext != null); 776Debug.Assert(filter != null); 804Debug.Assert(diagnosticListener != null); 805Debug.Assert(resultExecutedContext != null); 806Debug.Assert(filter != null); 834Debug.Assert(diagnosticListener != null); 835Debug.Assert(resultExecutingContext != null); 836Debug.Assert(filter != null); 864Debug.Assert(diagnosticListener != null); 865Debug.Assert(resultExecutingContext != null); 866Debug.Assert(filter != null); 894Debug.Assert(diagnosticListener != null); 895Debug.Assert(resultExecutedContext != null); 896Debug.Assert(filter != null); 924Debug.Assert(diagnosticListener != null); 925Debug.Assert(resultExecutedContext != null); 926Debug.Assert(filter != null); 954Debug.Assert(diagnosticListener != null); 955Debug.Assert(actionContext != null); 956Debug.Assert(result != null); 980Debug.Assert(diagnosticListener != null); 981Debug.Assert(actionContext != null); 982Debug.Assert(result != null);
Routing\ActionEndpointDataSourceBase.cs (4)
46Debug.Assert(_changeToken != null); 47Debug.Assert(_endpoints != null); 90Debug.Assert(_changeToken != null); 91Debug.Assert(_endpoints != null);
Routing\DynamicControllerEndpointMatcherPolicy.cs (1)
166Debug.Assert(currentSelector == null || ReferenceEquals(currentSelector, selector));
Routing\UrlHelperBase.cs (2)
309Debug.Assert(path.HasValue); 321Debug.Assert(pageName.Length > 0);
Routing\ViewEnginePath.cs (3)
18Debug.Assert(!string.IsNullOrEmpty(first)); 31Debug.Assert(index >= 0); 48Debug.Assert(!string.IsNullOrEmpty(path));
src\aspnetcore\src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (3)
66Debug.Assert(isTrimAotCompatible, "isTrimAotCompatible should always be true."); 149Debug.Assert(_executor != null, "Sync execution is not supported."); 178Debug.Assert(_executorAsync != null, "Async execution is not supported.");
src\aspnetcore\src\Shared\PropertyHelper\PropertyHelper.cs (18)
161Debug.Assert(propertyInfo != null); 181Debug.Assert(propertyInfo != null); 195Debug.Assert(propertyInfo != null); 198Debug.Assert(propertyGetterWrapperMethod != null); 199Debug.Assert(propertyGetterWrapperMethod.IsGenericMethodDefinition); 200Debug.Assert(propertyGetterWrapperMethod.GetParameters().Length == 2); 203Debug.Assert(propertyGetterByRefWrapperMethod != null); 204Debug.Assert(propertyGetterByRefWrapperMethod.IsGenericMethodDefinition); 205Debug.Assert(propertyGetterByRefWrapperMethod.GetParameters().Length == 2); 208Debug.Assert(getMethod != null); 209Debug.Assert(!getMethod.IsStatic); 210Debug.Assert(getMethod.GetParameters().Length == 0); 274Debug.Assert(propertyInfo != null); 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 278Debug.Assert(setMethod != null); 279Debug.Assert(!setMethod.IsStatic); 280Debug.Assert(setMethod.ReturnType == typeof(void)); 282Debug.Assert(parameters.Length == 1);
src\aspnetcore\src\Shared\RangeHelper\RangeHelper.cs (1)
67Debug.Assert(rangeHeader.Ranges.Count == 1);
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
26Debug.Assert(path.HasValue);
Microsoft.AspNetCore.Mvc.Formatters.Xml (3)
XmlDataContractSerializerOutputFormatter.cs (2)
242Debug.Assert(valueType is not null); 251Debug.Assert(wrapperProvider is not null);
XmlSerializerOutputFormatter.cs (1)
228Debug.Assert(wrapperProvider is not null);
Microsoft.AspNetCore.Mvc.Localization (2)
Properties\Resources.Designer.cs (1)
49System.Diagnostics.Debug.Assert(value != null);
ViewLocalizer.cs (1)
90Debug.Assert(!string.IsNullOrEmpty(path), "Couldn't determine a path for the view");
Microsoft.AspNetCore.Mvc.NewtonsoftJson (2)
BsonTempDataSerializer.cs (2)
182Debug.Assert(genericTypeArguments.Length == 1, "IList<T> has one generic argument"); 188Debug.Assert(
Microsoft.AspNetCore.Mvc.Razor (7)
Compilation\DefaultViewCompiler.cs (1)
120Debug.Assert(relativePath != null);
RazorPageBase.cs (2)
304Debug.Assert(_valueBuffer is not null); 607Debug.Assert(_tagHelperAttributeInfo.ExecutionContext != null);
RazorView.cs (2)
97Debug.Assert(_bufferScope != null); 280Debug.Assert(originalLocations is not null && layoutPageResult.SearchedLocations is not null);
RazorViewEngine.cs (2)
482Debug.Assert(!string.IsNullOrEmpty(name)); 488Debug.Assert(!string.IsNullOrEmpty(name));
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (17)
CSharpCompiler.cs (4)
117Debug.Assert(_parseOptions is not null); 118Debug.Assert(_compilationOptions is not null); 119Debug.Assert(_emitOptions is not null); 229Debug.Fail($"LanguageVersion {languageVersion} specified in the deps file could not be parsed.");
PageActionDescriptorChangeProvider.cs (1)
32Debug.Assert(!string.IsNullOrEmpty(rootDirectory));
RuntimeViewCompiler.cs (5)
138Debug.Assert(item.ExpirationTokens != null); 152Debug.Assert(item.Descriptor != null); 162Debug.Assert(taskSource != null); 168Debug.Assert(item.Descriptor != null); 383Debug.Assert(relativePath != null);
src\aspnetcore\src\Mvc\Mvc.RazorPages\src\ApplicationModels\PageRouteModelFactory.cs (7)
89Debug.Assert(relativePath.StartsWith('/')); 129Debug.Assert(path.StartsWith(rootDirectory, StringComparison.OrdinalIgnoreCase)); 130Debug.Assert(path.EndsWith(RazorViewEngine.ViewExtension, StringComparison.OrdinalIgnoreCase)); 140Debug.Assert(!string.IsNullOrEmpty(areaName)); 141Debug.Assert(!string.IsNullOrEmpty(viewEnginePath)); 142Debug.Assert(viewEnginePath.StartsWith('/')); 175Debug.Assert(directory.StartsWith('/'));
Microsoft.AspNetCore.Mvc.RazorPages (80)
ApplicationModels\PageRouteModelFactory.cs (7)
89Debug.Assert(relativePath.StartsWith('/')); 129Debug.Assert(path.StartsWith(rootDirectory, StringComparison.OrdinalIgnoreCase)); 130Debug.Assert(path.EndsWith(RazorViewEngine.ViewExtension, StringComparison.OrdinalIgnoreCase)); 140Debug.Assert(!string.IsNullOrEmpty(areaName)); 141Debug.Assert(!string.IsNullOrEmpty(viewEnginePath)); 142Debug.Assert(viewEnginePath.StartsWith('/')); 175Debug.Assert(directory.StartsWith('/'));
DependencyInjection\RazorPagesRazorViewEngineOptionsSetup.cs (1)
26Debug.Assert(!string.IsNullOrEmpty(rootDirectory));
Infrastructure\DynamicPageEndpointMatcherPolicy.cs (1)
183Debug.Assert(currentSelector == null || ReferenceEquals(currentSelector, selector));
Infrastructure\DynamicPageEndpointSelectorCache.cs (1)
35Debug.Assert(dataSourceId is not null);
Infrastructure\PageActionInvoker.cs (29)
194Debug.Assert(_instance is not null); 215Debug.Assert(handlerBinder is not null); 216Debug.Assert(_arguments is not null); 255Debug.Assert(_instance is not null); 256Debug.Assert(_arguments is not null); 269Debug.Assert(executor != null, "We should always find a executor for a handler"); 323Debug.Assert(_instance is not null); 359Debug.Assert(state != null); 360Debug.Assert(_handlerSelectedContext != null); 383Debug.Assert(state != null); 384Debug.Assert(_handlerSelectedContext != null); 399Debug.Assert(state != null); 400Debug.Assert(_handlerSelectedContext != null); 441Debug.Assert(_instance is not null); 442Debug.Assert(_arguments is not null); 473Debug.Assert(state != null); 474Debug.Assert(_handlerExecutingContext != null); 497Debug.Assert(state != null); 498Debug.Assert(_handlerExecutingContext != null); 500Debug.Assert(_instance is not null); 531Debug.Assert(state != null); 532Debug.Assert(_handlerExecutingContext != null); 533Debug.Assert(_instance is not null); 582Debug.Assert(state != null); 583Debug.Assert(_handlerExecutingContext != null); 584Debug.Assert(_handlerExecutedContext != null); 672Debug.Assert(_handlerExecutedContext != null); 677Debug.Assert(_handlerExecutingContext != null); 692Debug.Assert(_handlerExecutedContext != null);
Infrastructure\PageActionInvokerCache.cs (1)
47Debug.Assert(compiledPageActionDescriptor != null, "PageLoader didn't run!");
MvcRazorPagesDiagnosticListenerExtensions.cs (40)
20Debug.Assert(diagnosticListener != null); 21Debug.Assert(actionContext != null); 22Debug.Assert(handlerMethodDescriptor != null); 23Debug.Assert(arguments != null); 24Debug.Assert(instance != null); 56Debug.Assert(diagnosticListener != null); 57Debug.Assert(actionContext != null); 58Debug.Assert(handlerMethodDescriptor != null); 59Debug.Assert(arguments != null); 60Debug.Assert(instance != null); 90Debug.Assert(diagnosticListener != null); 91Debug.Assert(handlerExecutionContext != null); 92Debug.Assert(filter != null); 120Debug.Assert(diagnosticListener != null); 121Debug.Assert(handlerExecutedContext != null); 122Debug.Assert(filter != null); 150Debug.Assert(diagnosticListener != null); 151Debug.Assert(handlerExecutingContext != null); 152Debug.Assert(filter != null); 180Debug.Assert(diagnosticListener != null); 181Debug.Assert(handlerExecutingContext != null); 182Debug.Assert(filter != null); 210Debug.Assert(diagnosticListener != null); 211Debug.Assert(handlerExecutedContext != null); 212Debug.Assert(filter != null); 240Debug.Assert(diagnosticListener != null); 241Debug.Assert(handlerExecutedContext != null); 242Debug.Assert(filter != null); 270Debug.Assert(diagnosticListener != null); 271Debug.Assert(handlerSelectedContext != null); 272Debug.Assert(filter != null); 300Debug.Assert(diagnosticListener != null); 301Debug.Assert(handlerSelectedContext != null); 302Debug.Assert(filter != null); 330Debug.Assert(diagnosticListener != null); 331Debug.Assert(handlerSelectedContext != null); 332Debug.Assert(filter != null); 360Debug.Assert(diagnosticListener != null); 361Debug.Assert(handlerSelectedContext != null); 362Debug.Assert(filter != null);
Microsoft.AspNetCore.Mvc.TagHelpers (9)
CacheTagHelper.cs (2)
164Debug.Fail($"{nameof(content)} should be an {nameof(CharBufferHtmlContent)}."); 269Debug.Assert(length == 0);
CurrentValues.cs (1)
12Debug.Assert(values != null);
JavaScriptResources.cs (1)
39Debug.Assert(
LinkTagHelper.cs (2)
325Debug.Assert(url != null); 451Debug.Assert(fallbackHrefs[i] != null);
ScriptTagHelper.cs (2)
352Debug.Assert(url != null); 380Debug.Assert(src != null);
TagHelperOutputExtensions.cs (1)
99Debug.Assert(found);
Microsoft.AspNetCore.Mvc.Testing (2)
Handlers\RedirectHandler.cs (1)
137Debug.Assert(response.RequestMessage is not null);
src\db4096461e91d616\HostFactoryResolver.cs (1)
304Debug.Assert(_hostTcs.Task.IsCompleted);
Microsoft.AspNetCore.Mvc.ViewFeatures (47)
AttributeDictionary.cs (8)
76Debug.Assert(index >= 0 && index < Count && _items != null); 82Debug.Assert(index >= 0 && index <= Count); 83Debug.Assert(value.Key != null); 95Debug.Assert(index >= 0 && index <= Count); 96Debug.Assert(value.Key != null); 108Debug.Assert(index >= 0 && index < Count); 110Debug.Assert(_items != null); 119Debug.Assert(key != null);
Buffers\PagedBufferedTextWriter.cs (2)
50Debug.Assert(length > 0); 66Debug.Assert(length == 0);
Buffers\PagedCharBuffer.cs (2)
61Debug.Assert(copyLength > 0); 82Debug.Assert(copyLength > 0);
CachedExpressionCompiler.cs (2)
45Debug.Assert(expression != null); 223Debug.Assert(combinedNullTest.Type == typeof(bool));
DefaultDisplayTemplates.cs (1)
89Debug.Assert(elementMetadata != null);
DefaultEditorTemplates.cs (1)
72Debug.Assert(elementMetadata != null);
DefaultHtmlGenerator.cs (4)
199Debug.Assert(!isChecked.HasValue); 454Debug.Assert(!isChecked.HasValue); 457Debug.Assert(value != null); 966Debug.Assert(isTargetEnum ^ enumNames == null);
ExpressionHelper.cs (7)
131Debug.Assert(segmentCount >= 0); 134Debug.Assert(!doNotCache); 148Debug.Assert(doNotCache); 157Debug.Assert(doNotCache); 168Debug.Assert(!name.Contains("__")); 182Debug.Assert(false); 187Debug.Assert(segmentCount == 0);
ExpressionMetadataProvider.cs (1)
118Debug.Assert(metadata != null);
Filters\SaveTempDataPropertyFilterBase.cs (1)
70Debug.Assert(Subject != null, "Subject must be set before this method is invoked.");
ModelExplorer.cs (2)
127Debug.Assert(Container != null); 202Debug.Assert(propertyHelper != null);
ModelExplorerExtensions.cs (1)
53Debug.Assert(enumGroupedDisplayNamesAndValues != null);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (6)
93Debug.Assert(_rentedBuffer != null); 172Debug.Assert(_rentedBuffer != null); 196Debug.Assert(oldBuffer.Length >= _index); 197Debug.Assert(_rentedBuffer.Length >= _index); 205Debug.Assert(_rentedBuffer.Length - _index > 0); 206Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
TempDataDictionary.cs (1)
152Debug.Assert(_initialKeys is not null && _retainedKeys is not null && _data is not null);
TemplateBuilder.cs (1)
107Debug.Assert(enumGrouped != null);
ValidationHelpers.cs (4)
13Debug.Assert(modelError != null); 29Debug.Assert(modelError != null); 30Debug.Assert(containingEntry != null); 31Debug.Assert(modelExplorer != null);
ViewDataDictionaryFactory.cs (2)
18Debug.Assert(constructor != null); 39Debug.Assert(constructor != null);
ViewDataEvaluator.cs (1)
100Debug.Assert(expression != null);
Microsoft.AspNetCore.OpenApi (23)
_generated\0\GeneratedRouteBuilderExtensions.g.cs (6)
69Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 70Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 79Debug.Assert(options != null, "RequestDelegateFactoryOptions not found."); 80Debug.Assert(options.EndpointBuilder != null, "EndpointBuilder not found."); 81Debug.Assert(options.EndpointBuilder.ApplicationServices != null, "ApplicationServices not found."); 82Debug.Assert(options.EndpointBuilder.FilterFactories != null, "FilterFactories not found.");
Extensions\ApiDescriptionExtensions.cs (1)
70Debug.Assert(apiDescription.RelativePath != null, "Relative path cannot be null.");
Schemas\OpenApiJsonSchema.Helpers.cs (1)
215Debug.Assert(type is not null);
Services\OpenApiDocumentService.cs (1)
261Debug.Assert(descriptions.Key != null, "Relative path mapped to OpenApiPath key cannot be null.");
Services\Schemas\OpenApiSchemaService.cs (1)
259Debug.Assert(deserializedSchema != null, "The schema should have been deserialized successfully and materialize a non-null value.");
src\aspnetcore\src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (3)
66Debug.Assert(isTrimAotCompatible, "isTrimAotCompatible should always be true."); 149Debug.Assert(_executor != null, "Sync execution is not supported."); 178Debug.Assert(_executorAsync != null, "Async execution is not supported.");
src\aspnetcore\src\Shared\ParameterBindingMethodCache.cs (2)
525Debug.Fail("No suitable System.Enum.TryParse method found."); 725Debug.Assert(obj is ParameterLookupKey);
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (1)
24Debug.Assert(propertyInfo != null, "PropertyInfo must be provided.");
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
132Debug.Assert(charsUsed == 1);
Transformers\OpenApiDocumentTransformerContext.cs (1)
92Debug.Assert(Document is not null, "Document should have been initialized by framework.");
Transformers\TypeBasedOpenApiDocumentTransformer.cs (1)
25Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiDocumentTransformer)}.");
Transformers\TypeBasedOpenApiOperationTransformer.cs (1)
25Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiOperationTransformer)}.");
Transformers\TypeBasedOpenApiSchemaTransformer.cs (1)
25Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiSchemaTransformer)}.");
Microsoft.AspNetCore.OpenApi.SourceGenerators (4)
src\aspnetcore\src\Shared\Diagnostics\AnalyzerDebug.cs (4)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b); 16/// <inheritdoc cref="Debug.Assert(bool, string)"/> 19=> Debug.Assert(b, message);
Microsoft.AspNetCore.OutputCaching (20)
FormatterBinaryWriter.cs (6)
46Debug.Assert(target is not null); 50Debug.Assert(length == 0 && offset == 0); 55Debug.Assert(offset >= 0 && offset <= length); 56Debug.Assert(length > 0); 94Debug.Assert(actual == bytes); 102Debug.Assert(actual == bytes);
Memory\MemoryOutputCacheStore.cs (7)
100Debug.Assert(keys != null); 118Debug.Assert(key != null); 137Debug.Assert(state != null); 141Debug.Assert(tags != null); 142Debug.Assert(tags.Length > 0); 143Debug.Assert(key is string); 144Debug.Assert(entryId != Guid.Empty);
OutputCacheEntryFormatter.cs (1)
373Debug.Assert(reader.IsEOF, "should have read entire payload");
RecyclableArrayBufferWriter.cs (4)
66Debug.Assert(_buffer.Length > _index); 73Debug.Assert(_buffer.Length > _index); 107Debug.Assert(needed > currentLength); 127Debug.Assert(FreeCapacity > 0 && FreeCapacity >= sizeHint);
RecyclableSequenceBuilder.cs (2)
73Debug.Assert(_currentSegment is not null); 75Debug.Assert(_currentSegmentIndex >= 0 && _currentSegmentIndex <= current.Length);
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (7)
RedisOutputCacheStore.cs (7)
99Debug.Assert(secondsWithJitter >= 270 && secondsWithJitter <= 330); 168Debug.Assert(cache is not null); 193Debug.Assert(cache is not null); 212Debug.Assert(cache is not null); 246Debug.Assert(cache is not null); 345Debug.Assert(_cache is not null); 497Debug.WriteLine(ex);
Microsoft.AspNetCore.Razor (1)
TagHelpers\DefaultTagHelperContent.cs (1)
34Debug.Assert(_buffer.Count == 0);
Microsoft.AspNetCore.Razor.Runtime (1)
Runtime\TagHelpers\TagHelperExecutionContext.cs (1)
221Debug.Assert(!Output.IsContentModified);
Microsoft.AspNetCore.Razor.Utilities.Shared (117)
PooledArrayBufferWriter`1.cs (6)
87Debug.Assert(_rentedBuffer != null); 161Debug.Assert(_rentedBuffer != null); 182Debug.Assert(oldBuffer.Length >= _index); 183Debug.Assert(_rentedBuffer.Length >= _index); 191Debug.Assert(_rentedBuffer.Length - _index > 0); 192Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\EnumerableExtensions.cs (2)
60Debug.Assert(result.Length == count); 131Debug.Assert(result.Length == count);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\EnumExtensions.cs (4)
38Debug.Fail("Unexpected enum underlying type."); 67Debug.Fail("Unexpected enum underlying type."); 111Debug.Fail("Unexpected enum underlying type."); 141Debug.Fail("Unexpected enum underlying type.");
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\ImmutableArrayExtensions.cs (13)
310Debug.Assert(i > 0); 322Debug.Assert(i > 0); 335Debug.Assert(!(none && all)); 394Debug.Assert(i > 0); 406Debug.Assert(i > 0); 419Debug.Assert(!(none && all)); 476Debug.Assert(i > 0); 488Debug.Assert(i > 0); 501Debug.Assert(!(none && all)); 562Debug.Assert(i > 0); 574Debug.Assert(i > 0); 587Debug.Assert(!(none && all)); 964Debug.Assert(uniqueItems.Count == 0, $"{nameof(uniqueItems)} should be empty!");
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\MemoryBuilder`1.cs (6)
58Debug.Assert(value >= 0); 59Debug.Assert(value <= _memory.Length); 69Debug.Assert(index >= 0 && index < _length); 115Debug.Assert(_length == _memory.Length); 136Debug.Assert(additionalCapacityRequired > 0); 159Debug.Assert(nextCapacity > _memory.Length);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\PooledObjects\PooledArrayBuilder`1.cs (12)
147Debug.Assert(_inlineCount <= InlineCapacity); 206Debug.Assert(_inlineCount <= InlineCapacity); 221Debug.Assert(_inlineCount <= InlineCapacity); 359Debug.Assert(index >= 0 && index <= Count); 385Debug.Assert(index >= 0 && index <= Count); 419Debug.Assert(index >= 0 && index <= Count); 660Debug.Assert(_inlineCount <= InlineCapacity); 1600Debug.Assert(_builder is null); 1629Debug.Assert(_builder is null); 1630Debug.Assert(index >= 0 && index < _inlineCount); 1631Debug.Assert(offset > 0); 1632Debug.Assert(offset + _inlineCount <= InlineCapacity);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\PooledObjects\PooledHashSet`1.cs (1)
235Debug.Assert(_set is null);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\Utilities\SortHelper`1.cs (2)
106Debug.Assert(typeof(TElement) == typeof(T)); 180Debug.Assert(typeof(TElement) == typeof(T));
Utilities\Checksum.Builder.cs (2)
47Debug.Assert(length <= 8, $"length should never be greater than 8."); 65Debug.Assert(s_buffer is not null);
Utilities\Hashing\NonCryptographicHashAlgorithm.cs (1)
328Debug.Assert(destination.Length == HashLengthInBytes);
Utilities\Hashing\XxHash128.cs (6)
257Debug.Assert(length >= 1 && length <= 3); 282Debug.Assert(length >= 4 && length <= 8); 308Debug.Assert(length >= 9 && length <= 16); 334Debug.Assert(length >= 17 && length <= 128); 360Debug.Assert(length >= 129 && length <= 240); 393Debug.Assert(length > 240);
Utilities\Hashing\XxHashShared.cs (45)
121Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 124Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 127Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 129Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 130Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 131Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 132Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 133Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 134Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 135Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 136Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 137Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 138Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 139Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 140Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 141Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 142Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 145Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 212Debug.Assert(length > 240); 228Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 229Debug.Assert(stripesSoFar < stripesPerBlock); 250Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 280Debug.Assert(sourceIndex < source.Length); 286Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 290Debug.Assert(stripesToEnd <= stripes); 309Debug.Assert(sourceIndex < source.Length); // at least some bytes left 331Debug.Assert(sourceIndex < source.Length); 332Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 333Debug.Assert(state.BufferedCount == 0); 370Debug.Assert(state.BufferedCount > 0); 786Debug.Assert(shift >= 0 && shift < 64);
Microsoft.AspNetCore.ResponseCompression (2)
ResponseCompressionMiddleware.cs (1)
59Debug.Assert(originalBodyFeature != null);
ResponseCompressionProvider.cs (1)
84Debug.Assert(false, "Duplicate check failed.");
Microsoft.AspNetCore.Rewrite (9)
ApacheModRewrite\ConditionEvaluator.cs (1)
52Debug.Assert(condResult != null, "ConditionEvaluator must be passed at least one condition to evaluate.");
ApacheModRewrite\CookieActionFactory.cs (1)
59Debug.Assert(action != null || tokenType == Fields.Name);
ApacheModRewrite\RuleBuilder.cs (4)
65Debug.Assert(input.Operand != null); 76Debug.Assert(input.Operand != null); 102Debug.Assert(input.Operand != null); 162Debug.Assert(input.Operand != null);
PatternSegments\RuleMatchSegment.cs (1)
19Debug.Assert(ruleBackReferences != null);
UrlMatches\IntegerMatch.cs (1)
59Debug.Fail("This is never reached.");
UrlMatches\StringMatch.cs (1)
41Debug.Fail("This is never reached.");
Microsoft.AspNetCore.Routing (91)
ArrayBuilder.cs (7)
32Debug.Assert(capacity >= 0); 61Debug.Assert(index >= 0 && index < _count); 85Debug.Assert(_count > 0); 94Debug.Assert(_count > 0); 111Debug.Assert(_array != null); // Nonzero _count should imply this 141Debug.Assert(_count < Capacity); 148Debug.Assert(minimum > Capacity);
Constraints\RegexRouteConstraint.cs (1)
68Debug.Assert(_regexFactory is not null);
Matching\CandidateSet.cs (2)
289Debug.Assert(cmp <= 0); 335Debug.Assert(count > 0);
Matching\DfaMatcher.cs (2)
198Debug.Assert(candidateStateArray is not null); 205Debug.Assert(candidateStateArray is not null);
Matching\DfaMatcherBuilder.cs (1)
396Debug.Assert(i == segment.Parts.Count - 1 && partParameter.IsOptional);
Matching\EndpointComparer.cs (5)
43Debug.Assert(x != null); 44Debug.Assert(y != null); 79Debug.Assert(x != null); 80Debug.Assert(y != null); 88Debug.Fail("We don't expect this to be called.");
Matching\ILEmitTrieFactory.cs (4)
524Debug.Assert(entries.Length == 1, "We should have a single entry"); 534Debug.Assert(index + 4 <= text.Length); 544Debug.Assert(index + 4 <= text.Length); 552Debug.Assert(index + 1 <= text.Length);
Matching\SingleEntryAsciiJumpTable.cs (1)
47Debug.Assert(a.Length == b.Length && b.Length == length);
ParameterPolicyActivator.cs (1)
161Debug.Assert(constructors.Count > 0);
ParameterPolicyFactory.cs (1)
40Debug.Assert(reference.ParameterPolicy != null || reference.Content != null);
PathTokenizer.cs (3)
47Debug.Assert(_path[0] == '/'); 89Debug.Assert(_path[_path.Length - 1] != '/'); 90Debug.Assert(currentSegmentIndex == index);
Patterns\RoutePattern.cs (5)
45Debug.Assert(defaults != null); 46Debug.Assert(parameterPolicies != null); 47Debug.Assert(parameters != null); 48Debug.Assert(requiredValues != null); 49Debug.Assert(pathSegments != null);
Patterns\RoutePatternLiteralPart.cs (1)
22Debug.Assert(!string.IsNullOrEmpty(content));
Patterns\RoutePatternMatcher.cs (9)
111Debug.Assert(pathSegment != null); 168Debug.Assert(pathSegment != null); 169Debug.Assert(pathSegment.IsSimple); 172Debug.Assert(part.IsParameter); 240Debug.Assert(!pathSegment.IsSimple); 338Debug.Assert(routeSegment != null); 339Debug.Assert(routeSegment.Parts.Count > 1); 361Debug.Assert(part.IsLiteral || part.IsSeparator); 434Debug.Assert(false, "indexOfLastSegementUsed should always be 0 from the check above");
Patterns\RoutePatternParser.cs (8)
51Debug.Assert(context.AtEnd() || context.Current == Separator); 73Debug.Assert(context != null); 74Debug.Assert(segments != null); 145Debug.Assert(context.Current == OpenBrace); 445Debug.Assert(context != null); 446Debug.Assert(literal != null); 485Debug.Assert(template != null); 526Debug.Assert(_index >= 0);
Patterns\RoutePatternSeparatorPart.cs (1)
39Debug.Assert(!string.IsNullOrEmpty(content));
RequestDelegateFilterPipelineBuilder.cs (1)
19Debug.Assert(options.EndpointBuilder != null);
RouteBase.cs (2)
313Debug.Assert(_constraintLogger != null); 324Debug.Assert(_constraintLogger != null);
RouteCollection.cs (1)
150Debug.Assert(_options != null);
RouteEndpointDataSource.cs (2)
219Debug.Assert(entry.InferMetadataFunc != null, "A func to infer metadata must be provided for route handlers."); 264Debug.Assert(factoryCreatedRequestDelegate is not null);
RouteOptions.cs (1)
34Debug.Assert(_endpointDataSources != null, "Endpoint data sources should have been set in DI.");
src\aspnetcore\src\Shared\PropertyHelper\PropertyHelper.cs (18)
161Debug.Assert(propertyInfo != null); 181Debug.Assert(propertyInfo != null); 195Debug.Assert(propertyInfo != null); 198Debug.Assert(propertyGetterWrapperMethod != null); 199Debug.Assert(propertyGetterWrapperMethod.IsGenericMethodDefinition); 200Debug.Assert(propertyGetterWrapperMethod.GetParameters().Length == 2); 203Debug.Assert(propertyGetterByRefWrapperMethod != null); 204Debug.Assert(propertyGetterByRefWrapperMethod.IsGenericMethodDefinition); 205Debug.Assert(propertyGetterByRefWrapperMethod.GetParameters().Length == 2); 208Debug.Assert(getMethod != null); 209Debug.Assert(!getMethod.IsStatic); 210Debug.Assert(getMethod.GetParameters().Length == 0); 274Debug.Assert(propertyInfo != null); 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 278Debug.Assert(setMethod != null); 279Debug.Assert(!setMethod.IsStatic); 280Debug.Assert(setMethod.ReturnType == typeof(void)); 282Debug.Assert(parameters.Length == 1);
Template\RoutePrecedence.cs (7)
48Debug.Assert(digit >= 0 && digit < 10); 69Debug.Assert(digit >= 0 && digit < 10); 102Debug.Assert(digit >= 0 && digit < 10); 125Debug.Assert(digit >= 0 && digit < 10); 163Debug.Assert(part.IsParameter); 191Debug.Assert(parameterPart != null); 231Debug.Assert(part.IsParameter);
Template\TemplateBinder.cs (2)
518Debug.Assert(context.BufferState == SegmentState.Beginning); 519Debug.Assert(context.UriState == SegmentState.Beginning);
Tree\TreeEnumerator.cs (1)
94Debug.Assert(next.Depth < _tokenizer.Count);
Tree\UrlMatchingTree.cs (2)
98Debug.Assert(segment.Parts.Count == 1); 231Debug.Fail("We shouldn't get here.");
UriBuildingContext.cs (2)
137Debug.Assert(_lastValueOffset != -1, "Cannot invoke Remove more than once."); 171Debug.Assert(result);
Microsoft.AspNetCore.Routing.Abstractions (19)
RouteData.cs (1)
146Debug.Assert(_routers != null);
src\aspnetcore\src\Shared\PropertyHelper\PropertyHelper.cs (18)
161Debug.Assert(propertyInfo != null); 181Debug.Assert(propertyInfo != null); 195Debug.Assert(propertyInfo != null); 198Debug.Assert(propertyGetterWrapperMethod != null); 199Debug.Assert(propertyGetterWrapperMethod.IsGenericMethodDefinition); 200Debug.Assert(propertyGetterWrapperMethod.GetParameters().Length == 2); 203Debug.Assert(propertyGetterByRefWrapperMethod != null); 204Debug.Assert(propertyGetterByRefWrapperMethod.IsGenericMethodDefinition); 205Debug.Assert(propertyGetterByRefWrapperMethod.GetParameters().Length == 2); 208Debug.Assert(getMethod != null); 209Debug.Assert(!getMethod.IsStatic); 210Debug.Assert(getMethod.GetParameters().Length == 0); 274Debug.Assert(propertyInfo != null); 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 278Debug.Assert(setMethod != null); 279Debug.Assert(!setMethod.IsStatic); 280Debug.Assert(setMethod.ReturnType == typeof(void)); 282Debug.Assert(parameters.Length == 1);
Microsoft.AspNetCore.Server.HttpSys (53)
_generated\84\Windows.Win32.SCOPE_ID.g.cs (2)
86 global::System.Diagnostics.Debug.Assert(value is <= (uint)268435455L); 99 global::System.Diagnostics.Debug.Assert(value is <= (byte)15L);
AsyncAcceptContext.cs (5)
72Debug.Assert(_requestContext != null); 138Debug.Assert(false, nameof(SetExpectCompletion)); // fail hard in debug 150Debug.Assert(false, nameof(CancelExpectCompletion)); // fail hard in debug 162Debug.Assert(false, nameof(ObserveCompletion)); // fail hard in debug 172Debug.Assert(_requestContext != null);
AuthenticationManager.cs (1)
87Debug.Assert(_urlGroup == null, "SetUrlGroupSecurity called more than once.");
HttpSysListener.cs (3)
253Debug.Assert(_serverSession != null, "ServerSessionHandle is null in CloseV2Config"); 254Debug.Assert(!_serverSession.Id.IsInvalid, "ServerSessionHandle is invalid in CloseV2Config"); 278Debug.Assert(_state != State.Stopped, "Listener has been stopped.");
MessagePump.cs (4)
112Debug.Assert(RequestContextFactory == null, "Start called twice!"); 114Debug.Assert(application != null); 180Debug.Assert(RequestContextFactory != null); 321Debug.Assert(_messagePump.Stopping);
NativeInterop\RequestQueue.cs (2)
145Debug.Assert(Created); 161Debug.Assert(Created);
NativeInterop\SafeNativeOverlapped.cs (1)
36Debug.Assert(_boundHandle != null, "ReleaseHandle can't be called on SafeNativeOverlapped.Zero.");
NativeInterop\ServerSession.cs (1)
22Debug.Assert(serverSessionId != 0, "Invalid id returned by HttpCreateServerSession");
NativeInterop\UrlGroup.cs (3)
44Debug.Assert(urlGroupId != 0, "Invalid id returned by HttpCreateUrlGroup"); 118Debug.Assert(info != IntPtr.Zero, "SetUrlGroupProperty called with invalid pointer"); 222Debug.Assert(Id != 0, "HttpCloseUrlGroup called with invalid url group id");
RequestProcessing\RequestContext.FeatureCollection.cs (1)
85Debug.Assert(_features != null);
RequestProcessing\Response.cs (4)
301Debug.Assert(!HasStarted, "HttpListenerResponse::SendHeaders()|SentHeaders is true."); 402Debug.Assert(!HasComputedHeaders, nameof(HasComputedHeaders) + " is true."); 625Debug.Assert(HasTrailers); 671Debug.Assert(unknownHeadersOffset == trailerCount);
RequestProcessing\ResponseBody.cs (4)
114Debug.Assert(!(endOfRequest && data.Count > 0), "Data is not supported at the end of the request."); 188Debug.Assert(!(addTrailers && chunked), "Trailers aren't currently supported for HTTP/1.1 chunking."); 216Debug.Assert(hasData); 265Debug.Assert(currentChunk == dataChunks.Length, "All chunks should be accounted for");
RequestProcessing\ResponseStreamAsyncResult.cs (2)
94Debug.Assert(currentChunk == _dataChunks.Length); 135Debug.Assert(currentChunk == _dataChunks.Length);
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
205Debug.Assert(_memoryHandle.HasValue);
src\aspnetcore\src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (4)
34Debug.Assert(_blockSize >= 0); 84Debug.Assert(myString is not null); 119Debug.Assert(sizeHint >= 0); 143Debug.Assert(count >= 0);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (6)
122Debug.Assert(_nativeRequest != null || _backingBuffer == null, "native request accessed after ReleasePins()."); 131Debug.Assert(_nativeRequest != null || _backingBuffer == null, "native request accessed after ReleasePins()."); 171Debug.Assert(_backingBuffer != null); 185Debug.Assert(_nativeRequest != null, "RequestContextBase::ReleasePins()|ReleasePins() called twice."); 224Debug.Assert(_nativeRequest == null, "RequestContextBase::Dispose()|Dispose() called before ReleasePins()."); 235Debug.Assert((int)HTTP_VERB.HttpVerbMaximum == HttpVerbs.Length);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\RequestUriBuilder.cs (1)
23Debug.Assert(rawUrlBytes.Length != 0, "Length of the URL cannot be zero.");
src\aspnetcore\src\Shared\PathNormalizer\PathNormalizer.cs (2)
17Debug.Assert(src[0] == '/', "Path segment must always start with a '/'"); 98Debug.Assert(src[0] == '/');
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (3)
34Debug.Assert(destination[0] == '\0' || written == destination.Length); 63Debug.Assert(written == destination.Length); 82Debug.Assert(IsValidHeaderString(previousValue));
UrlPrefixCollection.cs (2)
214Debug.Assert(_urlGroup != null); 224Debug.Assert(port >= 5000 || port < 8000);
Microsoft.AspNetCore.Server.IIS (46)
_generated\45\Windows.Win32.SCOPE_ID.g.cs (2)
86 global::System.Diagnostics.Debug.Assert(value is <= (uint)268435455L); 99 global::System.Diagnostics.Debug.Assert(value is <= (byte)15L);
Core\HttpRequestStream.cs (2)
62Debug.Assert(_body != null, "Stream must be accepting reads."); 75Debug.Assert(_body != null, "Stream must be accepting reads.");
Core\IISHttpContext.cs (2)
504Debug.Assert(_hasResponseStarted == false); 544Debug.Assert(!HasStartedConsumingRequestBody);
Core\IISHttpContext.FeatureCollection.cs (1)
368Debug.Assert(_readBodyTask == null || _readBodyTask.IsCompleted);
Core\IISHttpServer.cs (1)
167Debug.Assert(server._iisContextFactory != null, "StartAsync must be called first.");
Core\IISServerAuthenticationHandlerInternal.cs (4)
24Debug.Assert(_iisHttpContext != null, "Handler must be initialized."); 25Debug.Assert(Scheme != null, "Handler must be initialized."); 41Debug.Assert(_context != null, "Handler must be initialized."); 51Debug.Assert(_context != null, "Handler must be initialized.");
Core\IO\AsyncIOEngine.cs (1)
175Debug.Assert(_runningOperation != null);
Core\IO\AsyncIOEngine.Flush.cs (1)
30Debug.Assert(_requestHandler != null, "Must initialize first.");
Core\IO\AsyncIOEngine.Read.cs (1)
34Debug.Assert(_requestHandler != null, "Must initialize first.");
Core\IO\AsyncIOOperation.cs (1)
13private static readonly Action<object?> CallbackCompleted = _ => { Debug.Assert(false, "Should not be invoked"); };
Core\IO\AsyncWriteOperationBase.cs (1)
26Debug.Assert(_requestHandler != null, "Must initialize first.");
Core\IO\WebSocketsAsyncIOEngine.cs (2)
37Debug.Assert(!read.InUse()); 53Debug.Assert(!write.InUse());
Core\IO\WebSocketsAsyncIOEngine.Initialize.cs (1)
28Debug.Assert(_requestHandler != null, "Must initialize first.");
Core\IO\WebSocketsAsyncIOEngine.Read.cs (1)
42Debug.Assert(_requestHandler != null, "Must initialize first.");
Core\OutputProducer.cs (1)
119Debug.Assert(false);
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
205Debug.Assert(_memoryHandle.HasValue);
src\aspnetcore\src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (4)
34Debug.Assert(_blockSize >= 0); 84Debug.Assert(myString is not null); 119Debug.Assert(sizeHint >= 0); 143Debug.Assert(count >= 0);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (6)
122Debug.Assert(_nativeRequest != null || _backingBuffer == null, "native request accessed after ReleasePins()."); 131Debug.Assert(_nativeRequest != null || _backingBuffer == null, "native request accessed after ReleasePins()."); 171Debug.Assert(_backingBuffer != null); 185Debug.Assert(_nativeRequest != null, "RequestContextBase::ReleasePins()|ReleasePins() called twice."); 224Debug.Assert(_nativeRequest == null, "RequestContextBase::Dispose()|Dispose() called before ReleasePins()."); 235Debug.Assert((int)HTTP_VERB.HttpVerbMaximum == HttpVerbs.Length);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\RequestUriBuilder.cs (1)
23Debug.Assert(rawUrlBytes.Length != 0, "Length of the URL cannot be zero.");
src\aspnetcore\src\Shared\PathNormalizer\PathNormalizer.cs (2)
17Debug.Assert(src[0] == '/', "Path segment must always start with a '/'"); 98Debug.Assert(src[0] == '/');
src\aspnetcore\src\Shared\RazorViews\BaseView.cs (3)
150Debug.Assert(string.IsNullOrEmpty(AttributeEnding)); 158Debug.Assert(AttributeValues != null); 159Debug.Assert(!string.IsNullOrEmpty(AttributeEnding));
src\aspnetcore\src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
235Debug.Assert(totalBytesUsed == encodedLength);
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (3)
34Debug.Assert(destination[0] == '\0' || written == destination.Length); 63Debug.Assert(written == destination.Length); 82Debug.Assert(IsValidHeaderString(previousValue));
src\aspnetcore\src\Shared\StackTrace\StackFrame\StackTraceHelper.cs (2)
198Debug.Assert(method != null); 199Debug.Assert(method.DeclaringType != null);
Microsoft.AspNetCore.Server.IISIntegration (3)
AuthenticationHandler.cs (3)
19Debug.Assert(_scheme != null, "Handler must be initialized."); 33Debug.Assert(_context != null, "Handler must be initialized."); 42Debug.Assert(_context != null, "Handler must be initialized.");
Microsoft.AspNetCore.Server.IntegrationTesting (1)
Common\TestUriHelper.cs (1)
38Debug.Assert(scheme == "http", "Https not supported");
Microsoft.AspNetCore.Server.Kestrel.Core (375)
AnyIPListenOptions.cs (1)
21Debug.Assert(IPEndPoint != null);
HttpsConfigurationService.cs (4)
135Debug.Assert(_useHttpsWithDefaults is not null); 136Debug.Assert(_tlsConfigurationLoader is not null); 137Debug.Assert(_populateMultiplexedTransportFeatures is not null); 138Debug.Assert(_httpsLogger is not null);
Internal\CertificatePathWatcher.cs (2)
113Debug.Assert(certificateConfig.IsFileCert, "AddWatch called on non-file cert"); 216Debug.Assert(certificateConfig.IsFileCert, "RemoveWatch called on non-file cert");
Internal\Http\Http1ChunkedEncodingMessageBody.cs (2)
94Debug.Assert(!RequestUpgrade, "Upgraded connections should never use this code path!"); 175Debug.Assert(_pumpTask != null, "OnReadStartedAsync must have been called.");
Internal\Http\Http1Connection.cs (9)
187Debug.Assert(MinRequestBodyDataRate != null); 421Debug.Assert(startLine.IndexOf((byte)0) == -1); 426Debug.Assert(target.Length != 0, "Request target must be non-zero length"); 460Debug.Assert(RawTarget != null, "RawTarget was not set"); 461Debug.Assert(((IHttpRequestFeature)this).Method != null, "Method was not set"); 462Debug.Assert(Path != null, "Path was not set"); 463Debug.Assert(QueryString != null, "QueryString was not set"); 464Debug.Assert(HttpVersion != null, "HttpVersion was not set"); 470Debug.Assert(target[0] == ByteForwardSlash, "Should only be called when path starts with /");
Internal\Http\Http1OutputProducer.cs (8)
175Debug.Assert(!producer._pipeWriterCompleted); 176Debug.Assert(producer._responseBodyMode == ResponseBodyMode.Chunked && producer._advancedBytesForChunk > 0); 363Debug.Assert(responseBodyMode != ResponseBodyMode.Uninitialized); 541Debug.Assert(_currentSegmentOwner == null); 542Debug.Assert(_completedSegments == null || _completedSegments.Count == 0); 648Debug.Assert(_advancedBytesForChunk <= _currentChunkMemory.Length); 649Debug.Assert(_advancedBytesForChunk > 0); 653Debug.Assert(bytesWritten <= _currentMemoryPrefixBytes);
Internal\Http\HttpHeaders.Generated.cs (131)
8403Debug.Assert((_currentBits & 0x1L) != 0); 8408Debug.Assert((_currentBits & 0x2L) != 0); 8413Debug.Assert((_currentBits & 0x4L) != 0); 8418Debug.Assert((_currentBits & 0x8L) != 0); 8423Debug.Assert((_currentBits & 0x10L) != 0); 8428Debug.Assert((_currentBits & 0x20L) != 0); 8433Debug.Assert((_currentBits & 0x40L) != 0); 8438Debug.Assert((_currentBits & 0x80L) != 0); 8443Debug.Assert((_currentBits & 0x100L) != 0); 8448Debug.Assert((_currentBits & 0x200L) != 0); 8453Debug.Assert((_currentBits & 0x400L) != 0); 8458Debug.Assert((_currentBits & 0x800L) != 0); 8463Debug.Assert((_currentBits & 0x1000L) != 0); 8468Debug.Assert((_currentBits & 0x2000L) != 0); 8473Debug.Assert((_currentBits & 0x4000L) != 0); 8478Debug.Assert((_currentBits & 0x8000L) != 0); 8483Debug.Assert((_currentBits & 0x10000L) != 0); 8488Debug.Assert((_currentBits & 0x20000L) != 0); 8493Debug.Assert((_currentBits & 0x40000L) != 0); 8498Debug.Assert((_currentBits & 0x80000L) != 0); 8503Debug.Assert((_currentBits & 0x100000L) != 0); 8508Debug.Assert((_currentBits & 0x200000L) != 0); 8513Debug.Assert((_currentBits & 0x400000L) != 0); 8518Debug.Assert((_currentBits & 0x800000L) != 0); 8523Debug.Assert((_currentBits & 0x1000000L) != 0); 8528Debug.Assert((_currentBits & 0x2000000L) != 0); 8533Debug.Assert((_currentBits & 0x4000000L) != 0); 8538Debug.Assert((_currentBits & 0x8000000L) != 0); 8543Debug.Assert((_currentBits & 0x10000000L) != 0); 8548Debug.Assert((_currentBits & 0x20000000L) != 0); 8553Debug.Assert((_currentBits & 0x40000000L) != 0); 8558Debug.Assert((_currentBits & 0x80000000L) != 0); 8563Debug.Assert((_currentBits & 0x100000000L) != 0); 8568Debug.Assert((_currentBits & 0x200000000L) != 0); 8573Debug.Assert((_currentBits & 0x400000000L) != 0); 8578Debug.Assert((_currentBits & 0x800000000L) != 0); 8583Debug.Assert((_currentBits & 0x1000000000L) != 0); 8588Debug.Assert((_currentBits & 0x2000000000L) != 0); 8593Debug.Assert((_currentBits & 0x4000000000L) != 0); 8598Debug.Assert((_currentBits & 0x8000000000L) != 0); 8603Debug.Assert((_currentBits & 0x10000000000L) != 0); 8608Debug.Assert((_currentBits & 0x20000000000L) != 0); 8613Debug.Assert((_currentBits & 0x40000000000L) != 0); 8618Debug.Assert((_currentBits & 0x80000000000L) != 0); 8623Debug.Assert((_currentBits & 0x100000000000L) != 0); 8628Debug.Assert((_currentBits & 0x200000000000L) != 0); 8633Debug.Assert((_currentBits & 0x400000000000L) != 0); 8638Debug.Assert((_currentBits & 0x800000000000L) != 0); 8643Debug.Assert((_currentBits & 0x1000000000000L) != 0); 8648Debug.Assert(_currentBits == 0); 14835Debug.Assert((tempBits & 0x1L) != 0); 14854Debug.Assert((tempBits & 0x2L) != 0); 14861Debug.Assert((tempBits & 0x4L) != 0); 14880Debug.Assert((tempBits & 0x8L) != 0); 14899Debug.Assert((tempBits & 0x10L) != 0); 14906Debug.Assert((tempBits & 0x20L) != 0); 14913Debug.Assert((tempBits & 0x40L) != 0); 14920Debug.Assert((tempBits & 0x80L) != 0); 14927Debug.Assert((tempBits & 0x100L) != 0); 14934Debug.Assert((tempBits & 0x200L) != 0); 14941Debug.Assert((tempBits & 0x400L) != 0); 14948Debug.Assert((tempBits & 0x800L) != 0); 14955Debug.Assert((tempBits & 0x1000L) != 0); 14962Debug.Assert((tempBits & 0x2000L) != 0); 14981Debug.Assert((tempBits & 0x4000L) != 0); 14988Debug.Assert((tempBits & 0x8000L) != 0); 14995Debug.Assert((tempBits & 0x10000L) != 0); 15002Debug.Assert((tempBits & 0x20000L) != 0); 15009Debug.Assert((tempBits & 0x40000L) != 0); 15016Debug.Assert((tempBits & 0x80000L) != 0); 15023Debug.Assert((tempBits & 0x100000L) != 0); 15030Debug.Assert((tempBits & 0x200000L) != 0); 15037Debug.Assert((tempBits & 0x400000L) != 0); 15044Debug.Assert((tempBits & 0x800000L) != 0); 15051Debug.Assert((tempBits & 0x1000000L) != 0); 15058Debug.Assert((tempBits & 0x2000000L) != 0); 15065Debug.Assert((tempBits & 0x4000000L) != 0); 15072Debug.Assert((tempBits & 0x8000000L) != 0); 15079Debug.Assert((tempBits & 0x10000000L) != 0); 15086Debug.Assert((tempBits & 0x20000000L) != 0); 15093Debug.Assert((tempBits & 0x40000000L) != 0); 15100Debug.Assert((tempBits & 0x80000000L) != 0); 15107Debug.Assert((tempBits & 0x100000000L) != 0); 15126Debug.Assert((tempBits & 0x200000000L) != 0); 15133Debug.Assert((tempBits & 0x400000000L) != 0); 15140Debug.Assert((tempBits & 0x800000000L) != 0); 15147Debug.Assert((tempBits & 0x1000000000L) != 0); 15154Debug.Assert((tempBits & 0x2000000000L) != 0); 15172Debug.Assert(valueCount > 0); 15253Debug.Assert((_currentBits & 0x1L) != 0); 15259Debug.Assert((_currentBits & 0x2L) != 0); 15265Debug.Assert((_currentBits & 0x4L) != 0); 15271Debug.Assert((_currentBits & 0x8L) != 0); 15277Debug.Assert((_currentBits & 0x10L) != 0); 15283Debug.Assert((_currentBits & 0x20L) != 0); 15289Debug.Assert((_currentBits & 0x40L) != 0); 15295Debug.Assert((_currentBits & 0x80L) != 0); 15301Debug.Assert((_currentBits & 0x100L) != 0); 15307Debug.Assert((_currentBits & 0x200L) != 0); 15313Debug.Assert((_currentBits & 0x400L) != 0); 15319Debug.Assert((_currentBits & 0x800L) != 0); 15325Debug.Assert((_currentBits & 0x1000L) != 0); 15331Debug.Assert((_currentBits & 0x2000L) != 0); 15337Debug.Assert((_currentBits & 0x4000L) != 0); 15343Debug.Assert((_currentBits & 0x8000L) != 0); 15349Debug.Assert((_currentBits & 0x10000L) != 0); 15355Debug.Assert((_currentBits & 0x20000L) != 0); 15361Debug.Assert((_currentBits & 0x40000L) != 0); 15367Debug.Assert((_currentBits & 0x80000L) != 0); 15373Debug.Assert((_currentBits & 0x100000L) != 0); 15379Debug.Assert((_currentBits & 0x200000L) != 0); 15385Debug.Assert((_currentBits & 0x400000L) != 0); 15391Debug.Assert((_currentBits & 0x800000L) != 0); 15397Debug.Assert((_currentBits & 0x1000000L) != 0); 15403Debug.Assert((_currentBits & 0x2000000L) != 0); 15409Debug.Assert((_currentBits & 0x4000000L) != 0); 15415Debug.Assert((_currentBits & 0x8000000L) != 0); 15421Debug.Assert((_currentBits & 0x10000000L) != 0); 15427Debug.Assert((_currentBits & 0x20000000L) != 0); 15433Debug.Assert((_currentBits & 0x40000000L) != 0); 15439Debug.Assert((_currentBits & 0x80000000L) != 0); 15445Debug.Assert((_currentBits & 0x100000000L) != 0); 15451Debug.Assert((_currentBits & 0x200000000L) != 0); 15457Debug.Assert((_currentBits & 0x400000000L) != 0); 15463Debug.Assert((_currentBits & 0x800000000L) != 0); 15469Debug.Assert((_currentBits & 0x1000000000L) != 0); 15475Debug.Assert((_currentBits & 0x2000000000L) != 0); 15481Debug.Assert(_currentBits == 0); 17589Debug.Assert((_currentBits & 0x1L) != 0); 17595Debug.Assert((_currentBits & 0x2L) != 0); 17601Debug.Assert((_currentBits & 0x4L) != 0);
Internal\Http\HttpParser.cs (3)
140Debug.Assert(result); 382Debug.Assert(result.HasError); 421Debug.Assert(foundDelimiter);
Internal\Http\HttpProtocol.cs (8)
438Debug.Assert(resetSuccess); 748Debug.Assert(_bodyControl != null); 1040Debug.Assert(_requestRejectedException != null); 1382Debug.Assert(!HasResponseStarted, $"{nameof(SetErrorResponseHeaders)} called after response had already started."); 1649Debug.Assert(false, "Should not reach here, all cases in above switch statement should return"); 1655Debug.Assert(!HasResponseStarted); 1699Debug.Assert(false, "Should not reach here, all cases in above switch statement should return"); 1746Debug.Assert(false, "Should not reach here, all cases in above switch statement should return");
Internal\Http\ReasonPhrases.cs (1)
84Debug.Assert(!string.IsNullOrEmpty(reasonPhrase));
Internal\Http2\FlowControl\FlowControl.cs (3)
19Debug.Assert(initialWindowSize <= Http2PeerSettings.MaxWindowSize, $"{nameof(initialWindowSize)} too large."); 30Debug.Assert(!IsAborted, $"({nameof(Advance)} called after abort."); 31Debug.Assert(bytes == 0 || (bytes > 0 && bytes <= Available), $"{nameof(Advance)}({bytes}) called with {Available} bytes available.");
Internal\Http2\FlowControl\InputFlowControl.cs (2)
32Debug.Assert(initialWindowSize >= minWindowSizeIncrement, "minWindowSizeIncrement is greater than the window size."); 86Debug.Assert(false, $"{nameof(TryUpdateWindow)} attempted to grow window past max size.");
Internal\Http2\FlowControl\StreamInputFlowControl.cs (2)
52Debug.Assert(connectionSuccess, "Connection-level input flow control should never be aborted."); 101Debug.Assert(connectionSuccess, "Connection-level input flow control should never be aborted.");
Internal\Http2\Http2Connection.cs (17)
241Debug.Assert(_isClosed == 1, "Should only be set when connection is closed."); 273Debug.Assert(Limits.MinRequestBodyDataRate != null); 429Debug.Assert(_currentHeadersStream != null); 667Debug.Assert(buffer.Length >= ClientPreface.Length, "Not enough content to match preface."); 781Debug.Assert(_currentHeadersStream != null, "Only throw this error if parsing headers."); 847Debug.Assert(TimeoutControl.TimerReason == TimeoutReason.KeepAlive, "Non keep-alive timeout set at start of trailer headers."); 873Debug.Assert(TimeoutControl.TimerReason == TimeoutReason.KeepAlive, "Non keep-alive timeout set at start of stream."); 1223Debug.Assert(TimeoutControl.TimerReason == TimeoutReason.RequestHeaders, "Received continuation frame without request header timeout being set."); 1246Debug.Assert(_currentHeadersStream != null); 1273Debug.Assert(_currentHeadersStream != null); 1297Debug.Assert(_currentHeadersStream != null); 1564Debug.Assert(TimeoutControl.TimerReason == TimeoutReason.RequestHeaders || 1582Debug.Assert(index <= H2StaticTable.Count); 1590Debug.Assert(index <= H2StaticTable.Count); 1608Debug.Assert(_currentHeadersStream != null); 1676Debug.Fail($"Unexpected header type: {headerType}"); 1790Debug.Assert(staticTableIndex > 0, "Static table starts at 1.");
Internal\Http2\Http2FrameWriter.cs (9)
254Debug.Assert(actual <= int.MaxValue); 280Debug.Assert(flushHeaders, "The app completed successfully without flushing headers!"); 551Debug.Assert(writeResult != HeaderWriteResult.BufferTooSmall, "This always writes the status as the first header, and it should never be an over the buffer size."); 634Debug.Assert(payloadLength <= _maxFrameSize, "The initial payload lengths is written to _headerEncodingBuffer with size of _maxFrameSize"); 658Debug.Assert(payloadLength == 0, "Payload written even though buffer is too small"); 717Debug.Assert(dataLength == data.Length); 744Debug.Assert(dataLength == data.Length); 748Debug.Assert(dataLength > dataPayloadLength); 967Debug.Assert(payload.Length == _outgoingFrame.PayloadLength); // 8
Internal\Http2\Http2OutputProducer.cs (2)
186Debug.Assert(_completedResponse); 313Debug.Assert(_unconsumedBytes > 0);
Internal\Http2\Http2Stream.cs (2)
163Debug.Assert(_decrementCalled); 515Debug.Assert(flushTask.IsCompletedSuccessfully);
Internal\Http3\Http3Connection.cs (8)
386Debug.Assert(streamDirectionFeature != null); 387Debug.Assert(streamIdFeature != null); 613Debug.Assert(persistentStateFeature != null, $"Required {nameof(IPersistentStateFeature)} not on stream context."); 640Debug.Assert(_context.ServiceContext.ServerOptions.EnableWebTransportAndH3Datagrams); 902Debug.Assert(!stream.IsReceivingHeader); 913Debug.Assert(Limits.MinRequestBodyDataRate != null); 929Debug.Assert(_context.ServiceContext.ServerOptions.EnableWebTransportAndH3Datagrams); 934Debug.Assert(!_webtransportSessions.ContainsKey(http3Stream.StreamId));
Internal\Http3\Http3ControlStream.cs (3)
275Debug.Assert(incomingFrame.RemainingLength >= framePayload.Length); 288Debug.Assert(framePayload.Slice(0, consumed).Length == framePayload.Length); 298Debug.Assert(incomingFrame.RemainingLength > 0);
Internal\Http3\Http3FrameWriter.cs (3)
179Debug.Assert(dataLength == data.Length); 202Debug.Assert(dataLength == data.Length); 206Debug.Assert(dataLength > dataPayloadLength);
Internal\Http3\Http3OutputProducer.cs (1)
60Debug.Assert(_dataWriteProcessingTask.IsCompleted);
Internal\Http3\Http3Stream.cs (5)
225Debug.Assert(index <= H3StaticTable.Count); 233Debug.Assert(index <= H3StaticTable.Count); 369Debug.Fail($"Unexpected header type: {headerType}"); 478Debug.Assert(staticTableIndex >= 0, "Static table starts at 0."); 864Debug.Fail("Unexpected header parsing state.");
Internal\Http3\QPackHeaderWriter.cs (1)
15Debug.Assert(hasValue == true);
Internal\HttpConnection.cs (6)
105Debug.Assert(connectionHeartbeatFeature != null, nameof(IConnectionHeartbeatFeature) + " is missing!"); 106Debug.Assert(connectionLifetimeNotificationFeature != null, nameof(IConnectionLifetimeNotificationFeature) + " is missing!"); 159Debug.Assert(previousState != ProtocolSelectionState.Initializing, "The state should never be initializing"); 178Debug.Assert(previousState != ProtocolSelectionState.Initializing, "The state should never be initializing"); 198Debug.Assert(previousState != ProtocolSelectionState.Initializing, "The state should never be initializing"); 298Debug.Assert(false, "Invalid TimeoutReason");
Internal\Infrastructure\HttpUtilities.cs (9)
54Debug.Assert(str.Length == 8, "String must be exactly 8 (ASCII) characters long."); 59Debug.Assert(operationStatus == OperationStatus.Done); 66Debug.Assert(str.Length == 4, "String must be exactly 4 (ASCII) characters long."); 71Debug.Assert(operationStatus == OperationStatus.Done); 78Debug.Assert(bytes.Length == 8, "Mask must be exactly 8 bytes long."); 101Debug.Assert(written == destination.Length); 281Debug.Assert(WordListForPerfectHashOfMethods.Length == (MaxHashValue + 1) && methodsLookup.Length == (MaxHashValue + 1)); 330Debug.Assert(char.IsAscii(c), "Must already be validated"); 465Debug.Fail("Unexpected HttpVersion: " + httpVersion);
Internal\Infrastructure\KestrelMetrics.cs (3)
412Debug.Assert(reason != ConnectionEndReason.Unset); 425Debug.Assert(reason != ConnectionEndReason.Unset); 436Debug.Assert(TryGetErrorType(reason, out _), "Overwrite should only be set for an error reason.");
Internal\Infrastructure\PipeWriterHelpers\ConcurrentPipeWriter.cs (5)
62Debug.Assert(_currentFlushTcs == null, "There should not be a pending flush."); 163Debug.Assert(_currentFlushTcs != null); 249Debug.Assert(_tail != null); 305Debug.Assert(_currentFlushTcs != null); 338Debug.Assert(_tail != null);
Internal\Infrastructure\ResourceCounter.cs (1)
64Debug.Assert(_count >= 0, "Resource count is negative. More resources were released than were locked.");
Internal\Infrastructure\StatusCheckPipeWriter.cs (1)
33Debug.Assert(_context != null);
Internal\Infrastructure\StatusCheckWriteStream.cs (1)
27Debug.Assert(_context != null);
Internal\Infrastructure\StreamCloseAwaitable.cs (1)
22Debug.Assert(ReferenceEquals(_callback, _callbackCompleted));
Internal\Infrastructure\TimeoutControl.cs (4)
116Debug.Assert(_minReadRate != null); 169Debug.Assert(_timeoutTimestamp == long.MaxValue, "Concurrent timeouts are not supported."); 205Debug.Assert(_concurrentIncompleteRequestBodies == 0 || minRate == _minReadRate, "Multiple simultaneous read data rates are not supported."); 260Debug.Assert(count >= 0, "BytesRead count must not be negative.");
Internal\KestrelServerImpl.cs (1)
345Debug.Assert(Options.ConfigurationLoader != null, "Rebind can only happen when there is a ConfigurationLoader.");
Internal\SniOptionsSelector.cs (1)
154Debug.Assert(_fallbackServerCertificateSelector != null,
Internal\ThrowHelper.cs (1)
24Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Internal\WebTransport\WebTransportSession.cs (1)
136Debug.Assert(success);
KestrelConfigurationLoader.cs (5)
50Debug.Assert(reloadOnChange || (certificatePathWatcher is null), "If reloadOnChange is false, then certificatePathWatcher should be null"); 290Debug.Assert(!!_loaded || _reloadToken is null, "Shouldn't have a reload token before first load"); 291Debug.Assert(!!ReloadOnChange || _reloadToken is null, "Shouldn't have a reload token unless reload-on-change is set"); 320Debug.Assert(ReloadOnChange); 399Debug.Assert(o.EndpointConfig?.Certificate?.FileHasChanged != true, "Preserving an endpoint with file changes");
KestrelServerOptions.cs (3)
298Debug.Assert(ApplicationServices.GetRequiredService<IHttpsConfigurationService>().IsInitialized, "HTTPS configuration should have been enabled"); 319Debug.Assert(DevelopmentCertificate is null); 404Debug.Assert(status.FailureMessage != null, "Status with a failure result must have a message.");
Middleware\HttpsConnectionMiddleware.cs (4)
98Debug.Assert(_serverCertificate != null); 284Debug.Assert(!certificate.HasPrivateKey, "This should only be called with certificates that don't have a private key"); 349Debug.Assert(_options != null, "Middleware must be created with options."); 445Debug.Assert(_options != null, "Middleware must be created with options.");
Middleware\TlsListener.cs (1)
63Debug.Assert(parseState is ClientHelloParseState.ValidTlsClientHello or ClientHelloParseState.NotTlsClientHello);
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
205Debug.Assert(_memoryHandle.HasValue);
src\aspnetcore\src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (4)
34Debug.Assert(_blockSize >= 0); 84Debug.Assert(myString is not null); 119Debug.Assert(sizeHint >= 0); 143Debug.Assert(count >= 0);
src\aspnetcore\src\Shared\Buffers\BufferSegment.cs (4)
27Debug.Assert(value <= AvailableMemory.Length); 64Debug.Assert(_memoryOwner != null); 102Debug.Assert(segment != null); 103Debug.Assert(Next == null);
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (9)
56Debug.Assert(_index >= 0); 84Debug.Assert(_index >= 0); 99Debug.Assert(_index >= 0); 137Debug.Assert(_rentedBuffer.Length - _index > 0); 138Debug.Assert(_rentedBuffer.Length - _index >= sizeHint); 157Debug.Assert(oldBuffer.Length >= _index); 158Debug.Assert(_rentedBuffer.Length >= _index); 166Debug.Assert(_rentedBuffer.Length - _index > 0); 167Debug.Assert(_rentedBuffer.Length - _index >= sizeHint);
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (1)
765Debug.Assert(pemEnvelope != null);
src\aspnetcore\src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
91Debug.Assert(oldTrustLevel == TrustLevel.Full); // Mac trust is all or nothing
src\aspnetcore\src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
354Debug.Assert(IsCommandAvailable(OpenSslCommand), "How did we trust without the openssl command?");
src\aspnetcore\src\Shared\Hpack\DynamicHPackEncoder.cs (5)
71Debug.Assert(!_pendingTableSizeUpdate, "Dynamic table size update should be encoded before headers."); 153Debug.Assert(headerSize <= _maxHeaderTableSize, "Header is bigger than dynamic table size."); 158Debug.Assert(removed != null); 212Debug.Assert(headerSize <= _maxHeaderTableSize, "Header is bigger than dynamic table size."); 213Debug.Assert(headerSize <= _maxHeaderTableSize - _headerTableSize, "Not enough room in dynamic table.");
src\aspnetcore\src\Shared\Hpack\EncoderHeaderEntry.cs (2)
32Debug.Assert(name != null); 33Debug.Assert(value != null);
src\aspnetcore\src\Shared\PathNormalizer\PathNormalizer.cs (2)
17Debug.Assert(src[0] == '/', "Path segment must always start with a '/'"); 98Debug.Assert(src[0] == '/');
src\aspnetcore\src\Shared\runtime\Http2\Hpack\DynamicTable.cs (2)
76Debug.Assert(_count + 1 <= maxCapacity); 80Debug.Assert(newBufferSize > _count);
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HeaderField.cs (1)
20Debug.Assert(name.Length > 0);
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (5)
182Debug.Fail("HPACK decoder reach an invalid state"); 249Debug.Assert(intResult != 0, "A header name length of 0 should never be encoded with a continuation byte."); 261Debug.Assert(intResult != 0, "A header value length of 0 should never be encoded with a continuation byte."); 315Debug.Assert(_state == State.Ready, "Should be ready to parse a new header."); 608Debug.Assert(_stringLength <= _maxHeadersLength, "String length should have been checked prior to decode.");
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
95Debug.Assert(indexLength >= 1); 127Debug.Assert(indexLength >= 1); 159Debug.Assert(indexLength >= 1); 197Debug.Assert(indexLength >= 1); 369Debug.Assert(Ascii.IsValid(value)); 376Debug.Assert(integerLength >= 1); 382Debug.Assert(status == OperationStatus.Done); 383Debug.Assert(valueBytesWritten == value.Length); 397Debug.Assert(destination.Length >= value.Length); 406Debug.Assert(status == OperationStatus.Done); 407Debug.Assert(bytesWritten == value.Length); 426Debug.Assert(integerLength >= 1); 470Debug.Assert(integerLength >= 1); 481Debug.Assert(written == encodedStringLength); 528Debug.Assert(separator != null); 529Debug.Assert(Ascii.IsValid(separator)); 551Debug.Assert(integerLength >= 1); 603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
src\aspnetcore\src\Shared\runtime\Http2\Hpack\Huffman.cs (2)
680Debug.Assert(dst.Length > 0); 745Debug.Assert(bitsInAcc < 8);
src\aspnetcore\src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (2)
39Debug.Assert(prefixLength >= 1 && prefixLength <= 8); 40Debug.Assert((b & ~((1 << prefixLength) - 1)) == 0, "bits other than prefix data must be set to 0.");
src\aspnetcore\src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (2)
25Debug.Assert(value >= 0); 26Debug.Assert(numBits >= 1 && numBits <= 8);
src\aspnetcore\src\Shared\runtime\Http3\Frames\Http3Frame.cs (1)
43Debug.Assert(VariableLengthIntegerHelper.GetByteCount((long)frameType) == 1, $"{nameof(TryWriteFrameEnvelope)} assumes {nameof(frameType)} will fit within a single byte varint.");
src\aspnetcore\src\Shared\runtime\Http3\Helpers\VariableLengthIntegerHelper.cs (9)
69Debug.Assert((firstByte & LengthMask) == InitialEightByteLengthMask); 73Debug.Assert(value >= 0 && value <= EightByteLimit, "Serialized values are within [0, 2^62)."); 118Debug.Assert(result); 119Debug.Assert(bytesRead == length); 149Debug.Assert(longToEncode >= 0); 150Debug.Assert(longToEncode <= EightByteLimit); 193Debug.Assert(res); 199Debug.Assert(value >= 0); 200Debug.Assert(value <= EightByteLimit);
src\aspnetcore\src\Shared\runtime\Http3\QPack\HeaderField.cs (1)
17Debug.Assert(name.Length > 0);
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackDecoder.cs (4)
233Debug.Fail("QPACK decoder reach an invalid state"); 428Debug.Assert(_state == State.CompressedHeaders, "Should be ready to parse a new header."); 646Debug.Assert(_stringLength <= _maxHeadersLength, "String length should have been checked prior to decode."); 652Debug.Assert(_stringOctets != null, "String buffer should have a value.");
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackEncoder.cs (14)
42Debug.Assert(res); 97Debug.Assert(res); 106Debug.Assert(res); 167Debug.Assert(res); 177Debug.Assert(res); 204Debug.Assert(written == encodedStringLength); 235Debug.Assert(separator != null); 236Debug.Assert(Ascii.IsValid(separator)); 303Debug.Assert(buffer.Length >= s.Length); 312Debug.Assert(status == OperationStatus.Done); 313Debug.Assert(bytesWritten == s.Length); 318Debug.Assert(Ascii.IsValid(s)); 331Debug.Assert(status == OperationStatus.Done); 332Debug.Assert(valueBytesWritten == s.Length);
src\aspnetcore\src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
235Debug.Assert(totalBytesUsed == encodedLength);
src\aspnetcore\src\Shared\ServerInfrastructure\Http2\Bitshifter.cs (2)
24Debug.Assert(value <= 0xFF_FF_FF, value.ToString(CultureInfo.InvariantCulture)); 45Debug.Assert(value <= 0x7F_FF_FF_FF, value.ToString(CultureInfo.InvariantCulture));
src\aspnetcore\src\Shared\ServerInfrastructure\Http2\Http2FrameReader.cs (1)
229Debug.Assert(data.Length % SettingSize == 0, "Invalid settings payload length");
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (3)
34Debug.Assert(destination[0] == '\0' || written == destination.Length); 63Debug.Assert(written == destination.Length); 82Debug.Assert(IsValidHeaderString(previousValue));
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (10)
Internal\NamedPipeConnectionListener.cs (2)
63Debug.Assert(!stream.IsConnected, "Stream should have been successfully disconnected to reach this point."); 71Debug.Assert(_completeListeningTask == null, "Already started");
Internal\NamedPipeTransportFactory.cs (1)
28Debug.Assert(OperatingSystem.IsWindows(), "Named pipes transport requires a Windows operating system.");
src\aspnetcore\src\Servers\Kestrel\shared\TransportConnection.cs (1)
72Debug.Assert(Application != null);
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
205Debug.Assert(_memoryHandle.HasValue);
src\aspnetcore\src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (4)
34Debug.Assert(_blockSize >= 0); 84Debug.Assert(myString is not null); 119Debug.Assert(sizeHint >= 0); 143Debug.Assert(count >= 0);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (22)
Internal\QuicConnectionContext.cs (2)
179Debug.Assert(cancellationToken.IsCancellationRequested, "Error requires cancellation is requested."); 190Debug.Fail($"Unexpected exception in {nameof(QuicConnectionContext)}.{nameof(AcceptAsync)}: {ex}");
Internal\QuicConnectionListener.cs (2)
169Debug.Assert(connectionContext != null); 170Debug.Assert(connectionContext.GetInnerConnection() == quicConnection);
Internal\QuicStreamContext.cs (8)
81Debug.Assert(_stream == null); 143Debug.Assert(_processingTask.IsCompletedSuccessfully); 150Debug.Assert(_stream != null); 185Debug.Assert(_stream != null); 206Debug.Assert(_stream != null); 354Debug.Assert(_streamClosedTokenSource != null); 370Debug.Assert(_stream != null); 525Debug.Assert(_stream != null);
src\aspnetcore\src\Servers\Kestrel\shared\TransportConnection.cs (1)
72Debug.Assert(Application != null);
src\aspnetcore\src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
205Debug.Assert(_memoryHandle.HasValue);
src\aspnetcore\src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (4)
34Debug.Assert(_blockSize >= 0); 84Debug.Assert(myString is not null); 119Debug.Assert(sizeHint >= 0); 143Debug.Assert(count >= 0);
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (3)
34Debug.Assert(destination[0] == '\0' || written == destination.Length); 63Debug.Assert(written == destination.Length); 82Debug.Assert(IsValidHeaderString(previousValue));
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (8)
Internal\SocketConnection.cs (3)
45Debug.Assert(socket != null); 46Debug.Assert(memoryPool != null); 47Debug.Assert(logger != null);
Internal\SocketSender.cs (2)
78Debug.Assert(!buffer.IsEmpty); 79Debug.Assert(!buffer.IsSingleSegment);
SocketConnectionListener.cs (2)
51Debug.Assert(listenSocket.LocalEndPoint != null); 65Debug.Assert(_listenSocket != null, "Bind must be called first.");
src\aspnetcore\src\Servers\Kestrel\shared\TransportConnection.cs (1)
72Debug.Assert(Application != null);
Microsoft.AspNetCore.SignalR.Client.Core (7)
HubConnection.cs (3)
1008Debug.Assert(genericTypes.Length == 1); 1054Debug.Assert(methodInfo == _sendIAsyncStreamItemsMethod); 2477Debug.Assert(_messageBuffer is not null);
src\aspnetcore\src\SignalR\common\Shared\MessageBuffer.cs (3)
334Debug.Assert(_currentIndex == -1); 340Debug.Assert(_startingSequenceId + _currentIndex + 1 == sequenceId); 382Debug.Assert(numElements > 0 && numElements < BufferLength + 1);
src\aspnetcore\src\SignalR\common\Shared\ReflectionHelper.cs (1)
35Debug.Assert(nullableType.GetGenericArguments().Length == 1);
Microsoft.AspNetCore.SignalR.Common (5)
Protocol\HandshakeProtocol.cs (2)
69Debug.Assert(writer.CurrentDepth == 0); 100Debug.Assert(writer.CurrentDepth == 0);
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
132Debug.Assert(charsUsed == 1);
Microsoft.AspNetCore.SignalR.Core (25)
HubConnectionContext.cs (1)
393Debug.Assert(_messageBuffer is not null);
Internal\ChannelBasedSemaphore.cs (1)
74Debug.Assert(false);
Internal\DefaultHubActivator.cs (2)
24Debug.Assert(!_created.HasValue, "hub activators must not be reused."); 41Debug.Assert(_created.HasValue, "hubs must be released with the hub activator they were created");
Internal\DefaultHubDispatcher.cs (2)
417Debug.Assert(hub.Clients is HubCallerClients); 860Debug.Assert(false, $"Failed to bind argument of type '{descriptor.OriginalParameterTypes[parameterPointer].Name}' for hub method '{descriptor.MethodExecutor.MethodInfo.Name}'.");
Internal\HubMethodDescriptor.cs (1)
270Debug.Assert(adapterMethodInfo == MakeAsyncEnumeratorFromChannelMethod);
SerializedHubMessage.cs (1)
45Debug.Assert(message.GetType().IsAssignableTo(typeof(HubInvocationMessage)));
src\aspnetcore\src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (3)
66Debug.Assert(isTrimAotCompatible, "isTrimAotCompatible should always be true."); 149Debug.Assert(_executor != null, "Sync execution is not supported."); 178Debug.Assert(_executorAsync != null, "Async execution is not supported.");
src\aspnetcore\src\SignalR\common\Shared\ClientResultsManager.cs (9)
34Debug.Assert(result); 44Debug.Assert(result); 169public static new void SetCanceled(CancellationToken cancellationToken) => Debug.Assert(false); 170public static new void SetException(IEnumerable<Exception> exceptions) => Debug.Assert(false); 173Debug.Assert(false); 178Debug.Assert(false); 183Debug.Assert(false); 188Debug.Assert(false); 193Debug.Assert(false);
src\aspnetcore\src\SignalR\common\Shared\MessageBuffer.cs (3)
334Debug.Assert(_currentIndex == -1); 340Debug.Assert(_startingSequenceId + _currentIndex + 1 == sequenceId); 382Debug.Assert(numElements > 0 && numElements < BufferLength + 1);
src\aspnetcore\src\SignalR\common\Shared\ReflectionHelper.cs (1)
35Debug.Assert(nullableType.GetGenericArguments().Length == 1);
StreamTracker.cs (1)
35Debug.Assert(RuntimeFeature.IsDynamicCodeSupported || !itemType.IsValueType, "HubMethodDescriptor ensures itemType is not a ValueType when PublishAot=true.");
Microsoft.AspNetCore.SignalR.Protocols.Json (4)
Protocol\JsonHubProtocol.cs (3)
571Debug.Assert(writer.CurrentDepth == 0); 791Debug.Assert(arguments != null); 809Debug.Assert(arguments != null);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
132Debug.Assert(charsUsed == 1);
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (3)
Protocol\MessagePackHubProtocolWorker.cs (1)
376Debug.Assert(written == prefixLength);
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (5)
Protocol\NewtonsoftJsonHubProtocol.cs (2)
783Debug.Assert(arguments != null); 800Debug.Assert(arguments != null);
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
132Debug.Assert(charsUsed == 1);
Microsoft.AspNetCore.SignalR.Specification.Tests (2)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
Microsoft.AspNetCore.SignalR.StackExchangeRedis (16)
Internal\RedisProtocol.cs (1)
244Debug.Assert(isArray);
RedisHubLifetimeManager.cs (4)
821Debug.Assert(success); 825Debug.Assert(success); 826Debug.Assert(written == 24); 828Debug.Assert(base64.EndsWith("=="));
src\aspnetcore\src\SignalR\common\Shared\ClientResultsManager.cs (9)
34Debug.Assert(result); 44Debug.Assert(result); 169public static new void SetCanceled(CancellationToken cancellationToken) => Debug.Assert(false); 170public static new void SetException(IEnumerable<Exception> exceptions) => Debug.Assert(false); 173Debug.Assert(false); 178Debug.Assert(false); 183Debug.Assert(false); 188Debug.Assert(false); 193Debug.Assert(false);
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (2)
249Debug.Assert(span.Length >= _bytesWritten); 273Debug.Assert(_bytesWritten == totalWritten + _position);
Microsoft.AspNetCore.SpaServices.Extensions (1)
Npm\NodeScriptRunner.cs (1)
109Debug.Assert(chunk.Array != null);
Microsoft.AspNetCore.StaticAssets (10)
Development\StaticAssetDevelopmentRuntimeHandler.cs (4)
51Debug.Assert(originalETag != null, $"The static asset descriptor {asset.Route} - {asset.AssetPath} does not have an original-resource property."); 52Debug.Assert(originalAsset != null, $"The static asset descriptor {asset.Route} - {asset.AssetPath} has an original-resource property that does not match any known static asset descriptor."); 122Debug.Assert(etag != null, $"The static asset descriptor {descriptor.Route} - {descriptor.AssetPath} does not have an ETag response header."); 123Debug.Assert(_descriptorsMap.ContainsKey((descriptor.Route, etag)),
src\aspnetcore\src\Shared\RangeHelper\RangeHelper.cs (1)
67Debug.Assert(rangeHeader.Ranges.Count == 1);
StaticAssetEndpointDataSource.cs (4)
77Debug.Assert(_changeToken != null); 78Debug.Assert(_endpoints != null); 125Debug.Assert(_changeToken != null); 126Debug.Assert(_endpoints != null);
StaticAssetsInvoker.cs (1)
184Debug.Fail(exception.ToString());
Microsoft.AspNetCore.StaticFiles (2)
src\aspnetcore\src\Shared\RangeHelper\RangeHelper.cs (1)
67Debug.Assert(rangeHeader.Ranges.Count == 1);
StaticFileContext.cs (1)
345Debug.Fail(exception.ToString());
Microsoft.AspNetCore.TestHost (3)
ResponseBodyReaderStream.cs (1)
116Debug.Assert(innerException != null);
src\db4096461e91d616\HostFactoryResolver.cs (1)
304Debug.Assert(_hostTcs.Task.IsCompleted);
WebSocketClient.cs (1)
104Debug.Assert(webSocketFeature != null);
Microsoft.AspNetCore.Watch.BrowserRefresh (3)
src\sdk\src\Dotnet.Watch\Web.Middleware\ResponseStreamWrapper.cs (1)
194Debug.Assert(_isHtmlResponse != true);
src\sdk\src\Dotnet.Watch\Web.Middleware\ScriptInjectingStream.cs (2)
142Debug.Assert(_partialBodyTagLength <= s_bodyTagBytes.Length); 165Debug.Assert(_partialBodyTagLength == 0);
Microsoft.AspNetCore.WebSockets (11)
HandshakeHelpers.cs (4)
175Debug.Assert(ret); 176Debug.Assert(written == len); 270Debug.Assert(ret); 271Debug.Assert(written == len);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueListBuilder.cs (1)
47Debug.Assert(_pos == _span.Length);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (6)
37Debug.Assert(value >= 0); 38Debug.Assert(value <= _chars.Length); 48Debug.Assert(capacity >= 0); 86Debug.Assert(index < _pos); 289Debug.Assert(additionalCapacityBeyondPos > 0); 290Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed.");
Microsoft.AspNetCore.WebUtilities (22)
FileBufferingReadStream.cs (2)
238Debug.Assert(_tempFileDirectoryAccessor != null); 240Debug.Assert(_tempFileDirectory != null);
FileBufferingWriteStream.cs (2)
124Debug.Assert(PagedByteBuffer.Length <= _memoryThreshold); 163Debug.Assert(PagedByteBuffer.Length <= _memoryThreshold);
FormPipeReader.cs (1)
269Debug.Assert(segmentConsumed == keyValuePair.FirstSpan.Length);
HttpRequestStreamReader.cs (3)
258Debug.Assert(charsRemaining == 0); 269Debug.Assert(charsRemaining == 0); 279Debug.Assert(charsRemaining > 0);
HttpResponseStreamWriter.cs (8)
215Debug.Assert(_charBufferCount == _charBufferSize); 251Debug.Assert(count > 0); 252Debug.Assert(_charBufferSize - _charBufferCount < count); 295Debug.Assert(count > 0); 296Debug.Assert(_charBufferSize - _charBufferCount < count); 344Debug.Assert(value.Length > 0); 345Debug.Assert(_charBufferSize - _charBufferCount < value.Length); 616Debug.Assert(_charBufferSize - _charBufferCount >= value.Length);
MultipartReaderStream.cs (4)
212Debug.Assert(matchCount == length); 229Debug.Assert(read == length); // It should have all been buffered 302Debug.Assert(matchCount == length); 319Debug.Assert(read == length); // It should have all been buffered
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
105Debug.Assert(success);
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (1)
155Debug.Assert(arraySizeRequired % 4 == 0, "Invariant: Array length must be a multiple of 4.");
Microsoft.Build (221)
BackEnd\BuildManager\BuildManager.cs (21)
806Debug.Assert(Monitor.IsEntered(_syncLock)); 1165Debug.Assert(allMismatchedProjectStartedEventsDueToLoggerErrors, "There was a mismatched project started event not caused by an exception result"); 1691Debug.Assert(!Monitor.IsEntered(_syncLock)); 1706Debug.Assert(Monitor.IsEntered(_syncLock)); 1811Debug.Assert(Monitor.IsEntered(_syncLock)); 2003Debug.Assert(!Monitor.IsEntered(_syncLock)); 2024Debug.Assert(!Monitor.IsEntered(_syncLock)); 2105Debug.Assert(!Monitor.IsEntered(_syncLock)); 2561Debug.Assert(Monitor.IsEntered(_syncLock)); 2594Debug.Assert(Monitor.IsEntered(_syncLock)); 2602Debug.Assert(Monitor.IsEntered(_syncLock)); 2721Debug.Assert(Monitor.IsEntered(_syncLock)); 2747Debug.Assert(Monitor.IsEntered(_syncLock)); 2831Debug.Assert(Monitor.IsEntered(_syncLock)); 2923Debug.Assert(Monitor.IsEntered(_syncLock)); 2972Debug.Assert(Monitor.IsEntered(_syncLock)); 3098Debug.Assert(Monitor.IsEntered(_syncLock)); 3122Debug.Assert(Monitor.IsEntered(_syncLock)); 3267Debug.Assert(Monitor.IsEntered(_syncLock)); 3573Debug.Assert(Monitor.IsEntered(_syncLock)); 3654Debug.Assert(Monitor.IsEntered(_syncLock));
BackEnd\Client\MSBuildClient.cs (1)
625Debug.Assert(KnownTelemetry.PartialBuildTelemetry == null || KnownTelemetry.PartialBuildTelemetry.StartAt.HasValue, "BuildTelemetry.StartAt was not initialized!");
BackEnd\Components\RequestBuilder\ItemBucket.cs (1)
154Debug.Assert(_expander != null, "ItemBucket.Initialize was not properly called");
BackEnd\Components\RequestBuilder\TaskHost.cs (1)
844Debug.Assert(coresAcquired >= 1);
BackEnd\Shared\TargetResult.cs (1)
182Debug.Fail($"Unknown enum value: {ResultCode}");
BackEnd\TaskExecutionHost\TaskExecutionHost.cs (2)
219Debug.Fail("Unexpected finalization. Dispose should already have been called."); 805Debug.Assert(TaskInstance is not IMultiThreadableTask multiThreadableTask || multiThreadableTask.TaskEnvironment != null, "task environment missing for multi-threadable task");
BuildCheck\Infrastructure\EditorConfig\EditorConfigFile.cs (4)
92Debug.Assert(!string.IsNullOrEmpty(sectionName)); 105Debug.Assert(!string.IsNullOrEmpty(key)); 106Debug.Assert(key == key.Trim()); 107Debug.Assert(value == value?.Trim());
BuildCheck\Infrastructure\EditorConfig\EditorConfigGlobsMatcher.cs (2)
33Debug.Assert(regex.GetGroupNumbers().Length - 1 == numberRangePairs.Length); 51Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
Collections\RetrievableEntryHashSet\HashHelpers.cs (1)
59Debug.Assert(min >= 0, "min less than zero; handle overflow checking before calling HashHelpers");
Collections\RetrievableEntryHashSet\RetrievableEntryHashSet.cs (10)
235Debug.Assert(String.Equals(name, value.Key, StringComparison.Ordinal)); 263Debug.Assert(_buckets != null, "m_buckets was null but m_lastIndex > 0"); 284Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal)); 398Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal)); 604Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal)); 703Debug.Assert(_count >= 0, "m_count is negative"); 714Debug.Assert(_buckets != null, "m_buckets was null but m_count > 0"); 740Debug.Assert(newSlots.Length <= _slots.Length, "capacity increased after TrimExcess"); 760Debug.Assert(_buckets == null, "Initialize was called but m_buckets was non-null"); 776Debug.Assert(_buckets != null, "IncreaseCapacity called on a set with no elements");
Construction\ProjectElementContainer.cs (1)
444Debug.Assert(child.ExpressedAsAttribute, nameof(SetElementAsAttributeValue) + " method requires that " +
Definition\BuiltInMetadata.cs (1)
69Debug.Fail($"Expected a valid item-spec modifier, got \"{name}\".");
Definition\ProjectCollection.cs (3)
1766Debug.Assert(_locker.IsWriteLockHeld); 1784Debug.Assert(_locker.IsWriteLockHeld); 1836Debug.Assert(!_locker.IsWriteLockHeld, "We should never raise events while holding a private lock.");
Evaluation\Conditionals\Scanner.cs (2)
84Debug.Assert(false, "What code path did not set an appropriate error resource? Expression: " + _expression); 111Debug.Assert(-1 != _errorPosition); // We should have set it
Evaluation\Expander.Function.cs (1)
158System.Diagnostics.Debug.Assert(
Evaluation\LazyItemEvaluator.cs (2)
205Debug.Assert(_applyCalls == cacheCount, "Apply should only be called once per globsToIgnore. Otherwise caching is not working"); 211Debug.Assert(_cache == null);
Evaluation\Profiler\ProfilerResultPrettyPrinter.cs (1)
70Debug.Assert(totalTime != null, "There should be at least one evaluation pass result");
Graph\ProjectGraph.cs (1)
973Debug.Assert(_evaluationContext is not null);
Instance\TaskFactories\TaskHostTask.cs (1)
541Debug.WriteLine("[TaskHostTask] Handling packet {0} at {1}", packet.Type, DateTime.Now);
Logging\BaseConsoleLogger.cs (2)
1209Debug.Assert(shared != null, "This is not supposed to be used in multiple threads or multiple time. One method is expected to return it before next acquire. Most probably it was not returned."); 1265Debug.Assert(previous == null, "This is not supposed to be used in multiple threads or multiple time. One method is expected to return it before next acquire. Most probably it was double returned.");
Logging\LogFormatter.cs (1)
37Debug.Assert(timeStamp != DateTime.MinValue, "Timestamp missing");
Logging\ProfilerLogger.cs (3)
105Debug.Assert(_aggregatedLocations == null, 141Debug.Assert(result, 254Debug.Assert(pair.Key.ParentId.HasValue,
Logging\TerminalLogger\TerminalLogger.cs (1)
757System.Diagnostics.Debug.Assert(
src\5057ed6cf5d6323b\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\5057ed6cf5d6323b\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\5057ed6cf5d6323b\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\5057ed6cf5d6323b\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\9f0d3f3da306d8cf\IEnumerableExtensions.cs (1)
752Debug.Assert(data.All(d => d.Count() == count));
src\9f0d3f3da306d8cf\ImmutableArrayExtensions.cs (16)
87Debug.Assert(items != null); 488Debug.Assert(self.Length == other.Length); 519Debug.Assert(self.Length == other.Length); 551Debug.Assert(!array.IsDefault); 552Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 571Debug.Assert(i > 0); 587Debug.Assert(i > 0); 590Debug.Assert(builder == null); 603Debug.Assert(!all); 604Debug.Assert(!none); 613Debug.Assert(none); 817Debug.Assert(!array.IsDefault); 1191Debug.Assert(builder.Count > 1); 1235Debug.Assert(members.Length > 0); 1250Debug.Assert(count < members.Length); 1262Debug.Assert(builder.Count == count);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\TemporaryArray`1.cs (2)
172Debug.Assert(_count == InlineCapacity); 335Debug.Assert(_builder is null);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.pooledobjects\5.0.0-1.25277.114\contentFiles\cs\netstandard2.0\ArrayBuilder.cs (8)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.Assert(limit <= Count);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.pooledobjects\5.0.0-1.25277.114\contentFiles\cs\netstandard2.0\ObjectPool`1.cs (5)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1); 277Debug.Assert(obj != null, "freeing null?"); 279Debug.Assert(_firstItem != obj, "freeing twice?"); 290Debug.Assert(value != obj, "freeing twice?");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.pooledobjects\5.0.0-1.25277.114\contentFiles\cs\netstandard2.0\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.pooledobjects\5.0.0-1.25277.114\contentFiles\cs\netstandard2.0\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\msbuild\artifacts\.packages\microsoft.codeanalysis.pooledobjects\5.0.0-1.25277.114\contentFiles\cs\netstandard2.0\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\msbuild\src\Shared\ResourceUtilities.cs (3)
302Debug.Fail("The resource string \"" + resourceName + "\" was not found."); 309Debug.Fail("The resource string \"" + resourceName + "\" was not found."); 316Debug.Fail("The resource string \"" + resourceName + "\" was not found.");
src\msbuild\src\Shared\TaskEngineAssemblyResolver.cs (1)
84Debug.Assert(false, "There is no handler to remove.");
src\msbuild\src\Shared\TaskLoggingHelper.cs (2)
280Debug.Assert(messageArgs == null || messageArgs.Length == 0 || messageArgs[0].GetType() != typeof(MessageImportance), "Did you call the wrong overload?"); 475Debug.Assert(messageArgs == null || messageArgs.Length == 0 || messageArgs[0].GetType() != typeof(MessageImportance), "Did you call the wrong overload?");
Utilities\EngineFileUtilities.cs (1)
597Debug.Assert(s_lazyWildCardExpansionRegexes is not null, $"If the user provided lazy wildcard regexes, {nameof(s_lazyWildCardExpansionRegexes)} should be populated");
Utilities\FileSpecMatchTester.cs (4)
24Debug.Assert(!string.IsNullOrEmpty(unescapedFileSpec)); 25Debug.Assert(currentDirectory != null); 59Debug.Assert(!string.IsNullOrEmpty(fileToMatch)); 79Debug.Assert(!string.IsNullOrEmpty(normalizedFileToMatch));
Utilities\SimpleVersion.cs (1)
181Debug.Assert(value >= 0);
Utilities\Utilities.cs (4)
726Debug.Fail($"In {nameof(EnumerateProperties)}(): Unexpected: property is null"); 730Debug.Fail($"In {nameof(EnumerateProperties)}(): Unexpected property {item} of type {item?.GetType().ToString()}"); 907Debug.Fail($"In {nameof(EnumerateItems)}(): Unexpected: {nameof(item)} is null"); 911Debug.Fail($"In {nameof(EnumerateItems)}(): Unexpected {nameof(item)} {item} of type {item?.GetType().ToString()}");
Xml\ProjectXmlUtilities.XmlElementChildIterator.cs (4)
33Debug.Assert(element != null); 43Debug.Assert(_state > -1); 60Debug.Assert(_state == -1); 70Debug.Assert(_state == 1 && _current != null);
Microsoft.Build.Framework (41)
BackEnd\InterningBinaryReader.cs (1)
157Debug.Assert(false, e.ToString());
BinaryTranslator.cs (1)
644Debug.Assert(count == 2);
BuildException\BuildExceptionBase.cs (1)
111Debug.Assert((exception.Data?.Count ?? 0) == 0,
ChangeWaves.cs (1)
180Debug.Assert(_runningTests || Array.IndexOf(AllWaves, wave) >= 0, $"Change wave version {wave} is invalid");
Collections\RefArrayBuilder.cs (13)
77Debug.Assert(value >= 0, "Count must be non-negative."); 78Debug.Assert(value <= _scope.Length, "Count must not exceed the span length."); 93Debug.Assert(index < _count, "Index must be less than Count."); 138Debug.Assert(_count == _scope.Length, "AddWithResize should only be called when the span is full."); 195Debug.Assert(index >= 0, "Insert index must be non-negative."); 196Debug.Assert(index <= _count, "Insert index must not exceed Count."); 220Debug.Assert(_count == _scope.Length, "InsertWithResize should only be called when the span is full."); 237Debug.Assert(index >= 0, "Insert index must be non-negative."); 238Debug.Assert(index <= _count, "Insert index must not exceed Count."); 279Debug.Assert(startIndex >= -1, "Start index must be -1 or non-negative."); 280Debug.Assert(startIndex <= _count, "Start index must not exceed Count."); 336Debug.Assert(index >= 0, "Remove index must be non-negative."); 337Debug.Assert(index < _count, "Remove index must be less than Count.");
EncodingUtilities.cs (2)
78Debug.Assert(false, "GetEncoding(default OEM encoding) threw an ArgumentException in EncodingUtilities.CurrentSystemOemEncoding! Please log a bug against MSBuild.", ex.Message); 82Debug.Assert(false, "GetEncoding(default OEM encoding) threw a NotSupportedException in EncodingUtilities.CurrentSystemOemEncoding! Please log a bug against MSBuild.", ex.Message);
FileUtilities.cs (3)
98Debug.Fail($"Casing test failed: {ex}"); 917Debug.Assert(allowedExtensions?.Length > 0); 925Debug.Assert(!String.IsNullOrEmpty(extension) && extension[0] == '.');
InternalErrorException.cs (1)
134Debug.Fail(message, innerMessage);
ITaskItemExtensions.cs (1)
59Debug.Fail(e.ToString());
Loader\CoreCLRAssemblyLoader.cs (1)
56Debug.Assert(Path.IsPathRooted(fullPath));
LoggerException.cs (1)
125Debug.Assert(state is not null, "state cannot be null");
ReuseableStringBuilder.cs (1)
326Debug.Assert(returningBuilder.Capacity > returning._borrowedWithCapacity, "Capacity can only increase");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.contracts\5.0.0-1.25277.114\contentFiles\cs\net9.0\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.contracts\5.0.0-1.25277.114\contentFiles\cs\net9.0\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
Utilities\BufferScope.cs (1)
96Debug.Assert(capacity > _span.Length);
Utilities\FileMatcher.cs (5)
871Debug.Assert(FileUtilities.PathsEqual(searchToExclude.BaseDirectory, recursionState.BaseDirectory), "Expected exclude search base directory to match include search base directory"); 1981Debug.Assert(projectDirectoryUnescaped != null); 1982Debug.Assert(filespecUnescaped != null); 1983Debug.Assert(Path.IsPathRooted(projectDirectoryUnescaped)); 2541Debug.Assert(excludeState.SearchData.RegexFileMatch != null || excludeState.SearchData.DirectoryPattern != null,
Utilities\QuotingUtilities.cs (1)
88Debug.Assert(false, "Null character in parameter");
Utilities\StringBuilderCache.cs (2)
49Debug.Assert( 93Debug.Assert(t_cachedInstance is null, "Unexpected replacing of other StringBuilder.");
Utilities\TypeExtensions.cs (1)
92Debug.Assert(
Utilities\ValueStringBuilder.cs (2)
408Debug.Assert(additionalCapacityBeyondPos > 0); 409Debug.Assert(_length > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed.");
Microsoft.Build.Tasks.CodeAnalysis (32)
src\roslyn\src\Compilers\Core\MSBuildTask\CommandLineBuilderExtension.cs (2)
124Debug.Assert(!_isQuotingRequired); 240Debug.Assert(treatAsFlags == null
src\roslyn\src\Compilers\Core\MSBuildTask\Csc.cs (2)
225Debug.Fail("The SDK framework-to-core bridge task only runs on .NET Framework MSBuild."); 826Debug.Assert(HostObject != null, "We should not be here if the host object has not been set.");
src\roslyn\src\Compilers\Core\MSBuildTask\ManagedToolTask.cs (1)
86Debug.Assert(IsBuiltinToolRunningOnCoreClr || useAppHost);
src\roslyn\src\Compilers\Core\MSBuildTask\MapSourceRoots.cs (1)
196Debug.Assert(mappedTopLevelPath.EndsWith("/", StringComparison.Ordinal));
src\roslyn\src\Compilers\Core\MSBuildTask\RCWForCurrentContext.cs (3)
52Debug.Assert(objInCurrentCtx != null, "Unable to marshal COM Object to the current context (apartment). This will hurt performance."); 72Debug.Fail("This object requires explicit call to Dispose"); 119Debug.Assert(OperatingSystem.IsWindows());
src\roslyn\src\Compilers\Core\MSBuildTask\Vbc.cs (3)
409Debug.Fail("The SDK framework-to-core bridge task only runs on .NET Framework MSBuild."); 1128Debug.Assert(this.HostObject != null, "We should not be here if the host object has not been set."); 1134Debug.Assert(vbcHostObject5 != null, "Wrong kind of host object passed in!");
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (2)
151Debug.Assert(e.InnerException is object); 153Debug.Assert(false, "Unreachable");
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (3)
73Debug.Assert(!string.IsNullOrWhiteSpace(CompilerHash), "A hash value is required to communicate with the server"); 85Debug.Assert(!string.IsNullOrWhiteSpace(compilerHash), "CompilerHash is required to send request to the build server"); 506Debug.Assert(reason is object);
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (4)
79Debug.Assert(workingDirectory is object); 199Debug.Assert(pipeName is object); 833Debug.Assert(Stream is null); 871Debug.Assert(Stream is not null);
src\roslyn\src\Compilers\Shared\CompilerServerLogger.cs (1)
138Debug.Assert(false, e.Message);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
Microsoft.Build.Tasks.Core (82)
AssemblyDependency\CandidateAssemblyFilesResolver.cs (1)
90Debug.Assert(considered.Reason != NoMatchReason.Unknown, "Expected a no match reason here.");
AssemblyDependency\Reference.cs (4)
210Debug.Assert(dependee.FullPath.Length > 0, "Cannot add dependee that doesn't have a full name. This should have already been resolved."); 424Debug.Assert(filenameExtension[0] == '.', "Expected extension to start with '.'"); 445Debug.Assert(!Path.IsPathRooted(filename), "Satellite path should be relative to the current reference."); 457Debug.Assert(!Path.IsPathRooted(filename), "Serialization assembly path should be relative to the current reference.");
AssemblyDependency\ResolveAssemblyReference.cs (6)
1850Debug.Assert(false, "Should have handled this case."); 1895Debug.Assert(false, "Unexpected exception type."); 2033Debug.Assert(false, "Should have handled this case."); 2151Debug.Assert(false, "Should have handled this case."); 2190Debug.Assert(!reference.IsPrimary, "A primary reference should never lose a conflict because of version. This is an insoluble conflict instead."); 2221Debug.Assert(false, "Should have handled this case.");
AssignCulture.cs (1)
212Debug.Assert(false, "Unexpected exception in AssignCulture.Execute. " +
BootstrapperUtil\BootstrapperBuilder.cs (21)
554Debug.Fail(ex.Message); 579Debug.Fail("Already found resources for culture " + stringNode.InnerText); 803Debug.Assert(filePath != null, "null filePath?"); 804Debug.Assert(schemaPath != null, "null schemaPath?"); 805Debug.Assert(schemaNamespace != null, "null schemaNamespace?"); 819Debug.Fail("Could not locate schema '" + schemaPath + "', so no validation of '" + filePath + "' is possible."); 828Debug.Fail("Could not locate data file '" + filePath + "'."); 850Debug.Assert(_document != null, "our document should have been created by now!"); 856Debug.Fail("Failed to load document '" + filePath + "' due to the following exception:\r\n" + ex.Message); 861Debug.Fail("Failed to load document '" + filePath + "' due to the following exception:\r\n" + ex.Message); 869Debug.Assert(xmlDocument.DocumentElement != null && 946Debug.Assert(langDoc != null, "we couldn't load package.xml in '" + strLangManifestFilename + "'...?"); 953Debug.Assert(langNode != null, $"Unable to find a package node in {strLangManifestFilename}"); 1045Debug.WriteLine($"Validation results already added for Product Code '{productCodeAttribute}'"); 1054Debug.Fail(ex.Message); 1058Debug.Fail(ex.Message); 1062Debug.Fail(ex.Message); 1260Debug.Assert(false, "Specified key does not exist for node " + nextNode.InnerXml); 1566Debug.Assert(sourceAttribute != null, "we should not be here if there is no ProductCode attribute"); 1901Debug.Fail(ex.Message); 1995Debug.Assert(s != null, $"EmbeddedResource '{name}' not found");
BootstrapperUtil\PackageCollection.cs (1)
39Debug.Fail("Package with culture " + package.Culture + " has already been added.");
BootstrapperUtil\Product.cs (2)
34Debug.Fail("Products are not to be created in this fashion. Please use IBootstrapperBuilder.Products instead."); 171Debug.WriteLine($"A package with culture '{package.Culture.ToLowerInvariant()}' has already been added to product '{ProductCode}'");
BootstrapperUtil\ProductCollection.cs (1)
37System.Diagnostics.Debug.WriteLine("Product '{0}' has already been added to the product list", product.ProductCode.ToUpperInvariant());
BootstrapperUtil\productvalidationresults.cs (1)
36System.Diagnostics.Debug.Fail("Validation results have already been added for culture '{0}'", culture);
GenerateApplicationManifest.cs (2)
402Debug.Assert(!String.IsNullOrEmpty(manifest.Product)); 420Debug.Assert(!String.IsNullOrEmpty(manifest.Publisher));
GenerateDeploymentManifest.cs (2)
141Debug.Assert(!String.IsNullOrEmpty(manifest.Product)); 153Debug.Assert(!String.IsNullOrEmpty(manifest.Publisher));
GenerateResource.cs (3)
3113Debug.Fail($"Unknown format {format}"); 3408Debug.Fail($"Unknown format {format}"); 3438Debug.Assert(_logger.HasLoggedErrors);
ManifestUtil\ConvertUtil.cs (2)
28Debug.Fail($"Invalid value '{value}' for {typeof(bool).Name}, returning {defaultValue}"); 32Debug.Fail($"Invalid value '{value}' for {typeof(bool).Name}, returning {defaultValue}");
ManifestUtil\Manifest.cs (4)
532Debug.Assert(false, "AssemblyName cannot be empty"); 778Debug.Fail("Comparing null objects"); 786Debug.Fail("Objects do not have a SortName"); 793Debug.Fail("Comparing objects that are not BaseReferences");
ManifestUtil\TrustInfo.cs (1)
317Debug.Assert(document != null, "GetPermissionSetElement was passed a null document");
ManifestUtil\Util.cs (4)
203Debug.Assert(s != null, $"EmbeddedResource '{name}' not found"); 596Debug.Fail("Comparing null objects"); 601Debug.Fail("Comparing objects that are not ITaskItem"); 608Debug.Fail("Objects do not have a ItemSpec");
ManifestUtil\XmlUtil.cs (1)
197Debug.Fail($"ResourceResolver could not find file '{filename}'");
RedistList.cs (3)
903Debug.Assert(isValidEntry, string.Format(CultureInfo.InvariantCulture, "Missing attribute in redist file: {0}, line #{1}", path, 936Debug.Assert(firstEntry != null && secondEntry != null); 1144Debug.Assert(name != null && frameworkDirectory != null);
ResGenDependencies.cs (3)
370Debug.Assert(outputFiles != null, "OutputFiles hasn't been set"); 395Debug.Assert(OutputFiles != null, "This has not been initialized"); 396Debug.Assert(otherLibrary.OutputFiles != null, "The other library has not been initialized");
ResolveManifestFiles.cs (13)
367Debug.Assert(!String.IsNullOrEmpty(itemCulture), $"Satellite item '{item.ItemSpec}' is missing expected attribute 'Culture'"); 888Debug.Assert(!_dictionary.ContainsKey(key), $"Two or more items with same key '{key}' detected"); 957Debug.Assert(!_dictionary.ContainsKey(key), $"Two or more items with same key '{key}' detected"); 991Debug.Assert(!String.IsNullOrEmpty(targetPath)); 998Debug.Assert(!_dictionary.ContainsKey(key), $"Two or more items with same '{(object)ItemMetadataNames.targetPath}' attribute detected"); 1033Debug.Fail($"Invalid value '{value}' for PublishState"); 1037Debug.Fail($"Invalid value '{value}' for PublishState"); 1072Debug.Fail("PublishState.DataFile is invalid for an assembly"); 1079Debug.Fail($"Unhandled value PublishFlags.{state}"); 1109Debug.Fail("PublishState.Prerequisite is invalid for a file"); 1112Debug.Fail($"Unhandled value PublishFlags.{state}"); 1139Debug.Fail("PublishState.DataFile is invalid for an assembly"); 1146Debug.Fail($"Unhandled value PublishFlags.{state}");
src\msbuild\src\Shared\LanguageParser\CSharptokenEnumerator.cs (2)
96Debug.Assert(false, "Code defect in tokenizer: Should have yielded a closing tick."); 160Debug.Assert(false, "Defect in tokenizer: Should have yielded a terminating quote.");
src\msbuild\src\Shared\ResourceUtilities.cs (3)
302Debug.Fail("The resource string \"" + resourceName + "\" was not found."); 309Debug.Fail("The resource string \"" + resourceName + "\" was not found."); 316Debug.Fail("The resource string \"" + resourceName + "\" was not found.");
SystemState.cs (1)
688Debug.Assert(false, "Using slow-path in SystemState.GetDirectories, was this intentional?");
Microsoft.Build.Tasks.Git (22)
GitDataReader\GitConfig.Reader.cs (1)
363Debug.Assert(c == '[');
GitDataReader\GitEnvironment.cs (1)
129Debug.Assert(!PathUtils.IsUnixLikePlatform);
GitDataReader\GitIgnore.Matcher.cs (5)
44Debug.Assert(PathUtils.HasTrailingSlash(directory)); 114Debug.Assert(PathUtils.IsAbsolute(normalizedPosixPath)); 115Debug.Assert(PathUtils.IsPosixPath(normalizedPosixPath)); 116Debug.Assert(!PathUtils.HasTrailingSlash(normalizedPosixPath)); 166Debug.Assert(!PathUtils.HasTrailingSlash(fullPath));
GitDataReader\GitReferenceResolver.cs (2)
38Debug.Assert(PathUtils.IsNormalized(gitDirectory)); 39Debug.Assert(PathUtils.IsNormalized(commonDirectory));
GitDataReader\GitRefTableReader.cs (1)
270Debug.Assert(StringComparer.Ordinal.Compare(referenceName, record.LastRefName) < 0);
GitDataReader\Glob.cs (4)
59Debug.Assert(pattern[patternIndex] == '*' && pattern[patternIndex + 1] == '/'); 171Debug.Assert(patternIndex >= 0); 172Debug.Assert(pathIndex >= 0); 191Debug.Assert(pattern[patternIndex - 1] == '[');
GitDataReader\PathUtils.cs (2)
52Debug.Assert(!string.IsNullOrEmpty(root)); 103Debug.Assert(!IsUnixLikePlatform);
GitOperations.cs (2)
437Debug.Assert(segments.Length > 0); 439Debug.Assert(root.Matcher == null);
src\sourcelink\src\Common\Utilities\NullableAttributes.cs (4)
105/// <inheritdoc cref="Debug.Assert(bool)"/> 108=> Debug.Assert(b); 110/// <inheritdoc cref="Debug.Assert(bool, string)"/> 113=> Debug.Assert(b, message);
Microsoft.Build.Utilities.Core (7)
CommandLineBuilder.cs (1)
201Debug.Assert(!hasAllUnquotedCharacters || !hasSomeQuotedCharacters,
src\msbuild\src\Shared\ResourceUtilities.cs (3)
302Debug.Fail("The resource string \"" + resourceName + "\" was not found."); 309Debug.Fail("The resource string \"" + resourceName + "\" was not found."); 316Debug.Fail("The resource string \"" + resourceName + "\" was not found.");
src\msbuild\src\Shared\TaskLoggingHelper.cs (2)
280Debug.Assert(messageArgs == null || messageArgs.Length == 0 || messageArgs[0].GetType() != typeof(MessageImportance), "Did you call the wrong overload?"); 475Debug.Assert(messageArgs == null || messageArgs.Length == 0 || messageArgs[0].GetType() != typeof(MessageImportance), "Did you call the wrong overload?");
ToolTask.cs (1)
440Debug.Assert(ExitCode != 0, "HandleTaskExecutionErrors should only be called if there were problems executing the task");
Microsoft.CodeAnalysis (2378)
AssemblyUtilities.cs (2)
26Debug.Assert(PathUtilities.IsAbsolute(filePath)); 100Debug.Assert(PathUtilities.IsAbsolute(assemblyPath));
Binding\AbstractLookupSymbolsInfo.cs (8)
132Debug.Assert((uniqueSymbol != null) || (arity == 0)); 139Debug.Assert(arity == _arityBitVectorOrUniqueArity); 148Debug.Assert(_uniqueSymbolOrArities is TSymbol); 163Debug.Assert(!this.HasUniqueSymbol); 205Debug.Assert(!this.HasUniqueSymbol); 213Debug.Assert(!this.HasUniqueSymbol); 265Debug.Assert(pair.UniqueSymbol == null || pair.UniqueSymbol == symbol); 286Debug.Assert(CanBeAdded(name));
Binding\BindingDiagnosticBag.cs (8)
43Debug.Assert(DiagnosticBag is object); 49Debug.Assert(DiagnosticBag is object); 67Debug.Assert(diagnosticBag?.GetType().IsValueType != true); 110Debug.Assert(allowMismatchInDependencyAccumulation || other.Dependencies.IsDefaultOrEmpty || this.AccumulatesDependencies || !this.AccumulatesDiagnostics); 119Debug.Assert(allowMismatchInDependencyAccumulation || !other.AccumulatesDependencies || this.AccumulatesDependencies); 186Debug.Assert(allowMismatchInDependencyAccumulation || !dependencies.AccumulatesDependencies || this.AccumulatesDependencies); 201Debug.Assert(!useSiteInfo.AccumulatesDependencies || this.AccumulatesDependencies); 261Debug.Assert(!useSiteInfo.AccumulatesDependencies || this.AccumulatesDependencies);
Binding\UseSiteInfo.cs (30)
60Debug.Assert(diagnosticInfo?.Severity != DiagnosticSeverity.Error || (primaryDependency is null && secondaryDependencies?.IsEmpty != false)); 61Debug.Assert(primaryDependency is null || primaryDependency != primaryDependency.CorLibrary); 62Debug.Assert(secondaryDependencies?.IsEmpty != false || !secondaryDependencies.Any(dependency => dependency == dependency.CorLibrary)); 81Debug.Assert(DiagnosticInfo?.Severity != DiagnosticSeverity.Error); 126Debug.Assert(assemblyBeingBuilt is object); 127Debug.Assert(assemblyBeingBuilt is ISourceAssemblySymbolInternal); 135Debug.Assert(assemblyBeingBuilt is object); 136Debug.Assert(assemblyBeingBuilt is ISourceAssemblySymbolInternal); 164Debug.Assert(discardLevel != DiscardLevel.None); 179Debug.Assert(_diagnostics is null); 180Debug.Assert(_dependencies is null); 181Debug.Assert(!_hasErrors); 185Debug.Assert(_dependencies is null); 201Debug.Assert(AccumulatesDiagnostics); 210Debug.Assert(_discardLevel switch { DiscardLevel.None => true, DiscardLevel.Dependencies => true, DiscardLevel.DiagnosticsAndDependencies => true, _ => false }); 211Debug.Assert(_hasErrors == (_diagnostics?.Any(d => d.Severity == DiagnosticSeverity.Error) ?? false)); 212Debug.Assert(!_hasErrors || (_dependencies is null)); 221Debug.Assert(AccumulatesDependencies); 231Debug.Assert(AccumulatesDiagnostics); 280Debug.Assert(_diagnostics is not null); 354Debug.Assert(!info.AccumulatesDependencies || this.AccumulatesDependencies); 390Debug.Assert(other.AccumulatesDiagnostics); 391Debug.Assert(other._discardLevel != DiscardLevel.None || _discardLevel == DiscardLevel.None); 395Debug.Assert(!AccumulatesDependencies); 438Debug.Assert(!AccumulatesDependencies); 474Debug.Assert(diagnosticInfo is null || diagnosticInfo.Severity == DiagnosticSeverity.Error); 486Debug.Assert(primaryDependency is object || (useSiteInfo.PrimaryDependency is null && secondaryDependencies.IsEmpty)); 487Debug.Assert(primaryDependency == useSiteInfo.PrimaryDependency || useSiteInfo.DiagnosticInfo?.Severity == DiagnosticSeverity.Error); 549Debug.Assert(info is object); 603Debug.Assert(!dependencies.IsEmpty);
CodeGen\BasicBlock.cs (18)
105Debug.Assert((this.FirstILMarker < 0) == (this.LastILMarker < 0)); 106Debug.Assert((this.LastILMarker < 0) || (this.LastILMarker + 1 == marker)); 119Debug.Assert(this.FirstILMarker >= 0); 120Debug.Assert(this.LastILMarker >= 0); 121Debug.Assert(this.LastILMarker == marker); 186Debug.Assert((ILOpCode)(byte)value == value, "rev opcodes must fit in a byte"); 210Debug.Assert(this.BranchCode.IsConditionalBranch() == newBranchCode.IsConditionalBranch()); 211Debug.Assert(newBranchCode.IsBranch() == (_branchLabel != null)); 232Debug.Assert(newLabel != null); 271Debug.Assert(delta <= 0); 284Debug.Assert(BranchBlock?.EnclosingHandler == null); 363Debug.Assert(BranchCode != ILOpCode.Nop, "Nop branches should not have labels"); 461Debug.Assert(toRemove == next || toRemove.TotalSize == 0); 462Debug.Assert(!builder._labelInfos.Values.Any(li => li.bb == toRemove), 633Debug.Assert(BranchCode.Size() == 1); 730Debug.Assert(BranchLabels != null); 741Debug.Assert(BranchesCount > 0); 742Debug.Assert(branchBlocksBuilder != null);
CodeGen\CompilationTestData.cs (1)
49Debug.Assert(MetadataWriter == null);
CodeGen\DebugId.cs (2)
35Debug.Assert(ordinal >= 0 || ordinal == UndefinedOrdinal); 36Debug.Assert(generation >= 0);
CodeGen\EmitState.cs (2)
47Debug.Assert(value >= 0 && value <= ushort.MaxValue); 63Debug.Assert(value >= 0 && value <= ushort.MaxValue);
CodeGen\ILBuilder.cs (37)
91Debug.Assert(!_pendingBlockCreate || (_currentBlock == null)); 104Debug.Assert(_currentBlock == null); 124Debug.Assert(_lastCompleteBlock != null); 125Debug.Assert(_lastCompleteBlock.NextBlock == null); 137Debug.Assert(_currentBlock == null); 140Debug.Assert(_currentBlock != null); 141Debug.Assert(!_pendingBlockCreate); 166Debug.Assert(_allocatedILMarkers != null); 176Debug.Assert((startMarker < 0) || (startMarker == (_lastCompleteBlock.LastILMarker + 1))); 269Debug.Assert(AllBlocks(block => (block.Reachability == Reachability.NotReachable))); 442Debug.Assert(handlerBlock != null); 448Debug.Assert(handlerBlock.NextExceptionHandler == null); 470Debug.Assert(handlerBlock.Type == BlockType.Catch || handlerBlock.Type == BlockType.Fault || handlerBlock.Type == BlockType.Filter); 481Debug.Assert(block.EnclosingHandler.LastFilterConditionBlock.BranchCode == ILOpCode.Endfilter); 531Debug.Assert(targetBlock != null && !IsSpecialEndHandlerBlock(targetBlock)); 591Debug.Assert(targetBlock != null && !IsSpecialEndHandlerBlock(targetBlock)); 703Debug.Assert(AllBlocks(block => (block.Reachability == Reachability.Reachable) || (block.Reachability == Reachability.BlockedByFinally))); 747Debug.Assert(current.Reachability != Reachability.BlockedByFinally || 768Debug.Assert(AllBlocks(block => !IsSpecialEndHandlerBlock(block))); 783Debug.Assert(block.BranchBlock == block); 910Debug.Assert(blockLastMarker >= blockFirstMarker); 913Debug.Assert(_allocatedILMarkers != null); 963Debug.Assert(btOffset == offset); 1001Debug.Assert(lastOffset < offset); 1004Debug.Assert((lastOffset >= 0) || (offset == 0)); 1042Debug.Assert(this.SeqPointsOpt.Count == 0); 1085Debug.Assert(_initialHiddenSequencePointMarker < 0); 1090Debug.Assert(_initialHiddenSequencePointMarker == 0); 1106Debug.Assert(_emitState.CurStack == 0); 1112Debug.Assert(_emitState.InstructionsEmitted >= _instructionCountAtLastLabel); 1142Debug.Assert(!_pendingBlockCreate); 1150Debug.Assert(!_pendingBlockCreate); 1246Debug.Assert(this.RealizedIL.IsDefault, "Too late to allocate a new IL marker"); 1253Debug.Assert(curBlock != null); 1271Debug.Assert(!RealizedIL.IsDefault, "Builder must be realized to perform this operation"); 1272Debug.Assert(_allocatedILMarkers != null, "There are not markers in this builder"); 1273Debug.Assert(ilMarker >= 0 && ilMarker < _allocatedILMarkers.Count, "Wrong builder?");
CodeGen\ILBuilderConversions.cs (2)
227Debug.Assert(fromPredefTypeKind.IsFloatingPoint()); 264Debug.Assert(fromPredefTypeKind.IsFloatingPoint());
CodeGen\ILBuilderEmit.cs (20)
32Debug.Assert(!code.IsControlTransfer(), 127Debug.Assert(labelInfo.bb == null, "duplicate use of a label"); 139Debug.Assert(curStack == labelStack, "forward branches and fall-through must agree on stack depth"); 169Debug.Assert(validOpCode); 170Debug.Assert(revOpCode == ILOpCode.Nop || revOpCode.IsBranch()); 171Debug.Assert(!code.HasVariableStackBehavior()); 184Debug.Assert(labelInfo.stack == _emitState.CurStack, "branches to same label with different stacks"); 191Debug.Assert((code != ILOpCode.Nop) || (block == _labelInfos[label].bb)); 231Debug.Assert(caseLabels.Length > 0); 263Debug.Assert(caseLabels.Length > 0); 264Debug.Assert(keyTypeCode != Cci.PrimitiveTypeCode.String); 289Debug.Assert(ld.stack == curStack, "branches to same label with different stacks"); 306Debug.Assert(!this.InExceptionHandler); 362Debug.Assert(!arrayType.IsSZArray, "should be used only with multidimensional arrays"); 376Debug.Assert(!arrayType.IsSZArray, "should be used only with multidimensional arrays"); 390Debug.Assert(!arrayType.IsSZArray, "should be used only with multidimensional arrays"); 404Debug.Assert(!arrayType.IsSZArray, "should be used only with multidimensional arrays"); 489Debug.Assert(LocalSlotManager != null); 806Debug.Assert(alignment is 1 or 2 or 4); 852Debug.Assert(size == 2);
CodeGen\ILOpCodeExtensions.cs (3)
19Debug.Assert(code < 0xf0); 24Debug.Assert((code & 0xff00) == 0xfe00); 185Debug.Assert(!opcode.HasVariableStackBehavior());
CodeGen\LambdaDebugInfo.cs (1)
37Debug.Assert(closureOrdinal >= MinClosureOrdinal);
CodeGen\LocalDebugId.cs (2)
44Debug.Assert(isNone); 52Debug.Assert(ordinal >= 0);
CodeGen\LocalScopeManager.cs (24)
47Debug.Assert(_enclosingExceptionHandler == GetEnclosingExceptionHandler()); 71Debug.Assert(_enclosingExceptionHandler == GetEnclosingExceptionHandler()); 214Debug.Assert(scopeType == ScopeType.Variable || scopeType == ScopeType.StateMachineVariable); 261Debug.Assert(scopes.Count > 0); 285Debug.Assert(scopes.Count > 0); 346Debug.Assert(variable.Name != null); 358Debug.Assert(constant.Name != null); 370Debug.Assert(slotIndex >= 0); 561Debug.Assert((type == ScopeType.Try) || (type == ScopeType.Catch) || (type == ScopeType.Filter) || (type == ScopeType.Finally) || (type == ScopeType.Fault)); 562Debug.Assert((type == ScopeType.Catch) == (exceptionType != null)); 600Debug.Assert(_type == ScopeType.Filter); 601Debug.Assert(_lastFilterConditionBlock == null); 622Debug.Assert(endLabel != null); 631Debug.Assert(LeaderBlock != null); 636Debug.Assert(builder.EnclosingExceptionHandler == this); 699Debug.Assert(((_handlers.Count == 0) && (scopeType == ScopeType.Try)) || 702Debug.Assert(currentExceptionHandler == _containingHandler); 711Debug.Assert(_handlers.Count > 1); 732Debug.Assert(builder._currentBlock == builder._labelInfos[_endLabel].bb); 749Debug.Assert(_handlers.Count > 1); 768Debug.Assert(handlerScope.Type == ScopeType.Try); 774Debug.Assert((reachability == Reachability.Reachable) || (reachability == Reachability.NotReachable)); 777Debug.Assert(_handlers.All(h => (h.LeaderBlock.Reachability == reachability))); 867Debug.Assert(begin >= 0 && end >= 0);
CodeGen\LocalSlotManager.cs (5)
165Debug.Assert(removed, $"Attempted to free '{symbol}' more than once."); 255Debug.Assert(slot.Name == null); 265Debug.Assert((_addressedLocals == null) == (_addressedLocalScopes == 0)); 283Debug.Assert(_addressedLocals != null); 301Debug.Assert(_addressedLocalScopes == 0 && countBefore == 0);
CodeGen\MetadataConstant.cs (1)
34Debug.Assert(value == null || value is string || value is DateTime || value is decimal || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is IntPtr) && !(value is UIntPtr)));
CodeGen\MethodBody.cs (4)
77Debug.Assert(!locals.IsDefault); 78Debug.Assert(!exceptionHandlers.IsDefault); 79Debug.Assert(!localScopes.IsDefault); 113Debug.Assert(debugDocumentProvider != null);
CodeGen\PermissionSetAttribute.cs (8)
71Debug.Assert(namedArgs.Length == 1); 75Debug.Assert(fileArg.ArgumentName == FilePropertyName); 76Debug.Assert(context.Module.IsPlatformType(fileArg.Type, Cci.PlatformType.SystemString)); 79Debug.Assert(fileArg.ArgumentValue is MetadataConstant); 81Debug.Assert(!String.IsNullOrEmpty(fileName)); 85Debug.Assert(((INamedTypeSymbol)iSymbol).GetMembers(HexPropertyName).Any( 135Debug.Assert(b < 0x10); 151Debug.Assert(_sourceAttribute.NamedArgumentCount == 1);
CodeGen\PrivateImplementationDetails.cs (23)
198Debug.Assert(!IsFrozen); 202Debug.Assert(typeCode is 222Debug.Assert(!IsFrozen); 224Debug.Assert(typeCode is not Cci.PrimitiveTypeCode.Reference); 242Debug.Assert(!IsFrozen); 243Debug.Assert(alignment is 1 or 2 or 4 or 8); 244Debug.Assert(length != 1 || alignment == 1); 385Debug.Assert(method is not null); 395Debug.Assert(symbol is not null, "The emit layer should check the helpers exist."); 404Debug.Assert(!IsFrozen); 408Debug.Assert(_mvidField.Type == mvidType); 416Debug.Assert(!IsFrozen); 420Debug.Assert(_moduleCancellationTokenField.Type == cancellationTokenType); 429Debug.Assert(!IsFrozen); 433Debug.Assert(payloadRootField.Type == payloadRootType); 440Debug.Assert(IsFrozen); 447Debug.Assert(!IsFrozen); 455Debug.Assert(IsFrozen); 461Debug.Assert(IsFrozen); 475Debug.Assert(IsFrozen); 508Debug.Assert(context.Module == ModuleBuilder); 529Debug.Assert(bytesWritten == hash.Length); 928Debug.Assert(!block.IsDefault);
CodeGen\SequencePointList.cs (1)
97Debug.Assert(ilOffset >= 0);
CodeGen\SwitchIntegralJumpTableEmitter.cs (13)
69Debug.Assert(caseLabels.Length > 0); 107Debug.Assert(!_sortedCaseLabels.IsEmpty); 152Debug.Assert(SwitchConstantValueHelper.IsValidSwitchCaseLabelConstant(firstConstant) 156Debug.Assert(SwitchConstantValueHelper.IsValidSwitchCaseLabelConstant(secondConstant) 187Debug.Assert(startLabelIndex >= 0 && startLabelIndex <= endLabelIndex); 188Debug.Assert(_sortedCaseLabels.Length > endLabelIndex); 227Debug.Assert(!switchBucketsStack.IsEmpty); 260Debug.Assert(startLabelIndex >= 0 && startLabelIndex <= endLabelIndex); 389Debug.Assert(i == bucketSize - 1); 397Debug.Assert(nextCaseLabelValue > startConstant.Int64Value); 403Debug.Assert(nextCaseLabelValue > startConstant.UInt64Value); 413Debug.Assert(nextCaseIndex >= switchBucket.LabelsCount); 423Debug.Assert(branchCode.IsBranch());
CodeGen\SwitchIntegralJumpTableEmitter.SwitchBucket.cs (11)
64Debug.Assert((uint)startIndex < (uint)endIndex); 74Debug.Assert((uint)startIndex <= (uint)endIndex); 75Debug.Assert((uint)startIndex != (uint)endIndex || isDegenerate); 95Debug.Assert(i < LabelsCount, "index out of range"); 140Debug.Assert(_startLabelIndex != _endLabelIndex, "1-sized buckets should be already known as degenerate."); 183Debug.Assert(!BucketOverflowUInt64Limit(startConstant, endConstant)); 184Debug.Assert(endConstant.Discriminator == startConstant.Discriminator); 190Debug.Assert(endConstant.Int64Value >= startConstant.Int64Value); 195Debug.Assert(endConstant.UInt64Value >= startConstant.UInt64Value); 205Debug.Assert(IsValidSwitchBucketConstantPair(startConstant, endConstant)); 306Debug.Assert(prevBucket._endLabelIndex + 1 == _startLabelIndex);
CodeGen\SwitchStringJumpTableEmitter.cs (5)
81Debug.Assert(caseLabels.Length > 0); 96Debug.Assert(_keyHash == null || ShouldGenerateHashTableSwitch(_caseLabels.Length)); 111Debug.Assert(_keyHash != null); 201Debug.Assert(stringConstant.IsNull || stringConstant.IsString); 212Debug.Assert(!bucket.Contains(kvPair));
CodeGen\SynthesizedLocalOrdinalsDispenser.cs (1)
59Debug.Assert(ordinal == 0 || localKind != SynthesizedLocalKind.UserDefined);
CodeGen\TokenMap.cs (2)
65Debug.Assert(referenceAdded); 98Debug.Assert(token < (uint)_count && _count <= _items.Length);
Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
Collections\ByteSequenceComparer.cs (1)
103Debug.Assert(!x.IsDefault);
Collections\CachingDictionary.cs (3)
216Debug.Assert(IsNotFullyPopulatedMap(existingMap)); 220Debug.Assert(_comparer == allKeys.Comparer); 237Debug.Assert(elements != s_emptySentinel);
Collections\CachingFactory.cs (2)
117Debug.Assert(result != 0); 244Debug.Assert(size > 0);
Collections\ImmutableMemoryStream.cs (1)
19Debug.Assert(!array.IsDefault);
Collections\OrderPreservingMultiDictionary.cs (13)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 280Debug.Assert(_value is V, "Item must be a a V"); 309Debug.Assert(this.Count >= 1); 315Debug.Assert(_value is V, "_value must be a V"); 343Debug.Assert(_count >= 1);
Collections\SmallConcurrentSetOfInts.cs (3)
50Debug.Assert(i != unoccupied); 80Debug.Assert(i != unoccupied); 126Debug.Assert(!added);
Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
Collections\TopologicalSort.cs (1)
75Debug.Assert(count != 0);
Collections\UnionCollection.cs (3)
33Debug.Assert(coll1.IsReadOnly && coll2.IsReadOnly); 51Debug.Assert(collections.All(c => selector(c).IsReadOnly)); 68Debug.Assert(!collections.IsDefault);
CommandLine\AnalyzerConfig.cs (4)
227Debug.Assert(!string.IsNullOrEmpty(sectionName)); 241Debug.Assert(!string.IsNullOrEmpty(key)); 242Debug.Assert(key == key.Trim()); 243Debug.Assert(value == value?.Trim());
CommandLine\AnalyzerConfig.SectionNameMatching.cs (2)
32Debug.Assert(regex.GetGroupNumbers().Length - 1 == numberRangePairs.Length); 49Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
CommandLine\AnalyzerConfigOptionsResult.cs (2)
37Debug.Assert(treeOptions != null); 38Debug.Assert(analyzerOptions != null);
CommandLine\AnalyzerConfigSet.cs (6)
154Debug.Assert(builder.Count == config.NamedSections.Length); 159Debug.Assert(allMatchers.Count == _analyzerConfigs.Length); 556Debug.Assert(_values is object); 565Debug.Assert(_values is object); 566Debug.Assert(_duplicates is object); 623Debug.Assert(originalEntry.globalLevel == globalLevel);
CommandLine\CommandLineArguments.cs (1)
439Debug.Assert((diagnosticsOpt == null) == (messageProviderOpt == null));
CommandLine\CommandLineParser.cs (7)
65Debug.Assert(PathUtilities.IsAbsolute(directory)); 131Debug.Assert(false); 468Debug.Assert(outputDirectory is object); 597Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 982Debug.Assert(i < arg.Length); 1001Debug.Assert(slashCount >= 0); 1153Debug.Assert(IsScriptCommandLineParser || !arg.StartsWith('-') && !arg.StartsWith('@'));
CommandLine\CommandLineReference.cs (1)
22Debug.Assert(!string.IsNullOrEmpty(reference));
CommandLine\CommandLineResource.cs (2)
40Debug.Assert(!resourceName.IsEmpty()); 41Debug.Assert(PathUtilities.IsAbsolute(fullPath));
CommandLine\CommandLineSourceFile.cs (1)
21Debug.Assert(!string.IsNullOrEmpty(path));
CommandLine\CommonCompiler.CompilerEmitStreamProvider.cs (1)
51Debug.Assert(_streamToDispose == null);
CommandLine\CommonCompiler.cs (20)
130Debug.Assert(null == responseFile || PathUtilities.IsAbsolute(responseFile)); 313Debug.Assert(normalizedPath is object); 423Debug.Assert(compilation.Options.SourceReferenceResolver is object); 462Debug.Assert(text != null); 467Debug.Assert(text != null || diagnostics.HasAnyErrors()); 717Debug.Assert(Arguments.ErrorLogOptions?.Path != null); 729Debug.Assert(diagnostics.HasAnyErrors()); 819Debug.Assert(generatedFilesBaseDirectory is not null); 852Debug.Assert(!string.IsNullOrWhiteSpace(Arguments.OutputFileName)); 878Debug.Assert(!Arguments.IsScriptRunner); 928Debug.Assert(hadErrors); 1045Debug.Assert(existing.GetOptions(syntaxTree) == DictionaryAnalyzerConfigOptions.Empty); 1060Debug.Assert(existing.GetOptions(additionalFiles[i]) == DictionaryAnalyzerConfigOptions.Empty); 1079Debug.Assert(analyzerConfigSet is object); 1174Debug.Assert(!string.IsNullOrWhiteSpace(tree.FilePath)); 1190Debug.Assert(path.StartsWith(explicitGeneratedOutDir!)); 1199Debug.Assert(tree.Encoding is object); 1576Debug.Assert(touchedFilesLogger != null); 1611Debug.Assert(filePath != null); 1627Debug.Assert(PathUtilities.IsAbsolute(file.Path));
CommandLine\CommonCompiler.ExistingReferencesResolver.cs (2)
30Debug.Assert(resolver != null); 31Debug.Assert(availableReferences != null);
CommandLine\CommonCompiler.LoggingMetadataFileReferenceResolver.cs (2)
21Debug.Assert(pathResolver != null); 22Debug.Assert(provider != null);
CommandLine\CommonCompiler.SuppressionDiagnostic.cs (4)
37Debug.Assert(originalDiagnostic != null); 38Debug.Assert(originalDiagnostic.ProgrammaticSuppressionInfo != null); 39Debug.Assert(!string.IsNullOrEmpty(suppressionId)); 40Debug.Assert(suppressionJustification != null);
CommandLine\Feature.cs (1)
43Debug.Assert(flags.Contains(s), $"Unknown feature flag: {s}");
CommandLine\ReportAnalyzerUtil.cs (1)
68Debug.Assert(analyzerDriver.AnalyzerExecutionTimes != null);
CommandLine\SarifErrorLogger.cs (8)
29Debug.Assert(stream != null); 30Debug.Assert(stream!.Position == 0); 78Debug.Assert(false); 88Debug.Assert(diagnostic.CustomTags.SequenceEqual(diagnostic.Descriptor.ImmutableCustomTags)); 89Debug.Assert(diagnostic.Category == diagnostic.Descriptor.Category); 90Debug.Assert(diagnostic.DefaultSeverity == diagnostic.Descriptor.DefaultSeverity); 91Debug.Assert(diagnostic.IsEnabledByDefault == diagnostic.Descriptor.IsEnabledByDefault); 127Debug.Assert(!string.IsNullOrEmpty(path));
CommandLine\SarifV1ErrorLogger.cs (4)
138Debug.Assert(HasPath(location)); 286Debug.Assert(Count > 0); 292Debug.Assert(list.Capacity > list.Count); 296Debug.Assert(list.Capacity == list.Count);
CommandLine\SarifV2ErrorLogger.cs (7)
172Debug.Assert(HasPath(diagnosticLocation)); 276Debug.Assert(reportAnalyzerExecutionTime || descriptorInfo.ExecutionTime == 0); 277Debug.Assert(reportAnalyzerExecutionTime || descriptorInfo.ExecutionPercentage == 0); 387Debug.Assert(!severities.IsEmpty); 498Debug.Assert(Count > 0); 504Debug.Assert(list.Capacity > list.Count); 508Debug.Assert(list.Capacity == list.Count);
Compilation\ClosedDerivedTypeInfo.cs (1)
30Debug.Assert(!closedDerivedTypes.IsDefault);
Compilation\CommonModuleCompilationState.cs (5)
19Debug.Assert(!_frozen); 44Debug.Assert(!Frozen); 45Debug.Assert(method.PartialImplementationPart is null); 60Debug.Assert(Frozen); 61Debug.Assert(method.PartialImplementationPart is null);
Compilation\Compilation.cs (23)
704Debug.Assert(reference is UnresolvedMetadataReference || reference is CompilationReference); 1097Debug.Assert(tree.Options.Kind != SourceCodeKind.Script); 1236Debug.Assert(result 1267Debug.Assert(result 2536Debug.Assert(!string.IsNullOrEmpty(text.FilePath)); 2654Debug.Assert(IsSubmission); 2685Debug.Assert(this.CommonAnonymousTypeManager.AreTemplatesSealed); 2967Debug.Assert(!embedPdb || pdbStream == null); 2968Debug.Assert(metadataPEStream == null || !options.IncludePrivateMembers); // you may not use a secondary stream and include private members together 3273Debug.Assert(moduleBeingBuilt.DebugInformationFormat != DebugInformationFormat.Embedded || pdbStreamProvider == null); 3307Debug.Assert(!deterministic || moduleBeingBuilt.PdbChecksumAlgorithm.Name != null); 3342Debug.Assert(nativePdbStream != null || metadataDiagnostics.HasAnyErrors()); 3400Debug.Assert(auxStream != null || metadataDiagnostics.HasAnyErrors()); 3442Debug.Assert(!metadataOnly); 3443Debug.Assert(!includePrivateMembers); 3475Debug.Assert(previousGeneration != null); 3476Debug.Assert(previousGeneration.Compilation != this); 3486Debug.Assert(previousGeneration.Compilation != null); 3487Debug.Assert(previousGeneration.PEModuleBuilder != null); 3488Debug.Assert(moduleBeingBuilt.EncSymbolChanges != null); 3718Debug.Assert(this.ContainsSyntaxTree(tree1)); 3719Debug.Assert(this.ContainsSyntaxTree(tree2)); 3954Debug.Assert(!found); // only one required language version in a given diagnostic
Compilation\DeterministicKeyBuilder.cs (3)
136Debug.Assert(!syntaxTrees.IsDefault); 137Debug.Assert(!references.IsDefault); 138Debug.Assert(!publicKey.IsDefault);
Compilation\IImportScope.cs (5)
132Debug.Assert(!aliases.IsDefault); 133Debug.Assert(!externAliases.IsDefault); 134Debug.Assert(!imports.IsDefault); 135Debug.Assert(!xmlNamespaces.IsDefault); 136Debug.Assert(aliases.Length + externAliases.Length + imports.Length + xmlNamespaces.Length > 0);
Compilation\SymbolInfo.cs (2)
70Debug.Assert(symbol is null || symbol.Kind != SymbolKind.Namespace || ((INamespaceSymbol)symbol).NamespaceKind != NamespaceKindNamespaceGroup); 73Debug.Assert(item.Kind != SymbolKind.Namespace || ((INamespaceSymbol)item).NamespaceKind != NamespaceKindNamespaceGroup);
Compilation\TypeInfo.cs (2)
43Debug.Assert(type is null || type.NullableAnnotation == nullability.FlowState.ToAnnotation()); 44Debug.Assert(convertedType is null || convertedType.NullableAnnotation == convertedNullability.FlowState.ToAnnotation());
ConstantValue.cs (2)
358Debug.Assert(discriminator != ConstantValueTypeDiscriminator.Bad); 402Debug.Assert(discriminator != ConstantValueTypeDiscriminator.Bad);
ConstantValueSpecialized.cs (1)
187Debug.Assert(constantValue != null);
CryptographicHashProvider.cs (1)
276Debug.Assert(bits.Length == 4);
CvtRes.cs (13)
549System.Diagnostics.Debug.Assert(resStream.Position - startPos == dataSize + headerSize); 710Debug.Assert((startPos & 3) == 0); 718Debug.Assert((writer.BaseStream.Position & 3) == 0); 723System.Diagnostics.Debug.Assert(cbBlock == writer.BaseStream.Position - startPos); 812System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 819System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 825System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 828System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 835System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 841System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 843System.Diagnostics.Debug.Assert(writer.BaseStream.Position - debugPos == dataSize - GetStringsSize()); 853System.Diagnostics.Debug.Assert(entry.Value != null); 857System.Diagnostics.Debug.Assert(writer.BaseStream.Position - debugPos == GetStringsSize());
Desktop\DesktopAssemblyIdentityComparer.Fx.cs (1)
164Debug.Assert(value.VersionHigh == default(AssemblyVersion));
Diagnostic\DiagnosticBag.cs (2)
210Debug.Assert(diagnostic.Severity != InternalDiagnosticSeverity.Unknown); //Info access should have forced resolution. 257Debug.Assert(diagnostic.Severity != InternalDiagnosticSeverity.Unknown); //Info access should have forced resolution.
Diagnostic\DiagnosticDescriptor.cs (2)
73Debug.Assert(CustomTags is ImmutableArray<string>); 162Debug.Assert(!customTags.IsDefault);
Diagnostic\DiagnosticInfo.cs (5)
146Debug.Assert(expectedLength == actualLength); 147Debug.Assert(bits == BitVector.AllSet(actualLength)); 155Debug.Assert(!isWarningAsError || _defaultSeverity == DiagnosticSeverity.Warning); 170Debug.Assert(this.GetType() == result.GetType()); 171Debug.Assert(severity == result.Severity);
Diagnostic\DiagnosticWithInfo.cs (1)
145Debug.Assert(HasLazyInfo);
Diagnostic\SourceLocation.cs (4)
39Debug.Assert(nodeOrToken.SyntaxTree is object); 45Debug.Assert(trivia.SyntaxTree is object); 87Debug.Assert(!result.IsValid); 101Debug.Assert(!result.IsValid);
Diagnostic\SuppressionInfo.cs (1)
36Debug.Assert(programmaticSuppressions.All(suppression => id == suppression.SuppressedDiagnostic.Id));
Diagnostic\XmlLocation.cs (1)
39Debug.Assert(xmlLineInfo.LinePosition != 0);
DiagnosticAnalyzer\AnalysisContextInfo.cs (2)
64Debug.Assert(node == null || file?.SourceTree != null); 65Debug.Assert(operation == null || file?.SourceTree != null);
DiagnosticAnalyzer\AnalysisResultBuilder.cs (4)
97Debug.Assert(_analyzerExecutionTimeOpt != null); 257Debug.Assert(!analysisScope.FilterSpanOpt.HasValue); 412Debug.Assert(getLocalDiagnostics || getNonLocalDiagnostics); 488Debug.Assert(diagnostics != null);
DiagnosticAnalyzer\AnalysisScope.cs (5)
141Debug.Assert(!isSyntacticSingleFileAnalysis || filterFile.HasValue); 159Debug.Assert(!filterSpan.HasValue || filterFile.HasValue); 163Debug.Assert(filterFile.HasValue); 184Debug.Assert(_lazyAnalyzersSet.Value.Contains(analyzer)); 202Debug.Assert(compilationWithAnalyzers.Analyzers.Contains(analyzer));
DiagnosticAnalyzer\AnalysisValueProvider.cs (1)
55Debug.Assert(value is object);
DiagnosticAnalyzer\AnalyzerAssemblyLoader.cs (1)
193Debug.Assert(GeneratedPathComparer.Equals(_originalPathInfoMap[originalPath].ResolvedPath, resolvedPath));
DiagnosticAnalyzer\AnalyzerDriver.cs (60)
78Debug.Assert(_lazyAnalyzerExecutor != null); 88Debug.Assert(_lazyCurrentCompilationData != null); 106Debug.Assert(_lazyUnsuppressedAnalyzers != null); 123Debug.Assert(_lazyPerSymbolAnalyzerActionsCache != null); 142Debug.Assert(_lazyCompilationEndAnalyzers != null); 164Debug.Assert(_lazyAnalyzerGateMap != null); 178Debug.Assert(!_lazyGeneratedCodeAnalysisFlagsMap.IsDefault); 198Debug.Assert(_lazyNonConfigurableAndCustomConfigurableAnalyzers != null); 212Debug.Assert(_lazySymbolStartAnalyzers != null); 226Debug.Assert(_lazyTreatAllCodeAsNonGeneratedCode.HasValue); 245Debug.Assert(_lazyGeneratedCodeFilesMap != null); 259Debug.Assert(_lazyGeneratedCodeSymbolsForTreeMap != null); 273Debug.Assert(_lazySuppressedAnalyzersForTreeMap != null); 289Debug.Assert(_lazySuppressedDiagnosticIdsForUnsuppressedAnalyzers != null); 303Debug.Assert(_lazyIsGeneratedCodeSymbolMap != null); 348Debug.Assert(_lazyCompilationEventQueue != null); 362Debug.Assert(_lazyDiagnosticQueue != null); 376Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Suppress)); 377Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Default)); 404Debug.Assert(_lazyInitializeTask == null); 473Debug.Assert(_lazyInitializeTask == null); 474Debug.Assert(compilation.SemanticModelProvider != null); 706Debug.Assert(analysisScope != null); 728Debug.Assert(faultedTask.IsFaulted); 993Debug.Assert(severity != ReportDiagnostic.Default); 1017Debug.Assert(compilation.ContainsSyntaxTree(tree)); 1024Debug.Assert(!reportedDiagnostics.IsEmptyWithoutResolution); 1048Debug.Assert(HasDiagnosticSuppressors); 1049Debug.Assert(!reportedDiagnostics.IsEmpty); 1050Debug.Assert(_programmaticSuppressions != null); 1051Debug.Assert(_diagnosticsProcessedForProgrammaticSuppressions != null); 1081Debug.Assert(suppressableDiagnostics.Contains(diagnostic)); 1082Debug.Assert(!diagnostic.IsSuppressed); 1084Debug.Assert(suppressedDiagnostic.IsSuppressed); 1262Debug.Assert(location.SourceTree != null); 1282Debug.Assert(declaredSymbols != null); 1299Debug.Assert(GeneratedCodeSymbolsForTreeMap != null); 1300Debug.Assert(_lazyGeneratedCodeAttribute != null); 1322Debug.Assert(existingGeneratedCodeSymbols.SetEquals(generatedCodeSymbols)); 1443Debug.Assert(_lazyInitializeTask != null); 1455Debug.Assert(_lazyPrimaryTask != null); 1618Debug.Assert(CompilationEventQueue.IsCompleted, "TryDequeueAsync should provide a value unless the AsyncQueue<T> is completed."); 1794Debug.Assert(!subsetProcessedAnalyzers.IsDefault); 1832Debug.Assert(AnalyzerActions.SymbolStartActionsCount > 0); 1883Debug.Assert(completedAnalyzers.Count < analysisScope.Analyzers.Length); 1964Debug.Assert(compilationEvent is CompilationStartedEvent || compilationEvent is CompilationCompletedEvent); 2171Debug.Assert(AnalyzerActions.SymbolStartActionsCount > 0); 2172Debug.Assert(SymbolStartAnalyzers.Contains(analyzer)); 2262Debug.Assert(!IsDiagnosticAnalyzerSuppressed(analyzer, analyzerExecutor.Compilation.Options, analyzerManager, analyzerExecutor, analysisScope, severityFilter, cancellationToken)); 2287Debug.Assert(!IsDiagnosticAnalyzerSuppressed(analyzer, analyzerExecutor.Compilation.Options, analyzerManager, analyzerExecutor, analysisScope, severityFilter, cancellationToken)); 2352Debug.Assert(_lazyDoNotAnalyzeGeneratedCode.HasValue); 2621Debug.Assert(shouldExecuteSyntaxNodeActions || shouldExecuteOperationActions || shouldExecuteCodeBlockActions || shouldExecuteOperationBlockActions); 2622Debug.Assert(!isInGeneratedCode || !DoNotAnalyzeGeneratedCode); 3032Debug.Assert(!operationBlock.Parent.IsImplicit); 3039Debug.Assert(operationBlock.Kind is OperationKind.Invocation or OperationKind.Invalid); 3040Debug.Assert(operationBlock.Parent.IsImplicit); 3041Debug.Assert(operationBlock.Parent.Parent is IConstructorBodyOperation ctorBody && 3043Debug.Assert(!operationBlock.Parent.Parent.IsImplicit); 3050Debug.Fail($"Expected operation with kind '{operationBlock.Kind}' to be the root operation with null 'Parent', but instead it has a non-null Parent with kind '{operationBlock.Parent.Kind}'"); 3061Debug.Assert(operationsToAnalyze.ToImmutableHashSet().Count == operationsToAnalyze.Count);
DiagnosticAnalyzer\AnalyzerDriver.GroupedAnalyzerActions.cs (3)
48Debug.Assert(isEmpty || !GroupedActionsByAnalyzer.IsEmpty); 68Debug.Assert(!analyzers.IsDefaultOrEmpty); 85Debug.Assert(intersected.IsEmpty());
DiagnosticAnalyzer\AnalyzerDriver.GroupedAnalyzerActionsForAnalyzer.cs (2)
30Debug.Assert(!analyzerActions.IsEmpty); 45Debug.Assert(action.Analyzer == analyzer);
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (3)
108Debug.Assert(_addNonCategorizedDiagnostic != null); 113Debug.Assert(_addNonCategorizedDiagnostic == null); 114Debug.Assert(_addCategorizedNonLocalDiagnostic != null);
DiagnosticAnalyzer\AnalyzerExecutor.cs (40)
136Debug.Assert((addNonCategorizedDiagnostic != null) ^ (addCategorizedLocalDiagnostic != null)); 137Debug.Assert((addCategorizedLocalDiagnostic != null) == (addCategorizedNonLocalDiagnostic != null)); 233Debug.Assert(_analyzerExecutionTimeMap != null); 339Debug.Assert(startAction.Analyzer == symbolScope.Analyzer); 362Debug.Assert(_addSuppression != null); 403Debug.Assert(compilationEvent is CompilationStartedEvent || compilationEvent is CompilationCompletedEvent); 450Debug.Assert(getTopMostNodeForAnalysis != null); 451Debug.Assert(!filterSpan.HasValue || filterTree != null); 573Debug.Assert(getTopMostNodeForAnalysis != null); 574Debug.Assert(!isGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(analyzer)); 575Debug.Assert(!IsAnalyzerSuppressedForSymbol(analyzer, symbolDeclaredEvent.Symbol, cancellationToken)); 576Debug.Assert(!filterSpan.HasValue || filterTree != null); 687Debug.Assert(file.SourceTree != null); 743Debug.Assert(file.AdditionalFile != null); 787Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(syntaxNodeAction.Analyzer)); 788Debug.Assert(!IsAnalyzerSuppressedForTree(syntaxNodeAction.Analyzer, node.SyntaxTree, cancellationToken)); 811Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(operationAction.Analyzer)); 812Debug.Assert(!IsAnalyzerSuppressedForTree(operationAction.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken)); 861Debug.Assert(!executableCodeBlocks.IsEmpty); 975Debug.Assert(!operationBlocks.IsEmpty); 1056Debug.Assert(declaredNode != null); 1057Debug.Assert(executionData.DeclaredSymbol != null); 1058Debug.Assert(CanHaveExecutableCodeBlock(executionData.DeclaredSymbol)); 1059Debug.Assert(startActions.Any() || endActions.Any() || actions.Any()); 1181Debug.Assert(nodeActionsByKind.Any()); 1182Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(executionData.Analyzer)); 1183Debug.Assert(!IsAnalyzerSuppressedForTree(executionData.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken)); 1284Debug.Assert(operationActionsByKind != null); 1285Debug.Assert(operationActionsByKind.Any()); 1286Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(executionData.Analyzer)); 1287Debug.Assert(!IsAnalyzerSuppressedForTree(executionData.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken)); 1327Debug.Assert(((IFieldSymbol)symbol).AssociatedSymbol == null); 1386Debug.Assert(false); 1538Debug.Assert(IsAnalyzerExceptionDiagnostic(exceptionDiagnostic)); 1576Debug.Assert(_addNonCategorizedDiagnostic != null); 1581Debug.Assert(_addNonCategorizedDiagnostic == null); 1582Debug.Assert(_addCategorizedNonLocalDiagnostic != null); 1618Debug.Assert(_addNonCategorizedDiagnostic != null); 1690Debug.Assert(_analyzerExecutionTimeMap != null); 1701Debug.Assert(operation.Parent == null);
DiagnosticAnalyzer\AnalyzerFileReference.cs (1)
610Debug.Assert(type != null);
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (6)
120Debug.Assert(sessionScope.Analyzer == _analyzer); 416Debug.Assert(pendingMemberSymbols != null); 434Debug.Assert(!symbolEndActions.IsEmpty); 439Debug.Assert(_lazyPendingMemberSymbolsMap != null); 482Debug.Assert(_lazyPendingMemberSymbolsMap == null || _lazyPendingMemberSymbolsMap.Count == 0); 483Debug.Assert(_lazyPendingSymbolEndActionsMap == null || _lazyPendingSymbolEndActionsMap.Count == 0);
DiagnosticAnalyzer\AsyncQueue.cs (6)
98Debug.Assert(_data.Count == 0); 102Debug.Assert(waiter.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously)); 197Debug.Assert(this.Count == 0, "we should not be cancelling the waiters when we have items in the queue"); 200Debug.Assert(tcs.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously)); 205Debug.Assert(_whenCompleted.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously)); 316Debug.Assert(taskCompletionSource.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously));
DiagnosticAnalyzer\CompilationUnitCompletedEvent.cs (1)
16Debug.Assert(compilation.ContainsSyntaxTree(compilationUnit));
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (12)
704Debug.Assert(analysisScope != null); 727Debug.Assert(driver.IsInitialized); 728Debug.Assert(!driver.WhenInitializedTask.IsCanceled); 775Debug.Assert(!analysisScope.IsSyntacticSingleFileAnalysis); 776Debug.Assert(hasAnyActionsRequiringCompilationEvents); 779Debug.Assert(!symbolStartAnalyzers.IsEmpty); 838Debug.Assert(driver.IsInitialized); 960Debug.Assert(compilationEvents.Count(e => e is CompilationUnitCompletedEvent c && !c.FilterSpan.HasValue) == 1); 963Debug.Assert(!compilationEvents.HasDuplicates()); 996Debug.Assert(analysisScope.IsSingleFileAnalysis); 1047Debug.Assert(analysisScope.IsSingleFileAnalysis); 1048Debug.Assert(!analysisScope.IsSyntacticSingleFileAnalysis);
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (2)
838Debug.Assert(!filterSpan.HasValue || filterTree != null); 918Debug.Assert(!filterSpan.HasValue || filterTree != null);
DiagnosticAnalyzer\DiagnosticAnalysisContextHelpers.cs (1)
95Debug.Assert(location.SourceTree != null);
DiagnosticAnalyzer\DiagnosticQueue.cs (2)
111Debug.Assert(diagnostic.Location.Kind == LocationKind.SourceFile || diagnostic.Location.Kind == LocationKind.ExternalFile); 176Debug.Assert(diag != null);
DiagnosticAnalyzer\ProgramFilesAnalyzerPathResolver.cs (2)
43Debug.Assert(IsAnalyzerPathHandled(originalAnalyzerPath)); 49Debug.Assert(IsAnalyzerPathHandled(originalAnalyzerPath));
DiagnosticAnalyzer\ShadowCopyAnalyzerPathResolver.cs (1)
253Debug.Assert(AnalyzerAssemblyLoader.GeneratedPathComparer.Equals(shadowCopyPath, task.Result));
DiagnosticAnalyzer\Suppression.cs (1)
21Debug.Assert(suppressedDiagnostic.ProgrammaticSuppressionInfo == null);
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (6)
58Debug.Assert(_lazyResolvedSuppressionsById.IsEmpty); 75Debug.Assert(symbol != null); 80Debug.Assert(symbol.IsDefinition); 116Debug.Assert(target.IsDefinition); 194Debug.Assert(declaredSymbols != null); 342Debug.Assert(symbol is IAssemblySymbol || symbol is IModuleSymbol);
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (7)
308Debug.Assert(PeekNextChar() is '(' or '['); 495Debug.Assert(PeekNextChar() == '!'); 542Debug.Assert(bindingContext != null); 657Debug.Assert(PeekNextChar() == '<'); 698Debug.Assert(PeekNextChar() == '['); 884Debug.Assert(type != null); 890Debug.Assert(startIndex >= 0);
DiaSymReader\Metadata\SymWriterMetadataAdapter.cs (7)
23Debug.Assert(metadataProvider != null); 43Debug.Assert(baseType == null); 96Debug.Assert(attributes == null); 97Debug.Assert(signature == null); 98Debug.Assert(signatureLength == null); 99Debug.Assert(relativeVirtualAddress == null); 100Debug.Assert(implAttributes == null);
DiaSymReader\SymUnmanagedFactory.cs (1)
158System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
DiaSymReader\Utilities\InteropUtilities.cs (2)
36Debug.Assert(nameStr != null); 85Debug.Assert(dst <= dstEndPtr);
DiaSymReader\Writer\SymUnmanagedWriterFactory.cs (1)
50Debug.Assert(loadException != null);
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (5)
34Debug.Assert(pdbStream != null); 35Debug.Assert(symWriter != null); 36Debug.Assert(symWriterModuleName != null); 366Debug.Assert(OperatingSystem.IsWindows()); 377Debug.Assert(value != null);
DocumentationCommentId.cs (4)
686Debug.Assert(symbol.ContainingSymbol is null or INamedTypeSymbol or IMethodSymbol); 689Debug.Assert(!declarer.Failed); 1005System.Diagnostics.Debug.Assert(PeekNextChar(id, index) == '`'); 1520System.Diagnostics.Debug.Assert(typeParameterContext != null);
DocumentationComments\XmlDocumentationCommentTextReader.XmlStream.cs (2)
135Debug.Assert(charCount > 0); 140Debug.Assert(destCount >= 0);
EmbeddedText.cs (4)
54Debug.Assert(filePath.Length > 0); 55Debug.Assert(SourceHashAlgorithms.IsSupportedAlgorithm(checksumAlgorithm)); 56Debug.Assert(!blob.IsDefault && blob.Length >= sizeof(int)); 218Debug.Assert(longLength >= 0);
Emit\AnonymousTypeKey.cs (1)
35Debug.Assert(name != null);
Emit\AnonymousTypeValue.cs (2)
18Debug.Assert(!string.IsNullOrEmpty(name)); 19Debug.Assert(uniqueIndex >= 0);
Emit\AsyncMoveNextBodyDebugInfo.cs (3)
40Debug.Assert(!yieldOffsets.IsDefault); 41Debug.Assert(!resumeOffsets.IsDefault); 42Debug.Assert(yieldOffsets.Length == resumeOffsets.Length);
Emit\CommonPEModuleBuilder.cs (32)
64Debug.Assert(manifestResources != null); 65Debug.Assert(serializationProperties != null); 66Debug.Assert(compilation != null); 132Debug.Assert(_encDeletedMemberDefinitions == null); 143Debug.Assert(_encDeletedMemberDefinitions != null); 393Debug.Assert(ReferenceEquals(context.Module, this)); 415Debug.Assert(methodSymbol.ContainingModule == CommonSourceModule); 416Debug.Assert(methodSymbol.IsDefinition); 417Debug.Assert(((IMethodSymbol)methodSymbol.GetISymbol()).PartialDefinitionPart == null); // Must be definition. 432Debug.Assert(methodSymbol.ContainingModule == CommonSourceModule); 433Debug.Assert(methodSymbol.IsDefinition); 434Debug.Assert(((IMethodSymbol)methodSymbol.GetISymbol()).PartialDefinitionPart == null); // Must be definition. 435Debug.Assert(body == null || (object)methodSymbol == body.MethodDefinition.GetInternalSymbol()); 442Debug.Assert(method == null || IsSourceDefinition(method)); 443Debug.Assert(OutputKind.IsApplication()); 450Debug.Assert(method == null || IsSourceDefinition(method)); 623Debug.Assert(value != null); 630Debug.Assert(TestData == null); 693Debug.Assert(sourceModule != null); 694Debug.Assert(serializationProperties != null); 757Debug.Assert(names != null); 787Debug.Assert(_namesOfTopLevelTypes == null); 864Debug.Assert(((ISynthesizedGlobalMethodSymbol)cctor.GetInternalSymbol()).ContainingPrivateImplementationDetailsType == (object)details); 892Debug.Assert(NestedTypes is null || 984Debug.Assert(container.IsDefinition); 990Debug.Assert(method != null); 1003Debug.Assert(property != null); 1016Debug.Assert(field != null); 1029Debug.Assert(nestedType != null); 1037Debug.Assert(typeOrNamespace != null); 1177Debug.Assert(_lazyPrivateImplementationDetails?.IsFrozen != false); 1187Debug.Assert((object)this == context.Module);
Emit\Context.cs (5)
39Debug.Assert(rebuildData is null || !metadataOnly); 41Debug.Assert(module != null); 42Debug.Assert(diagnostics != null); 43Debug.Assert(includePrivateMembers || metadataOnly); 44Debug.Assert(syntaxNode is null || syntaxReference is null);
Emit\EditAndContinue\AddedOrChangedMethodInfo.cs (5)
41Debug.Assert(methodId.Generation >= 0); 44Debug.Assert(stateMachineAwaiterSlotsOpt.IsDefault == stateMachineTypeName is null); 47Debug.Assert(stateMachineHoistedLocalSlotsOpt.IsDefault || stateMachineTypeName is not null); 74Debug.Assert(!info.IsDefault); 77Debug.Assert(info.Signature != null);
Emit\EditAndContinue\DefinitionMap.cs (16)
54Debug.Assert(edits != null); 89Debug.Assert(edit.NewSymbol != null); 90Debug.Assert(edit.OldSymbol != null); 95Debug.Assert(oldMethod != null); 96Debug.Assert(newMethod != null); 187Debug.Assert(peMethod != null); 188Debug.Assert(peMethod.MetadataName == oldProperty.MetadataName); 213Debug.Assert(peProperty != null); 214Debug.Assert(peProperty.MetadataName == oldProperty.MetadataName); 239Debug.Assert(peEvent != null); 240Debug.Assert(peEvent.MetadataName == oldEvent.MetadataName); 648Debug.Assert(!containingDisplayClassId.HasValue); 662Debug.Assert(hasDebugIds); 672Debug.Assert(containingDisplayClassId.HasValue); 682Debug.Assert(hasDebugIds); 746Debug.Assert(peMethod != null);
Emit\EditAndContinue\DeletedPEMethodDefinition.cs (1)
24Debug.Assert(oldMethod.MetadataToken != 0);
Emit\EditAndContinue\DeltaMetadataWriter.cs (33)
87Debug.Assert(previousGeneration != null); 88Debug.Assert(encId != default); 89Debug.Assert(encId != previousGeneration.EncId); 90Debug.Assert(context.Module.DebugInformationFormat != DebugInformationFormat.Embedded); 91Debug.Assert(context.Module.EncSymbolChanges != null); 145Debug.Assert(changes != null); 212Debug.Assert(module.EncSymbolChanges is not null); 795Debug.Assert(!methodDef.IsEncDeleted); 856Debug.Assert(ok); 878Debug.Assert(def is INestedTypeDefinition or IPropertyDefinition or IEventDefinition); 1041Debug.Assert(xOrdinal == int.MaxValue && yOrdinal == int.MaxValue); 1054Debug.Assert(xOrdinal == int.MaxValue && yOrdinal == int.MaxValue); 1069Debug.Assert(CustomAttributeRowIds.IsSorted()); 1081Debug.Assert(CustomAttributeRowIds.IsSorted()); 1135Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncLog] == 0); 1136Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncMap] == 0); 1371Debug.Assert(tokens.IsSorted(HandleComparer.Default)); 1390Debug.Assert(debugTokens.Distinct().Count() == debugTokens.Count); 1446Debug.Assert(rowCounts[i] == 0); 1576Debug.Assert(prev < next); 1626Debug.Assert(!_map.TryGetValue(index, out var other) || ((object)other == (object)item) || other is DeletedSourceTypeDefinition || item is DeletedSourceTypeDefinition); 1641Debug.Assert(!this.IsFrozen); 1655Debug.Assert(!this.IsFrozen); 1707Debug.Assert(index > 0); 1800Debug.Assert(!this.IsFrozen); 1838Debug.Assert(!this.IsFrozen); 1874Debug.Assert(!this.IsFrozen); 1906Debug.Assert(this.ShouldVisit(eventDefinition)); 1912Debug.Assert(this.ShouldVisit(fieldDefinition)); 1926Debug.Assert(this.ShouldVisit(method)); 1945Debug.Assert(this.ShouldVisit(namespaceTypeDefinition)); 1951Debug.Assert(this.ShouldVisit(nestedTypeDefinition)); 1957Debug.Assert(this.ShouldVisit(propertyDefinition));
Emit\EditAndContinue\EmitBaseline.cs (30)
33Debug.Assert(implementingMethod > 0); 34Debug.Assert(index > 0); 323Debug.Assert(module != null); 324Debug.Assert(ordinal is 0 == (encId == default)); 325Debug.Assert(ordinal is 0 == initialBaseline is null); 326Debug.Assert(synthesizedTypes.IsEmpty || ordinal > 0); 327Debug.Assert(encId != module.GetModuleVersionId()); 328Debug.Assert(debugInformationProvider != null); 329Debug.Assert(localSignatureProvider != null); 330Debug.Assert(typeToEventMap != null); 331Debug.Assert(typeToPropertyMap != null); 332Debug.Assert(moduleVersionId != default); 333Debug.Assert(moduleVersionId == module.GetModuleVersionId()); 334Debug.Assert(synthesizedMembers != null); 335Debug.Assert(deletedMembers != null); 337Debug.Assert(tableEntriesAdded.Length == MetadataTokens.TableCount); 343Debug.Assert(tableEntriesAdded[(int)TableIndex.TypeDef] >= typesAdded.Count); 344Debug.Assert(tableEntriesAdded[(int)TableIndex.Event] >= eventsAdded.Count); 345Debug.Assert(tableEntriesAdded[(int)TableIndex.Field] >= fieldsAdded.Count); 346Debug.Assert(tableEntriesAdded[(int)TableIndex.MethodDef] >= methodsAdded.Count); 347Debug.Assert(tableEntriesAdded[(int)TableIndex.Property] >= propertiesAdded.Count); 348Debug.Assert(tableEntriesAdded[(int)TableIndex.EventMap] >= eventMapAdded.Count); 349Debug.Assert(tableEntriesAdded[(int)TableIndex.PropertyMap] >= propertyMapAdded.Count); 419Debug.Assert(synthesizedTypes.AnonymousTypes.Count >= _synthesizedTypes.AnonymousTypes.Count); 420Debug.Assert(synthesizedTypes.AnonymousDelegates.Count >= _synthesizedTypes.AnonymousDelegates.Count); 421Debug.Assert(synthesizedTypes.AnonymousDelegatesWithIndexedNames.Count >= _synthesizedTypes.AnonymousDelegatesWithIndexedNames.Count); 422Debug.Assert(customAttributesAdded.All(entry => !entry.Value.IsDefaultOrEmpty && entry.Value.IsSorted())); 469Debug.Assert(LazyMetadataSymbols is object); 508Debug.Assert(!parentType.IsNil); 523Debug.Assert(!parentType.IsNil);
Emit\EditAndContinue\EncHoistedLocalMetadata.cs (3)
17Debug.Assert(name != null); 18Debug.Assert(type != null); 19Debug.Assert(synthesizedKind.IsLongLived());
Emit\EditAndContinue\EncLocalInfo.cs (2)
23Debug.Assert(signature.Length > 0); 57Debug.Assert(Type != null);
Emit\EditAndContinue\EncVariableSlotAllocator.cs (3)
64Debug.Assert(!previousLocals.IsDefault); 87Debug.Assert(!localInfo.IsDefault); 333Debug.Assert(closureOrdinal >= LambdaDebugInfo.MinClosureOrdinal);
Emit\EditAndContinue\SymbolChanges.cs (8)
325Debug.Assert(symbol != null); 327Debug.Assert(result != null); 382Debug.Assert(edit.OldSymbol is IMethodSymbol or IPropertySymbol or IEventSymbol); 397Debug.Assert(!deletedMembersPerType.Contains(oldSymbol)); 423Debug.Assert(newMethod.PartialImplementationPart == null); 424Debug.Assert(edit.OldSymbol == null || ((IMethodSymbol)edit.OldSymbol).PartialImplementationPart == null); 446Debug.Assert(newProperty.PartialImplementationPart == null); 447Debug.Assert(edit.OldSymbol == null || ((IPropertySymbol)edit.OldSymbol).PartialImplementationPart == null);
Emit\EditAndContinue\SymbolMatcher.cs (2)
166Debug.Assert(template is not null); 259Debug.Assert(isDeletedMemberMapping || newSynthesizedMembers.Contains(mappedMember));
Emit\EditAndContinueMethodDebugInformation.cs (6)
34Debug.Assert(methodOrdinal >= -1); 165Debug.Assert(kind <= SynthesizedLocalKind.MaxValidValueForLocalVariableSerializedToDebugInformation); 174Debug.Assert((b & (1 << 7)) == 0); 263Debug.Assert(MethodOrdinal >= -1); 296Debug.Assert(info.ClosureOrdinal >= LambdaDebugInfo.MinClosureOrdinal); 297Debug.Assert(info.LambdaId.Generation == 0);
Emit\NoPia\CommonEmbeddedEvent.cs (3)
48Debug.Assert(adder != null || remover != null); 86Debug.Assert(!isUsedForComAwareEventBinding || _isUsedForComAwareEventBinding != 0); 91Debug.Assert(!isUsedForComAwareEventBinding || _isUsedForComAwareEventBinding != 0);
Emit\NoPia\CommonEmbeddedProperty.cs (1)
47Debug.Assert(getter != null || setter != null);
Emit\NoPia\CommonEmbeddedType.cs (5)
232Debug.Assert(_lazyAssemblyRefIndex >= 0); 255Debug.Assert(TypeManager.IsFrozen); 284Debug.Assert(TypeManager.IsFrozen); 453Debug.Assert(TypeManager.IsFrozen); 503Debug.Assert(TypeManager.IsFrozen);
Emit\NoPia\EmbeddedTypesManager.cs (1)
114Debug.Assert(_frozen[i - 1] == prev);
Emit\StateMachineMoveNextDebugInfo.cs (1)
23Debug.Assert(kickoffMethod != null);
EnumConstantHelper.cs (4)
22Debug.Assert(!constantValue.IsBad); 23Debug.Assert(offset > 0); 119Debug.Assert(maxOffset >= previous); 125Debug.Assert(maxOffset >= previous);
ExtendedSpecialType.cs (2)
21Debug.Assert(value >= sbyte.MinValue && value <= sbyte.MaxValue); 72Debug.Assert(InternalSpecialType.First == InternalSpecialType.System_ReadOnlySpan_T);
FileKey.cs (2)
30Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 31Debug.Assert(timestamp.Kind == DateTimeKind.Utc);
FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
FileSystem\PathUtilities.cs (3)
410Debug.Assert(!IsUnixLikePlatform); 428Debug.Assert(IsAbsolute(root)); 884Debug.Assert(parts[toSkip - 1] == string.Empty);
FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
InternalUtilities\BlobBuildingStream.cs (1)
100Debug.Assert(disposing);
InternalUtilities\ConcurrentLruCache.cs (1)
102Debug.Assert(_capacity > 0);
InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 87Debug.Assert(tail != null); 98Debug.Assert(this != Empty); 108Debug.Assert(this != Empty);
InternalUtilities\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
InternalUtilities\FileLockCheck.cs (1)
199Debug.Assert(rgAffectedApps != null);
InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
InternalUtilities\JsonWriter.cs (2)
219Debug.Assert(_pending == Pending.NewLineAndIndent || _pending == Pending.CommaNewLineAndIndent); 302Debug.Assert(ShouldAppendAsUnicode(c));
InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
InternalUtilities\ReflectionUtilities.cs (2)
151Debug.Assert(e.InnerException is object); 153Debug.Assert(false, "Unreachable");
InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
InternalUtilities\ThreeState.cs (1)
33Debug.Assert(value != ThreeState.Unknown);
InternalUtilities\WeakList.cs (6)
27Debug.Assert(_size == _items.Length); 28Debug.Assert(_items.Length == 0 || _items.Length >= MinimalNonEmptySize); 64Debug.Assert(_size == _items.Length); 76Debug.Assert(_items.Length > 0 && _size < 3 * _items.Length / 4, "length: " + _items.Length + " size: " + _size); 100Debug.Assert(_items[firstDead].IsNull()); 157Debug.Assert(_size < _items.Length);
InternalUtilities\XmlUtilities.cs (3)
34Debug.Assert(copy != node); 35Debug.Assert(copy.Parent == null); // Otherwise, when we give it one, it will be copied. 52Debug.Assert(sourceAttributes.Current.Name == targetAttributes.Current.Name);
MemberDescriptor.cs (2)
56Debug.Assert(_declaringTypeId < (int)InternalSpecialType.NextAvailable); 65Debug.Assert(_declaringTypeId >= (int)WellKnownType.First);
MetadataReader\MetadataDecoder.cs (21)
87Debug.Assert(type != null); 129Debug.Assert(module != null); 142Debug.Assert(!token.IsNil); 168Debug.Assert(type != null); 400Debug.Assert(!refersToNoPiaLocalType || generic.TypeKind == TypeKind.Error); 514Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name)); 528Debug.Assert(result != null); 534Debug.Assert(result1.Equals(result, TypeCompareKind.ConsiderEverything)); 560Debug.Assert(fullName.NamespaceName.Length == 0); 637Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name)); 702Debug.Assert((object)result != null); 719Debug.Assert(!isNoPiaLocalType); 862Debug.Assert(typeParameterCount == 0); 884Debug.Assert(signatureReader.Offset <= start); 1486Debug.Assert(type != null); 1993Debug.Assert(!typeDef.IsNil); 2012Debug.Assert(typeSymbol != null); 2149Debug.Assert(type.TypeKind == TypeKind.Array); 2258Debug.Assert( 2284Debug.Assert(type == HandleKind.MethodDefinition || type == HandleKind.MemberReference); 2294Debug.Assert(type == HandleKind.FieldDefinition ||
MetadataReader\MetadataHelpers.cs (31)
153Debug.Assert(!isTypeArgumentWithAssemblyName || isTypeArgument); 177Debug.Assert(decodedString != null); 305Debug.Assert(topLevelType == null); 325Debug.Assert(i == _input.Length || s_typeNameDelimiters.Contains(_input[i])); 434Debug.Assert(Current == '['); 494Debug.Assert(arity > 0); 511Debug.Assert(emittedTypeName != null, "NULL actual name unexpected!!!"); 557Debug.Assert(intArity > 0); 573Debug.Assert(!resultMemory.Equals(emittedTypeNameMemory) || ReferenceEquals(resultString, emittedTypeName), "If the name was not mangled, we should get the original string instance back."); 584Debug.Assert(suffixStartsAt == -1); 588Debug.Assert(suffixStartsAt > 0 && suffixStartsAt < emittedTypeName.Length - 1); 594Debug.Assert(arity > 0); 599Debug.Assert(suffixStartsAt > 0 && suffixStartsAt < emittedTypeName.Length - 1); 621Debug.Assert(!nameMemory.Equals(default(ReadOnlyMemory<char>))); 686Debug.Assert(pstrName != null); 714Debug.Assert(angleBracketDepth == 0); 738Debug.Assert(name != null); 792Debug.Assert(typesByNS != null); 793Debug.Assert(namespaceNameLength >= 0); 794Debug.Assert(!isGlobalNamespace || namespaceNameLength == 0); 855Debug.Assert((object?)typesInLastChildNamespace != null); 866Debug.Assert(lastChildNamespaceName != null); 873Debug.Assert(lastChildNamespaceName != null); 874Debug.Assert(typesInLastChildNamespace.Count != 0); 891Debug.Assert(lastChildNamespaceName != null); 892Debug.Assert(typesInLastChildNamespace.Count != 0); 924Debug.Assert(keyIndex < i); 932Debug.Assert(removed > 0); 938Debug.Assert(types != null); 939Debug.Assert(namespaces != null); 1106Debug.Assert(value <= 0x1fffffff);
MetadataReader\MetadataTypeName.cs (19)
94Debug.Assert(fullName != null); 95Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue); 96Debug.Assert(forcedArity == -1 || 124Debug.Assert(namespaceName != null); 125Debug.Assert(typeName != null); 126Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue); 127Debug.Assert(!typeName.Contains(MetadataHelpers.DotDelimiterString)); 128Debug.Assert(forcedArity == -1 || 153Debug.Assert(typeName != null); 154Debug.Assert(!typeName.Contains(MetadataHelpers.DotDelimiterString) || typeName.IndexOf(MetadataHelpers.MangledNameRegionStartChar) >= 0); 155Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue); 156Debug.Assert(forcedArity == -1 || 188Debug.Assert(_namespaceName != null); 189Debug.Assert(_typeName != null); 204Debug.Assert(_fullName != null); 224Debug.Assert(_fullName != null); 244Debug.Assert(_inferredArity == -1); 279Debug.Assert(_unmangledTypeNameMemory.Equals(default(ReadOnlyMemory<char>))); 280Debug.Assert(_unmangledTypeName == null);
MetadataReader\MetadataTypeName.Key.cs (2)
46Debug.Assert(mdTypeName._namespaceName != null); 47Debug.Assert(mdTypeName._typeName != null);
MetadataReader\PEAssembly.cs (2)
62Debug.Assert(!modules.IsDefault); 63Debug.Assert(modules.Length > 0);
MetadataReader\PEModule.cs (50)
150Debug.Assert((peReader == null) ^ (metadataOpt == IntPtr.Zero && metadataSizeOpt == 0)); 151Debug.Assert(metadataOpt == IntPtr.Zero || metadataSizeOpt > 0); 174Debug.Assert(peReader != null); 248Debug.Assert(_peReaderOpt != null); 345Debug.Assert(_hashesOpt != null); 531Debug.Assert(name.Length == 0 || MetadataHelpers.IsValidMetadataIdentifier(name)); // Obfuscated assemblies can have types with empty names. 739Debug.Assert(left.IsEmpty() && right.IsEmpty()); 744Debug.Assert(result != 0); 1124Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 1144Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 1176Debug.Assert(info.SignatureIndex == 0); 1192Debug.Assert(info.SignatureIndex == 0); 1209Debug.Assert(info.SignatureIndex == 0); 1224Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 1323Debug.Assert(attributeInfo.HasValue); 1497Debug.Assert(AttributeDescription.InterpolatedStringHandlerArgumentAttribute.Signatures.Length == 2); 1498Debug.Assert(targetAttribute.SignatureIndex is 0 or 1); 1508Debug.Assert(!paramNames.IsDefault); 1518Debug.Assert(description.Namespace == "System.Diagnostics.CodeAnalysis"); 1519Debug.Assert(description.Name == "MaybeNullWhenAttribute" || description.Name == "NotNullWhenAttribute" || description.Name == "DoesNotReturnIfAttribute"); 1559Debug.Assert(info.SignatureIndex == 0); 1667Debug.Assert(info.SignatureIndex == 0); 1800Debug.Assert(attributeInfo.HasValue); 1840Debug.Assert(!handle.IsNil); 1867Debug.Assert(attributeInfo.HasValue); 1886Debug.Assert(attributeInfo.HasValue); 1900Debug.Assert(attributeInfo.HasValue); 1951Debug.Assert(info.HasValue); 2047Debug.Assert(!handle.IsNil); 2517Debug.Assert(signatureIndex >= 0 && signatureIndex <= byte.MaxValue); 2638Debug.Assert(rid > 0); 2704Debug.Assert(rid > 0); 2785Debug.Assert(namespaceName != null); 2786Debug.Assert(typeName != null); 2820Debug.Assert(assemblyName != null); 2859Debug.Assert(!resolutionScope.IsNil); 2860Debug.Assert(namespaceName != null); 2861Debug.Assert(typeName != null); 2906Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name)); 2965Debug.Assert(targetSignature.Length >= 3); 3118Debug.Assert(!ctorType.IsNil); 3204Debug.Assert(_lazyContainsNoPiaLocalTypes != ThreeState.True); 3242Debug.Assert(!info.HasValue || info.SignatureIndex == 0); 3256Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 3277Debug.Assert(!info.HasValue || info.SignatureIndex == 0); 3410Debug.Assert(rva >= 0); 3614Debug.Assert(!param.IsNil); 3631Debug.Assert(!fieldDef.IsNil); 3909Debug.Assert(indices.FirstIndex >= 0, "Not allowed to store a negative (non-existent) index in typesToAssemblyIndexMap"); 3998Debug.Assert(_peReaderOpt != null);
MetadataReader\TypeNameDecoder.cs (3)
157Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(fullName.TopLevelType)); 173Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(fullName.NestedTypes[i])); 211Debug.Assert(rank >= 0);
MetadataReference\AssemblyIdentity.cs (11)
59Debug.Assert((object)other != null); 60Debug.Assert((object)version != null); 164Debug.Assert(name != null); 165Debug.Assert(IsValid(version)); 166Debug.Assert(IsValidCultureName(cultureName)); 167Debug.Assert((hasPublicKey && MetadataHelpers.IsValidPublicKey(publicKeyOrToken)) || (!hasPublicKey && (publicKeyOrToken.IsDefaultOrEmpty || publicKeyOrToken.Length == PublicKeyTokenSize))); 188Debug.Assert(name != null); 189Debug.Assert((hasPublicKey && MetadataHelpers.IsValidPublicKey(publicKeyOrToken)) || (!hasPublicKey && (publicKeyOrToken.IsDefaultOrEmpty || publicKeyOrToken.Length == PublicKeyTokenSize))); 190Debug.Assert(noThrow); 343Debug.Assert(HasPublicKey || !_lazyPublicKeyToken.IsDefault); 437Debug.Assert(hash.Length == CryptographicHashProvider.Sha1HashSize);
MetadataReference\AssemblyIdentity.DisplayName.cs (4)
450Debug.Assert(displayName.IndexOf('\0') == -1); 552Debug.Assert(i == displayName.Length || IsNameTokenTerminator(displayName[i])); 602Debug.Assert(str.Length > 0); 603Debug.Assert(str.IndexOf('\0') < 0);
MetadataReference\AssemblyIdentityComparer.cs (2)
89Debug.Assert((reference is not null) ^ (referenceDisplayName != null)); 113Debug.Assert(reference.ContentType == definition.ContentType);
MetadataReference\AssemblyMetadata.cs (6)
37Debug.Assert(!modules.IsDefaultOrEmpty && assembly != null); 94Debug.Assert(!modules.IsDefaultOrEmpty); 101Debug.Assert(manifestModule != null); 102Debug.Assert(moduleFactory != null); 327Debug.Assert(_initialModules.Length == 1); 395Debug.Assert(_initialModules.Length == 1 || _initialModules.Length == previousData.Modules.Length);
MetadataReference\CompilationReference.cs (1)
24Debug.Assert(properties.Kind != MetadataImageKind.Module);
MetadataReference\ModuleMetadata.cs (2)
115Debug.Assert(metadata != IntPtr.Zero); 116Debug.Assert(size > 0);
MetadataReference\ReferenceDirective.cs (2)
20Debug.Assert(file != null); 21Debug.Assert(location != null);
MethodImplExtensions.cs (2)
20Debug.Assert(MethodImplAttributes.Async == (MethodImplAttributes)0x2000); 37Debug.Assert(MethodImplOptions.Async == (MethodImplOptions)0x2000);
NativePdbWriter\PdbWriter.cs (24)
67Debug.Assert(_metadataWriter != null); 93Debug.Assert(emitAllDebugInfo || !emitExternNamespaces); 174Debug.Assert(import.AliasOpt != null); 175Debug.Assert(import.TargetAssemblyOpt == null); 249Debug.Assert(import.TargetAssemblyOpt == null); 250Debug.Assert(declaredExternAliasesOpt == null); 254Debug.Assert(import.TargetNamespaceOpt == null); 255Debug.Assert(import.TargetAssemblyOpt == null); 289Debug.Assert(import.AliasOpt != null); 290Debug.Assert(import.TargetXmlNamespaceOpt != null); 295Debug.Assert(import.TargetXmlNamespaceOpt == null); 299Debug.Assert(import.TargetNamespaceOpt == null); 300Debug.Assert(import.TargetAssemblyOpt == null); 327Debug.Assert(import.AliasOpt != null); 328Debug.Assert(import.TargetAssemblyOpt == null); 366Debug.Assert(!(typeReference is IArrayTypeReference)); 367Debug.Assert(!(typeReference is IPointerTypeReference)); 368Debug.Assert(!typeReference.IsTypeSpecification()); 391Debug.Assert(namespaceType != null); 519Debug.Assert(scopeLocal.SlotIndex >= 0); 574Debug.Assert(age == Age); 671Debug.Assert(sequencePoint.Document != null); 708Debug.Assert(!handle.IsNil); 730Debug.Assert(token != 0);
Operations\BasicBlock.cs (9)
79Debug.Assert(_successorsAreSealed); 96Debug.Assert(_successorsAreSealed); 112Debug.Assert(_predecessorsAreSealed); 137Debug.Assert(!_successorsAreSealed); 138Debug.Assert(_lazySuccessor == null); 139Debug.Assert(_lazyConditionalSuccessor == null); 153Debug.Assert(!_predecessorsAreSealed); 154Debug.Assert(_lazyPredecessors.IsDefault); 155Debug.Assert(!predecessors.IsDefault);
Operations\CaptureId.cs (1)
17Debug.Assert(value >= 0);
Operations\ControlFlowBranch.cs (3)
88Debug.Assert(source.Kind != ControlFlowRegionKind.Root); 89Debug.Assert(source.EnclosingRegion != null); 150Debug.Assert(builder.Last().Kind == ControlFlowRegionKind.Finally);
Operations\ControlFlowGraph.cs (23)
40Debug.Assert(parent != null == (originalOperation.Kind == OperationKind.LocalFunction || originalOperation.Kind == OperationKind.AnonymousFunction)); 41Debug.Assert(captureIdDispenser != null); 42Debug.Assert(!blocks.IsDefault); 43Debug.Assert(blocks.First().Kind == BasicBlockKind.Entry); 44Debug.Assert(blocks.Last().Kind == BasicBlockKind.Exit); 45Debug.Assert(root != null); 46Debug.Assert(root.Kind == ControlFlowRegionKind.Root); 47Debug.Assert(root.FirstBlockOrdinal == 0); 48Debug.Assert(root.LastBlockOrdinal == blocks.Length - 1); 49Debug.Assert(!localFunctions.IsDefault); 50Debug.Assert(localFunctionsMap != null); 51Debug.Assert(localFunctionsMap.Count == localFunctions.Length); 52Debug.Assert(localFunctions.Distinct().Length == localFunctions.Length); 53Debug.Assert(anonymousFunctionsMap != null); 57Debug.Assert(method.MethodKind == MethodKind.LocalFunction); 58Debug.Assert(localFunctionsMap.ContainsKey(method)); 191Debug.Assert(controlFlowGraph.OriginalOperation == operation); 252Debug.Assert(localFunction == LocalFunctions[info.ordinal]); 262Debug.Assert(localFunction == info.operation.Symbol); 264Debug.Assert(graph.OriginalOperation == info.operation); 269Debug.Assert(controlFlowGraph.Parent == this); 311Debug.Assert(graph.OriginalOperation == anonymous.Original); 316Debug.Assert(controlFlowGraph.Parent == this);
Operations\ControlFlowGraphBuilder.BasicBlockBuilder.cs (19)
51Debug.Assert(operation != null); 81Debug.Assert(Region != null); 99Debug.Assert(_predecessor1 == null); 100Debug.Assert(_predecessor2 == null); 116Debug.Assert(!result || BranchValue != null); 125Debug.Assert(_predecessor1 == null); 126Debug.Assert(_predecessor2 == null); 145Debug.Assert(predecessor != null); 149Debug.Assert(_predecessor1 == null); 150Debug.Assert(_predecessor2 == null); 175Debug.Assert(_predecessors.Count == 3); 183Debug.Assert(predecessor != null); 187Debug.Assert(_predecessor1 == null); 188Debug.Assert(_predecessor2 == null); 205Debug.Assert(_predecessor1 == null); 206Debug.Assert(_predecessor2 == null); 242Debug.Assert(_predecessor1 == null); 243Debug.Assert(_predecessor2 == null); 292Debug.Assert(predecessor.FallThroughSuccessor != null);
Operations\ControlFlowGraphBuilder.ConditionalAccessOperationTracker.cs (1)
30Debug.Assert(operations != null && whenNull != null);
Operations\ControlFlowGraphBuilder.Context.cs (2)
26Debug.Assert(!anonymousTypePropertyValues.IsDefault); 27Debug.Assert(implicitInstance == null || anonymousType == null);
Operations\ControlFlowGraphBuilder.cs (330)
65Debug.Assert(compilation != null); 77Debug.Assert(_currentRegion != null); 89Debug.Assert(body != null); 90Debug.Assert(((Operation)body).OwningSemanticModel != null); 95Debug.Assert(body.Parent == null); 96Debug.Assert(body.Kind == OperationKind.Block || 104Debug.Assert(parent == null); 108Debug.Assert(body.Kind == OperationKind.LocalFunction || body.Kind == OperationKind.AnonymousFunction); 109Debug.Assert(parent != null); 127Debug.Assert(captureIdDispenser != null); 131Debug.Assert(captureIdDispenser != null); 145Debug.Assert(builder._currentRegion == null); 162Debug.Assert(builder._evalStack.Count == 0); 268Debug.Assert(outOfRangeBlocksToVisit != null); 313Debug.Assert(current.Region != null); 331Debug.Assert(branch.Destination == null); 336Debug.Assert(branch.Destination != null); 337Debug.Assert(current.Region != null); 357Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 358Debug.Assert(region.EnclosingRegion != null); 362Debug.Assert(enclosing.NestedRegions[0] == region); 363Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 380Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 421Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 422Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 431Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 442Debug.Assert(enclosing!.Kind == ControlFlowRegionKind.FilterAndHandler); 443Debug.Assert(enclosing.EnclosingRegion != null); 445Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 469Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 470Debug.Assert(startAt > 0); 471Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 485Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 486Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal); 525Debug.Assert(!region.IsEmpty); 563Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 584Debug.Assert(subRegion.FirstBlock != null); 589Debug.Assert(!subRegion.HasCaptureIds); 592Debug.Assert(regionMap[block] == subRegion); 624Debug.Assert(subRegion.Kind != ControlFlowRegionKind.Root); 625Debug.Assert(subRegion.Enclosing != null); 634Debug.Assert(canHaveEmptyRegion); 635Debug.Assert(!subRegion.HasRegions); 648Debug.Assert(!r.IsEmpty); 651Debug.Assert(regionMap[blocks[i]] == subRegion); 667Debug.Assert(regionMap[blocks[i]] == subRegion); 712Debug.Assert(predecessor.BranchValue == null); 713Debug.Assert(predecessor.FallThrough.Kind == ControlFlowBranchSemantics.Regular); 726Debug.Assert((block.BranchValue != null && !block.HasCondition) == (next.Kind == ControlFlowBranchSemantics.Return || next.Kind == ControlFlowBranchSemantics.Throw)); 727Debug.Assert((next.Destination == null) == 738Debug.Assert(currentRegion.Kind == ControlFlowRegionKind.Filter || 740Debug.Assert(block == currentRegion.LastBlock); 756Debug.Assert(currentRegion.FirstBlock == block); 757Debug.Assert(!currentRegion.HasRegions); 765Debug.Assert(currentRegion.Enclosing != null); 767Debug.Assert(tryAndFinally.Kind == ControlFlowRegionKind.TryAndFinally); 768Debug.Assert(tryAndFinally.Regions!.Count == 2); 771Debug.Assert(@try.Kind == ControlFlowRegionKind.Try); 772Debug.Assert(tryAndFinally.Regions.Last() == currentRegion); 777Debug.Assert(@try.FirstBlock != null); 789Debug.Assert(tryAndFinally.Enclosing != null); 794Debug.Assert(regionMap[block] == tryAndFinallyEnclosing); 805Debug.Assert(block.HasCondition || block.BranchValue == null); 806Debug.Assert(next.Destination == null); 836Debug.Assert(next.Kind == ControlFlowBranchSemantics.Regular || 843Debug.Assert(!block.HasCondition); // This is ensured by an "if" above. 858Debug.Assert(implicitEntryRegion.LastBlock!.Ordinal >= next.Destination.Ordinal); 866Debug.Assert(next.Destination != null); 890Debug.Assert(predecessor.FallThrough.Destination == block); 929Debug.Assert(predecessor.BranchValue == null); 936Debug.Assert(value == null); 957Debug.Assert(next.Kind == ControlFlowBranchSemantics.Regular || 984Debug.Assert(predecessor != block); 985Debug.Assert(predecessor.BranchValue == null); 1048Debug.Assert(!region.IsEmpty); 1049Debug.Assert(region.FirstBlock.Ordinal >= 0); 1050Debug.Assert(region.FirstBlock.Ordinal <= region.LastBlock.Ordinal); 1051Debug.Assert(region.FirstBlock.Ordinal <= block.Ordinal); 1052Debug.Assert(block.Ordinal <= region.LastBlock.Ordinal); 1058Debug.Assert(region.Enclosing != null); 1063Debug.Assert(enclosing.Enclosing != null); 1071Debug.Assert(region.Enclosing != null); 1076Debug.Assert(enclosing.Enclosing != null); 1081Debug.Assert(region.FirstBlock.Ordinal <= region.LastBlock.Ordinal); 1084Debug.Assert(removed); 1085Debug.Assert(blocks[block.Ordinal] == block); 1105Debug.Assert(predecessorBranch.Kind == ControlFlowBranchSemantics.Regular); 1234Debug.Assert(branch.Kind == ControlFlowBranchSemantics.Regular); 1245Debug.Assert(stackDepth == 0 || _evalStack.Peek().frameOpt != null); 1259Debug.Assert(_evalStack.Count == stackDepth); 1260Debug.Assert(stackDepth == 0 || _evalStack.Peek().frameOpt != null); 1286Debug.Assert(spillingTheStack || _evalStack.All( 1306Debug.Assert(block != null); 1307Debug.Assert(_currentRegion != null); 1338Debug.Assert(_evalStack.Count == _startSpillingAt); 1351Debug.Assert(_currentRegion != null); 1363Debug.Assert((frameOpt == null) != (operationOpt == null)); 1367Debug.Assert(enclosed != frameOpt.RegionBuilderOpt); 1372Debug.Assert(enclosed.LastBlock != null); 1379Debug.Assert(prevBlock.HasCondition || prevBlock.BranchValue == null); 1380Debug.Assert(prevBlock.FallThrough.Destination == null); 1404Debug.Assert(_currentStatement == operation); 1405Debug.Assert(_evalStack.Count == 0 || _evalStack.Peek().frameOpt != null); 1412Debug.Assert(((Operation)originalOperation).OwningSemanticModel != null, "Not an original node."); 1413Debug.Assert(_currentStatement == originalOperation); 1414Debug.Assert(_evalStack.Count == 0 || _evalStack.Peek().frameOpt != null); 1509Debug.Assert(captureIdForResult is null); 1516Debug.Assert(_currentStatement == operation); 1577Debug.Assert(whenFalse is { }); 1616Debug.Assert(operation is { WhenTrue: not null, WhenFalse: not null }); 1631Debug.Assert(rewrittenThrow!.Kind == OperationKind.None); 1632Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 1649Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 1650Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 1695Debug.Assert(_startSpillingAt == _evalStack.Count); 1724Debug.Assert(_lazyRegionBuilder == null); 1725Debug.Assert(value != null); 1740Debug.Assert(frame != null); 1742Debug.Assert(_startSpillingAt <= stackDepth); 1750Debug.Assert(frame == frameOpt); 1751Debug.Assert(operationOpt == null); 1757Debug.Assert(_currentRegion != null); 1759Debug.Assert(toMerge.Enclosing != null); 1762Debug.Assert(toMerge.IsStackSpillRegion); 1763Debug.Assert(!toMerge.HasLocalFunctions); 1764Debug.Assert(toMerge.Locals.IsEmpty); 1792Debug.Assert(_currentRegion!.IsStackSpillRegion); 1816Debug.Assert(owner != null); 1824Debug.Assert(_startSpillingAt <= _evalStack.Count); 1836Debug.Assert(frameOpt.RegionBuilderOpt != null); 1844Debug.Assert((frameOpt == null) != (operationOpt == null)); 1849Debug.Assert(frameOpt.RegionBuilderOpt == null); 1855Debug.Assert(operationOpt != null); 1872Debug.Assert(currentFrame != null); 1874Debug.Assert(currentSpillRegion != null); 1905Debug.Assert(candidate.IsStackSpillRegion); 1912Debug.Assert(candidate.Enclosing != null); 1932Debug.Assert(CurrentRegionRequired.IsStackSpillRegion); 1949Debug.Assert(operationOpt == null); 1950Debug.Assert(frameOpt.RegionBuilderOpt != null); 1954Debug.Assert(operationOpt != null); 1962Debug.Assert(_evalStack.Count != 0); 1963Debug.Assert(_evalStack.First().frameOpt != null); 1964Debug.Assert(_evalStack.First().operationOpt == null); 1965Debug.Assert(_startSpillingAt <= _evalStack.Count); 1966Debug.Assert(operation != null); 1973Debug.Assert(_startSpillingAt <= stackDepth); 1981Debug.Assert(frameOpt == null); 1982Debug.Assert(operationOpt != null); 1989Debug.Assert(_startSpillingAt <= _evalStack.Count); 1992Debug.Assert(frameOpt == null); 1993Debug.Assert(operationOpt != null); 2000Debug.Assert(unwrapper != null || typeof(T) == typeof(IOperation)); 2009Debug.Assert(wrapper != null || typeof(T) == typeof(IOperation)); 2039Debug.Assert(stackSizeBefore == _evalStack.Count); 2072Debug.Assert(interpolatedStringBuilder != null); 2102Debug.Assert(index >= 0 && index < args.Length); 2461Debug.Assert(binOp.Type is not null); 2475Debug.Assert(binOp.Type is not null); 2500Debug.Assert(unaryOperatorMethod == null); 2574Debug.Assert(binOp.OperatorMethod is not null); 2603Debug.Assert(unaryOperatorMethod == null || !ITypeSymbolHelpers.IsNullableType(unaryOperatorMethod.Parameters[0].Type)); 2664Debug.Assert(IsBooleanConditionalOperator(condition)); 2714Debug.Assert(ITypeSymbolHelpers.IsBooleanType(condition.Type)); 2776Debug.Assert(current == _currentRegion); 2793Debug.Assert(_startSpillingAt == _evalStack.Count); 2880Debug.Assert(conditional.WhenFalse is not null); 2938Debug.Assert(rewrittenThrow != null); 2939Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 2940Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 2976Debug.Assert(previous.BranchValue == null); 2977Debug.Assert(!previous.HasCondition); 2978Debug.Assert(condition != null); 2979Debug.Assert(branch.Destination != null); 2993Debug.Assert(_evalStack.Last().frameOpt != null); 2994Debug.Assert(_startSpillingAt >= _evalStack.Count - 1); 3078Debug.Assert(conversion is not null); 3080Debug.Assert(rewrittenThrow != null); 3081Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 3082Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 3113Debug.Assert(operation.Parent != null); 3115Debug.Assert(captureIdForResult == null || !isStatement); 3129Debug.Assert(valueFrame.RegionBuilderOpt != null); 3191Debug.Assert(intermediateFrame.RegionBuilderOpt != null); 3206Debug.Assert(intermediateFrame != null); 3227Debug.Assert(whenNullFrame.RegionBuilderOpt != null); 3324Debug.Assert(ITypeSymbolHelpers.IsBooleanType(booleanType)); 3335Debug.Assert(nullableMember == SpecialMember.System_Nullable_T_GetValueOrDefault || 3342Debug.Assert(ITypeSymbolHelpers.IsNullableType(valueType)); 3365Debug.Assert(ITypeSymbolHelpers.IsNullableType(value.Type)); 3418Debug.Assert(captureIdForResult == null); 3425Debug.Assert(_currentStatement is not null); 3437Debug.Assert(expressionFrame != null); 3464Debug.Assert(operation.Type is not null); 3480Debug.Assert(!_currentConditionalAccessTracker.IsDefault); 3481Debug.Assert(_currentConditionalAccessTracker.Operations.Count == 0); 3531Debug.Assert(!_currentConditionalAccessTracker.IsDefault && _currentConditionalAccessTracker.Operations.Count > 0); 3539Debug.Assert(!_currentConditionalAccessTracker.IsDefault); 3572Debug.Assert(operation.Operation.Kind == OperationKind.ConditionalAccess || operation.Operation.Kind == OperationKind.CoalesceAssignment); 3609Debug.Assert(operation.Condition is not null); 3649Debug.Assert(_currentRegion == locals); 3688Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 3721Debug.Assert(!filterRegion.IsEmpty); 3722Debug.Assert(filterRegion.LastBlock.FallThrough.Destination == null); 3723Debug.Assert(!filterRegion.FirstBlock.HasPredecessors); 3742Debug.Assert(!handlerRegion.IsEmpty); 3745Debug.Assert(CurrentRegionRequired == filterAndHandlerRegion); 3748Debug.Assert(filterAndHandlerRegion.Regions![0].LastBlock!.FallThrough.Destination == null); 3753Debug.Assert(predecessors.All(p => filterAndHandlerRegion.Regions[0].FirstBlock!.Ordinal <= p.Ordinal && 3761Debug.Assert(!handlerRegion.FirstBlock.HasPredecessors); 3765Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndCatch); 3771Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 3782Debug.Assert(_currentRegion == tryAndFinallyRegion); 3784Debug.Assert(!finallyRegion.IsEmpty); 3785Debug.Assert(finallyRegion.LastBlock.FallThrough.Destination == null); 3786Debug.Assert(!finallyRegion.FirstBlock.HasPredecessors); 3790Debug.Assert(tryAndFinallyRegion?.Regions![1].LastBlock!.FallThrough.Destination == null); 3852Debug.Assert(current.BranchValue == null); 3853Debug.Assert(!current.HasCondition); 3949Debug.Assert(current.BranchValue == null); 3950Debug.Assert(!current.HasCondition); 3951Debug.Assert(current.FallThrough.Destination == null); 3952Debug.Assert(current.FallThrough.Kind == ControlFlowBranchSemantics.None); 3977Debug.Assert(visitResource is null); 3996Debug.Assert(resources.Kind != OperationKind.VariableDeclaration); 3997Debug.Assert(resources.Kind != OperationKind.VariableDeclarator); 4016Debug.Assert(_currentRegion == usingRegion); 4103Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 4110Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4115Debug.Assert(_currentRegion == resourceRegion); 4125Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4126Debug.Assert(resource.Type is not null); 4137Debug.Assert(!isNotNullableValueType(resource.Type)); 4142Debug.Assert(resource.Type is not null); 4173Debug.Assert(_currentRegion == finallyRegion); 4179Debug.Assert((disposeMethod is object && !disposeArguments.IsDefault) || 4223Debug.Assert(iDisposable.SpecialType == SpecialType.System_IDisposable || 4343Debug.Assert(lockStatement.LockTakenSymbol == null); 4377Debug.Assert(lockStatement.LockTakenSymbol is not null); 4378Debug.Assert(enterMethod is not null); 4405Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 4419Debug.Assert(lockStatement.LockTakenSymbol is not null); 4453Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4504Debug.Assert(regionForCollection == _currentRegion); 4532Debug.Assert(localsRegion == _currentRegion); 4542Debug.Assert(_currentRegion.Kind == ControlFlowRegionKind.Try); 4559Debug.Assert(_currentRegion.Kind == ControlFlowRegionKind.TryAndFinally); 4565Debug.Assert(_currentRegion == enumeratorCaptureRegion); 4691Debug.Assert(info?.ElementConversion?.ToCommonConversion().IsIdentity != false); 4713Debug.Assert(method.IsStatic == (instanceOpt == null)); 4791Debug.Assert(isObjectLoop && loopObject is not null); 4812Debug.Assert(builder.All(o => o != null)); 4842Debug.Assert(builder.All(op => op is not null)); 4905Debug.Assert(_forToLoopBinaryOperatorLeftOperand == null); 4906Debug.Assert(_forToLoopBinaryOperatorRightOperand == null); 5049Debug.Assert(_forToLoopBinaryOperatorLeftOperand == null); 5050Debug.Assert(_forToLoopBinaryOperatorRightOperand == null); 5061Debug.Assert(positiveFlag is not null); 5100Debug.Assert(value.Discriminator != ConstantValueTypeDiscriminator.Bad); 5297Debug.Assert(_forToLoopBinaryOperatorLeftOperand == null); 5298Debug.Assert(_forToLoopBinaryOperatorRightOperand == null); 5366Debug.Assert(controlVariableReferenceForAssignment.Kind == OperationKind.FlowCaptureReference); 5391Debug.Assert(ITypeSymbolHelpers.IsNullableType(controlVariableReferenceForIncrement.Type)); 5415Debug.Assert(controlVariableReferenceForAssignment.Type != null); 5446Debug.Assert(!_forceImplicit); 5492Debug.Assert(_currentRegion == switchRegion); 5523Debug.Assert(section.Clauses.All(c => c.Label == null)); 5524Debug.Assert(_currentSwitchOperationExpression == null); 5579Debug.Assert(compareWith.Type != null); 5585Debug.Assert(operation.Value.Type != null); 5675Debug.Assert(ITypeSymbolHelpers.IsNullableType(type)); 5676Debug.Assert(ITypeSymbolHelpers.GetNullableUnderlyingType(type).Equals(operand.Type)); 5716Debug.Assert(current.BranchValue == null); 5717Debug.Assert(!current.HasCondition); 5718Debug.Assert(current.FallThrough.Destination == null); 5719Debug.Assert(current.FallThrough.Kind == ControlFlowBranchSemantics.None); 5880Debug.Assert(initializer != null && assignmentSyntax != null); 5883Debug.Assert((afterInitialization, localSymbol.IsStatic) is (null, false) or (not null, true)); 6077Debug.Assert(validKinds.Contains(innerInitializer.Kind)); 6231Debug.Assert(instance.Kind == OperationKind.Invalid || instance.Kind == OperationKind.None); 6318Debug.Assert(array.Initializer is not null); 6370Debug.Fail("This code path should not be reachable."); 6376Debug.Fail("This code path should not be reachable."); 6389Debug.Assert(operation.Type is not null); 6391Debug.Assert(_currentImplicitInstance.AnonymousTypePropertyValues is not null); 6403Debug.Assert(propertyReference != null); 6404Debug.Assert(propertyReference.Arguments.IsEmpty); 6405Debug.Assert(propertyReference.Instance != null); 6406Debug.Assert(propertyReference.Instance.Kind == OperationKind.InstanceReference); 6407Debug.Assert(((IInstanceReferenceOperation)propertyReference.Instance).ReferenceKind == InstanceReferenceKind.ImplicitReceiver); 6455Debug.Assert(owner.Enclosing != null); 6465Debug.Assert(_currentStatement == null); 6619Debug.Assert(operation.IsImplicit); 6627Debug.Assert(operation.Parent is InvocationOperation { Parent: CollectionExpressionOperation ce } && ce.HasErrors(_compilation), 6758Debug.Assert(left != null); 6759Debug.Assert(right != null); 6792Debug.Assert(_currentStatement == operation); 6812Debug.Assert(_evalStack[maxStackDepth + 1].frameOpt != null); 6819Debug.Assert(_evalStack[i].frameOpt == null); 6820Debug.Assert(_evalStack[i].operationOpt != null); 6844Debug.Assert(operation.HandlerCreation is IObjectCreationOperation); 6858Debug.Assert(outParameterArgument is { Parameter: { RefKind: RefKind.Out, Type.SpecialType: SpecialType.System_Boolean } }); 6870Debug.Assert(resultBlock != null); 6871Debug.Assert(outParameterPlaceholder != null); 6872Debug.Assert(outParameterFlowCapture != -1); 6893Debug.Assert(resultBlock != null); 7013Debug.Assert(receiverCapture is IFlowCaptureReferenceOperation); 7027Debug.Assert(argumentCapture is IFlowCaptureReferenceOperation or IDiscardOperation); 7049Debug.Assert(_evalStack.Count > _currentInterpolatedStringHandlerCreationContext.MaximumStackDepth); 7092Debug.Assert(interpolation.FormatString is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7105Debug.Assert(interpolatedStringText.Text is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7134Debug.Assert(operation.GetConstantValue() != null); 7182Debug.Assert(_currentImplicitInstance.AnonymousTypePropertyValues is not null); 7348Debug.Assert(operation.EventReference != null); 7454Debug.Fail("All placeholders should be handled above. Have we introduced a new scenario where placeholders are used?"); 7536Debug.Assert(_currentStatement == invalidOperation); 7899Debug.Assert(operation == null || ((Operation)operation).OwningSemanticModel!.Compilation == _compilation); 7907Debug.Assert(operation == null || ((Operation)operation).OwningSemanticModel!.Compilation == _compilation); 7909Debug.Assert((result == null) == (operation == null)); 7920Debug.Assert((result == null) == (operation == null)); 7986Debug.Assert(operation.Type!.IsAnonymousType); 8031Debug.Assert(simpleAssignment.Target is InvalidOperation); 8038Debug.Assert(propertyReference != null); 8039Debug.Assert(propertyReference.Arguments.IsEmpty); 8040Debug.Assert(propertyReference.Instance != null); 8041Debug.Assert(propertyReference.Instance.Kind == OperationKind.InstanceReference); 8042Debug.Assert(((IInstanceReferenceOperation)propertyReference.Instance).ReferenceKind == InstanceReferenceKind.ImplicitReceiver); 8072Debug.Assert(oldValueCaptureId >= 0); 8124Debug.Assert(simpleAssignment.Target is InvalidOperation); 8129Debug.Assert(properties.Contains(propertyReference.Property, SymbolEqualityComparer.IgnoreAll));
Operations\ControlFlowGraphBuilder.ImplicitInstanceInfo.cs (3)
37Debug.Assert(currentImplicitInstance != null); 45Debug.Assert(currentInitializedAnonymousType.IsAnonymousType); 54Debug.Assert(context.ImplicitInstance == null || context.AnonymousType == null);
Operations\ControlFlowGraphBuilder.InterpolatedStringContext.cs (6)
49Debug.Assert(_currentInterpolatedStringHandlerCreationContext != null); 50Debug.Assert(placeholderOperation is IInstanceReferenceOperation { ReferenceKind: InstanceReferenceKind.InterpolatedStringHandler } or IInterpolatedStringHandlerArgumentPlaceholderOperation); 58Debug.Assert(operation != null); 59Debug.Assert(_currentInterpolatedStringHandlerCreationContext.ApplicableCreationOperation == operation); 70Debug.Assert(_currentInterpolatedStringHandlerArgumentContext.ApplicableCreationOperations.Contains((IInterpolatedStringHandlerCreationOperation)operation)); 74Debug.Assert(placeholderOperation.Parent!.Parent is IObjectCreationOperation objectCreation && objectCreation.HasErrors(_compilation));
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (40)
33Debug.Assert(!isStackSpillRegion || (kind == ControlFlowRegionKind.LocalLifetime && locals.IsDefaultOrEmpty)); 45Debug.Assert((FirstBlock == null) == (LastBlock == null)); 66Debug.Assert(Kind != ControlFlowRegionKind.Root); 78Debug.Assert(Kind != ControlFlowRegionKind.Root); 96Debug.Assert(!IsStackSpillRegion); 97Debug.Assert(Kind != ControlFlowRegionKind.Root); 98Debug.Assert(symbol.MethodKind == MethodKind.LocalFunction); 110Debug.Assert(Kind != ControlFlowRegionKind.Root); 117Debug.Assert(others.All(((IMethodSymbol m, ILocalFunctionOperation _) tuple) => tuple.m.MethodKind == MethodKind.LocalFunction)); 136Debug.Assert(region.Enclosing == null || (region.Enclosing._aboutToFree && region.Enclosing.Enclosing == this)); 146Debug.Assert(Regions.Count <= 2); 147Debug.Assert(lastKind == (Regions.Count < 2 ? ControlFlowRegionKind.Filter : ControlFlowRegionKind.Catch)); 153Debug.Assert(lastKind == ControlFlowRegionKind.Try); 157Debug.Assert(lastKind == ControlFlowRegionKind.Catch || lastKind == ControlFlowRegionKind.FilterAndHandler); 162Debug.Assert(Regions.Count <= 2); 165Debug.Assert(lastKind == ControlFlowRegionKind.Try); 169Debug.Assert(lastKind == ControlFlowRegionKind.Finally); 174Debug.Assert(lastKind != ControlFlowRegionKind.Filter); 175Debug.Assert(lastKind != ControlFlowRegionKind.Catch); 176Debug.Assert(lastKind != ControlFlowRegionKind.Finally); 177Debug.Assert(lastKind != ControlFlowRegionKind.Try); 185Debug.Assert(region.Enclosing == this); 186Debug.Assert(Regions != null); 190Debug.Assert(Regions[0] == region); 203Debug.Assert(toReplace.Enclosing == this); 204Debug.Assert(toReplace.FirstBlock!.Ordinal <= replaceWith.First().FirstBlock!.Ordinal); 205Debug.Assert(toReplace.LastBlock!.Ordinal >= replaceWith.Last().LastBlock!.Ordinal); 206Debug.Assert(Regions != null); 212Debug.Assert(Regions[0] == toReplace); 250Debug.Assert(block != null); 251Debug.Assert((Kind != ControlFlowRegionKind.FilterAndHandler && 258Debug.Assert(LastBlock == null); 268Debug.Assert(FirstBlock != null); 269Debug.Assert(Regions.Count == 1 && Regions.First().LastBlock == block); 273Debug.Assert(LastBlock!.Ordinal < block.Ordinal); 274Debug.Assert(!HasRegions || Regions.Last().LastBlock!.Ordinal <= block.Ordinal); 283Debug.Assert(_aboutToFree); 303Debug.Assert(!_aboutToFree); 305Debug.Assert(!IsEmpty); 377Debug.Assert(block.Region == null);
Operations\ControlFlowRegion.cs (17)
71Debug.Assert(firstBlockOrdinal >= 0); 72Debug.Assert(lastBlockOrdinal >= firstBlockOrdinal); 86Debug.Assert(r.EnclosingRegion == null && r.Kind != ControlFlowRegionKind.Root); 96Debug.Assert(NestedRegions.Length == 2); 97Debug.Assert(NestedRegions[0].Kind == (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Try : ControlFlowRegionKind.Filter)); 98Debug.Assert(NestedRegions[1].Kind == (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Finally : ControlFlowRegionKind.Catch)); 99Debug.Assert(NestedRegions[0].FirstBlockOrdinal == firstBlockOrdinal); 100Debug.Assert(NestedRegions[1].LastBlockOrdinal == lastBlockOrdinal); 101Debug.Assert(NestedRegions[0].LastBlockOrdinal + 1 == NestedRegions[1].FirstBlockOrdinal); 105Debug.Assert(NestedRegions.Length >= 2); 106Debug.Assert(NestedRegions[0].Kind == ControlFlowRegionKind.Try); 107Debug.Assert(NestedRegions[0].FirstBlockOrdinal == firstBlockOrdinal); 113Debug.Assert(previousLast + 1 == r.FirstBlockOrdinal); 116Debug.Assert(r.Kind == ControlFlowRegionKind.FilterAndHandler || r.Kind == ControlFlowRegionKind.Catch); 119Debug.Assert(previousLast == lastBlockOrdinal); 134Debug.Assert(previousLast < r.FirstBlockOrdinal); 138Debug.Assert(previousLast <= lastBlockOrdinal);
Operations\IOperation.OperationList.cs (1)
126Debug.Assert(_operation != null && _currentSlot >= 0 && _currentIndex >= 0);
Operations\IOperation.OperationList.Reversed.cs (2)
106Debug.Assert(_operation != null && _currentSlot is >= 0 and not int.MaxValue && _currentIndex is >= 0 and not int.MaxValue); 113Debug.Assert((_currentSlot == int.MaxValue) == (_currentIndex == int.MaxValue));
Operations\Loops\ForEachLoopOperationInfo.cs (1)
61Debug.Assert(!collectionIsInlineArrayValue || inlineArrayConversion is { });
Operations\Operation.cs (9)
32Debug.Assert(semanticModel.ContainingPublicModelOrSelf != null); 33Debug.Assert(semanticModel.ContainingPublicModelOrSelf != semanticModel); 34Debug.Assert(semanticModel.ContainingPublicModelOrSelf.ContainingPublicModelOrSelf == semanticModel.ContainingPublicModelOrSelf); 52Debug.Assert(_parentDoNotAccessDirectly != s_unset, "Attempt to access parent node before construction is complete!"); 139Debug.Assert(_parentDoNotAccessDirectly == s_unset); 140Debug.Assert(parent != s_unset); 144Debug.Assert(parent == null || ((Operation)parent).OwningSemanticModel == OwningSemanticModel); 178Debug.Assert((object?)child.Parent == parent); 185Debug.Assert(!children.IsDefault);
Operations\OperationExtensions.cs (1)
339Debug.Assert(operation != null);
Operations\OperationMapBuilder.cs (1)
21Debug.Assert(dictionary.Count == 0);
Operations\OperationNodes.cs (4)
91Debug.Assert(children.All(o => o != null)); 652Debug.Assert(value != null); 661Debug.Assert(operand != null); 699Debug.Assert(statements.All(s => s.Parent != this && s.Parent!.Kind is OperationKind.Block or OperationKind.SwitchCase));
PEWriter\CustomDebugInfoWriter.cs (4)
33Debug.Assert(pdbWriter != null); 175Debug.Assert(local.SlotIndex >= 0); 188Debug.Assert(localConstant.SlotIndex < 0); 271Debug.Assert(!ReferenceEquals(_previousMethodBodyWithUsingInfo, methodBody));
PEWriter\ExceptionHandlerRegion.cs (8)
42Debug.Assert(tryStartOffset < tryEndOffset); 43Debug.Assert(tryEndOffset <= handlerStartOffset); 44Debug.Assert(handlerStartOffset < handlerEndOffset); 45Debug.Assert(tryStartOffset >= 0); 46Debug.Assert(tryEndOffset >= 0); 47Debug.Assert(handlerStartOffset >= 0); 48Debug.Assert(handlerEndOffset >= 0); 157Debug.Assert(filterDecisionStartOffset >= 0);
PEWriter\ExtendedPEBuilder.cs (2)
76Debug.Assert(_withMvidSection); 98Debug.Assert(mvidWriter.RemainingBytes == 0);
PEWriter\LocalScope.cs (4)
32Debug.Assert(!locals.Any(l => l.Name == null)); 33Debug.Assert(!constants.Any(c => c.Name == null)); 34Debug.Assert(offset >= 0); 35Debug.Assert(endOffset > offset);
PEWriter\Members.cs (1)
116Debug.Assert((compare & ~(CallingConvention)SignatureCallingConventionMask) == 0);
PEWriter\MetadataVisitor.cs (3)
105Debug.Assert((constant != null) == fieldDefinition.IsCompileTimeConstant); 106Debug.Assert((marshalling != null || !fieldDefinition.MarshallingDescriptor.IsDefaultOrEmpty) == fieldDefinition.IsMarshalledExplicitly); 437Debug.Assert((marshalling != null || !parameterDefinition.MarshallingDescriptor.IsDefaultOrEmpty) == parameterDefinition.IsMarshalledExplicitly);
PEWriter\MetadataWriter.cs (50)
104Debug.Assert(metadata != debugMetadataOpt); 661Debug.Assert(namespaceTypeReference.AsGenericTypeInstanceReference == null); 668Debug.Assert(!_tableIndicesAreComplete); 677Debug.Assert(!_tableIndicesAreComplete); 846Debug.Assert(!_tableIndicesAreComplete); 1130Debug.Assert((methodReference.CallingConvention & CallingConvention.Generic) != 0 == (methodReference.GenericParameterCount > 0)); 1190Debug.Assert(!(signature is IMethodReference)); 1427Debug.Assert(str != null); // No need to handle in an internal utility. 1696Debug.Assert(nativePdbWriterOpt == null ^ portablePdbStreamOpt == null); 1714Debug.Assert(module.SerializationProperties.PersistentIdentifier != default(Guid)); 1725Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncLog] == 0); 1726Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncMap] == 0); 1729Debug.Assert(managedResourceDataBuilder == null); 1730Debug.Assert(mvidFixup.IsDefault); 1731Debug.Assert(mvidStringFixup.IsDefault); 1995Debug.Assert(sourceAssembly != null); 2067Debug.Assert(this.IsFullMetadata); // parentToken is not relative 2105Debug.Assert(this.IsFullMetadata); 2264Debug.Assert(exportedType.ParentIndex != -1); 2369Debug.Assert(offset % ManagedPEBuilder.MappedFieldDataAlignment == 0, "Expected last write to end at alignment boundary"); 2370Debug.Assert(ManagedPEBuilder.MappedFieldDataAlignment == 8, "Expected alignment to be 8"); 2436Debug.Assert(propDef.DefaultValue != null); 2575Debug.Assert(resourceDataWriter == null || (resourceDataWriter.Count % ManagedPEBuilder.ManagedResourcesDataAlignment) == 0); 2958Debug.Assert(MetadataOnly); 2987Debug.Assert(!MetadataOnly); 3013Debug.Assert(body != null); 3095Debug.Assert(!_tableIndicesAreComplete); 3275Debug.Assert(pseudoToken <= 0xffffff); 3316Debug.Assert(ReadByte(generatedIL, offset - 1) == (byte)ILOpCode.Ldtoken); 3324Debug.Assert(handle.Kind is HandleKind.MethodDefinition); 3332Debug.Assert(handle.Kind is HandleKind.FieldDefinition); 3371Debug.Assert(guidStringLength == default(Guid).ToString().Length); 3466Debug.Assert(parameterTypeInformation.RefCustomModifiers.Length == 0 || parameterTypeInformation.IsByReference); 3477Debug.Assert(fieldReference.RefCustomModifiers.Length == 0 || fieldReference.IsByReference); 3514Debug.Assert(parameters.Length == arguments.Length); 3570Debug.Assert(this.module.IsPlatformType(targetType, PlatformType.SystemObject)); 3630Debug.Assert(!module.IsPlatformType(c.Type, PlatformType.SystemType) || c.Value == null); 3646Debug.Assert(marshallingInformation.NumberOfElements >= 0); 3685Debug.Assert(marshallingInformation.ElementType >= 0); 3783Debug.Assert(identity.ContentType == AssemblyContentType.Default); 3830Debug.Assert(!signature.ReturnValueIsByRef); 3831Debug.Assert(signature.RefCustomModifiers.IsEmpty); 3838Debug.Assert(signature.RefCustomModifiers.IsEmpty || signature.ReturnValueIsByRef); 4060Debug.Assert(arrayTypeReference.IsSZArray); 4063Debug.Assert(!(elementType is IModifiedTypeReference)); 4094Debug.Assert(typeReference.IsEnum); 4279Debug.Assert(!_writer._tableIndicesAreComplete); 4282Debug.Assert(!this.TryGetValue(item, out i)); 4305Debug.Assert(index.Count == 0); 4332Debug.Assert(index.Count == 0);
PEWriter\MetadataWriter.DynamicAnalysis.cs (3)
159Debug.Assert(previousStartColumn < 0); 182Debug.Assert(deltaLines != 0 || deltaColumns != 0); 230Debug.Assert(name != null);
PEWriter\MetadataWriter.PortablePdb.cs (16)
107Debug.Assert(local.SlotIndex >= 0); 120Debug.Assert(mdConstant != null); 247Debug.Assert(!value.GetType().GetTypeInfo().IsEnum); 336Debug.Assert(import.TargetNamespaceOpt == null); 337Debug.Assert(import.TargetAssemblyOpt == null); 338Debug.Assert(import.TargetTypeOpt == null); 347Debug.Assert(import.TargetNamespaceOpt == null); 348Debug.Assert(import.TargetAssemblyOpt == null); 404Debug.Assert(import.AliasOpt != null); 405Debug.Assert(import.TargetAssemblyOpt == null); 433Debug.Assert(rid == ModuleImportScopeHandle); 580Debug.Assert(asyncInfo.ResumeOffsets.Length == asyncInfo.YieldOffsets.Length); 581Debug.Assert(asyncInfo.CatchHandlerOffset >= -1); 688Debug.Assert(previousNonHiddenStartColumn < 0); 725Debug.Assert(deltaLines != 0 || deltaColumns != 0 || sequencePoint.IsHidden); 762Debug.Assert(result);
PEWriter\ModifiedTypeReference.cs (1)
24Debug.Assert(!customModifiers.IsDefault);
PEWriter\NativeResourceWriter.cs (2)
196Debug.Assert(typeDirectory.NumberOfIdEntries == 0, "Not all Win32 resources with types encoded as strings precede those encoded as ints"); 214Debug.Assert(nameDirectory.NumberOfIdEntries == 0, "Not all Win32 resources with names encoded as strings precede those encoded as ints");
PEWriter\PeWriter.cs (11)
60Debug.Assert(ManagedResourceBlobBuilder == null || ManagedResourceBlobBuilder.Count > 0); 61Debug.Assert(MappedFieldDataBlobBuilder == null || MappedFieldDataBlobBuilder.Count > 0); 94Debug.Assert(nativePdbWriterOpt == null || pdbPathOpt != null); 107Debug.Assert(properties.PersistentIdentifier == default(Guid)); 205Debug.Assert(!isDeterministic || context.Module.PdbChecksumAlgorithm.Name != null); 300Debug.Assert(strongNameProvider != null); 346Debug.Assert(writer.RemainingBytes == 0); 353Debug.Assert(writer.RemainingBytes == 0); 360Debug.Assert(writer.RemainingBytes == 0); 410Debug.Assert(resourceSection != null); 426Debug.Assert(resources.Any());
PEWriter\ReferenceIndexer.cs (3)
74Debug.Assert(!this.typeReferenceNeedsToken); 109Debug.Assert(body != null); 148Debug.Assert(!this.typeReferenceNeedsToken);
PEWriter\ReferenceIndexerBase.cs (5)
47Debug.Assert(!this.typeReferenceNeedsToken); 54Debug.Assert(!this.typeReferenceNeedsToken); 280Debug.Assert(!this.typeReferenceNeedsToken); 321Debug.Assert(!this.typeReferenceNeedsToken); 339Debug.Assert(!this.typeReferenceNeedsToken);
PEWriter\RootModuleType.cs (1)
32Debug.Assert(_methods is null);
PEWriter\TypeNameSerializer.cs (3)
92Debug.Assert(uninstantiatedTypeReference != typeReference); 215Debug.Assert(needsEscaping.All(c => !fileIdentifier.Contains(c))); 268Debug.Assert(@namespace != null);
PEWriter\Units.cs (4)
38Debug.Assert(startLine >= 0); 39Debug.Assert(startColumn >= 0); 40Debug.Assert(endLine >= 0); 41Debug.Assert(endColumn >= 0);
RealParser.cs (6)
229Debug.Assert((DenormalMantissaMask & (1UL << DenormalMantissaBits)) == 0); 231Debug.Assert((shiftedExponent & DenormalMantissaMask) == 0); 232Debug.Assert((mantissa & ~DenormalMantissaMask) == 0); 233Debug.Assert((shiftedExponent & ~(((1UL << this.ExponentBits) - 1) << DenormalMantissaBits)) == 0); // exponent fits in its place 466Debug.Assert(!fractionalNumerator.IsZero); 548Debug.Assert(integerBitsOfPrecision < 60); // we can use BigInteger's built-in conversion
ReferenceManager\AssemblyDataForAssemblyBeingBuilt.cs (3)
32Debug.Assert(identity != null); 33Debug.Assert(!referencedAssemblyData.IsDefault); 89Debug.Assert(assemblies[_referencedAssemblyData[i].Identity.Name].Contains((_referencedAssemblyData[i], i + 1)));
ReferenceManager\AssemblyReferenceBinding.cs (6)
27Debug.Assert(referenceIdentity != null); 39Debug.Assert(referenceIdentity != null); 40Debug.Assert(definitionIndex >= 0); 41Debug.Assert(versionDifference >= -1 && versionDifference <= +1); 78Debug.Assert(IsBound); 91Debug.Assert(IsBound);
ReferenceManager\CommonReferenceManager.Binding.cs (31)
110Debug.Assert(explicitAssemblies[0] is AssemblyDataForAssemblyBeingBuilt); 111Debug.Assert(explicitReferences.Length == explicitReferenceMap.Length); 159Debug.Assert(referenceBindings.Count == allAssemblies.Length); 225Debug.Assert(explicitAssemblies[0] is AssemblyDataForAssemblyBeingBuilt); 226Debug.Assert(referenceBindings.Count == explicitAssemblies.Length); 227Debug.Assert(explicitReferences.Length == explicitReferenceMap.Length); 265Debug.Assert(binding.ReferenceIdentity is object); 320Debug.Assert(lazyAliasMap == null); 360Debug.Assert(binding.ReferenceIdentity is object); 397Debug.Assert(result.Count == 0); 417Debug.Assert(bindingIndex == bindingsOfAssemblyBeingBuilt.Length); 435Debug.Assert(result.Count == explicitModules.Length + totalReferencedAssemblyCount); 559Debug.Assert(resolvedAssembly is object); 580Debug.Assert(assembly is object); 675Debug.Assert(GetCorLibrary(candidateInputAssemblySymbols[j]) == null); 683Debug.Assert(corLibraryIndex != 0); 689Debug.Assert(candidateInputAssemblySymbols[corLibraryIndex] == null); 702Debug.Assert(candidateInputAssemblySymbols[j] != null); 771Debug.Assert(candidate.DefinitionIndex >= 0); 772Debug.Assert(candidate.AssemblySymbol is object); 777Debug.Assert(boundInputs[candidateIndex].AssemblySymbol == null || 810Debug.Assert(candidateInputAssemblySymbols[candidateIndex] == null); 822Debug.Assert(candidateReferenceBinding is object); 823Debug.Assert(candidateReferenceBinding.Length == candidateReferencedSymbols.Count); 912Debug.Assert(corLibraryIndex != 0); 914Debug.Assert(ReferenceEquals(candidateCorLibrary, GetCorLibrary(candidateCorLibrary))); 931Debug.Assert(!assemblies[corLibraryIndex].ContainsNoPiaLocalTypes); 932Debug.Assert(!assemblies[corLibraryIndex].IsLinked); 933Debug.Assert(!IsLinked(candidateCorLibrary)); 948Debug.Assert(boundInputs[k].AssemblySymbol == null); 988Debug.Assert(value.Identity is object);
ReferenceManager\CommonReferenceManager.Resolution.cs (24)
69Debug.Assert(index >= 0); 82Debug.Assert(!aliasesOpt.IsDefault || !recursiveAliasesOpt.IsDefault); 83Debug.Assert(!mergedReferences.IsDefault); 101Debug.Assert(!IsUninitialized); 115Debug.Assert(!IsUninitialized); 124Debug.Assert(!IsUninitialized); 144Debug.Assert(!IsSkipped); 156Debug.Assert(!IsSkipped); 323Debug.Assert(metadata != null || diagnostics.HasAnyErrors()); 336Debug.Assert(assembly is object); 531Debug.Assert(existing is Metadata || existing is Diagnostic); 549Debug.Assert(metadata != null || diagnostics.HasAnyErrors()); 686Debug.Assert(other.Identity is object); 716Debug.Assert(other.Identity is object); 731Debug.Assert(other.Identity is object); 750Debug.Assert(equivalent.Identity.IsStrongName); 771Debug.Assert(!equivalent.Identity.IsStrongName); 785Debug.Assert(equivalent.Reference != null); 804Debug.Assert(referenceDirective.Location is object); 813Debug.Assert(referenceDirective.File is object); 814Debug.Assert(referenceDirective.Location.SourceTree is object); 875Debug.Assert(compilation.Options.MetadataReferenceResolver != null); 963Debug.Assert(reference.Version > definition.Version); 1054Debug.Assert(definitionData.Identity.PublicKeyToken.IsEmpty);
ReferenceManager\CommonReferenceManager.State.cs (47)
197Debug.Assert(simpleAssemblyName != null); 198Debug.Assert(identityComparer != null); 329Debug.Assert(_lazyMergedAssemblyReferencesMap != null); 351Debug.Assert(_isBound == 0); 352Debug.Assert(_lazyHasCircularReference == ThreeState.Unknown); 353Debug.Assert(_lazyReferencedAssembliesMap == null); 354Debug.Assert(_lazyReferencedModuleIndexMap == null); 355Debug.Assert(_lazyReferenceDirectiveMap == null); 356Debug.Assert(_lazyDirectiveReferences.IsDefault); 357Debug.Assert(_lazyImplicitReferenceResolutions == null); 358Debug.Assert(_lazyExplicitReferences.IsDefault); 359Debug.Assert(_lazyReferencedModules.IsDefault); 360Debug.Assert(_lazyReferencedModulesReferences.IsDefault); 361Debug.Assert(_lazyReferencedAssemblies.IsDefault); 362Debug.Assert(_lazyAliasesOfReferencedAssemblies.IsDefault); 363Debug.Assert(_lazyMergedAssemblyReferencesMap == null); 364Debug.Assert(_lazyUnifiedAssemblies.IsDefault); 365Debug.Assert(_lazyCorLibraryOpt == null); 372Debug.Assert(_isBound != 0); 373Debug.Assert(_lazyHasCircularReference != ThreeState.Unknown); 374Debug.Assert(_lazyReferencedAssembliesMap != null); 375Debug.Assert(_lazyReferencedModuleIndexMap != null); 376Debug.Assert(_lazyReferenceDirectiveMap != null); 377Debug.Assert(!_lazyDirectiveReferences.IsDefault); 378Debug.Assert(_lazyImplicitReferenceResolutions != null); 379Debug.Assert(!_lazyExplicitReferences.IsDefault); 380Debug.Assert(!_lazyReferencedModules.IsDefault); 381Debug.Assert(!_lazyReferencedModulesReferences.IsDefault); 382Debug.Assert(!_lazyReferencedAssemblies.IsDefault); 383Debug.Assert(!_lazyAliasesOfReferencedAssemblies.IsDefault); 384Debug.Assert(_lazyMergedAssemblyReferencesMap != null); 385Debug.Assert(!_lazyUnifiedAssemblies.IsDefault); 388Debug.Assert(_lazyReferencedAssemblies.Length == 0 || _lazyCorLibraryOpt != null); 394Debug.Assert(compilation.MakeSourceAssemblySimpleName() == this.SimpleAssemblyName); 427Debug.Assert(referencedModules.Length == referencedModulesReferences.Length); 428Debug.Assert(referencedModules.Length == referencedModulesMap.Count); 429Debug.Assert(referencedAssemblies.Length == aliasesOfReferencedAssemblies.Length); 496Debug.Assert(aliasesOfReferencedAssembliesBuilder.Count == assemblyIndex); 516Debug.Assert(!aliasesOfReferencedAssembliesBuilder.Any(a => a.IsDefault)); 544Debug.Assert(originalIdentities.Length == symbols.Length); 555Debug.Assert(versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); 572Debug.Assert(originalIdentity == symbolIdentity); 590Debug.Assert(versionPattern is null || versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); 622Debug.Assert(bindingResult.Length == aliasesOfReferencedAssembliesBuilder.Count + 1); 630Debug.Assert(reference.Kind == MetadataImageKind.Assembly); 633Debug.Assert(assemblyIndicesToProcess.Count == 0); 647Debug.Assert(referenceBinding is object);
ReferenceManager\ModuleReferences.cs (4)
46Debug.Assert(!identities.IsDefault); 47Debug.Assert(!symbols.IsDefault); 48Debug.Assert(identities.Length == symbols.Length); 49Debug.Assert(!unifiedAssemblies.IsDefault);
ReferenceManager\UnifiedAssembly.cs (2)
29Debug.Assert(originalReference != null); 30Debug.Assert(targetAssembly != null);
RuleSet\RuleSet.cs (2)
146Debug.Assert(effectiveRuleset is object); 301Debug.Assert(resolvedPath != null);
RuleSet\RuleSetProcessor.cs (3)
82Debug.Assert(nodeList.Count == 1, "Multiple top-level nodes!"); 83Debug.Assert(nodeList[0].Name == RuleSetNodeName); 166Debug.Assert(false, "Unknown child node in Rules node");
SignatureComparer.cs (3)
35Debug.Assert(!result || position == signature.Length); 79Debug.Assert(position == signature.Length); 124Debug.Assert(position == signature.Length);
SourceGeneration\AdditionalSourcesCollection.cs (2)
37Debug.Assert(fileExtension.Length > 0 && fileExtension[0] == '.'); 38Debug.Assert(reservedHintNames.IsEmpty || reservedHintNames.KeyComparer == s_hintNameComparer);
SourceGeneration\CompilationCache.cs (1)
66Debug.Assert(_compilation is not null, $"{nameof(Compilation)} read before any builder produced this cache.");
SourceGeneration\GeneratorAdaptor.cs (2)
39Debug.Assert(_sourceExtension != DummySourceExtension); 96Debug.Assert(ParseOptions is object && ConfigOptions is object);
SourceGeneration\GeneratorDriver.cs (3)
33Debug.Assert(state.Generators.GroupBy(s => s.GetGeneratorType()).Count() == state.Generators.Length); // ensure we don't have duplicate generator types 452Debug.Assert(false); 487Debug.Assert(outputKind != IncrementalGeneratorOutputKind.None);
SourceGeneration\GeneratorDriverState.cs (2)
40Debug.Assert(Generators.Length == GeneratorStates.Length); 41Debug.Assert(IncrementalGenerators.Length == GeneratorStates.Length);
SourceGeneration\GeneratorSyntaxWalker.cs (2)
25Debug.Assert(model is not null 30Debug.Assert(model.Value.SyntaxTree == child.SyntaxTree);
SourceGeneration\IncrementalGeneratorRunStep.cs (2)
18Debug.Assert(!inputs.IsDefault); 19Debug.Assert(!outputs.IsDefault);
SourceGeneration\Nodes\AbstractSourceOutputNode.cs (1)
103Debug.Assert(context.TableBuilder is not null);
SourceGeneration\Nodes\BatchNode.cs (3)
87Debug.Assert(indexInPrevious == previousItems.Length); 106Debug.Assert(builder.Count == entryCount); 127Debug.Assert(!tableBuilder.TrackIncrementalSteps || (sourceTable.HasTrackedSteps || sourceTable.IsEmpty));
SourceGeneration\Nodes\CombineNode.cs (3)
81Debug.Assert(tableBuilder.Count == totalEntryItemCount); 90Debug.Assert(input1Table.HasTrackedSteps && input2Table.IsCached); 98Debug.Assert(usedCachedEntry);
SourceGeneration\Nodes\DriverStateTable.cs (3)
45Debug.Assert(_compilation is not null, "Compilation should only be read after the pre-compilation phase has completed; if this fires a driver-internal caller is reading it too early."); 68Debug.Assert(_syntaxStore is not null, "SyntaxStore should only be read after the pre-compilation phase has completed; if this fires a driver-internal caller is reading it too early."); 84Debug.Assert(_compilation is null, "SetCompilation should only be called once.");
SourceGeneration\Nodes\GeneratorRunStateTable.cs (4)
41Debug.Assert(RecordingExecutedSteps); 42Debug.Assert(table.HasTrackedSteps); 76Debug.Assert(RecordingExecutedSteps); 95Debug.Assert(step.Name is not null);
SourceGeneration\Nodes\HostOutputNode.cs (1)
70Debug.Assert(context.TableBuilder is not null);
SourceGeneration\Nodes\InputNode.cs (6)
69Debug.Assert(added); 93Debug.Assert(usedCache); 103Debug.Assert(removed); 106Debug.Assert(modified); 111Debug.Assert(removed); 119Debug.Assert(previousTable is null || inputItems.Length != previousTable.Count || itemsSet.Count == 0);
SourceGeneration\Nodes\NodeStateTable.cs (18)
70Debug.Assert(!hasTrackedSteps || steps.Length == states.Length); 172Debug.Assert(compacted.Count == nonRemovedCount); 180Debug.Assert((_states.Length == 1 || _states.Length == 2 && _states[0].IsRemovedDueToInputRemoval) && _states[^1].Count == 1); 189Debug.Assert(inputTable.HasTrackedSteps && inputTable.IsCached); 195Debug.Assert(usedCachedEntry); 305Debug.Assert(previousEntries.IsCached); 338Debug.Assert(previousEntry.Count == 1); 478Debug.Assert(stepInputs.IsDefault == !TrackIncrementalSteps); 482Debug.Assert(_steps.Count + 1 == _states.Count); 521Debug.Assert(!TrackIncrementalSteps || _states.Count == _steps.Count); 533Debug.Assert(_requestedTableCapacity == null || _states.Count <= _requestedTableCapacity); 604Debug.Assert(!states.IsDefault); 605Debug.Assert(states.Length == 1 || states.Distinct().Length > 1); 657Debug.Assert(itemBuilder.Count < this.Count); 768Debug.Assert(_currentState.HasValue, "Created a builder with no values?"); 769Debug.Assert(_items.Count >= 1, "Created a builder with no values?"); 771Debug.Assert(_items.Count == _requestedCapacity); 772Debug.Assert(_states == null || _states.Count == _requestedCapacity);
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (1)
86Debug.Assert(model is object);
SourceGeneration\Nodes\SourceOutputNode.cs (1)
19Debug.Assert(outputKind is IncrementalGeneratorOutputKind.Source or IncrementalGeneratorOutputKind.Implementation);
SourceGeneration\Nodes\SyntaxReceiverStrategy.cs (1)
80Debug.Assert(model is not null);
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (1)
102Debug.Assert(syntaxNodes.All(n => n.SyntaxTree == syntaxTree));
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
116Debug.Assert(compilationUnit is ICompilationUnitSyntax); 160Debug.Assert(compilationUnit is ICompilationUnitSyntax);
SourceGeneration\RunResults.cs (1)
91Debug.Assert(exception is null || diagnostics.Length == 1);
SourceGeneration\SyntaxStore.cs (2)
51Debug.Assert(_syntaxInputNodes.Contains(syntaxInputNode)); 136Debug.Assert(_tableBuilder.Contains(node));
SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
SpecialTypes.cs (1)
103Debug.Assert(name.IndexOf('+') < 0); // Compilers aren't prepared to lookup for a nested special type.
src\roslyn\src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (1)
81Debug.Assert(assemblyScopedNamespaceSymbol.ConstituentNamespaces.Length == 1);
src\roslyn\src\Compilers\Core\AnalyzerDriver\DeclarationInfo.cs (2)
17Debug.Assert(declaredNode != null); 18Debug.Assert(!executableCodeBlocks.IsDefault);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (8)
25Debug.Assert(builder.Count == 0); 50Debug.Assert(_recordCount <= byte.MaxValue); 85Debug.Assert(groupSizes.Count <= ushort.MaxValue); 102Debug.Assert(usingCount <= ushort.MaxValue); 152Debug.Assert(info.Flags.Length <= DynamicAttributeSize); 153Debug.Assert(info.LocalName.Length <= IdentifierSize); 172Debug.Assert(infos.Count > 0); 179Debug.Assert((info.SlotIndex == -1) ^ (info.ScopeStart == 0 && info.ScopeEnd == 0));
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (7)
257Debug.Assert(flagsBuilder.Count == 0); 258Debug.Assert(nameBuilder.Length == 0); 398Debug.Assert(!allModuleInfoImportStrings.IsDefault); 422Debug.Assert(!importStrings.IsDefault); 452Debug.Assert(groupBuilder.Count == 0); 493Debug.Assert(!importStrings.IsDefault); 512Debug.Assert(!importStrings.IsDefault);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\StateMachineHoistedLocalScope.cs (2)
26Debug.Assert(startOffset >= 0); 27Debug.Assert(endOffset > startOffset || startOffset == 0 && endOffset == 0);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\TupleElementNamesInfo.cs (1)
22Debug.Assert(!elementNames.IsDefault);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (1)
714Debug.Assert(data.All(d => d.Count() == count));
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\roslyn\src\Dependencies\Collections\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\roslyn\src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\roslyn\src\Dependencies\Collections\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\roslyn\src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\roslyn\src\Dependencies\Collections\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\roslyn\src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
StrongName\DesktopStrongNameProvider.cs (3)
81Debug.Assert(PathUtilities.IsAbsolute(resolvedKeyFile)); 134Debug.Assert(combinedPath == null || PathUtilities.IsAbsolute(combinedPath)); 164Debug.Assert(string.IsNullOrEmpty(keys.KeyFilePath) != string.IsNullOrEmpty(keys.KeyContainer));
StrongName\StrongNameFileSystem.cs (2)
33Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 39Debug.Assert(fullPath == null || PathUtilities.IsAbsolute(fullPath));
StrongName\StrongNameKeys.cs (5)
71Debug.Assert(diagnostic != null); 77Debug.Assert(keyContainerName == null || keyPair.IsDefault); 78Debug.Assert(keyPair.IsDefault || keyFilePath != null); 90Debug.Assert(!publicKey.IsDefaultOrEmpty); 212Debug.Assert(keyFilePath is object);
SwitchConstantValueHelper.cs (1)
89Debug.Assert(second.IsString);
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (1)
23Debug.Assert(IsMinimizing);
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (9)
77Debug.Assert(format != null); 135Debug.Assert(constantValue != null); 154Debug.Assert(enumType.EnumUnderlyingType is not null); 183Debug.Assert(typeSymbol != null); 236Debug.Assert(enumType.EnumUnderlyingType is not null); 300Debug.Assert(zeroField.IdentityOpt is not null); 315Debug.Assert(enumType.EnumUnderlyingType is not null); 335Debug.Assert(enumType.EnumUnderlyingType is not null); 346Debug.Assert(match.IdentityOpt is not null);
SymbolDisplay\FormattedSymbol.cs (1)
27Debug.Assert(symbol != null && symbolDisplayFormat != null);
SymbolDisplay\FormattedSymbolList.cs (1)
23Debug.Assert(symbols != null);
Symbols\Attributes\AttributeDescription.cs (1)
48Debug.Assert(signature[0] == (byte)SignatureAttributes.Instance);
Symbols\Attributes\CommonAssemblyWellKnownAttributeData.cs (3)
460Debug.Assert(value != null); 461Debug.Assert(!value.IsUninitialized); 462Debug.Assert(value.Kind == ObsoleteAttributeKind.Experimental);
Symbols\Attributes\CommonAttributeData.cs (22)
67Debug.Assert(AttributeClass is not null); 202Debug.Assert(AttributeConstructor is object); 206Debug.Assert(parameters.Length == 5); 207Debug.Assert(parameters[0].Type.SpecialType == SpecialType.System_Byte); 208Debug.Assert(parameters[1].Type.SpecialType == SpecialType.System_Byte); 217Debug.Assert(parameters[2].Type.SpecialType == SpecialType.System_Int32); 218Debug.Assert(parameters[3].Type.SpecialType == SpecialType.System_Int32); 219Debug.Assert(parameters[4].Type.SpecialType == SpecialType.System_Int32); 227Debug.Assert(parameters[2].Type.SpecialType == SpecialType.System_UInt32); 228Debug.Assert(parameters[3].Type.SpecialType == SpecialType.System_UInt32); 229Debug.Assert(parameters[4].Type.SpecialType == SpecialType.System_UInt32); 274Debug.Assert(this.CommonConstructorArguments.Length == 1); 322Debug.Assert(args.Length <= 2); 327Debug.Assert(args[1].ValueInternal is object); 380Debug.Assert(args[1].ValueInternal is object); 394Debug.Assert(this.CommonConstructorArguments.Length == 0); 406Debug.Assert(arguments.AttributeSyntaxOpt is object); 412Debug.Assert(attribute.AttributeConstructor is object); 455Debug.Assert(attribute.AttributeClass is object); 479Debug.Assert(arguments.AttributeSyntaxOpt is object); 482Debug.Assert(attribute.AttributeClass is object); 590Debug.Assert(positionalArg.ValueInternal is object);
Symbols\Attributes\CommonAttributeDataComparer.cs (6)
33Debug.Assert(attr1 != null); 34Debug.Assert(attr2 != null); 46Debug.Assert(!equals || GetHashCode(attr1) == GetHashCode(attr2), "If attributes are equal for some options, their hashes must be equal for those same options."); 52Debug.Assert(attr != null); 115Debug.Assert(!result || GetHashCode(x) == GetHashCode(y), "If TypedConstants are equal, their hashes must be equal."); 146Debug.Assert(!equals || GetHashCode(pair1) == GetHashCode(pair2), "If named arguments are equal, their hashes must be equal.");
Symbols\Attributes\CommonEventEarlyWellKnownAttributeData.cs (2)
32Debug.Assert(value != null); 33Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonFieldEarlyWellKnownAttributeData.cs (2)
32Debug.Assert(value != null); 33Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonFieldWellKnownAttributeData.cs (2)
29Debug.Assert(offset >= 0); 56Debug.Assert(_constValue == ConstantValue.Unset);
Symbols\Attributes\CommonMethodEarlyWellKnownAttributeData.cs (2)
48Debug.Assert(value != null); 49Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonMethodWellKnownAttributeData.cs (3)
49Debug.Assert(attributeIndex >= 0); 58Debug.Assert(attributeIndex >= 0); 68Debug.Assert(attributeIndex >= 0);
Symbols\Attributes\CommonModuleWellKnownAttributeData.cs (5)
45Debug.Assert(HasDefaultCharSetAttribute); 51Debug.Assert(IsValidCharSet(value)); 80Debug.Assert(value != null); 81Debug.Assert(!value.IsUninitialized); 82Debug.Assert(value.Kind == ObsoleteAttributeKind.Experimental);
Symbols\Attributes\CommonParameterEarlyWellKnownAttributeData.cs (1)
28Debug.Assert(_defaultParameterValue == ConstantValue.Unset);
Symbols\Attributes\CommonPropertyEarlyWellKnownAttributeData.cs (2)
28Debug.Assert(value != null); 29Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonTypeEarlyWellKnownAttributeData.cs (4)
28Debug.Assert(_attributeUsageInfo.IsNull); 29Debug.Assert(!value.IsNull); 86Debug.Assert(value != null); 87Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonTypeWellKnownAttributeData.cs (4)
162Debug.Assert(value != null); 178Debug.Assert(charSet == CharSet.Ansi || charSet == CharSet.Unicode || charSet == Cci.Constants.CharSet_Auto); 199Debug.Assert(HasStructLayoutAttribute); 209Debug.Assert(HasStructLayoutAttribute);
Symbols\Attributes\CustomAttributesBag.cs (7)
72Debug.Assert(!IsPartComplete(CustomAttributeBagCompletionPart.DecodedWellKnownAttributeData) || IsPartComplete(CustomAttributeBagCompletionPart.EarlyDecodedWellKnownAttributeData)); 87Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.EarlyDecodedWellKnownAttributeData)); 100Debug.Assert(!newCustomAttributes.IsDefault); 114Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.Attributes)); 115Debug.Assert(!_customAttributes.IsDefault); 128Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.DecodedWellKnownAttributeData)); 141Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.EarlyDecodedWellKnownAttributeData));
Symbols\Attributes\DecodeWellKnownAttributeArguments.cs (1)
65Debug.Assert(this.HasDecodedData);
Symbols\Attributes\EarlyDecodeWellKnownAttributeArguments.cs (1)
69Debug.Assert(this.HasDecodedData);
Symbols\Attributes\MarshalAsAttributeDecoder.cs (6)
22Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 116Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 176Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 209Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 298Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 368Debug.Assert((object)arguments.AttributeSyntaxOpt != null);
Symbols\Attributes\MarshalPseudoCustomAttributeData.cs (17)
47Debug.Assert(parameterIndex == null || parameterIndex >= 0 && parameterIndex <= MaxMarshalInteger); 55Debug.Assert(elementCount == null || elementCount >= 0 && elementCount <= MaxMarshalInteger); 56Debug.Assert(parameterIndex == null || parameterIndex >= 0); 66Debug.Assert(elementCount == null || elementCount >= 0 && elementCount <= MaxMarshalInteger); 67Debug.Assert(elementType == null || elementType >= 0 && (int)elementType <= MaxMarshalInteger); 76Debug.Assert(elementType == null || elementType >= 0 && (int)elementType <= MaxMarshalInteger); 85Debug.Assert(elementCount >= 0 && elementCount <= MaxMarshalInteger); 93Debug.Assert(type >= 0 && (int)type <= MaxMarshalInteger); 108Debug.Assert( 119Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_CustomMarshaler); 127Debug.Assert(_marshalTypeNameOrSymbol == null || _marshalTypeNameOrSymbol is string); 136Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_CustomMarshaler); 145Debug.Assert(_marshalType == UnmanagedType.ByValTStr || _marshalType == UnmanagedType.LPArray || _marshalType == Cci.Constants.UnmanagedType_SafeArray || _marshalType == UnmanagedType.ByValArray); 154Debug.Assert(_marshalType == UnmanagedType.LPArray && _marshalParameterIndex <= short.MaxValue); 163Debug.Assert(_marshalType == UnmanagedType.LPArray || _marshalType == UnmanagedType.ByValArray); 172Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_SafeArray); 179Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_SafeArray);
Symbols\Attributes\SecurityWellKnownAttributeData.cs (10)
32Debug.Assert(attributeIndex >= 0 && attributeIndex < totalSourceAttributes); 33Debug.Assert(action != 0); 40Debug.Assert(_lazySecurityActions.Length == totalSourceAttributes); 46Debug.Assert(attributeIndex >= 0 && attributeIndex < totalSourceAttributes); 47Debug.Assert(resolvedFilePath != null); 54Debug.Assert(_lazyPathsForPermissionSetFixup.Length == totalSourceAttributes); 64Debug.Assert(!customAttributes.IsDefault); 65Debug.Assert(_lazyPathsForPermissionSetFixup == null || _lazySecurityActions != null && _lazyPathsForPermissionSetFixup.Length == _lazySecurityActions.Length); 69Debug.Assert(_lazySecurityActions != null); 70Debug.Assert(_lazySecurityActions.Length == customAttributes.Length);
Symbols\Attributes\WellKnownAttributeData.cs (4)
44Debug.Assert(_isSealed == expected); 52Debug.Assert(_anyDataStored == expected); 70Debug.Assert(!data._isSealed); 71Debug.Assert(data._anyDataStored);
Symbols\INamedTypeSymbolInternal.cs (1)
38Debug.Assert(type.EnumUnderlyingType is not null);
Symbols\ISymbolExtensions.cs (2)
26Debug.Assert(reducedFrom is object); 40Debug.Assert(typeParameter.ReducedFrom is object);
Symbols\ITypeSymbol.cs (1)
255Debug.Assert(IsNullableType(type));
Symbols\SymbolKind.cs (1)
132Debug.Assert(!EnumUtilities.ContainsValue(FunctionType));
Symbols\TypedConstant.cs (3)
25Debug.Assert(kind == TypedConstantKind.Array || !(value is ImmutableArray<TypedConstant>)); 26Debug.Assert(!(value is ISymbol) || value is ISymbolInternal); 27Debug.Assert(type is object || kind == TypedConstantKind.Error);
Symbols\TypedConstantValue.cs (2)
25Debug.Assert(value == null || value is string || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is System.IntPtr) && !(value is System.UIntPtr)) || value is ITypeSymbol); 57Debug.Assert(!(_value is ImmutableArray<TypedConstant>));
Symbols\TypeKind.cs (1)
107Debug.Assert(!EnumUtilities.ContainsValue(FunctionType));
Symbols\TypeLayout.cs (2)
23Debug.Assert(size >= 0 && (int)kind >= 0 && (int)kind <= 3); 26Debug.Assert(LayoutKind.Sequential == 0);
Syntax\AbstractWarningStateMap.cs (1)
56Debug.Assert(_warningStateMapEntries != null && _warningStateMapEntries.Length > 0);
Syntax\ChildSyntaxList.cs (5)
146Debug.Assert(offsetInSlot >= 0); 193Debug.Assert(result != null); 255Debug.Assert(node.FullSpan.Contains(targetPosition)); 261Debug.Assert(!green.IsList); 401Debug.Assert(_node is object);
Syntax\ChildSyntaxList.Enumerator.cs (3)
53Debug.Assert(_node != null); 66Debug.Assert(_node is object); 79Debug.Assert(_node != null);
Syntax\ChildSyntaxList.Reversed.cs (2)
30Debug.Assert(_node is object); 93Debug.Assert(_node is object);
Syntax\CommonSyntaxNodeRemover.cs (1)
36Debug.Assert(node is object);
Syntax\GreenNode.cs (7)
165Debug.Assert(value <= byte.MaxValue); 229Debug.Assert(0 <= offset && offset < FullWidth); 235Debug.Assert(i < SlotCount); 585Debug.Assert(found, "We must be able to find annotations since we had the bit set on ourselves"); 586Debug.Assert(annotations != null, "annotations should not be null"); 587Debug.Assert(annotations != s_noAnnotations, "annotations should not be s_noAnnotations"); 588Debug.Assert(annotations.Length != 0, "annotations should be non-empty");
Syntax\GreenNode.NodeEnumerable.cs (1)
43Debug.Assert(_started);
Syntax\GreenNode.NodeFlagsAndSlotCount.cs (2)
44Debug.Assert(shifted <= SlotCountTooLarge); 67Debug.Assert((ushort)value <= NodeFlagsMask);
Syntax\InternalSyntax\SeparatedSyntaxList.cs (2)
28Debug.Assert(!item.IsToken, "even elements of a separated list must be nodes"); 32Debug.Assert(item.IsToken, "odd elements of a separated list must be tokens");
Syntax\InternalSyntax\SyntaxList.cs (1)
77Debug.Assert(node is object);
Syntax\InternalSyntax\SyntaxList.WithLotsOfChildren.cs (1)
44Debug.Assert(offset >= 0 && offset < FullWidth);
Syntax\InternalSyntax\SyntaxList`1.cs (3)
41Debug.Assert(index >= 0); 42Debug.Assert(index <= _node.SlotCount); 73Debug.Assert(index == 0);
Syntax\InternalSyntax\SyntaxListBuilder.cs (2)
94Debug.Assert(_nodes[i].Value != null); 146Debug.Assert(newSize >= requiredSize);
Syntax\InternalSyntax\SyntaxListBuilder`1.cs (1)
50Debug.Assert(result != null);
Syntax\InternalSyntax\SyntaxListPool.cs (2)
40Debug.Assert(!_allocated.Contains(item)); 72Debug.Assert(_allocated.Contains(item));
Syntax\InternalSyntax\SyntaxNodeCache.cs (5)
144Debug.Assert(GetCacheHash(node) == hash); 345Debug.Assert(IsCacheable(node)); 366Debug.Assert(IsCacheable(parent)); 379Debug.Assert(IsCacheable(parent)); 393Debug.Assert(IsCacheable(parent));
Syntax\LineDirectiveMap.cs (5)
41Debug.Assert(directives != null); 160Debug.Assert(entries[i].CompareTo(entries[i + 1]) < 0); 174Debug.Assert(Entries.Length > 1); 179Debug.Assert( 190Debug.Assert(unmappedEndLine >= current.UnmappedLine - 1);
Syntax\LineDirectiveMap.LineMappingEntry.cs (1)
94Debug.Assert(state != PositionState.RemappedSpan);
Syntax\SeparatedSyntaxList.cs (6)
74Debug.Assert(item.IsNode, "Node missing in separated list."); 78Debug.Assert(item.IsToken, "Separator token missing in separated list."); 149Debug.Assert(node.IsList, "separated list cannot be a singleton separator"); 154Debug.Assert(green.IsToken); 443Debug.Assert(node is object); 456Debug.Assert(tr.UnderlyingNode is object);
Syntax\SeparatedSyntaxListBuilder.cs (1)
78Debug.Assert(separatorToken.Node is object);
Syntax\SyntaxDiffer.cs (13)
197System.Diagnostics.Debug.Assert(count >= 0); 445Debug.Assert(tr.UnderlyingNode is object); 451Debug.Assert(tr.UnderlyingNode is object); 457Debug.Assert(tr.UnderlyingNode is object); 466Debug.Assert(tr.UnderlyingNode is object); 477Debug.Assert(n1.UnderlyingNode is object); 488Debug.Assert(n2.UnderlyingNode is object); 588Debug.Assert(change.Range.Span.Start >= last.Range.Span.End); 611Debug.Assert(textChangeRange.Span.Start >= last.Range.Span.End); 644Debug.Assert(start >= 0); 645Debug.Assert(end >= 0); 669Debug.Assert(start >= 0); 670Debug.Assert(end >= 0);
Syntax\SyntaxList`1.cs (2)
151Debug.Assert(index == 0); 406Debug.Assert(_node == null || Count != 0);
Syntax\SyntaxListBuilder.cs (1)
144Debug.Assert(list.Node is object);
Syntax\SyntaxNavigator.cs (10)
123Debug.Assert(child.IsNode); 170Debug.Assert(child.IsNode); 190Debug.Assert(stepInto != null); 211Debug.Assert(stepInto != null); 454Debug.Assert(child.IsNode); 504Debug.Assert(child.IsNode); 532Debug.Assert(searchInsideCurrentTokenTrailingTrivia == false || stepInto != null); 562Debug.Assert(child.IsNode); 586Debug.Assert(searchInsideCurrentTokenLeadingTrivia == false || stepInto != null); 616Debug.Assert(child.IsNode);
Syntax\SyntaxNode.cs (9)
108Debug.Assert(width >= 0); 214Debug.Assert(this.IsList); 234Debug.Assert(this.IsList); 480Debug.Assert(!triviaContainsMatch(current.GetLeadingTriviaCore(), rawKind), "Should not have a match if the token doesn't even have leading trivia"); 483Debug.Assert(!triviaContainsMatch(current.GetTrailingTriviaCore(), rawKind), "Should never have a match in trailing trivia"); 765Debug.Assert(childNodeOrToken.FullSpan.Contains(position), "ChildThatContainsPosition's return value does not contain the requested position."); 1505Debug.Assert(Eof.EndPosition == position); 1522Debug.Assert(curNode.RawKind != 0); 1523Debug.Assert(curNode.FullSpan.Contains(position));
Syntax\SyntaxNode.Iterators.cs (19)
106Debug.Assert(_stack is object); 121Debug.Assert(_stack is object); 144Debug.Assert(_stack is object); 258Debug.Assert(_discriminatorStack is object); 269Debug.Assert(_discriminatorStack is object); 281Debug.Assert(_discriminatorStack is object); 290Debug.Assert(_discriminatorStack is object); 297Debug.Assert(_discriminatorStack is object); 304Debug.Assert(_discriminatorStack is object); 355Debug.Assert(_discriminatorStack is object); 366Debug.Assert(_discriminatorStack is object); 378Debug.Assert(_discriminatorStack is object); 385Debug.Assert(_discriminatorStack is object); 386Debug.Assert(_tokenStack is object); 395Debug.Assert(_discriminatorStack is object); 402Debug.Assert(_discriminatorStack is object); 409Debug.Assert(_discriminatorStack is object); 416Debug.Assert(_discriminatorStack is object); 417Debug.Assert(_tokenStack is object);
Syntax\SyntaxNodeExtensions_Tracking.cs (3)
161Debug.Assert(node is object); 186Debug.Assert(node is object); 206Debug.Assert(node is object);
Syntax\SyntaxNodeOrToken.cs (8)
47Debug.Assert(!node.Green.IsList, "node cannot be a list"); 55Debug.Assert(parent == null || !parent.Green.IsList, "parent cannot be a list"); 56Debug.Assert(token != null || (parent == null && position == 0 && index == 0), "parts must form a token"); 57Debug.Assert(token == null || token.IsToken, "token must be a token"); 58Debug.Assert(index >= 0, "index must not be negative"); 59Debug.Assert(parent == null || token != null, "null token cannot have parent"); 137Debug.Assert(UnderlyingNode is not null); 703Debug.Assert(
Syntax\SyntaxNodeOrTokenList.cs (1)
43Debug.Assert(node != null || index == 0);
Syntax\SyntaxToken.cs (4)
31Debug.Assert(parent == null || !parent.Green.IsList, "list cannot be a parent"); 32Debug.Assert(token == null || token.IsToken, "token must be a token"); 42Debug.Assert(token == null || token.IsToken, "token must be a token"); 84Debug.Assert(Node is object);
Syntax\SyntaxTokenList.cs (7)
31Debug.Assert(tokenOrList != null || (position == 0 && index == 0 && parent == null)); 32Debug.Assert(position >= 0); 33Debug.Assert(tokenOrList == null || (tokenOrList.IsToken) || (tokenOrList.IsList)); 103Debug.Assert(token.Node is object); 258Debug.Assert(this.Count >= offset + count); 271Debug.Assert(Node is object); 280Debug.Assert(node.IsList || (i == 0 && !node.IsList));
Syntax\SyntaxTokenList.Enumerator.cs (2)
95Debug.Assert(_singleNodeOrList is object); 97Debug.Assert(_current is object);
Syntax\SyntaxTokenList.Reversed.cs (2)
111Debug.Assert(_singleNodeOrList is object); 113Debug.Assert(_current is object);
Syntax\SyntaxTokenListBuilder.cs (6)
36Debug.Assert(item.Node is object); 98Debug.Assert(_nodes[0] is object); 99Debug.Assert(_nodes[1] is object); 102Debug.Assert(_nodes[0] is object); 103Debug.Assert(_nodes[1] is object); 104Debug.Assert(_nodes[2] is object);
Syntax\SyntaxTree.cs (2)
380Debug.Assert(!_lazyChecksum.IsDefault); 381Debug.Assert(_lazyHashAlgorithm != default(SourceHashAlgorithm));
Syntax\SyntaxTreeExtensions.cs (1)
85Debug.Assert(false, message);
Syntax\SyntaxTrivia.cs (2)
35Debug.Assert(this.RawKind != 0 || this.Equals(default(SyntaxTrivia))); 65Debug.Assert(node is object);
Syntax\SyntaxTriviaList.cs (2)
453Debug.Assert(Node is object); 459Debug.Assert(node.IsList || (i == 0 && !node.IsList));
Syntax\SyntaxTriviaList.Enumerator.cs (5)
57Debug.Assert(token.Node is object); 59Debug.Assert(node is object); 68Debug.Assert(token.Node is object); 83Debug.Assert(trailingGreen is object); 104Debug.Assert(_singleNodeOrList is object);
Syntax\SyntaxTriviaList.Reversed.cs (2)
108Debug.Assert(_singleNodeOrList is object); 112Debug.Assert(_current is object);
Syntax\TranslationSyntaxReference.cs (1)
37Debug.Assert(node.SyntaxTree == _reference.SyntaxTree);
Text\ChangedText.cs (4)
23Debug.Assert(newText is CompositeText || newText is SubText || newText is StringText || newText is LargeText); 25Debug.Assert(oldText != newText); 26Debug.Assert(!changeRanges.IsDefault); 254Debug.Assert(changeSets.Count > 1);
Text\CompositeText.cs (10)
31Debug.Assert(!segments.IsDefaultOrEmpty); 32Debug.Assert(segments.Length > 0); 44Debug.Assert(_segments[i].Length > 0); 441Debug.Assert(compositeText.Segments.Length > 0); 452Debug.Assert(segment.Length > 0); 455Debug.Assert(i == compositeText.Segments.Length - 1 || segment[^1] != '\r' || compositeText.Segments[i + 1][0] != '\n'); 497Debug.Assert(firstSegmentIndexInclusive <= lastSegmentIndexInclusive); 514Debug.Assert((nextSegment.Lines.Count == 1) || 526Debug.Assert(lastSegment.Lines.Count >= 1); 540Debug.Assert(resultLine.ToString().All(static c => !TextUtilities.IsAnyLineBreakCharacter(c)));
Text\LargeText.cs (1)
66Debug.Assert(longLength > 0 && longLength <= int.MaxValue); // GetMaxCharCountOrThrowIfHuge should have thrown.
Text\SourceText.cs (10)
70Debug.Assert(embeddedTextBlob.IsDefault || !checksum.IsDefault); 490Debug.Assert(0 <= span.Start && span.Start <= span.End); 635Debug.Assert(charBuffer.Length == CharBufferSize); 1011Debug.Assert(priorLineBreakLength is 1 or 2); 1246Debug.Assert(buffer1.Length == buffer2.Length); 1247Debug.Assert(buffer1.Length == CharBufferSize); 1280Debug.Assert(length <= source.Length); 1350Debug.Assert(stream.CanSeek); 1378Debug.Assert(checksumAlgorithm != SourceHashAlgorithm.None); 1379Debug.Assert(checksumAlgorithm != underlying.ChecksumAlgorithm);
Text\SourceTextStream.cs (1)
39Debug.Assert(source.Encoding != null || useDefaultEncodingIfNull);
Text\SubText.cs (2)
122Debug.Assert(_subText.UnderlyingText[underlyingSpanEnd - 1] == '\r' && _subText.UnderlyingText[underlyingSpanEnd] == '\n'); 189Debug.Assert(resultLine.ToString().All(static c => !TextUtilities.IsAnyLineBreakCharacter(c)));
Text\TextChange.cs (1)
91Debug.Assert(change.NewText is object);
Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
Text\TextLine.cs (3)
100Debug.Assert(span.Start == 0 || TextUtilities.IsAnyLineBreakCharacter(text[span.Start - 1])); 101Debug.Assert(span.End == text.Length || TextUtilities.IsAnyLineBreakCharacter(text[span.End - 1])); 102Debug.Assert(lineBreakLength is >= 0 and <= 2);
VersionHelper.cs (2)
55Debug.Assert(!allowWildcard || maxValue < ushort.MaxValue); 200Debug.Assert(revision < ushort.MaxValue);
WellKnownMembers.cs (1)
5966Debug.Assert(!descriptor.IsSpecialTypeMember); // Members of types from core library should be in the SpecialMember set instead.
WellKnownTypes.cs (6)
819Debug.Assert(expectedName == (startingOffset + i).ToString()); 842Debug.Assert(typeId != WellKnownType.ExtSentinel); 848Debug.Assert(typeId != WellKnownType.ExtSentinel); 871Debug.Assert(WellKnownType.First != 0); 878Debug.Assert(invokeArgumentCount >= 0); 887Debug.Assert(invokeArgumentCount >= 0);
Xml\XmlCharType.cs (8)
1125Debug.Assert(str != null); 1126Debug.Assert(startPos + len <= str.Length); 1127Debug.Assert(startPos <= str.Length); 1141Debug.Assert(chars != null); 1142Debug.Assert(startPos + len <= chars.Length); 1143Debug.Assert(startPos <= chars.Length); 1173Debug.Assert(start <= end); 1182Debug.Assert(start <= end);
XmlFileResolver.cs (2)
59Debug.Assert(resolvedPath == null || PathUtilities.IsAbsolute(resolvedPath)); 69Debug.Assert(resolvedPath == null || PathUtilities.IsAbsolute(resolvedPath));
Microsoft.CodeAnalysis.Analyzers (584)
MetaAnalyzers\CompareSymbolsCorrectlyAnalyzer.cs (1)
241Debug.Assert(destinationTypeIndex < method.TypeArguments.Length);
MetaAnalyzers\CompilerExtensionStrictApiAnalyzer.cs (1)
173Debug.Assert(attribute.ApplicationSyntaxReference is not null,
MetaAnalyzers\CompilerExtensionTargetFrameworkAnalyzer.cs (1)
122Debug.Assert(attribute.ApplicationSyntaxReference is not null,
MetaAnalyzers\DiagnosticAnalyzerAPIUsageAnalyzer.cs (3)
106Debug.Assert(added); 135Debug.Assert(SymbolEqualityComparer.Default.Equals(typeToProcess.ContainingAssembly, declaredType.ContainingAssembly)); 136Debug.Assert(namedTypesToAccessedTypesMap.ContainsKey(typeToProcess));
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (2)
42Debug.Assert(HasResxAdditionalFiles(options)); 43Debug.Assert(!resourceFileName.EndsWith(".resx", StringComparison.OrdinalIgnoreCase));
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (5)
693Debug.Assert(diagnostic.Id is DiagnosticIds.DefineDiagnosticTitleCorrectlyRuleId or 963Debug.Assert(IsMultiSentences(s)); 973Debug.Assert(EndsWithPeriod(s)); 982Debug.Assert(ContainsLineReturn(s)); 1023Debug.Assert(HasLeadingOrTrailingWhitespaces(s));
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (4)
92Debug.Fail($"Unsupported diagnostic ID {diagnostic.Id}"); 337Debug.Fail($"Unexpected line {lineText}"); 363Debug.Fail($"Unexpected line {lineText}"); 413Debug.Assert(newRuleEntriesToAdd == null || newRuleEntriesToAdd.Count == 0);
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.FixAllProvider.cs (1)
61Debug.Fail($"Unknown FixAllScope '{fixAllContext.Scope}'");
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs (2)
39Debug.Assert(fixAllContext.CodeActionEquivalenceKey.EndsWith(AdditionalDocumentEquivalenceKeySuffix, StringComparison.Ordinal)); 74Debug.Fail($"Unknown FixAllScope '{fixAllContext.Scope}'");
MetaAnalyzers\RegisterActionAnalyzer.cs (1)
540Debug.Assert(IsContextType(contextParameter.Type, _codeBlockStartAnalysisContext, _compilationStartAnalysisContext, _operationBlockStartAnalysisContext));
MetaAnalyzers\ReleaseTrackingHelper.cs (1)
482Debug.Assert(kind is ReleaseTrackingRuleEntryKind.New or ReleaseTrackingRuleEntryKind.Removed);
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 160Debug.Assert(cfg.Parent != null); 161Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 162Debug.Assert(parentAnalysisData != null); 319Debug.Assert(lambdaOrLocalFunctionCfg != null); 329Debug.Assert(anonymousFunctionCfg != null); 338Debug.Assert(localFunction.IsLocalFunction()); 346Debug.Assert(localFunctionCfg != null); 362Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 503Debug.Assert(localFunction.IsLocalFunction()); 504Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 594Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\roslyn\src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\roslyn\src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (13)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 280Debug.Assert(_value is V, "Item must be a a V"); 309Debug.Assert(this.Count >= 1); 315Debug.Assert(_value is V, "_value must be a V"); 343Debug.Assert(_count >= 1);
src\roslyn\src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
410Debug.Assert(!IsUnixLikePlatform); 428Debug.Assert(IsAbsolute(root)); 884Debug.Assert(parts[toSkip - 1] == string.Empty);
src\roslyn\src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 87Debug.Assert(tail != null); 98Debug.Assert(this != Empty); 108Debug.Assert(this != Empty);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (2)
151Debug.Assert(e.InnerException is object); 153Debug.Assert(false, "Unreachable");
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\roslyn\src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
85Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\roslyn\src\Dependencies\Collections\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\roslyn\src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\roslyn\src\Dependencies\Collections\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\roslyn\src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\roslyn\src\Dependencies\Collections\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\roslyn\src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (11)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 488Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 495Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 528Debug.Assert(_completionRefCount == 0, $"Expected {nameof(_completionRefCount)} == 0, got {_completionRefCount}"); 540Debug.Assert(!Cancellation.IsCancellationRequested); 556Debug.Assert(taskSet, "Complete should only be called once.");
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
26Debug.Assert(childrenCount != 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
495Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 507Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (7)
210Debug.Assert(isInsideAnonymousObjectInitializer == 288Debug.Assert(success); 289Debug.Assert(cfg != null); 320Debug.Assert(operation.Kind is OperationKind.None or OperationKind.Attribute, $"Unexpected root operation kind: {operation.Kind}"); 333Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 495Debug.Assert(parameterIndex >= 0); 496Debug.Assert(parameterIndex < arguments.Length);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
61Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (12)
80Debug.Assert(expectedValueText == actualValueText); 86Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 90Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 99Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 108Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 147Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics."); 153Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (4)
100Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 101Debug.Assert(_span.End == virtualChars._span.Start); 111Debug.Assert(chars1._leafCharacters == chars2._leafCharacters); 175Debug.Assert(chars1._tokenStart == chars2._tokenStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
119Debug.Fail("Unhandled declaration pattern context"); 153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
248Debug.Fail("Could not find common ancestor."); 271Debug.Fail("Could not find common ancestor.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 216Debug.Assert(branch.Destination == null); 221Debug.Assert(branch.Destination == null); 227Debug.Assert(branch.Destination != null); 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 262Debug.Assert(enclosing.NestedRegions[0] == region); 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 325Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 337Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 375Debug.Assert(startAt > 0); 376Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 391Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\LValueFlowCaptureProvider.cs (1)
76Debug.Assert(kind == FlowCaptureKind.LValueAndRValueCapture || !rvalueFlowCaptureIds.Contains(captureId), "Flow capture used as both an r-value and an l-value, but with incorrect flow capture kind");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (1)
411Debug.Assert(s_serializationVersion == 5, "After increasing the serialization version, add an upgrade path here.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (5)
92Debug.Assert(BitConverter.IsLittleEndian); 185Debug.Assert(value == null || !value.GetType().GetTypeInfo().IsEnum, "Enum should not be written with WriteValue. Write them as ints instead."); 195Debug.Assert(!typeInfo.IsEnum, "Enums should not be written with WriteObject. Write them out as integers instead."); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (18)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1072Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1073Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1157Debug.Assert(parameter1.HasExplicitDefaultValue, "Expected all unspecified parameter to have default values"); 1158Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\LightweightOverloadResolution.cs (3)
114Debug.Assert(foundParameterIndex < parameters.Length); 239Debug.Assert(parameterIndex >= 0); 240Debug.Assert(parameterIndex < method.Parameters.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (4)
34Debug.Assert(span.Start >= start, "Bad generator."); 86Debug.Assert(current < length); 108Debug.Assert(current < length); 127Debug.Assert(char.IsUpper(identifier[current - 1]));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
155Debug.Assert(similarityWeight <= _threshold);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
342Debug.Assert(type is null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
53Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 58Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
26Debug.Fail("Unhandled symbol kind in RequiresUnsafeModifierVisitor: " + node.Kind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
540Debug.Assert(isTypeParameter2);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
60Debug.Fail("FixAllScope.ContainingMember and FixAllScope.ContainingType are not supported in CodeStyle layer");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
206Debug.Assert(false, message + ". " + diagnostics);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
34Debug.Assert(diagnostic != null); 88Debug.Assert(analyzerConfigPath != null); 89Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\AbstractSemanticModelReuseLanguageService.cs (4)
102Debug.Fail("Previous container didn't map back to a normal accessor container."); 111Debug.Fail("Accessor count shouldn't have changed as there were no top level edits."); 132Debug.Fail("Member count shouldn't have changed as there were no top level edits."); 139Debug.Fail("Child at indicated index should be a node as there were no top level edits.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (3)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel); 227Debug.Assert(replacedParent.GetAnnotatedNodesAndTokens(annotation).Count() == 1); 246Debug.Assert(newRoot.GetAnnotatedNodesAndTokens(marker).Count() == 1);
Microsoft.CodeAnalysis.AnalyzerUtilities (977)
src\1e7e9f16bf7f1945\ValueContentAnalysis.CoreAnalysisDataDomain.cs (2)
52Debug.Assert(Compare(forwardEdgeAnalysisData, resultMap) <= 0); 53Debug.Assert(Compare(backEdgeAnalysisData, resultMap) <= 0);
src\1e7e9f16bf7f1945\ValueContentAnalysis.ValueContentAnalysisDomain.cs (1)
35Debug.Assert(forwardEdgeAnalysisData.IsReachableBlockData == backEdgeAnalysisData.IsReachableBlockData);
src\2e2796bccd1466f6\TaintedDataAnalysis.TaintedDataOperationVisitor.cs (5)
142Debug.Fail("Can we have a tainted data parameter with no syntax references?"); 328Debug.Fail("Are the tainted data sources misconfigured?"); 367Debug.Fail("Are the tainted data sources misconfigured?"); 406Debug.Fail("Are the tainted data sanitizers misconfigured?"); 466Debug.Assert(!this.TryGetInterproceduralAnalysisResult(invocationOperation, out _));
src\66dd3055a1c91c38\PointsToAnalysis.CorePointsToAnalysisDataDomain.cs (2)
122Debug.Assert(Compare(forwardEdgeAnalysisData.CoreAnalysisData, resultMap) <= 0); 123Debug.Assert(Compare(backEdgeAnalysisData.CoreAnalysisData, resultMap) <= 0);
src\66dd3055a1c91c38\PointsToAnalysis.PointsToDataFlowOperationVisitor.cs (16)
91Debug.Assert(!ShouldBeTracked(analysisEntity)); 92Debug.Assert(!CurrentAnalysisData.TryGetValue(analysisEntity, out var existingValue) || existingValue == PointsToAbstractValue.NoLocation); 177Debug.Assert(ShouldBeTracked(analysisEntity) || !HasAbstractValue(analysisEntity)); 183Debug.Assert(value == _defaultPointsToValueGenerator.GetOrCreateDefaultValue(analysisEntity)); 184Debug.Assert(!CurrentAnalysisData.TryGetValue(analysisEntity, out var currentValue) || 254Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData == null); 282Debug.Assert(operation.Type == null || !operation.Type.IsNonNullableValueType() || defaultValue == PointsToAbstractValue.NoLocation); 289Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 451Debug.Assert(!targetAnalysisData.HasAbstractValue(key)); 452Debug.Assert(!sourceAnalysisData.HasAbstractValue(key)); 514Debug.Assert(IsValidValueForPredicateAnalysis(nullState) || nullState == NullAbstractValue.Invalid); 563Debug.Assert(IsValidValueForPredicateAnalysis(value)); 791Debug.Assert(value.NullState == NullAbstractValue.NotNull || DataFlowAnalysisContext.InterproceduralAnalysisData != null); 893Debug.Assert(operation.Initializer == null || initializerValue == pointsToAbstractValue); 1193Debug.Assert(!inference.AlwaysSucceed || !inference.AlwaysFail); 1214Debug.Assert(!inference.IsUnboxing);
src\683181b2796de991\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (7)
34Debug.Assert(analysisContext.OwningSymbol.Kind == SymbolKind.Method); 35Debug.Assert(analysisContext.PointsToAnalysisResult != null); 176Debug.Assert(_hazardousParameterUsageBuilder != null); 193Debug.Assert(IsNotOrMaybeValidatedLocation(location)); 290Debug.Assert(!targetMethod.IsLambdaOrLocalFunctionOrDelegate()); 319Debug.Assert(!targetMethod.IsVirtual && !targetMethod.IsOverride); 358Debug.Assert(targetMethod.MethodKind is MethodKind.LambdaMethod or MethodKind.LocalFunction);
src\683181b2796de991\ParameterValidationAnalysisContext.cs (3)
76Debug.Assert(pointsToAnalysisResult != null); 77Debug.Assert(copyAnalysisResult == null); 78Debug.Assert(valueContentAnalysisResult == null);
src\97c55a67c449f67c\GlobalFlowStateAnalysis.GlobalFlowStateAnalysisValueSetDomain.cs (5)
78Debug.Assert(value1.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 79Debug.Assert(value2.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 144Debug.Assert(value1.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 145Debug.Assert(value2.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 228Debug.Assert(value1.Height == value2.Height);
src\97c55a67c449f67c\GlobalFlowStateDataFlowOperationVisitor.cs (1)
86Debug.Assert(input.ContainsKey(GlobalEntity));
src\97c55a67c449f67c\GlobalFlowStateValueSetFlowOperationVisitor.cs (2)
45Debug.Assert(HasPredicatedGlobalState || !negate); 63Debug.Assert(HasPredicatedGlobalState || value.Parents.IsEmpty);
src\a03b2aad21e28a8a\PropertySetAnalysis.PropertySetDataFlowOperationVisitor.cs (12)
60Debug.Assert(analysisContext.PointsToAnalysisResult != null); 78Debug.Assert(this.TrackedTypeSymbols.Any()); 173Debug.Assert(this.DataFlowAnalysisContext.ValueContentAnalysisResult != null); 187Debug.Fail("Unhandled ConstructorMapper"); 271Debug.Fail($"Unhandled PointsToAbstractValue: Kind = {pointsToAbstractValue.Kind}, NullState = {pointsToAbstractValue.NullState}"); 300Debug.Assert(this.DataFlowAnalysisContext.ValueContentAnalysisResult != null); 306Debug.Fail("Unhandled PropertyMapper"); 381Debug.Fail("Expected to have tracked assignment operations for a given location"); 408Debug.Fail("Expected to have tracked assignment operations with locations"); 431Debug.Fail("Expected to have tracked assignment operations with unknown PointsTo"); 440Debug.Fail($"Unhandled PointsToAbstractValue: Kind = {pointsToAbstractValue.Kind}, NullState = {pointsToAbstractValue.NullState}"); 722Debug.Fail("Can LValues FlowCaptureReferences have more than one operation?");
src\a172c07bebba4cd8\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (8)
36Debug.Assert(IDisposableNamedType != null); 37Debug.Assert(CollectionNamedTypes.All(ct => ct.TypeKind == TypeKind.Interface)); 38Debug.Assert(analysisContext.DisposeOwnershipTransferLikelyTypes != null); 39Debug.Assert(analysisContext.PointsToAnalysisResult != null); 181Debug.Assert(!escapedLocations.IsEmpty); 182Debug.Assert(parameter.RefKind != RefKind.None); 190Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 427Debug.Assert(disposedState == DisposeAbstractValue.NotDisposed);
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 160Debug.Assert(cfg.Parent != null); 161Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 162Debug.Assert(parentAnalysisData != null); 319Debug.Assert(lambdaOrLocalFunctionCfg != null); 329Debug.Assert(anonymousFunctionCfg != null); 338Debug.Assert(localFunction.IsLocalFunction()); 346Debug.Assert(localFunctionCfg != null); 362Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 503Debug.Assert(localFunction.IsLocalFunction()); 504Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 594Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\roslyn\src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\roslyn\src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (13)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 280Debug.Assert(_value is V, "Item must be a a V"); 309Debug.Assert(this.Count >= 1); 315Debug.Assert(_value is V, "_value must be a V"); 343Debug.Assert(_count >= 1);
src\roslyn\src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
410Debug.Assert(!IsUnixLikePlatform); 428Debug.Assert(IsAbsolute(root)); 884Debug.Assert(parts[toSkip - 1] == string.Empty);
src\roslyn\src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 87Debug.Assert(tail != null); 98Debug.Assert(this != Empty); 108Debug.Assert(this != Empty);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (2)
151Debug.Assert(e.InnerException is object); 153Debug.Assert(false, "Unreachable");
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\roslyn\src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
85Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\roslyn\src\Dependencies\Collections\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\roslyn\src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\roslyn\src\Dependencies\Collections\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\roslyn\src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\roslyn\src\Dependencies\Collections\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\roslyn\src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (11)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 488Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 495Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 528Debug.Assert(_completionRefCount == 0, $"Expected {nameof(_completionRefCount)} == 0, got {_completionRefCount}"); 540Debug.Assert(!Cancellation.IsCancellationRequested); 556Debug.Assert(taskSet, "Complete should only be called once.");
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
26Debug.Assert(childrenCount != 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
495Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 507Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (7)
210Debug.Assert(isInsideAnonymousObjectInitializer == 288Debug.Assert(success); 289Debug.Assert(cfg != null); 320Debug.Assert(operation.Kind is OperationKind.None or OperationKind.Attribute, $"Unexpected root operation kind: {operation.Kind}"); 333Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 495Debug.Assert(parameterIndex >= 0); 496Debug.Assert(parameterIndex < arguments.Length);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
61Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\Extensions\BasicBlockExtensions.cs (1)
199Debug.Assert(ordinal < basicBlock.Ordinal);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\Extensions\ControlFlowConditionKindExtensions.cs (1)
22Debug.Fail($"Unsupported conditional kind: '{controlFlowConditionKind}'");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAbstractValue.cs (10)
24Debug.Assert(analysisEntities.IsEmpty != kind.IsKnown()); 25Debug.Assert(kind != CopyAbstractValueKind.KnownReferenceCopy || analysisEntities.All(a => !a.Type.IsValueType)); 41Debug.Assert(!kind.IsKnown()); 54Debug.Assert(!analysisEntities.IsEmpty); 59Debug.Assert(AnalysisEntities.Contains(entityToRemove)); 60Debug.Assert(AnalysisEntities.Count > 1); 61Debug.Assert(Kind.IsKnown()); 68Debug.Assert(entitiesToRemove.All(AnalysisEntities.Contains)); 69Debug.Assert(AnalysisEntities.Count > 1); 70Debug.Assert(Kind.IsKnown());
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysis.CopyAbstractValueDomain.cs (4)
73Debug.Assert(value1.Kind.IsKnown()); 74Debug.Assert(value2.Kind.IsKnown()); 83Debug.Assert(_entitiesDomain.Equals(mergedEntities, value1.AnalysisEntities)); 88Debug.Assert(_entitiesDomain.Equals(mergedEntities, value2.AnalysisEntities));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysis.CopyDataFlowOperationVisitor.cs (7)
157Debug.Assert(ReferenceEquals(sourceCopyAnalysisData, targetCopyAnalysisData) || fromPredicateKind.HasValue); 181Debug.Assert(existingValue.AnalysisEntities.Contains(analysisEntity)); 319Debug.Assert(operation.Parameter?.RefKind is RefKind.Ref or RefKind.Out); 453Debug.Assert(SymbolEqualityComparer.Default.Equals(throwBranchWithExceptionType.ExceptionType, ExceptionNamedType)); 545Debug.Assert(copyValue.AnalysisEntities.Contains(key)); 546Debug.Assert(predicate == null || copyValue.AnalysisEntities.All(predicate)); 628Debug.Assert(!inference.AlwaysSucceed || !inference.AlwaysFail);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysis.cs (1)
41Debug.Fail("Expected non-null CFG");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysisData.cs (10)
52Debug.Assert(IsReachableBlockData || !data.IsReachableBlockData); 93Debug.Assert(HasPredicatedData); 169Debug.Assert(newCopyEntities.SetEquals(currentValue.AnalysisEntities)); 180Debug.Assert(predicatedData.All(kvp => kvp.Value.AnalysisEntities.IsSubsetOf(coreAnalysisData[kvp.Key].AnalysisEntities))); 206Debug.Assert(!coreCopyAnalysisData.IsDisposed); 212Debug.Assert(kvp.Value.AnalysisEntities.Contains(kvp.Key)); 216Debug.Assert(map[analysisEntity] == kvp.Value); 228Debug.Assert(kvp.Value.AnalysisEntities.Contains(defaultCopyValyeEntity)); 229Debug.Assert(map.ContainsKey(defaultCopyValyeEntity)); 239Debug.Assert(!analysisEntity.HasUnknownInstanceLocation, "Don't track entities if do not know about it's instance location");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAbstractValue.cs (6)
26Debug.Assert(kind != DisposeAbstractValueKind.Disposed); 38Debug.Assert(Kind != DisposeAbstractValueKind.NotDisposable); 45Debug.Assert(Kind != DisposeAbstractValueKind.NotDisposable); 46Debug.Assert(Kind != DisposeAbstractValueKind.Unknown); 60Debug.Assert(disposingOrEscapingOperations.IsEmpty); 66Debug.Assert(!disposingOrEscapingOperations.IsEmpty);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysis.cs (2)
58Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, wellKnownTypeProvider.Compilation)); 98Debug.Assert(wellKnownTypeProvider.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemIDisposable, out _));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysis.DisposeAbstractValueDomain.cs (3)
83Debug.Assert(!mergedDisposingOperations.IsEmpty); 89Debug.Assert(!value1.DisposingOrEscapingOperations.IsEmpty || !value2.DisposingOrEscapingOperations.IsEmpty); 156Debug.Fail($"Unhandled dispose value kind merge: {value1.Kind} and {value2.Kind}");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysisContext.cs (3)
99Debug.Assert(pointsToAnalysisResult != null); 100Debug.Assert(copyAnalysisResult == null); 101Debug.Assert(valueContentAnalysisResult == null);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateAnalysisValueSet.cs (13)
33Debug.Assert((!analysisValues.IsEmpty || !parents.IsEmpty) == (kind == GlobalFlowStateAnalysisValueSetKind.Known)); 34Debug.Assert(analysisValues.All(value => value != null)); 35Debug.Assert(parents.All(parent => parent != null)); 36Debug.Assert(height >= 0); 37Debug.Assert(height == 0 || kind == GlobalFlowStateAnalysisValueSetKind.Known); 38Debug.Assert(height == 0 == parents.IsEmpty); 51Debug.Assert(!analysisValues.IsEmpty || !parents.IsEmpty); 65Debug.Assert(Kind == GlobalFlowStateAnalysisValueSetKind.Known); 89Debug.Assert(Kind != GlobalFlowStateAnalysisValueSetKind.Unknown); 107Debug.Assert(Kind == GlobalFlowStateAnalysisValueSetKind.Known); 135Debug.Assert(AnalysisValues.Count > 1); 136Debug.Assert(parentsBuilder.Count > 1); 145Debug.Assert(parents.Count > 0);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ParameterValidationAnalysis\ParameterValidationAnalysis.cs (1)
41Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, compilation));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAbstractValue.cs (18)
33Debug.Assert(!locations.IsEmpty); 34Debug.Assert(locations.All(location => !location.IsNull) || nullState != NullAbstractValue.NotNull); 35Debug.Assert(nullState != NullAbstractValue.Undefined); 36Debug.Assert(nullState != NullAbstractValue.Invalid); 37Debug.Assert(!locations.Any(l => l.IsAnalysisEntityDefaultLocation && l.AnalysisEntity!.HasUnknownInstanceLocation)); 38Debug.Assert(locations.Count <= LocationThreshold); 48Debug.Assert(!lValueCapturedOperations.IsEmpty); 58Debug.Assert(kind != PointsToAbstractValueKind.KnownLocations); 59Debug.Assert(kind != PointsToAbstractValueKind.KnownLValueCaptures); 69Debug.Assert(!location.IsNull, "Use 'PointsToAbstractValue.NullLocation' singleton"); 70Debug.Assert(!location.IsNoLocation, "Use 'PointsToAbstractValue.NoLocation' singleton"); 82Debug.Assert(!locations.IsEmpty); 114Debug.Assert(!lValueCapturedOperations.IsEmpty); 120Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 147Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 164Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 165Debug.Assert(NullState != NullAbstractValue.Null); 177Debug.Assert(Locations.All(location => !location.IsNull));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.cs (2)
73Debug.Fail("Expected non-null CFG"); 100Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.PointsToAbstractValueDomain.cs (5)
127Debug.Assert(value2.Kind == PointsToAbstractValueKind.KnownLValueCaptures); 133Debug.Assert(value1.Kind == PointsToAbstractValueKind.KnownLocations); 134Debug.Assert(value2.Kind == PointsToAbstractValueKind.KnownLocations); 141Debug.Assert(Compare(value1, result) <= 0); 142Debug.Assert(Compare(value2, result) <= 0);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.PointsToAnalysisDomain.cs (1)
39Debug.Assert(forwardEdgeAnalysisData.IsReachableBlockData == backEdgeAnalysisData.IsReachableBlockData);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisContext.cs (3)
42Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None); 76Debug.Assert(pointsToAnalysisResult == null); 77Debug.Assert(valueContentAnalysisResult == null);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisData.cs (6)
76Debug.Assert(IsReachableBlockData || !data.IsReachableBlockData); 108Debug.Assert(key.CaptureId == null); 126Debug.Assert(!corePointsToAnalysisData.IsDisposed); 141Debug.Assert(value.Kind != PointsToAbstractValueKind.Undefined); 142Debug.Assert(!key.IsLValueFlowCaptureEntity || value.Kind == PointsToAbstractValueKind.KnownLValueCaptures); 143Debug.Assert(PointsToAnalysis.ShouldBeTracked(key, PointsToAnalysisKind.Complete, isDisposable));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\TrackedEntitiesBuilder.cs (2)
33Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None); 50Debug.Assert(analysisEntity.ShouldBeTrackedForPointsToAnalysis(PointsToAnalysisKind));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAbstractValue.cs (1)
154Debug.Assert(index >= 0);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAbstractValue.ValuePool.cs (1)
33Debug.Assert(values[i] == i, $"{nameof(PropertySetAbstractValueKind)} isn't a contiguous enum starting at 0");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysis.cs (2)
203Debug.Assert(success); 206Debug.Fail("Expected non-null CFG");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysisContext.cs (2)
115Debug.Assert(pointsToAnalysisResult != null); 116Debug.Assert(copyAnalysisResult == null);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAbstractValue.cs (3)
77Debug.Assert(value1.Kind == TaintedDataAbstractValueKind.Tainted); 78Debug.Assert(value2.Kind == TaintedDataAbstractValueKind.Tainted); 95Debug.Assert(value.Kind == TaintedDataAbstractValueKind.Tainted);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysis.cs (1)
56Debug.Fail("Expected non-null CFG");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysisContext.cs (2)
58Debug.Assert(pointsToAnalysisResult != null); 81Debug.Assert(pointsToAnalysisResult != null);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataConfig.cs (4)
200Debug.Fail($"SinkKind {sinkKind} entry missing from {typeof(T).Name} map"); 251Debug.Fail($"Unhandled SinkKind {sinkKind}"); 307Debug.Fail($"Unhandled SinkKind {sinkKind}"); 362Debug.Fail($"Unhandled SinkKind {sinkKind}");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataSymbolMap.cs (1)
117Debug.Fail("Expected non-null 'namedTypeSymbol'");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAbstractValue.cs (4)
204Debug.Assert(value1 == ValueContainsNonLiteralState.No); 205Debug.Assert(value2 == ValueContainsNonLiteralState.No); 241Debug.Assert(IsLiteralState); 242Debug.Assert(value2.IsLiteralState);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAnalysis.cs (1)
64Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, wellKnownTypeProvider.Compilation));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAnalysisContext.cs (1)
82Debug.Assert(valueContentAnalysisResult == null);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractDataFlowAnalysisContext.cs (5)
46Debug.Assert(owningSymbol.Kind is SymbolKind.Method or 50Debug.Assert(Equals(owningSymbol.OriginalDefinition, owningSymbol)); 51Debug.Assert(pointsToAnalysisResult == null || 53Debug.Assert(copyAnalysisResult == null || 55Debug.Assert(valueContentAnalysisResult == null ||
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractDomain.cs (1)
59Debug.Fail("Non-monotonic merge");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractLocation.cs (4)
37Debug.Assert(isSpecialSingleton ^ (locationType != null)); 50Debug.Assert(creation != null ^ symbol != null ^ analysisEntity != null ^ captureId != null); 51Debug.Assert(locationType != null); 129Debug.Assert(Creation != null);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractLocationDataFlowOperationVisitor.cs (5)
25Debug.Assert(analysisContext.PointsToAnalysisResult != null); 43Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData != null); 69Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 99Debug.Assert(Equals(analysisEntity.Symbol, parameter)); 109Debug.Assert(SymbolEqualityComparer.Default.Equals(analysisEntity.Symbol, parameter));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AddressSharedEntitiesProvider.cs (1)
85Debug.Assert(builder.All(e => !e.HasUnknownInstanceLocation));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntity.cs (16)
49Debug.Assert(!indices.IsDefault); 50Debug.Assert(symbol != null || !indices.IsEmpty || instanceReferenceOperationSyntax != null || captureId.HasValue); 51Debug.Assert(parent == null || parent.Type.HasValueCopySemantics() || !indices.IsEmpty); 52Debug.Assert(entityForInstanceLocation == null || parent == null); 53Debug.Assert(entityForInstanceLocation == null || location.Kind == PointsToAbstractValueKind.KnownLocations); 72Debug.Assert(symbol != null || !indices.IsEmpty); 79Debug.Assert(instanceReferenceOperation != null); 97Debug.Assert(symbol != null || !indices.IsEmpty); 98Debug.Assert(parent == null || parent.InstanceLocation == instanceLocation); 99Debug.Assert(entityForInstanceLocation == null || instanceLocation.Kind == PointsToAbstractValueKind.KnownLocations); 119Debug.Assert(instanceLocation.Locations.Count == 1); 120Debug.Assert(instanceLocation.Locations.Single().Creation == null); 121Debug.Assert(Equals(instanceLocation.Locations.Single().Symbol, typeSymbol)); 128Debug.Assert(EqualsIgnoringInstanceLocation(analysisEntityToMerge)); 129Debug.Assert(!InstanceLocation.Equals(analysisEntityToMerge.InstanceLocation)); 160Debug.Assert(Parent == null || result);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityBasedPredicateAnalysisData.cs (5)
44Debug.Assert(data1.IsReachableBlockData == data2.IsReachableBlockData); 75Debug.Assert(baseCompareResult < 0, "Non-monotonic Merge function"); 80Debug.Assert(coreAnalysisDataCompareResult <= 0, "Non-monotonic Merge function"); 95Debug.Assert(!CoreAnalysisData.IsDisposed); 96AssertValidPredicatedAnalysisData(map => Debug.Assert(!map.IsDisposed));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityDataFlowOperationVisitor.cs (21)
34Debug.Assert(!analysisContext.PredicateAnalysis || SupportsPredicateAnalysis); 66Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 82Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 103Debug.Assert(locals.Any() || flowCaptures.Any()); 119Debug.Fail("TryCreateForSymbolDeclaration failed"); 157Debug.Assert(analysisEntity.Symbol is IParameterSymbol parameter && parameter.IsParams); 258Debug.Assert(success || assignedValueEntity == null); 280Debug.Assert(addressSharedCopyValue.AnalysisEntities.Contains(targetAnalysisEntity)); 294Debug.Assert(SymbolEqualityComparer.Default.Equals(analysisEntity.Symbol, parameter)); 307Debug.Assert(Equals(analysisEntity.Symbol, parameter)); 328Debug.Assert(HasPointsToAnalysisResult); 329Debug.Assert(analysisEntity.Type.HasValueCopySemantics()); 337Debug.Assert(HasPointsToAnalysisResult); 362Debug.Assert(HasPointsToAnalysisResult); 363Debug.Assert(targetAnalysisEntity.Type.HasValueCopySemantics()); 411Debug.Assert(analysisEntity.Type.HasValueCopySemantics()); 571Debug.Assert(ShouldProcessPointsToValue(pointsToValue)); 688Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData != null); 742Debug.Assert(throwBranchWithExceptionType.ExceptionType.Equals(ExceptionNamedType)); 769Debug.Assert(tupleOperation.Elements.Length == tupleElementEntities.Length); 776Debug.Assert(tupleElementEntity.Symbol is IFieldSymbol field);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityFactory.cs (8)
313Debug.Assert(symbol.Kind is SymbolKind.Local or SymbolKind.Parameter or SymbolKind.Field or SymbolKind.Property); 352Debug.Assert(parentTupleOperationOpt.Elements.Length == parentTupleElementEntities.Length); 372Debug.Assert(parentEntity.InstanceLocation == instanceLocation); 399Debug.Assert(!indices.IsEmpty); 421Debug.Assert(_interproceduralCallStack.Last().Descendants().Contains(flowCaptureOrReference)); 425Debug.Assert(_controlFlowGraph.DescendantOperations().Contains(flowCaptureOrReference)); 442Debug.Assert(symbol != null || !indices.IsEmpty); 519Debug.Assert(symbol.Kind == SymbolKind.Local || symbol.Kind == SymbolKind.Parameter || symbol.IsStatic || symbol.IsLambdaOrLocalFunction());
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityMapAbstractDomain.cs (16)
99Debug.Assert(!map2.ContainsKey(key1)); 100Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 164Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 165Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 185Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 186Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 194Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 206Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 213Debug.Assert(!map1.ContainsKey(newKey)); 214Debug.Assert(!map2.ContainsKey(newKey)); 226Debug.Assert(Compare(map1, resultMap) <= 0); 227Debug.Assert(Compare(map2, resultMap) <= 0); 247Debug.Assert(values.Count > 0); 259Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 260Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 267Debug.Assert(isNewKey == (!map1.ContainsKey(key) && !map2.ContainsKey(key)));
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysis.cs (19)
233Debug.Assert(tryRegion.Kind == ControlFlowRegionKind.Try); 260Debug.Assert(needsAtLeastOnePass); 267Debug.Assert(!currentInfeasibleData.IsDisposed); 278Debug.Assert(enclosingTryAndCatchRegion.Kind == ControlFlowRegionKind.TryAndCatch); 279Debug.Assert(block.EnclosingRegion.Kind is ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter); 280Debug.Assert(block.EnclosingRegion.FirstBlockOrdinal == block.Ordinal); 281Debug.Assert(!catchBlockInput.IsDisposed); 352Debug.Assert(finallyRegion.Kind == ControlFlowRegionKind.Finally); 380Debug.Assert(!ReferenceEquals(dataToDispose, newSuccessorInput)); 428Debug.Assert(compare <= 0, "The newly computed abstract value must be greater or equal than the previous one."); 439Debug.Assert(currentSuccessorInput == null || AnalysisDomain.Compare(currentSuccessorInput, newSuccessorInput) <= 0); 455Debug.Assert(dominatorBlockOrdinal >= block.Ordinal); 456Debug.Assert(dominatorBlockOrdinal >= successorBlock.Ordinal); 470Debug.Assert(IsValidWorklistState()); 492Debug.Assert(tryAndCatchRegion.Kind == ControlFlowRegionKind.TryAndCatch); 537Debug.Assert(compare <= 0, "The newly computed abstract value must be greater or equal than the previous one."); 627Debug.Assert(basicBlock.EnclosingRegion.Kind == ControlFlowRegionKind.Finally); 729Debug.Assert(finallyRegion.Kind == ControlFlowRegionKind.Finally); 783Debug.Assert(builder[block] == null || AnalysisDomain.Compare(builder[block]!, newInput) <= 0, "Non-monotonic update");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysisResult.cs (4)
108Debug.Assert(operation.GetRoot() != ControlFlowGraph.OriginalOperation, 118Debug.Assert(operation.GetAncestor<IBlockOperation>(OperationKind.Block, predicate: b => b.Parent == null) == null); 159Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 170Debug.Assert(lambdaOrLocalFunctionOperation.Kind is OperationKind.AnonymousFunction or OperationKind.LocalFunction);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (103)
177Debug.Assert(!_currentAnalysisData.IsDisposed); 182Debug.Assert(!value.IsDisposed); 191Debug.Assert(_currentBasicBlock != null); 234Debug.Assert(ExceptionNamedType != null); 430Debug.Assert(_pendingArgumentsToReset.Count == 0); 431Debug.Assert(_pendingArgumentsToPostProcess.Count == 0); 551Debug.Assert(entryBlock.Kind == BasicBlockKind.Entry); 564Debug.Assert(result); 584Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit); 634Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 635Debug.Assert(DataFlowAnalysisContext.ControlFlowGraph.LocalFunctions.Contains(localFunction)); 643Debug.Assert(_visitedLambdas.Contains(lambda)); 651Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit); 745Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None); 788Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None); 823Debug.Assert(implicitTaskPointsToValueOpt.Kind == PointsToAbstractValueKind.KnownLocations); 852Debug.Assert(ExecutingExceptionPathsAnalysisPostPass); 853Debug.Assert(!SkipExceptionPathsAnalysisPostPass); 932Debug.Assert(ExecutingExceptionPathsAnalysisPostPass); 933Debug.Assert(!SkipExceptionPathsAnalysisPostPass); 962Debug.Assert(locals.Any() || flowCaptures.Any()); 1004/// Checks if the method is an overload of the <see cref="Debug.Assert(bool)"/> method. 1007/// <returns>True if the method is an overlaod of the <see cref="Debug.Assert(bool)"/> method.</returns> 1141Debug.Assert(parameterEntity.Symbol?.Kind == SymbolKind.Parameter); 1154Debug.Assert(CurrentBasicBlock.Kind == BasicBlockKind.Entry); 1302Debug.Fail($"Unexpected 'null' target type for '{operation.Syntax}'"); 1358Debug.Assert(PredicateAnalysis); 1364Debug.Assert(PredicateAnalysis); 1388Debug.Assert(PredicateAnalysis); 1389Debug.Assert(operation.Kind is OperationKind.BinaryOperator or 1424Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData"); 1436Debug.Assert(result); 1439Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity)); 1453Debug.Assert(!ReferenceEquals(truePredicatedData, CurrentAnalysisData)); 1458Debug.Assert(!ReferenceEquals(falsePredicatedData, CurrentAnalysisData)); 1462Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData"); 1491Debug.Assert(IsContractCheckArgument((IArgumentOperation)operation)); 1529Debug.Assert(targetEntity.CaptureId != null); 1546Debug.Assert(PredicateAnalysis); 1547Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None); 1641Debug.Fail($"Unknown pattern kind '{isPatternOperation.Pattern.Kind}'"); 1670Debug.Assert(IsContractCheckArgument(argument)); 1684Debug.Assert(result); 1827Debug.Assert(PredicateAnalysis); 1852Debug.Assert(PredicateAnalysis); 1853Debug.Assert(operation.IsComparisonOperator()); 1854Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None); 1896Debug.Assert(PredicateAnalysis); 1902Debug.Assert(PredicateAnalysis); 1908Debug.Assert(PredicateAnalysis); 1914Debug.Assert(PredicateAnalysis); 1923Debug.Assert(PredicateAnalysis); 1929Debug.Assert(PredicateAnalysis); 1935Debug.Assert(PredicateAnalysis); 1951Debug.Assert(IsLValueFlowCaptureReference(flowCaptureReference)); 2026Debug.Assert(HasPointsToAnalysisResult); 2027Debug.Assert(operation.Type!.HasValueCopySemantics()); 2045Debug.Assert(HasPointsToAnalysisResult); 2046Debug.Assert(!operation.Type!.HasValueCopySemantics()); 2268Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2269Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2270Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 2333Debug.Assert(arguments.All(arg => !_pendingArgumentsToReset.Contains(arg))); 2348Debug.Assert(popped == originalOperation); 2395Debug.Assert(arguments.All(_pendingArgumentsToReset.Contains)); 2485Debug.Assert(originalOperation.Kind == OperationKind.ObjectCreation); 2516Debug.Assert(arguments.Length == invokedMethod.Parameters.Length); 2558Debug.Assert(invokedMethod.Parameters.Length == method.GetParameters().Length || 2624Debug.Assert(success); 2635Debug.Assert(IsStandaloneAnalysisRequiredForLocalFunction(localFunction)); 2653Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2654Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2655Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 2685Debug.Assert(IsStandaloneAnalysisRequiredForLambda(lambda)); 2703Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2704Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2705Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 3000Debug.Assert(result); 3009Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity)); 3035Debug.Assert(flowCaptureEntity.CaptureId != null); 3079Debug.Assert(FlowBranchConditionKind == ControlFlowConditionKind.None); 3158Debug.Assert(operation.Initializer == null, "Object or collection initializer must have been lowered in the CFG"); 3241Debug.Assert(!arguments.IsEmpty); 3260Debug.Assert(arguments.Length >= 2); 3284Debug.Assert(IsPointsToAnalysis); 3328Debug.Assert(operation != null ^ invocationTarget != null); 3339Debug.Assert(invocation.Instance == null); 3347Debug.Assert(targetMethod.MethodKind is MethodKind.LambdaMethod or 3381Debug.Assert(knownTargetInvocations); 3388Debug.Assert(knownTargetInvocations); 3395Debug.Assert(knownTargetInvocations); 3417Debug.Assert(knownTargetInvocations); 3462Debug.Assert(methodTargetsOptBuilder.Count > 0 || lambdaTargets.Count > 0); 3480Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData)); 3492Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData)); 3496Debug.Assert(mergedCurrentAnalysisData == null || ReferenceEquals(mergedCurrentAnalysisData, CurrentAnalysisData)); 3587Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation)); 3605Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation)); 3682Debug.Assert(elementEntities.Length == elementValueBuilder.Count); 3683Debug.Assert(elementEntities.Length == operation.Elements.Length); 3761Debug.Assert(caughtExceptionType != null || CurrentBasicBlock.IsFirstBlockOfFinally(out _)); 3794Debug.Assert(CurrentBasicBlock.IsFirstBlockOfFinally(out _)); 3828Debug.Assert(operation.Kind == OperationKind.YieldReturn, "IReturnOperation must have been lowered in the CFG");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DictionaryAnalysisData.cs (17)
35Debug.Assert(!IsDisposed); 43Debug.Assert(!IsDisposed); 48Debug.Assert(!IsDisposed); 57Debug.Assert(!IsDisposed); 71Debug.Assert(!IsDisposed); 80Debug.Assert(!IsDisposed); 87Debug.Assert(!IsDisposed); 93Debug.Assert(!IsDisposed); 99Debug.Assert(!IsDisposed); 105Debug.Assert(!IsDisposed); 111Debug.Assert(!IsDisposed); 117Debug.Assert(!IsDisposed); 123Debug.Assert(!IsDisposed); 129Debug.Assert(!IsDisposed); 135Debug.Assert(!IsDisposed); 143Debug.Assert(!IsDisposed); 149Debug.Assert(!IsDisposed);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\LValueFlowCapturesProvider.cs (1)
70Debug.Fail("Flow capture used as both an r-value and an l-value?");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\MapAbstractDomain.cs (1)
93Debug.Fail("Non-monotonic merge");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\PerEntityPredicatedAnalysisData.cs (1)
22Debug.Assert(truePredicatedData != null || falsePredicatedData != null);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\PredicateAnalysisEntityDataFlowOperationVisitor.cs (2)
30Debug.Assert(PredicateAnalysis); 33Debug.Assert(!isReachable || predicatedData.IsReachableBlockData);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\PredicatedAnalysisData.cs (12)
65Debug.Assert(!_lazyPredicateDataMap.IsDisposed); 71Debug.Assert(!value.TruePredicatedData.IsDisposed); 72Debug.Assert(builder.Add(value.TruePredicatedData)); 77Debug.Assert(!value.FalsePredicatedData.IsDisposed); 78Debug.Assert(builder.Add(value.FalsePredicatedData)); 91Debug.Assert(predicatedEntity.IsCandidatePredicateEntity()); 92Debug.Assert(predicatedEntity.CaptureId != null, "Currently we only support predicated data tracking for flow captures"); 105Debug.Assert(HasPredicatedDataForEntity(predicatedEntity)); 128Debug.Assert(HasPredicatedDataForEntity(fromEntity)); 144Debug.Assert(HasPredicatedDataForEntity(predicatedEntity)); 175Debug.Assert(HasPredicatedData); 437Debug.Assert(_lazyPredicateDataMap.IsDisposed);
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\ThrownExceptionInfo.cs (2)
50Debug.Assert(enclosingRegion.NestedRegions[0].Kind == ControlFlowRegionKind.Try); 71Debug.Assert(interproceduralCallStack != InterproceduralCallStack);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (12)
80Debug.Assert(expectedValueText == actualValueText); 86Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 90Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 99Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 108Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 147Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics."); 153Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (4)
100Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 101Debug.Assert(_span.End == virtualChars._span.Start); 111Debug.Assert(chars1._leafCharacters == chars2._leafCharacters); 175Debug.Assert(chars1._tokenStart == chars2._tokenStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
119Debug.Fail("Unhandled declaration pattern context"); 153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
248Debug.Fail("Could not find common ancestor."); 271Debug.Fail("Could not find common ancestor.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 216Debug.Assert(branch.Destination == null); 221Debug.Assert(branch.Destination == null); 227Debug.Assert(branch.Destination != null); 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 262Debug.Assert(enclosing.NestedRegions[0] == region); 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 325Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 337Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 375Debug.Assert(startAt > 0); 376Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 391Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\LValueFlowCaptureProvider.cs (1)
76Debug.Assert(kind == FlowCaptureKind.LValueAndRValueCapture || !rvalueFlowCaptureIds.Contains(captureId), "Flow capture used as both an r-value and an l-value, but with incorrect flow capture kind");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (1)
411Debug.Assert(s_serializationVersion == 5, "After increasing the serialization version, add an upgrade path here.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (5)
92Debug.Assert(BitConverter.IsLittleEndian); 185Debug.Assert(value == null || !value.GetType().GetTypeInfo().IsEnum, "Enum should not be written with WriteValue. Write them as ints instead."); 195Debug.Assert(!typeInfo.IsEnum, "Enums should not be written with WriteObject. Write them out as integers instead."); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (18)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1072Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1073Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1157Debug.Assert(parameter1.HasExplicitDefaultValue, "Expected all unspecified parameter to have default values"); 1158Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\LightweightOverloadResolution.cs (3)
114Debug.Assert(foundParameterIndex < parameters.Length); 239Debug.Assert(parameterIndex >= 0); 240Debug.Assert(parameterIndex < method.Parameters.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (4)
34Debug.Assert(span.Start >= start, "Bad generator."); 86Debug.Assert(current < length); 108Debug.Assert(current < length); 127Debug.Assert(char.IsUpper(identifier[current - 1]));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
155Debug.Assert(similarityWeight <= _threshold);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
342Debug.Assert(type is null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
53Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 58Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
26Debug.Fail("Unhandled symbol kind in RequiresUnsafeModifierVisitor: " + node.Kind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
540Debug.Assert(isTypeParameter2);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.CodeStyle (560)
src\9547feb31df4cc5d\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (3)
275Debug.Assert(operation.Kind is OperationKind.DelegateCreation or OperationKind.AnonymousFunction); 324Debug.Assert(operation.Kind is OperationKind.LocalReference or OperationKind.ParameterReference); 525Debug.Assert(!SymbolUsageAnalysis.Run(context.GetControlFlowGraph(operationBlock), context.OwningSymbol, context.CancellationToken)
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 160Debug.Assert(cfg.Parent != null); 161Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 162Debug.Assert(parentAnalysisData != null); 319Debug.Assert(lambdaOrLocalFunctionCfg != null); 329Debug.Assert(anonymousFunctionCfg != null); 338Debug.Assert(localFunction.IsLocalFunction()); 346Debug.Assert(localFunctionCfg != null); 362Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 503Debug.Assert(localFunction.IsLocalFunction()); 504Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 594Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\roslyn\src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (4)
29Debug.Assert(!isUnnecessary || this is AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer); 43Debug.Assert(!supportedDiagnostics.Any(descriptor => descriptor.CustomTags.Any(t => t == WellKnownDiagnosticTags.Unnecessary)) || this is AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer); 161Debug.Assert(_minimumReportedSeverity != null); 245Debug.Assert(editorConfigSeverity != null);
src\roslyn\src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs (2)
75Debug.Assert(options.Count > 1); 87Debug.Assert(option is { Definition.DefaultValue: ICodeStyleOption2 } == descriptor.CustomTags.Contains(WellKnownDiagnosticTags.CustomSeverityConfigurable));
src\roslyn\src\Analyzers\Core\Analyzers\DiagnosticCustomTags.cs (3)
64Debug.Assert(customTags.Length == tags.Length); 68Debug.Assert(customTags[i] == tags[i]); 74Debug.Assert(isConfigurable || enforceOnBuild == EnforceOnBuild.Never);
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (1)
337Debug.Assert(id.StartsWith("IDE", StringComparison.Ordinal));
src\roslyn\src\Analyzers\Core\Analyzers\IDEDiagnosticIdToOptionMappingHelper.cs (3)
47Debug.Assert(perLanguageValuedOption.IsPerLanguage); 83Debug.Assert(!map.TryGetValue(diagnosticId, out var existingOptions) || options.SetEquals(existingOptions)); 84Debug.Assert(options.All(option => option.Definition.IsEditorConfigOption));
src\roslyn\src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
109Debug.Assert(fieldStateMap.ContainsKey(field.OriginalDefinition)); 219Debug.Assert(IsCandidateField(field)); 293Debug.Assert(isInInstanceConstructor);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
108Debug.Assert(preference.Value == ParenthesesPreference.NeverIfUnnecessary ||
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (5)
69Debug.Fail(ex.Message); 422Debug.Assert(!analyzer.IsCompilerAnalyzer()); 454Debug.Assert(semanticModel.Compilation.Options.ReportSuppressedDiagnostics); 554Debug.Assert(diagnostic.Location.IsInSource); 555Debug.Assert(diagnostic.Location.SourceTree == tree);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
406Debug.Assert(memberReference.Parent is ICompoundAssignmentOperation compoundAssignment && 633Debug.Assert(IsCandidateSymbol(member)); 634Debug.Assert(!member.IsImplicitlyDeclared);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (3)
256Debug.Assert(unusedValueExpressionStatementSeverity.Severity != ReportDiagnostic.Suppress || 317Debug.Assert(TryGetUnusedValuePreference(diagnostic, out _)); 323Debug.Assert(TryGetUnusedValuePreference(diagnostic, out _));
src\roslyn\src\Analyzers\Core\Analyzers\UseCompoundAssignment\UseCompoundAssignmentUtilities.cs (2)
36Debug.Assert(binaryToAssignmentMap.Count == assignmentToTokenMap.Count); 37Debug.Assert(binaryToAssignmentMap.Values.All(assignmentToTokenMap.ContainsKey));
src\roslyn\src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
70Debug.Assert(elementCount >= 2 || statements.Length >= 2);
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
202Debug.Assert(syntaxFacts.IsArgument(argsArgument));
src\roslyn\src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\roslyn\src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (13)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 280Debug.Assert(_value is V, "Item must be a a V"); 309Debug.Assert(this.Count >= 1); 315Debug.Assert(_value is V, "_value must be a V"); 343Debug.Assert(_count >= 1);
src\roslyn\src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (7)
308Debug.Assert(PeekNextChar() is '(' or '['); 495Debug.Assert(PeekNextChar() == '!'); 542Debug.Assert(bindingContext != null); 657Debug.Assert(PeekNextChar() == '<'); 698Debug.Assert(PeekNextChar() == '['); 884Debug.Assert(type != null); 890Debug.Assert(startIndex >= 0);
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
410Debug.Assert(!IsUnixLikePlatform); 428Debug.Assert(IsAbsolute(root)); 884Debug.Assert(parts[toSkip - 1] == string.Empty);
src\roslyn\src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 87Debug.Assert(tail != null); 98Debug.Assert(this != Empty); 108Debug.Assert(this != Empty);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (2)
151Debug.Assert(e.InnerException is object); 153Debug.Assert(false, "Unreachable");
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\roslyn\src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
85Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\roslyn\src\Dependencies\Collections\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\roslyn\src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\roslyn\src\Dependencies\Collections\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\roslyn\src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\roslyn\src\Dependencies\Collections\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\roslyn\src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (11)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 488Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 495Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 528Debug.Assert(_completionRefCount == 0, $"Expected {nameof(_completionRefCount)} == 0, got {_completionRefCount}"); 540Debug.Assert(!Cancellation.IsCancellationRequested); 556Debug.Assert(taskSet, "Complete should only be called once.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (12)
80Debug.Assert(expectedValueText == actualValueText); 86Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 90Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 99Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 108Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 147Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics."); 153Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (4)
100Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 101Debug.Assert(_span.End == virtualChars._span.Start); 111Debug.Assert(chars1._leafCharacters == chars2._leafCharacters); 175Debug.Assert(chars1._tokenStart == chars2._tokenStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
119Debug.Fail("Unhandled declaration pattern context"); 153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
248Debug.Fail("Could not find common ancestor."); 271Debug.Fail("Could not find common ancestor.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 216Debug.Assert(branch.Destination == null); 221Debug.Assert(branch.Destination == null); 227Debug.Assert(branch.Destination != null); 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 262Debug.Assert(enclosing.NestedRegions[0] == region); 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 325Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 337Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 375Debug.Assert(startAt > 0); 376Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 391Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\LValueFlowCaptureProvider.cs (1)
76Debug.Assert(kind == FlowCaptureKind.LValueAndRValueCapture || !rvalueFlowCaptureIds.Contains(captureId), "Flow capture used as both an r-value and an l-value, but with incorrect flow capture kind");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (1)
411Debug.Assert(s_serializationVersion == 5, "After increasing the serialization version, add an upgrade path here.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (5)
92Debug.Assert(BitConverter.IsLittleEndian); 185Debug.Assert(value == null || !value.GetType().GetTypeInfo().IsEnum, "Enum should not be written with WriteValue. Write them as ints instead."); 195Debug.Assert(!typeInfo.IsEnum, "Enums should not be written with WriteObject. Write them out as integers instead."); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (18)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1072Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1073Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1157Debug.Assert(parameter1.HasExplicitDefaultValue, "Expected all unspecified parameter to have default values"); 1158Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\LightweightOverloadResolution.cs (3)
114Debug.Assert(foundParameterIndex < parameters.Length); 239Debug.Assert(parameterIndex >= 0); 240Debug.Assert(parameterIndex < method.Parameters.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (4)
34Debug.Assert(span.Start >= start, "Bad generator."); 86Debug.Assert(current < length); 108Debug.Assert(current < length); 127Debug.Assert(char.IsUpper(identifier[current - 1]));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
155Debug.Assert(similarityWeight <= _threshold);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
342Debug.Assert(type is null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
53Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 58Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
26Debug.Fail("Unhandled symbol kind in RequiresUnsafeModifierVisitor: " + node.Kind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
540Debug.Assert(isTypeParameter2);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.CodeStyle.Fixes (37)
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
97Debug.Assert(false, "All conflict markers should start at the beginning of a line."); 396Debug.Assert(
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
87Debug.Assert(constructor.Parameters.Length == expressions.Length);
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
222Debug.Assert(syntaxFacts.IsInvocationExpression(invocationExpression));
src\roslyn\src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (1)
36Debug.Fail("Declared symbol must never be null here");
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (2)
43Debug.Assert(diagnostics.Select(diagnostic => diagnostic.Properties[MatchFolderAndNamespaceConstants.TargetNamespace]).Distinct().Count() == 1); 62Debug.Assert(newSolution != document.Project.Solution);
src\roslyn\src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
57Debug.Assert(missingCases || missingDefaultCase);
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (2)
70Debug.Fail("We should always be able to find the node from the diagnostic."); 77Debug.Fail("We should always be able to find the method symbol for the diagnostic.");
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedMembers\AbstractRemoveUnusedMembersCodeFixProvider.cs (1)
98Debug.Assert(childDeclarators.All(c => !declarators.Contains(c)));
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (7)
249Debug.Assert(success); 254Debug.Assert(diagnosticId == diagnostic.Id); 255Debug.Assert(AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.TryGetUnusedValuePreference(diagnostic, out var diagnosticPreference) && 257Debug.Assert(removeAssignments == AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.GetIsRemovableAssignmentDiagnostic(diagnostic)); 410Debug.Assert(semanticModel.Language != LanguageNames.VisualBasic); 517Debug.Assert(syntaxFacts.IsLeftSideOfAnyAssignment(node)); 726Debug.Assert(removeAssignments);
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
130Debug.Assert(fieldDocument.Project == propertyDocument.Project); 171Debug.Assert(fieldDocument.Project == propertyDocument.Project);
src\roslyn\src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
285Debug.Assert(syntaxFacts.IsElementAccessExpression(elementAccess));
src\roslyn\src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
48Debug.Fail("Could not get analyzer");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
60Debug.Fail("FixAllScope.ContainingMember and FixAllScope.ContainingType are not supported in CodeStyle layer");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
206Debug.Assert(false, message + ". " + diagnostics);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
34Debug.Assert(diagnostic != null); 88Debug.Assert(analyzerConfigPath != null); 89Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\AbstractSemanticModelReuseLanguageService.cs (4)
102Debug.Fail("Previous container didn't map back to a normal accessor container."); 111Debug.Fail("Accessor count shouldn't have changed as there were no top level edits."); 132Debug.Fail("Member count shouldn't have changed as there were no top level edits."); 139Debug.Fail("Child at indicated index should be a node as there were no top level edits.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (3)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel); 227Debug.Assert(replacedParent.GetAnnotatedNodesAndTokens(annotation).Count() == 1); 246Debug.Assert(newRoot.GetAnnotatedNodesAndTokens(marker).Count() == 1);
Microsoft.CodeAnalysis.CSharp (8577)
Binder\Binder_Attributes.cs (35)
35Debug.Assert(binders.Any()); 36Debug.Assert(attributesToBind.Any()); 37Debug.Assert((object)ownerSymbol != null); 38Debug.Assert(binders.Length == attributesToBind.Length); 81Debug.Assert(binders.Any()); 82Debug.Assert(attributesToBind.Any()); 83Debug.Assert(boundAttributeTypes.Any()); 84Debug.Assert(binders.Length == attributesToBind.Length); 85Debug.Assert(boundAttributeTypes.Length == attributesToBind.Length); 105Debug.Assert(boundAttributeArray is null || boundAttributeArray[i] is not null); 112Debug.Assert(!attribute.HasErrors); 113Debug.Assert(attribute.AttributeClass is object); 157Debug.Assert(binder.SkipSemanticModelBinder() == binder.GetRequiredBinder(node).SkipSemanticModelBinder()); 158Debug.Assert(binder.InAttributeArgument); 236Debug.Assert(!attributeConstructor.IsExtensionBlockMember()); 259Debug.Assert(boundConstructorArguments.All(a => !a.NeedsToBeConverted())); 267Debug.Assert(boundNamedArguments.All(arg => !arg.Right.NeedsToBeConverted())); 290Debug.Assert(boundAttribute.Syntax.Kind() == SyntaxKind.Attribute); 297Debug.Assert(hasErrors); 310Debug.Assert(!constructorArgsArray.IsDefault, "Property of VisitArguments"); 328Debug.Assert(rewrittenArguments.Length == attributeConstructor.ParameterCount); 354Debug.Assert(arguments.Count(a => a.IsParamsArrayOrCollection) == (boundAttribute.ConstructorExpanded ? 1 : 0)); 379Debug.Assert(argsToParamsOpt.IsDefault 386Debug.Assert(!arguments[argIndex].IsParamsArrayOrCollection || arguments[argIndex] is BoundArrayCreation); 403Debug.Assert(paramType.HasType); 422Debug.Assert((object)attributeType != null); 423Debug.Assert(!attributeType.IsErrorType()); 428Debug.Assert(conditionalSymbols != null); 518Debug.Assert(namedArgument.NameEquals is not null); 555Debug.Assert(resultKind == LookupResultKind.Viable || wasError); 713Debug.Assert(!constructorArgsArray.IsDefault); 714Debug.Assert(!hasErrors); 749Debug.Assert(hasErrors || reorderedArguments.All(arg => arg.Kind != TypedConstantKind.Error)); 908Debug.Assert(node.ConstantValueOpt == null); 925Debug.Assert(type.IsSZArray());
Binder\Binder_Await.cs (6)
96Debug.Assert(!call.IsErroneousNode); 281Debug.Assert(TypeSymbol.Equals(expression.Type, getAwaiterArgument.Type, TypeCompareKind.ConsiderEverything)); 511Debug.Assert(awaitMethod is { Arity: 1 }); 608Debug.Assert(!call.IsErroneousNode); 693Debug.Assert(conversion.IsValid); 725Debug.Assert(!call.IsErroneousNode);
Binder\Binder_Constraints.cs (11)
33Debug.Assert(this.Flags.Includes(BinderFlags.GenericConstraintsClause)); 35Debug.Assert((containingSymbol.Kind == SymbolKind.NamedType) || (containingSymbol.Kind == SymbolKind.Method)); 36Debug.Assert(typeParameters.Length > 0); 37Debug.Assert(clauses.Count > 0); 66Debug.Assert(ordinal >= 0); 67Debug.Assert(ordinal < n); 125Debug.Assert(!InExecutableBinder); // Cannot eagerly report diagnostics handled by LazyMissingNonNullTypesContextDiagnosticInfo 345Debug.Assert(!isForOverride || 392Debug.Assert(typeParameters.Length > 0); 393Debug.Assert(typeParameters.Length == constraintClauses.Count); 469Debug.Assert(possibleFileType?.IsDefinition != false);
Binder\Binder_Conversions.cs (146)
69Debug.Assert(result is BoundConversion || (conversion.IsIdentity && ((object)result == source) || source.NeedsToBeConverted()) || hasErrors); 74Debug.Assert(filterConversion(conversion, result)); 75Debug.Assert(BoundNode.GetConversion(result, placeholder1) == conversion); 81Debug.Assert(BoundNode.GetConversion(result2, placeholder2) == conversion); 234Debug.Assert(destination.SpecialType != SpecialType.System_String); 258Debug.Assert(!conversion.Exists); 277Debug.Assert(conversion.IsCollectionExpression 300Debug.Assert(source.Type is null); 301Debug.Assert(!conversion.Exists); 311Debug.Assert(inConversionGroupFlags == InConversionGroupFlags.Unspecified); 344Debug.Assert(source == (object)methodGroup || !conversion.IsValid); 363Debug.Assert(!conversion.IsMethodGroup); 379Debug.Assert(conversion.UnderlyingConversions.Length == 1); 442Debug.Assert(elementConversions.Length == sourceTypes.Length); 465Debug.Assert(conversion.UnderlyingConversions.IsDefault); 474Debug.Assert(syntax.SyntaxTree is object); 482Debug.Assert(conversion.ConstrainedToTypeOpt is TypeParameterSymbol); 523Debug.Assert(source.Type is { }); 526Debug.Assert(elementField is { }); 545Debug.Assert(destination.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions)); 562Debug.Assert(source.Type is not null); 563Debug.Assert(destination.IsSpan() || destination.IsReadOnlySpan()); 584Debug.Assert(destination.IsReadOnlySpan()); 596Debug.Assert(destination.IsReadOnlySpan()); 653Debug.Assert(type.IsSpan() || type.IsReadOnlySpan()); 654Debug.Assert(type.IsDefinition); 663Debug.Assert(spanType.IsSpan() && readonlySpanType.IsReadOnlySpan()); 664Debug.Assert(spanType.IsDefinition && readonlySpanType.IsDefinition); 686Debug.Assert(source.IsSpan() || source.IsReadOnlySpan()); 687Debug.Assert(destination.IsReadOnlySpan()); 688Debug.Assert(!source.IsDefinition && !destination.IsDefinition); 695Debug.Assert(!source.IsReadOnlySpan() || !sameElementTypes); 703Debug.Assert(source.IsReadOnlySpan() && destination.IsReadOnlySpan()); 704Debug.Assert(source.IsDefinition && destination.IsDefinition); 731Debug.Assert(readOnlySpanType.IsReadOnlySpan()); 732Debug.Assert(!readOnlySpanType.IsDefinition); 733Debug.Assert(((NamedTypeSymbol)readOnlySpanType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].SpecialType is SpecialType.System_Char); 786Debug.Assert(destination.Equals(Compilation.GetWellKnownType(WellKnownType.System_IFormattable), TypeCompareKind.ConsiderEverything) || 826Debug.Assert(expr is BoundObjectCreationExpressionBase { WasTargetTyped: true } or 831Debug.Assert(expr is not BoundBadExpression { ChildBoundNodes: var children } || !children.Any((child, node) => child.Syntax == node.Syntax, node)); 942Debug.Assert(_conversion.Kind is ConversionKind.NoConversion); 950Debug.Assert(elementType is { }); 961Debug.Assert(result.WasCompilerGenerated == _node.IsParamsArrayOrCollection); 962Debug.Assert(result.IsParamsArrayOrCollection == _node.IsParamsArrayOrCollection); 972Debug.Assert(elementType is { }); 1038Debug.Assert(_node.WithElement is null); 1039Debug.Assert(inProgressConstructor is not null); 1047Debug.Assert(collectionCreation is BoundObjectCreationExpressionBase or BoundBadExpression); 1159Debug.Assert(elements.Length == elementConversions.Length); 1160Debug.Assert(elementConversions.All(c => c.Exists)); 1191Debug.Assert(enumeratorInfo is { }); 1192Debug.Assert(enumeratorInfo.ElementType is { }); // ElementType is set always, even for IEnumerable. 1268Debug.Assert(@this._targetType.IsArrayInterface(out _)); 1280Debug.Assert(isMutableArray); 1370Debug.Assert(projection.Arity == 0); 1371Debug.Assert(projection.ParameterCount == 0 || !projection.Parameters.Last().IsParams); 1387Debug.Assert(collectionBuilderMethods.All(t => t.Name == methodName)); 1420Debug.Assert(!projectionCall.Expanded); 1503Debug.Assert(result); 1507Debug.Assert(result); 1637Debug.Assert(parameterType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 1649Debug.Assert(!collectionBuilderMethod.IsExtensionBlockMember()); 1664Debug.Assert(!isParamsModifierValidation || syntax is ParameterSyntax); 1666Debug.Assert(!isParamsModifierValidation); 1669Debug.Assert(!hasWithElement); 1690Debug.Assert(!hasWithElement); 1835Debug.Assert(!targetType.IsDynamic()); 1914Debug.Assert(boundExpression.HasErrors); 1954Debug.Assert(methodGroup.ReceiverOpt is not null); 1955Debug.Assert(methodGroup.ReceiverOpt.Type is not null); 1971Debug.Assert(false); // Should not get here given the 'acceptOnlyMethods' argument value used in 'ResolveMethodGroup' call above 1995Debug.Assert(resolution.AnalyzedArguments.HasDynamicArgument); 2011Debug.Assert(finalApplicableCandidates.Length != 1 || finalApplicableCandidates[0].IsApplicable); 2032Debug.Assert(!IsDisallowedExtensionInOlderLangVer(addMethods[0])); 2038Debug.Assert(!resolution.OverloadResolutionResult.Succeeded); 2061Debug.Assert(methodGroup.ReceiverOpt is not null); 2091Debug.Assert(receiverType is not null); 2152Debug.Assert(constructed is not null); 2185Debug.Assert(node != null); 2186Debug.Assert(methodGroup != null); 2187Debug.Assert(methodGroup.Error == null); 2188Debug.Assert(methodGroup.Methods.Count > 0); 2249Debug.Assert(call.HasErrors); 2250Debug.Assert(call.Method.Name == "Add"); 2253Debug.Assert(false); // Add test if we hit this assert. 2266Debug.Assert(!collectionInitializer.DefaultArguments[argIndex]); 2281Debug.Assert(false); 2364Debug.Assert(elementTypeWithAnnotations.Type is null); // GetCollectionExpressionTypeKind() does not set elementType for these cases. 2376Debug.Assert(elementTypeWithAnnotations.HasType); 2386Debug.Assert(elementType is { }); 2434Debug.Assert(reportedErrors); 2456Debug.Assert(targetTyped || destination.IsErrorType() || destination.Equals(source.Type, TypeCompareKind.ConsiderEverything)); 2495Debug.Assert(targetTyped || destination.IsErrorType() || destination.Equals(source.Type, TypeCompareKind.ConsiderEverything)); 2528Debug.Assert(conversionGroup != null); 2529Debug.Assert(conversionGroup.Conversion == conversion); 2530Debug.Assert(conversion.IsUserDefined); 2579Debug.Assert(conversion.BestUserDefinedConversionAnalysis is object); // All valid user-defined conversions have this populated 2601Debug.Assert(toParameterTypeConversion.IsNullable); 2602Debug.Assert(toParameterTypeConversion.IsExplicit); 2603Debug.Assert(toParameterTypeConversion.UnderlyingConversions[0].IsIdentity); 2647Debug.Assert(toConversion.Exists); 2653Debug.Assert(fromReturnTypeConversion.IsNullable); 2654Debug.Assert(fromReturnTypeConversion.IsImplicit); 2655Debug.Assert(!fromReturnTypeConversion.UnderlyingConversions[0].IsIdentity); 2717Debug.Assert(conversionGroup != null); 2718Debug.Assert(conversionGroup.Conversion == conversion); 2719Debug.Assert(conversion.IsUnion); 2742Debug.Assert(conversion.BestUnionConversionAnalysis is object); // All valid union conversions have this populated 2746Debug.Assert(analysis.Kind == UserDefinedConversionAnalysisKind.ApplicableInNormalForm); 2747Debug.Assert(analysis.Operator is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true })); 2748Debug.Assert(TypeSymbol.Equals(analysis.FromType, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions)); 2749Debug.Assert(TypeSymbol.Equals(destination.StrippedType(), analysis.Operator.MethodKind == MethodKind.Constructor ? analysis.Operator.ContainingType : analysis.Operator.ReturnType, TypeCompareKind.AllIgnoreOptions)); 2750Debug.Assert(TypeSymbol.Equals(destination.StrippedType(), analysis.ToType, TypeCompareKind.AllIgnoreOptions)); 2751Debug.Assert(analysis.TargetConversion is { IsIdentity: true } or { IsNullable: true, IsImplicit: true }); 2752Debug.Assert(source.Type?.IsDynamic() != true); 2841Debug.Assert(conversion.Kind == ConversionKind.FunctionType); 2842Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 2843Debug.Assert(syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType)); 2847Debug.Assert(delegateType is { }); 2863Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.FunctionTypeDelegate) == 0); 2893Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.FunctionTypeDelegateToTarget) == 0); 2947Debug.Assert(conversion.UnderlyingConversions.IsDefault); 3004Debug.Assert(delegateType is not null); 3008Debug.Assert(lambdaSymbol.ParameterCount == delegateParameters.Length); 3094Debug.Assert(conversion.IsStackAlloc); 3127Debug.Assert(conversion.IsTupleLiteralConversion || 3132Debug.Assert(conversion.IsNullable == destination.IsNullableType()); 3144Debug.Assert(conversionWithoutNullable.IsTupleLiteralConversion); 3182Debug.Assert(targetElementTypes.Length == arguments.Length, "converting a tuple literal to incompatible type?"); 3204Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.TupleLiteral) == 0); 3222Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.TupleLiteralExplicitIdentity) == 0); 3364Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } || 3375Debug.Assert(!invokedAsExtensionMethod); 3379Debug.Assert(!invokedAsExtensionMethod || (receiverOpt != null)); 3518Debug.Assert(delegateType is NamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: { HasUseSiteError: false } } 3529Debug.Assert(!isExtensionMethod || (receiverOpt != null)); 3536Debug.Assert(methodParameters.Length == numParams + (isExtensionMethod ? 1 : 0)); 3542Debug.Assert(!(isExtensionMethod || (method.IsExtensionBlockMember() && !method.IsStatic)) || 3625Debug.Fail("This method should have been eliminated in overload resolution!"); 3685Debug.Assert(method.IsExtensionBlockMember()); 3709Debug.Assert(Conversions.IsAssignableFromMulticastDelegate(delegateOrFuncPtrType, ref discardedUseSiteInfo) || delegateOrFuncPtrType.TypeKind == TypeKind.Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.FunctionPointer); 3710Debug.Assert(conversion.Method is object); 3755Debug.Assert(!selectedMethod.HasUseSiteError, "Shouldn't have reached this point if there were use site errors."); 3792Debug.Assert(conversion.IsValid); // i.e. if it exists, then it is valid. 3907Debug.Assert(!sourceValue.IsBad); 3914Debug.Assert(underlyingType.SpecialType != SpecialType.None);
Binder\Binder_Crefs.cs (27)
22Debug.Assert(!symbols.IsDefault, "Prefer empty to null."); 23Debug.Assert((symbols.Length > 1) == ((object?)ambiguityWinner != null), "ambiguityWinner should be set iff more than one symbol is returned."); 85Debug.Assert(Flags.Includes(BinderFlags.Cref)); 97Debug.Assert((object)namespaceOrTypeSymbol != null); 165Debug.Assert((object?)containerOpt == null); 211Debug.Assert(sortedSymbols.All(SymbolExtensions.IsIndexer)); 268Debug.Assert(sortedSymbols.All(s => s.IsExtensionBlockMember())); 274Debug.Assert(name is not null); 276Debug.Assert(syntax.Parameters is not null); 350Debug.Assert(result.Symbol is not null); 575Debug.Assert(memberName == memberNameText); 665Debug.Assert(builder != null); 690Debug.Assert(!symbols.IsEmpty); 876Debug.Assert(!symbols.IsEmpty); 895Debug.Assert(!best.IsNone); 896Debug.Assert(!secondBest.IsNone); 1036Debug.Assert(candidate.GetMemberArity() != 0 || candidate.Name == WellKnownMemberNames.InstanceConstructorName || arity == 0, 1092Debug.Assert(typeArgumentListSyntax is object); 1099Debug.Assert(unusedDiagnostics.DiagnosticBag is object); 1111Debug.Assert(typeArgumentSyntax.ContainsDiagnostics || !typeArgumentSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics() || 1128Debug.Assert(symbol is NamedTypeSymbol); 1149Debug.Assert(parameterListSyntax.Parent is object); 1167Debug.Assert(InCrefButNotParameterOrReturnType); 1173Debug.Assert(!this.Compilation.ContainsSyntaxTree(typeSyntax.SyntaxTree) || 1179Debug.Assert(localDiagnostics.DiagnosticBag is object); 1187Debug.Assert(typeSyntax.Parent is object); 1201Debug.Assert(type.TypeKind != TypeKind.Error || typeSyntax.ContainsDiagnostics || !typeSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics(), "Why wasn't there a diagnostic?");
Binder\Binder_Deconstruct.cs (17)
96Debug.Assert(locals.NestedVariables is object); 120Debug.Assert(diagnostics.DiagnosticBag is object); 158Debug.Assert(hasErrors || lhsTuple.Type is object); 185Debug.Assert(parent.Kind() == SyntaxKind.SimpleAssignmentExpression); 211Debug.Assert(diagnostics.DiagnosticBag is object); 251Debug.Assert((object)type != null); 309Debug.Assert(nestedConversion.Kind == ConversionKind.Deconstruction); 322Debug.Assert(single is object); 323Debug.Assert(single.Type is not null); 381Debug.Assert((object?)pending.Type == null); 405Debug.Assert(variable.Single is object); 423Debug.Assert((object?)variables[i].Single!.Type != null); 463Debug.Assert(NestedVariables is object); 503Debug.Assert(variable.Single is object); 566Debug.Assert(variable.Single is object); 755Debug.Assert(isVar == !declType.HasType); 953Debug.Assert(TypeSymbol.Equals(declTypeWithAnnotations.Type, fieldType.Type, TypeCompareKind.ConsiderEverything2));
Binder\Binder_Expressions.cs (303)
220Debug.Assert(expr != null); 221Debug.Assert(resultKind != LookupResultKind.Viable); 343Debug.Assert(op.NoCommonTypeError != 0); 448Debug.Assert(expr.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup); 478Debug.Assert((object)this.ContainingMemberOrLambda == field); 486Debug.Assert(initializerBinder != null); 536Debug.Assert(this.InParameterDefaultValue); 537Debug.Assert(this.ContainingMemberOrLambda.Kind == SymbolKind.Method 543Debug.Assert(defaultValueBinder != null); 561Debug.Assert(initializerBinder != null); 629Debug.Assert(node != null); 877Debug.Assert(false, "Unexpected SyntaxKind " + node.Kind()); 1185Debug.Assert(elementNames.Count == inferredElementNames.Count); 1482Debug.Assert(ContainingType is { }); 1506Debug.Assert((this.Flags & BinderFlags.InContextualAttributeBinder) != 0); 1533Debug.Assert(!result || lookupResult.Symbols.Count > 0); 1566Debug.Assert(symbol is null or LocalSymbol or LocalFunctionSymbol or RangeVariableSymbol or TypeParameterSymbol); 1649Debug.Assert(node != null); 1687Debug.Assert(node.Arity == typeArgumentList.Count); 1708Debug.Assert(members.Count > 0); 1711Debug.Assert(!IsTypeOrValueExpression(receiver)); 1740Debug.Assert(isError); // Should have been reported by GetSymbolOrMethodOrPropertyGroup. 1820Debug.Assert(SyntaxFacts.IsInvoked(id) == invoked); 1885Debug.Assert(!primaryConstructor.GetCapturedParameters().ContainsKey(shadowedParameter)); // How could we capture a shadowed parameter? 1912Debug.Assert((options & LookupOptions.NamespacesOrTypesOnly) == 0); 1941Debug.Assert(node.Identifier.IsUnderscoreToken()); 2006Debug.Assert(members.Count > 0); 2049Debug.Assert(!symbol.ContainingSymbol.Equals(containingMethod)); 2116Debug.Assert(primaryCtor is null || 2135Debug.Assert(parameter.Type.IsRefLikeOrAllowsRefLikeType()); 2158Debug.Assert(parameter.Type.IsRefLikeOrAllowsRefLikeType()); 2518Debug.Assert(node.ContainsDiagnostics); 2535Debug.Assert(result.IsSingleViable, "If this happens, we need to deal with multiple label definitions."); 2579Debug.Assert(node != null); 2607Debug.Assert(location is not null); 2617Debug.Assert(this.ContainingMemberOrLambda is not null); 2681Debug.Assert(node.OperatorToken.IsKind(SyntaxKind.CaretToken)); 2880Debug.Assert(conversion.IsUserDefined || conversion.IsUnion); 2889Debug.Assert(originalUserDefinedConversions.Length == 0, 2965Debug.Assert((object)operand.Type != null); 3006Debug.Assert(targetTypeWithAnnotations.HasType && targetTypeWithAnnotations.IsNullableType()); 3007Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType()); 3256Debug.Assert(isVar != declType.HasType); 3272Debug.Assert(declarationExpression.IsOutVarDeclaration()); 3296Debug.Assert(localSymbol.DeclarationKind == LocalDeclarationKind.OutVariable); 3414Debug.Assert(argumentSyntax is ArgumentSyntax || argumentSyntax is AttributeArgumentSyntax); 3526Debug.Assert(result.ConversionForArg(arg).IsIdentity); 3527Debug.Assert(!argument.NeedsToBeConverted()); 3528Debug.Assert(!expanded || result.ParameterFromArgument(arg) != parameters.Length - 1); 3537Debug.Assert(paramsArgsBuilder is null); 3554Debug.Assert(analyzedArguments.RefKinds.Count == 0 || analyzedArguments.RefKinds.Count == arguments.Count); 3555Debug.Assert(analyzedArguments.Names.Count == 0 || analyzedArguments.Names.Count == arguments.Count); 3556Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == arguments.Count); 3577Debug.Assert(argument is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }); 3598Debug.Assert(parameterTypeWithAnnotations.HasType); 3603Debug.Assert(kind.IsIdentity); 3631Debug.Assert(arguments[arg].Kind is not 3660Debug.Assert(methodResult.Result.ParamsElementTypeOpt.HasType); 3661Debug.Assert(methodResult.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 3683Debug.Assert(collectionArgs.Length != 0); 3688Debug.Assert(firstParamsArgument != -1); 3689Debug.Assert(collectionArgs.Length == 1 || firstParamsArgument + collectionArgs.Length == arguments.Count); 3702Debug.Assert(argsToParamsBuilder is not null || argsToParamsOpt.IsDefault); 3753Debug.Assert(unconvertedString is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }); 3755Debug.Assert(interpolatedStringConversion.IsInterpolatedStringHandler); 3756Debug.Assert(handlerType is NamedTypeSymbol { IsInterpolatedStringHandlerType: true }); 3763Debug.Assert(handlerParameterIndexes.IsEmpty); 3777Debug.Assert(arguments is not null); 3810Debug.Assert(handlerParameterIndexes.All((index, paramLength) => index >= BoundInterpolatedStringArgumentPlaceholder.ExtensionReceiver && index < paramLength, 3829Debug.Assert(handlerArgumentIndexesBuilder[handlerParameterIndex] is BoundInterpolatedStringArgumentPlaceholder.UnspecifiedParameter); 3862Debug.Assert(argumentIndex != interpolatedStringArgNum); 3869Debug.Assert(receiver!.Type is not null); 3874Debug.Assert(methodResult.Member.IsExtensionBlockMember()); 3876Debug.Assert(receiverParameter is not null); 3930Debug.Assert(receiver != null); 3995Debug.Assert(!available); 4008Debug.Assert(argNumber > 0); 4020Debug.Assert(argNumber >= 0); // can be 0 for receiver of extension method 4029Debug.Assert(argNumber > 0); 4289Debug.Assert(rank > 0); 4290Debug.Assert(dimension > 0 && dimension <= rank); 4291Debug.Assert(exprBuilder != null); 4362Debug.Assert(!boundInitExpr.IsDefault); 4372Debug.Assert(boundInitExprIndex >= 0 && boundInitExprIndex < boundInitExpr.Length); 4397Debug.Assert(boundInitExprIndex >= 0 && boundInitExprIndex < boundInitExpr.Length); 4400Debug.Assert(init.HasAnyErrors); 4401Debug.Assert(init.Type.IsErrorType()); 4510Debug.Assert(creationSyntax == null || 4513Debug.Assert(initSyntax != null); 4514Debug.Assert((object)type != null); 4515Debug.Assert(boundInitExprOpt.IsDefault || creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4667Debug.Assert(node is StackAllocArrayCreationExpressionSyntax || node is ImplicitStackAllocArrayCreationExpressionSyntax); 4692Debug.Assert(node is StackAllocArrayCreationExpressionSyntax or ImplicitStackAllocArrayCreationExpressionSyntax); 4730Debug.Assert(node != null); 4769Debug.Assert(node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression) || node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 4815Debug.Assert(expression != null); 4833Debug.Assert(expression != null); 4859Debug.Assert(type == SpecialType.System_UInt32 || type == SpecialType.System_UInt64); 4894Debug.Assert(argumentListBinder.IsSemanticModelBinder); 4926Debug.Assert((object)constructor != null); 4927Debug.Assert(constructor.MethodKind == MethodKind.Constructor || 4929Debug.Assert(diagnostics != null); 4943Debug.Assert(constructorReturnType.IsVoidType()); //true of all constructors 4962Debug.Assert((object)initializerType != null || 4998Debug.Assert(initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer); 5104Debug.Assert(initializerType.IsErrorType() || 5165Debug.Assert(!resultMember.IsExtensionBlockMember()); 5294Debug.Assert(result is not BoundBadExpression { ChildBoundNodes: var children } || !children.Any((child, node) => child.Syntax == node, node)); 5422Debug.Assert(expression.Type is { }); 5429Debug.Assert(conversion.IsValid); 5437Debug.Assert(length > 0); 5584Debug.Assert(!type.IsGenericOrNonGenericExpressionType(out _)); 5671Debug.Assert(!conv.IsExtensionMethod); 5672Debug.Assert(conv.IsValid); // i.e. if it exists, then it is valid. 5739Debug.Assert(type.TypeKind is TypeKind.Class or TypeKind.Struct); 5783Debug.Assert(typeSyntax is not null); 5802Debug.Assert(syntax != null); 5803Debug.Assert((object)type != null); 5833Debug.Assert(syntax != null); 5834Debug.Assert((object)type != null); 5840Debug.Assert(syntax.Parent.Parent.Kind() != SyntaxKind.WithInitializerExpression); 5841Debug.Assert(rhsValueKind == BindValueKind.RValue); 5860Debug.Assert(initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression || 5862Debug.Assert((object)initializerType != null); 5906Debug.Assert((object)boundLeft.Type != null); 6235Debug.Assert(!boundMember.NeedsToBeConverted()); 6257Debug.Assert(boundMember.HasAnyErrors); 6271Debug.Assert(memberNameMap != null); 6281Debug.Assert(memberInitializerSyntax.Kind() == SyntaxKind.SimpleAssignmentExpression); 6415Debug.Assert(initializerSyntax.Kind() == SyntaxKind.CollectionInitializerExpression); 6416Debug.Assert(initializerSyntax.Expressions.Any()); 6417Debug.Assert((object)initializerType != null); 6569Debug.Assert(node.Kind() == SyntaxKind.ComplexElementInitializerExpression); 6600Debug.Assert(!boundElementInitializerExpressions.IsEmpty); 6619Debug.Assert(collectionInitializerAddMethodBinder.HasCollectionExpressionApplicableAddMethod(elementInitializer, implicitReceiver.Type, addMethods: out _, d)); 6633Debug.Assert(collectionInitializerAddMethodBinder != null); 6634Debug.Assert(collectionInitializerAddMethodBinder.Flags.Includes(BinderFlags.CollectionInitializerAddMethod)); 6635Debug.Assert(implicitReceiver != null); 6636Debug.Assert((object)implicitReceiver.Type != null); 6702Debug.Assert(addMethodInvocation.Kind == BoundKind.BadExpression); 6748Debug.Assert(enumeratorInfo.ElementType is { }); // ElementType is set always, even for IEnumerable. 6795Debug.Assert((object)constructor != null); 6796Debug.Assert(constructor.MethodKind == MethodKind.Constructor || constructor.MethodKind == MethodKind.StaticConstructor); 6823Debug.Assert((object)this.Compilation.Assembly != null); 6879Debug.Assert(finalApplicableCandidates[0].IsApplicable); 6967Debug.Assert(!method.IsExtensionBlockMember()); 7102Debug.Assert((object)type != null); 7128Debug.Assert((object)interfaceType != null); 7129Debug.Assert(interfaceType.IsInterfaceType()); 7130Debug.Assert((object)coClassType != null); 7131Debug.Assert(TypeSymbol.Equals(interfaceType.ComImportCoClass, coClassType, TypeCompareKind.ConsiderEverything2)); 7132Debug.Assert(coClassType.TypeKind == TypeKind.Class || coClassType.TypeKind == TypeKind.Error); 7571Debug.Assert(!value.GetType().GetTypeInfo().IsEnum); 7576Debug.Assert( 7597Debug.Assert(node.Kind() == SyntaxKind.Utf8StringLiteralExpression); 7598Debug.Assert(node.Token.Kind() is SyntaxKind.Utf8StringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken); 7642Debug.Assert(node != null); 7643Debug.Assert(invoked == SyntaxFacts.IsInvoked(node)); 7655Debug.Assert(node.Kind() == SyntaxKind.PointerMemberAccessExpression); 7709Debug.Assert((left.Parent is MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess && memberAccess.Expression == left) || 7721Debug.Assert(left.Arity == 0); 7780Debug.Assert(!leftType.IsDynamic()); 7781Debug.Assert(IsPotentialColorColorReceiver(left, leftType)); 7787Debug.Assert(!IsPotentialColorColorReceiver(left, leftType)); 7790Debug.Assert(leftType.Equals(boundValue.Type, TypeCompareKind.ConsiderEverything)); 7791Debug.Assert(leftSymbol == (boundValue.ExpressionSymbol ?? ((BoundConversion)boundValue).Operand.ExpressionSymbol)); 7913Debug.Assert(node != null); 7914Debug.Assert(boundLeft != null); 7948Debug.Assert((object)leftType == null); 8090Debug.Assert(sym.Kind == SymbolKind.NamedType); 8106Debug.Assert(symbols.Count > 0); 8107Debug.Assert(symbols[0].Kind == SymbolKind.NamedType); 8116Debug.Assert(lookupResult.IsClear, "If there's a legitimate reason for having candidates without a reason, then we should produce something intelligent in such cases."); 8117Debug.Assert(lookupResult.Error == null); 8142Debug.Assert(boundLeft is BoundTypeExpression); 8143Debug.Assert((object)leftType != null); 8218Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 8226Debug.Assert(!resolution.IsEmpty); 8271Debug.Assert(typeArgumentsOpt.IsDefault); 8294Debug.Assert(propertySymbol.ContainingType.ExtensionParameter is not null); 8326Debug.Assert(rightArity == (typeArgumentsWithAnnotations.IsDefault ? 0 : typeArgumentsWithAnnotations.Length)); 8606Debug.Assert(receiver != null); 8607Debug.Assert(extensionMethodArguments.Arguments.Count == 0); 8608Debug.Assert(extensionMethodArguments.Names.Count == 0); 8609Debug.Assert(extensionMethodArguments.RefKinds.Count == 0); 8651Debug.Assert(node != null); 8652Debug.Assert(left != null); 8653Debug.Assert(lookupResult.IsMultiViable); 8654Debug.Assert(lookupResult.Symbols.Any()); 8664Debug.Assert(members.Count > 0); 8690Debug.Assert(symbol.Kind != SymbolKind.Method); 8773Debug.Assert(left.Type is not null); 8774Debug.Assert(!left.Type.IsDynamic()); 8775Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion | 8868Debug.Assert(left.Type is not null); 8889Debug.Assert(arity == 0 || lookupResult.Symbols.All(s => s.Kind != SymbolKind.Property)); 8902Debug.Assert(actualReceiverArguments is not null); 8937Debug.Assert(actualReceiverArguments is not null); 8946Debug.Assert(propertyResult?.HasAnyApplicableMember == true); 8957Debug.Assert(actualReceiverArguments is not null); 9004Debug.Assert(propertyResult is not null); 9029Debug.Assert(lookupResult.Kind == LookupResultKind.Viable); 9060Debug.Assert(receiverType is not null); 9185Debug.Assert(left is not null); 9193Debug.Assert(left.Type is not null); 9194Debug.Assert(!left.Type.IsDynamic()); 9195Debug.Assert(!left.Type.IsArray()); 9196Debug.Assert(left.Type.SpecialType != SpecialType.System_String); 9246Debug.Assert(receiver.Type is not null); 9247Debug.Assert(lookupResult.IsClear); 9282Debug.Assert(left is not null); 9290Debug.Assert(left.Type is not null); 9291Debug.Assert(!left.Type.IsDynamic()); 9292Debug.Assert(!left.Type.IsArray()); 9293Debug.Assert(left.Type.SpecialType != SpecialType.System_String); 9330Debug.Assert(receiver.Type is not null); 9350Debug.Assert(actualExtensionIntIndexerOrSliceArguments is null); 9368Debug.Assert(!argumentPlaceholders.IsDefault); 9406Debug.Assert(lengthOrCountProperty.ContainingType.ExtensionParameter is not null); 9426Debug.Assert(receiver.Type is not null); 9547Debug.Assert(receiver.Type is not null); 9556Debug.Assert(argKind is IndexOrRangeArgKind.Range); 9575Debug.Assert(receiver.Type is not null); 9669Debug.Assert(receiver.Type is not null); 9730Debug.Assert(!candidate.IsStatic); 9783Debug.Assert(resolutionResult.Result.ConversionForArg(0).Exists); 9966Debug.Assert((object)underlyingType != null); 9991Debug.Assert(propertySymbol.GetCallerUnsafeMode(ConsList<FieldSymbol>.Empty) == CallerUnsafeMode.None || 10013Debug.Assert(symbol is not TypeSymbol); 10079Debug.Assert(eventSymbol.GetCallerUnsafeMode(ConsList<FieldSymbol>.Empty) == CallerUnsafeMode.None || 10175Debug.Assert(!methodOrPropertyGroup.Any()); 10180Debug.Assert(result.Kind != LookupResultKind.Empty); 10181Debug.Assert(!result.Symbols.Any(s => s.IsIndexer())); 10227Debug.Assert(methodOrPropertyGroup.Any() || ((object)other != null)); 10257Debug.Assert(members.Count > 0); 10262Debug.Assert(members.All(m => m.Kind == member.Kind)); 10270Debug.Assert(members.All(m => !m.IsIndexer())); 10299Debug.Assert(receiver.Type?.IsFunctionPointer() != true, "There should have been an error reported for indexing into a function pointer."); 10316Debug.Assert(propertyGroup.ReceiverOpt is not null); 10366Debug.Assert(expr.Type.TryGetInlineArrayElementField() is not null); 10382Debug.Assert(tryInlineArrayAccess); 10383Debug.Assert(diagnosticsForBindElementAccessCore.DiagnosticBag is { }); 10610Debug.Assert(node != null); 10611Debug.Assert(expr != null); 10612Debug.Assert((object)expr.Type != null); 10613Debug.Assert(arguments != null); 10641Debug.Assert(node != null); 10642Debug.Assert(expr != null); 10643Debug.Assert(arguments != null); 10702Debug.Assert(convertedArguments.Length == 1); 10724Debug.Assert(index != null); 10829Debug.Assert(expr != null); 10830Debug.Assert((object)targetType != null); 10846Debug.Assert(result != null); // If this ever fails (it shouldn't), then put a null-check around the diagnostics update. 10853Debug.Assert(node != null); 10854Debug.Assert(expr != null); 10855Debug.Assert(analyzedArguments != null); 10869Debug.Assert(expr.Type.IsPointerType()); 10915Debug.Assert(node != null); 10916Debug.Assert(expr != null); 10917Debug.Assert((object?)expr.Type != null); 10918Debug.Assert(analyzedArguments != null); 10934Debug.Assert(symbol.IsIndexer()); 11005Debug.Assert(property.ParameterCount > 0); 11023Debug.Assert(receiver is not null); 11051Debug.Assert(receiver is not null); 11117Debug.Assert(receiver is not null); 11134Debug.Assert(finalApplicableCandidates[0].IsApplicable); 11260Debug.Assert(receiver is not null); 11261Debug.Assert(receiver.Type is not null); 11299Debug.Assert(argKind != IndexOrRangeArgKind.None); 11300Debug.Assert(lengthOrCountAccess is BoundPropertyAccess); 11301Debug.Assert(indexerOrSliceAccess is BoundIndexerAccess or BoundCall); 11302Debug.Assert(indexerOrSliceAccess.Type is not null); 11365Debug.Assert(argKind != IndexOrRangeArgKind.None); 11376Debug.Assert(actualExtensionIntIndexerOrSliceArguments is null); 11496Debug.Assert(receiverPlaceholder.Type is not null); 11499Debug.Assert(receiverPlaceholder.Type is not null); 11524Debug.Assert(lookupResult.IsClear); 11604Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion | 11636Debug.Assert(node.LookupError == null); 11696Debug.Assert(!methodResolution.HasAnyApplicableMethod); 11697Debug.Assert(!extensionMethodResolution.HasAnyApplicableMethod); 11698Debug.Assert(!methodResolution.IsEmpty); 11699Debug.Assert(!extensionMethodResolution.IsEmpty); 11713Debug.Assert(!extensionMethodResolution.IsEmpty); 11731Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion | 11864Debug.Assert(node.ReceiverOpt!.Type is not null); // extensions are only considered on member access 11882Debug.Assert(extensionMember is not null); 11921Debug.Assert(methods.Count != 0); 12080Debug.Assert(node.ReceiverOpt!.Type is not null); // extensions are only considered on member access 12096Debug.Assert(extensionMember is not null); 12209Debug.Assert(ContainingMemberOrLambda is { }); 12210Debug.Assert(parameterRefKinds.IsDefault || parameterRefKinds.Length == parameterTypes.Length); 12211Debug.Assert(parameterDefaultValues.IsDefault || parameterDefaultValues.Length == parameterTypes.Length); 12212Debug.Assert(returnType.Type is { }); // Expecting System.Void rather than null return type. 12213Debug.Assert(!hasParams || parameterTypes.Length != 0); 12302Debug.Assert((location == null) ^ (node == null)); 12356Debug.Assert((object)receiverType != null); 12475Debug.Assert(node != null); 12476Debug.Assert(node.Expression != null); 12482Debug.Assert(receiver != null); 12491Debug.Assert(conditionalAccessNode != null);
Binder\Binder_Flags.cs (6)
23Debug.Assert(containingMemberOrLambda != null); 31Debug.Assert(containingMemberOrLambda != null); 53Debug.Assert(receiverExpression != null); 80Debug.Assert((object)containing != null); 90Debug.Assert((object)containing != null); 124Debug.Assert(!this.Flags.Includes(BinderFlags.UncheckedRegion | BinderFlags.CheckedRegion));
Binder\Binder_Initializers.cs (5)
89Debug.Assert((object)fieldSymbol != null); 147Debug.Assert((ContainingMemberOrLambda is TypeSymbol containing && TypeSymbol.Equals(containing, fieldSymbol.ContainingType, TypeCompareKind.ConsiderEverything2)) || //should be the binder for the type 195Debug.Assert(syntaxTree.Options.Kind != SourceCodeKind.Regular); 207Debug.Assert(scriptClassBinder.ContainingMemberOrLambda is NamedTypeSymbol { IsScriptClass: true }); 289Debug.Assert(!fieldSymbol.IsMetadataConstant);
Binder\Binder_InterpolatedString.cs (21)
188Debug.Assert(isResultConstant == (resultConstant != null)); 219Debug.Assert(unconvertedInterpolatedString.Type?.SpecialType == SpecialType.System_String); 245Debug.Assert(unconvertedInterpolatedString.Parts.All(static part => part.Type is null or { SpecialType: SpecialType.System_String })); 387Debug.Assert(fillin.Alignment.ConstantValueOpt is { }); 392Debug.Assert(fillin.Format.ConstantValueOpt is { }); 407Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue != null); 442Debug.Assert(binaryOperator.IsUnconvertedInterpolatedStringAddition); 484Debug.Assert(partsArrayBuilder.Count >= 2); 510Debug.Assert(count <= 4); 530Debug.Assert(arg.AppendCalls.Length > i); 590Debug.Assert(appendCalls.Length == 1); 608Debug.Assert(binaryOperator.IsUnconvertedInterpolatedStringAddition); 641Debug.Assert(additionalConstructorArguments.IsDefault 669Debug.Assert(appendCallsArray.Select(a => a.Length).SequenceEqual(partsArray.Select(a => a.Length))); 670Debug.Assert(appendCallsArray.All(appendCalls => appendCalls.All(a => a is { HasErrors: true } or BoundCall { Arguments: { Length: > 0 } } or BoundDynamicInvocation))); 799Debug.Assert(constructorCall.HasErrors || constructorCall is BoundObjectCreationExpression or BoundDynamicObjectCreationExpression); 887Debug.Assert(part is BoundLiteral { Type: { SpecialType: SpecialType.System_String }, ConstantValueOpt.IsString: true }); 920Debug.Assert(part is BoundLiteral or BoundStringInsert); 952Debug.Assert(boundLiteral.ConstantValueOpt != null && boundLiteral.ConstantValueOpt.IsString); 970Debug.Assert(parameterNamesAndLocationsBuilder.Count == 0 || parameterNamesAndLocationsBuilder[0] == null); 979Debug.Assert(call is BoundCall or BoundDynamicInvocation or { HasErrors: true });
Binder\Binder_Invocation.cs (55)
101Debug.Assert(receiver != null); 102Debug.Assert(names.IsDefault || names.Length == args.Length); 125Debug.Assert(allowFieldsAndProperties || boundExpression.Kind is (BoundKind.MethodGroup or BoundKind.BadExpression)); 130Debug.Assert(!args.Any(static e => e.Kind == BoundKind.OutVariablePendingInference || 149Debug.Assert(diagnostics.DiagnosticBag is null || diagnostics.HasAnyErrors()); 226Debug.Assert(node.Expression.Kind() is SyntaxKind.SimpleMemberAccessExpression); 434Debug.Assert(ContainingType is not null); 565Debug.Assert(receiver.Type is not null); 617Debug.Assert((object?)arg.Type != null); 759Debug.Assert(extensionMemberAccess.Kind != BoundKind.MethodGroup); 793Debug.Assert(methodGroup.LookupSymbolOpt is not MethodSymbol); 860Debug.Assert(finalApplicableCandidates[0].IsApplicable); 872Debug.Assert(finalApplicableCandidates.Length > 0); 881Debug.Assert(methodGroup.ReceiverOpt != null && (object)methodGroup.ReceiverOpt.Type != null); 1042Debug.Assert(overloadResolutionResult.HasAnyApplicableMember); 1100Debug.Assert(diagnostics != null); 1182Debug.Assert(node != null); 1183Debug.Assert(methodGroup != null); 1184Debug.Assert(methodGroup.Error == null); 1185Debug.Assert(methodGroup.Methods.Count > 0); 1186Debug.Assert(((object)delegateTypeOpt == null) || (methodGroup.Methods.Count == 1)); 1192Debug.Assert(!invokedAsExtensionMethod || ((object)delegateTypeOpt == null)); 1256Debug.Assert(methodResult.Result.ConversionForArg(0).Exists); 1272Debug.Assert(analyzedArguments.Arguments[0] == (object)methodGroup.Receiver); 1315Debug.Assert(analyzedArguments.RefKind(0) == RefKind.None); 1364Debug.Assert(!method.HasUseSiteError, "Shouldn't have reached this point if there were use site errors."); 1375Debug.Assert(args.IsDefaultOrEmpty || (object)receiver != (object)args[0]); 1456Debug.Assert(parameterType.IsDynamic() || parameterType.SpecialType == SpecialType.System_Object); 1537Debug.Assert(argumentOrdinal < argsToParamsOpt.Length); 1580Debug.Assert(argumentsBuilder[i].IsParamsArrayOrCollection); 1581Debug.Assert(i + 1 == argumentsBuilder.Count || 1597Debug.Assert(argumentsBuilder.Count >= parameters.Length); // Accounting for arglist cases 1598Debug.Assert(argumentRefKindsBuilder is null || argumentRefKindsBuilder.Count == 0 || argumentRefKindsBuilder.Count == argumentsBuilder.Count); 1599Debug.Assert(namesBuilder is null || namesBuilder.Count == 0 || namesBuilder.Count == argumentsBuilder.Count); 1600Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == argumentsBuilder.Count); 1622Debug.Assert(InAttributeArgument || (attributedMember is null && containingMember is not null)); 1628Debug.Assert(!expanded || parameters[^1].IsParams); 1637Debug.Assert(parameter.IsOptional); 1678Debug.Assert(argumentsBuilder.Count == parameters.Length); 1679Debug.Assert(argumentRefKindsBuilder is null || argumentRefKindsBuilder.Count == 0 || argumentRefKindsBuilder.Count == parameters.Length); 1680Debug.Assert(namesBuilder is null || namesBuilder.Count == 0 || namesBuilder.Count == parameters.Length); 1681Debug.Assert(argsToParamsBuilder is null || argsToParamsBuilder.Count == parameters.Length); 1713Debug.Assert((object?)defaultConstantValue != ConstantValue.Unset); 1806Debug.Assert(parameterIndex >= 0); 1900Debug.Assert(false); // Add test if this code path is reachable 1906Debug.Assert(conversion.IsCollectionExpression); 1923Debug.Assert(collection.IsParamsArrayOrCollection); 1992Debug.Assert(typeOrValue.Binder == (object)this); 2008Debug.Assert(typeOrValue.Type.Equals(boundValue.Type, TypeCompareKind.ConsiderEverything)); 2009Debug.Assert(typeOrValue.ValueSymbol == (boundValue.ExpressionSymbol ?? ((BoundConversion)boundValue).Operand.ExpressionSymbol)); 2168Debug.Assert(!p.IsExtensionBlockMember()); 2389Debug.Assert(binder.Flags == this.Flags); 2450Debug.Assert(!syntaxIsOk); 2451Debug.Assert(indexerAccess.AccessorKind == AccessorKind.Unknown); 2467Debug.Assert(!resolution.IsNonMethodExtensionMember(out _));
Binder\Binder_Lambda.cs (6)
43Debug.Assert(syntax != null); 44Debug.Assert(syntax.IsAnonymousFunction()); 296Debug.Assert(syntax is not ScopedTypeSyntax); 367Debug.Assert(syntax != null); 368Debug.Assert(syntax.IsAnonymousFunction()); 436Debug.Assert(s_lambdaBindings is null);
Binder\Binder_Lookup.cs (40)
69Debug.Assert(options.AreValid()); 73Debug.Assert((binder != null) || result.IsClear); 80Debug.Assert(binder == otherBinder); 83Debug.Assert(result.IsMultiViable || result.IsClear || result.Error != null); 90Debug.Assert(result.IsClear); 91Debug.Assert(options.AreValid()); 156Debug.Assert(options.AreValid()); 167Debug.Assert(result.IsMultiViable || result.IsClear || result.Error != null); 172Debug.Assert(options.AreValid()); 174Debug.Assert(arity >= 0); 202Debug.Assert(name == WellKnownMemberNames.Indexer); 208Debug.Assert(implementationsToShadow is null); 233Debug.Assert(resultOfThisMember.Symbol is not null); 262Debug.Assert(resultOfThisMember.Symbol is not null); 459Debug.Assert(result.Symbols.All(IsMethodOrIndexer)); 577Debug.Assert(result.IsClear); 578Debug.Assert(options.AreValid()); 579Debug.Assert(options.IsAttributeTypeLookup()); 631Debug.Assert(resultWithSuffix != null); 695Debug.Assert(symbols.Count >= 2); 707Debug.Assert(!best.IsNone); 708Debug.Assert(!secondBest.IsNone); 766Debug.Assert((object)symbol != null); 776Debug.Assert((object)symbol != null); 792Debug.Assert(!diagnose || useSiteInfo.AccumulatesDiagnostics); 907Debug.Assert((object)type != null); 908Debug.Assert(!type.IsInterfaceType() && type.TypeKind != TypeKind.TypeParameter); 1126Debug.Assert((object)type != null); 1127Debug.Assert(type.IsInterface); 1254Debug.Assert((object)type != null); 1255Debug.Assert(type.IsInterface); 1272Debug.Assert((object)typeParameter != null); 1280Debug.Assert(!originalBinder.InCref, "Can't dot into type parameters, so how can this happen?"); 1291Debug.Assert(!TypeSymbol.Equals(baseType, derivedType, TypeCompareKind.ConsiderEverything2)); 1489Debug.Assert((options & LookupOptions.MustBeAbstractOrVirtual) == 0 || (options & LookupOptions.MustNotBeInstance) != 0); 1648Debug.Assert(symbol.MustCallMethodsDirectly()); 1687Debug.Assert(symbol.Kind != SymbolKind.Alias, "It is the caller's responsibility to unwrap aliased symbols."); 1688Debug.Assert(aliasSymbol == null || aliasSymbol.GetAliasTarget(basesBeingResolved: null) == symbol); 1689Debug.Assert(options.AreValid()); 1880Debug.Assert(object.ReferenceEquals(namedType.ConstructedFrom, namedType));
Binder\Binder_Operators.cs (156)
72Debug.Assert(left.Type is { }); 136Debug.Assert(ordinaryInstanceOperatorName is not null); 162Debug.Assert(resultKind is LookupResultKind.Viable or LookupResultKind.Ambiguous or LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 163Debug.Assert(best.HasValue == (resultKind is LookupResultKind.Viable)); 164Debug.Assert(resultKind is not (LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty) || originalUserDefinedOperators.IsEmpty); 168Debug.Assert(resultKind is LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 169Debug.Assert(originalUserDefinedOperators.IsEmpty); 184Debug.Assert(instanceExtensionResult.ResultKind is LookupResultKind.Viable || !instanceExtensionResult.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 268Debug.Assert(leftType is { }); 283Debug.Assert(finalConversion.HasErrors || (object)finalConversion == finalPlaceholder); 312Debug.Assert(left.Kind != BoundKind.EventAccess || hasError); 341Debug.Assert(!left.HasDynamicType()); 384Debug.Assert(leftType is not null); 412Debug.Assert(analyzedArguments is not null); 430Debug.Assert(!methods.IsEmpty); 435Debug.Assert(leftType is not null); 448Debug.Assert(analyzedArguments.RefKinds.Count == 0); 487Debug.Assert(method.ContainingType.ExtensionParameter is not null); 502Debug.Assert(conversion.Kind is ConversionKind.ImplicitReference); 503Debug.Assert(leftType.IsReferenceType); 601Debug.Assert(ordinaryInstanceOperatorName is not null); 692Debug.Assert(opKind == BinaryOperatorKind.Addition || opKind == BinaryOperatorKind.Subtraction); 778Debug.Assert(operand != null); 808Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 838Debug.Assert(left.Type is not TypeParameterSymbol); 890Debug.Assert(IsSimpleBinaryOperator(node.Kind())); 925Debug.Assert(IsSimpleBinaryOperator(syntaxNode.Kind())); 988Debug.Assert(right.Type.SpecialType == SpecialType.System_String); 1043Debug.Assert(!resultOperatorKind.IsUserDefined()); 1073Debug.Assert((object)signature.LeftType != null); 1074Debug.Assert((object)signature.RightType != null); 1087Debug.Assert(conversionDiagnostics != diagnostics); 1091Debug.Assert(sourceBag is not null); 1217Debug.Assert(isObjectEquality); 1255Debug.Assert(current.IsUnconvertedInterpolatedStringAddition); 1260Debug.Assert(stack.Count > 0 && stack.Peek().Left is BoundUnconvertedInterpolatedString); 1277Debug.Assert(left != null); 1278Debug.Assert(stack.Count == 0); 1314Debug.Assert(!conversion.IsImplicit); 1344Debug.Assert(!right.Type.IsReferenceType); 1348Debug.Assert(!left.Type.IsReferenceType); 1389Debug.Assert(node.Kind() == SyntaxKind.LogicalOrExpression || node.Kind() == SyntaxKind.LogicalAndExpression); 1435Debug.Assert(kind == BinaryOperatorKind.LogicalAnd || kind == BinaryOperatorKind.LogicalOr); 1526Debug.Assert(trueOperator is { HasValue: true }); 1527Debug.Assert(falseOperator is { HasValue: true }); 1535Debug.Assert(resultLeft.Type.Equals(signature.LeftType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 1565Debug.Assert(bothBool); 1566Debug.Assert(!(signature.Method?.ContainingType?.IsInterface ?? false)); 1615Debug.Assert(left.IsLiteralNull()); 1646Debug.Assert(result.Conversion.IsImplicit); 1677Debug.Assert(signature.Kind.OperandTypes() == BinaryOperatorKind.UserDefined); 1678Debug.Assert(signature.Method is not null); 1693Debug.Assert(trueOperator is { HasValue: true }); 1694Debug.Assert(falseOperator is { HasValue: true }); 1695Debug.Assert(!trueOperator.GetValueOrDefault().Signature.Kind.IsLifted()); 1696Debug.Assert(!falseOperator.GetValueOrDefault().Signature.Kind.IsLifted()); 1700Debug.Assert(trueOperator is null); 1701Debug.Assert(falseOperator is null); 1895Debug.Assert(result.Results.IsEmpty); 2059Debug.Assert(resultKind is LookupResultKind.Viable or LookupResultKind.Ambiguous or LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 2060Debug.Assert(possiblyBest.HasValue == (resultKind is LookupResultKind.Viable)); 2061Debug.Assert(resultKind is not (LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty) || originalUserDefinedOperators.IsEmpty); 2065Debug.Assert(resultKind is LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 2066Debug.Assert(originalUserDefinedOperators.IsEmpty); 2169Debug.Assert(resultKind is LookupResultKind.Viable or LookupResultKind.Ambiguous or LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 2170Debug.Assert(possiblyBest.HasValue == (resultKind is LookupResultKind.Viable)); 2171Debug.Assert(resultKind is not (LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty) || originalUserDefinedOperators.IsEmpty); 2267Debug.Assert(resultKind is LookupResultKind.Viable or LookupResultKind.Ambiguous or LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 2268Debug.Assert(best.HasValue == (resultKind is LookupResultKind.Viable)); 2269Debug.Assert(resultKind is not (LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty) || originalUserDefinedOperators.IsEmpty); 2273Debug.Assert(resultKind is LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 2274Debug.Assert(originalUserDefinedOperators.IsEmpty); 2316Debug.Assert(resultKind is LookupResultKind.Viable or LookupResultKind.Ambiguous or LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 2317Debug.Assert(possiblyBest.HasValue == (resultKind is LookupResultKind.Viable)); 2318Debug.Assert(resultKind is not (LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty) || originalUserDefinedOperators.IsEmpty); 2460Debug.Assert(valueLeft != null); 2461Debug.Assert(valueRight != null); 2491Debug.Assert(valueLeft != null); 2492Debug.Assert(valueRight != null); 2534Debug.Assert(valueLeft != null); 2535Debug.Assert(valueRight != null); 2590Debug.Assert(valueLeft != null); 2591Debug.Assert(valueRight != null); 2686Debug.Assert(left != null); 2687Debug.Assert(right != null); 2688Debug.Assert(kind.IsEnum()); 2689Debug.Assert(!kind.IsLifted()); 2732Debug.Assert(resultTypeSymbol.SpecialType == SpecialType.System_Boolean); 2761Debug.Assert(left != null); 2762Debug.Assert(right != null); 2945Debug.Assert(valueLeft != null); 2946Debug.Assert(valueRight != null); 3200Debug.Assert(valueLeft != null); 3201Debug.Assert(valueRight != null); 3298Debug.Assert(operandType is not null); 3325Debug.Assert(ordinaryInstanceOperatorName is not null); 3342Debug.Assert(resultKind is LookupResultKind.Viable or LookupResultKind.Ambiguous or LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 3343Debug.Assert(best.HasValue == (resultKind is LookupResultKind.Viable)); 3344Debug.Assert(resultKind is not (LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty) || originalUserDefinedOperators.IsEmpty); 3348Debug.Assert(resultKind is LookupResultKind.OverloadResolutionFailure or LookupResultKind.Empty); 3349Debug.Assert(originalUserDefinedOperators.IsEmpty); 3365Debug.Assert(instanceExtensionResult.ResultKind is LookupResultKind.Viable || !instanceExtensionResult.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3409Debug.Assert(hasErrors || (object)resultConversion == resultPlaceholder); 3419Debug.Assert(!signature.Kind.IsUserDefined()); 3452Debug.Assert(operandType is not null); 3453Debug.Assert(!operandType.IsDynamic()); 3454Debug.Assert(kind is (UnaryOperatorKind.PrefixIncrement or UnaryOperatorKind.PrefixDecrement or UnaryOperatorKind.PostfixIncrement or UnaryOperatorKind.PostfixDecrement)); 3498Debug.Assert(operand.Type is not null); 3499Debug.Assert(mode != InstanceUserDefinedIncrementUsageMode.None); 3520Debug.Assert(analyzedArguments is not null); 3539Debug.Assert(!methods.IsEmpty); 3542Debug.Assert(operandType is not null); 3558Debug.Assert(analyzedArguments.RefKinds.Count == 0); 3593Debug.Assert(method.ContainingType.ExtensionParameter is not null); 3608Debug.Assert(conversion.Kind is ConversionKind.ImplicitReference); 3609Debug.Assert(operandType.IsReferenceType); 3693Debug.Assert(operand.Type is not null); 3710Debug.Assert(ordinaryInstanceOperatorName is not null); 3775Debug.Assert(mode != InstanceUserDefinedIncrementUsageMode.None); 3795Debug.Assert(parameterCount is 0 or 1); 3801Debug.Assert(SyntaxFacts.IsCheckedOperator(checkedName)); 3859Debug.Assert(parameterCount is 0 or 1); 3870Debug.Assert(parameterCount is 0 or 1); 3875Debug.Assert(SyntaxFacts.IsCheckedOperator(checkedName)); 3924Debug.Assert(extensionParameter is not null); 3936Debug.Assert(!op.IsStatic); 3960Debug.Assert(!x.IsOverride); 3961Debug.Assert(!x.IsStatic); 3963Debug.Assert(!y.IsOverride); 3964Debug.Assert(!y.IsStatic); 3973Debug.Assert(!method.IsOverride); 3974Debug.Assert(!method.IsStatic); 4032Debug.Assert((methodOpt.Name == WellKnownMemberNames.UnsignedRightShiftOperatorName) == isUnsignedRightShift); 4069Debug.Assert(node.Operand.SkipParens().GetLastToken().Kind() == SyntaxKind.ExclamationToken); 4146Debug.Assert(hasErrors); 4155Debug.Assert((object)operandType != null, "BindValue should have caught a null operand type"); 4477Debug.Assert(operand != null); 4662Debug.Assert(false, "Should be handled separately."); 4731Debug.Assert(valueRight != null); 4862Debug.Assert(hasUnionMatching); 4930Debug.Assert((object)inputType != null); 5052Debug.Assert(constantValue == ConstantValue.True || constantValue == ConstantValue.False); 5075Debug.Assert((object)targetType != null); 5116Debug.Assert((object)operandType != null); 5216Debug.Assert(operandType is TypeParameterSymbol { AllowsRefLikeType: false }); 5224Debug.Assert(targetType is TypeParameterSymbol { AllowsRefLikeType: false }); 5312Debug.Assert(operandType.IsNullableType()); 5369Debug.Assert(targetType.IsNullableType()); 5485Debug.Assert(operand.Type is null); 5501Debug.Assert((object)operandType != null); 5504Debug.Assert(!targetType.IsPointerOrFunctionPointer(), "Should have been caught above"); 5635Debug.Assert(constantValue.IsNull); 5890Debug.Assert((object)leftType != null); 6066Debug.Assert(type is { }); 6067Debug.Assert(Conversions.HasIdentityConversion(trueType, type)); 6068Debug.Assert(Conversions.HasIdentityConversion(falseType, type));
Binder\Binder_Patterns.cs (44)
30Debug.Assert(unionType is null || inputType.IsObjectType()); 76Debug.Assert(expression.Type is { }); 109Debug.Assert(expression.Type is object); 127Debug.Assert(expression.Type is object); 300Debug.Assert(indexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess); 308Debug.Assert(indexerAccess.Type is not null); 394Debug.Assert(indexerAccess!.Type is not null); 429Debug.Assert(!inputType.IsDynamic()); 458Debug.Assert(indexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess or BoundPointerElementAccess); 528Debug.Assert(hasUnionMatching); 569Debug.Assert(unionMatchingInputType is null || unionMatchingInputType.IsSubjectForUnionMatching); 674Debug.Assert(hasErrors); 872Debug.Assert((object)inputType != null); 873Debug.Assert((object)patternType != null); 959Debug.Assert(unionType.IsUnionType); 1019Debug.Assert((!conversion.IsUserDefined && !conversion.IsUnion) || result == ConstantValue.False || result == ConstantValue.Bad); 1056Debug.Assert(declType.HasType); 1117Debug.Assert(designation.SyntaxTree.Options.Kind != SourceCodeKind.Regular); 1220Debug.Assert(typeSyntax is null); 1221Debug.Assert(unionMatchingMode == UnionMatchingMode.None); 1269Debug.Assert(unionType is null || inputType.IsObjectType()); 1471Debug.Assert(!declType.IsTupleType); 1472Debug.Assert(!IsZeroElementTupleType(declType)); 1598Debug.Assert(node.Parent is { }); 1676Debug.Assert(unionType is null || strippedInputType.IsObjectType()); 1772Debug.Assert(expr is not null); 1887Debug.Assert(boundMember.HasAnyErrors); 1918Debug.Assert(declType.HasType); 1937Debug.Assert(unionType is null || inputType.IsObjectType()); 1953Debug.Assert(unionValueMatchingInputType == (object)inputType); 1971Debug.Assert(unionValueTypeMatchHasErrors && instanceTypeMatchHasErrors); 2035Debug.Assert(!isExplicitNotNullTest || unionMatchingMode == UnionMatchingMode.None); 2037Debug.Assert(unionType is null || inputType.IsObjectType()); 2059Debug.Assert(type is { }); 2167Debug.Assert(currentUnionType is null || subPattern.NarrowedType.IsObjectType()); 2193Debug.Assert(binaryPatternStack.Count > 0); 2202Debug.Assert(permitDesignations); 2207Debug.Assert(currentPermitDesignations == binaryPatternAndPermitDesignations.permitDesignations); 2232Debug.Assert(binaryPatternAndPermitDesignations.pat.IsKind(SyntaxKind.AndPattern)); 2237Debug.Assert(currentPermitDesignations == (permitDesignations && binaryPatternAndPermitDesignations.permitDesignations)); 2261Debug.Assert(!permitDesignations); 2267Debug.Assert(!permitDesignations); 2298Debug.Assert(candidates.Count >= 2); 2318Debug.Assert(spoiler.Equals(bestSoFar, TypeCompareKind.ConsiderEverything));
Binder\Binder_Query.cs (11)
109Debug.Assert(state.clauses.IsEmpty()); 219Debug.Assert(state.clauses.IsEmpty()); 300Debug.Assert(state.fromExpression.Type is { }); 694Debug.Assert(LambdaUtilities.IsQueryPairLambda(node)); 746Debug.Assert(yExpression.Type is { }); 841Debug.Assert(lambdaSymbol != null); 872Debug.Assert(node is ExpressionSyntax || LambdaUtilities.IsQueryPairLambda(node)); 925Debug.Assert(expectedMethodName is null || expectedMethodName == methodName); 933Debug.Assert(receiver.Type is object || ultimateReceiver.Type is null); 936Debug.Assert(ultimateReceiver.Kind != BoundKind.MethodGroup || ultimateReceiver.HasAnyErrors); 1024Debug.Assert(receiver == originalUltimateReceiver);
Binder\Binder_QueryErrors.cs (1)
215Debug.Assert(methodName == "SelectMany");
Binder\Binder_Statements.cs (94)
59Debug.Assert(node != null); 151Debug.Assert(result.WasCompilerGenerated == false || 156Debug.Assert(result.Syntax is StatementSyntax, "BoundStatement should be associated with a statement syntax."); 158Debug.Assert(System.Linq.Enumerable.Contains(result.Syntax.AncestorsAndSelf(), node), @"Bound statement (or one of its parents) 189Debug.Assert(fixedBinder != null); 203Debug.Assert(!declarations.IsEmpty); 298Debug.Assert(lockBinder != null); 310Debug.Assert(usingBinder != null); 339Debug.Assert(binder != null); 348Debug.Assert(binder != null); 354Debug.Assert(binder != null); 593Debug.Assert(blockBody != null || expressionBody != null || (localSymbol.IsExtern && localSymbol.IsStatic) || hasErrors); 703Debug.Assert(usingDeclaration is BoundUsingLocalDeclarations); 763Debug.Assert(expr is object); 764Debug.Assert(expr.Type is object); 765Debug.Assert(expr.Type.IsRefLikeType || hasAwait); // pattern dispose lookup is only valid on ref structs or asynchronous usings 793Debug.Assert( 803Debug.Assert(typeSyntax is not ScopedTypeSyntax); 805Debug.Assert(declType.HasType || isVar); 965Debug.Assert(declarator != null); 991Debug.Assert(declarator != null); 992Debug.Assert(declTypeOpt.HasType || isVar); 993Debug.Assert(typeSyntax != null); 1076Debug.Assert(declTypeOpt.HasType); 1229Debug.Assert(!ReferenceEquals(declType, null)); 1230Debug.Assert(declType.IsPointerType()); 1366Debug.Assert(initializer != null); 1410Debug.Assert(node != null); 1411Debug.Assert(node.Left != null); 1412Debug.Assert(node.Right != null); 1486Debug.Assert(op1 != null); 1487Debug.Assert(op2 != null); 1493Debug.Assert(!op1.NeedsToBeConverted() 1555Debug.Assert(op1 != null); 1556Debug.Assert(op2 != null); 1560Debug.Assert(op1.Type is { }); 1593Debug.Assert(leftEscape.Equals(rightEscape) || op1.Type.IsRefLikeOrAllowsRefLikeType()); 1601Debug.Assert(op1.Kind != BoundKind.Parameter); // If the assert fails, add a corresponding test. 1649Debug.Assert(false); 1657Debug.Assert(methodInvocationInfo.MethodInfo.Method is not null); 1861Debug.Assert((object)receiver.Type != null); 1872Debug.Assert(node != null); 1917Debug.Assert(binder != null); 1968Debug.Assert((object)targetType != null); 1969Debug.Assert(expression != null); 2048Debug.Assert((object)targetType != null); 2049Debug.Assert(anonymousFunction != null); 2105Debug.Assert(targetType.IsExpressionTree()); 2112Debug.Assert(targetType.IsGenericOrNonGenericExpressionType(out _)); 2150Debug.Assert(delegateType is not null); 2208Debug.Assert(diagnostics.DiagnosticBag?.Count is not 0); 2231Debug.Assert(anonymousFunction.HasExplicitlyTypedParameterList); 2235Debug.Assert(anonymousFunction.ParameterCount == delegateParameters.Length); 2241Debug.Assert(!lambdaParameterType.IsErrorType()); 2263Debug.Assert(ErrorFacts.PreventsSuccessfulDelegateConversion(bindingResult.Diagnostics.Diagnostics)); 2270Debug.Assert(false, "Missing case in lambda conversion error reporting"); 2281Debug.Assert(!conversion.IsImplicit || !conversion.IsValid); 2315Debug.Assert(conversion.IsUserDefined || conversion.IsUnion); 2324Debug.Assert(originalUserDefinedConversions.Length == 0, 2353Debug.Assert(operand != null); 2354Debug.Assert((object)targetType != null); 2445Debug.Assert(reportedError); 2465Debug.Assert(reportedError); 2487Debug.Assert(operand.HasAnyErrors && operand.Kind != BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting"); 2605Debug.Assert(b != null); 2790Debug.Assert(node != null); 2807Debug.Assert(node != null); 2810Debug.Assert(loopBinder != null); 2822Debug.Assert(loopBinder != null); 2835Debug.Assert(loopBinder != null); 2853Debug.Assert(typeSyntax is not ScopedTypeSyntax || localKind is LocalDeclarationKind.RegularVariable or LocalDeclarationKind.UsingVariable); 2873Debug.Assert(declType.HasType || isVar); 2877Debug.Assert(count > 0); 2965Debug.Assert(name != null); 3215Debug.Assert(returnRefKind == RefKind.None); 3292Debug.Assert(node != null); 3340Debug.Assert((object)type != null); 3376Debug.Assert(((object)type == null) || !type.IsErrorType()); 3418Debug.Assert(binder != null); 3426Debug.Assert(local.Type.IsErrorType() || (TypeSymbol.Equals(local.Type, type, TypeCompareKind.ConsiderEverything2))); 3568Debug.Assert(expressionSyntax != null || !IsValidExpressionBody(expressionSyntax, expression)); 3658Debug.Assert(bodyBinder != null); 3679Debug.Assert(bodyBinder != null); 3691Debug.Assert(bodyBinder != null); 3693Debug.Assert(body.Kind() != SyntaxKind.RefExpression); 3771Debug.Assert(typeDecl.ParameterList is object); 3772Debug.Assert(typeDecl.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration); 3779Debug.Assert(initializerBinder != null); 3800Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer."); 3813Debug.Assert(bodyBinder != null); 3878Debug.Assert(!this.ContainingMember().IsImplicitlyDeclared); 3880Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer."); 3897Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer."); 3921Debug.Assert(sourceConstructor?.SyntaxNode is TypeDeclarationSyntax
Binder\Binder_Symbols.cs (44)
42Debug.Assert(isVar == symbol.IsDefault); 62Debug.Assert((keyword != ConstraintContextualKeyword.None) == symbol.IsDefault); 83Debug.Assert(isVar == symbol.IsDefault); 277Debug.Assert(UnwrapAliasNoDiagnostics(symbol) is NamespaceSymbol); 325Debug.Assert(diagnostics != null); 400Debug.Assert(!result.IsDefault); 1136Debug.Assert(syntax != null); 1137Debug.Assert(diagnostics != null); 1319Debug.Assert(lookupResult.Error != null); 1362Debug.Assert(typeArguments.Count > 0); 1458Debug.Assert(members.Count > 0); 1563Debug.Assert(lookupResult?.IsClear != false); 1602Debug.Assert(symbol.IsExtensionBlockMember()); 1639Debug.Assert(!typeArguments.IsEmpty); 1721Debug.Assert((object)typeSymbol != null, "Expect an error type if special type isn't found"); 1729Debug.Assert((object)typeSymbol != null, "Expect an error type if special type isn't found"); 1794Debug.Assert(symbol.IsDefinition); 1859Debug.Assert((object)typeSymbol != null, "Expect an error type if well-known type isn't found"); 1867Debug.Assert((object)typeSymbol != null, "Expect an error type if well-known type isn't found"); 1889Debug.Assert((object)typeSymbol != null, "Expect an error type if well-known type isn't found"); 1905Debug.Assert((syntax != null) ^ (location != null)); 2027Debug.Assert(where != null); 2028Debug.Assert(diagnostics != null); 2050Debug.Assert(!best.IsNone); 2051Debug.Assert(!secondBest.IsNone); 2066Debug.Assert(best.IsFromAddedModule); 2109Debug.Assert(!(srcSymbol.Kind == SymbolKind.Namespace && mdSymbol.Kind == SymbolKind.Namespace)); 2117Debug.Assert(!Symbol.Equals(originalSymbols[best.Index], originalSymbols[secondBest.Index], TypeCompareKind.ConsiderEverything) || options.IsAttributeTypeLookup(), 2120Debug.Assert(!Symbol.Equals(first, second, TypeCompareKind.ConsiderEverything) || !Symbol.Equals(originalSymbols[best.Index], originalSymbols[secondBest.Index], TypeCompareKind.ConsiderEverything), 2161Debug.Assert(!best.IsFromCorLibrary); 2173Debug.Assert(best.IsFromCompilation); 2209Debug.Assert(secondBest.IsFromAddedModule); 2220Debug.Assert(best.IsFromAddedModule); 2244Debug.Assert(arg2.ContainingAssembly == Compilation.Assembly); 2275Debug.Assert(originalSymbols[best.Index].Name != originalSymbols[secondBest.Index].Name || 2404Debug.Assert(symbols.Count > 0); 2524Debug.Assert(location != BestSymbolLocation.None); 2551Debug.Assert(secondLocation != 0); 2598Debug.Assert(!first.IsNone); 2599Debug.Assert(!second.IsNone); 2661Debug.Assert(qualifierOpt.IsNamespace); 2667Debug.Assert(aliasOpt == null || aliasOpt == SyntaxFacts.GetText(SyntaxKind.GlobalKeyword)); 2733Debug.Assert((object)forwardedType.ContainingAssembly != null, "How did we find a cycle if there was no forwarding?"); 2764Debug.Assert(false);
Binder\Binder_TupleOperators.cs (8)
56Debug.Assert(length == multiple.Operators.Length); 111Debug.Assert(!binary.OperatorKind.IsDynamic()); 187Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 224Debug.Assert((object)left.Type != null || left.Kind == BoundKind.TupleLiteral); 225Debug.Assert((object)right.Type != null || right.Kind == BoundKind.TupleLiteral); 241Debug.Assert(length == rightParts.Length); 291Debug.Assert(leftNoNames || rightNoNames || leftNames.Length == rightNames.Length); 338Debug.Assert(targetType.StrippedType().IsTupleType);
Binder\Binder_Unsafe.cs (10)
113Debug.Assert(this.Compilation.SourceModule.UseUpdatedMemorySafetyRules || callerUnsafeMode == CallerUnsafeMode.Implicit); 117Debug.Assert(callerUnsafeMode == CallerUnsafeMode.Explicit || !forConstructorConstraint); 149Debug.Fail($"Symbol {symbol} has {nameof(CallerUnsafeMode)}={callerUnsafeMode}."); 154Debug.Fail($"Symbol {symbol} has {nameof(symbol.Kind)}={symbol.Kind}."); 159Debug.Fail($"Symbol {symbol} is a generic type."); 199Debug.Assert((node.Kind() == SyntaxKind.SizeOfExpression) == ((object?)sizeOfTypeOpt != null), "Should have a type for (only) sizeof expressions."); 267Debug.Assert(sizeOfTypeOpt is null || disallowedUnder is MemorySafetyRules.Legacy); 279Debug.Assert(customErrorCode is null && customArgs is null); 299Debug.Assert(disallowedUnder is MemorySafetyRules.Updated); 328Debug.Assert(disallowedUnder is MemorySafetyRules.Updated);
Binder\Binder_XmlNameAttribute.cs (3)
41Debug.Assert(lookupResult.IsMultiViable); 45Debug.Assert(lookupSymbols[0].Kind == SymbolKind.TypeParameter || lookupSymbols[0].Kind == SymbolKind.Parameter); 46Debug.Assert(lookupSymbols.All(sym => sym.Kind == lookupSymbols[0].Kind));
Binder\Binder.CapturedParametersFinder.cs (2)
58Debug.Assert(syntaxNode is not null); 165Debug.Assert(lookupResult.SingleSymbolOrDefault == (object)parameter);
Binder\Binder.cs (2)
124Debug.Assert(Next is not null); 820Debug.Assert(syntax.GetLocation() != null);
Binder\Binder.IdentifierUsedAsValueFinder.cs (8)
123Debug.Assert(targetNode.Parent is not null); 204Debug.Assert(_lookupResult?.IsClear != false); 267Debug.Assert(!type.IsDynamic()); 268Debug.Assert(lookupResult.IsClear); 277Debug.Assert(lookupResult.Symbols.Any()); 285Debug.Assert(members.Count > 0); 297Debug.Assert(symbol.Kind != SymbolKind.Method); 373Debug.Assert(state.clauses.IsEmpty());
Binder\Binder.NamespaceOrTypeOrAliasSymbolWithAnnotations.cs (3)
22Debug.Assert(typeWithAnnotations.HasType); 30Debug.Assert(!(symbol is TypeSymbol)); 47Debug.Assert(_symbol?.Kind == SymbolKind.Alias); // Not meaningful to use this property otherwise
Binder\Binder.OperatorResolutionForReporting.cs (5)
28Debug.Assert(_nonExtensionResult is null or OverloadResolutionResult<MethodSymbol> or BinaryOperatorOverloadResolutionResult or UnaryOperatorOverloadResolutionResult); 29Debug.Assert(_extensionResult is null or OverloadResolutionResult<MethodSymbol> or BinaryOperatorOverloadResolutionResult or UnaryOperatorOverloadResolutionResult); 126Debug.Assert(results.All(r => r.resultKind == OperatorAnalysisResultKind.Inapplicable)); 247Debug.Assert(results.All(r => r.resultKind != kind)); 272Debug.Assert(first is not null);
Binder\Binder.QueryTranslationState.cs (2)
78Debug.Assert(identifier.Parent is { }); 126Debug.Assert(nextInvokedMethodName is null);
Binder\Binder.ValueChecks.cs (104)
93Debug.Assert(method is ErrorMethodSymbol or { HasUnsupportedMetadata: true }); 156Debug.Assert(indexerAccess.AccessorKind != AccessorKind.Set); 172Debug.Assert(objectCreation.Constructor is not null); 188Debug.Assert(unaryOperator.MethodOpt is not null); 205Debug.Assert(binaryOperatorMethod is not null); 260Debug.Assert(incrementOperator.MethodOpt is not null); 277Debug.Assert(method is not null); 306Debug.Assert(propertyAccess.AutoPropertyAccessorKind != AccessorKind.Set); 353Debug.Assert(parameter.RefKind.IsWritableReference() && parameter.Type.IsRefLikeOrAllowsRefLikeType()); 354Debug.Assert(GetParameterValEscapeLevel(parameter).HasValue); 395Debug.Assert(!isArgList || parameter is null); 662Debug.Assert(parameters.Length == indexer.Parameters.Length); 743Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut); 748Debug.Assert(valueKind == BindValueKind.RefOrOut); 752Debug.Assert(valueKind is (BindValueKind.Assignable or BindValueKind.RefOrOut or BindValueKind.RefAssignable) || diagnostics.DiagnosticBag is null || diagnostics.HasAnyResolvedErrors()); 854Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 873Debug.Assert(methodGroup.ResultKind != LookupResultKind.Viable); 880Debug.Assert(methodGroup.LookupError != null); 938Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 1109Debug.Assert(!RequiresRefAssignableVariable(valueKind)); 1404Debug.Assert(!RequiresAssignableVariable(BindValueKind.AddressOf)); 1423Debug.Assert(parameterSymbol.RefKind != RefKind.None || !RequiresRefAssignableVariable(valueKind)); 1431Debug.Assert(backingField.RefKind == RefKind.None); 1432Debug.Assert(!RequiresRefAssignableVariable(valueKind)); 1436Debug.Assert(backingField.RefKind == RefKind.None); 1469Debug.Assert(valueKind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 1573Debug.Assert(parameterSymbol.RefKind == RefKind.None || isRefScoped || refSafeToEscape.IsReturnOnly); 1655Debug.Assert(valueKind == BindValueKind.RefAssignable); 1666Debug.Assert(fieldAccess.ReceiverOpt is null or BoundTypeExpression); 1671Debug.Assert(fieldAccess.ReceiverOpt is not null); 1805Debug.Assert(fieldAccess.ReceiverOpt is { }); 1862Debug.Assert(!RequiresVariableReceiver(receiver, eventSymbol)); 1912Debug.Assert(receiver != null); 1997Debug.Assert((object)propertySymbol != null); 1998Debug.Assert(propertySyntax != null); 2010Debug.Assert(propertySymbol.TypeWithAnnotations.HasType); 2214Debug.Assert(member.Kind != SymbolKind.Property); 2215Debug.Assert(member.Kind != SymbolKind.Event); 2267Debug.Assert(AllParametersConsideredInEscapeAnalysisHaveArguments(in methodInvocationInfo)); 2430Debug.Assert(extensionParameter is not null); 2440Debug.Assert(methodInvocationInfo.HasAnyErrors, "Got a null receiver for a non-static extension method without errors?"); 2481Debug.Assert(AllParametersConsideredInEscapeAnalysisHaveArguments(in methodInvocationInfo)); 2668Debug.Assert(receiver.Type is { }); 2669Debug.Assert(methodInvocationInfo.ReceiverIsSubjectToCloning != ThreeState.Unknown); 2673Debug.Assert(receiver is not BoundValuePlaceholderBase && method is not null && receiver.Type?.IsReferenceType == false); 2701Debug.Assert(argIndex == argsOpt.Length - 1); 2884Debug.Assert(methodInfo.Method?.IsExtensionMethod != false); 2913Debug.Assert(parameter?.IsThis != true); 2918Debug.Assert(escapeLevel == EscapeLevel.ReturnOnly); 3144Debug.Assert(symbol is null or SourceLocalSymbol or GlobalExpressionVariable); 3359Debug.Assert(underlyingParameter.IsThis); 3360Debug.Assert(underlyingParameter.RefKind != RefKind.Out); // Shouldn't get here for a constructor 3361Debug.Assert(underlyingParameter.ContainingSymbol is MethodSymbol); 3436Debug.Assert((object)local != null); 3437Debug.Assert(kind != BindValueKind.RValue); 3598Debug.Assert((object)field != null); 3599Debug.Assert(field.RefKind == RefKind.None ? RequiresAssignableVariable(kind) : RequiresRefAssignableVariable(kind)); 3600Debug.Assert(field.Type != (object)null); 3604Debug.Assert(kind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 3634Debug.Assert((object)symbol != null); 3635Debug.Assert(RequiresAssignableVariable(kind)); 3671Debug.Assert(expr.Type is not null); 3752Debug.Assert(false); 3757Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 3885Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 3893Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 3921Debug.Assert(expr is BoundConversion conversion && 3928Debug.Assert(expr is BoundUnaryOperator unaryOperator && 3935Debug.Assert(expr is BoundBinaryOperator binaryOperator && 3942Debug.Assert(expr is BoundUserDefinedConditionalLogicalOperator logicalOperator && 3948Debug.Assert(expr is BoundCompoundAssignmentOperator compoundAssignmentOperator && 3955Debug.Assert(expr is BoundIncrementOperator incrementOperator && 3977Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 3981Debug.Assert(GetRefEscape(expr).IsConvertibleTo(escapeTo)); 4051Debug.Assert(false); 4056Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 4186Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 4194Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 4264Debug.Assert((!conversion.Conversion.IsUserDefined && !conversion.Conversion.IsUnion) || 4270Debug.Assert(expr is BoundUnaryOperator unaryOperator && 4277Debug.Assert(expr is BoundBinaryOperator binaryOperator && 4284Debug.Assert(expr is BoundUserDefinedConditionalLogicalOperator logicalOperator && 4290Debug.Assert(expr is BoundCompoundAssignmentOperator compoundAssignmentOperator && 4297Debug.Assert(expr is BoundIncrementOperator incrementOperator && 4368Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 4416Debug.Assert(false); 4594Debug.Assert(conversion.ConversionKind != ConversionKind.StackAllocToSpanType, "StackAllocToSpanType unexpected"); 4620Debug.Assert(operatorMethod is not null); 4642Debug.Assert(increment.OperatorKind.IsUserDefined()); 4645Debug.Assert(prefix || increment.OperatorKind.Operator() is UnaryOperatorKind.PostfixIncrement or UnaryOperatorKind.PostfixDecrement); 4790Debug.Assert(elementType.Type is { }); 4799Debug.Assert(elementType.Type is { }); 4803Debug.Assert(expr.CollectionCreation is not null); 4848Debug.Assert(spreadElement.HasErrors 4863Debug.Assert(element.HasErrors); 5037Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 5041Debug.Assert(GetValEscape(expr).IsConvertibleTo(escapeTo)); 5069Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 5174Debug.Assert(false); 5373Debug.Assert(conversion.ConversionKind != ConversionKind.StackAllocToSpanType, "StackAllocToSpanType unexpected"); 5409Debug.Assert(operatorMethod is not null); 5436Debug.Assert(increment.OperatorKind.IsUserDefined()); 5439Debug.Assert(prefix || increment.OperatorKind.Operator() is UnaryOperatorKind.PostfixIncrement or UnaryOperatorKind.PostfixDecrement); 5765Debug.Assert(conversion.Conversion.IsInlineArray);
Binder\Binder.WithQueryLambdaParametersBinder.cs (4)
39Debug.Assert(!qv.IsTransparent); 49Debug.Assert(value.Count == 1); 56Debug.Assert(base.lambdaSymbol.Parameters[0].Name.StartsWith(transparentIdentifierPrefix, StringComparison.Ordinal)); 107Debug.Assert(result.IsClear);
Binder\BinderFactory.BinderFactoryVisitor.cs (26)
29Debug.Assert((memberDeclarationOpt == null) == (memberOpt == null)); 221Debug.Assert(method.Arity == 0, "Generic Ctor, What to do?"); 293Debug.Assert(accessor is not null || parent.HasErrors); 423Debug.Assert(!accessor.IsIterator); 440Debug.Assert(containingSymbol is NamespaceSymbol); 526Debug.Assert(basePropertyDeclarationSyntax.Kind() == SyntaxKind.PropertyDeclaration || basePropertyDeclarationSyntax.Kind() == SyntaxKind.IndexerDeclaration); 562Debug.Assert(kind is SymbolKind.Method or SymbolKind.Property or SymbolKind.Event); 633Debug.Assert(syntaxTree != null); 642Debug.Assert(syntaxTree != null); 859Debug.Assert(!inUsing || inBody, "inUsing => inBody"); 905Debug.Assert(name is not QualifiedNameSyntax); 916Debug.Assert(outer is SimpleProgramUnitBinder); 929Debug.Assert(!inUsing); 962Debug.Assert((object)compilation.ScriptClass != null); 1040Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 1056Debug.Assert(BitArithmeticUtilities.CountBits((uint)usage) <= 1, "Not a flags enum."); 1077Debug.Assert(token == this.syntaxTree.GetRoot().GetLastToken()); 1147Debug.Assert(extraInfo == NodeUsage.Normal || extraInfo == NodeUsage.CrefParameterOrReturnType, 1269Debug.Assert(type.IsExtension); 1306Debug.Assert(property.SetMethod.ParameterCount > 0); 1321Debug.Assert((object)delegateType != null); 1323Debug.Assert((object)invokeMethod != null); 1405Debug.Assert(crefSyntax != null); 1406Debug.Assert(memberSyntax != null); 1448Debug.Assert(xmlSyntax is XmlAttributeSyntax || xmlSyntax.Kind() == SyntaxKind.XmlEmptyElement || xmlSyntax.Kind() == SyntaxKind.XmlElementStartTag); 1483Debug.Assert(curr != null);
Binder\BinderFactory.cs (3)
126Debug.Assert(node != null); 158Debug.Assert(typeDecl.ParameterList is not null); 166Debug.Assert(constructor.Arity == 0, "Generic Ctor, What to do?");
Binder\BlockBinder.cs (1)
29Debug.Assert(block != null);
Binder\CatchClauseBinder.cs (1)
23Debug.Assert(syntax != null);
Binder\ContextualAttributeBinder.cs (1)
28Debug.Assert(symbol is not null);
Binder\DecisionDagBuilder_CheckOrReachability.cs (18)
84Debug.Assert(noPreviousCases.Count == 0); 284Debug.Assert(ShouldWarn(node)); 483Debug.Assert(diagSyntax is not null); 634Debug.Assert(current.Left is not BoundBinaryPattern { Disjunction: true }); 727public bool? OnTheLeftOfDisjunction { get; set { Debug.Assert(field is null); field = value; } } 762Debug.Assert(_disjunction.HasValue); 764Debug.Assert(_operationSyntax is not null); 776Debug.Assert(_operand is not null); 799Debug.Assert(_evalSequence is [var first, ..] && first.IsOperand(out _)); 868Debug.Assert(node is not BoundPattern { UnionMatchingMode: not UnionMatchingMode.None }); 869Debug.Assert(node is BoundBinaryPattern 920Debug.Assert(!(current.Left is BoundBinaryPattern binary && binary.Disjunction == node.Disjunction)); 1102Debug.Assert(pattern is BoundITuplePattern or BoundListPattern); 1179Debug.Assert(_evalSequence.Count == startOfLeft + 1); 1279Debug.Assert(_expectingOperandOfDisjunction == _negated); 1307Debug.Assert(_evalSequence.Count == startOfLeft + 1); 1368Debug.Assert(_evalSequence.Count == startOfLeft + 1); 1406Debug.Assert(slice.Pattern is not null);
Binder\DecisionDagBuilder_ListPatterns.cs (10)
18Debug.Assert(inputType.IsErrorType() || list.HasErrors || list.InputType.IsErrorType() || 43Debug.Assert(list.LengthAccess is not null); 45Debug.Assert(lengthProperty is not null); 63Debug.Assert(slice.IndexerAccess is not null); 64Debug.Assert(index <= 0); 65Debug.Assert(slice.ReceiverPlaceholder is not null); 66Debug.Assert(slice.ArgumentPlaceholder is not null); 79Debug.Assert(list.IndexerAccess is not null); 80Debug.Assert(list.ReceiverPlaceholder is not null); 81Debug.Assert(list.ArgumentPlaceholder is not null);
Binder\DecisionDagBuilder.cs (104)
372Debug.Assert(pattern.UnionMatchingMode == UnionMatchingMode.None); 373Debug.Assert(input.UnionValue is null ? 387Debug.Assert(input.UnionValue is null); 435Debug.Assert(unionValue.Symbol is PropertySymbol); 440Debug.Assert(IsUnionValue(result, out _)); 569Debug.Assert(input.Index == 0); 602Debug.Assert(variableAccess.Type!.Equals(input.Type, TypeCompareKind.AllIgnoreOptions) || variableAccess.Type.IsErrorType()); 758Debug.Assert(IsUnionHasValue(temp, out _)); 761Debug.Assert(test is Tests.One { Test: BoundDagValueTest }); 803Debug.Assert(IsUnionTryGetValueReturn(boolResult, out _, out _, out _)); 806Debug.Assert(test is Tests.One { Test: var tryGetValueResultTest } && IsUnionTryGetValueTest(tryGetValueResultTest, out _, out _, out _)); 844Debug.Assert(!conversion.IsUserDefined); 845Debug.Assert(!conversion.IsUnion); 904Debug.Assert(constant.Value.Type is not null || constant.HasErrors); 923Debug.Assert(input.Source is BoundDagPropertyEvaluation { IsLengthOrCount: true }); 1009Debug.Assert(subpattern is { IsLengthOrCount: false }); 1067Debug.Assert(subpattern.HasAnyErrors); 1095Debug.Assert(subpattern.HasAnyErrors); 1170Debug.Assert(bin.HasErrors || 1185Debug.Assert(type is { }); 1233Debug.Assert(_suitableForLowering || !_forLowering); 1239Debug.Assert(kvp.Key == kvp.Value); 1385Debug.Assert(!first.IsImpossible); 1460Debug.Assert(state.SelectedTest is null); 1488Debug.Assert(state.FalseBranch is null); 1489Debug.Assert(trueBranch is not null); 1490Debug.Assert(state.TrueBranch is not null); 1500Debug.Assert(stateForCases.Index == state.TrueBranch.Cases[case2].Index); 1505Debug.Assert(case2 >= state.TrueBranch.Cases.Count || stateForCases.Index != state.TrueBranch.Cases[case2].Index); 1544Debug.Assert(trueBranch is not null); 1545Debug.Assert(falseBranch is not null); 1610Debug.Assert(_defaultLabel != null); 1611Debug.Assert(defaultDecision != null); 1621Debug.Assert(wasAcyclic, "wasAcyclic"); // force failure in debug builds 1893Debug.Assert(e.IsLengthOrCount); 1899Debug.Assert(input.Index == 0); 1914Debug.Assert(input.Index == 0); 2210Debug.Assert(testUnionInstance != null); 2211Debug.Assert(testKind != UnionTestKind.TypeTest || testTargetType is not null); 2222Debug.Assert(otherUnionInstance != null); 2223Debug.Assert(otherKind != UnionTestKind.TypeTest || otherTargetType is not null); 2265Debug.Assert(testTargetType is not null); 2266Debug.Assert(otherTargetType is not null); 2377Debug.Assert((hasValueTest.Value == ConstantValue.True || hasValueTest.Value == ConstantValue.False)); 2396Debug.Assert(isTrue); // The only form of the test that we construct 2522Debug.Assert(s1LengthTemp.IsEquivalentTo(s2LengthTemp)); 2589Debug.Assert(s1.Input.Source is BoundDagTypeEvaluation); 2590Debug.Assert(s2.Input.Source is BoundDagTypeEvaluation); 2676Debug.Assert(input.Index == 0); 2961Debug.Assert(arrayBuilder != null); 3067Debug.Assert(dagState.Cases.IsDefault); 3068Debug.Assert(dagState.RemainingValues is null); 3069Debug.Assert(dagState.SelectedTest is null); 3070Debug.Assert(dagState.TrueBranch is null); 3071Debug.Assert(dagState.FalseBranch is null); 3072Debug.Assert(dagState.Dag is null); 3278Debug.Assert((conditionToUseFinalResult is null) == (tempsUpdatedResult is null)); 3279Debug.Assert((conditionToUseFinalResult is null) || (tempsUpdatedResult is One(BoundDagIndexerEvaluation))); 3316Debug.Assert(rewriteResult.TempsUpdatedResult is not null); 3354Debug.Assert(!b.TempContainingValue.Equals(useValueFrom)); 3523Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32); 3524Debug.Assert(t.Relation == BinaryOperatorKind.GreaterThanOrEqual); 3525Debug.Assert(t.Value.Int32Value >= 0); 3538Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32); 3542Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32); 3566Debug.Assert(value >= 0); // Tests with negative values should never be created. 3567Debug.Assert(offset >= 0); // The number of elements in a list is always non-negative. 3581Debug.Assert(tempMap.IsEmpty); 3607Debug.Assert(savedTempMap == tempsUpdatedResultTempMap); 3618Debug.Assert(removeEvaluationLeavesInputUnchanged(tempsUpdatedResult, builder, state, tempMap, e)); 3623Debug.Assert(!finalResult.Equals(tempsUpdatedResult) || tempsUpdatedResultTempMap == tempMap); 3624Debug.Assert(condition is null || 3628Debug.Assert(Test is not BoundDagIndexerEvaluation || 3646Debug.Fail("Unexpected change in temp map during conditional removal of indexer evaluation."); 3713Debug.Assert(!eval.Input.Equals(e1.Input)); 3762Debug.Assert(oldTemp.Type.Equals(newTemp.Type, TypeCompareKind.AllIgnoreOptions)); 3794Debug.Assert(!typeEval.Equals(e1)); 3860Debug.Fail("Do not expect to get in a situation when a type evaluation removal initiates a temp rewrite."); 3882Debug.Assert(s1LengthTemp.IsEquivalentTo(s2LengthTemp)); 3892Debug.Assert(state.RemainingValues.ContainsKey(s1LengthTemp)); 3896Debug.Assert(!lengthValues.IsEmpty); 3935Debug.Assert(passThrough.Input.Source is BoundDagTypeEvaluation); 4018Debug.Assert(test is not BoundDagEvaluation); 4046Debug.Assert(!values.IsEmpty); 4105Debug.Assert(test is BoundDagTypeTest, "New type of non-evaluation test added, please update filter for this"); 4151Debug.Assert(sample is not null); 4174Debug.Assert(Input.Source is not BoundDagPropertyEvaluation { IsLengthOrCount: true } e || 4244Debug.Assert(remainingTests.Length > 1); 4376Debug.Assert(tempMapToRestore == tempMap); 4386Debug.Assert(testsToAssemble.Count != 0); // If we have a child to rewrite, we must have a parent to reassemble. 4432Debug.Assert(testsToAssemble.Peek().Kind == ReassembleKind.And); 4442Debug.Assert(rewriteResult.TempsUpdatedResult is not null); 4448Debug.Assert(leftToRewriteBuilder.Count < childCount); 4475Debug.Assert(rewriteResult.ConditionToUseFinalResult is not null); 4476Debug.Assert(rewriteResult.TempsUpdatedResult is not null); 4547Debug.Assert(!skip); 4548Debug.Assert(!skip); 4616Debug.Assert(obj is SequenceTests); 4644Debug.Assert(t2 is SequenceTests seq && seq.RemainingTests.Length == sequence.RemainingTests.Length); 4778Debug.Assert(!remainingTests.Any(t => t is AndSequence)); 4785Debug.Assert(t2 is not (True or False)); 4884Debug.Assert(!remainingTests.Any(t => t is OrSequence)); 4891Debug.Assert(t2 is not (True or False)); 4943Debug.Assert(builder.Count == count);
Binder\EarlyWellKnownAttributeBinder.cs (2)
48Debug.Assert(false, "Don't call this overload."); 59Debug.Assert(node != null);
Binder\EmbeddedStatementBinder.cs (1)
27Debug.Assert(statement != null);
Binder\ExecutableCodeBinder.cs (1)
41Debug.Assert((object)memberSymbol == null ||
Binder\ExpressionListVariableBinder.cs (1)
22Debug.Assert(expressions.Count > 0);
Binder\ExpressionVariableFinder.cs (9)
27Debug.Assert(node != null); 55Debug.Assert(node.Parent is ConstructorInitializerSyntax || node.Parent is PrimaryConstructorBaseTypeSyntax); 58Debug.Assert(node is ExpressionSyntax); 115Debug.Assert(nodes.Count > 0); 226Debug.Assert(node.Designation == null || node.Designation.Kind() == SyntaxKind.DiscardDesignation); 265Debug.Assert(node.Designation is null or SingleVariableDesignationSyntax or DiscardDesignationSyntax); 277Debug.Assert(node.Designation is null or SingleVariableDesignationSyntax or DiscardDesignationSyntax); 614Debug.Assert(_scopeBinder.ContainingMemberOrLambda != null); 636Debug.Assert(_scopeBinder.ContainingMemberOrLambda != null);
Binder\FixedStatementBinder.cs (1)
25Debug.Assert(syntax != null);
Binder\ForEachEnumeratorInfo.cs (10)
78Debug.Assert(patternDisposeInfo == null || needsDisposal); 79Debug.Assert(inlineArraySpanType is WellKnownType.Unknown or WellKnownType.System_Span_T or WellKnownType.System_ReadOnlySpan_T); 80Debug.Assert(inlineArraySpanType == WellKnownType.Unknown || 82Debug.Assert(!inlineArrayUsedAsValue || inlineArraySpanType != WellKnownType.Unknown); 83Debug.Assert(!isAsync || moveNextAwaitableInfo != null); 127Debug.Assert((object)CollectionType != null, $"'{nameof(CollectionType)}' cannot be null"); 128Debug.Assert((object)ElementType != null, $"'{nameof(ElementType)}' cannot be null"); 129Debug.Assert(GetEnumeratorInfo != null, $"'{nameof(GetEnumeratorInfo)}' cannot be null"); 131Debug.Assert(MoveNextInfo != null); 132Debug.Assert(CurrentPropertyGetter != null);
Binder\ForEachLoopBinder.cs (53)
43Debug.Assert(syntax != null); 315Debug.Assert(declType.HasType); 436Debug.Assert(hasErrors || 467Debug.Assert(!IsDisallowedExtensionInOlderLangVer(getEnumeratorMethod)); 475Debug.Assert(!IsDisallowedExtensionInOlderLangVer(builder.MoveNextInfo.Method)); 476Debug.Assert(!IsDisallowedExtensionInOlderLangVer(builder.CurrentPropertyGetter)); 556Debug.Assert(collectionConversionClassification.IsValid); 557Debug.Assert(currentConversionClassification.IsValid || 562Debug.Assert((object)collectionConversionClassification.Method == null, 564Debug.Assert((object)currentConversionClassification.Method == null, 585Debug.Assert( 648Debug.Assert(!collectionConversionClassification.IsUserDefined); 649Debug.Assert(!collectionConversionClassification.IsUnion); 663Debug.Assert(collectionConversionClassification.IsIdentity); 664Debug.Assert(convertedCollectionExpression == (object)collectionExpr); 665Debug.Assert(collectionType.Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions)); // Should not create an Identity conversion that changes type. 692Debug.Assert(!isAsync || !isSpread); 787Debug.Assert(!isAsync || !isSpread); 884Debug.Assert(span == originalSpan); 885Debug.Assert(!builder.ViaExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionBlockMember()); 892Debug.Assert(builder.CollectionType == (object)spanType); 930Debug.Assert(collectionExpr == originalCollectionExpr || 932Debug.Assert(!builder.ViaExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionBlockMember()); 964Debug.Assert(collectionExpr.HasAnyErrors); // should already have been reported 1032Debug.Assert((object)builder.GetEnumeratorInfo != null); 1034Debug.Assert(!(viaExtensionMethod && builder.GetEnumeratorInfo.Method.IsExtensionMethod && builder.GetEnumeratorInfo.Method.Parameters.IsDefaultOrEmpty)); 1035Debug.Assert(!(viaExtensionMethod && !builder.GetEnumeratorInfo.Method.IsExtensionMethod && !builder.GetEnumeratorInfo.Method.IsExtensionBlockMember())); 1088Debug.Assert((object)builder.CollectionType != null); 1105Debug.Assert(IsIAsyncEnumerable(collectionType.OriginalDefinition)); 1111Debug.Assert(getEnumeratorMethod is null or { ParameterCount: 1 }); 1122Debug.Assert(collectionType.OriginalDefinition.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T); 1143Debug.Assert(enumeratorType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerator_T))); 1181Debug.Assert(collectionType.SpecialType == SpecialType.System_Collections_IEnumerable); 1188Debug.Assert((object)builder.GetEnumeratorInfo == null || 1213Debug.Assert(!patternDisposeMethod.IsExtensionMethod && !patternDisposeMethod.IsExtensionBlockMember(), 1215Debug.Assert(patternDisposeMethod.ParameterRefKinds.IsDefaultOrEmpty || 1237Debug.Assert(argsToParams.IsDefault); 1262Debug.Assert(!enumeratorType.IsRefLikeType); // Ref like types are supposed to be structs, therefore, sealed. 1324Debug.Assert((object)builder.GetEnumeratorInfo == null || 1374Debug.Assert(lookupResult.IsClear); 1464Debug.Assert(!result.IsExtensionMethod && !result.IsExtensionBlockMember()); 1483Debug.Assert(analyzedArguments.Arguments.Count == 0); 1499Debug.Assert(argsToParams.IsDefault); 1545Debug.Assert(result.IsExtensionMethod || result.IsExtensionBlockMember()); 1566Debug.Assert(!collectionConversion.IsUserDefined); 1567Debug.Assert(!collectionConversion.IsUnion); 1589Debug.Assert(!result.IsStatic); 1643Debug.Assert((object)builder.GetEnumeratorInfo.Method != null); 1696Debug.Assert((object)lookupSymbol != null); 1949Debug.Assert(resolvedMember is null or { ParameterCount: 0 }); 1958Debug.Assert((extensionReceiverOpt != null) == (method.IsExtensionMethod || method.IsExtensionBlockMember())); 1959Debug.Assert(!method.IsExtensionBlockMember() || !method.IsStatic); 1987Debug.Assert(argsToParams.IsDefault);
Binder\ForLoopBinder.cs (3)
24Debug.Assert(syntax != null); 108Debug.Assert(increment.Kind != BoundKind.StatementList || ((BoundStatementList)increment).Statements.Length > 1); 128Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node));
Binder\HostObjectModeBinder.cs (1)
27Debug.Assert((object)result != null);
Binder\ImportChain.cs (4)
24Debug.Assert(imports != null); 39Debug.Assert(result); 40Debug.Assert(!imports.IsDefault); 107Debug.Assert(!symbol.IsExtern);
Binder\Imports.cs (12)
41Debug.Assert(usingAliases != null); 42Debug.Assert(!usings.IsDefault); 43Debug.Assert(!externs.IsDefault); 67Debug.Assert(previousSubmissionImports != null); 68Debug.Assert(newSubmission.IsSubmission); 93Debug.Assert(newSubmission.IsSubmission); 123Debug.Assert(!originalNamespace.IsGlobalNamespace, "Global using to global namespace"); 126Debug.Assert(expandedGlobalNamespace.IsGlobalNamespace, "Global namespace required"); 156Debug.Assert(usingAliases != null); 157Debug.Assert(!usings.IsDefault); 158Debug.Assert(!externs.IsDefault); 173Debug.Assert(otherImports != null);
Binder\InContainerBinder.cs (2)
31Debug.Assert((object)container != null); 103Debug.Assert(result.IsClear);
Binder\InMethodBinder.cs (6)
44Debug.Assert(!enclosing.Flags.Includes(BinderFlags.InCatchFilter)); 45Debug.Assert((object)owner != null); 187Debug.Assert(result.IsClear); 237Debug.Assert(!locations.IsEmpty || parameter.IsImplicitlyDeclared); 239Debug.Assert(oldLocation != newLocation || oldLocation == Location.None || newLocation.SourceTree?.GetRoot().ContainsDiagnostics == true, 316Debug.Assert(false, "what else could be defined in a method?");
Binder\InSubmissionClassBinder.cs (2)
29Debug.Assert(submissionClass.IsSubmissionClass); 45Debug.Assert(result.IsClear);
Binder\LocalBinderFactory.cs (26)
136Debug.Assert((object)containingMemberOrLambda != null); 137Debug.Assert(containingMemberOrLambda.Kind != SymbolKind.Local && containingMemberOrLambda.Kind != SymbolKind.RangeVariable && containingMemberOrLambda.Kind != SymbolKind.Parameter); 175Debug.Assert(node.ParameterList is object); 176Debug.Assert(node.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration); 288Debug.Assert((current.Flags & BinderFlags.InContextualAttributeBinder) != 0); 291Debug.Assert(contextualAttributeBinder is not null); 333Debug.Assert(false); 347Debug.Assert(false); 354Debug.Assert(delegateType.IsDelegateType()); 360Debug.Assert(false); 367Debug.Assert(parameters[^1] is SynthesizedAccessorValueParameterSymbol); 542Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 555Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 562Debug.Assert((expressionSyntax == null) ^ (declarationSyntax == null)); // Can't have both or neither. 583Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 593Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 603Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 649Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 709Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 745Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 893Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 933Debug.Assert(_map.TryGetValue(node.Block, out finallyBinder) && finallyBinder.Flags.Includes(BinderFlags.InFinallyBlock)); 1026Debug.Assert(node.CanHaveAssociatedLocalBinder() || 1038Debug.Assert(!_map.TryGetValue(node, out existing) || existing == binder || existing == binder.Next || existing == binder.Next?.Next); 1066Debug.Assert((object)_containingMemberOrLambda == enclosing.ContainingMemberOrLambda); 1071Debug.Assert((object)_containingMemberOrLambda == enclosing.ContainingMemberOrLambda);
Binder\LocalInProgressBinder.cs (1)
35Debug.Assert(_localSymbol is not null);
Binder\LocalScopeBinder.cs (6)
134Debug.Assert(array.Length > 0); 276Debug.Assert(statementBinder != null); // Lock always has a binder. 424Debug.Assert(options.AreValid()); 425Debug.Assert(result.IsClear); 464Debug.Assert(options.AreValid()); 536Debug.Assert(false, "what else can be declared inside a local scope?");
Binder\LockBinder.cs (1)
74Debug.Assert(this.Locals.IsDefaultOrEmpty);
Binder\LockOrUsingBinder.cs (3)
44Debug.Assert(targetExpressionSyntax.Parent.Kind() == SyntaxKind.LockStatement || 73Debug.Assert(_lazyLockedOrDisposedVariables != null); 95Debug.Assert(_lazyExpressionAndDiagnostics != null);
Binder\LookupResult.cs (1)
336Debug.Assert(instance.IsClear);
Binder\LookupResultKind.cs (1)
94Debug.Assert(false, "Should not call this on LookupResultKind.Viable");
Binder\LookupSymbolsInfo.cs (1)
38Debug.Assert(info.Count == 0);
Binder\MethodArgumentInfo.cs (1)
36Debug.Assert(method.ParameterCount == 0);
Binder\MethodGroupResolution.cs (8)
46Debug.Assert((methodGroup != null) || ((object)otherSymbol != null) || analyzedArguments == null); // analyzedArguments is only set if we have some result 47Debug.Assert((methodGroup == null) || (methodGroup.Methods.Count > 0)); 48Debug.Assert((methodGroup == null) || ((object)otherSymbol == null)); 50Debug.Assert(((object)otherSymbol == null) || (otherSymbol.Kind != SymbolKind.Method)); 51Debug.Assert(resultKind != LookupResultKind.Ambiguous); // HasAnyApplicableMethod is expecting Viable methods. 52Debug.Assert(!diagnostics.Diagnostics.IsDefault); 53Debug.Assert(!diagnostics.Dependencies.IsDefault); 96Debug.Assert((extensionMember is not null) || !isExtensionMember);
Binder\PatternExplainer.cs (9)
38Debug.Assert(nullPaths == (reachabilityInfo is not null)); 50Debug.Assert(!nodes.Contains(x)); 106Debug.Assert(next != null); 107Debug.Assert(distance(next) == (d - 1)); 252Debug.Assert(nullPaths == (reachabilityInfo is not null)); 396Debug.Assert(sense); // we have dropped failing type tests 524Debug.Assert(e == slice); 750Debug.Assert(typeName != null || deconstruction != null || propertyString != null); 837Debug.Assert(underlyingType.IsNativeIntegerType);
Binder\RefSafetyAnalysis.cs (28)
227Debug.Assert(_localEscapeScopes?.ContainsKey(local) == true || _symbol != local.ContainingSymbol); 236Debug.Assert(_localEscapeScopes?.ContainsKey(local) == true); 246Debug.Fail($"Placeholder {placeholder} already has a scope: {existing.FilePath}:{existing.LineNumber}."); 260Debug.Assert(_placeholderScopes?.ContainsKey(placeholder) == true); 270Debug.Assert(_placeholderScopes?.ContainsKey(placeholder) == true); 344Debug.Assert(ContainsPlaceholderScope(placeholder)); 360Debug.Assert(ContainsPlaceholderScope(placeholder)); 496Debug.Assert(_localEscapeScopes?.ContainsKey(node.LocalSymbol) == true || 524Debug.Assert(_localEscapeScopes?.ContainsKey(local) != true); 538Debug.Assert(_localEscapeScopes is { }); 559Debug.Assert(localSymbol.RefKind == RefKind.None || 877Debug.Assert(node.InitialBindingReceiverIsSubjectToCloning != ThreeState.Unknown); 899Debug.Assert(interpolationData.ReceiverPlaceholder is not null); 912Debug.Assert(receiver != null); 923Debug.Assert(placeholder.Type.SpecialType == SpecialType.System_Boolean); 930Debug.Assert(isExtensionBlockMethod); 1016Debug.Assert(node.Constructor is not null); 1063Debug.Assert(node.InitialBindingReceiverIsSubjectToCloning != ThreeState.Unknown); 1073Debug.Assert(node.AccessorKind is not AccessorKind.Unknown); 1081Debug.Assert(node.AccessorKind is AccessorKind.Get or AccessorKind.Both); 1082Debug.Assert(node.InitialBindingReceiverIsSubjectToCloning != ThreeState.Unknown); 1144Debug.Assert(node.ArgumentPlaceholders.All(p => p is BoundImplicitIndexerValuePlaceholder { Type.SpecialType: SpecialType.System_Int32 })); 1165Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 1195Debug.Assert(parameters.Length - offset == n); 1216Debug.Assert(offset == 1); 1217Debug.Assert(methodInvocationInfo.Receiver is null); 1435Debug.Assert(spreadElement.HasErrors 1443Debug.Assert(element is BoundCollectionElementInitializer or BoundExpression, $"Unexpected collection expression element {element}");
Binder\SafeContext.cs (2)
66Debug.Assert(_value >= ReturnOnlyRaw); 76Debug.Assert(_value >= CurrentMethodRaw);
Binder\Semantics\AccessCheck.cs (22)
69Debug.Assert(symbol is object); 142Debug.Assert((object)symbol != null); 143Debug.Assert((object)within != null); 144Debug.Assert(within.IsDefinition); 145Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 225Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 226Debug.Assert((object)type != null); 261Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 262Debug.Assert((object)assembly != null); 307Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 308Debug.Assert((object)containingType != null); 464Debug.Assert(current.IsDefinition); 497Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 518Debug.Assert((object)withinType != null); 519Debug.Assert((object)originalContainingType != null); 520Debug.Assert(originalContainingType.IsDefinition); 527Debug.Assert(current.IsDefinition); 551Debug.Assert(type.IsDefinition); 552Debug.Assert(baseType.IsDefinition); 570Debug.Assert(current.IsDefinition); 602Debug.Assert(!result); 613Debug.Assert(currentBase.IsDefinition);
Binder\Semantics\BestTypeInferrer.cs (4)
26Debug.Assert(!type.HasType || type.Equals(example, TypeCompareKind.AllIgnoreOptions)); 72Debug.Assert(!NullableWalker.IsTargetTypedExpression(expr)); 137Debug.Assert(!NullableWalker.IsTargetTypedExpression(expr1)); 152Debug.Assert(!NullableWalker.IsTargetTypedExpression(expr2));
Binder\Semantics\Conversions\Conversion.cs (13)
99Debug.Assert(!deconstructConversionInfo.IsDefaultOrEmpty); 116Debug.Assert(collectionExpressionTypeKind != CollectionExpressionTypeKind.None); 117Debug.Assert(elementType is { }); 164Debug.Assert(!(this is { IsNullable: true, UnderlyingConversions: var underlying } && (underlying[0].IsUserDefined || underlying[0].IsUnion))); 208Debug.Assert(kind == ConversionKind.Deconstruction); 223Debug.Assert(_kind is ConversionKind.MethodGroup or ConversionKind.IntPtr or ConversionKind.ImplicitUserDefined or ConversionKind.ExplicitUserDefined); 230Debug.Assert(_kind.IsDynamic()); 231Debug.Assert(_uncommonData == null); 378Debug.Assert(kind == ConversionKind.ImplicitNullable || kind == ConversionKind.ExplicitNullable); 440Debug.Assert((_uncommonData as NestedUncommonData)?._nestedConversionsChecked ?? true); 621Debug.Assert(!this.IsUserDefined); 622Debug.Assert(!this.IsUnion); 1322Debug.Assert(invocation is not BoundCall { Expanded: true });
Binder\Semantics\Conversions\Conversions.cs (12)
40Debug.Assert(IncludeNullability != includeNullability); 58Debug.Assert(methodSymbol == ((NamedTypeSymbol)destination).DelegateInvokeMethod); 105Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 152Debug.Assert(source is BoundUnconvertedInterpolatedString); 185Debug.Assert(elementType is { }); 283Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 343Debug.Assert((object)method != null); 346Debug.Assert(method.IsExtensionMethod || method.IsExtensionBlockMember()); 414Debug.Assert((object)delegateInvokeMethod != null && !delegateInvokeMethod.HasUseSiteError, 515Debug.Assert(method.ParameterCount == parameterCount + (isExtensionMethod ? 1 : 0)); 524Debug.Assert((object)sourceExpression.Type == null); 525Debug.Assert((object)sourceExpression.ElementType != null);
Binder\Semantics\Conversions\ConversionsBase.cs (155)
35Debug.Assert((object)corLibrary != null); 36Debug.Assert(otherNullabilityOpt == null || includeNullability != otherNullabilityOpt.IncludeNullability); 37Debug.Assert(otherNullabilityOpt == null || currentRecursionDepth == otherNullabilityOpt.currentRecursionDepth); 38Debug.Assert(corLibrary == corLibrary.CorLibrary); 60Debug.Assert(_lazyOtherNullability.IncludeNullability == includeNullability); 61Debug.Assert(_lazyOtherNullability._lazyOtherNullability == this); 100Debug.Assert(sourceExpression != null); 101Debug.Assert(Compilation != null); 102Debug.Assert((object)destination != null); 171Debug.Assert((object)source != null); 172Debug.Assert((object)destination != null); 221Debug.Assert(false); 236Debug.Assert((object)source != null); 237Debug.Assert((object)destination != null); 285Debug.Assert(sourceExpression != null); 286Debug.Assert(Compilation != null); 287Debug.Assert((object)destination != null); 319Debug.Assert((object)source != null); 320Debug.Assert((object)destination != null); 377Debug.Assert(source != null); 378Debug.Assert(Compilation != null); 379Debug.Assert((object)destination != null); 431Debug.Assert((object)source != null); 432Debug.Assert((object)destination != null); 501Debug.Assert((object)source != null); 502Debug.Assert((object)destination != null); 543Debug.Assert(sourceExpression is null || Compilation is not null); 544Debug.Assert(sourceExpression != null || (object)source != null); 545Debug.Assert((object)destination != null); 607Debug.Assert(sourceExpression is null || Compilation is not null); 608Debug.Assert(sourceExpression != null || (object)source != null); 609Debug.Assert(sourceExpression == null || (object)sourceExpression.Type == (object)source); 610Debug.Assert((object)destination != null); 647Debug.Assert(isStandardImplicitConversionFromExpression(conversion.Kind)); 698Debug.Assert(conversion.Kind == ConversionKind.NoConversion || IsStandardImplicitConversionFromType(conversion.Kind)); 703Debug.Assert((object)source != null); 704Debug.Assert((object)destination != null); 724Debug.Assert(false); 765Debug.Assert((object)source != null); 766Debug.Assert((object)destination != null); 809Debug.Assert((object)source != null); 810Debug.Assert((object)destination != null); 819Debug.Assert(!HasExplicitNumericConversion(source, destination)); 966Debug.Assert((object)baseType != null); 967Debug.Assert((object)derivedType != null); 1001Debug.Assert((object)derivedType != null); 1002Debug.Assert((object)baseType != null); 1046Debug.Assert(sourceExpression is null || Compilation is not null); 1047Debug.Assert(sourceExpression != null || (object)source != null); 1048Debug.Assert(sourceExpression == null || (object)sourceExpression.Type == (object)source); 1049Debug.Assert((object)destination != null); 1201Debug.Assert(Compilation is not null); 1230Debug.Assert(Compilation is not null); 1248Debug.Assert((object)source != null); 1249Debug.Assert((object)destination != null); 1310Debug.Assert(Compilation is not null); 1336Debug.Assert(Compilation is not null); 1418Debug.Assert(sourceExpression != null); 1419Debug.Assert(Compilation != null); 1420Debug.Assert((object)destination != null); 1458Debug.Assert((object)source != null); 1459Debug.Assert((object)destination != null); 1484Debug.Assert((object)anonymousFunction != null); 1485Debug.Assert((object)type != null); 1603Debug.Assert((object)anonymousFunction != null); 1604Debug.Assert((object)type != null); 1605Debug.Assert(type.IsExpressionTree()); 1641Debug.Assert((object)anonymousFunction != null); 1642Debug.Assert((object)type != null); 1658Debug.Assert(source != null); 1659Debug.Assert((object)destination != null); 1671Debug.Assert(compilation is { }); 1746Debug.Assert((object)sourceType != null); 1747Debug.Assert(!sourceType.IsValidV6SwitchGoverningType()); 1756Debug.Assert(switchGoverningType.IsValidV6SwitchGoverningType(isTargetTypeOfUserDefinedOp: true)); 1819Debug.Assert((object)type1 != null); 1820Debug.Assert((object)type2 != null); 1906Debug.Assert(IncludeNullability); 1928Debug.Assert((object)thisType != null); 1938Debug.Assert(sourceExpressionOpt is null || Compilation is not null); 1939Debug.Assert(sourceExpressionOpt == null || (object)sourceExpressionOpt.Type == sourceType); 1940Debug.Assert((object)destination != null); 1969Debug.Assert(!IncludeNullability); 2041Debug.Assert(conversion.Kind == ConversionKind.NoConversion); 2050Debug.Assert((object)source != null); 2051Debug.Assert((object)destination != null); 2066Debug.Assert(conversionKind is ConversionKind.ImplicitNumeric or ConversionKind.ExplicitNumeric); 2139Debug.Assert((object)source != null); 2140Debug.Assert((object)target != null); 2225Debug.Assert((object)source != null); 2226Debug.Assert((object)destination != null); 2254Debug.Assert((object)source != null); 2255Debug.Assert((object)destination != null); 2300Debug.Assert(Compilation is not null); 2304Debug.Assert(!IncludeNullability); 2318Debug.Assert(Compilation is not null); 2322Debug.Assert(!IncludeNullability); 2343Debug.Assert(Compilation is not null); 2354Debug.Assert(arguments.Length == targetElementTypes.Length); 2455Debug.Assert((object)source != null); 2456Debug.Assert((object)destination != null); 2510Debug.Assert((object)source != null); 2511Debug.Assert((object)destination != null); 2532Debug.Assert((object)source != null); 2533Debug.Assert((object)destination != null); 2548Debug.Assert((object)destination != null); 2557Debug.Assert((object)source != null); 2558Debug.Assert((object)destination != null); 2564Debug.Assert((object)source != null); 2565Debug.Assert((object)destination != null); 2645Debug.Assert((object)source != null); 2646Debug.Assert((object)destination != null); 2895Debug.Assert((object)source != null); 2896Debug.Assert((object)destination != null); 2992Debug.Assert((object)derivedType != null); 2993Debug.Assert((object)baseType != null); 3023Debug.Assert(targetInterfaceType.IsErrorType() || targetInterfaceType.IsInterface); 3057Debug.Assert(targetInterfaceType.IsErrorType() || targetInterfaceType.IsInterface); 3091Debug.Assert((object)source != null); 3092Debug.Assert((object)destination != null); 3110Debug.Assert((object)source != null); 3111Debug.Assert((object)destination != null); 3160Debug.Assert((object)source != null); 3161Debug.Assert((object)destination != null); 3179Debug.Assert((object)source != null); 3180Debug.Assert((object)destination != null); 3192Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, destination.OriginalDefinition, TypeCompareKind.AllIgnoreOptions)); 3193Debug.Assert(typeParameters.Count == sourceTypeArguments.Count); 3194Debug.Assert(typeParameters.Count == destinationTypeArguments.Count); 3272Debug.Assert((object)source != null); 3273Debug.Assert((object)destination != null); 3326Debug.Assert((object)source != null); 3327Debug.Assert((object)destination != null); 3387Debug.Assert((object)source != null); 3388Debug.Assert((object)destination != null); 3455Debug.Assert((object)source != null); 3456Debug.Assert((object)destination != null); 3478Debug.Assert((object)source != null); 3479Debug.Assert((object)destination != null); 3552Debug.Assert((object)source != null); 3553Debug.Assert((object)destination != null); 3604Debug.Assert((object)source != null); 3605Debug.Assert((object)destination != null); 3655Debug.Assert((object)source != null); 3656Debug.Assert((object)destination != null); 3744Debug.Assert((object)source != null); 3745Debug.Assert((object)destination != null); 3836Debug.Assert((object)source != null); 3837Debug.Assert((object)destination != null); 3904Debug.Assert((object)source != null); 3905Debug.Assert((object)destination != null); 3912Debug.Assert((object)source != null); 3913Debug.Assert((object)destination != null); 3930Debug.Assert((object)source != null); 3931Debug.Assert((object)destination != null);
Binder\Semantics\Conversions\TypeConversions.cs (1)
32Debug.Assert(IncludeNullability != includeNullability);
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (19)
27Debug.Assert(sourceExpression is null || Compilation is not null); 28Debug.Assert(sourceExpression != null || (object)source != null); 29Debug.Assert((object)target != null); 94Debug.Assert(sourceExpression is null || Compilation is not null); 95Debug.Assert(sourceExpression != null || (object)source != null); 96Debug.Assert((object)target != null); 97Debug.Assert(d != null); 98Debug.Assert(u != null); 106Debug.Assert(constrainedToTypeOpt is not null); 152Debug.Assert(sourceExpression is null || Compilation is not null); 153Debug.Assert(sourceExpression != null || (object)source != null); 154Debug.Assert((object)target != null); 155Debug.Assert(u != null); 156Debug.Assert((object)declaringType != null); 327Debug.Assert(liftedFromConversion.Exists); 328Debug.Assert(liftedToConversion.Exists); 481Debug.Assert(expr is null || Compilation is not null); 482Debug.Assert(expr != null || (object)a != null); 483Debug.Assert((object)b != null);
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (22)
31Debug.Assert(sourceExpression is null || Compilation is not null); 32Debug.Assert(sourceExpression != null || (object)source != null); 33Debug.Assert((object)target != null); 151Debug.Assert(sourceExpression is null || Compilation is not null); 152Debug.Assert(sourceExpression != null || (object)source != null); 153Debug.Assert(((object)target != null) == !allowAnyTarget); 154Debug.Assert(d != null); 155Debug.Assert(u != null); 259Debug.Assert(constrainedToTypeOpt is not null); 577Debug.Assert(aExpr is null || Compilation is not null); 578Debug.Assert((object)a != null); 579Debug.Assert((object)b != null); 596Debug.Assert(aExpr is null || Compilation is not null); 597Debug.Assert(aExpr != null || (object)a != null); 598Debug.Assert((object)b != null); 908Debug.Assert((object)source != null); 909Debug.Assert(!source.IsValidV6SwitchGoverningType()); 990Debug.Assert(sourceExpression is null || Compilation is not null); 991Debug.Assert(sourceExpression != null || (object)source != null); 992Debug.Assert((object)target != null); 1035Debug.Assert(targetConversion.Exists && targetConversion.IsImplicit); 1036Debug.Assert(targetConversion.IsIdentity || (targetConversion.IsNullable && targetConversion.UnderlyingConversions[0].IsIdentity));
Binder\Semantics\Operators\BinaryOperatorEasyOut.cs (6)
317Debug.Assert(leftConversion.Exists && leftConversion.IsImplicit); 318Debug.Assert(rightConversion.Exists && rightConversion.IsImplicit); 325Debug.Assert(left != null); 326Debug.Assert((object?)left.Type != null); 327Debug.Assert(right != null); 328Debug.Assert((object?)right.Type != null);
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (39)
43Debug.Assert(left != null); 44Debug.Assert(right != null); 45Debug.Assert(result.Results.Count == 0); 67Debug.Assert(left != null); 68Debug.Assert(right != null); 69Debug.Assert(result.Results.Count == 0); 131Debug.Assert((result.Results.Count == 0) != hadApplicableCandidates); 204Debug.Assert((result.Results.Count == 0) != hadApplicableCandidates); 227Debug.Assert(candidates.Count == 0); 247Debug.Assert(hadUserDefinedCandidateFromInterfaces == candidates.Any(r => r.IsValid)); 299Debug.Assert(hadUserDefinedCandidate == results.Any(r => r.IsValid)); 339Debug.Assert(left != null); 340Debug.Assert(right != null); 479Debug.Assert((object)enumType != null); 488Debug.Assert((object)underlying != null); 489Debug.Assert(underlying.SpecialType != SpecialType.None); 558Debug.Assert((object)pointerType != null); 603Debug.Assert(left != null); 604Debug.Assert(right != null); 692Debug.Assert(left != null); 693Debug.Assert(right != null); 732Debug.Assert(operators.Count == 1); 738Debug.Assert(op.LeftType.IsObjectType()); 739Debug.Assert(op.RightType.IsObjectType()); 744Debug.Assert(convLeft.IsImplicit); 745Debug.Assert(convRight.IsImplicit); 840Debug.Assert(op.Signature.Kind.Operator() == existingSignature.Kind.Operator()); 875Debug.Assert(results.Count == 0); 927Debug.Assert(hadApplicableCandidates == results.Any(r => r.IsValid)); 955Debug.Assert(operators.Count == 0); 1226Debug.Assert(op1.Priority.HasValue == op2.Priority.HasValue); 1426Debug.Assert((kind & ~BinaryOperatorKind.Checked) == kind, "Did not expect operator to be checked. Consider using .Operator() to mask."); 1442Debug.Assert(isChecked || name2Opt is null); 1505Debug.Assert(extensionCandidatesInSingleScope.All(static m => m.ContainingType.ExtensionParameter is not null)); 1557Debug.Assert(lifting is LiftingResult.LiftOperandsAndResult or LiftingResult.LiftOperandsButNotResult); 1588Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null); 1607Debug.Assert(extensionParameter is not null); 1614Debug.Assert(operand.Type is not null); 1615Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null);
Binder\Semantics\Operators\BinaryOperatorSignature.cs (4)
98Debug.Assert(Method.ParameterCount == 2); 102Debug.Assert(Method.ParameterRefKinds.Length == 2); 120Debug.Assert(Method.ParameterCount == rightIndex + 1); 124Debug.Assert(Method.ParameterRefKinds.Length == rightIndex + 1);
Binder\Semantics\Operators\OperatorKindExtensions.cs (6)
122Debug.Assert(kind == (kind & ~UnaryOperatorKind.TypeMask)); 123Debug.Assert(type == (type & UnaryOperatorKind.TypeMask)); 149Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 167Debug.Assert(kind == (kind & ~UnaryOperatorKind.TypeMask)); 185Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 186Debug.Assert(type == (type & BinaryOperatorKind.TypeMask));
Binder\Semantics\Operators\UnaryOperatorEasyOut.cs (1)
116Debug.Assert(conversion.HasValue && conversion.Value.IsImplicit);
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (16)
33Debug.Assert(operand != null); 34Debug.Assert(result.Results.Count == 0); 82Debug.Assert(isChecked || name2Opt is null); 83Debug.Assert(operand.Type is not null); 146Debug.Assert(extensionCandidatesInSingleScope.All(static m => m.ContainingType.ExtensionParameter is not null)); 220Debug.Assert(operand.Type is not null); 221Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null); 225Debug.Assert(operand.Type.IsNullableType()); 250Debug.Assert(x is { }); 251Debug.Assert(y is { }); 260Debug.Assert(xGroupingKey is not null); 292Debug.Assert(groupingKey is not null); 551Debug.Assert(operand != null); 582Debug.Assert(operand != null); 613Debug.Assert(operand != null); 775Debug.Assert(operators.Count == 0);
Binder\Semantics\Operators\UnaryOperatorSignature.cs (2)
52Debug.Assert(Method.ParameterCount == 1); 56Debug.Assert(Method.ParameterRefKinds.Length == 1);
Binder\Semantics\OverloadResolution\ArgumentAnalysisResult.cs (2)
21Debug.Assert(arg >= 0); 26Debug.Assert(arg < ArgsToParamsOpt.Length);
Binder\Semantics\OverloadResolution\CallingConventionInfo.cs (1)
17Debug.Assert(unmanagedCallingConventionTypes.IsEmpty || callKind == Cci.CallingConvention.Unmanaged);
Binder\Semantics\OverloadResolution\MemberAnalysisResult.cs (10)
31Debug.Assert(!_argumentsCoerced); 53Debug.Assert(!_argumentsCoerced); 67Debug.Assert(!_argumentsCoerced); 81Debug.Assert(!_argumentsCoerced); 130Debug.Assert(kind != MemberResolutionKind.ApplicableInExpandedForm || definitionParamsElementTypeOpt.HasType); 131Debug.Assert(kind != MemberResolutionKind.ApplicableInExpandedForm || paramsElementTypeOpt.HasType); 166Debug.Assert(arg >= 0); 171Debug.Assert(arg < ArgsToParamsOpt.Length); 325Debug.Assert(conversions.Length != 0); 326Debug.Assert(badArguments.TrueBits().Any());
Binder\Semantics\OverloadResolution\MethodGroup.cs (7)
55Debug.Assert(method.IsExtensionMethod || method.IsExtensionBlockMember()); 130Debug.Assert(this.Receiver == null); 131Debug.Assert(this.Methods.Count == 0); 132Debug.Assert(this.TypeArguments.Count == 0); 133Debug.Assert(!this.IsExtensionMethodGroup); 134Debug.Assert(this.Error == null); 135Debug.Assert(this.ResultKind == LookupResultKind.Empty);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (143)
65Debug.Assert(instance.Count == 0); 285Debug.Assert(!methodTypeParameters.IsDefault); 286Debug.Assert(methodTypeParameters.Length > 0); 287Debug.Assert(!formalParameterTypes.IsDefault); 288Debug.Assert(formalParameterRefKinds.IsDefault || formalParameterRefKinds.Length == formalParameterTypes.Length); 289Debug.Assert(!arguments.IsDefault); 345Debug.Assert(ordinals is null || ordinals.Values.Count() == ordinals.Values.Distinct().Count()); 346Debug.Assert(ordinals is null || methodTypeParameters.All(tp => ordinals.ContainsKey(tp))); 354Debug.Assert(_nullableAnnotationLowerBounds.All(annotation => annotation.IsNotAnnotated())); 443Debug.Assert(0 <= index && index < _formalParameterTypes.Length); 498Debug.Assert(ValidIndex(methodTypeParameterIndex)); 504Debug.Assert(type.HasType); 539Debug.Assert(IsUnfixedTypeParameter(methodTypeParameterWithAnnotations)); 554Debug.Assert(ValidIndex(methodTypeParameterIndex)); 562Debug.Assert((object)delegateOrFunctionPointerType != null); 563Debug.Assert(delegateOrFunctionPointerType.IsDelegateType() || delegateOrFunctionPointerType is FunctionPointerTypeSymbol); 603Debug.Assert(!_formalParameterTypes.IsDefault); 604Debug.Assert(!_arguments.IsDefault); 671Debug.Assert(targetType is { }); 705Debug.Assert(target.Type is { }); 744Debug.Assert(sourceArguments.Length == destTypes.Length); 802Debug.Assert(res != InferenceResult.NoProgress); 931Debug.Assert((object)argument.Type == null, "should not need to dig into elements if tuple has natural type"); 941Debug.Assert(sourceArguments.Length == destTypes.Length); 1128Debug.Assert(ValidIndex(iParam)); 1129Debug.Assert(ValidIndex(jParam)); 1141Debug.Assert(IsUnfixed(iParam)); 1142Debug.Assert(IsUnfixed(jParam)); 1194Debug.Assert(_dependencies == null); 1198Debug.Assert(0 == (int)Dependency.Unknown); 1215Debug.Assert(_dependencies != null); 1221Debug.Assert(0 <= iParam && iParam < _methodTypeParameters.Length); 1222Debug.Assert(0 <= jParam && jParam < _methodTypeParameters.Length); 1234Debug.Assert(_dependencies != null); 1235Debug.Assert(ValidIndex(iParam)); 1236Debug.Assert(ValidIndex(jParam)); 1270Debug.Assert(_dependencies != null); 1291Debug.Assert(_dependencies != null); 1306Debug.Assert(_dependencies != null); 1324Debug.Assert(ValidIndex(iParam)); 1339Debug.Assert(ValidIndex(iParam)); 1352Debug.Assert(ValidIndex(iParam)); 1371Debug.Assert(expression != null); 1372Debug.Assert(target.HasType); 1404Debug.Assert(source != null); 1405Debug.Assert(target.HasType); 1418Debug.Assert((object)delegateType.DelegateInvokeMethod != null && !delegateType.DelegateInvokeMethod.HasUseSiteError, 1432Debug.Assert(inferredReturnType.Type is not FunctionTypeSymbol); 1440Debug.Assert(source != null); 1441Debug.Assert((object)target != null); 1472Debug.Assert(method is { HasUseSiteError: false }, 1523Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 1549Debug.Assert(source != null); 1550Debug.Assert(target.HasType); 1604Debug.Assert(source != null); 1605Debug.Assert(target.HasType); 1640Debug.Assert(source.HasType); 1641Debug.Assert(target.HasType); 1694Debug.Assert(source.HasType); 1695Debug.Assert(target.HasType); 1709Debug.Assert(source.HasType); 1710Debug.Assert(target.HasType); 1741Debug.Assert(source is not null); 1742Debug.Assert(target is not null); 1768Debug.Assert(type.IsSpan() || type.IsReadOnlySpan()); 1804Debug.Assert(source.HasType); 1805Debug.Assert(target.HasType); 1833Debug.Assert(source.HasType); 1834Debug.Assert(target.HasType); 1860Debug.Assert(source.HasType); 1861Debug.Assert(target.HasType); 1944Debug.Assert((object)source != null); 1945Debug.Assert((object)target != null); 1946Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 1954Debug.Assert(sourceTypeArguments.Count == targetTypeArguments.Count); 1971Debug.Assert(source.HasType); 1972Debug.Assert(target.HasType); 2065Debug.Assert(source.HasType); 2066Debug.Assert(target.HasType); 2080Debug.Assert((object)source != null); 2081Debug.Assert((object)target != null); 2115Debug.Assert((object)source != null); 2116Debug.Assert((object)target != null); 2153Debug.Assert(source is not null); 2154Debug.Assert(target is not null); 2196Debug.Assert((object)source != null); 2197Debug.Assert((object)target != null); 2260Debug.Assert((object)source != null); 2261Debug.Assert((object)target != null); 2305Debug.Assert((object)source != null); 2306Debug.Assert((object)target != null); 2386Debug.Assert((object)source != null); 2387Debug.Assert((object)target != null); 2388Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 2398Debug.Assert(typeParameters.Count == sourceTypeArguments.Count); 2399Debug.Assert(typeParameters.Count == targetTypeArguments.Count); 2480Debug.Assert(source.HasType); 2481Debug.Assert(target.HasType); 2514Debug.Assert(source.Type.IsReferenceType || source.Type.IsFunctionPointer()); 2541Debug.Assert(source.HasType); 2542Debug.Assert(target.HasType); 2555Debug.Assert(source.HasType); 2556Debug.Assert(target.HasType); 2597Debug.Assert(sourceWithAnnotations.HasType); 2598Debug.Assert(targetWithAnnotations.HasType); 2657Debug.Assert((object)source != null); 2658Debug.Assert((object)target != null); 2686Debug.Assert((object)source != null); 2687Debug.Assert((object)target != null); 2736Debug.Assert((object)source != null); 2737Debug.Assert((object)target != null); 2738Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 2748Debug.Assert(typeParameters.Count == sourceTypeArguments.Count); 2749Debug.Assert(typeParameters.Count == targetTypeArguments.Count); 2829Debug.Assert(IsUnfixed(iParam)); 2851Debug.Assert(best.Type.Type.Equals(withoutNullability.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 2883Debug.Assert(!containsFunctionTypes(exact)); 2884Debug.Assert(!containsFunctionTypes(upper)); 2974Debug.Assert(!best.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 2994Debug.Assert(compilation is not null); // Tracked by https://github.com/dotnet/roslyn/issues/80658 3062Debug.Assert((object)target != null); 3063Debug.Assert(target.IsDelegateType()); 3064Debug.Assert((object)target.DelegateInvokeMethod != null && !target.DelegateInvokeMethod.HasUseSiteError, 3066Debug.Assert(!target.DelegateInvokeMethod.ReturnsVoid); 3070Debug.Assert(!HasUnfixedParamInInputType(source, target)); 3156Debug.Assert(target.IsInterface); 3194Debug.Assert(extension is not null); 3195Debug.Assert(extension.Arity > 0); 3196Debug.Assert(extension.ExtensionParameter is not null); 3197Debug.Assert(!extension.ExtensionParameter.Type.IsDynamic()); 3198Debug.Assert(extension.IsDefinition); 3199Debug.Assert(receiver is not null); 3263Debug.Assert((object)method != null); 3264Debug.Assert(method.Arity > 0); 3265Debug.Assert(!arguments.IsDefault); 3274Debug.Assert(!method.GetParameterType(0).IsDynamic()); 3301Debug.Assert(!_formalParameterTypes.IsDefault); 3302Debug.Assert(_formalParameterTypes.Length >= 1); 3303Debug.Assert(!_arguments.IsDefault); 3304Debug.Assert(_arguments.Length >= 1); 3323Debug.Assert(IsUnfixed(iParam)); 3393Debug.Assert(conversions.IncludeNullability || 3424Debug.Assert(variance == VarianceKind.In || variance == VarianceKind.Out);
Binder\Semantics\OverloadResolution\OverloadResolution_ArgsToParameters.cs (11)
34Debug.Assert(parameters == null || parameters.Length == length); 47Debug.Assert(0 <= argument && argument < _length); 60Debug.Assert(symbol.IsExtensionBlockMember()); 71Debug.Assert((object)symbol != null); 72Debug.Assert(arguments != null); 286Debug.Assert(expanded); 321Debug.Assert(arguments.Names[argumentPosition].HasValue); 353Debug.Assert(!parameters.IsDefault); 354Debug.Assert(arguments != null); 355Debug.Assert(arguments.Names.Count == 0); 445Debug.Assert(!(expanded && isMethodGroupConversion));
Binder\Semantics\OverloadResolution\OverloadResolution.cs (90)
103Debug.Assert(!dynamicResolution || arguments.HasDynamicArgument); 149Debug.Assert((options & Options.DynamicResolution) == 0 || arguments.HasDynamicArgument); 150Debug.Assert((options & Options.InferWithDynamic) == 0 || (options & Options.DynamicResolution) == 0); 151Debug.Assert((options & Options.IsFunctionPointerResolution) == 0 || (options & Options.DynamicResolution) == 0); 152Debug.Assert((options & Options.IsMethodGroupConversion) == 0 || (options & Options.DynamicResolution) == 0); 153Debug.Assert((options & Options.InferWithDynamic) == 0 || (options & Options.IsMethodGroupConversion) != 0); 173Debug.Assert(!dynamicResolution || arguments.HasDynamicArgument); 515Debug.Assert(hidden == hidden.ConstructedFrom()); 562Debug.Assert(funcPtrBuilder.Count == 1); 563Debug.Assert(funcPtrBuilder[0].Arity == 0); 672Debug.Assert(!expectedConvention.CallKind.HasUnknownCallingConventionAttributeBits()); 673Debug.Assert(expectedConvention.UnmanagedCallingConventionTypes is not null); 674Debug.Assert(expectedConvention.UnmanagedCallingConventionTypes.IsEmpty || expectedConvention.CallKind == Cci.CallingConvention.Unmanaged); 676Debug.Assert(!_binder.IsEarlyAttributeBinder); 694Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyData, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound) 717Debug.Assert(unmanagedCallingConventionTypes.All(u => FunctionPointerTypeSymbol.IsCallingConventionModifier((NamedTypeSymbol)u))); 860Debug.Assert(typeof(TMember) == typeof(MethodSymbol)); 938Debug.Assert(!MemberAnalysisResult.UnsupportedMetadata().HasUseSiteDiagnosticToReportFor(constructor)); 1038Debug.Assert(!constructor.IsVararg); 1054Debug.Assert(!result.IsValid || result.Kind == MemberResolutionKind.ApplicableInExpandedForm); 1071Debug.Assert(checkOverriddenOrHidden || containingTypeMapOpt is null); 1072Debug.Assert((options & Options.IgnoreNormalFormIfHasValidParamsParameter) == 0 || (options & Options.IsMethodGroupConversion) == 0); 1157Debug.Assert(!MemberAnalysisResult.UnsupportedMetadata().HasUseSiteDiagnosticToReportFor(member)); 1173Debug.Assert(typeArguments.Count == 0 || typeArguments.Count == member.GetMemberArityIncludingExtension()); 1239Debug.Assert(!normalResult.IsValid); 1377Debug.Assert(elementType.Type is { }); 1892Debug.Assert(memberWithPriority is not null); 1923Debug.Assert(previousResults.All(r => r.MemberWithPriority.GetOverloadResolutionPriority() == previousPriority)); 2047Debug.Assert(!results[i].IsValid || worse[i] != unknown); 2058Debug.Assert(!results[i].IsValid || worse[i] != unknown); 2067Debug.Assert(worse[i] != notBetterThanEverything || i == notBestIdx); 2071Debug.Assert(worse[notBestIdx] == notBetterThanEverything); 2076Debug.Assert(countOfNotBestCandidates > 1); 2080Debug.Assert(!results[i].IsValid || worse[i] != unknown); 2104Debug.Assert(m1.Result.IsValid); 2105Debug.Assert(m2.Result.IsValid); 2106Debug.Assert(arguments != null); 2144Debug.Assert(m1.Result.IsValid); 2145Debug.Assert(m2.Result.IsValid); 2146Debug.Assert(arguments != null); 2181Debug.Assert(i == arguments.Count - 1); 2182Debug.Assert(m1.Member.GetIsVararg() && m2.Member.GetIsVararg()); 2282Debug.Assert(result == r); 2283Debug.Assert(result == BetterResult.Left || result == BetterResult.Right); 2323Debug.Assert(i == arguments.Count - 1); 2324Debug.Assert(m1.Member.GetIsVararg() && m2.Member.GetIsVararg()); 2376Debug.Assert(m1.Result.Kind != MemberResolutionKind.ApplicableInExpandedForm); 2483Debug.Assert(i == arguments.Count - 1); 2484Debug.Assert(m1.Member.GetIsVararg() && m2.Member.GetIsVararg()); 2588Debug.Assert(paramsElementTypeOpt.HasType); 2589Debug.Assert(paramsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 2606Debug.Assert(extensionParameter is not null); 2640Debug.Assert(!isInterpolatedStringHandlerConversion || arguments[i] is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }); 2702Debug.Assert(m.Result.IsValid); 2754Debug.Assert(t1.Count == t2.Count); 2818Debug.Assert(arr1.HasSameShapeAs(arr2)); 2834Debug.Assert(t1.IsDynamic() && t2.IsDynamic() || 2849Debug.Assert(((object)n1 == null) == ((object)n2 == null)); 2918Debug.Assert(refKind1 == RefKind.None || refKind1 == RefKind.Ref); 2919Debug.Assert(refKind2 == RefKind.None || refKind2 == RefKind.Ref); 3130Debug.Assert(underlyingElementConversions1.Length == underlyingElementConversions2.Length && underlyingElementConversions1.Length == collectionExpressionElements.Length); 3196Debug.Assert(!Conversions.HasIdentityConversion(t1, t2)); 3214Debug.Assert(kind1 is not (CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span)); 3401Debug.Assert(sourceArguments.Length == destTypes.Length); 3721Debug.Assert((r1.IsVoidType()) == (r2.IsVoidType())); 3725Debug.Assert(!r1.IsVoidType()); 3726Debug.Assert(!r2.IsVoidType()); 3727Debug.Assert(!Conversions.HasIdentityConversion(r1, r2)); 3738Debug.Assert(currentResult == BetterResult.Right); 3743Debug.Assert(currentResult == BetterResult.Left); 3765Debug.Assert( 3883Debug.Assert(firstParamsElementIndex == -1 || (firstParamsElementIndex >= 0 && firstParamsElementIndex < types.Length)); 3900Debug.Assert(argumentRefKinds != null); 3915Debug.Assert(member.ContainingType.ExtensionParameter is not null); 4017Debug.Assert(compilation is not null); 4061Debug.Assert(argumentRefKinds != null); 4084Debug.Assert(paramsIterationType.HasType); 4160Debug.Assert(!hasAnyRefOmittedArgument || (options & Options.AllowRefOmittedArguments) != 0); 4229Debug.Assert(!hasAnyRefOmittedArgument || (options & Options.AllowRefOmittedArguments) != 0); 4246Debug.Assert(!result.Result.IsValid || result.Result.Kind == MemberResolutionKind.ApplicableInExpandedForm); 4268Debug.Assert(GetConstructedFrom(leastOverriddenMember) == (object)leastOverriddenMember); 4405Debug.Assert(isExtensionBlockMember); 4407Debug.Assert(!result.IsDefaultOrEmpty); 4594Debug.Assert(candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator }); 4626Debug.Assert( 4639Debug.Assert(badArguments.IsNull); 4640Debug.Assert(conversions == null); 4683Debug.Assert(paramsElementTypeOpt.HasType); 4738Debug.Assert(argRefKind != RefKind.None); 4751Debug.Assert((!conversion.Exists) || conversion.IsImplicit, "ClassifyImplicitConversion should only return implicit conversions");
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (41)
68Debug.Assert(_bestResultState == ThreeState.True && _bestResult.Result.IsValid); 93Debug.Assert(_bestResultState == ThreeState.True); 133Debug.Assert(HasAnyApplicableMember); 176Debug.Assert(false, "How did we manage to get two methods in the overload resolution results that were both better than every other method?"); 224Debug.Assert(!this.Succeeded, "Don't ask for diagnostic info on a successful overload resolution result."); 227Debug.Assert(arguments.Arguments.All(a => a.Display != null)); 432Debug.Assert(!supportedRequiredParameterMissingConflicts); 495Debug.Assert(arguments.Names[badArg].HasValue); 535Debug.Assert(firstSupported.Member is MethodSymbol { MethodKind: MethodKind.Constructor }); 544Debug.Assert(firstSupported.Member is MethodSymbol { Name: "Add" }); 606Debug.Assert(diagInfo != null); 607Debug.Assert(diagInfo.Severity == DiagnosticSeverity.Error); 620Debug.Assert(firstSupported.Result.Kind == MemberResolutionKind.WrongCallingConvention); 635Debug.Assert(bad.Member.GetUseSiteInfo().DiagnosticInfo.Severity == DiagnosticSeverity.Error, 792Debug.Assert(arguments.Arguments.Count > 0); 832Debug.Assert(arguments.Names.Count > badArg); 833Debug.Assert(arguments.Names[badArg].HasValue); 835Debug.Assert(badName != null); 852Debug.Assert(arguments.Names.Count > badArg); 853Debug.Assert(arguments.Names[badArg].HasValue); 855Debug.Assert(badName != null); 866Debug.Assert(result.Result.BadArgumentsOpt.TrueBits().Count() == 1); 867Debug.Assert(arguments.Names[result.Result.FirstBadArgument].HasValue); 869Debug.Assert(name != null); 892Debug.Assert(arguments.Names.Count > badArg); 893Debug.Assert(arguments.Names[badArg].HasValue); 895Debug.Assert(badName != null); 938Debug.Assert(badMember.Kind == SymbolKind.Method); 939Debug.Assert(((MethodSymbol)(object)badMember).IsVararg); 1235Debug.Assert(refArg == RefKind.None); 1340Debug.Assert(argument.Kind != BoundKind.OutDeconstructVarPendingInference); 1341Debug.Assert(argument.Kind != BoundKind.OutVariablePendingInference); 1342Debug.Assert(argument.Kind != BoundKind.DiscardExpression || argument.HasExpressionType()); 1343Debug.Assert(argument.Display != null); 1347Debug.Assert((arg == 0) && (parm == arg)); 1348Debug.Assert(!badArg.Result.ConversionForArg(parm).IsImplicit); 1359Debug.Assert((object)parameter == unwrapIfParamsCollection(badArg, parameter, isLastParameter), "If they ever differ, just call the method when constructing the diagnostic."); 1423Debug.Assert(badArg.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 1442Debug.Assert(nWorse == 0, "How is it that there is exactly one applicable but worse method, and exactly zero applicable best methods? What was better than this thing?"); 1503Debug.Assert(nValid == 0, "Why are we doing error reporting on an overload resolution problem that had one valid result?"); 1507Debug.Assert(false, "Add tests if this is triggered. https://github.com/dotnet/roslyn/issues/80507");
Binder\SingleLookupResult.cs (1)
31Debug.Assert(symbol is not null || kind == LookupResultKind.Empty);
Binder\SwitchBinder_Patterns.cs (3)
31Debug.Assert(SwitchSyntax.Equals(node)); 153Debug.Assert(this.SwitchSyntax == node.Parent.Parent); 199Debug.Assert(sectionBinder != null);
Binder\SwitchBinder.cs (18)
46Debug.Assert(_switchGoverningExpression != null); 98Debug.Assert(labels.Length > 0); 211Debug.Assert(caseLabel.Value != null); 287Debug.Assert((object)constantValue != null); 294Debug.Assert(constantValue.Value is int); 298Debug.Assert(constantValue.Value is uint); 335Debug.Assert(key != null); 343Debug.Assert((object)label != null); 397Debug.Assert(ScopeDesignator == SwitchSyntax); 400Debug.Assert(binder != null); 440Debug.Assert(conversion.Kind == ConversionKind.ImplicitUserDefined); 441Debug.Assert(conversion.Method.IsUserDefinedConversion()); 442Debug.Assert(conversion.UserDefinedToConversion.IsIdentity); 443Debug.Assert(resultantGoverningType.IsValidV6SwitchGoverningType(isTargetTypeOfUserDefinedOp: true)); 465Debug.Assert((object)switchGoverningExpression.Type == null || switchGoverningExpression.Type.IsVoidType()); 497Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement || node.Kind() == SyntaxKind.GotoDefaultStatement); 517Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement); 542Debug.Assert(node.Kind() == SyntaxKind.GotoDefaultStatement);
Binder\SwitchExpressionArmBinder.cs (2)
31Debug.Assert(node == _arm); 38Debug.Assert(node == _arm);
Binder\SwitchExpressionBinder.cs (4)
28Debug.Assert(node == SwitchExpressionSyntax); 100Debug.Assert(wasAcyclic); 193Debug.Assert(inputExpression.Type is not null); 204Debug.Assert(inputExpression.Type is not null);
Binder\UnionMatchingRewriter.cs (17)
44Debug.Assert(result != pattern); 62Debug.Assert(unionMatchingInputType.IsSubjectForUnionMatching); 63Debug.Assert(exclusiveValuePattern.InputType.IsObjectType()); 84Debug.Assert(node.InputType.IsSubjectForUnionMatching); 85Debug.Assert((node.UnionMatchingMode & UnionMatchingMode.UnionValue) != 0); 89Debug.Assert(Binder.IsClassOrNullableValueTypeUnionNullPatternMatching((NamedTypeSymbol)node.InputType, node.ConstantValue)); 90Debug.Assert(node.NarrowedType.Equals(node.InputType, TypeCompareKind.AllIgnoreOptions)); 145Debug.Assert(node.UnionMatchingMode == UnionMatchingMode.None); 171Debug.Assert((node.UnionMatchingMode & UnionMatchingMode.UnionValue) != 0); 188Debug.Assert(node.UnionMatchingMode == UnionMatchingMode.UnionValue); 199Debug.Assert(node.UnionMatchingMode == UnionMatchingMode.None); 240Debug.Assert(binaryPatternStack.Count > 0); 300Debug.Assert(node.NarrowedType.Equals(leastSpecific ?? node.InputType, TypeCompareKind.ConsiderEverything)); 352Debug.Assert(rightUnionPattern.LeftOfPendingConjunction is not BoundPatternWithUnionMatching); 424Debug.Assert(right is not null); 430Debug.Assert(left is not null); 530Debug.Assert(result.InputType.Equals(pattern.InputType, TypeCompareKind.AllIgnoreOptions));
Binder\UsingStatementBinder.cs (12)
32Debug.Assert((expressionSyntax == null) ^ (declarationSyntax == null)); // Can't have both or neither. 82Debug.Assert((expressionSyntax == null) ^ (declarationSyntax == null)); // Can't have both or neither. 85Debug.Assert(boundUsingStatement is BoundUsingStatement); 105Debug.Assert(isUsingDeclaration || usingBinderOpt != null); 119Debug.Assert(expressionOpt is not null); 130Debug.Assert(!declarationsOpt.IsEmpty && declarationsOpt[0].DeclaredTypeOpt != null); 188Debug.Assert(!fromExpression || expressionOpt != null); 203Debug.Assert(!disposeMethod.IsExtensionMethod && !disposeMethod.IsExtensionBlockMember(), 228Debug.Assert(argsToParams.IsDefault); 243Debug.Assert((object)disposableInterface != null); 290Debug.Assert(expressionOpt is { }); 295Debug.Assert(declarationTypeOpt is { });
Binder\WhileBinder.cs (3)
24Debug.Assert(syntax != null && (syntax.IsKind(SyntaxKind.WhileStatement) || syntax.IsKind(SyntaxKind.DoStatement))); 34Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node)); 44Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node));
Binder\WithClassTypeParametersBinder.cs (1)
26Debug.Assert((object)container != null);
Binder\WithCrefTypeParametersBinder.cs (2)
136Debug.Assert(typeParameterSyntax != null, "Syntactic requirement of crefs"); 157Debug.Assert(!result.CanBeAdded(typeParameter.Name) || originalBinder.CanAddLookupSymbolInfo(typeParameter, options, result, null));
Binder\WithExtensionParameterBinder.cs (1)
39Debug.Assert(result.IsClear);
Binder\WithExternAliasesBinder.cs (3)
35Debug.Assert(result.IsClear); 91Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 117Debug.Assert(!externAliases.IsDefault);
Binder\WithExternAndUsingAliasesBinder.cs (6)
28Debug.Assert(!next.WithImportChainEntry); 39Debug.Assert(result.IsClear); 72Debug.Assert(this.Next is WithUsingNamespacesAndTypesBinder); 76Debug.Assert(_lazyImportChain != null); 120Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 234Debug.Assert(!externAliases.IsDefault);
Binder\WithLambdaParametersBinder.cs (2)
89Debug.Assert(result.IsClear); 153Debug.Assert(false, "what else could be defined in a lambda?");
Binder\WithNullableContextBinder.cs (2)
19Debug.Assert(syntaxTree != null); 20Debug.Assert(position >= 0);
Binder\WithParametersBinder.cs (2)
27Debug.Assert(!parameters.IsDefaultOrEmpty); 53Debug.Assert(result.IsClear);
Binder\WithPrimaryConstructorParametersBinder.cs (1)
66Debug.Assert(result.IsClear);
Binder\WithTypeParametersBinder.cs (1)
40Debug.Assert(result.IsClear);
Binder\WithUsingNamespacesAndTypesBinder.cs (7)
76Debug.Assert(members.Count == 0); 120Debug.Assert(result.IsClear); 150Debug.Assert(!symbol.IsExtensionBlockMember()); 232Debug.Assert(_lazyImportChain != null || !_withImportChainEntry); 264Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 294Debug.Assert(declarationSyntax.IsKind(SyntaxKind.CompilationUnit) || declarationSyntax.IsKind(SyntaxKind.NamespaceDeclaration)); 329Debug.Assert(!namespacesOrTypes.IsDefault);
BoundTree\BoundAwaitableInfo.cs (10)
15Debug.Assert(RuntimeAsyncAwaitCall.Method.ContainingType.ExtendedSpecialType == InternalSpecialType.System_Runtime_CompilerServices_AsyncHelpers); 16Debug.Assert(RuntimeAsyncAwaitCallPlaceholder is not null); 21Debug.Assert(GetAwaiter is null); 22Debug.Assert(IsCompleted is null); 23Debug.Assert(GetResult is null); 28Debug.Assert(GetAwaiter is not null); 29Debug.Assert(IsCompleted is not null); 30Debug.Assert(GetResult is not null); 34Debug.Fail($"Unexpected RuntimeAsyncAwaitCall: {RuntimeAsyncAwaitCall.Method.Name}"); 39Debug.Assert(GetAwaiter is not null || RuntimeAsyncAwaitCall is not null || IsDynamic || HasErrors);
BoundTree\BoundBadExpression.cs (1)
14Debug.Assert(!this.ChildBoundNodes.Any(c => Binder.IsTypeOrValueExpression(c) || Binder.IsMethodGroupWithTypeOrValueReceiver(c)));
BoundTree\BoundBinaryOperator.UncommonData.cs (6)
19Debug.Assert(OperatorKind.IsLogical()); 20Debug.Assert(method.Name is WellKnownMemberNames.TrueOperatorName or WellKnownMemberNames.FalseOperatorName); 21Debug.Assert(method.ParameterCount == 1); 25Debug.Assert(method is ErrorMethodSymbol or { ParameterCount: 2 }); 73Debug.Assert(interpolatedStringHandlerData is null || !isUnconvertedInterpolatedStringAddition); 74Debug.Assert(method is null or ErrorMethodSymbol { ParameterCount: 0 } or { MethodKind: MethodKind.UserDefinedOperator } or { ParameterCount: 2 });
BoundTree\BoundBinaryPattern.cs (6)
13Debug.Assert(Left.InputType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)); 14Debug.Assert(Left is not BoundPatternWithUnionMatching); 15Debug.Assert(Right is not BoundPatternWithUnionMatching); 19Debug.Assert(Right.InputType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)); 25Debug.Assert(Right.InputType.Equals(Left.NarrowedType, TypeCompareKind.AllIgnoreOptions)); 26Debug.Assert(NarrowedType.Equals(Right.NarrowedType, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundCall.cs (3)
15Debug.Assert(ResultKind is not LookupResultKind.MemberGroup); 16Debug.Assert(ResultKind is not LookupResultKind.StaticInstanceMismatch); 17Debug.Assert(ResultKind is LookupResultKind.Viable || HasErrors);
BoundTree\BoundCollectionExpression.cs (12)
19Debug.Assert(this.CollectionTypeKind == CollectionExpressionTypeKind.CollectionBuilder); 20Debug.Assert(this.CollectionCreation is not null); 21Debug.Assert(this.CollectionBuilderMethod is not null); 22Debug.Assert(collectionBuilderElementsPlaceholder is not null); 23Debug.Assert(collectionBuilderElementsPlaceholder.Type is not null); 25Debug.Assert(boundCall.Arguments is [.., BoundCollectionBuilderElementsPlaceholder placeholder] && 27Debug.Assert(collectionBuilderElementsPlaceholder.Type.IsReadOnlySpan()); 31Debug.Assert(this.CollectionTypeKind != CollectionExpressionTypeKind.CollectionBuilder); 32Debug.Assert(this.CollectionBuilderMethod is null); 33Debug.Assert(collectionBuilderElementsPlaceholder is null); 55Debug.Assert(collectionCreation 71Debug.Assert(element is not BoundUnconvertedWithElement);
BoundTree\BoundConstantPattern.cs (2)
16Debug.Assert(NarrowedType.IsObjectType() || 22Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions) ||
BoundTree\BoundConversion.cs (59)
13Debug.Assert(!Binder.IsTypeOrValueExpression(Operand)); 14Debug.Assert(!Binder.IsMethodGroupWithTypeOrValueReceiver(Operand)); 19Debug.Assert((InConversionGroupFlags & InConversionGroupFlags.TupleLiteral) != 0); 24Debug.Assert(Conversion.IsTupleLiteralConversion || 26Debug.Assert(Operand is BoundConvertedTupleLiteral); 31Debug.Assert(Conversion.IsIdentity); 32Debug.Assert(Operand is BoundConvertedTupleLiteral || 43Debug.Assert(ConversionGroupOpt is null); 47Debug.Assert(ConversionGroupOpt?.Conversion.IsUserDefined == true); 55Debug.Assert(Conversion == ConversionGroupOpt.Conversion); 59Debug.Assert(InConversionGroupFlags == InConversionGroupFlags.UserDefinedErroneous); 60Debug.Assert(Operand is not BoundConversion operandAsConversion || operandAsConversion.ConversionGroupOpt != ConversionGroupOpt); 64Debug.Assert(InConversionGroupFlags == InConversionGroupFlags.UserDefinedOperator); 68Debug.Assert((operandAsConversion.InConversionGroupFlags & (InConversionGroupFlags.UserDefinedFromConversion | InConversionGroupFlags.UserDefinedFromConversionAdjustment)) != 0); 72Debug.Assert(Conversion.UserDefinedFromConversion.IsIdentity || 80Debug.Assert(!ExplicitCastInCode); 81Debug.Assert(ConversionGroupOpt.Conversion.IsValid); 85Debug.Assert(ConversionsBase.IsEncompassingImplicitConversionKind(Conversion.Kind) || 92Debug.Assert((InConversionGroupFlags & InConversionGroupFlags.UserDefinedAllFlags) == InConversionGroupFlags.UserDefinedFromConversion); 93Debug.Assert(Operand is not BoundConversion operandAsConversion || 95Debug.Assert(Conversion == ConversionGroupOpt.Conversion.UserDefinedFromConversion); 99Debug.Assert((InConversionGroupFlags & InConversionGroupFlags.UserDefinedAllFlags) == InConversionGroupFlags.UserDefinedFromConversionAdjustment); 100Debug.Assert(Conversion.IsNullable); 101Debug.Assert(Conversion.IsExplicit); 102Debug.Assert(Conversion.UnderlyingConversions[0].IsIdentity); 106Debug.Assert((operandAsConversion.InConversionGroupFlags & InConversionGroupFlags.UserDefinedFromConversion) != 0); 110Debug.Assert(ConversionGroupOpt.Conversion.UserDefinedFromConversion.IsIdentity || 117Debug.Assert((InConversionGroupFlags & InConversionGroupFlags.UserDefinedAllFlags) == InConversionGroupFlags.UserDefinedReturnTypeAdjustment); 118Debug.Assert(Conversion.IsNullable); 119Debug.Assert(Conversion.IsImplicit); 120Debug.Assert(!Conversion.UnderlyingConversions[0].IsIdentity); 121Debug.Assert(Operand is BoundConversion operandAsConversion && 127Debug.Assert(InConversionGroupFlags == InConversionGroupFlags.UserDefinedFinal); 129Debug.Assert(Operand is BoundConversion operandAsConversion && 143Debug.Assert((InConversionGroupFlags & InConversionGroupFlags.UserDefinedAllFlags) == 0 || (InConversionGroupFlags & InConversionGroupFlags.UnionAllFlags) == 0); 149Debug.Assert(ConversionGroupOpt is null); 153Debug.Assert(ConversionGroupOpt?.Conversion.IsUnion == true); 161Debug.Assert(Conversion == ConversionGroupOpt.Conversion); 165Debug.Assert(InConversionGroupFlags == InConversionGroupFlags.UnionErroneous); 166Debug.Assert(Operand is not BoundConversion operandAsConversion || operandAsConversion.ConversionGroupOpt != ConversionGroupOpt); 170Debug.Assert(ConversionGroupOpt.Conversion.BestUnionConversionAnalysis is { }); 171Debug.Assert(InConversionGroupFlags == InConversionGroupFlags.UnionConstructor); 175Debug.Assert((operandAsConversion.InConversionGroupFlags & InConversionGroupFlags.UnionSourceConversion) != 0); 180Debug.Assert(sourceConversion.IsIdentity || 188Debug.Assert(ConversionGroupOpt.Conversion.IsValid); 189Debug.Assert(ConversionGroupOpt.Conversion.BestUnionConversionAnalysis is { }); 190Debug.Assert(!ExplicitCastInCode); 191Debug.Assert(ConversionsBase.IsEncompassingImplicitConversionKind(Conversion.Kind)); 195Debug.Assert((InConversionGroupFlags & InConversionGroupFlags.UnionAllFlags) == InConversionGroupFlags.UnionSourceConversion); 196Debug.Assert(Operand is not BoundConversion operandAsConversion || 198Debug.Assert(Conversion == ConversionGroupOpt.Conversion.BestUnionConversionAnalysis.SourceConversion); 202Debug.Assert(InConversionGroupFlags == InConversionGroupFlags.UnionFinal); 203Debug.Assert(Conversion.IsNullable); 204Debug.Assert(Conversion.IsImplicit); 205Debug.Assert(Conversion.UnderlyingConversions[0].IsIdentity); 206Debug.Assert(Operand is BoundConversion operandAsConversion && 209Debug.Assert(Conversion == ConversionGroupOpt.Conversion.BestUnionConversionAnalysis.TargetConversion); 221Debug.Assert(ConversionGroupOpt?.Conversion.IsUnion == true); 241Debug.Assert(current.InConversionGroupFlags == InConversionGroupFlags.UnionConstructor);
BoundTree\BoundDagEvaluation.cs (11)
21Debug.Assert(other.GetHashCode() == this.GetHashCode()); 22Debug.Assert(DecisionDagBuilder.IsEqualEvaluation(other, this)); 23Debug.Assert(other is BoundDagIndexerEvaluation or BoundDagTypeEvaluation or BoundDagPassThroughEvaluation || 64Debug.Assert(result is not null || this is BoundDagAssignmentEvaluation or BoundDagPassThroughEvaluation); 198Debug.Assert(Property.Type.IsObjectType()); 225Debug.Assert(IndexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess); 262Debug.Assert(IndexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess); 327Debug.Assert(parameter.RefKind == RefKind.Out); 339Debug.Assert(parameter.RefKind == RefKind.Out); 345Debug.Assert(!DeconstructMethod.ReturnsVoid); 382Debug.Assert(Input.Source is BoundDagTypeEvaluation);
BoundTree\BoundDagTemp.cs (1)
30Debug.Assert(other.GetHashCode() == this.GetHashCode());
BoundTree\BoundDecisionDag.cs (2)
81Debug.Assert(wasAcyclic); 108Debug.Assert(!replacement.ContainsKey(node));
BoundTree\BoundDecisionDagNode.cs (2)
66Debug.Assert(value >= 0, "Id must be non-negative but was set to " + value); 67Debug.Assert(_id == -1, $"Id was set to {_id} and set again to {value}");
BoundTree\BoundDeclarationPattern.cs (2)
13Debug.Assert(DeclaredType is not null); 14Debug.Assert(NarrowedType.Equals(DeclaredType.Type, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundDiscardExpression.cs (3)
14Debug.Assert(Type is null && type.HasType); 15Debug.Assert(this.IsInferred); 32Debug.Assert(this.Type is { });
BoundTree\BoundDiscardPattern.cs (1)
13Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundExpression.cs (8)
22Debug.Assert(this.WasCompilerGenerated || 47Debug.Assert(suppress || !this.IsSuppressed); 236Debug.Fail("Getting here is unexpected."); 253Debug.Assert(Expression.ConstantValueOpt == null); 434Debug.Assert(LogicalOperator.ParameterCount == 2); 435Debug.Assert(TrueOperator.ParameterCount == 1); 436Debug.Assert(FalseOperator.ParameterCount == 1); 707Debug.Fail("Getting here is unexpected.");
BoundTree\BoundExpressionExtensions.cs (1)
137Debug.Assert(expr.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda);
BoundTree\BoundFunctionPointerInvocation.cs (1)
16Debug.Assert(InvokedExpression.Type is FunctionPointerTypeSymbol);
BoundTree\BoundImplicitIndexerAccess.cs (2)
20Debug.Assert(LengthOrCountAccess is BoundPropertyAccess or BoundArrayLength or BoundLocal or BoundBadExpression); 21Debug.Assert(IndexerOrSliceAccess is BoundIndexerAccess or BoundCall or BoundArrayAccess);
BoundTree\BoundInlineArrayAccess.cs (9)
16Debug.Assert(!IsValue || GetItemOrSliceHelper == WellKnownMember.System_ReadOnlySpan_T__get_Item); 18Debug.Assert(Argument.Type is 35Debug.Assert(GetItemOrSliceHelper is 41Debug.Assert(Type.Name == "ReadOnlySpan"); 45Debug.Assert(Type.Name == "Span"); 49Debug.Assert(Type is 62Debug.Assert(((NamedTypeSymbol)Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Equals(Expression.Type?.TryGetInlineArrayElementField()?.TypeWithAnnotations ?? default, TypeCompareKind.ConsiderEverything)); 66Debug.Assert(GetItemOrSliceHelper is 70Debug.Assert(Type.Equals(Expression.Type?.TryGetInlineArrayElementField()?.Type, TypeCompareKind.ConsiderEverything));
BoundTree\BoundIsPatternExpression.cs (2)
17Debug.Assert(negated == this.IsNegated); 28Debug.Assert(decisionDag.SuitableForLowering);
BoundTree\BoundITuplePattern.cs (2)
14Debug.Assert(UnionMatchingMode == UnionMatchingMode.None); 15Debug.Assert(NarrowedType.IsCompilerServicesTopLevelType() && NarrowedType.Name == "ITuple");
BoundTree\BoundListPattern.cs (6)
21Debug.Assert(!Subpatterns.Any(p => p is BoundPatternWithUnionMatching)); 22Debug.Assert(LengthAccess is null or BoundPropertyAccess or BoundBadExpression); 23Debug.Assert(IndexerAccess is null or BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess or BoundPointerElementAccess); 24Debug.Assert(Binder.GetIndexerOrImplicitIndexerSymbol(IndexerAccess) is var _); 25Debug.Assert(UnionMatchingMode == UnionMatchingMode.None); 26Debug.Assert(NarrowedType.Equals(InputType.StrippedType(), TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundMethodDefIndex.cs (1)
13Debug.Assert(Method.IsDefinition);
BoundTree\BoundNameOfOperator.cs (2)
13Debug.Assert(!Binder.IsTypeOrValueExpression(Argument)); 14Debug.Assert(!Binder.IsMethodGroupWithTypeOrValueReceiver(Argument));
BoundTree\BoundNegatedPattern.cs (4)
14Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)); 15Debug.Assert(Negated.InputType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)); 16Debug.Assert(Negated is not BoundPatternWithUnionMatching); 17Debug.Assert(UnionMatchingMode == UnionMatchingMode.None);
BoundTree\BoundNode.cs (21)
75Debug.Assert( 139Debug.Assert((_attributes & BoundNodeAttributes.HasErrors) == 0, 157Debug.Assert(original is BoundExpression || !original.IsSuppressed); 185Debug.Assert((_attributes & BoundNodeAttributes.WasCompilerGeneratedIsChecked) == 0, 195Debug.Assert((_attributes & BoundNodeAttributes.CompilerGenerated) == 0, 207Debug.Assert((_attributes & BoundNodeAttributes.WasCompilerGeneratedIsChecked) == 0, 240Debug.Assert((_attributes & BoundNodeAttributes.WasTopLevelNullabilityChecked) == 0, 304Debug.Assert((_attributes & BoundNodeAttributes.IsSuppressed) == 0, "flag should not be set twice or reset"); 326Debug.Assert((_attributes & BoundNodeAttributes.WasConverted) == 0, "WasConverted flag should not be set twice or reset"); 342Debug.Assert((_attributes & BoundNodeAttributes.WasPropertyBackingFieldAccessChecked) == 0, "should not be set twice or reset"); 360Debug.Assert(value || !IsParamsArrayOrCollection); 361Debug.Assert(!value || 366Debug.Assert(!value || 468Debug.Assert(possiblyUserDefined.Conversion.IsUserDefined); 495Debug.Assert(possiblyUnion.Conversion.IsUnion); 519Debug.Assert((boundConversion.InConversionGroupFlags & InConversionGroupFlags.LoweredFormOfUserDefinedConversionForExpressionTree) != 0); 562Debug.Assert(false, "duplicate local " + local.GetDebuggerDisplay()); 573Debug.Assert(false, "missing local " + local.GetDebuggerDisplay()); 582Debug.Assert(false, "undeclared local " + local.GetDebuggerDisplay()); 618Debug.Assert(added); 635Debug.Assert(removed);
BoundTree\BoundNodeExtensions.cs (7)
41Debug.Assert(statement != null); 59Debug.Assert(call != null); 152Debug.Assert(stack.Count == 0); 158Debug.Assert(typeof(TInterpolatedStringType) == typeof(BoundInterpolatedString) || binary.IsUnconvertedInterpolatedStringAddition); 211Debug.Assert(currentBinary.Left is TInterpolatedStringType || result != null); 233Debug.Assert(result != null); 244Debug.Assert(typeof(TInterpolatedStringType) == typeof(BoundInterpolatedString) || binary.IsUnconvertedInterpolatedStringAddition);
BoundTree\BoundPattern.cs (3)
24Debug.Assert(negatedPattern.UnionMatchingMode == UnionMatchingMode.None); 35Debug.Assert(UnionMatchingMode != UnionMatchingMode.UnionInstance); 36Debug.Assert(UnionMatchingMode == UnionMatchingMode.None || InputType is { IsSubjectForUnionMatching: true });
BoundTree\BoundPatternWithUnionMatching.cs (11)
14Debug.Assert(UnionMatchingInputType.IsSubjectForUnionMatching); 15Debug.Assert(InputType.Equals(LeftOfPendingConjunction?.InputType ?? UnionMatchingInputType, TypeCompareKind.AllIgnoreOptions)); 16Debug.Assert(UnionMatchingInputType == (object)(LeftOfPendingConjunction?.NarrowedType ?? InputType)); 17Debug.Assert(NarrowedType == (object)(SharedRightOfPendingConjunction ?? ExclusiveValuePattern).NarrowedType); 18Debug.Assert(ExclusiveValuePattern is not BoundPatternWithUnionMatching); 19Debug.Assert(SharedRightOfPendingConjunction is not BoundPatternWithUnionMatching); 26Debug.Assert(p1.DeclaredType == (object)((BoundTypePattern)ExclusiveValuePattern).DeclaredType); 29Debug.Assert(p1.DeclaredType == (object)((BoundDeclarationPattern)ExclusiveValuePattern).DeclaredType); 32Debug.Assert(p1.DeclaredType == (object?)((BoundRecursivePattern)ExclusiveValuePattern).DeclaredType); 38Debug.Assert(SharedRightOfPendingConjunction is not null || NarrowedType.Equals(ExclusiveInstancePattern.NarrowedType, TypeCompareKind.ConsiderEverything)); 39Debug.Assert(ExclusiveInstancePattern.InputType == (object)UnionMatchingInputType);
BoundTree\BoundRecursivePattern.cs (3)
17Debug.Assert(UnionMatchingMode == UnionMatchingMode.None); 18Debug.Assert(NarrowedType.Equals(InputType.StrippedType(), TypeCompareKind.AllIgnoreOptions)); 22Debug.Assert(NarrowedType.Equals(DeclaredType.Type, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundRelationalPattern.cs (3)
16Debug.Assert((UnionMatchingMode & UnionMatchingMode.UnionInstance) == 0); 17Debug.Assert(NarrowedType.IsObjectType() || 22Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions) ||
BoundTree\BoundReturnStatement.cs (1)
13Debug.Assert(RefKind is RefKind.None or RefKind.Ref); // We assume that 'ref readonly' cannot be result of a return inference for a lambda.
BoundTree\BoundSlicePattern.cs (4)
18Debug.Assert(Pattern is not BoundPatternWithUnionMatching); 19Debug.Assert(IndexerAccess is null or BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess); 20Debug.Assert(Binder.GetIndexerOrImplicitIndexerSymbol(IndexerAccess) is var _); 21Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundStatementExtensions.cs (3)
30Debug.Assert(node != null); 35Debug.Assert(((BoundLabelStatement)node).Label == label); 39Debug.Assert(((BoundLabeledStatement)node).Label == label);
BoundTree\BoundSubpattern.cs (1)
13Debug.Assert(Pattern is not BoundPatternWithUnionMatching);
BoundTree\BoundSwitchExpression.cs (1)
29Debug.Assert(decisionDag.SuitableForLowering);
BoundTree\BoundSwitchStatement.cs (1)
25Debug.Assert(decisionDag.SuitableForLowering);
BoundTree\BoundTreeRewriter.cs (14)
38System.Diagnostics.Debug.Assert(item != null); 69Debug.Assert(symbol is not null); 75Debug.Assert(symbol is not null); 84Debug.Assert(symbol is not null); 90Debug.Assert(symbol is not null); 102Debug.Assert(symbol is not null); 177Debug.Assert(newSymbol is not null); 274Debug.Assert(left is { }); 280Debug.Assert(right is { }); 286Debug.Assert((object)binary == node); 334Debug.Assert((object)ifStatement == node); 368Debug.Assert(left is { }); 374Debug.Assert(right is { }); 379Debug.Assert((object)binary == node);
BoundTree\BoundTreeVisitors.cs (2)
202Debug.Assert(node is BoundExpression or BoundPattern); 221Debug.Assert(saveRecursionDepth == recursionDepth);
BoundTree\BoundTreeWalker.cs (1)
88Debug.Assert(node is BoundExpression or BoundPattern);
BoundTree\BoundTypeOrValueExpression.cs (2)
14Debug.Assert(Syntax is IdentifierNameSyntax); 15Debug.Assert(!HasErrors);
BoundTree\BoundTypePattern.cs (1)
13Debug.Assert(NarrowedType.Equals(DeclaredType.Type, TypeCompareKind.AllIgnoreOptions));
BoundTree\Constructors.cs (7)
140Debug.Assert(method.OriginalDefinition is ErrorMethodSymbol); 143Debug.Assert(resultKind is not LookupResultKind.Viable); 144Debug.Assert(arguments.IsDefaultOrEmpty || (object)receiverOpt != (object)arguments[0]); 201Debug.Assert(argumentRefKind is RefKind.None or RefKind.Ref or RefKind.In or RefKind.Out or RefKindExtensions.StrictIn && 213Debug.Assert(method is ErrorMethodSymbol || arguments[i].Kind == BoundKind.ArgListOperator); 487Debug.Assert((object)typeWithAnnotations.Type != null, "Field 'type' cannot be null"); 543Debug.Assert((object)type != null);
BoundTree\InterpolatedStringHandlerData.cs (4)
37Debug.Assert(construction is BoundObjectCreationExpression or BoundDynamicObjectCreationExpression or BoundBadExpression); 38Debug.Assert(!placeholders.IsDefault); 40Debug.Assert(placeholders.IsEmpty || placeholders.AsSpan()[..^1].All(item => item.ArgumentIndex != BoundInterpolatedStringArgumentPlaceholder.TrailingConstructorValidityParameter)); 41Debug.Assert(!positionInfo.IsDefault);
BoundTree\LengthBasedStringSwitchData.cs (12)
92Debug.Assert(lengthCaseLabels.Length > 0); 107Debug.Assert(charCaseLabels.Length > 0); 122Debug.Assert(stringCaseLabels.Length > 0); 139Debug.Assert(inputCases.All(c => c.value.IsString && c.label is not null)); 146Debug.Assert(nullCaseLabel is null, "At most one null case per string dispatch"); 168Debug.Assert(stringLength >= 0); 169Debug.Assert(casesWithGivenLength.All(c => c.value.Length == stringLength)); 170Debug.Assert(casesWithGivenLength.Length > 0); 206Debug.Assert(stringLength > 0); 207Debug.Assert(caseLabels.Length > 0); 234Debug.Assert(caseLabel.value is not null); 255Debug.Assert(cases.Length > 0 && cases.All(c => c.value is not null));
BoundTree\NullabilityRewriter.cs (8)
39Debug.Assert(rewrittenConsequence is { }); 87Debug.Assert(stack.Count > 0); 134Debug.Assert(currentBinary != null); 152Debug.Assert(stack.Count > 0); 245Debug.Assert(updatedContaining is object); 250Debug.Assert(updatedDelegateType is object); 256Debug.Assert(lambda.ParameterCount == updatedLambda.ParameterCount); 322Debug.Assert(updatedSymbol is object);
BoundTree\OutDeconstructVarPendingInference.cs (1)
16Debug.Assert(Placeholder is null);
BoundTree\TupleBinaryOperatorInfo.cs (5)
73Debug.Assert(Kind.IsUserDefined() == (MethodSymbolOpt is { })); 111Debug.Assert(leftConvertedTypeOpt is null || leftConvertedTypeOpt.StrippedType().IsTupleType); 112Debug.Assert(rightConvertedTypeOpt is null || rightConvertedTypeOpt.StrippedType().IsTupleType); 113Debug.Assert(!operators.IsDefault); 114Debug.Assert(operators.IsEmpty || operators.Length > 1); // an empty array is used for error cases, otherwise tuples must have cardinality > 1
BoundTree\UnboundLambda.cs (34)
90Debug.Assert( 126Debug.Assert(getterNullResilienceData is null || nullableState is not null); 146Debug.Assert(!UnboundLambda.HasExplicitReturnType(out _, out _, out _)); 147Debug.Assert(conversions != null); 200Debug.Assert(!node.UnboundLambda.HasExplicitReturnType(out _, out _, out _)); 207Debug.Assert(!node.HasExplicitReturnType(out _, out _, out _)); 240Debug.Assert(bestType.Type is not FunctionTypeSymbol); 244Debug.Assert(refKind != RefKind.RefReadOnly); 424Debug.Assert(binder != null); 425Debug.Assert(syntax.IsAnonymousFunction()); 555Debug.Assert(binder != null); 556Debug.Assert(binder.ContainingMemberOrLambda != null); 569Debug.Assert(unbound != null); 570Debug.Assert(_unboundLambda == null || (object)_unboundLambda == unbound); 584Debug.Assert((state._bindingCache == null) != includeCache); 740Debug.Assert(Binder.ContainingMemberOrLambda is { }); 792Debug.Assert(getEffectiveScopeFromSymbol); 797Debug.Assert(lambdaSymbol.Parameters[i].EffectiveScope == parameterScopesBuilder[i]); 820Debug.Assert(Binder.ContainingMemberOrLambda is { }); 1016Debug.Assert(refKind != CodeAnalysis.RefKind.RefReadOnly); 1017Debug.Assert(refCustomModifiers.IsEmpty); 1042Debug.Assert(refKind != CodeAnalysis.RefKind.RefReadOnly); 1043Debug.Assert(refCustomModifiers.IsEmpty); 1098Debug.Assert(parameterTypes.Length == parameterRefKinds.Length); 1099Debug.Assert(taskLikeReturnTypeOpt is null || ((object)taskLikeReturnTypeOpt == taskLikeReturnTypeOpt.ConstructedFrom && taskLikeReturnTypeOpt.IsCustomTaskType(out var builderArgument))); 1273Debug.Assert(!inferredReturnType.IsExplicitType); 1573Debug.Assert(HasSignature && 0 <= index && index < ParameterCount); 1596Debug.Assert(!_parameterNames.IsDefault && 0 <= index && index < _parameterNames.Length); 1602Debug.Assert(0 <= index && index < this.ParameterCount); 1608Debug.Assert(0 <= index && index < this.ParameterCount); 1614Debug.Assert(0 <= index && index < this.ParameterCount); 1620Debug.Assert(0 <= index && index < this.ParameterCount); 1626Debug.Assert(this.HasExplicitlyTypedParameterList); 1627Debug.Assert(0 <= index && index < _parameterTypesWithAnnotations.Length);
BoundTree\VariablePendingInference.cs (5)
29Debug.Assert(type.HasType); 36Debug.Assert(binderOpt != null || type.HasType); 37Debug.Assert(this.Syntax.Kind() == SyntaxKind.SingleVariableDesignation || 95Debug.Assert(inferenceDiagnostics.DependenciesBag is object); 96Debug.Assert(inferenceDiagnostics.DependenciesBag.Count == 0);
CodeGen\CodeGenerator_HasHome.cs (7)
49Debug.Assert(containingSymbol is object); 71Debug.Assert(IsAnyReadOnly(addressKind), "`this` is readonly in classes"); 129Debug.Assert(HasHome( 135Debug.Assert(HasHome( 182Debug.Assert(containingSymbol is object); 220Debug.Assert(field.RefKind == RefKind.None); 230Debug.Assert(!IsAnyReadOnly(addressKind));
CodeGen\CodeGenerator.cs (22)
95Debug.Assert((object)method != null); 96Debug.Assert(boundBody != null); 97Debug.Assert(builder != null); 98Debug.Assert(moduleBuilder != null); 99Debug.Assert(diagnostics != null); 100Debug.Assert(diagnostics.DiagnosticBag != null); 171Debug.Assert(!_method.ReturnsVoid, "returning something from void method?"); 184Debug.Assert(((InternalSpecialType)returnType.OriginalDefinition.ExtendedSpecialType) is InternalSpecialType.System_Threading_Tasks_ValueTask_T or InternalSpecialType.System_Threading_Tasks_Task_T); 228Debug.Assert(_asyncCatchHandlerOffset < 0); 229Debug.Assert(_asyncYieldPoints == null); 230Debug.Assert(_asyncResumePoints == null); 241Debug.Assert(_asyncCatchHandlerOffset >= 0); 248Debug.Assert((yieldPoints == null) == (resumePoints == null)); 264Debug.Assert(resumeOffset >= 0); // resume marker should always be reachable from dispatch 313Debug.Assert(_diagnostics.HasAnyErrors()); 318Debug.Assert(!(_expressionTemps?.Count > 0), "leaking expression temps?"); 327Debug.Assert(_method.ReturnsVoid == (_returnTemp == null) 464Debug.Assert(node.Syntax is { }); 508Debug.Assert(_emitPdbSequencePoints); 519Debug.Assert(syntaxTree != null); 520Debug.Assert(_emitPdbSequencePoints); 541Debug.Assert(!exprTemps.Contains(temp));
CodeGen\EmitAddress.cs (15)
36Debug.Assert(((BoundDup)expression).RefKind != RefKind.None, "taking address of a stack value?"); 41Debug.Assert(!expression.Type.IsReferenceType); 42Debug.Assert(!expression.Type.IsValueType || expression.Type.IsNullableType()); 65Debug.Assert(expression.Type.IsValueType || IsAnyReadOnly(addressKind), "'this' is readonly in classes"); 90Debug.Assert(false, "base is always a reference type, why one may need a reference to it?"); 102Debug.Assert(operand.Type.IsPointerType()); 166Debug.Assert(HasHome(right, addressKind)); 176Debug.Assert(!HasHome(expression, addressKind)); 221Debug.Assert(expr.ConstantValueOpt == null, "Constant value should have been emitted directly"); 242Debug.Assert(!expression.Type.IsReferenceType); 243Debug.Assert(!expression.Type.IsValueType); 255Debug.Assert(receiverTemp == null); 426Debug.Assert(arrayAccess.Type.TypeKind == TypeKind.TypeParameter, "constrained call should only be used with type parameter types"); 536Debug.Assert(receiverType.TypeKind == TypeKind.TypeParameter || receiverType.IsValueType); 542Debug.Assert(!receiverType.IsVerifierReference());
CodeGen\EmitArrayInitializer.cs (19)
150Debug.Assert(!indices.Any()); 195Debug.Assert(indices.Count == arrayType.Rank - 1); 369Debug.Assert(inits.All((init) => init.Kind != BoundKind.ArrayInitialization) || 432Debug.Assert(inPlaceTarget is null || TargetIsNotOnHeap(inPlaceTarget), "in-place construction target should not be on heap"); 467Debug.Assert(!rosPointerCtor.HasUnsupportedMetadata); 511Debug.Assert(arrayType is not null); 512Debug.Assert(elementType is not null); 525Debug.Assert(length is not null); 569Debug.Assert(used); 584Debug.Assert(specialElementType.SizeInBytes() is 2 or 4 or 8, "Supported primitives are expected to be 2, 4, or 8 bytes"); 612Debug.Assert(!createSpan.HasUnsupportedMetadata); 690Debug.Assert(initializer != null); 693Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null)); 694Debug.Assert(!elementType.IsEnumType()); 739Debug.Assert(used); 770Debug.Assert(used); 784Debug.Assert(!rosArrayCtor.HasUnsupportedMetadata); 813Debug.Assert(initializers.Length > 0); 814Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null));
CodeGen\EmitConversion.cs (9)
73Debug.Assert((operand.Type.IsArray()) && 155Debug.Assert(IsNumeric(toType)); 158Debug.Assert(IsNumeric(fromType)); 159Debug.Assert( 247Debug.Assert(IsNumeric(fromType)); 251Debug.Assert(IsNumeric(toType)); 319Debug.Assert(!conversion.Type.IsNullableType()); 328Debug.Assert(IsNumeric(fromType)); 337Debug.Assert(IsNumeric(toType));
CodeGen\EmitExpression.cs (120)
79Debug.Assert(_recursionDepth == 1); 84Debug.Assert(_recursionDepth == 1); 233Debug.Assert(used); 238Debug.Assert(used); 243Debug.Assert(!used); 248Debug.Assert(used); 253Debug.Assert(used); 258Debug.Assert(used); 263Debug.Assert(used); 268Debug.Assert(used); 273Debug.Assert(used); 278Debug.Assert(used); 313Debug.Assert(used); 359Debug.Assert(expression.Kind != BoundKind.BadExpression); 376Debug.Assert(!expression.Type.IsReferenceType); 377Debug.Assert(!expression.Type.IsValueType); 408Debug.Assert(!receiverType.IsValueType || 415Debug.Assert(receiverType.IsVerifierReference()); 519Debug.Assert(receiver.Type.IsNullableType()); 572Debug.Assert(receiverTemp == null); 575Debug.Assert(receiverTemp == null || receiver.IsDefaultValue()); 613Debug.Assert(walker._result.HasValue); 631Debug.Assert(!_result.HasValue); 640Debug.Assert(!_result.HasValue); 651Debug.Assert(!expression.Type.IsValueType); 674Debug.Assert(temp == null, "makeref should not create temps"); 691Debug.Assert((object)getTypeMethod != null); 721Debug.Assert(refKind is RefKind.In or RefKind.Ref or RefKind.Out or RefKindExtensions.StrictIn); 727Debug.Assert(refKind is RefKind.In || argument.Type.IsDynamic() || argument is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None }, "passing args byref should not clone them into temps"); 746Debug.Assert(refKind is RefKind.Ref or RefKind.Out or RefKindExtensions.StrictIn); 758Debug.Assert(temp == null, "If the operand is addressable, then a temp shouldn't be required."); 810Debug.Assert((object)meth != null); 817Debug.Assert(thisType.TypeKind != TypeKind.TypeParameter); 867Debug.Assert(sequence.Value.Kind != BoundKind.TypeExpression || !used); 957Debug.Assert(arguments.Length == parameters.Length || 959Debug.Assert(parameters.All(p => p.RefKind == RefKind.None) || !argRefKindsOpt.IsDefault, "there are nontrivial parameters, so we must have argRefKinds"); 961Debug.Assert(argRefKindsOpt.IsDefault || argRefKindsOpt.Length == arguments.Length || 985Debug.Assert(argRefKind == parameters[i].RefKind || 996Debug.Assert(parameters[i].RefKind != RefKind.RefReadOnlyParameter, 1010Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator); 1150Debug.Assert(!field.IsConst || field.ContainingType.SpecialType == SpecialType.System_Decimal, 1193Debug.Assert(FieldLoadMustUseRef(receiver), "only clr-ambiguous structs use temps here"); 1260Debug.Assert(!field.IsVolatile, "volatile valuetype fields are unexpected"); 1432Debug.Assert(parameter.Type.Equals(parameter.ParameterSymbol.Type, TypeCompareKind.AllIgnoreOptions) || 1540Debug.Assert(receiver.Type.IsVerifierReference(), "this is not a reference"); 1541Debug.Assert(receiver.Kind != BoundKind.BaseReference, "base should always use call"); 1669Debug.Assert(method.IsImplicitlyDeclared); 1670Debug.Assert(TypeSymbol.Equals(method.ContainingType, receiver.Type, TypeCompareKind.ConsiderEverything2)); 1671Debug.Assert(receiver.Kind == BoundKind.ThisReference); 1686Debug.Assert(method.IsStatic); 1755Debug.Assert(!box); 1763Debug.Assert(addressKind.GetValueOrDefault() != AddressKind.Constrained); 1764Debug.Assert(!parentCallReceiverType.IsVerifierValue()); 1765Debug.Assert(parentCallKind != CallKind.ConstrainedCallVirt); 1769Debug.Assert(!box); 1770Debug.Assert(!parentCallReceiverType.IsVerifierReference()); 1805Debug.Assert(receiverUseKind == UseKind.UsedAsValue); 1815Debug.Assert(receiverUseKind == UseKind.UsedAsValue); 1820Debug.Assert(!parentCallReceiverType.IsVerifierReference()); 1824Debug.Assert(receiverUseKind == UseKind.UsedAsValue); 1825Debug.Assert(!HasHome(nested, addressKind.GetValueOrDefault())); 1868Debug.Assert(!method.IsStatic && !method.IsDefaultValueTypeConstructor() && method.RequiresInstanceReceiver); 1908Debug.Assert(TypeSymbol.Equals(receiverType, methodContainingType, TypeCompareKind.ObliviousNullableModifierMatchesAny)); 1953Debug.Assert((callKind != CallKind.ConstrainedCallVirt) || (addressKind.GetValueOrDefault() == AddressKind.Constrained) || receiverType.IsVerifierValue()); 1976Debug.Assert(!box); 1977Debug.Assert(!receiverType.IsVerifierReference()); 2022Debug.Assert(receiver.Type.IsVerifierReference()); 2033Debug.Assert(receiver.Type.IsVerifierReference()); 2046Debug.Assert(false, "Taking this code path is likely unexpected."); 2205Debug.Assert(!b.OperatorKind.IsUserDefined()); 2218Debug.Assert(!conv.ConversionKind.IsUserDefinedConversion()); 2219Debug.Assert(!conv.ConversionKind.IsUnionConversion()); 2236Debug.Assert(methodContainingType.IsVerifierValue(), "only struct calls can be readonly"); 2351Debug.Assert(method.ContainingType.IsVerifierValue(), "this is not a value type"); 2399Debug.Assert(expression.Type.SpecialType == SpecialType.System_Int32 || 2732Debug.Assert(temp == null, "in-place init target should not create temps"); 2739Debug.Assert(TargetIsNotOnHeap(target), "cannot read-back the target since it could have been modified"); 2746Debug.Assert(TargetIsNotOnHeap(target), "in-place construction target should not be on heap"); 2761Debug.Assert(temp == null, "in-place ctor target should not create temps"); 2855Debug.Assert(temp == null, "temp is unexpected when assigning to a field"); 2939Debug.Assert(temp == null, "taking ref of this should not create a temp"); 2950Debug.Assert(temp == null, "taking ref of Dup should not create a temp"); 2959Debug.Assert(left.IsRef); 2962Debug.Assert(temp == null, "taking ref of this should not create a temp"); 2995Debug.Assert(left.Method.RefKind != RefKind.None); 3006Debug.Assert(left.FunctionPointer.Signature.RefKind != RefKind.None); 3061Debug.Assert(lhs.Kind != BoundKind.Parameter || exprTempsAfter <= exprTempsBefore); 3179Debug.Assert(((BoundDup)expression).RefKind != RefKind.None); 3184Debug.Assert(((BoundConditionalOperator)expression).IsRef); 3202Debug.Assert(((BoundCall)expression).Method.RefKind != RefKind.None); 3207Debug.Assert(((BoundFunctionPointerInvocation)expression).FunctionPointer.Signature.RefKind != RefKind.None); 3258Debug.Assert(thisRef.Type.IsValueType); 3454Debug.Assert((object)operand.Type != null); 3473Debug.Assert(asOp.OperandPlaceholder is null); 3474Debug.Assert(asOp.OperandConversion is null); 3483Debug.Assert((object)targetType != null); 3535Debug.Assert(expression.Type.SpecialType == SpecialType.System_Decimal || 3580Debug.Assert((object)getTypeMethod != null); // Should have been checked during binding 3601Debug.Assert(node.Method.IsDefinition); 3602Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3619Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3633Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3647Debug.Assert(field.IsDefinition); 3656Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3692Debug.Assert(throwMethod != null); 3735Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3746Debug.Assert((object)getMethod != null); 3754Debug.Assert(getMethod.ParameterCount == 2); 3773Debug.Assert((object)getField != null); 3781Debug.Assert(getField.ParameterCount == 2); 3810Debug.Assert(expr.ConstantValueOpt == null, "Constant value should have been emitted directly"); 3908Debug.Assert(expr.LeftConversion is null, "coalesce with nontrivial left conversions are lowered into conditional."); 3909Debug.Assert(expr.Type.IsReferenceType); 3989Debug.Assert(conversionKind != ConversionKind.NullLiteral && conversionKind != ConversionKind.DefaultLiteral); 4056Debug.Assert(to.IsVerifierReference()); 4076Debug.Assert(!type.IsRefLikeType); 4129Debug.Assert(useKind == UseKind.Unused, "Using the return value of a void method."); 4130Debug.Assert(_method.GenerateDebugInfo, "Implied by this.emitSequencePoints"); 4169Debug.Assert(method.RefKind != RefKind.None); 4175Debug.Assert(load.Type is { TypeKind: TypeKind.FunctionPointer });
CodeGen\EmitOperators.cs (21)
153Debug.Assert((object)binary == expression); 305Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 306Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 314Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 315Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 331Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 332Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 337Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 338Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 343Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 344Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 496Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 501Debug.Assert(constantValue.Discriminator == ConstantValueTypeDiscriminator.Boolean); 531Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 535Debug.Assert(constantValue.Discriminator == ConstantValueTypeDiscriminator.Boolean); 575Debug.Assert(unOp.OperatorKind == UnaryOperatorKind.BoolLogicalNegation); 583Debug.Assert(expression.OperatorKind.Operator() == UnaryOperatorKind.UnaryMinus); 596Debug.Assert(type == UnaryOperatorKind.Int || type == UnaryOperatorKind.Long || type == UnaryOperatorKind.NInt); 659Debug.Assert(TypeSymbol.Equals(expression.Left.Type, expression.Right.Type, TypeCompareKind.ConsiderEverything2)); 676Debug.Assert(enumType.IsEnumType()); 779Debug.Assert(opKind.Operator() != BinaryOperatorKind.UnsignedRightShift);
CodeGen\EmitStackAllocInitializer.cs (4)
24Debug.Assert(type is PointerTypeSymbol || type is NamedTypeSymbol); 25Debug.Assert(_diagnostics.DiagnosticBag is not null); 75Debug.Assert(TypeSymbol.Equals(readOnlySpan.OriginalDefinition, _module.Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.ConsiderEverything)); 171Debug.Assert(!(init is BoundArrayInitialization), "Nested initializers are not allowed for stackalloc");
CodeGen\EmitStatement.cs (58)
145Debug.Assert((_asyncYieldPoints == null) == (_asyncResumePoints == null)); 151Debug.Assert(_asyncYieldPoints.Count == _asyncResumePoints.Count); 156Debug.Assert(_asyncYieldPoints != null); 157Debug.Assert(_asyncYieldPoints != null); 159Debug.Assert(_asyncYieldPoints.Count == _asyncResumePoints.Count); 192Debug.Assert(label != null); 221Debug.Assert(tc != Microsoft.Cci.PrimitiveTypeCode.Invalid); 222Debug.Assert(tc != Microsoft.Cci.PrimitiveTypeCode.Void); 232Debug.Assert(opKind == BinaryOperatorKind.Equal || 378Debug.Assert(_recursionDepth == 1); 383Debug.Assert(_recursionDepth == 1); 421Debug.Assert(binOp.ConstantValueOpt is null); 589Debug.Assert((object)operand.Type != null); 708Debug.Fail("Exception handling constructs should be blocked at the binding layer, not here at emit time"); 759Debug.Assert(local.RefKind == RefKind.None || local.SynthesizedKind.IsLongLived(), 804Debug.Assert(!block.Locals.IsEmpty); 810Debug.Assert(local.Name != null); 811Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.UserDefined && 884Debug.Assert(unexpectedTemp == null, "ref-returning a temp?"); 937Debug.Fail("Exception handling constructs should be blocked at the binding layer, not here at emit time"); 943Debug.Assert(!statement.CatchBlocks.IsDefault); 1152Debug.Assert(exceptionSourceOpt.Type.IsTypeParameter()); // only expecting type parameters 1161Debug.Assert(seq.Locals.IsDefaultOrEmpty); 1170Debug.Assert(exceptionSourceLocal.LocalSymbol.RefKind == RefKind.None); 1180Debug.Assert(!left.FieldSymbol.IsStatic, "Not supported"); 1181Debug.Assert(!left.ReceiverOpt.Type.IsTypeParameter()); 1182Debug.Assert(left.FieldSymbol.RefKind == RefKind.None); 1196Debug.Assert(receiverTemp == null); 1215Debug.Assert(_builder.IsStackEmpty); 1240Debug.Assert(currentCatchFilterLevel == _inCatchFilterLevel); 1251Debug.Assert(_asyncCatchHandlerOffset < 0); // only one expected 1259Debug.Assert((object)dispatch.Expression.Type != null); 1260Debug.Assert(dispatch.Expression.Type.IsValidV6SwitchGoverningType() || dispatch.Expression.Type.IsSpanOrReadOnlySpanChar()); 1263Debug.Assert(!dispatch.Expression.Type.IsNullableType()); 1266Debug.Assert(dispatch.Cases.Any()); 1281Debug.Assert(expression.ConstantValueOpt == null); 1282Debug.Assert((object)expression.Type != null && 1284Debug.Assert(switchCaseLabels.Length > 0); 1286Debug.Assert(switchCaseLabels != null || lengthBasedSwitchStringJumpTableOpt != null); 1334Debug.Assert(lengthBasedSwitchStringJumpTableOpt is null || 1400Debug.Assert(indexerRef is not null); 1401Debug.Assert(lengthMethodRef is not null); 1506Debug.Assert(diag.IsEmptyWithoutResolution); 1571Debug.Assert(sequenceEqualsTMethod != null && !sequenceEqualsTMethod.HasUseSiteError); 1576Debug.Assert(asSpanMethod != null && !asSpanMethod.HasUseSiteError); 1582Debug.Assert(stringEqualityMethod != null && !stringEqualityMethod.HasUseSiteError); 1593Debug.Assert(!isSpanOrReadOnlySpan); 1623Debug.Assert(diag.IsEmptyWithoutResolution); 1666Debug.Assert(spanTLengthMethod != null && !spanTLengthMethod.HasUseSiteError); 1724Debug.Assert(stringEqualityMethodRef != null); 1728Debug.Assert(stringEqualityMethodRef == _module.Translate((MethodSymbol)_module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality), (CSharpSyntaxNode)syntaxNode, assertDiagnostics)); 1762Debug.Assert(sequenceEqualsRef != null); 1763Debug.Assert(asSpanRef != null); 1801Debug.Assert(local.HasConstantValue); 1823Debug.Assert(local.RefKind == RefKind.None); 1824Debug.Assert(local.TypeWithAnnotations.Type.IsPointerType()); 1889Debug.Assert((local.Name == null) == (localKind != SynthesizedLocalKind.UserDefined)); 1906Debug.Assert(ordinal == 0 || localKind != SynthesizedLocalKind.UserDefined);
CodeGen\Optimizer.cs (44)
298Debug.Assert(instance._localDefs == null); 450Debug.Assert(expr.Kind != BoundKind.Label); 520Debug.Assert(_recursionDepth == 1); 525Debug.Assert(_recursionDepth == 1); 541Debug.Assert(result != null || context == ExprContext.None); 567Debug.Assert(node == null || EvalStackIsEmpty()); 614Debug.Assert(EvalStackIsEmpty(), "entering blocks when evaluation stack is not empty?"); 793Debug.Assert(localUsedWalker.IsLocalUsedIn(assignment.Right), "who assigns the temp?"); 868Debug.Assert(_assignmentLocal == null); 928Debug.Assert(_context != ExprContext.AssignmentTarget, "assignment expression cannot be a target of another assignment"); 938Debug.Assert(_context == ExprContext.Value || 972Debug.Assert( 978Debug.Assert(!isIndirectAssignment, "indirect assignment is a read, not a write"); 1039Debug.Assert(!node.IsRef || 1046Debug.Assert(lhs.Type.IsValueType, "'this' is assignable only in structs"); 1066Debug.Assert(((BoundCall)lhs).Method.RefKind == RefKind.Ref, "only ref returning methods are assignable"); 1070Debug.Assert(((BoundFunctionPointerInvocation)lhs).FunctionPointer.Signature.RefKind == RefKind.Ref, "only ref returning function pointers are assignable"); 1074Debug.Assert(((BoundConditionalOperator)lhs).IsRef, "only ref ternaries are assignable"); 1078Debug.Assert(((BoundAssignmentOperator)lhs).IsRef, "only ref assignments are assignable"); 1084Debug.Assert(!IsIndirectAssignment(node.Update(((BoundSequence)node.Left).Value, node.Right, node.IsRef, node.Type)), 1179Debug.Assert(method.IsStatic); 1268Debug.Assert(!arguments.IsDefault); 1269Debug.Assert(!parameters.IsDefault); 1271Debug.Assert(arguments.Length == parameters.Length || arguments.Length == parameters.Length + 1); 1331Debug.Assert(node.InitializerExpressionOpt == null); 1400Debug.Assert(false, "we should not have label expressions at this stage"); 1406Debug.Assert(false, "we should not have is-pattern expressions at this stage"); 1412Debug.Assert(node.CaseExpressionOpt == null, "we should not have label expressions at this stage"); 1431Debug.Assert(EvalStackIsEmpty()); 1538Debug.Assert(!binary.OperatorKind.IsDynamic()); 1552Debug.Assert((object)binary == node); 1573Debug.Assert(!node.OperatorKind.IsDynamic()); 1582Debug.Assert(node.LeftPlaceholder is null); 1583Debug.Assert(node.LeftConversion is null); 1887Debug.Assert(local.RefKind == RefKind.None, "cannot take a ref of a ref"); 1934Debug.Assert(local == empty || locInfo.StackAtDeclaration == StackDepth()); 1955Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.OptimizerTemp); 1960Debug.Assert(local == empty || locInfo.StackAtDeclaration == StackDepth()); 1968Debug.Assert(local.SynthesizedKind != SynthesizedLocalKind.OptimizerTemp); 2023Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.LoweringTemp, "only lowering temps may be sometimes reused"); 2162Debug.Assert(!binary.OperatorKind.IsDynamic()); 2173Debug.Assert((object)binary == node); 2205Debug.Assert(node.InitializerExpressionOpt == null); 2245Debug.Assert(locInfo.LocalDefs.Any((d) => _nodeCounter == d.Start && _nodeCounter <= d.End));
CommandLine\CSharpCommandLineParser.cs (9)
54Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 169Debug.Assert(optionsEnded || !arg.StartsWith("@", StringComparison.Ordinal)); 442Debug.Assert(loweredValue == nameof(NullableContextOptions.Disable).ToLower()); 446Debug.Assert(loweredValue == nameof(NullableContextOptions.Enable).ToLower()); 450Debug.Assert(loweredValue == nameof(NullableContextOptions.Warnings).ToLower()); 454Debug.Assert(loweredValue == nameof(NullableContextOptions.Annotations).ToLower()); 1732Debug.Assert(!IsScriptCommandLineParser); 1774Debug.Assert(IsScriptCommandLineParser); 2081Debug.Assert(!PathUtilities.IsValidFilePath(fullPath));
CommandLine\CSharpCompiler.cs (6)
94Debug.Assert(hadErrors); 103Debug.Assert(normalizedFilePath != null); 104Debug.Assert(sourceFiles[i].IsInputRedirected || PathUtilities.IsAbsolute(normalizedFilePath)); 118Debug.Assert(touchedFilesLogger is object); 196Debug.Assert(fileDiagnostics.Count == 0); 243Debug.Assert(Arguments.CompilationOptions.OutputKind.IsApplication());
Compilation\AttributeSemanticModel.cs (1)
31Debug.Assert(syntax != null);
Compilation\BuiltInOperators.cs (8)
692Debug.Assert(_compilation.IsReadOnlySpanType(readonlySpanOfByte)); 693Debug.Assert(((NamedTypeSymbol)readonlySpanOfByte).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type.SpecialType is SpecialType.System_Byte); 766Debug.Assert(false, "Bad operator kind in left type"); 798Debug.Assert(false, "Bad operator kind in right type"); 829Debug.Assert(false, "Bad operator kind in return type"); 835Debug.Assert(kind.IsLifted()); 886Debug.Assert((object)leftType != null); 897Debug.Assert((object)rightType != null);
Compilation\CSharpCompilation.cs (63)
363Debug.Assert(ReferenceEquals(method.ContainingAssembly, Assembly)); 364Debug.Assert(method.IsDefinition); 365Debug.Assert(method is not Symbols.Metadata.PE.PEMethodSymbol); 493Debug.Assert(!isSubmission || options.ReferencesSupersedeLowerVersions); 530Debug.Assert(compilation._lazyAssemblySymbol is null); 573Debug.Assert(previousSubmission == null || previousSubmission.HostObjectType == hostObjectType); 578Debug.Assert(previousSubmission == null && submissionReturnType == null && hostObjectType == null); 601Debug.Assert(_lazyAssemblySymbol is null); 607Debug.Assert(debugEntryPoint != null); 854Debug.Assert(IsSubmission); 1121Debug.Assert(this.ContainsSyntaxTree(tree)); 1166Debug.Assert(contentHash.Length == InterceptableLocation1.ContentHashLength); 1230Debug.Assert(_lazyAssemblySymbol is object); 1284Debug.Assert(reference.Properties.Kind == MetadataImageKind.Module); 1608Debug.Assert(foundNamespace == !(@namespace is MissingNamespaceSymbol)); 1642Debug.Assert(tree != null); 1643Debug.Assert(!this.IsSubmission || _syntaxAndDeclarations.ExternalSyntaxTrees.Length <= 1); 1700Debug.Assert(this.IsSubmission); 1701Debug.Assert(_syntaxAndDeclarations.ExternalSyntaxTrees.Length <= 1); 1721Debug.Assert(this.IsSubmission); 1762Debug.Assert(result.ExtendedSpecialType == specialType); 1785Debug.Fail($"Unsupported type argument: {typeArgument.ToDisplayString()}"); 1908Debug.Assert(result?.IsErrorType() != true); 1975Debug.Assert(!this.Options.Errors.IsDefaultOrEmpty); 2202Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.Uninitialized)); 2203Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound)); 2298Debug.Assert(result is { Type: not null } || runtimeAwaitCall is { Type: not null }); 2527Debug.Assert(!_declarationDiagnosticsFrozen); 2557Debug.Assert(!_declarationDiagnosticsFrozen); 2558Debug.Assert(!InterceptorsDiscoveryComplete); 2633Debug.Assert(model != null); 2666Debug.Assert(System.Runtime.CompilerServices.Unsafe.AreSame(ref cachedBinderFactories, ref ignoreAccessibility ? ref _ignoreAccessibilityBinderFactories : ref _binderFactories)); 2697Debug.Assert(slot is object); 2739Debug.Assert(diagnostics is { }); 2741Debug.Assert(bag.DiagnosticBag is { }); 2941Debug.Assert(!_declarationDiagnosticsFrozen || true); 3032Debug.Assert(builder.DiagnosticBag is { }); 3140Debug.Assert(!loadDirectives.IsEmpty); 3215Debug.Assert(this.ContainsSyntaxTree(tree)); 3227Debug.Assert(bindingDiagnostics.DiagnosticBag is { }); 3253Debug.Assert(reportUnusedUsings); 3272Debug.Assert(reportUnusedUsings); 3275Debug.Assert(discarded.DiagnosticBag is object); 3319Debug.Assert(methodBodyDiagnostics.Diagnostics.SequenceEqual(diagnostics)); 3462Debug.Assert(!_lazyClsComplianceDependencies.IsDefault); 3463Debug.Assert(!_lazyClsComplianceDiagnostics.IsDefault); 3583Debug.Assert(!IsSubmission || HasCodeToEmit() || 3719Debug.Assert(methodBodyDiagnosticBag.DiagnosticBag is { }); 3720Debug.Assert(moduleBeingBuilt is object); 3733Debug.Assert(filterOpt == null || moduleBeingBuilt.IsEncDelta); 3819Debug.Assert(symbol.ContainingSymbol.Kind == SymbolKind.Namespace); // avoid unnecessary traversal of nested types 3851Debug.Assert(interceptionsOfAGivenLocation.Count != 0); 3869Debug.Assert(_declarationDiagnosticsFrozen); 3924Debug.Assert(xmlDiagnostics.DiagnosticBag is { }); 4447Debug.Assert(csharpReturnType is not null); 4448Debug.Assert(csharpLeftType is not null); 4449Debug.Assert(csharpRightType is not null); 4671Debug.Assert(csharpReturnType is not null); 4672Debug.Assert(csharpOperandType is not null); 4755Debug.Assert(loc1.IsInSource); 4756Debug.Assert(loc2.IsInSource); 4923Debug.Assert(symbol.IsDefinition); 4980Debug.Assert(LanguageVersion == LanguageVersion.MapSpecifiedToEffectiveVersion());
Compilation\CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs (6)
57Debug.Assert(directiveDiagnostics.DiagnosticBag is object); 58Debug.Assert(directiveDiagnostics.DependenciesBag is object); 107Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports)); 133Debug.Assert(diagnostics.DiagnosticBag is object); 134Debug.Assert(diagnostics.DependenciesBag is object); 146Debug.Assert(@using.UsingDirective is null);
Compilation\CSharpDiagnosticFilter.cs (5)
153Debug.Assert(location.SourceTree is null || location.SourceTree is CSharpSyntaxTree); 325Debug.Assert(isEnabledByDefault); 326Debug.Assert(!specifiedWarnAsErrorMinus); 334Debug.Assert(report == ReportDiagnostic.Default); 335Debug.Assert(generalDiagnosticOption == ReportDiagnostic.Error);
Compilation\CSharpScriptCompilationInfo.cs (1)
17Debug.Assert(previousCompilationOpt == null || previousCompilationOpt.HostObjectType == globalsType);
Compilation\CSharpSemanticModel.cs (73)
62Debug.Assert(node != null); 206Debug.Assert(expression != null); 255Debug.Assert(binder != null); 256Debug.Assert(binder.IsSemanticModelBinder); 257Debug.Assert(expression != null); 258Debug.Assert(bindingOption != SpeculativeBindingOption.BindAsTypeOrNamespace || expression is TypeSyntax); 267Debug.Assert(bindingOption == SpeculativeBindingOption.BindAsExpression); 739Debug.Assert(boundNode == null || crefSymbols.IsDefault); 765Debug.Assert(CanGetSemanticInfo(attribute, isSpeculative: true)); 793Debug.Assert(CanGetSemanticInfo(constructorInitializer, isSpeculative: true)); 865Debug.Assert(CanGetSemanticInfo(constructorInitializer, isSpeculative: true)); 926Debug.Assert(CanGetSemanticInfo(cref, isSpeculative: true)); 1069Debug.Assert(boundNode == null || crefSymbols.IsDefault); 1216Debug.Assert(boundNode == null || crefSymbols.IsDefault); 1236Debug.Assert(result == null || result.IsSemanticModelBinder); 1328Debug.Assert(IsInTree(node)); 1346Debug.Assert(position == fullSpan.Start); 1354Debug.Assert(node.Width == 0); 1373Debug.Assert(position == CheckAndAdjustPosition(position), "Expected adjusted position"); 1581Debug.Assert((options & LookupOptions.UseBaseReferenceAccessibility) == 0, "Use the useBaseReferenceAccessibility parameter."); 1586Debug.Assert(!options.IsAttributeTypeLookup()); // Not exposed publicly. 1606Debug.Assert((object)container == null); 1677Debug.Assert((options & LookupOptions.NamespacesOrTypesOnly) == 0); 1678Debug.Assert((options & LookupOptions.NamespaceAliasesOnly) == 0); 1679Debug.Assert((options & LookupOptions.LabelsOnly) == 0); 1696Debug.Assert(symbol.IsExtensionBlockMember()); 1755Debug.Assert(results != null); 1758Debug.Assert((options & LookupOptions.AllMethodsOnArityZero) == 0); 2323Debug.Assert((object)symbol != null); 2361Debug.Assert((object)symbol != null); 3314Debug.Assert(catchClause.Kind() == SyntaxKind.CatchClause); 3438Debug.Assert(boundNode is not BoundTypeOrValueExpression, "The Binder is expected to resolve the member access in the most appropriate way, even in an error scenario."); 3495Debug.Assert((object)indexerAccess.Indexer != null); 3544Debug.Assert((object)symbol != null); 3595Debug.Assert(conditional.ExpressionSymbol is null); 3601Debug.Assert(boundNodeForSyntacticParent == null); 3613Debug.Assert(resultKind != LookupResultKind.Viable); 3647Debug.Assert(dynamicInvocation.ExpressionSymbol is null); 3655Debug.Assert(collectionInit.ExpressionSymbol is null); 3663Debug.Assert(dynamicIndexer.ExpressionSymbol is null); 3670Debug.Assert((object)boundNode.ExpressionSymbol == null); 3686Debug.Assert(boundObjectCreation.ConstructorsGroup.Contains(boundObjectCreation.Constructor)); 3832Debug.Assert((object)unaryOperator.MethodOpt == null && unaryOperator.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3855Debug.Assert((object)increment.MethodOpt == null && increment.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3880Debug.Assert((object)binaryOperator.BinaryOperatorMethod == null && binaryOperator.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3919Debug.Assert(returnType.IsDynamic()); 3923Debug.Assert(rightType.IsDynamic()); 3928Debug.Assert(leftType.IsDynamic()); 3953Debug.Assert((object)compoundAssignment.Operator.Method == null && compoundAssignment.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 4012Debug.Assert(resultKind != LookupResultKind.Viable || 4047Debug.Assert(lowestBoundNode != null); 4048Debug.Assert(binderOpt != null || IsInTree(lowestBoundNode.Syntax)); 4052Debug.Assert(lowestBoundNode.Syntax != null); 4073Debug.Assert(resultKind != LookupResultKind.Viable); 4084Debug.Assert(candidateConstructors.Contains(constructorOpt)); 4090Debug.Assert(resultKind != LookupResultKind.Viable); 4108Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax)); 4139Debug.Assert(symbol.IsIndexer(), "Only indexers can have name " + WellKnownMemberNames.Indexer); 4265Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax)); 4417Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax)); 4500Debug.Assert(SyntaxFacts.IsNamedArgumentName(identifierNameSyntax)); 4600Debug.Assert(nonHiddenMethods.Any()); // Something must be hiding, so can't all be hidden. 4636Debug.Assert(receiver != null); 4750Debug.Assert(members.Count > 0); 4757Debug.Assert((members.Count == 0) == (resultKind == LookupResultKind.Empty)); 4758Debug.Assert(members.Count == filteredMembers.Count); 4769Debug.Assert(!methods.IsDefault); 4783Debug.Assert((object)receiverType != null); 4804Debug.Assert((object)method != null); 4808Debug.Assert(call.Arguments.Length > 0); 4821Debug.Assert((object)method != null); 4956Debug.Assert(((options & SymbolInfoOptions.PreferConstructorsToType) != 0) != 4958Debug.Assert(((options & SymbolInfoOptions.ResolveAliases) != 0) !=
Compilation\InitializerSemanticModel.cs (7)
33Debug.Assert(!(syntax is ConstructorInitializerSyntax || syntax is PrimaryConstructorBaseTypeSyntax)); 41Debug.Assert(containingSemanticModel != null); 42Debug.Assert(syntax.IsKind(SyntaxKind.VariableDeclarator) || syntax.IsKind(SyntaxKind.EnumMemberDeclaration)); 51Debug.Assert(containingSemanticModel != null); 52Debug.Assert(syntax.IsKind(SyntaxKind.PropertyDeclaration)); 61Debug.Assert(containingSemanticModel != null); 279Debug.Assert(MemberSymbol.ContainingType is SourceMemberContainerTypeSymbol);
Compilation\LexicalOrderSymbolComparer.cs (2)
36Debug.Assert((object)x.DeclaringCompilation == y.DeclaringCompilation); 51Debug.Assert(comparison != 0);
Compilation\MemberSemanticModel.cs (58)
53Debug.Assert(root != null); 54Debug.Assert((object)memberSymbol != null); 55Debug.Assert(containingPublicSemanticModel.IsSpeculativeSemanticModel == (containingPublicSemanticModel is SpeculativeSemanticModelWithMemberModel)); 149Debug.Assert(false); 159Debug.Assert(_lazySnapshotManager is object || this is AttributeSemanticModel || !IsNullableAnalysisEnabled()); 166Debug.Assert(_lazyRemappedSymbols is object || this is AttributeSemanticModel || !IsNullableAnalysisEnabled()); 228Debug.Assert(root.Contains(node)); 237Debug.Assert(current != null); // Why were we asked for an enclosing binder for a node outside our root? 254Debug.Assert(ownerOfTypeParametersInScope == null); 282Debug.Assert(binder != null); 364Debug.Assert(!current.CanHaveAssociatedLocalBinder()); 374Debug.Assert(binder != null); 402Debug.Assert(binder != null); 412Debug.Assert(binder != null); 418Debug.Assert(binder != null); 429Debug.Assert(binder != null); 537Debug.Assert(node == GetBindableSyntaxNode(node)); 559Debug.Assert(node == GetBindableSyntaxNode(node)); 840Debug.Assert(parameter != null); 875Debug.Assert(parameter != null); 876Debug.Assert(lambda != null && lambda.IsAnonymousFunction()); 893Debug.Assert(this.GetMemberModel(lambda) == null, "Did not find a unique LambdaSymbol for lambda in member."); 992Debug.Assert(enumeratorInfoOpt != null || boundForEach.HasAnyErrors); 1052Debug.Assert(boundConversion != null); 1070Debug.Assert(boundDeconstruction != null || boundForEach.HasAnyErrors); 1140Debug.Assert(index >= 0); 1141Debug.Assert(index < anonymousObjectCreation.Initializers.Count); 1234Debug.Assert(highestBoundNode != null); 1246Debug.Assert(highestBoundNode.Kind != BoundKind.UnboundLambda); 1263Debug.Assert(IsInTree(node), "Since the node is in the tree, we can always recompute the binder later"); 1286Debug.Assert(IsInTree(node), "Since the node is in the tree, we can always recompute the binder later"); 1298Debug.Assert(IsInTree(node), "Since the node is in the tree, we can always recompute the binder later"); 1416Debug.Assert(node != null); 1424Debug.Assert(current != null, "Why are we being asked to find an enclosing lambda outside of our root?"); 1480Debug.Assert(_nodeMapLock.IsWriteLockHeld || _nodeMapLock.IsReadLockHeld); 1498Debug.Assert(_nodeMapLock.IsWriteLockHeld); 1512Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax)); 1529Debug.Assert(_nodeMapLock.IsWriteLockHeld); 1548Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax)); 1556Debug.Assert((manager is null && (!IsNullableAnalysisEnabled() || syntax != Root || syntax is TypeSyntax || 1574Debug.Assert(node != null); 1580Debug.Assert(current != null, "How did we get outside the root?"); 1709Debug.Assert(bindingRoot.Contains(enclosingLambdaOrQuery)); 1751Debug.Assert(lambdaOrQuery != nodeToBind); 1786Debug.Assert(boundInnerLambdaOrQuery != null); 1804Debug.Assert(result != null); 1945Debug.Assert(containingLambda.IsAnonymousFunction()); 1946Debug.Assert(LookupPosition.IsInAnonymousFunctionOrQuery(position, containingLambda)); 1997Debug.Assert(!isNullableAnalysisEnabled || 2043Debug.Assert(Compilation.IsNullableAnalysisEnabledAlways); 2071Debug.Assert(binder is SimpleProgramBinder); 2121Debug.Assert(node == GetBindableSyntaxNode(node)); 2286Debug.Assert(parent.Kind() == SyntaxKind.VariableDeclaration); 2365Debug.Assert(bindableParent != null); 2393Debug.Assert(symbol is LocalSymbol or ParameterSymbol or MethodSymbol { MethodKind: MethodKind.LambdaMethod }); 2462Debug.Assert(!(binder is IncrementalBinder)); 2519Debug.Assert(!block.WasCompilerGenerated); 2583Debug.Assert(alternative is BoundIfStatement);
Compilation\MemberSemanticModel.NodeMapBuilder.cs (7)
41Debug.Assert(node == null || root == null || !(root.Syntax is StatementSyntax), "individually added nodes are not supposed to be statements."); 80Debug.Assert(existing.Count == nodesToAdd.Count, "existing.Count == nodesToAdd.Length"); 90Debug.Assert(!(key is StatementSyntax), "!(key is StatementSyntax)"); 95Debug.Assert( 103Debug.Assert( 111Debug.Assert(false, "New bound node does not match existing bound node"); 116Debug.Assert(
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (2)
34Debug.Assert(containingPublicSemanticModel is not null); 51Debug.Assert(boundRoot.Syntax is TypeSyntax);
Compilation\MethodBodySemanticModel.cs (8)
51Debug.Assert((object)owner != null); 52Debug.Assert(owner.Kind == SymbolKind.Method); 53Debug.Assert(syntax != null); 54Debug.Assert(parentRemappedSymbolsOpt is null || IsSpeculativeSemanticModel); 55Debug.Assert((syntax.Kind() == SyntaxKind.CompilationUnit) == (!IsSpeculativeSemanticModel && owner is SynthesizedSimpleProgramEntryPointSymbol)); 63Debug.Assert(containingSemanticModel != null); 185Debug.Assert(binder != null); 262Debug.Assert(typeDecl.Kind() is (SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration));
Compilation\SpeculativeSemanticModelWithMemberModel.cs (10)
33Debug.Assert(parentSemanticModel is not null); 51Debug.Assert(syntax != null); 52Debug.Assert(rootBinder != null); 53Debug.Assert(rootBinder.IsSemanticModelBinder); 80Debug.Assert(syntax != null); 81Debug.Assert(rootBinder != null); 82Debug.Assert(rootBinder.IsSemanticModelBinder); 110Debug.Assert(syntax != null); 111Debug.Assert(rootBinder != null); 112Debug.Assert(rootBinder.IsSemanticModelBinder);
Compilation\SpeculativeSyntaxTreeSemanticModel.cs (5)
39Debug.Assert(parentSemanticModel is SyntaxTreeSemanticModel); 40Debug.Assert(root != null); 41Debug.Assert(root is TypeSyntax || root is CrefSyntax); 42Debug.Assert(rootBinder != null); 43Debug.Assert(rootBinder.IsSemanticModelBinder);
Compilation\SymbolInfoFactory.cs (1)
40Debug.Assert(symbols.Count == 1);
Compilation\SyntaxAndDeclarationManager.cs (15)
211Debug.Assert(!directive.IsActive || tree.GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error)); 274Debug.Assert(diagnostics.IsEmptyWithoutResolution); 395Debug.Assert(!oldLoadDirectives.IsEmpty); 418Debug.Assert(!loadDirectives.IsEmpty); 448Debug.Assert(!nestedLoadDirectives.IsEmpty); 518Debug.Assert(!loadDirectiveMapBuilder.ContainsKey(oldTree)); 519Debug.Assert(!loadDirectiveMapBuilder.ContainsKey(newTree)); 562Debug.Assert(newTrees.Length == ordinalMap.Count); 572Debug.Assert(!oldLoadDirectives.IsDefault); 573Debug.Assert(!oldLoadDirectives.IsEmpty); 574Debug.Assert(oldLoadDirectives.Length == newLoadDirectivesSyntax.Count); 578Debug.Assert(ordinalMap.ContainsKey(oldTree)); // Checked by RemoveSyntaxTreeFromDeclarationMapAndTable 687Debug.Assert(!loadDirectives.IsEmpty); 691Debug.Assert((resolvedPath != null) || !directive.Diagnostics.IsEmpty); 736Debug.Assert(directive.Diagnostics.HasAnyErrors());
Compilation\SyntaxAndDeclarationManager.LazyState.cs (2)
55Debug.Assert(syntaxTrees.All(tree => syntaxTrees[syntaxTreeOrdinalMap[tree]] == tree)); 56Debug.Assert(syntaxTrees.SetEquals(rootNamespaces.Keys.AsImmutable(), EqualityComparer<SyntaxTree>.Default));
Compilation\SyntaxTreeSemanticModel.cs (37)
259Debug.Assert(symbols.All(s => s.Kind == SymbolKind.TypeParameter || s.Kind == SymbolKind.Parameter)); 332Debug.Assert(this.GetMemberModel(node) == null); 768Debug.Assert(speculativeSyntax.SyntaxTree != SyntaxTree); 1215Debug.Assert((object)scriptInitializer != null); 1323Debug.Assert(declarationSyntax != null); 1335Debug.Assert((object)container != null); 1339Debug.Assert((object)symbol != null); 1343Debug.Assert((object)symbol != null); 1379Debug.Assert(declarationSyntax != null); 1392Debug.Assert(extensionDeclaration != null); 1395Debug.Assert(container is not null); 1414Debug.Assert(declarationSyntax != null); 1422Debug.Assert(declarationSyntax != null); 1425Debug.Assert((object)container != null); 1615Debug.Assert((object)container != null); 1616Debug.Assert(declarationSyntax.Keyword.Kind() != SyntaxKind.IdentifierToken); 1636Debug.Assert((object)container != null); 1759Debug.Assert((object)left != null); 1794Debug.Assert(name is not null, "Should only be looking for a known namespace by name."); 1795Debug.Assert(namespaces is [NamespaceSymbol], "Namespace declarations of the same name are expected to appear as a single merged symbol."); 1799Debug.Assert(knownNamespace.HasLocationContainedWithin(SyntaxTree, declarationSpan, out _), "Namespace symbols should include all syntax declaration locations."); 1863Debug.Assert((object)container != null); 1866Debug.Assert((object)result != null); 2032Debug.Assert(parameter != null); 2063Debug.Assert(parameter != null); 2100Debug.Assert(parameter != null); 2127Debug.Assert(parameter != null); 2380Debug.Assert((object)container != null); 2452Debug.Assert(symbol is LocalSymbol or ParameterSymbol or MethodSymbol { MethodKind: MethodKind.LambdaMethod }); 2479Debug.Assert(((INamespaceSymbol)declaredSymbol).IsGlobalNamespace); 2484Debug.Assert((object)declaredSymbol.GetSymbol() == (object)entryPoint); 2489Debug.Assert((object)declaredSymbol.GetSymbol() == (object)entryPoint.ContainingSymbol); 2504Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor); 2525Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor.ContainingSymbol); 2540Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor); 2553Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor.ContainingSymbol); 2574Debug.Assert(declaredSymbol.GetSymbol() is SynthesizedRecordPropertySymbol);
Compiler\AnonymousTypeMethodBodySynthesizer.cs (4)
38Debug.Assert(ContainingType.BaseTypeNoUseSiteDiagnostics.SpecialType == SpecialType.System_Object); 50Debug.Assert(anonymousType.Properties.Length == paramCount); 126Debug.Assert(c.IsImplicit); 127Debug.Assert(c.IsReference);
Compiler\ClsComplianceChecker.cs (40)
44Debug.Assert(diagnostics.DependenciesBag is null || diagnostics.DependenciesBag is ConcurrentSet<AssemblySymbol>); 93System.Diagnostics.Debug.Assert(symbol is SourceAssemblySymbol); 122System.Diagnostics.Debug.Assert(warningLocation != null || !moduleDeclaredCompliance.HasValue || (i == 0 && _filterTree != null), 243Debug.Assert(!symbol.IsImplicitClass); 279System.Diagnostics.Debug.Assert(IsAccessibleOutsideAssembly(constructor), "Should be implied by IsAccessibleIfContainerIsAccessible"); 424System.Diagnostics.Debug.Assert( 430System.Diagnostics.Debug.Assert(!symbol.IsAccessor()); 499System.Diagnostics.Debug.Assert(!IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on non-compliant symbols"); 514System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols"); 532System.Diagnostics.Debug.Assert((object)baseType != null || symbol.SpecialType == SpecialType.System_Object || symbol.IsExtension, "Only object or extension has no base."); 543System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols"); 546System.Diagnostics.Debug.Assert((object)containingType == null || !containingType.IsImplicitClass); 555System.Diagnostics.Debug.Assert(typeParameters.IsEmpty || IsTrue(GetDeclaredOrInheritedCompliance(context)), "Only call on compliant symbols"); 574System.Diagnostics.Debug.Assert(parameters.IsEmpty || IsTrue(GetDeclaredOrInheritedCompliance(context)), "Only call on compliant symbols"); 587System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols"); 665System.Diagnostics.Debug.Assert(syntaxRef.SyntaxTree.HasCompilationUnitRoot); 713System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols"); 738System.Diagnostics.Debug.Assert(method.ContainingType.TypeKind == TypeKind.Delegate); 743System.Diagnostics.Debug.Assert(!method.IsAccessor()); 804System.Diagnostics.Debug.Assert(IsAccessibleOutsideAssembly(symbol)); 805System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol))); 886Debug.Assert(sameNameSymbols.Count > 0); 887Debug.Assert(symbol.Name == symbolName); 929System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol))); 930System.Diagnostics.Debug.Assert(IsAccessibleOutsideAssembly(symbol)); 952System.Diagnostics.Debug.Assert(name.Length == 0 || name[0] != '\uFF3F'); 1116System.Diagnostics.Debug.Assert(symbol.Kind == SymbolKind.NamedType || !((symbol is TypeSymbol)), 1136Debug.Assert(symbol.Kind != SymbolKind.Alias); 1137Debug.Assert(symbol.Kind != SymbolKind.Label); 1138Debug.Assert(symbol.Kind != SymbolKind.Namespace); 1139Debug.Assert(symbol.Kind != SymbolKind.Parameter); 1140Debug.Assert(symbol.Kind != SymbolKind.RangeVariable); 1172System.Diagnostics.Debug.Assert(symbol.Kind != SymbolKind.Assembly); 1175System.Diagnostics.Debug.Assert((object)containing != null); 1209System.Diagnostics.Debug.Assert(args.Length == 1, "We already checked the signature and HasErrors."); 1246System.Diagnostics.Debug.Assert(symbol.Kind == SymbolKind.ErrorType); 1318System.Diagnostics.Debug.Assert((object)x != null); 1319System.Diagnostics.Debug.Assert((object)y != null); 1320System.Diagnostics.Debug.Assert((object)x != (object)y); 1321System.Diagnostics.Debug.Assert(x.Kind == y.Kind);
Compiler\DocumentationCommentCompiler.cs (34)
105Debug.Assert(compiler._indentDepth == 0); 140Debug.Assert( 148Debug.Assert(compilation != null); 164Debug.Assert(compiler._indentDepth == 0); 179Debug.Assert(_assemblyName != null); 198Debug.Assert(!_isForSingleSymbol); 265Debug.Assert(!_isForSingleSymbol); 299Debug.Assert(firstExtension is not null); 308Debug.Assert(extension.IsExtension); 315Debug.Assert(firstExtension.GetEscapedDocumentationCommentId() == extension.GetEscapedDocumentationCommentId()); 484Debug.Assert(paramTags.Count > 0); 588Debug.Assert(location.SourceTree!.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol. 609Debug.Assert(location.SourceTree!.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol. 637Debug.Assert(!docCommentNodes.IsDefaultOrEmpty); 796Debug.Assert((object)symbol != null); 918Debug.Assert(numLines > 0); 923Debug.Assert(numLines > 0); 957Debug.Assert(start >= 0); 958Debug.Assert(start <= str.Length); 959Debug.Assert(end >= 0); 960Debug.Assert(end <= str.Length); 961Debug.Assert(end >= start); 1084Debug.Assert(numLines > 0); 1104Debug.Assert(pattern.StartsWith(currentLinePattern, StringComparison.Ordinal)); 1226Debug.Assert((object)symbol != null); 1237Debug.Assert(!ns.IsGlobalNamespace); 1332Debug.Assert(referencedSymbol.Kind == SymbolKind.Parameter); 1333Debug.Assert(documentedParameters != null); 1346Debug.Assert(referencedSymbol.Kind == SymbolKind.TypeParameter); 1347Debug.Assert(documentedTypeParameters != null); 1396Debug.Assert(_indentDepth >= 0); 1454Debug.Assert(depth >= 0); 1470Debug.Assert(false, "Didn't expect nesting to reach depth " + depth); 1505Debug.Assert(false, "If we hit this, then we might need to think about a different workaround " +
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (18)
104Debug.Assert(sourceIncludeElementNodes.All(syntax => syntax.SyntaxTree.Options.DocumentationMode < DocumentationMode.Diagnose), 135Debug.Assert(expander._nextSourceIncludeElementIndex == expander._sourceIncludeElementNodes.Length); 149Debug.Assert(nodes != null); 165Debug.Assert(builder == null || builder.All(node => node.Parent == null)); 193Debug.Assert(commentMessage == null, "How did we get an error comment for a non-container?"); 269Debug.Assert(originatingSyntax != null); 351Debug.Assert(doc != null); 458Debug.Assert(_inProgressIncludeElementNodes != null); 460Debug.Assert(result); 476Debug.Assert(_nextSourceIncludeElementIndex < _sourceIncludeElementNodes.Length); 477Debug.Assert(originatingSyntax == null); 490Debug.Assert(location != null); 513Debug.Assert(memberDeclSyntax != null, 535Debug.Assert(memberDeclSyntax != null, 553Debug.Assert((object)containingSymbol != null); 622Debug.Assert(leadingTrivia.Count == 1); 625Debug.Assert(structure.Content.Count == 2); 627Debug.Assert(elementSyntax.Attributes.Count == 1);
Compiler\MethodBodySynthesizer.cs (14)
37Debug.Assert((object)constructor.ContainingType.BaseTypeNoUseSiteDiagnostics == null || constructor.ContainingType.BaseTypeNoUseSiteDiagnostics.SpecialType == SpecialType.System_Object); 90Debug.Assert(submissionConstructor.ParameterCount == 1); 99Debug.Assert(slotIndex >= 0); 145Debug.Assert(targetSubmissionIndex >= 0); 178Debug.Assert(accessor.MethodKind == MethodKind.PropertyGet || accessor.MethodKind == MethodKind.PropertySet); 199Debug.Assert(accessor.MethodKind == MethodKind.PropertySet); 219Debug.Assert(eventSymbol.HasAssociatedField); 239Debug.Assert((object)accessor != null); 242Debug.Assert((object)field != null); 245Debug.Assert(fieldType.Name == "EventRegistrationTokenTable"); 255Debug.Assert(diagnostics.DiagnosticBag is null || diagnostics.HasAnyErrors()); 273Debug.Assert(diagnostics.DiagnosticBag is null || diagnostics.HasAnyErrors()); 534Debug.Assert(method.MethodKind == MethodKind.Destructor); 535Debug.Assert(syntax.Kind() == SyntaxKind.Block || syntax.Kind() == SyntaxKind.ArrowExpressionClause);
Compiler\MethodBodySynthesizer.Lowered.cs (3)
328Debug.Assert(this.Arity == methodBeingWrapped.Arity); 361Debug.Assert(system_Int32.SpecialType == SpecialType.System_Int32); 404Debug.Assert(fields.Count > 0);
Compiler\MethodCompiler.cs (72)
90Debug.Assert(compilation != null); 91Debug.Assert(diagnostics != null); 92Debug.Assert(diagnostics.DiagnosticBag != null); 93Debug.Assert(diagnostics.DependenciesBag == null || diagnostics.DependenciesBag is ConcurrentSet<AssemblySymbol>); 119Debug.Assert(compilation != null); 120Debug.Assert(diagnostics != null); 121Debug.Assert(diagnostics.DiagnosticBag != null); 228Debug.Assert(diagnostics.DiagnosticBag != null); 232Debug.Assert(!entryPointAndDiagnostics.Diagnostics.Diagnostics.IsDefault); 295Debug.Assert(lazyVariableSlotAllocator is null); 296Debug.Assert(stateMachineTypeOpt is null); 297Debug.Assert(codeCoverageSpans.IsEmpty); 298Debug.Assert(lambdaDebugInfoBuilder.IsEmpty); 299Debug.Assert(lambdaRuntimeRudeEditsBuilder.IsEmpty); 300Debug.Assert(closureDebugInfoBuilder.IsEmpty); 301Debug.Assert(stateMachineStateDebugInfoBuilder.IsEmpty); 363Debug.Assert(_moduleBeingBuiltOpt != null); 476Debug.Assert((object)scriptCtor != null); 477Debug.Assert((object)scriptInitializer != null); 530Debug.Assert(scriptCtorOrdinal == -1); 531Debug.Assert((object)scriptCtor == method); 603Debug.Assert(containingType.IsScriptClass == (scriptCtorOrdinal >= 0)); 622Debug.Assert(processedStaticInitializers.BoundInitializers.All((init) => 662Debug.Assert(scriptCtorOrdinal >= 0); 692Debug.Assert(_moduleBeingBuiltOpt != null); 701Debug.Assert(method.SynthesizesLoweredBoundBody); 712Debug.Assert(diagnostics.DiagnosticBag != null); 735Debug.Assert(_moduleBeingBuiltOpt != null); 736Debug.Assert(compilationState.ModuleBuilderOpt == _moduleBeingBuiltOpt); 793Debug.Assert((object)iteratorStateMachine == null || (object)asyncStateMachine == null); 841Debug.Assert(emittedBody is null); 870Debug.Assert(synthesizedExplicitImpl.SynthesizesLoweredBoundBody); 880Debug.Assert(!discardedDiagnostics.HasAnyErrors()); 896Debug.Assert(synthesizedAccessor.SynthesizesLoweredBoundBody); 899Debug.Assert(!discardedDiagnostics.HasAnyErrors()); 941Debug.Assert(!methodSymbol.SynthesizesLoweredBoundBody); 1012Debug.Assert(methodSymbol.IsImplicitlyDeclared); 1017Debug.Assert(methodSymbol.IsImplicitlyDeclared); 1072Debug.Assert(!prependedDefaultValueTypeConstructorInitializer || originalBodyNested); 1073Debug.Assert(!prependedDefaultValueTypeConstructorInitializer || methodSymbol.ContainingType.IsStructType()); 1131Debug.Assert(importChain == null); 1135Debug.Assert(processedInitializers.BoundInitializers.IsDefaultOrEmpty || processedInitializers.FirstImportChain != null); 1184Debug.Assert(rootSyntax == forSemanticModel.Syntax); 1246Debug.Assert(loweredBodyOpt != null); 1260Debug.Assert(!(methodSymbol.IsImplicitInstanceConstructor && methodSymbol.ParameterCount == 0) || 1303Debug.Assert(!instrumentation.Kinds.Contains(InstrumentationKind.TestCoverage)); 1323Debug.Assert(initializerCodeCoverageSpans.IsEmpty); 1328Debug.Assert(initializerStateMachineTypeOpt is null); 1329Debug.Assert(!hasErrors); 1423Debug.Assert(_diagnostics.DiagnosticBag != null); 1424Debug.Assert(_moduleBeingBuiltOpt != null); 1499Debug.Assert(compilationState.ModuleBuilderOpt != null); 1618Debug.Assert(iteratorStateMachine is null || asyncStateMachine is null); 1655Debug.Assert(!diagnostics.HasAnyErrors(), "Running code generator when errors exist might be dangerous; code generator not expecting errors"); 1662Debug.Assert(diagnosticsForThisMethod.DiagnosticBag != null); 1685Debug.Assert(kickoffMethod != null); 1757Debug.Assert(method.IsAsync || method.IsIterator); 1759Debug.Assert(!diagnostics.HasAnyErrors()); 1827Debug.Assert(index >= 0); 1838Debug.Assert(index >= 0 && field.SlotDebugInfo.SynthesizedKind.IsLongLived()); 1925Debug.Assert(!sourceMethod.IsDefaultValueTypeConstructor()); 1961Debug.Assert(diagnostics.DiagnosticBag != null); 1997Debug.Assert(IsEmptyRewritePossible(methodBody)); 1998Debug.Assert(WasPropertyBackingFieldAccessChecked.FindUncheckedAccess(methodBody) is null); 2028Debug.Assert(constructor.Initializer is null); 2029Debug.Assert(constructor.Locals.IsEmpty); 2030Debug.Assert(BindImplicitConstructorInitializerIfAny(method, compilationState, BindingDiagnosticBag.Discarded) is null); 2038Debug.Assert(body != null); 2078Debug.Assert(diagnostics.AccumulatesDiagnostics); 2328Debug.Assert(false); 2497Debug.Assert(!method.ContainingType.IsDelegateType()); 2511Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer.");
Compiler\SynthesizedMetadataCompiler.cs (2)
31Debug.Assert(moduleBeingBuilt != null); 46Debug.Assert(moduleBeingBuilt != null);
Compiler\TypeCompilationState.cs (2)
98Debug.Assert(_typeOpt is { }); 125Debug.Assert(_synthesizedMethods == null);
Declarations\DeclarationTable.cs (1)
76Debug.Assert(compilation.Declarations == this);
Declarations\DeclarationTreeBuilder.cs (6)
130Debug.Assert( 243Debug.Assert(nameLocation.SourceTree is not null); 268Debug.Assert(_syntaxTree.Options.Kind != SourceCodeKind.Regular); 328Debug.Assert(parent.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind != SourceCodeKind.Regular); 560Debug.Assert(node.Parent is CompilationUnitSyntax); 570Debug.Assert(node is NamespaceDeclarationSyntax);
Declarations\MergedNamespaceDeclaration.cs (2)
182Debug.Assert(namespaces.Count > 0); 209Debug.Assert(namespaces.Count > 0);
Declarations\RootSingleNamespaceDeclaration.cs (1)
43Debug.Assert(!referenceDirectives.IsDefault);
Declarations\SingleTypeDeclaration.cs (1)
91Debug.Assert(kind != DeclarationKind.Namespace);
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (2)
159Debug.Assert(containingSymbol is NamedTypeSymbol); 243Debug.Assert(_inParameterOrReturnType);
Emitter\EditAndContinue\CSharpDefinitionMap.cs (4)
62Debug.Assert(stateMachineType.ContainingAssembly is PEAssemblySymbol); 123Debug.Assert(!handle.IsNil); 127Debug.Assert(result.Length == localInfos.Length); 217Debug.Assert(name.Length >= closeBracketOffset + 1);
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (44)
66Debug.Assert( 155Debug.Assert((object)symbol.ContainingAssembly != (object)_otherAssembly); 190Debug.Assert(symbol.IsDefinition); 275Debug.Assert(@namespace.IsGlobalNamespace); 333Debug.Assert(sourceType.IsDefinition); 348Debug.Assert((object)otherContainer == (object)_otherAssembly.GlobalNamespace); 354Debug.Assert((object)otherContainer == (object)_otherAssembly.GlobalNamespace); 495Debug.Assert(delegateTemplate.DelegateInvokeMethod != null); 509Debug.Assert(otherDelegateType is not null); 523Debug.Assert(type.Arity == otherType.Arity); 563Debug.Assert(!string.IsNullOrEmpty(sourceMember.MetadataName)); 583Debug.Assert(type.ElementTypeWithAnnotations.CustomModifiers.IsEmpty); 584Debug.Assert(other.ElementTypeWithAnnotations.CustomModifiers.IsEmpty); 592Debug.Assert(StringOrdinalComparer.Equals(@event.Name, other.Name)); 601Debug.Assert(StringOrdinalComparer.Equals(field.Name, other.Name)); 607Debug.Assert(StringOrdinalComparer.Equals(method.Name, other.Name)); 609Debug.Assert(method.IsDefinition); 610Debug.Assert(other.IsDefinition); 623Debug.Assert(method.IsDefinition); 637Debug.Assert(StringOrdinalComparer.Equals(type.MetadataName, other.MetadataName)); 640Debug.Assert(type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.All(t => t.CustomModifiers.IsEmpty)); 641Debug.Assert(other.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.All(t => t.CustomModifiers.IsEmpty)); 648Debug.Assert(type.IsDefinition); 662Debug.Assert(StringOrdinalComparer.Equals(@namespace.MetadataName, other.MetadataName)); 668Debug.Assert(parameter.Ordinal == other.Ordinal); 678Debug.Assert(type.PointedAtTypeWithAnnotations.CustomModifiers.IsEmpty); 679Debug.Assert(other.PointedAtTypeWithAnnotations.CustomModifiers.IsEmpty); 710Debug.Assert(type.CustomModifiers.IsEmpty); 711Debug.Assert(verifyRefModifiers(refCustomModifiers, refKind, allowOut)); 715Debug.Assert(RefKind.RefReadOnly == RefKind.In); 729Debug.Assert(StringOrdinalComparer.Equals(property.MetadataName, other.MetadataName)); 740Debug.Assert(type.Ordinal == other.Ordinal); 741Debug.Assert(StringOrdinalComparer.Equals(type.Name, other.Name)); 745Debug.Assert(type.HasConstructorConstraint == other.HasConstructorConstraint); 746Debug.Assert(type.HasValueTypeConstraint == other.HasValueTypeConstraint); 747Debug.Assert(type.AllowsRefLikeType == other.AllowsRefLikeType); 748Debug.Assert(type.HasUnmanagedTypeConstraint == other.HasUnmanagedTypeConstraint); 749Debug.Assert(type.HasReferenceTypeConstraint == other.HasReferenceTypeConstraint); 750Debug.Assert(type.ConstraintTypesNoUseSiteDiagnostics.Length == other.ConstraintTypesNoUseSiteDiagnostics.Length); 756Debug.Assert(type.CustomModifiers.IsDefaultOrEmpty); 757Debug.Assert(other.CustomModifiers.IsDefaultOrEmpty); 831Debug.Assert(matcher != null); 906Debug.Assert(type.IsDefinition); 965Debug.Assert((object)translatedType != null);
Emitter\EditAndContinue\EmitHelpers.cs (1)
80Debug.Assert(baseline.PEModuleBuilder != null);
Emitter\EditAndContinue\PEDeltaAssemblyBuilder.cs (3)
88Debug.Assert(visited is not null); 244Debug.Assert(EmitOptions.InstrumentationKinds.IsEmpty); 257Debug.Assert(Compilation == template.DeclaringCompilation);
Emitter\Model\AssemblyReference.cs (1)
25Debug.Assert((object)assemblySymbol != null);
Emitter\Model\AttributeDataAdapter.cs (4)
30Debug.Assert(argument.Kind != TypedConstantKind.Error); 121Debug.Assert(!argument.Values.IsDefault); 145Debug.Assert(argument.ValueInternal != null); 193Debug.Assert(false, "Name does not match an attribute field or a property. How can that be?");
Emitter\Model\ExpandedVarargsMethodReference.cs (5)
27Debug.Assert(underlyingMethod.AcceptsExtraArguments); 28Debug.Assert(!argListParams.IsEmpty); 66Debug.Assert(_underlyingMethod.AsGenericMethodInstanceReference == _underlyingMethod); 80Debug.Assert(_underlyingMethod.AsSpecializedMethodReference == _underlyingMethod); 211Debug.Assert(!(value is ISymbol));
Emitter\Model\FieldSymbolAdapter.cs (5)
65Debug.Assert(this.IsDefinitionOrDistinct()); 80Debug.Assert(this.IsDefinitionOrDistinct()); 95Debug.Assert(this.IsDefinitionOrDistinct()); 105Debug.Assert(this.IsDefinitionOrDistinct()); 293Debug.Assert(!AdaptedFieldSymbol.IsDefinition);
Emitter\Model\GenericMethodInstanceReference.cs (1)
36Debug.Assert(arg.CustomModifiers.IsEmpty);
Emitter\Model\GenericTypeInstanceReference.cs (3)
28Debug.Assert(underlyingNamedType.IsDefinition); 30Debug.Assert(!underlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Any(static a => a.CustomModifiers.Any())); 52System.Diagnostics.Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition);
Emitter\Model\MethodReference.cs (1)
21Debug.Assert((object)underlyingMethod != null);
Emitter\Model\MethodSymbolAdapter.cs (19)
39Debug.Assert(this.IsDefinitionOrDistinct()); 55Debug.Assert(this.IsDefinitionOrDistinct()); 60Debug.Assert((object)AdaptedMethodSymbol.ContainingType != null && 76Debug.Assert(this.IsDefinitionOrDistinct()); 105Debug.Assert(this.IsDefinitionOrDistinct()); 111Debug.Assert(((Cci.IMethodReference)this).AsGenericMethodInstanceReference != null); 116Debug.Assert(((Cci.IMethodReference)this).AsSpecializedMethodReference != null); 125Debug.Assert(((Cci.IMethodReference)this).GetResolvedMethod(visitor.Context) != null); 171Debug.Assert(this.IsDefinitionOrDistinct()); 177Debug.Assert((object)AdaptedMethodSymbol.PartialDefinitionPart == null); // must be definition 202Debug.Assert(this.IsDefinitionOrDistinct()); 217Debug.Assert(AdaptedMethodSymbol.Parameters.All(p => p.IsDefinition)); 261Debug.Assert(((Cci.IMethodReference)this).AsGenericMethodInstanceReference != null); 265Debug.Assert(arg.CustomModifiers.IsEmpty); 274Debug.Assert(((Cci.IMethodReference)this).AsGenericMethodInstanceReference != null); 297Debug.Assert(((Cci.IMethodReference)this).AsSpecializedMethodReference != null); 359Debug.Assert(@param.IsDefinition); 379Debug.Assert(AdaptedMethodSymbol.HasDeclarativeSecurity); 671Debug.Assert(this.MethodKind != MethodKind.Destructor);
Emitter\Model\ModuleReference.cs (2)
25Debug.Assert(moduleBeingBuilt != null); 26Debug.Assert((object)underlyingModule != null);
Emitter\Model\NamedTypeReference.cs (1)
23Debug.Assert((object)underlyingNamedType != null);
Emitter\Model\NamedTypeSymbolAdapter.cs (34)
64Debug.Assert(this.IsDefinitionOrDistinct()); 98Debug.Assert(this.IsDefinitionOrDistinct()); 119Debug.Assert(this.IsDefinitionOrDistinct()); 135Debug.Assert(this.IsDefinitionOrDistinct()); 171Debug.Assert(this.IsDefinitionOrDistinct()); 187Debug.Assert(this.IsDefinitionOrDistinct()); 192Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType != null && 210Debug.Assert(this.IsDefinitionOrDistinct()); 290Debug.Assert(((Cci.ITypeReference)this).AsTypeDefinition(context) != null); 296Debug.Assert((object)baseType == null); 331Debug.Assert((object)method.PartialDefinitionPart == null); // must be definition 392Debug.Assert(body.ContainingType == (object)container); 412Debug.Assert((object)method.PartialDefinitionPart == null); // must be definition 419Debug.Assert(!method.RequiresExplicitOverride(out _)); 434Debug.Assert((object)(f.TupleUnderlyingField ?? f) == f); 435Debug.Assert(!(f is TupleErrorFieldSymbol)); 486Debug.Assert(((Cci.ITypeReference)this).AsTypeDefinition(context) != null); 632Debug.Assert((object)method != null); 693Debug.Assert((object)property != null); 812Debug.Assert(AdaptedNamedTypeSymbol.IsErrorType() || 824Debug.Assert(((Cci.ITypeReference)this).AsNamespaceTypeReference != null); 834Debug.Assert(((Cci.ITypeReference)this).AsNamespaceTypeReference != null); 844Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType == null && AdaptedNamedTypeSymbol.ContainingModule is SourceModuleSymbol); 854Debug.Assert(((Cci.ITypeReference)this).AsNestedTypeReference != null); 856Debug.Assert(this.IsDefinitionOrDistinct()); 868Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType != null); 879Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType != null); 890Debug.Assert(((Cci.ITypeReference)this).AsGenericTypeInstanceReference != null); 911Debug.Assert(((Cci.ITypeReference)this).AsGenericTypeInstanceReference != null); 924Debug.Assert(((Cci.ITypeReference)this).AsSpecializedNestedTypeReference != null); 927Debug.Assert(result != null); 941Debug.Assert(this is not SynthesizedPrivateImplementationDetailsType); 981Debug.Assert(this.IsDefinition); 982Debug.Assert(this.ContainingModule is SourceModuleSymbol);
Emitter\Model\ParameterSymbolAdapter.cs (1)
191Debug.Assert(this.IsDefinitionOrDistinct());
Emitter\Model\ParameterTypeInformation.cs (1)
22Debug.Assert((object)underlyingParameter != null);
Emitter\Model\PEAssemblyBuilder.cs (6)
80Debug.Assert(sourceAssembly is object); 548Debug.Assert(Compilation.ShouldEmitNativeIntegerAttributes()); 672Debug.Assert(!allowUserDefinedAttribute || typeof(T) == typeof(NamedTypeSymbol)); 693Debug.Assert(symbol.Constructors.Length == description.Signatures.Length); 707Debug.Assert(userDefinedAttribute is null || (object)userDefinedAttribute.ContainingModule == _sourceAssembly.SourceModule); 708Debug.Assert(userDefinedAttribute?.IsErrorType() != true);
Emitter\Model\PEModuleBuilder.cs (76)
77Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 256Debug.Assert(debugDocuments.Count == 0); 257Debug.Assert(methodDocumentList.Count == 0); 258Debug.Assert(typesToProcess.Count == 0); 481Debug.Assert(Compilation == compilation, "How did we get symbol from different compilation?"); 530Debug.Assert(Compilation == template.DeclaringCompilation); 538Debug.Assert(Compilation == template.DeclaringCompilation); 591Debug.Assert(symbol.IsDefinition); 607Debug.Assert(namespaceOrType is PENamespaceSymbol or PENamedTypeSymbol); 624Debug.Assert(!groupingTypes.IsEmpty); 660Debug.Assert(HaveDeterminedTopLevelTypes); 693Debug.Assert(OutputKind.IsNetModule() == sourceAssembly.DeclaringCompilation.Options.OutputKind.IsNetModule()); 724Debug.Assert(exportedType.Type.AsGenericTypeInstanceReference is null); 725Debug.Assert(exportedType.Type.AsSpecializedNestedTypeReference is null); 735Debug.Assert(type.IsDefinition); 736Debug.Assert(type.IsTopLevelType()); 766Debug.Assert(contender.ContainingAssembly == sourceAssembly); 795Debug.Assert(builder is null || contextOpt is not null); 813Debug.Assert((object)originalDefinition.ContainingType == null, "How did a nested type get forwarded?"); 821Debug.Assert(contextOpt is not null); 826Debug.Assert(stack.Count == 0); 843Debug.Assert(type is { ContainingModule: SourceModuleSymbol } or PENamedTypeSymbol or RetargetingNamedTypeSymbol); 869Debug.Assert(!groupingTypes.IsEmpty); 968Debug.Assert(diagnostics != null); 1113Debug.Assert(namedTypeSymbol.IsDefinitionOrDistinct()); 1114Debug.Assert(diagnostics != null); 1119Debug.Assert(!needDeclaration); 1152Debug.Assert(!needDeclaration); 1200Debug.Assert((object)container != null); 1219Debug.Assert(namedTypeSymbol.IsDefinition); 1292Debug.Assert(diagnostics != null); 1325Debug.Assert(fieldSymbol.IsDefinitionOrDistinct()); 1326Debug.Assert(!fieldSymbol.IsVirtualTupleField && 1332Debug.Assert(!needDeclaration); 1367Debug.Assert(!methodSymbol.IsDefaultValueTypeConstructor()); 1368Debug.Assert(optArgList == null || (methodSymbol.IsVararg && !needDeclaration)); 1407Debug.Assert(!needDeclaration); 1411Debug.Assert(methodSymbol.IsDefinitionOrDistinct()); 1415Debug.Assert(!needDeclaration); 1416Debug.Assert(!(methodSymbol.OriginalDefinition is NativeIntegerMethodSymbol)); 1417Debug.Assert(!(methodSymbol.ConstructedFrom is NativeIntegerMethodSymbol)); 1447Debug.Assert(typeIsGeneric); 1501Debug.Assert(methodSymbol.IsDefinition); 1518Debug.Assert(@params.All(p => p.IsDefinitionOrDistinct())); 1521Debug.Assert(@params.All(p => mustBeTranslated == MustBeWrapped(p)), "either all or no parameters need translating"); 1733Debug.Assert(flagsBuilder.All(f => f <= 2)); 1802Debug.Assert((object)type != null); 1803Debug.Assert(type.ContainsNativeIntegerWrapperType()); 1804Debug.Assert(Compilation.ShouldEmitNativeIntegerAttributes()); 1815Debug.Assert(builder.Any()); 1816Debug.Assert(builder.Contains(true)); 1826Debug.Assert((object)booleanType != null); 1839Debug.Assert(Compilation.ShouldEmitNativeIntegerAttributes()); 1848Debug.Assert(scope != ScopedKind.None); 1849Debug.Assert(!ParameterHelpers.IsRefScopedByDefault(symbol) || scope == ScopedKind.ScopedValue); 1850Debug.Assert(!symbol.IsThis); 1953Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 1954Debug.Assert(diagnosticsOpt is null || attribute == EmbeddableAttributes.ParamCollectionAttribute, "Don't report any errors. They should be reported during binding."); 1999Debug.Assert(Compilation.ShouldEmitNativeIntegerAttributes()); 2032Debug.Assert(methodAdapter.Name == methodName); 2037Debug.Assert(methodSymbol.Name == methodName); 2099Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 2116Debug.Assert(Compilation.Assembly.RuntimeSupportsInlineArrayTypes); 2117Debug.Assert(arrayLength > 0); 2118Debug.Assert(diagnostics.DiagnosticBag is not null); 2124Debug.Assert(arrayWellKnownType is >= WellKnownType.System_Runtime_CompilerServices_InlineArray2 and <= WellKnownType.System_Runtime_CompilerServices_InlineArray16); 2134Debug.Assert(attributeConstructor is { }); 2145Debug.Assert(syntaxNode is { }); 2146Debug.Assert(diagnostics is { }); 2170Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 2187Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 2203Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 2315Debug.Assert(container is not NamedTypeSymbol { IsExtension: true } || nestedType.GetInternalSymbol() is FixedFieldImplementationType); 2321Debug.Assert(container is not NamedTypeSymbol { IsExtension: true }); 2327Debug.Assert(container is not NamedTypeSymbol { IsExtension: true }); 2333Debug.Assert(container is not NamedTypeSymbol { IsExtension: true });
Emitter\Model\PropertySymbolAdapter.cs (2)
145Debug.Assert(AdaptedPropertySymbol.IsDefinition); 148Debug.Assert(AdaptedPropertySymbol.ContainingModule is SourceModuleSymbol || AdaptedPropertySymbol.ContainingAssembly.IsLinked);
Emitter\Model\SpecializedFieldReference.cs (2)
26Debug.Assert((object)underlyingField != null); 48Debug.Assert(_underlyingField.OriginalDefinition.IsDefinition);
Emitter\Model\SpecializedGenericMethodInstanceReference.cs (2)
27Debug.Assert(PEModuleBuilder.IsGenericType(underlyingMethod.ContainingType) && underlyingMethod.ContainingType.IsDefinition); 37Debug.Assert(arg.CustomModifiers.IsEmpty);
Emitter\Model\SpecializedGenericNestedTypeInstanceReference.cs (3)
27Debug.Assert(underlyingNamedType.IsDefinition); 29Debug.Assert(!underlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Any(static a => a.CustomModifiers.Any())); 51System.Diagnostics.Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition);
Emitter\Model\SpecializedNestedTypeReference.cs (2)
28Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition); 32Debug.Assert(result != null);
Emitter\Model\SymbolAdapter.cs (5)
65Debug.Assert(this.IsDefinition); 68Debug.Assert(this.ContainingModule is SourceModuleSymbol || 89Debug.Assert(this.Kind != SymbolKind.Assembly); 96Debug.Assert(this.Kind != SymbolKind.Assembly); 144Debug.Assert(attribute.ShouldEmitAttribute(this, isReturnType, emittingAssemblyAttributesInNetModule));
Emitter\Model\TypeParameterSymbolAdapter.cs (6)
78Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 113Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 200Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 221Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 230Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 262Debug.Assert(!type.NullableAnnotation.IsAnnotated());
Emitter\NoPia\EmbeddedMethod.cs (1)
129Debug.Assert(!isMetadataFinal);
Emitter\NoPia\EmbeddedParameter.cs (1)
28Debug.Assert(underlyingParameter.AdaptedParameterSymbol.IsDefinition);
Emitter\NoPia\EmbeddedType.cs (5)
32Debug.Assert(underlyingNamedType.AdaptedNamedTypeSymbol.IsDefinition); 33Debug.Assert(underlyingNamedType.AdaptedNamedTypeSymbol.IsTopLevelType()); 34Debug.Assert(!underlyingNamedType.AdaptedNamedTypeSymbol.IsGenericType); 39Debug.Assert(UnderlyingNamedType.AdaptedNamedTypeSymbol.IsInterfaceType()); 125Debug.Assert((object)TypeManager.ModuleBeingBuilt == context.Module);
Emitter\NoPia\EmbeddedTypeParameter.cs (1)
24Debug.Assert(underlyingTypeParameter.AdaptedTypeParameterSymbol.IsDefinition);
Emitter\NoPia\EmbeddedTypesManager.cs (20)
226Debug.Assert(!IsFrozen); // After we freeze the set of types, we might add additional assemblies into this map without actual guid values. 235Debug.Assert(guidString == null); 275Debug.Assert(IsFrozen); 406Debug.Assert(namedType.IsDefinition); 407Debug.Assert(ModuleBeingBuilt.SourceModule.AnyReferencedAssembliesAreLinked); 423Debug.Assert(namedType.IsDefinition); 444Debug.Assert(!IsFrozen, "Set of embedded types is frozen."); 453Debug.Assert(namedType.TypeKind == TypeKind.Struct || namedType.TypeKind == TypeKind.Enum || namedType.TypeKind == TypeKind.Delegate); 489Debug.Assert(field.AdaptedSymbol.IsDefinition); 501Debug.Assert(!IsFrozen, "Set of embedded fields is frozen."); 525Debug.Assert(method.AdaptedSymbol.IsDefinition); 526Debug.Assert(!method.AdaptedMethodSymbol.IsDefaultValueTypeConstructor()); 538Debug.Assert(!IsFrozen, "Set of embedded methods is frozen."); 586Debug.Assert(property.AdaptedPropertySymbol.IsDefinition); 605Debug.Assert(!IsFrozen, "Set of embedded properties is frozen."); 621Debug.Assert(@event.AdaptedSymbol.IsDefinition); 645Debug.Assert(!IsFrozen, "Set of embedded events is frozen."); 658Debug.Assert(member.AdaptedSymbol.IsDefinition); 659Debug.Assert(ModuleBeingBuilt.SourceModule.AnyReferencedAssembliesAreLinked); 689Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Errors\CSDiagnosticInfo.cs (1)
42Debug.Assert(code != ErrorCode.ERR_InternalError);
Errors\LazyMissingNonNullTypesContextDiagnosticInfo.cs (2)
24Debug.Assert(type.HasType); 63Debug.Assert(questionToken.SyntaxTree != null);
Errors\LazyObsoleteDiagnosticInfo.cs (3)
20Debug.Assert(symbol is Symbol || symbol is TypeWithAnnotations); 46Debug.Assert(kind != ObsoleteDiagnosticKind.Lazy); 47Debug.Assert(kind != ObsoleteDiagnosticKind.LazyPotentiallySuppressed);
Errors\LazyUnmanagedCallersOnlyMethodCalledDiagnosticInfo.cs (2)
36Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.Uninitialized)); 37Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound));
Errors\MessageID.cs (1)
488Debug.Assert(RequiredFeature(feature) == null);
Errors\SyntaxDiagnosticInfo.cs (1)
34Debug.Assert(width >= 0);
FlowAnalysis\AbstractFlowPass.cs (43)
140Debug.Assert(newState != null); 190Debug.Assert(node != null); 199Debug.Assert(firstInRegion != null); 200Debug.Assert(lastInRegion != null); 204Debug.Assert(length >= 0, "last comes before first"); 272Debug.Assert(this.regionPlace == RegionPlace.Before); 289Debug.Assert(IsInside); 299Debug.Assert(span.Length > 0); 538Debug.Assert(_labelsSeen.Count == 0); 673Debug.Assert(!this.IsConditionalState); 827Debug.Assert(!this.IsConditionalState); 923Debug.Assert(!IsConditionalState); 926Debug.Assert(node.Pattern is 932Debug.Assert(negated == node.IsNegated); 936Debug.Assert(!IsConditionalState); 999Debug.Assert(binaryPatterns.Peek().Left is not BoundBinaryPattern); 1040Debug.Assert(binaryPatterns.Peek().Left is not BoundBinaryPattern); 1189Debug.Assert(shortCircuitState != null); 1519Debug.Assert(method?.OriginalDefinition.MethodKind != MethodKind.LocalFunction); 1657Debug.Assert(node is not BoundTypeOrValueExpression, "The Binder is expected to resolve the member access in the most appropriate way, even in an error scenario."); 2205Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)GetWriteMethod(property)); 2396Debug.Assert(!node.OperatorKind.IsUserDefined()); 2438Debug.Assert(!binOp.OperatorKind.IsUserDefined()); 2462Debug.Assert(stack.Count > 0); 2506Debug.Assert(!isBool || binary.Kind != BoundKind.UserDefinedConditionalLogicalOperator); 2508Debug.Assert(isAnd || op == BinaryOperatorKind.Or); 2715Debug.Assert(node.InterpolatedStringHandlerData.HasValue); 2728Debug.Assert(parts.Count >= 2); 2754Debug.Assert(shortCircuitState != null || (!usesBoolReturns && !firstPartIsConditional)); 2778Debug.Assert(shortCircuitState != null); 2842Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)writeMethod); 2938Debug.Assert(!IsConditionalState); 2974Debug.Assert(!IsConditionalState); 3019Debug.Assert(!IsConditionalState); 3045Debug.Assert(method is object); 3046Debug.Assert(method.ParameterCount is 1); 3118Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion)); 3129Debug.Assert(expr is BoundExpression); 3258Debug.Assert(!this.IsConditionalState); 3266Debug.Assert(!this.IsConditionalState); 3369Debug.Assert(!this.IsConditionalState); 3466Debug.Assert(!this.IsConditionalState); 3581Debug.Assert(this.IsConditionalState);
FlowAnalysis\AlwaysAssignedWalker.cs (1)
52Debug.Assert(!IsInside);
FlowAnalysis\ControlFlowPass.cs (3)
83Debug.Assert(!self.Alive || !self.Reported); 92Debug.Assert(!self.Alive || !self.Reported); 166Debug.Assert(!badRegion);
FlowAnalysis\DefiniteAssignment.cs (32)
245Debug.Assert(member is TypeSymbol type && 249Debug.Assert((object)member.ContainingAssembly == compilation?.SourceAssembly); 289Debug.Assert(variableId.Symbol.Kind == SymbolKind.Field || variableId.Symbol.Kind == SymbolKind.Property || variableId.Symbol.Kind == SymbolKind.Event, 315Debug.Assert( 417Debug.Assert(node != null || location != null); 431Debug.Assert(thisSlot > 0); 492Debug.Assert(!parameter.IsThis); 509Debug.Assert(diagnostics != null); 523Debug.Assert(unused.IsDefault); 575Debug.Assert(newCode != oldCode || oldCode == ErrorCode.ERR_InsufficientStack, oldCode.ToString()); 602Debug.Assert(walker.TrackImplicitlyInitializedFields); 612Debug.Assert(!badRegion); 623Debug.Assert(strictAnalysis || implicitlyInitializedFieldsOpt.IsDefault); 644Debug.Assert(captured.Kind == SymbolKind.Parameter || captured.Kind == SymbolKind.Local || captured.Kind == SymbolKind.RangeVariable); 737Debug.Assert(fieldOrEventAccess.Kind == BoundKind.FieldAccess || fieldOrEventAccess.Kind == BoundKind.EventAccess); 1106Debug.Assert(!IsConditionalState); 1211Debug.Assert(CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }); 1243Debug.Assert(foundUnassignedField); 1425Debug.Assert(unassignedSlot > 0); 1488Debug.Assert(!IsConditionalState); 1513Debug.Assert(local.InitializerOpt == value || value == null); 1642Debug.Assert(containingSlot != -1); 1643Debug.Assert(!state.IsAssigned(containingSlot)); 1682Debug.Assert(!_emptyStructTypeCache.IsEmptyStructType(type)); 1718Debug.Assert(!_emptyStructTypeCache.IsEmptyStructType(type)); 1899Debug.Assert(!this.IsConditionalState); 2230Debug.Assert(_usedVariables.Contains(local)); 2365Debug.Assert(target.LocalSymbol.Type is not null); 2372Debug.Assert(IsConditionalState); 2760Debug.Assert((object)iterationVariable != null); 2890Debug.Assert(!other.Reachable); 2909Debug.Assert(!assigned.IsNull);
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (3)
70Debug.Assert(!IsConditionalState); 97Debug.Assert(localFunc != null); 107Debug.Assert(!_emptyStructTypeCache.IsEmptyStructType(type));
FlowAnalysis\DefiniteAssignment.VariableIdentifier.cs (5)
27Debug.Assert(containingSlot >= 0); 28Debug.Assert(symbol.Kind switch 50Debug.Assert(Exists); 63Debug.Assert(Exists); 64Debug.Assert(other.Exists);
FlowAnalysis\EmptyStructTypeCache.cs (2)
55Debug.Assert(compilation != null || !dev12CompilerCompatibility); 105Debug.Assert(!Cache.ContainsKey(nts) || Cache[nts] == result);
FlowAnalysis\FlowAnalysisPass.cs (17)
41Debug.Assert(!hasTrailingExpression || method.IsScriptInitializer); 56Debug.Assert(!implicitlyInitializedFields.IsEmpty); 59Debug.Assert(method is not SourceMemberMethodSymbol { SyntaxNode: ConstructorDeclarationSyntax { Initializer: not null } } || block.HasErrors); 71Debug.Assert(unusedImplicitlyInitializedFields.IsDefault); 72Debug.Assert(needsImplicitReturn); 76Debug.Assert(method.MethodKind != MethodKind.AnonymousFunction); 82Debug.Assert(!submissionResultType.IsVoidType()); 92Debug.Assert(!Analyze(compilation, method, block, flowAnalysisDiagnostics, needsImplicitReturn: out _, out unusedImplicitlyInitializedFields)); 93Debug.Assert(unusedImplicitlyInitializedFields.IsDefault); 95Debug.Assert(getErrorsOnly(flowAnalysisDiagnostics.ToReadOnly()).SequenceEqual(getErrorsOnly(diagnostics.ToReadOnly().Diagnostics.Skip(initialDiagnosticCount)))); 115Debug.Assert(!implicitlyInitializedFields.IsEmpty); 116Debug.Assert(method.MethodKind == MethodKind.Constructor); 118Debug.Assert(containingType.IsStructType()); 128Debug.Assert(elementField == implicitlyInitializedFields.Single()); 192Debug.Assert(body != null); 193Debug.Assert(method != null); 197Debug.Assert(body.WasCompilerGenerated ||
FlowAnalysis\LocalDataFlowPass.cs (4)
42Debug.Assert(emptyStructs != null); 102Debug.Assert(containingSlot >= 0); 103Debug.Assert(symbol != null); 229Debug.Assert((receiver is null) != member.RequiresInstanceReceiver());
FlowAnalysis\NullableWalker_Patterns.cs (40)
38Debug.Assert(!IsConditionalState); 131Debug.Assert(current.Left is not BoundBinaryPattern); 400Debug.Assert(originalInputSlot > 0); 415Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.Type)); 426Debug.Assert(found); // the topologically sorted nodes should contain only reachable nodes 443Debug.Assert(inputSlot > 0); 464Debug.Assert(!IsConditionalState); 473Debug.Assert(outputSlot > 0); 478Debug.Assert(inputSlot > 0); 484Debug.Assert(outputSlot > 0); 498Debug.Assert(outputSlot > 0); 507Debug.Assert(outputSlot > 0); 517Debug.Assert(outputSlot > 0); 543Debug.Assert(foundTemp); 582Debug.Assert(t.Value != ConstantValue.Null); 659Debug.Assert(this.IsConditionalState); 665Debug.Assert(w.WhenFalse is null); 691Debug.Assert(inputSlot > 0); 704Debug.Assert(outputSlot > 0); 733Debug.Assert(inputSlot > 0); 763Debug.Assert(originalInputMap[outputSlot] == ((BoundTupleExpression)expression).Arguments[originalTupleElement.TupleElementIndex]); 772Debug.Assert(outputSlot > 0); 778Debug.Assert(inputSlot > 0); 787Debug.Assert(outputSlot > 0); 795Debug.Assert(outputSlot > 0); 802Debug.Assert(inputSlot > 0); 806Debug.Assert(outputSlot > 0); 813Debug.Assert(inputSlot > 0); 817Debug.Assert(outputSlot > 0); 856Debug.Assert(slot > 0); 860Debug.Assert(outputSlotAndType.slot == slot); 861Debug.Assert(isDerivedType(outputSlotAndType.type, type)); 865Debug.Assert(NominalSlotType(slot) is var slotType && (slotType.IsErrorType() || isDerivedType(slotType, type))); 897Debug.Assert(false); 902Debug.Assert(false); 907Debug.Assert(false); 936Debug.Assert(false); 1089Debug.Assert(reachabilityInfo is not null); 1160Debug.Assert((node is BoundUnconvertedSwitchExpression && (_returnTypesOpt is not null || _disableDiagnostics)) 1249Debug.Assert(!IsConditionalState);
FlowAnalysis\NullableWalker.cs (372)
82Debug.Assert(variables.Id == variableNullableStates.Id); 149Debug.Assert(TypeSymbol.Equals(RValueType.Type, LValueType.Type, TypeCompareKind.ConsiderEverything)); 166Debug.Assert(!StateForLambda.HasValue); 369Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.Type) 490Debug.Assert(_targetTypedAnalysisCompletionOpt is null or { Count: 0 }); 514Debug.Assert(!TrackingRegions); 515Debug.Assert(!useDelegateInvokeParameterTypes || delegateInvokeMethodOpt is object); 516Debug.Assert(baseOrThisInitializer is null or { MethodKind: MethodKind.Constructor }); 584Debug.Assert(_resultForPlaceholdersOpt.Count == 0); 591Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.Type)); 592Debug.Assert(expression != null || placeholder.Kind == BoundKind.InterpolatedStringArgumentPlaceholder); 601Debug.Assert(_resultForPlaceholdersOpt is { }); 603Debug.Assert(removed); 609Debug.Assert(placeholder is { }); 691Debug.Assert(_useConstructorExitWarnings); 1035Debug.Assert(requiredMember.IsRequired()); 1507Debug.Assert(node.SyntaxTree is object); 1553Debug.Assert(method.IsConstructor()); 1874Debug.Assert(diagnostics != null); 1875Debug.Assert(getterNullResilienceData is null || symbol is SourcePropertyAccessorSymbol { MethodKind: MethodKind.PropertyGet }); 1876Debug.Assert(getterNullResilienceData is null || !useConstructorExitWarnings); 1900Debug.Assert(!walker.IsConditionalState); 1918Debug.Assert(snapshotBuilderOpt is null || symbol is object); 1925Debug.Assert(walker._variables.Id == initialState.Value.Id); 1931Debug.Assert(!badRegion); 1952Debug.Assert(result.RequiredAnalysis == requiredAnalysis); 1968Debug.Assert(!IsConditionalState); 1991Debug.Assert(node is object); 2041Debug.Assert(slot > 0); 2136Debug.Assert(member?.RequiresInstanceReceiver() ?? true); 2155Debug.Assert(node.HasErrors || 2275Debug.Assert(containingSlot == 0); 2672Debug.Assert(!IsConditionalState); 2726Debug.Assert(ErrorFacts.NullableWarnings.Contains(MessageProvider.Instance.GetIdForErrorCode((int)errorCode))); 2735Debug.Assert(targetSlot > 0); 2736Debug.Assert(EmptyStructTypeCache.IsTrackableStructType(targetType)); 2762Debug.Assert(false, "If this assert fires, please add a unit test for the scenario."); 2778Debug.Assert(targetContainerSlot > 0); 2779Debug.Assert(skipSlot > 0); 2863Debug.Assert(slot > 0); 2884Debug.Assert(targetSlot > 0); 2888Debug.Assert(actualType is { }); 2896Debug.Assert(conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference); 2929Debug.Assert(false); 2957Debug.Assert(targetSlot > 0); 2958Debug.Assert(valueSlot > 0); 2966Debug.Assert(member.Kind == SymbolKind.Field || member.Kind == SymbolKind.Property || member.Kind == SymbolKind.Event); 3040Debug.Assert(!IsConditionalState); 3094Debug.Assert(!IsConditionalState); 3200Debug.Assert((object)returnType != LambdaSymbol.ReturnTypeIsBeingInferred); 3249Debug.Assert(node.Type.IsErrorType() || type.Type.IsErrorType()); 3281Debug.Assert(!TrackingRegions); 3348Debug.Assert(newBodiesVisited); 3438Debug.Assert((object?)variables.Container == container); 3450Debug.Assert(!useDelegateInvokeParameterTypes || delegateInvokeMethod is object); 3451Debug.Assert(!useDelegateInvokeReturnType || delegateInvokeMethod is object); 3573Debug.Assert(!IsConditionalState); 3599Debug.Assert(!IsConditionalState); 3713Debug.Assert(!IsConditionalState); 3748Debug.Assert(type.Type.IsErrorType()); 3767Debug.Assert(node is BoundExpression or BoundPattern); 3768Debug.Assert(!IsConditionalState); 3785Debug.Assert((object?)resultType.Type != _invalidType.Type); 3786Debug.Assert(AreCloseEnough(resultType.Type, node.Type)); 3884Debug.Assert(!_completingTargetTypedExpression); 3993Debug.Assert(reinferenceResult.Completion != null); 4009Debug.Assert(collectionBuilderElementsPlaceholder != null); 4031Debug.Assert(reinferenceResult.Completion != null); 4052Debug.Assert(allTypeArguments.Length == call.Method.Arity, "Guaranteed by GetCollectionBuilderMethods"); 4091Debug.Assert(node.Placeholder is { }); 4095Debug.Assert(initializer.ArgsToParamsOpt.IsDefault); 4166Debug.Assert(completion is not null); 4180Debug.Assert(TypeSymbol.Equals(strippedTargetCollectionType, node.Type, TypeCompareKind.AllIgnoreOptions)); 4239Debug.Assert(foundIterationType); 4244Debug.Assert(!targetElementType.HasType); 4258Debug.Assert(node.ExpressionPlaceholder is { }); 4259Debug.Assert(node.EnumeratorInfoOpt is { }); 4271Debug.Assert(node.HasErrors); 4272Debug.Assert(node.Conversion is null); 4273Debug.Assert(node.EnumeratorInfoOpt is null); 4281Debug.Assert(!IsConditionalState); 4293Debug.Assert(isTargetTyped == argumentsCompletion is not null); 4324Debug.Assert(argumentsCompletion is not null); 4325Debug.Assert(initialStateInferenceCompletion is not null); 4330Debug.Assert(argumentsCompletion is null); 4331Debug.Assert(initialStateInferenceCompletion is null); 4332Debug.Assert(initializerCompletion is null); 4348Debug.Assert(resultState == NullableFlowState.NotNull); 4353Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4391Debug.Assert(node.Kind is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression); 4482Debug.Assert(completion is null); 4483Debug.Assert(resultState == NullableFlowState.NotNull); 4491Debug.Assert(containingSlot > 0); 4505Debug.Assert(iUnionValuePropertySlot > 0); 4518Debug.Assert(!delayCompletionForType || containingSlot == -1); 4568Debug.Assert(!delayCompletionForType || containingSlot == -1); 4608Debug.Assert(symbol is not null); 4631Debug.Assert(argumentsCompletion is null); 4632Debug.Assert(initializationCompletion is null); 4642Debug.Assert(objectInitializer.MemberSymbol is not null); 4660Debug.Assert(argumentResults[0].LValueType.Type.Equals(containingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4669Debug.Assert(initializationCompletion is null || symbol is not null); 4673Debug.Assert(result is null); 4685Debug.Assert(!delayCompletionForType || slot == -1); 4701Debug.Assert(nestedCompletion is null); 4726Debug.Assert(!delayCompletionForType || conversionCompletion is null); 4733Debug.Assert(GetTypeOrReturnTypeWithAnnotations(symbol).HasType); 4745Debug.Assert(conversionCompletion is not null); 4749Debug.Assert(conversionCompletion is null); 4762Debug.Assert(result is null); 4779Debug.Assert(TypeSymbol.Equals(objectInitializer.Type, GetTypeOrReturnType(symbol), TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4807Debug.Assert(TypeSymbol.Equals(objectInitializer.Type, GetTypeOrReturnType(symbol), TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4854Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4855Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4871Debug.Assert(visitArgumentsCompletion is not null); 4875Debug.Assert(visitArgumentsCompletion is null); 4876Debug.Assert(reinferredMethod is object); 4912Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4913Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4990Debug.Assert(node.Type is object); 5008Debug.Assert((object)placeholder != null); 5014Debug.Assert(!IsConditionalState); 5015Debug.Assert(node.Type.IsAnonymousType); 5192Debug.Assert(namedType.Name == "Span"); 5193Debug.Assert(namedType.OriginalDefinition.Arity == 1); 5199Debug.Assert(namedType.Name == "Span"); 5200Debug.Assert(namedType.OriginalDefinition.Arity == 1); 5309Debug.Assert(!IsConditionalState); 5313Debug.Assert(!IsConditionalState); 5314Debug.Assert(!node.Expression.Type!.IsValueType); 5343Debug.Assert(!IsConditionalState); 5347Debug.Assert(!IsConditionalState); 5348Debug.Assert(expressionType is not null); 5349Debug.Assert(expressionType.IsValueType); 5423Debug.Assert(!IsConditionalState); 5581Debug.Assert(binary.Type.SpecialType == SpecialType.System_Boolean); 5614Debug.Assert(!IsConditionalState); 5649Debug.Assert(operand == expr); 5667Debug.Assert(!IsConditionalState); 5671Debug.Assert(binary.Type!.SpecialType == SpecialType.System_Boolean); 5797Debug.Assert(!IsConditionalState); 5898Debug.Assert(operand != null); 6146Debug.Assert(targetType.Type.ContainsErrorType() || 6158Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.Type, TypeCompareKind.AllIgnoreOptions)); 6169Debug.Assert(!IsConditionalState); 6220Debug.Assert(rightType is object); 6227Debug.Assert(!conversion.IsUserDefined); 6228Debug.Assert(!conversion.IsUnion); 6233Debug.Assert(!conversion.IsUserDefined); 6234Debug.Assert(!conversion.IsUnion); 6257Debug.Assert(conversionResult.Type is not null); 6286Debug.Assert(targetType.HasType); 6298Debug.Assert(!IsConditionalState); 6336Debug.Assert(!IsConditionalState); 6382Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion)); 6394Debug.Assert(expr is BoundExpression); 6404Debug.Assert(expr is BoundExpression); 6475Debug.Assert(node is not BoundConditionalOperator { WasTargetTyped: true }, """ 6565Debug.Assert(!wasTargetTyped); 6572Debug.Assert(node is BoundUnconvertedConditionalOperator); 6573Debug.Assert(node.HasErrors || _returnTypesOpt is not null || _disableDiagnostics); 6665Debug.Assert(!isRef); 6677Debug.Assert(isRef); 6809Debug.Assert(node.InvokedAsExtensionMethod); 6829Debug.Assert(node.InvokedAsExtensionMethod || isExtensionBlockMethod); 6836Debug.Assert(node.Method.ContainingType.ExtensionParameter is not null); 6876Debug.Assert(node.ReceiverOpt is null); 6929Debug.Assert(reinferenceResult.Member is not null); 6993Debug.Assert(reinferenceResult.Completion is null); 6995Debug.Assert(newMethod is not null); 7020Debug.Assert(extensionParameter is not null); 7033Debug.Assert(member.IsExtensionBlockMember()); 7054Debug.Assert(extensionParameter is not null); 7125Debug.Assert(arguments.Length == 2); 7136Debug.Assert(arguments.Length == 1); 7225Debug.Assert(baseType is object); 7297Debug.Assert(!compareExchangeInfo.IsDefault); 7319Debug.Assert(argsToParamsOpt is { IsDefault: true } or { Length: 3 }); 7537Debug.Assert(reinferenceResult.Completion is null); 7551Debug.Assert(reinferenceResult.Completion is null); 7584Debug.Assert(!arguments.IsDefault); 7585Debug.Assert(!expanded || !parametersOpt.IsDefault); 7586Debug.Assert(refKindsOpt.IsDefaultOrEmpty || refKindsOpt.Length == arguments.Length); 7587Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == arguments.Length); 7595Debug.Assert(!arguments.Any(a => a.IsParamsArrayOrCollection)); 7695Debug.Assert(method is ErrorMethodSymbol); 7821Debug.Assert(result.Completion is null); 7833Debug.Assert(arguments.Count(a => a.IsParamsArrayOrCollection) <= 1); 7840Debug.Assert(parametersOpt.IsDefault || arguments.Length == parametersOpt.Length); 7868Debug.Assert(defaultArguments.IsNull || elements.Length == 1); 7869Debug.Assert(elements.Length == 1 || a == arguments.Length - 1); 7874Debug.Assert(argumentsBuilder.Count == arguments.Length + elements.Length - 1); 7978Debug.Assert(receiverSlot >= 0); 8085Debug.Assert(!IsConditionalState); 8149Debug.Assert(!IsConditionalState); 8197Debug.Assert(!IsConditionalState); 8216Debug.Assert(!this.IsConditionalState); 8233Debug.Assert(argumentResultType is not null); 8289Debug.Assert(!this.IsConditionalState); 8475Debug.Assert(!IsConditionalState); 8480Debug.Assert(!IsConditionalState); 8659Debug.Assert(variables.Id == localState.Id); 8678Debug.Assert(!expanded); 8688Debug.Assert(paramsIterationType.HasType); 8705Debug.Assert(member.GetMemberArityIncludingExtension() != 0); 8841Debug.Assert(false); // unexpected value 8880Debug.Assert(lambdaState.HasValue); 8893Debug.Assert(collectionExpressionVisitResults is not null); 8894Debug.Assert(collectionExpressionVisitResults.Length == collection.Elements.Length); 9034Debug.Assert(group != null || !conversion.ExplicitCastInCode); // Explicit conversions should include a group. 9147Debug.Assert((object)symbol != null); 9148Debug.Assert(!symbol.IsExtensionBlockMember(), symbol.ToDisplayString()); 9182Debug.Assert(symbol.ContainingType.IsDefinition); 9219Debug.Assert(false); 9249Debug.Assert(targetType.HasType); 9294Debug.Assert(completion is null); 9325Debug.Assert(targetTypeOpt.HasType); 9354Debug.Assert(result.completion is null); 9384Debug.Assert(!IsConditionalState); 9420Debug.Assert(diagnostics.DiagnosticBag is { }); 9446Debug.Assert(tupleType.IsTupleType); 9447Debug.Assert(values.Length == types.Length); 9448Debug.Assert(values.Length == (useRestField ? Math.Min(tupleType.TupleElements.Length, NamedTypeSymbol.ValueTupleRestPosition) : tupleType.TupleElements.Length)); 9481Debug.Assert(index != -1); 9488Debug.Assert(containingType.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T); 9489Debug.Assert(containingSlot > 0); 9490Debug.Assert(valueSlot > 0); 9512Debug.Assert(conversion.Kind == ConversionKind.ImplicitTuple || conversion.Kind == ConversionKind.ExplicitTuple); 9513Debug.Assert(slot > 0); 9514Debug.Assert(valueSlot > 0); 9603Debug.Assert(targetField.TypeWithAnnotations.Type.StrippedType() is NamedTypeSymbol { IsUnionType: true }); 9623Debug.Assert(conversionOperandSlot > 0); 9673Debug.Assert(diagnostics.DiagnosticBag is { }); 9729Debug.Assert(diagnostics.DiagnosticBag is { }); 9784Debug.Assert(conversionOpt is null 9832Debug.Assert(!trackMembers || !IsConditionalState); 9833Debug.Assert(conversionOperand != null); 9834Debug.Assert(conversionOpt is null || targetInstanceSlotOpt < 0); 9860Debug.Assert(conversionOpt is null); 9909Debug.Assert(targetInstanceSlotOpt < 0); 9948Debug.Assert(targetInstanceSlotOpt < 0); 9953Debug.Assert(targetInstanceSlotOpt < 0); 10015Debug.Assert(containingSlot > 0); 10050Debug.Assert(targetInstanceSlotOpt < 0); 10064Debug.Assert(conversionOperand != null); 10072Debug.Assert(containingSlot > 0); 10109Debug.Assert(targetInstanceSlotOpt < 0); 10112Debug.Assert(conversionOperand != null); 10139Debug.Assert(conversionOperand != null); 10189Debug.Assert(targetType.IsValueType || targetType.IsErrorType()); 10292Debug.Assert(dependsOn); // If this case fails, add a corresponding test. 10365Debug.Assert(handlerData.ArgumentPlaceholders.IsEmpty 10387Debug.Assert(extensionBlockFormOffset == 1); 10444Debug.Assert(!IsConditionalState); 10445Debug.Assert(conversionOperand != null); 10446Debug.Assert(targetTypeWithNullability.HasType); 10447Debug.Assert(diagnosticLocation != null); 10448Debug.Assert(conversion.Kind == ConversionKind.ExplicitUserDefined || conversion.Kind == ConversionKind.ImplicitUserDefined); 10480Debug.Assert(method is object); 10481Debug.Assert(method.ParameterCount == 1); 10482Debug.Assert(operandType.Type is object); 10598Debug.Assert(!IsConditionalState); 10599Debug.Assert(conversionOperand != null); 10600Debug.Assert(targetTypeWithNullability.HasType); 10601Debug.Assert(diagnosticLocation != null); 10602Debug.Assert(conversion.IsUnion); 10603Debug.Assert(conversionOpt is null || targetInstanceSlotOpt < 0); 10612Debug.Assert(conversion.BestUnionConversionAnalysis is { }); 10615Debug.Assert(analysis.Kind == UserDefinedConversionAnalysisKind.ApplicableInNormalForm); 10616Debug.Assert(analysis.Operator is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true })); 10617Debug.Assert(TypeSymbol.Equals(analysis.FromType, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions)); 10618Debug.Assert(TypeSymbol.Equals(targetTypeWithNullability.Type.StrippedType(), analysis.Operator.MethodKind == MethodKind.Constructor ? analysis.Operator.ContainingType : analysis.Operator.ReturnType, TypeCompareKind.AllIgnoreOptions)); 10619Debug.Assert(TypeSymbol.Equals(targetTypeWithNullability.Type.StrippedType(), analysis.ToType, TypeCompareKind.AllIgnoreOptions)); 10620Debug.Assert(analysis.TargetConversion is { IsIdentity: true } or { IsNullable: true, IsImplicit: true }); 10628Debug.Assert(unionConstructionConversion is not null, "Unexpected conversion group structure for union conversion."); 10629Debug.Assert(sourceToParameterConversion is not null || analysis.SourceConversion.IsIdentity); 10633Debug.Assert(conversionOpt is null); 10653Debug.Assert(i < candidates.Length); 10660Debug.Assert(TypeSymbol.Equals(analysis.FromType, parameterType.Type, TypeCompareKind.AllIgnoreOptions)); 10661Debug.Assert(TypeSymbol.Equals(toType, analysis.ToType, TypeCompareKind.AllIgnoreOptions)); 10679Debug.Assert(operandType.Type is object); 10699Debug.Assert(factory.MethodKind == MethodKind.Constructor); 10704Debug.Assert(factory is { IsStatic: true, ContainingType.IsInterface: true }); 10718Debug.Assert(conversionOperand != null); 10720Debug.Assert(containingSlot > 0); 10760Debug.Assert(conversionOpt.ConversionGroupOpt == conversionGroup); 10773Debug.Assert(conversionOpt.ConversionGroupOpt == conversionGroup); 10838Debug.Assert(operandType.Type is object); 10839Debug.Assert(diagnosticLocation != null); 10872Debug.Assert(node.Type.IsDelegateType()); 10919Debug.Assert(analysisCompletion is null); 10931Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 11008Debug.Assert(arg.Type is not null); 11027Debug.Assert(arg.Type is not null); 11048Debug.Assert(!IsConditionalState); 11114Debug.Assert(_binder is object); 11123Debug.Assert(receiverParameter is not null); 11157Debug.Assert(delegateTypeOpt?.IsDelegateType() != false); 11225Debug.Assert(!IsConditionalState); 11437Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 11463Debug.Assert(invocation is object); 11464Debug.Assert(rightResult.Type is object); 11490Debug.Assert(invocation.DefaultArguments.IsNull); 11502Debug.Assert(parameters.Length - offset == n); 11509Debug.Assert(receiverParameter is not null); 11554Debug.Assert(rightParts.Length == n); 11721Debug.Assert(!IsConditionalState); 11749Debug.Assert(reinferenceResult.Member is not null); 11817Debug.Assert(!operandConversion.IsUnion); 11914Debug.Assert(!IsConditionalState); 11942Debug.Assert(reinferenceResult.Member is not null); 12041Debug.Assert(MakeSlot(node) == -1); 12129Debug.Assert(property.Parameters.IsEmpty); 12143Debug.Assert(reinferenceResult.Completion is null); 12160Debug.Assert(property.IsExtensionBlockMember()); 12182Debug.Assert(node.ReceiverOpt is not null); 12184Debug.Assert(reinferenceResult.Member is not null); 12223Debug.Assert(node.ReceiverOpt is not null); 12229Debug.Assert(reinferrenceResult.Member is not null); 12303Debug.Assert(!IsConditionalState); 12304Debug.Assert(!member.IsExtensionBlockMember()); 12344Debug.Assert(!IsConditionalState); 12391Debug.Assert(containingType.IsNullableType()); 12392Debug.Assert(TypeSymbol.Equals(NominalSlotType(containingSlot), containingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 12404Debug.Assert(node.HasErrors); 12454Debug.Assert(resultType is object); 12504Debug.Assert(!foundMultiple); 12505Debug.Assert(targetTypeWithAnnotations.HasType); 12511Debug.Assert(node.HasErrors); 12518Debug.Assert(node.HasErrors); 12569Debug.Assert(wellKnownSpan is WellKnownType.System_Span_T or WellKnownType.System_ReadOnlySpan_T); 12790Debug.Assert(!IsConditionalState); 12940Debug.Assert(stack.Count > 0); 12968Debug.Assert(leftOperand is not null); 12993Debug.Assert(isAnd || op == BinaryOperatorKind.Or); 12998Debug.Assert(IsConditionalState); 13024Debug.Assert(!isBool); 13097Debug.Assert(placeholder is object); 13152Debug.Assert(!this.IsConditionalState); 13172Debug.Assert(!this.IsConditionalState); 13191Debug.Assert(node.Type.SpecialType == SpecialType.System_Boolean); 13243Debug.Assert(node.Type.SpecialType == SpecialType.System_RuntimeArgumentHandle); 13251Debug.Assert(node.Type is null); 13258Debug.Assert(!IsConditionalState); 13266Debug.Assert(!IsConditionalState); 13275Debug.Assert(node.WasCompilerGenerated); 13283Debug.Assert(node.WasCompilerGenerated); 13322Debug.Assert(node.Type.IsDynamic()); 13341Debug.Assert(node.Type.IsDynamic()); 13342Debug.Assert(node.Type.IsReferenceType); 13352Debug.Assert(!IsConditionalState); 13448Debug.Assert(node.Type.IsDynamic()); 13461Debug.Assert(!this.IsConditionalState); 13471Debug.Assert(receiverOpt.Type is null || AreCloseEnough(receiverOpt.Type, resultTypeSymbol)); 13592Debug.Assert(node.Type is null || node.Type.IsErrorType() || node.Type.IsRefLikeType); 13612Debug.Assert(node.Type is not null); 13783Debug.Assert(node.AwaitableInstancePlaceholder is not null); 13787Debug.Assert(node.RuntimeAsyncAwaitCallPlaceholder is not null); 13793Debug.Assert(node.GetResult is null); 13824Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull }); 13896Debug.Assert(!otherIsConditional); 14033Debug.Assert(Id == variables.Container!.Id); 14092Debug.Assert(state.Id > id); 14106Debug.Assert(Id < variables.Id); 14152Debug.Assert(Id > id); 14165Debug.Assert(index < Capacity); 14167Debug.Assert((_state[index], _state[index + 1]) != (false, false)); 14184Debug.Assert(Id > id); 14239Debug.Assert(Id == other.Id); 14246Debug.Assert(_state.Capacity == other._state.Capacity); 14268Debug.Assert(Id == other.Id); 14275Debug.Assert(_state.Capacity == other._state.Capacity);
FlowAnalysis\NullableWalker.DebugVerifier.cs (1)
276Debug.Assert(node is not BoundTypeOrValueExpression, "The Binder is expected to resolve the member access in the most appropriate way, even in an error scenario.");
FlowAnalysis\NullableWalker.PlaceholderLocal.cs (2)
30Debug.Assert(identifier != null); 31Debug.Assert(containingSymbol is null || containingSymbol.DeclaringCompilation is not null);
FlowAnalysis\NullableWalker.SnapshotManager.cs (7)
42Debug.Assert(!incrementalSnapshots.IsDefaultOrEmpty); 47Debug.Assert(currentPosition > previousPosition); 116Debug.Fail($"Did not find a snapshot for {node} `{node.Syntax}.`"); 171Debug.Assert(_currentWalkerSlot == -1, "Attempting to finalize snapshots before all walks completed"); 172Debug.Assert(_symbolToSlot.Count == _walkerStates.Count); 173Debug.Assert(_symbolToSlot.Count > 0); 223Debug.Assert(AreCloseEnough(originalSymbol, updatedSymbol));
FlowAnalysis\NullableWalker.Variables.cs (16)
164Debug.Assert(_variableSlot.Count == 0); 165Debug.Assert(_variableTypes.Count == 0); 166Debug.Assert(_variableBySlot.Count == 1); 185Debug.Assert(id >= 0); 186Debug.Assert(id <= IdMask); 187Debug.Assert(container is null || container.Id < id); 215Debug.Assert(GetVariablesForMethodScope(method) is null); 216Debug.Assert(!(method.ContainingSymbol is MethodSymbol containingMethod) || 261Debug.Assert(slot <= 0 || 289Debug.Assert(id == Id); 305Debug.Assert((object)variables == this); 415Debug.Assert(id >= 0); 416Debug.Assert(id <= IdMask); 417Debug.Assert(index >= 0); 418Debug.Assert(index <= IndexMask); 425Debug.Assert(slot > -1);
FlowAnalysis\ReadWriteWalker.cs (1)
95Debug.Assert(!ignoreThisParameter || m is SynthesizedPrimaryConstructor);
FlowAnalysis\UnassignedAddressTakenVariablesWalker.cs (1)
30Debug.Assert(!badRegion);
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (22)
41Debug.Assert(TypeSymbol.Equals(factory.CurrentType, (containingType ?? containingMethod.ContainingType), TypeCompareKind.ConsiderEverything2)); 117Debug.Assert(containingSymbol != null); 118Debug.Assert((object)containingType != null); 119Debug.Assert(statement != null); 120Debug.Assert(compilationState != null); 121Debug.Assert(diagnostics != null); 177Debug.Assert(SyntaxBindingUtilities.BindsToTryStatement(tryStatementSyntax)); 207Debug.Assert(asTry.FinallyBlockOpt == null); 408Debug.Assert(node.Label == _currentAwaitFinallyFrame.ProxyLabelIfNeeded(node.Label), "conditional leave?"); 603Debug.Assert(!_inCatchWithoutAwaits); 608Debug.Assert(node.Syntax.IsKind(SyntaxKind.CatchClause)); 618Debug.Assert(pendingCaughtExceptionType.IsObjectType()); 620Debug.Assert(c.IsImplicit); 621Debug.Assert(c.IsReference || c.IsIdentity); 645Debug.Assert(filterPrologueOpt is null); 740Debug.Assert(pendingExceptionRef.Type.IsObjectType()); 742Debug.Assert(c.IsReference || c.IsIdentity); 1026Debug.Assert(parent != null); 1027Debug.Assert(syntax != null); 1029Debug.Assert(SyntaxBindingUtilities.BindsToTryStatement(syntax)); 1094Debug.Assert(_syntaxOpt != null); 1154Debug.Assert(pendingCatch.SyntaxOpt.IsKind(SyntaxKind.TryStatement));
Lowering\AsyncRewriter\AsyncIteratorMethodToStateMachineRewriter.cs (7)
68Debug.Assert(asyncIteratorInfo != null); 204Debug.Assert(_currentDisposalLabel is object); 214Debug.Assert(_currentDisposalLabel is object); 254Debug.Assert(_exprReturnLabel.Equals(_currentDisposalLabel)); 304Debug.Assert(_currentDisposalLabel is object); // no yield return allowed inside a finally 317Debug.Assert(_asyncIteratorInfo != null); 323Debug.Assert(_currentDisposalLabel is object); // no yield break allowed inside a finally
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (4)
117Debug.Assert((object)builderType != null); 151Debug.Assert((object)builderType != null); 214Debug.Assert((object)builderType != null); 296Debug.Assert((object)builderType != null);
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (11)
293Debug.Assert(!CurrentMethod.IsIterator); // an override handles async-iterators 350Debug.Assert(node.AwaitableInfo.RuntimeAsyncAwaitCall is null); 377Debug.Assert(node.Syntax.IsKind(SyntaxKind.AwaitExpression) || node.WasCompilerGenerated); 429Debug.Assert(receiver != null); 437Debug.Assert(methodName != null); 494Debug.Assert(awaiterFieldType.IsObjectType() || TypeSymbol.Equals(awaiterFieldType, awaiterTempRef.Type, TypeCompareKind.AllIgnoreOptions)); 496Debug.Assert(c.IsImplicit); 497Debug.Assert(c.IsReference || c.IsIdentity); 536Debug.Assert(awaiterFieldRef.Type.IsObjectType() || TypeSymbol.Equals(awaiterTemp.Type, awaiterFieldRef.Type, TypeCompareKind.AllIgnoreOptions)); 538Debug.Assert(c.IsReference || c.IsIdentity); 685Debug.Assert(_method.IsAsyncEffectivelyReturningGenericTask(F.Compilation));
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (4)
45Debug.Assert(!TypeSymbol.Equals(method.IteratorElementTypeWithAnnotations.Type, null, TypeCompareKind.ConsiderEverything2)); 48Debug.Assert(_isEnumerable != method.IsAsyncReturningIAsyncEnumerator(method.DeclaringCompilation)); 160Debug.Assert(stateMachineType.Constructor is IteratorConstructor); 385Debug.Assert(!_asyncMethodBuilderMemberCollection.CheckGenericMethodConstraints);
Lowering\AsyncRewriter\AsyncRewriter.cs (1)
51Debug.Assert(compilationState.ModuleBuilderOpt != null);
Lowering\AsyncRewriter\RuntimeAsyncRewriter.cs (22)
68Debug.Assert(rewriter._factory.CurrentFunction is not null); 97Debug.Assert(factory.CurrentFunction != null); 134Debug.Assert(nodeType is not null); 144Debug.Assert(runtimeAsyncAwaitCall is not null); 145Debug.Assert(awaitableInfo.RuntimeAsyncAwaitCallPlaceholder is not null); 147Debug.Assert(runtimeAsyncAwaitMethod is not null); 148Debug.Assert(ReferenceEquals( 151Debug.Assert(runtimeAsyncAwaitMethod.Name is "Await" or "UnsafeAwaitAwaiter" or "AwaitAwaiter"); 189Debug.Assert(getAwaiter is not null); 200Debug.Assert(awaitableInfo.IsCompleted is not null); 202Debug.Assert(isCompletedMethod is not null); 206Debug.Assert(awaitableInfo.RuntimeAsyncAwaitCall is not null); 207Debug.Assert(awaitableInfo.RuntimeAsyncAwaitCallPlaceholder is not null); 218Debug.Assert(getResultMethod is not null); 244Debug.Assert(expr is not null); 329Debug.Assert(leftLocal.LocalSymbol.SynthesizedKind == SynthesizedLocalKind.Spill || 331Debug.Assert(node.IsRef); 387Debug.Assert(!_variablesToHoist.Contains(node.LocalSymbol)); 401Debug.Assert(!_variablesToHoist.Contains(node.ParameterSymbol)); 407Debug.Assert(_factory.CurrentFunction is not null); 409Debug.Assert(thisParameter is not null); 415Debug.Assert(thisParameter is not { Type.IsValueType: true, RefKind: RefKind.Ref });
Lowering\BoundTreeToDifferentEnclosingContextRewriter.cs (5)
40Debug.Fail($"Override the visitor for {node.Kind}"); 149Debug.Assert(node.RuntimeAsyncAwaitCall is null); 163Debug.Assert(node.InterpolatedStringHandlerData is null); 164Debug.Assert(!node.OperatorKind.IsDynamic()); 244Debug.Assert(node.Type.Equals(VisitType(node.Type), TypeCompareKind.ConsiderEverything));
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (7)
84Debug.Assert(scopeTree != null); 181Debug.Assert(!oldEnv.IsStruct); 182Debug.Assert(oldEnv.Parent == null || oldEnv.Parent == env); 343Debug.Assert(scope.DeclaredEnvironment is null); 384Debug.Assert(environmentsToScopes.ContainsKey(env)); 530Debug.Assert(syntax != null); 536Debug.Assert(_slotAllocator == null || environment.Parent is null || parentClosure is not null);
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (18)
82Debug.Assert(boundNode != null); 153Debug.Assert(value); 162Debug.Assert(symbol != null); 355Debug.Assert(rootScope != null); 356Debug.Assert(topLevelMethod != null); 357Debug.Assert(methodsConvertedToDelegates != null); 358Debug.Assert(diagnostics != null); 374Debug.Assert(node == FindNodeToAnalyze(node)); 375Debug.Assert(topLevelMethod != null); 407Debug.Assert(_labelsInScope.Count == 1); 608Debug.Assert( 632Debug.Assert(symbol.ContainingSymbol != null); 671Debug.Assert(_freeVariables.Contains(symbol)); 694Debug.Assert(capturedVariable.Kind == SymbolKind.Method); 700Debug.Assert(false); // Add test(s) for scenarios that hit this code path 745Debug.Assert(parentScope.BoundNode != node); 791Debug.Assert(!_localToScope.ContainsKey(local)); 795Debug.Assert(_freeVariables.Add(local));
Lowering\ClosureConversion\ClosureConversion.cs (40)
207Debug.Assert(localOrParameter is LocalSymbol || localOrParameter is ParameterSymbol || 246Debug.Assert(thisType is not null); 247Debug.Assert(thisParameter is null || TypeSymbol.Equals(thisParameter.Type, thisType, TypeCompareKind.ConsiderEverything2)); 248Debug.Assert(compilationState.ModuleBuilderOpt != null); 249Debug.Assert(diagnostics.DiagnosticBag != null); 322Debug.Assert(_addedStatements == null); 359Debug.Assert(!_frames.ContainsKey(scope.BoundNode)); 383Debug.Assert(syntax != null); 405Debug.Assert(!proxies.ContainsKey(captured)); 472Debug.Assert((object)translatedLambdaContainer != _topLevelMethod.ContainingType || 595Debug.Assert(TypeSymbol.Equals(result.Type, frameType, TypeCompareKind.ConsiderEverything2)); 609Debug.Assert(frameClass.IsDefinition); 680Debug.Assert(frame.ScopeSyntaxOpt != null); 692Debug.Assert(TypeSymbol.Equals(frameType, constructor.ContainingType, TypeCompareKind.ConsiderEverything2)); 715Debug.Assert(capturedFrame.Type.IsReferenceType); // Make sure we're not accidentally capturing a struct by value 819Debug.Assert(_thisProxyInitDeferred == null); 824Debug.Assert(_currentMethod is not SynthesizedPrimaryConstructor primaryConstructor || 891Debug.Assert(localFunc.MethodKind == MethodKind.LocalFunction); 901Debug.Assert(!arguments.IsDefault); 914Debug.Assert(frameType is SynthesizedClosureEnvironment); 919Debug.Assert(typeParameters.Length == frameType.Arity); 977Debug.Assert(!typeArguments.IsDefault); 1013Debug.Assert((object)oldTypeArg.Type == newTypeArg.Type); 1017Debug.Assert(oldTypeArg.NullableAnnotation == newTypeArg.NullableAnnotation); 1038Debug.Assert((typeArgumentsOpt.IsDefault && !originalMethod.IsGenericMethod) || (typeArgumentsOpt.Length == originalMethod.Arity)); 1064Debug.Assert(realTypeArguments.Length == 0); 1092Debug.Assert(node.ArgsToParamsOpt.IsDefault, "should be done with argument reordering by now"); 1215Debug.Assert(!node.Locals.IsEmpty); 1269Debug.Assert(rewrittenFilter != null); 1379Debug.Assert(node.TargetMethod is { RequiresInstanceReceiver: false, IsStatic: true }); 1391Debug.Assert(arguments.IsDefault && 1405Debug.Assert(_inExpressionLambda || conversion.Conversion.MethodSymbol is null); 1407Debug.Assert(conversion.ConversionKind != ConversionKind.MethodGroup); 1455Debug.Assert(syntax != null); 1456Debug.Assert(CompilationState.ModuleBuilderOpt != null); 1457Debug.Assert(closureOrdinal >= LambdaDebugInfo.MinClosureOrdinal); 1486Debug.Assert(closureKind == ClosureKind.Singleton); 1495Debug.Assert(!isLambdaBody || LambdaUtilities.IsLambdaBody(lambdaOrLambdaBodySyntax)); 1536Debug.Assert(synthesizedMethod != null); 1555Debug.Assert(tmpScope != null);
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (27)
134Debug.Assert(block.Locals.IsEmpty); 178Debug.Assert(c.IsImplicit); 179Debug.Assert(c.IsReference || c.IsIdentity); 199Debug.Assert(!binOp.OperatorKind.IsDynamic()); 280Debug.Assert(saveRecursionDepth == _recursionDepth); 377Debug.Assert(node.OperandPlaceholder is null); 378Debug.Assert(node.OperandConversion is null); 629Debug.Assert(useSiteInfo.Diagnostics.IsNullOrEmpty()); 777Debug.Assert(c.IsImplicit); 778Debug.Assert(c.IsBoxing); 899Debug.Assert(node.LeftPlaceholder is not null); 939Debug.Assert(c.IsImplicit); 940Debug.Assert(c.IsReference); 949Debug.Assert(c.IsImplicit); 950Debug.Assert(c.IsReference); 966Debug.Assert(c.IsImplicit); 967Debug.Assert(c.IsReference); 976Debug.Assert(c.IsImplicit); 977Debug.Assert(c.IsReference); 1000Debug.Assert((object)sym != null); 1045Debug.Assert(ci.Initializers.Length != 0); 1111Debug.Assert(args.Type.IsSZArray()); 1113Debug.Assert(c.IsImplicit); 1114Debug.Assert(c.IsReference); 1239Debug.Assert((object)node.MethodOpt == null); 1257Debug.Assert(c.IsImplicit); 1258Debug.Assert(c.IsBoxing || c.IsReference || c.IsIdentity);
Lowering\ClosureConversion\LambdaCapturedVariable.cs (5)
33Debug.Assert(type.HasType); 48Debug.Assert(captured is LocalSymbol || captured is ParameterSymbol); 98Debug.Assert(local.SynthesizedKind != SynthesizedLocalKind.LocalStoreTracker); 112Debug.Assert(variable.Name != null); 183Debug.Assert(parameter is { IsThis: false });
Lowering\ClosureConversion\SynthesizedClosureEnvironment.cs (1)
106Debug.Assert(methodId.Ordinal >= 0);
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (2)
45Debug.Assert(containingType.DeclaringCompilation is not null); 108Debug.Assert(originalMethod is not { MethodKind: MethodKind.LocalFunction } || !originalMethod.IsStatic || IsStatic);
Lowering\DiagnosticsPass_ExpressionTrees.cs (11)
33Debug.Assert(node != null); 34Debug.Assert((object)containingSymbol != null); 51Debug.Assert(diagnostics != null); 52Debug.Assert((object)containingSymbol != null); 208Debug.Assert(symbol.Kind == SymbolKind.Local || symbol.Kind == SymbolKind.Parameter || symbol is LocalFunctionSymbol); 316Debug.Assert((object)method != null); 317Debug.Assert(((object)propertyAccess == null) || 347Debug.Assert(_compilation.IsFeatureEnabled(MessageID.IDS_FeatureExpressionOptionalAndNamedArguments)); 779Debug.Assert(!node.TrueOperator.IsExtensionBlockMember()); 780Debug.Assert(!node.FalseOperator.IsExtensionBlockMember()); 951Debug.Assert(!(!parentIsConversion && _inExpressionLambda));
Lowering\DiagnosticsPass_Warnings.cs (13)
25Debug.Assert(arguments.Length == argumentRefKindsOpt.Length); 228Debug.Assert(TypeSymbol.Equals(expr1.Type, expr2.Type, TypeCompareKind.ConsiderEverything2)); 305Debug.Assert(node != null); 382Debug.Assert(node != null); 383Debug.Assert(node.OperatorKind.IsComparison()); 393Debug.Assert(tree != null); 394Debug.Assert(constantValue != null); 395Debug.Assert(operand != null); 667Debug.Assert(false, "How did we get here?"); 719Debug.Assert(node != null); 734Debug.Assert(node != null); 781Debug.Assert(node != null); 911Debug.Assert(length == rightTuple.Arguments.Length);
Lowering\ExtensionMethodBodyRewriter.cs (7)
34Debug.Assert(sourceMethod is not null); 35Debug.Assert(implementationMethod is not null); 36Debug.Assert(sourceMethod == (object)implementationMethod.UnderlyingMethod); 43Debug.Assert(implementationMethod.ParameterCount - 1 == sourceMethod.ParameterCount); 48Debug.Assert(_rewrittenContainingMethod is not null); 56Debug.Assert(symbol.Parameters.Length == rewrittenParameters.Length); 187Debug.Assert(symbol?.IsExtensionBlockMember() != true);
Lowering\ExtensionMethodReferenceRewriter.cs (10)
36Debug.Assert(node != null); 77Debug.Assert(node.Method.MethodKind == MethodKind.LocalFunction || node.Method.IsStatic || node.ReceiverOpt is not null); 102Debug.Assert(boundCall.Method.OriginalDefinition.TryGetCorrespondingExtensionImplementationMethod() == (object)method.OriginalDefinition); 103Debug.Assert(!boundCall.Method.IsStatic); 123Debug.Assert(receiverOpt.Type!.Equals(method.Parameters[0].Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 168Debug.Assert(method?.IsExtensionBlockMember() != true || 221Debug.Assert(node.MethodOpt!.OriginalDefinition.TryGetCorrespondingExtensionImplementationMethod() == (object)methodOpt.OriginalDefinition); 249Debug.Assert(node.InterpolatedStringHandlerData is null); 250Debug.Assert(!node.OperatorKind.IsDynamic()); 271Debug.Assert(symbol?.IsExtensionBlockMember() != true);
Lowering\Extensions.cs (3)
34Debug.Assert(expr != null); 78Debug.Assert(expr != null); 131Debug.Assert(expr != null);
Lowering\InitializerRewriter.cs (5)
21Debug.Assert(!boundInitializers.IsDefault); 22Debug.Assert((method.MethodKind == MethodKind.Constructor) || (method.MethodKind == MethodKind.StaticConstructor)); 31Debug.Assert(!boundInitializers.IsDefault); 65Debug.Assert(!submissionResultType.IsVoidType()); 115Debug.Assert(LocalRewriter.IsFieldOrPropertyInitializer(boundStatement));
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (4)
143Debug.Assert(method.MethodKind != MethodKind.LocalFunction && method.MethodKind != MethodKind.AnonymousFunction); 417Debug.Assert(returnStatement.ExpressionOpt.Syntax.Parent != null); 441Debug.Assert(whenClause != null); 625Debug.Assert(keyword.Node != null || type != null);
Lowering\Instrumentation\CompoundInstrumenter.cs (1)
25Debug.Assert(previous != null);
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (9)
31Debug.Assert(declarationSyntax.Initializer != null); 56Debug.Assert(startFallbackOpt != default || endOpt != default); 90Debug.Assert(declaratorSyntax.Parent != null); 92Debug.Assert(declarationSyntax.Parent != null); 110Debug.Assert(!modifiers.Any(SyntaxKind.ConstKeyword)); // const locals don't have a sequence point 145Debug.Assert(declaratorSyntax.Parent != null); 149Debug.Assert(declarationSyntax.Parent != null); 174Debug.Assert(condition.Type is not null); 198Debug.Assert(condition.ConstantValueOpt != null ||
Lowering\Instrumentation\DebugInfoInjector.cs (8)
65Debug.Assert(ctorDecl.Initializer == null); 70Debug.Assert(ctorDecl.Body != null); 95Debug.Assert(typeDecl.ParameterList != null); 96Debug.Assert(typeDecl.BaseList?.Types.Any(t => t is PrimaryConstructorBaseTypeSyntax { ArgumentList: not null }) != true); 141Debug.Assert(syntax is { Parent: { Parent: { } } }); 414Debug.Assert(parameterSyntax is { Parent.Parent: RecordDeclarationSyntax }); 440Debug.Assert(whenClause != null); 481Debug.Assert(filterClause is not null);
Lowering\Instrumentation\Instrumenter.cs (47)
39Debug.Assert(!original.WasCompilerGenerated); 50Debug.Assert(!original.WasCompilerGenerated || original.Syntax.Kind() == SyntaxKind.Block); 103Debug.Assert(LocalRewriter.IsFieldOrPropertyInitializer(original)); 114Debug.Assert(!original.WasCompilerGenerated); 115Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 116Debug.Assert(factory != null); 122Debug.Assert(!original.WasCompilerGenerated); 123Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 124Debug.Assert(factory != null); 130Debug.Assert(!original.WasCompilerGenerated); 131Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 137Debug.Assert(!original.WasCompilerGenerated); 138Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 145Debug.Assert(!original.WasCompilerGenerated); 146Debug.Assert(original.Syntax is CommonForEachStatementSyntax); 152Debug.Assert(original.Syntax is CommonForEachStatementSyntax); 158Debug.Assert(!original.WasCompilerGenerated); 159Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachStatement); 165Debug.Assert(!original.WasCompilerGenerated); 166Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachVariableStatement); 172Debug.Assert(!original.WasCompilerGenerated); 173Debug.Assert(original.Syntax is CommonForEachStatementSyntax); 179Debug.Assert(!original.WasCompilerGenerated); 180Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 186Debug.Assert(!original.WasCompilerGenerated); 187Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 188Debug.Assert(factory != null); 194Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 200Debug.Assert(!original.WasCompilerGenerated); 201Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 202Debug.Assert(factory != null); 208Debug.Assert(original.Syntax.Kind() == SyntaxKind.LabeledStatement); 214Debug.Assert(original.Syntax.Kind() == SyntaxKind.VariableDeclarator || 222Debug.Assert(original.Left is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } or BoundParameter); 258Debug.Assert(!original.WasCompilerGenerated); 259Debug.Assert(original.Syntax.Kind() == SyntaxKind.LockStatement); 270Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement); 281Debug.Assert(!original.WasCompilerGenerated); 282Debug.Assert(original.Syntax.FirstAncestorOrSelf<WhenClauseSyntax>() != null); 288Debug.Assert(!original.WasCompilerGenerated); 289Debug.Assert(original.Syntax.Kind() == SyntaxKind.UsingStatement); 302Debug.Assert(original.Syntax.Kind() == SyntaxKind.CatchClause); 307Debug.Assert(original.Kind == BoundKind.SwitchStatement); 308Debug.Assert(!original.WasCompilerGenerated); 309Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement); 310Debug.Assert(factory != null); 319Debug.Assert(factory != null);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (15)
114Debug.Assert(_lazyPreviousContextVariables?.IsEmpty != false); 259Debug.Assert(enumDelta == 0 || overloadOpt.Value != WellKnownMember.Microsoft_CodeAnalysis_Runtime_LocalStoreTracker__LogLocalStoreLocalAlias); 264Debug.Assert(symbol?.IsGenericMethod != true); 298Debug.Assert(_factory.TopLevelMethod is not null); 299Debug.Assert(_factory.CurrentFunction is not null); 364Debug.Assert(original.Left is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } or BoundParameter); 427Debug.Assert(!parameterSymbol.IsDiscard); 449Debug.Assert(index is BoundParameterId or BoundLocalId or BoundLiteral); 455Debug.Assert(parameter.RefKind == RefKind.None); 460Debug.Assert(!parameter.Type.IsManagedTypeNoUseSiteDiagnostics); 482Debug.Assert(targetType.IsStructType()); 490Debug.Assert(c.IsNumeric || c.IsReference || c.IsIdentity || c.IsPointer || c.IsBoxing || c.IsEnumeration); 561Debug.Assert(original.ReceiverOpt is not null); 576Debug.Assert(refKinds.IsDefault || arguments.Length == refKinds.Length); 577Debug.Assert(invocation.Type is not null);
Lowering\Instrumentation\ModuleCancellationInstrumenter.cs (2)
80Debug.Assert(_factory.TopLevelMethod is not null); 81Debug.Assert(_factory.CurrentFunction is not null);
Lowering\Instrumentation\StackOverflowProbingInstrumenter.cs (2)
70Debug.Assert(_factory.TopLevelMethod is not null); 71Debug.Assert(_factory.CurrentFunction is not null);
Lowering\IteratorRewriter\IteratorFinallyMethodSymbol.cs (2)
37Debug.Assert((object)stateMachineType != null); 38Debug.Assert(name != null);
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.cs (8)
291Debug.Assert(body != null, "we should have either sub-dispatch or a handler"); 361Debug.Assert(node.Label == proxyLabel || !(F.CurrentFunction is IteratorFinallyMethodSymbol), "should not be proxying branches in finally"); 367Debug.Assert(node.Label == _currentFinallyFrame.ProxyLabelIfNeeded(node.Label), "conditional leave?"); 388Debug.Assert(node.CatchBlocks.IsEmpty, "try with yields must have no catches"); 389Debug.Assert(node.FinallyBlockOpt != null, "try with yields must have finally"); 396Debug.Assert(!frame.IsRoot()); 397Debug.Assert(frame.parent.knownStates.ContainsValue(frame), "parent must be aware about states in the child frame"); 414Debug.Assert(frame.parent.finalizeState == _currentFinallyFrame.finalizeState);
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.IteratorFinallyFrame.cs (2)
49Debug.Assert(parent != null, "non root frame must have a parent"); 50Debug.Assert((object)handler != null, "non root frame must have a handler");
Lowering\IteratorRewriter\IteratorRewriter.cs (2)
175Debug.Assert(F.ModuleBuilderOpt is not null); 277Debug.Assert(stateMachineType.Constructor is IteratorConstructor);
Lowering\LocalRewriter\DelegateCacheContainer.cs (7)
25Debug.Assert(containingType.IsDefinition); 38Debug.Assert(containingType.IsDefinition); 39Debug.Assert(owner.IsDefinition); 40Debug.Assert(owner is NamedTypeSymbol { Arity: > 0 } or MethodSymbol { Arity: > 0 }); 65Debug.Assert(delegateType.IsDelegateType()); 66Debug.Assert(targetMethod is { }); 83Debug.Assert(_constructedContainer is { });
Lowering\LocalRewriter\DelegateCacheRewriter.cs (7)
28Debug.Assert(factory.TopLevelMethod is { }); 38Debug.Assert(targetMethod is { }); 45Debug.Assert(boundDelegateCreation.MethodOpt is { }); 63Debug.Assert(_factory.ModuleBuilderOpt is { }); 64Debug.Assert(_factory.CurrentFunction is { }); 126Debug.Assert(targetMethod is { }); 167Debug.Assert(targetMethod.MethodKind == MethodKind.Ordinary);
Lowering\LocalRewriter\DynamicSiteContainer.cs (1)
22Debug.Assert(topLevelMethod != null);
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (7)
28Debug.Assert(result is { }); 42Debug.Assert(rewrittenTargetType.Type.Equals(rewrittenType)); 45Debug.Assert(!rewrittenType.IsValueType || rewrittenType.IsNullableType()); 62Debug.Assert(constantValue.IsNull); 85Debug.Assert(operandPlaceholder is not null); 86Debug.Assert(operandConversion is not null); 90Debug.Assert(result.Type!.Equals(rewrittenType, TypeCompareKind.ConsiderEverything));
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (18)
50Debug.Assert(!node.IsRef); 129Debug.Assert(eventAccess.IsUsableAsField); 194Debug.Assert(!isRef); 198Debug.Assert(!property.IsIndexer); 215Debug.Assert(!isRef); 220Debug.Assert(indexer.IsIndexer || indexer.IsIndexedProperty); 239Debug.Assert(!isRef || rewrittenLeft.GetRefKind() != RefKind.None); 276Debug.Assert(!isRef); 316Debug.Assert(autoProp.IsAutoPropertyOrUsesFieldKeyword, 318Debug.Assert(_factory.CurrentFunction.IsConstructor()); 319Debug.Assert(property.Equals(autoProp, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 364Debug.Assert(receiverIsKnownToBeCaptured || rewrittenReceiverBeforePossibleCapture != (object?)rewrittenReceiver); 366Debug.Assert(storesOpt is { }); 367Debug.Assert(receiverIsKnownToBeCaptured || storesOpt.Count != 0); 368Debug.Assert(receiverIsKnownToBeCaptured || argTempsBuilder is not null); 404Debug.Assert(exprType is object); 441Debug.Assert(sideEffects.IsEmpty); 459Debug.Assert(newElement is { });
Lowering\LocalRewriter\LocalRewriter_BasePatternSwitchLocalRewriter.cs (1)
31Debug.Assert(sectionSyntax is { });
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (74)
118Debug.Assert(node.Type.SpecialType == SpecialType.System_String, "Non-string binary addition should have been handled by VisitConversion or VisitArguments"); 125Debug.Assert(applyParentUnaryOperator is null); 131Debug.Assert(applyParentUnaryOperator is null); 147Debug.Assert(stack.Count >= 1); 169Debug.Assert(node.OperatorKind == BinaryOperatorKind.StringConcatenation); 170Debug.Assert(node.InterpolatedStringHandlerData is not null); 209Debug.Assert(oldNode == null || (oldNode.Syntax == syntax)); 234Debug.Assert(!isPointerElementAccess); 242Debug.Assert(method is null); 340Debug.Assert(loweredLeft.Type is { }); 341Debug.Assert(loweredRight.Type is { }); 354Debug.Assert(loweredLeft.Type is { }); 355Debug.Assert(loweredRight.Type is { }); 368Debug.Assert(loweredLeft.Type is { }); 369Debug.Assert(loweredRight.Type is { }); 539Debug.Assert(!operatorKind.IsDynamic()); 577Debug.Assert(loweredLeft.Type is { }); 614Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.And || operatorKind.Operator() == BinaryOperatorKind.Or); 631Debug.Assert(applyParentUnaryOperator == null || applyParentUnaryOperator.OperatorKind == testOperator); 637Debug.Assert(leftTruthOperator == null); 712Debug.Assert(temp is { }); 737Debug.Assert(leftTruthOperator == null); 750Debug.Assert(leftTruthOperator == null); 768Debug.Assert(leftTruthOperator != null); 772Debug.Assert(conversion.IsImplicit); 795Debug.Assert(!operatorKind.IsLogical()); 803Debug.Assert(method is { }); 804Debug.Assert(TypeSymbol.Equals(method.ReturnType, type, TypeCompareKind.ConsiderEverything2)); 822Debug.Assert(left != null); 823Debug.Assert(right != null); 865Debug.Assert(nonNull is { }); 909Debug.Assert(expression.Type is { }); 932Debug.Assert(expression.Type is { }); 946Debug.Assert(expression.Type is { }); 1023Debug.Assert(yNonNull is null, "Handled by trivial optimization above; otherwise we should use yNonNull here."); 1036Debug.Assert(xNonNull is null, "Handled by trivial optimization above; otherwise we should use xNonNull here."); 1324Debug.Assert(left != null); 1325Debug.Assert(right != null); 1392Debug.Assert(!(leftAlwaysNull && rightAlwaysNull)); // We've already optimized this case. 1633Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2)); 1634Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1635Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1685Debug.Assert(!(leftAlwaysNull && rightAlwaysNull)); // We've already optimized this case. 1708Debug.Assert(alwaysNull.Type is { }); 1750Debug.Assert(conditionalExpression.Type is { }); 1784Debug.Assert(leftNonNull == null || rightNonNull == null); // We've already optimized the case where they are both non-null. 1785Debug.Assert(!NullableNeverHasValue(left) && !NullableNeverHasValue(right)); // We've already optimized the case where one is null. 1926Debug.Assert(nullableType2 is { }); 1958Debug.Assert(loweredLeft != null); 1959Debug.Assert(loweredRight != null); 1960Debug.Assert((object)returnType != null); 1961Debug.Assert(returnType.SpecialType == SpecialType.System_Boolean); 1962Debug.Assert(loweredLeft.IsLiteralNull() != loweredRight.IsLiteralNull()); 2022Debug.Assert((object)method != null); 2047Debug.Assert((object)method != null); 2059Debug.Assert(loweredLeft.Type is { SpecialType: SpecialType.System_Decimal }); 2060Debug.Assert(loweredRight.Type is { SpecialType: SpecialType.System_Decimal }); 2083Debug.Assert((object)method != null); 2090Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 2096Debug.Assert( 2156Debug.Assert(loweredRight.Type is { }); 2158Debug.Assert(rightType.SpecialType == SpecialType.System_Int32); 2223Debug.Assert(loweredLeft.Type is { }); 2225Debug.Assert(leftType.SpecialType is SpecialType.System_IntPtr or SpecialType.System_UIntPtr); 2228Debug.Assert(loweredRight.Type is { }); 2230Debug.Assert(rightType.SpecialType == SpecialType.System_Int32); 2279Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2284Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2290Debug.Assert(kind.Operator() == BinaryOperatorKind.Addition); 2324Debug.Assert(sizeOfExpression.Type is { SpecialType: SpecialType.System_Int32 }); 2334Debug.Assert(numericOperand.Type is { }); 2471Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2472Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2473Debug.Assert(returnType.SpecialType == SpecialType.System_Int64);
Lowering\LocalRewriter\LocalRewriter_Call.cs (80)
43Debug.Assert(methodGroup.ReceiverOpt == null || methodGroup.ReceiverOpt.Kind != BoundKind.TypeOrValueExpression); 49Debug.Assert(node.ApplicableMethods.All(m => !m.RequiresInstanceReceiver && TypeSymbol.Equals(m.ContainingType, firstContainer, TypeCompareKind.ConsiderEverything2))); 56Debug.Assert(_factory.CurrentType is { }); 57Debug.Assert(!_factory.CurrentType.IsExtension); // When binding a simple name for a call, you cannot get a member inside an extension type 86Debug.Assert(loweredReceiver != null); 163Debug.Assert(nameSyntax != null); 164Debug.Assert(interceptor.IsDefinition); 165Debug.Assert(!interceptor.ContainingType.IsGenericType); 201Debug.Assert(containingMethod is not null); 214Debug.Assert(receiverOpt is not BoundTypeExpression || method.IsStatic); 289Debug.Assert(methodThisParameter is not null); 290Debug.Assert(receiverOpt?.Type is not null); 296Debug.Assert(receiverOpt.Type.Equals(interceptor.Parameters[0].Type, TypeCompareKind.AllIgnoreOptions) 338Debug.Assert(node != null); 389Debug.Assert(invokedAsExtensionMethod && !arguments.IsEmpty); 446Debug.Assert(node.ReceiverOpt is null); 472Debug.Assert(rewrittenArguments.Length == 2); 525Debug.Assert(rewrittenBoundCall.Type is not null); 573Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression)); 624Debug.Assert(false, "Not expected to survive lowering."); 632Debug.Assert(false, "Unexpected conversion kind" + conv.ConversionKind); 676Debug.Assert(argumentRefKindsOpt.IsDefault || argumentRefKindsOpt.Length == arguments.Length); 678Debug.Assert(!requiresInstanceReceiver || rewrittenReceiver != null || _inExpressionLambda); 679Debug.Assert(!forceReceiverCapturing || (requiresInstanceReceiver && rewrittenReceiver != null && storesOpt is object)); 680Debug.Assert(!forceReceiverCapturing || methodOrIndexer is PropertySymbol); 688Debug.Assert(!_inExpressionLambda); 689Debug.Assert(rewrittenReceiver is object); 690Debug.Assert(rewrittenReceiver.Type is { }); 793Debug.Assert(saveTempsOpt is object || tempsOpt?.Count is null or > 0); 800Debug.Assert(assignmentToTemp is object); 801Debug.Assert(tempsOpt is object); 858Debug.Assert(!_inExpressionLambda); 863Debug.Assert(!((BoundConversion)argument).ExplicitCastInCode); 869Debug.Assert(!argumentsAssignedToTemp.IsNull); 875Debug.Assert(argIndex < argumentIndex); 882Debug.Assert(usesReceiver(argument)); 883Debug.Assert(requiresInstanceReceiver); 884Debug.Assert(receiverTemp is object); 898Debug.Assert(visitedArgumentsBuilder[argIndex] != null); 935Debug.Assert(!((BoundConversion)argument).ExplicitCastInCode); 953Debug.Assert(rewrittenReceiver.Type is { }); 954Debug.Assert(methodOrIndexer.ContainingType.ExtensionParameter is { }); 995Debug.Assert(assignmentToTemp.IsRef); 998Debug.Assert(receiverType is object); 1034Debug.Assert(SpillSequenceSpiller.IsComplexConditionalInitializationOfReceiverRef(assignmentToTemp, out _, out _, out _, out _)); 1051Debug.Assert(CodeGenerator.ReceiverIsKnownToReferToTempIfReferenceType(receiverTemp)); 1077Debug.Assert(rewrittenArguments.All(arg => arg is not BoundDiscardExpression), "Discards should have been substituted by VisitArguments"); 1082Debug.Assert(expanded ? rewrittenArguments.Length == parameters.Length : rewrittenArguments.Length >= parameters.Length); 1083Debug.Assert(rewrittenArguments.Count(a => a.IsParamsArrayOrCollection) <= (expanded ? 1 : 0)); 1189Debug.Assert(actualArguments.All(static arg => arg is not null)); 1240Debug.Assert(argumentRefKindsOpt.IsDefault || argumentRefKindsOpt.Length >= parameters.Length); 1249Debug.Assert(!argumentRefKindsOpt.IsEmpty); 1271Debug.Assert(initialArgRefKind is RefKind.None or RefKind.In or RefKind.Ref); 1286Debug.Assert(comRefKindMismatchPossible); 1310Debug.Assert(rewrittenArguments.Length == methodOrIndexer.GetParameterCount() + 1); 1311Debug.Assert(argsToParamsOpt.IsDefault); 1334Debug.Assert(methodOrIndexer.ContainingType.ExtensionParameter is not null); 1357Debug.Assert(paramsArray.IsParamsArrayOrCollection); 1411Debug.Assert(refKinds.Count == arguments.Length); 1412Debug.Assert(storesToTemps.Count == 0); 1413Debug.Assert(rewrittenArguments.Length == parameters.Length); 1414Debug.Assert(rewrittenArguments.Count(a => a.IsParamsArrayOrCollection) <= (expanded ? 1 : 0)); 1423Debug.Assert(arguments[p] == null); 1427Debug.Assert(expanded); 1428Debug.Assert(p == parameters.Length - 1); 1429Debug.Assert(argRefKind == RefKind.None); 1448Debug.Assert(arguments[p].IsParamsArrayOrCollection); 1543Debug.Assert(arguments != null); 1544Debug.Assert(storesToTemps != null); 1545Debug.Assert(temporariesBuilder != null); 1572Debug.Assert(arguments != null); 1573Debug.Assert(tempStores != null); 1613Debug.Assert(firstUnclaimedStore == tempStores.Count, "not all side-effects were claimed"); 1639Debug.Assert(value.Type is { }); 1691Debug.Assert(actualArguments != null); 1692Debug.Assert(actualArguments.Length == parameters.Length); 1694Debug.Assert(argsRefKindsBuilder != null); 1695Debug.Assert(argsRefKindsBuilder.Count == parameters.Length); 1721Debug.Assert(localRefKind == RefKind.None); 1748Debug.Assert(node.TypeArgumentsOpt.IsDefault);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (78)
31Debug.Assert(conversion.Kind == ConversionKind.CollectionExpression); 32Debug.Assert(!_inExpressionLambda); 33Debug.Assert(_additionalLocals is { }); 34Debug.Assert(node.Type is { }); 82Debug.Assert(elementType is { }); 128Debug.Assert(spreadElement.IteratorBody is { }); 146Debug.Assert(spreadElement.IteratorBody is { }); 148Debug.Assert(iteratorBody is { }); 161Debug.Assert(result is { }); 185Debug.Assert(singleSpread.Expression.Type is not null); 202Debug.Assert(targetEnumerableType.OriginalDefinition == (object)_compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T)); 256Debug.Assert(!_inExpressionLambda); 257Debug.Assert(_additionalLocals is { }); 258Debug.Assert(node.Placeholder is null); 259Debug.Assert(collectionType is ArrayTypeSymbol or NamedTypeSymbol); 273Debug.Assert(namedType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Span_T)) || 280Debug.Assert(collectionType.OriginalDefinition == (object)_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T) || 320Debug.Assert(isReadOnlySpan 337Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, CollectionExpressionTypeKind.ReadOnlySpan, elementType.Type, _compilation)); 347Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, isReadOnlySpan ? CollectionExpressionTypeKind.ReadOnlySpan : CollectionExpressionTypeKind.Span, elementType.Type, _compilation)); 360Debug.Assert(isReadOnlySpan 384Debug.Assert(conversionKind == ConversionKind.Identity || (isReadOnlySpan && conversionKind == ConversionKind.ImplicitReference)); 408Debug.Assert(list.Type is { }); 409Debug.Assert(list.Type.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T), TypeCompareKind.AllIgnoreOptions)); 421Debug.Assert(!_inExpressionLambda); 426Debug.Assert(rewrittenReceiver is { }); 435Debug.Assert(placeholder is { }); 483Debug.Assert(!_inExpressionLambda); 484Debug.Assert(_factory.ModuleBuilderOpt is { }); 485Debug.Assert(_diagnostics.DiagnosticBag is { }); 486Debug.Assert(node.Type is NamedTypeSymbol); 487Debug.Assert(node.Placeholder is null); 488Debug.Assert(node.Type.IsArrayInterface(out _)); 498Debug.Assert(node.CollectionCreation is null); 505Debug.Assert(numberIncludingLastSpread == 0); 545Debug.Assert(collectionType.IsMutableArrayInterface(out _)); 551Debug.Assert(node.CollectionCreation is null or BoundObjectCreationExpression); 561Debug.Assert(c.IsImplicit); 562Debug.Assert(c.IsReference || c.IsIdentity); 567Debug.Assert(node.Type.OriginalDefinition.SpecialType is 581Debug.Assert(!_inExpressionLambda); 582Debug.Assert(node.Type is { }); 583Debug.Assert(node.CollectionCreation is { }); 584Debug.Assert(node.Placeholder is null); 585Debug.Assert(node.CollectionBuilderMethod is { }); 586Debug.Assert(node.CollectionBuilderElementsPlaceholder is { }); 593Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 642Debug.Assert(elements.Length > 0); 643Debug.Assert(elements.All(e => e is BoundExpression)); 644Debug.Assert(_factory.ModuleBuilderOpt is { }); 645Debug.Assert(_diagnostics.DiagnosticBag is { }); 646Debug.Assert(_compilation.Assembly.RuntimeSupportsInlineArrayTypes); 647Debug.Assert(_additionalLocals is { }); 668Debug.Assert(inlineArrayType.HasInlineArrayAttribute(out int inlineArrayLength) && inlineArrayLength == arrayLength); 709Debug.Assert(span.Type is { }); 839Debug.Assert(TryOptimizeSingleSpreadToArray_NoConversionApplied(node, targetsReadOnlyCollection: false, arrayType) is null); 904Debug.Assert(arrayTemp.Type is ArrayTypeSymbol); 947Debug.Assert(indexTemp is not null); 1036Debug.Assert(type is not null); 1132Debug.Assert((object)spreadOperandAsSpan != rewrittenSpreadOperand || spreadOperandAsSpan is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.LoweringTemp }); 1161Debug.Assert(!_inExpressionLambda); 1236Debug.Assert(useKnownLength); 1237Debug.Assert(setCount is { }); 1238Debug.Assert(asSpan is { }); 1239Debug.Assert(knownLengthTemp is { }); 1275Debug.Assert(spanTemp.Type is NamedTypeSymbol); 1318Debug.Assert(indexTemp is not null); 1345Debug.Assert(rewrittenSpreadOperand.Type is not null); 1426Debug.Assert(statements.Length > 0); 1443Debug.Assert(rewrittenExpressions.Count >= numberIncludingLastSpread); 1454Debug.Assert(collectionPlaceholder is { }); 1459Debug.Assert(lengthAccess is { }); 1478Debug.Assert(sum is { }); 1500Debug.Assert(enumeratorInfo is { }); 1501Debug.Assert(convertedExpression is { }); 1502Debug.Assert(expressionPlaceholder is { }); 1503Debug.Assert(elementPlaceholder is { }); 1504Debug.Assert(iteratorBody is { });
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (42)
24Debug.Assert(TypeSymbol.Equals(node.Right.Type, node.Operator.RightType, TypeCompareKind.ConsiderEverything2)); 38Debug.Assert(node.Operator.Method is { }); 39Debug.Assert(node.LeftConversion is null || (node.Left.Type!.IsReferenceType && node.Operator.Method.IsExtensionBlockMember())); 40Debug.Assert(node.FinalConversion is null); 54Debug.Assert(leftType is { }); 55Debug.Assert(TypeSymbol.Equals(leftType, node.Type, TypeCompareKind.AllIgnoreOptions)); 77Debug.Assert(node.LeftConversion is null); 116Debug.Assert(!IsBinaryStringConcatenation(binaryOperator)); 153Debug.Assert(rewrittenAssignment.Type is { }); 165Debug.Assert(rewrittenAssignment.Type is { }); 196Debug.Assert(node.LeftPlaceholder is not null); 206Debug.Assert(!rightIsVisited); 207Debug.Assert(node.Operator.ReturnType is { SpecialType: SpecialType.System_String }); 216Debug.Assert(node.Left.Type is { }); 221Debug.Assert(node.FinalPlaceholder is not null); 228Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.Left.Type, TypeCompareKind.AllIgnoreOptions)); 236Debug.Assert(assignment.Type is { }); 264Debug.Assert(propertyOrEvent.Kind == SymbolKind.Property || propertyOrEvent.Kind == SymbolKind.Event); 290Debug.Assert(receiverOpt.Kind != BoundKind.TypeExpression); 293Debug.Assert(rewrittenReceiver.Type is { }); 370Debug.Assert(receiverOpt != null); 429Debug.Assert(temps is object); 499Debug.Assert(array is BoundArrayCreation); 520Debug.Assert(actualArguments.All(static arg => arg is not null)); 555Debug.Assert(implicitIndexerAccess.IndexerOrSliceAccess.GetRefKind() == RefKind.None); 564Debug.Assert(receiverIsKnownToBeCaptured); 594Debug.Assert(fieldOrEvent.Kind == SymbolKind.Field || fieldOrEvent.Kind == SymbolKind.Event); 602Debug.Assert(receiver is { Type: { } }); 612Debug.Assert(receiver.Type.IsReferenceType); 613Debug.Assert(receiver.Kind != BoundKind.TypeExpression); 616Debug.Assert(rewrittenReceiver.Type is { }); 755Debug.Assert(Binder.IsWellKnownSystemIndex(implicitIndexerAccess.Argument.Type, _compilation) 811Debug.Assert(originalLHS.GetRefKind() == RefKind.Ref); 827Debug.Assert((object)result == originalLHS || IsCapturedPrimaryConstructorParameter(originalLHS)); // If this fails, we might need to add tests for new scenarios and relax the assert. 832Debug.Assert(((BoundCall)originalLHS).Method.RefKind != RefKind.None); 836Debug.Assert(((BoundFunctionPointerInvocation)originalLHS).FunctionPointer.Signature.RefKind != RefKind.None); 840Debug.Assert(((BoundConditionalOperator)originalLHS).IsRef); 844Debug.Assert(((BoundAssignmentOperator)originalLHS).IsRef); 855Debug.Assert(eventAccess.IsUsableAsField); 1018Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression)); 1038Debug.Assert(expression.Type is { }); 1058Debug.Assert(call.ReceiverOpt is { });
Lowering\LocalRewriter\LocalRewriter_ConditionalAccess.cs (10)
40Debug.Assert(!_inExpressionLambda); 41Debug.Assert(node.AccessExpression.Type is { }); 44Debug.Assert(loweredReceiver.Type is { }); 119Debug.Assert(loweredAccessExpression != null); 120Debug.Assert(loweredAccessExpression.Type is { }); 135Debug.Assert(TypeSymbol.Equals(accessExpressionType, nodeType.GetNullableUnderlyingType(), TypeCompareKind.ConsiderEverything2)); 140Debug.Assert(TypeSymbol.Equals(accessExpressionType, nodeType, TypeCompareKind.ConsiderEverything2) || 149Debug.Assert(loweredReceiver.Type is { }); 166Debug.Assert(temp is { }); 205Debug.Assert(newtarget is { Type: { } });
Lowering\LocalRewriter\LocalRewriter_ConditionalOperator.cs (1)
21Debug.Assert(node.ConstantValueOpt == null);
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (117)
25Debug.Assert(node.Type is NamedTypeSymbol { IsInterpolatedStringHandlerType: true }); 39Debug.Assert(node.Operand is BoundConvertedSwitchExpression { WasTargetTyped: true }); 43Debug.Assert(node.Operand is BoundConditionalOperator { WasTargetTyped: true }); 47Debug.Assert(node.Operand is not null); 52Debug.Assert(node.Operand is BoundObjectCreationExpressionBase { WasTargetTyped: true }); 56Debug.Assert(node.Operand is BoundObjectCreationExpressionBase { WasTargetTyped: true } or 82Debug.Assert(result.Type!.Equals(toType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 94Debug.Assert(node.Type is not null); 95Debug.Assert(_compilation.IsReadOnlySpanType(node.Type)); 97Debug.Assert(byteType.SpecialType == SpecialType.System_Byte); 142Debug.Assert(byteArray.IsSZArray); 143Debug.Assert(byteArray.ElementType.SpecialType == SpecialType.System_Byte); 166Debug.Assert(node.OperatorKind is BinaryOperatorKind.Utf8Addition); 194Debug.Assert(utf8Addition.OperatorKind is BinaryOperatorKind.Utf8Addition); 224Debug.Assert(rewrittenNode.Type is { }); 271Debug.Assert(result.Type is { } rt && rt.Equals(rewrittenType, TypeCompareKind.AllIgnoreOptions)); 306Debug.Assert(oldNodeOpt == null || oldNodeOpt.Syntax == syntax); 307Debug.Assert(rewrittenType is { }); 308Debug.Assert(_factory.ModuleBuilderOpt is { }); 309Debug.Assert(_diagnostics.DiagnosticBag is { }); 319Debug.Assert(rewrittenOperand.Type is { }); 433Debug.Assert(rewrittenOperand.Type is { }); 448Debug.Assert(rewrittenOperand.Type is { }); 451Debug.Assert(rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 494Debug.Assert(rewrittenOperand.Type is { }); 504Debug.Assert(rewrittenOperand.Type.IsEnumType()); 515Debug.Assert(rewrittenType.IsEnumType()); 541Debug.Assert(conversion.Method is null); 542Debug.Assert(!conversion.IsExtensionMethod); 543Debug.Assert(constantValueOpt == null); 560Debug.Assert(symbolOpt is { }); 570Debug.Assert(oldNodeOpt is { }); 573Debug.Assert(method is { }); 577Debug.Assert(receiver is { }); 584Debug.Assert(_factory.TopLevelMethod is { }); 602Debug.Assert(rewrittenOperand.Type is not null); 613Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions)); 629Debug.Assert(sourceType is not null); 642Debug.Assert(parameterType.IsSZArray()); 643Debug.Assert(rewrittenOperand.Type?.IsSZArray() == true); 645Debug.Assert(c.IsImplicit || conversion.IsExplicit); 646Debug.Assert(c.IsReference || c.IsIdentity); 660Debug.Assert(destinationType.IsReadOnlySpan()); 661Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 670Debug.Assert(implicitOperator.ParameterTypesWithAnnotations[0].Type.Equals(rewrittenOperand.Type, TypeCompareKind.AllIgnoreOptions)); 692Debug.Assert(destinationType.IsReadOnlySpan()); 693Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 694Debug.Assert(Binder.NeedsSpanCastUp(sourceType, destinationType)); 704Debug.Assert(method.ParameterTypesWithAnnotations[0].Type.Equals(rewrittenOperand.Type, TypeCompareKind.AllIgnoreOptions)); 711Debug.Assert(destinationType.IsReadOnlySpan()); 712Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 719Debug.Assert(method.Parameters[0].Type.IsStringType()); 720Debug.Assert(rewrittenOperand.Type?.IsStringType() == true); 757Debug.Assert(_factory.ModuleBuilderOpt is { }); 770Debug.Assert((object)target != null); 832Debug.Assert(rewrittenOperand.Type is { }); 864Debug.Assert(conversion.IsValid); 889Debug.Assert(conversion.Method is { }); 890Debug.Assert(conversion.BestUserDefinedConversionAnalysis is { }); 916Debug.Assert(rewrittenOperand.Type is { }); 956Debug.Assert(conversion.IsValid); 957Debug.Assert(conversion.BestUnionConversionAnalysis is { }); 961Debug.Assert(analysis.Kind == UserDefinedConversionAnalysisKind.ApplicableInNormalForm); 962Debug.Assert(analysis.Operator is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true })); 963Debug.Assert(TypeSymbol.Equals(analysis.FromType, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions)); 964Debug.Assert(TypeSymbol.Equals(rewrittenType.StrippedType(), analysis.Operator.MethodKind == MethodKind.Constructor ? analysis.Operator.ContainingType : analysis.Operator.ReturnType, TypeCompareKind.AllIgnoreOptions)); 965Debug.Assert(TypeSymbol.Equals(rewrittenType.StrippedType(), analysis.ToType, TypeCompareKind.AllIgnoreOptions)); 966Debug.Assert(analysis.TargetConversion is { IsIdentity: true } or { IsNullable: true, IsImplicit: true }); 970Debug.Assert(!analysis.SourceConversion.IsIdentity); 979Debug.Assert(TypeSymbol.Equals(rewrittenOperand.Type, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions)); 986Debug.Assert(TypeSymbol.Equals(rewrittenOperand.Type, analysis.ToType, TypeCompareKind.AllIgnoreOptions)); 990Debug.Assert(!analysis.TargetConversion.IsIdentity); 999Debug.Assert(TypeSymbol.Equals(rewrittenOperand.Type, rewrittenType, TypeCompareKind.AllIgnoreOptions)); 1023Debug.Assert(rewrittenOperand.Type is { }); 1064Debug.Assert(expression.Type is { }); 1111Debug.Assert((object)rewrittenType != null); 1119Debug.Assert(rewrittenOperandType is { }); 1120Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1167Debug.Assert((object)rewrittenType != null); 1168Debug.Assert(rewrittenOperand.Type is { }); 1170Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1293Debug.Assert(conversion.Method is { }); 1313Debug.Assert(operand != null); 1314Debug.Assert((object)type != null); 1382Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2)); 1383Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1384Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1415Debug.Assert(conversion.Method is { } && !conversion.Method.ReturnsVoid && conversion.Method.ParameterCount == 1); 1416Debug.Assert(rewrittenOperand.Type is { }); 1448Debug.Assert(TypeSymbol.Equals(result.Type, rewrittenType, TypeCompareKind.ConsiderEverything2)); 1456Debug.Assert(resultType.IsNullableType() && TypeSymbol.Equals(resultType.GetNullableUnderlyingType(), call.Method.ReturnType, TypeCompareKind.ConsiderEverything2)); 1471Debug.Assert(rewrittenOperand.Type is { }); 1487Debug.Assert((object)rewrittenType != null); 1488Debug.Assert(rewrittenOperand.Type.IsNullableType()); 1519Debug.Assert(conversion.Method is { }); 1559Debug.Assert(conversion.IsUnion); 1560Debug.Assert(conversion.Method is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true })); 1561Debug.Assert(rewrittenOperand.Type is { }); 1562Debug.Assert(!_inExpressionLambda); 1563Debug.Assert(conversion.Method.Parameters[0].Type.Equals(rewrittenOperand.Type, TypeCompareKind.AllIgnoreOptions)); 1602Debug.Assert(rewrittenOperand != null); 1603Debug.Assert((object)rewrittenType != null); 1604Debug.Assert(rewrittenOperand.Type is { }); 1605Debug.Assert(!_compilation.Assembly.RuntimeSupportsNumericIntPtr); 1618Debug.Assert(!method.ReturnsVoid); 1619Debug.Assert(method.ParameterCount == 1); 1625Debug.Assert(target.IsNullableType()); 1651Debug.Assert((object)source != null); 1652Debug.Assert((object)target != null); 1811Debug.Assert(fromType.SpecialType == SpecialType.System_Decimal || toType.SpecialType == SpecialType.System_Decimal); 1830Debug.Assert(operand.Type is { }); 1861Debug.Assert(TypeSymbol.Equals(method.ReturnType, toType, TypeCompareKind.ConsiderEverything2)); 1878Debug.Assert(meth is { }); 1914Debug.Assert(!_compilation.Assembly.RuntimeSupportsNumericIntPtr); 1945Debug.Assert(underlying is { }); 1958Debug.Assert(underlying is { }); 1990Debug.Assert(!meth.ContainingType.IsInterface);
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (19)
20Debug.Assert(right.Conversion.Kind == ConversionKind.Deconstruction); 42Debug.Assert(left.Type is { }); 65Debug.Assert(!conditional.IsRef); 87Debug.Assert(returnValue is null); 114Debug.Assert(right is not ({ Kind: BoundKind.TupleLiteral } or BoundConversion { Operand.Kind: BoundKind.TupleLiteral })); 162Debug.Assert(target is { Single: not null, NestedVariables: null } or { Single: null, NestedVariables: not null }); 172Debug.Assert(!IsCapturedPrimaryConstructorParameter(single)); 219Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 223Debug.Assert(!deconstructConversionInfo.IsDefault); 224Debug.Assert(leftTargets.Count == rightParts.Length && leftTargets.Count == deconstructConversionInfo.Length); 231Debug.Assert(placeholder is not null); 232Debug.Assert(nestedConversion is not null); 247Debug.Assert(leftTarget is { Type: { } }); 259Debug.Assert(builder is null || resultPart is { }); 286Debug.Assert(!IsTupleExpression(right.Kind)); 319Debug.Assert(right.Type is { }); 338Debug.Assert(expression.Type is { }); 339Debug.Assert(expression.Type.IsTupleType); 463Debug.Assert(variable.Type is { });
Lowering\LocalRewriter\LocalRewriter_DelegateCreationExpression.cs (2)
16Debug.Assert(!node.Type.IsAnonymousType); // Missing EnsureParamCollectionAttributeExists call? 32Debug.Assert(method is { });
Lowering\LocalRewriter\LocalRewriter_DoStatement.cs (2)
17Debug.Assert(node != null); 21Debug.Assert(rewrittenBody is { });
Lowering\LocalRewriter\LocalRewriter_Event.cs (17)
57Debug.Assert(method is { }); 58Debug.Assert(method.ReturnType.Equals(node.Type, TypeCompareKind.AllIgnoreOptions)); 91Debug.Assert(eventSymbol.IsStatic || rewrittenReceiverOpt is { }); 186Debug.Assert(sideEffects.Any(), "Otherwise, we shouldn't be building a sequence"); 193Debug.Assert(left.IsUsableAsField); 196Debug.Assert(eventSymbol.HasAssociatedField); 197Debug.Assert(eventSymbol.IsWindowsRuntimeEvent); 213Debug.Assert(node.IsUsableAsField); 227Debug.Assert(eventSymbol.HasAssociatedField); 230Debug.Assert(fieldSymbol is { }); 238Debug.Assert(fieldType.Name == "EventRegistrationTokenTable"); 311Debug.Assert(parameters0Type.IsObjectType()); 313Debug.Assert(c0.IsImplicit); 314Debug.Assert(c0.IsReference); 317Debug.Assert(parameters1Type.SpecialType == SpecialType.System_Delegate); 319Debug.Assert(c1.IsImplicit); 320Debug.Assert(c1.IsReference);
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (23)
49Debug.Assert(rewrittenBody is { }); 53Debug.Assert(statementBuilder.Count == numFixedLocals + 1 + 1); 84Debug.Assert(node is { }); 135Debug.Assert(node.Parent is TryStatementSyntax); 144Debug.Assert(node is { } && node.Kind() == SyntaxKind.TryStatement); 200Debug.Assert(!ReferenceEquals(initializer, null)); 241Debug.Assert(initializerExpr.Type is { TypeKind: TypeKind.Pointer }); 245Debug.Assert(initializerExpr.Kind == BoundKind.AddressOfOperator); 256Debug.Assert(declarator != null); 268Debug.Assert(pinnedTemp.IsPinned); 269Debug.Assert(!localSymbol.IsPinned); 308Debug.Assert(initializerExpr.Type is { }); 313Debug.Assert(getPinnableMethod is { }); 317Debug.Assert(declarator != null); 388Debug.Assert(nullableBoundTemp is not null); 389Debug.Assert(nullableTempAssignment is not null); 445Debug.Assert(initializerType is { }); 449Debug.Assert(declarator != null); 458Debug.Assert(pinnedTemp.IsPinned); 459Debug.Assert(!localSymbol.IsPinned); 514Debug.Assert(initializerType is { }); 521Debug.Assert(pinnedTemp.IsPinned); 522Debug.Assert(!localSymbol.IsPinned);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (35)
44Debug.Assert(nodeExpressionType is { }); 122Debug.Assert(enumeratorInfo != null); 125Debug.Assert(rewrittenBody is { }); 231Debug.Assert(moveNextAwaitableInfo is { GetResult: not null } or { RuntimeAsyncAwaitCall: not null }); 346Debug.Assert(_factory.CurrentFunction is { }); 372Debug.Assert(idisposableTypeSymbol is { }); 403Debug.Assert(enumeratorType.OriginalDefinition.SpecialType != SpecialType.System_Nullable_T); 428Debug.Assert(!enumeratorType.IsSealed); 429Debug.Assert(!enumeratorInfo.IsAsync); 430Debug.Assert(idisposableTypeSymbol is { }); 431Debug.Assert(disposeMethod is { }); 507Debug.Assert(receiver.Type is { }); 510Debug.Assert(receiverConversion.IsImplicit); 511Debug.Assert(!receiverConversion.IsUserDefined); 512Debug.Assert(!receiverConversion.IsUnion); 537Debug.Assert(!receiverConversion.IsNumeric); 572Debug.Assert(rewrittenBody is { }); 574Debug.Assert(node.EnumeratorInfoOpt is not null); 609Debug.Assert(collectionType is { }); 747Debug.Assert(rewrittenExpression.Type is not null); 769Debug.Assert(rewriter._factory.ModuleBuilderOpt is { }); 770Debug.Assert(rewriter._diagnostics.DiagnosticBag is { }); 779Debug.Assert(enumeratorInfo.InlineArraySpanType == WellKnownType.System_ReadOnlySpan_T); 795Debug.Assert(length > 0); 819Debug.Assert(iterationVariables.Length == 1); 876Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 879Debug.Assert(rewrittenBody is { }); 904Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 910Debug.Assert(arrayType is { IsSZArray: true }); 1025Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1028Debug.Assert(rewrittenBody is { }); 1053Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1060Debug.Assert(!arrayType.IsSZArray); 1206Debug.Assert(forLoop != null); 1246Debug.Assert(result is { });
Lowering\LocalRewriter\LocalRewriter_ForStatement.cs (5)
17Debug.Assert(node != null); 23Debug.Assert(rewrittenBody is { }); 51Debug.Assert(original.Kind is BoundKind.ForStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement); 52Debug.Assert(rewrittenBody != null); 213Debug.Assert(rewrittenBody != null);
Lowering\LocalRewriter\LocalRewriter_FunctionPointerInvocation.cs (2)
17Debug.Assert(rewrittenExpression != null); 36Debug.Assert(discardedReceiver is null);
Lowering\LocalRewriter\LocalRewriter_HostObjectMemberReference.cs (3)
13Debug.Assert(_previousSubmissionFields != null); 14Debug.Assert(_factory.TopLevelMethod is { IsStatic: false }); 15Debug.Assert(_factory.CurrentType is { });
Lowering\LocalRewriter\LocalRewriter_IfStatement.cs (4)
16Debug.Assert(node != null); 25Debug.Assert(rewrittenConsequence is { }); 91Debug.Assert(elseIfStatement is not null); 100Debug.Assert(builder[conditionalGotoIndex] is BoundConditionalGoto);
Lowering\LocalRewriter\LocalRewriter_Index.cs (3)
15Debug.Assert(node.MethodOpt != null); 71Debug.Assert(targetNullableType.IsNullableType()); 72Debug.Assert(TypeSymbol.Equals(targetNullableType.GetNullableUnderlyingType(), underlyingValue.Type, TypeCompareKind.AllIgnoreOptions));
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (81)
70Debug.Assert(node.AccessorKind != AccessorKind.Unknown); 71Debug.Assert(node.Indexer.IsIndexer || node.Indexer.IsIndexedProperty); 72Debug.Assert((object?)node.Indexer.GetOwnOrInheritedGetMethod() != null); 80Debug.Assert(indexer.IsIndexer || indexer.IsIndexedProperty); 81Debug.Assert(node.AccessorKind != AccessorKind.Unknown); 82Debug.Assert(isLeftOfAssignment || (node.AccessorKind != AccessorKind.Set)); 86Debug.Assert(rewrittenReceiver is { }); 117Debug.Assert(oldNode is BoundIndexerAccess or BoundObjectInitializerMember); 118Debug.Assert(arguments.Length != 0); 119Debug.Assert(rewrittenReceiver is { }); 124Debug.Assert(oldNode.Type is not null); 125Debug.Assert(oldNode.Type.Equals(type, TypeCompareKind.ConsiderEverything)); 162Debug.Assert(getMethod is not null); 197Debug.Assert(receiverIsKnownToBeCaptured || rewrittenReceiverBeforePossibleCapture != (object?)rewrittenReceiver); 199Debug.Assert(storesOpt is { }); 220Debug.Assert(call.Type is not null); 224Debug.Assert(sideEffects.IsEmpty); 242Debug.Assert(_factory.ModuleBuilderOpt is { }); 243Debug.Assert(_diagnostics.DiagnosticBag is { }); 244Debug.Assert(node.Expression.Type is object); 245Debug.Assert(node.Argument.Type is object); 257Debug.Assert(getItemOrSliceHelper is object); 268Debug.Assert(length > 0); 281Debug.Assert(receiverStore is null); 282Debug.Assert(Binder.IsWellKnownSystemRange(node.Argument.Type, _compilation)); 296Debug.Assert(!startOnlyOverload.IsExtensionBlockMember()); 324Debug.Assert(rewrittenRangeArg is not null); 388Debug.Assert(node.Expression.Type is object); 405Debug.Assert(node.Expression.Type is object); 406Debug.Assert(index.Type?.SpecialType == SpecialType.System_Int32); 423Debug.Assert(node.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__get_Item); 442Debug.Assert(node.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__get_Item); 452Debug.Assert(index.ConstantValueOpt is null); // Binder should have reported an error due to index out of bounds, or should have handled by code above. 507Debug.Assert(Binder.IsWellKnownSystemRange(argumentType, _compilation)); 508Debug.Assert(!isLeftOfAssignment || node.IndexerOrSliceAccess.GetRefKind() == RefKind.Ref); 542Debug.Assert(node.ArgumentPlaceholders.Length == 1); 543Debug.Assert(node.IndexerOrSliceAccess is BoundIndexerAccess or BoundArrayAccess); 545Debug.Assert(TypeSymbol.Equals( 563Debug.Assert(receiver.Type is { }); 577Debug.Assert(node.LengthOrCountAccess.ExpressionSymbol is not null); 578Debug.Assert(node.IndexerOrSliceAccess.ExpressionSymbol is not null); 589Debug.Assert(receiverLocal.LocalSymbol.Type is { IsReferenceType: false, IsValueType: false }); 640Debug.Assert(node.ArgumentPlaceholders.Length == 1); 642Debug.Assert(integerArgument.Type!.SpecialType == SpecialType.System_Int32); 648Debug.Assert(indexerAccess.Arguments.Length == 1); 665Debug.Assert(locals is not null); 732Debug.Assert(lengthAccess is not null); 736Debug.Assert(loweredExpr is not null); 737Debug.Assert(lengthAccess is not null); 738Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 748Debug.Assert(loweredExpr is not null); 749Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 753Debug.Assert(loweredExpr is not null); 754Debug.Assert(lengthAccess is not null); 755Debug.Assert(Binder.IsWellKnownSystemIndex(loweredExpr.Type, _compilation)); 785Debug.Assert(TypeSymbol.Equals( 794Debug.Assert(hatExpression.Operand is { Type: { SpecialType: SpecialType.System_Int32 } }); 854Debug.Assert(node.ArgumentPlaceholders.Length == 2); 855Debug.Assert(node.IndexerOrSliceAccess is BoundCall); 857Debug.Assert(Binder.IsWellKnownSystemRange(node.Argument.Type, _compilation)); 881Debug.Assert(receiver.Type is { }); 896Debug.Assert(node.LengthOrCountAccess.ExpressionSymbol is not null); 897Debug.Assert(node.IndexerOrSliceAccess.ExpressionSymbol is not null); 925Debug.Assert(receiverLocal.LocalSymbol.Type is { IsReferenceType: false, IsValueType: false }); 955Debug.Assert(startStrategy is not PatternIndexOffsetLoweringStrategy.Length); 956Debug.Assert(endMakeOffsetInput is not null || endStrategy == PatternIndexOffsetLoweringStrategy.Length); 963Debug.Assert(!startOnlyOverload.IsExtensionBlockMember()); 968Debug.Assert(startMakeOffsetInput is not null); 980Debug.Assert(!needSpecialExtensionReceiverReadOrder); 1044Debug.Assert(startStrategy != PatternIndexOffsetLoweringStrategy.Zero || (rewriteFlags & captureStartOffset) == 0); 1045Debug.Assert((rewriteFlags & captureEndOffset) == 0 || (rewriteFlags & captureStartOffset) != 0 || startStrategy == PatternIndexOffsetLoweringStrategy.Zero); 1046Debug.Assert((rewriteFlags & captureStartOffset) == 0 || (rewriteFlags & captureEndOffset) != 0 || endStrategy == PatternIndexOffsetLoweringStrategy.Length); 1047Debug.Assert(endStrategy != PatternIndexOffsetLoweringStrategy.Length || (rewriteFlags & captureEndOffset) == 0); 1048Debug.Assert((rewriteFlags & captureLength) == 0 || (rewriteFlags & useLength) != 0); 1052Debug.Assert(startMakeOffsetInput is not null); 1058Debug.Assert(endMakeOffsetInput is not null); 1095Debug.Assert(rewrittenRangeArg is not null); 1099Debug.Assert(node.ArgumentPlaceholders.Length == 2); 1138Debug.Assert(startLengthOverload.Name == startOverload.Name 1168Debug.Assert(methodDefinition.IsDefinition); 1179Debug.Assert(startLengthOverload.Name == startOverload.Name
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (4)
51Debug.Assert(operandType is { } || rewrittenOperand.ConstantValueOpt!.IsNull); 52Debug.Assert(targetType is { }); 88Debug.Assert(constantValue == ConstantValue.True || constantValue == ConstantValue.False); 89Debug.Assert((object)type != null);
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (8)
66Debug.Assert(w.WhenFalse is null); 119Debug.Assert(node.Type is { SpecialType: SpecialType.System_Boolean }); 178Debug.Assert(test.Type.SpecialType == SpecialType.System_Boolean); 278Debug.Assert(leafNode.Label == whenTrueLabel); 283Debug.Assert(whenNode.WhenExpression == null); 284Debug.Assert(whenNode.WhenTrue is BoundLeafDecisionDagNode d && d.Label == whenTrueLabel); 307Debug.Assert(_sideEffectBuilder.Count == 0); 315Debug.Assert(result != null);
Lowering\LocalRewriter\LocalRewriter_LabeledStatement.cs (1)
16Debug.Assert(node != null);
Lowering\LocalRewriter\LocalRewriter_Literal.cs (13)
19Debug.Assert(node.ConstantValueOpt is { }); 25Debug.Assert(constantValue != null); 30Debug.Assert(type is { SpecialType: SpecialType.System_Decimal }); 38Debug.Assert(type is { SpecialType: SpecialType.System_DateTime }); 53Debug.Assert(constantValue != null); 54Debug.Assert(constantValue.IsDecimal); 71Debug.Assert(curMethod is { }); 132Debug.Assert((object)ctor != null); 133Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_Decimal); 144Debug.Assert(constantValue != null); 145Debug.Assert(constantValue.IsDateTime); 151Debug.Assert((object)ctor != null); 152Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_DateTime);
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (4)
28Debug.Assert(rewrittenBody is { }); 35Debug.Assert(rewrittenArgument.ConstantValueOpt == ConstantValue.Null); 47Debug.Fail("We should have reported an error during binding if lock type info cannot be found."); 201Debug.Assert(enterMethod.ParameterCount == 1);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (10)
16Debug.Assert(node.Type is { }); 20Debug.Assert(node.LeftOperand.Type is { }); 24Debug.Assert(transformedLHS.Type is { }); 41Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.LeftOperand.Type, TypeCompareKind.AllIgnoreOptions)); 50Debug.Assert(assignment.Type is { }); 61Debug.Assert(conditionalExpression.Type is { }); 82Debug.Assert(node.LeftOperand.Type.IsNullableType()); 113Debug.Assert(!_inExpressionLambda && lhsRead.Kind != BoundKind.PropertyAccess); 136Debug.Assert(transformedLHS.Type.GetNullableUnderlyingType().Equals(tmp.Type.StrippedType(), TypeCompareKind.AllIgnoreOptions)); 140Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.LeftOperand.Type, TypeCompareKind.AllIgnoreOptions));
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (18)
31Debug.Assert(rewrittenLeft != null); 32Debug.Assert(rewrittenRight != null); 33Debug.Assert(BoundNode.GetConversion(leftConversion, leftPlaceholder).IsValid); 34Debug.Assert(rewrittenResultType is { }); 35Debug.Assert(rewrittenRight.Type is { }); 36Debug.Assert(rewrittenRight.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 42Debug.Assert(rewrittenLeft.Type is { }); 46Debug.Assert(leftPlaceholder is not null); 75Debug.Assert(!rewrittenLeft.ConstantValueOpt.IsNull); 90Debug.Assert(rewrittenLeft.Type is { }); 167Debug.Assert(convertedLeft.HasErrors || convertedLeft.Type!.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 179Debug.Assert(conditionalExpression.ConstantValueOpt == null); // we shouldn't have hit this else case otherwise 180Debug.Assert(conditionalExpression.Type!.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 237Debug.Assert(rewrittenLeft != null); 238Debug.Assert(rewrittenLeft.Type is { }); 239Debug.Assert(rewrittenResultType is { }); 240Debug.Assert(BoundNode.GetConversion(leftConversion, leftPlaceholder).IsValid); 243Debug.Assert(rewrittenLeftType.IsNullableType() || !rewrittenLeftType.IsValueType);
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (16)
33Debug.Assert(node != null); 55Debug.Assert(receiverDiscard is null); 81Debug.Assert(TypeSymbol.Equals(rewrittenObjectCreation.Type, ((NamedTypeSymbol)node.Type).ComImportCoClass, TypeCompareKind.ConsiderEverything2)); 114Debug.Assert(TypeSymbol.Equals(rewrittenObjectCreation.Type, ((NamedTypeSymbol)node.Type).ComImportCoClass, TypeCompareKind.ConsiderEverything2)); 135Debug.Assert(receiver.Type!.Equals(type, TypeCompareKind.ConsiderEverything)); 183Debug.Assert(withExpr.CloneMethod is not null); 184Debug.Assert(withExpr.CloneMethod.ParameterCount == 0); 191Debug.Assert(c.IsReference || c.IsIdentity); 214Debug.Assert(left.MemberSymbol is not null); 223Debug.Assert(property.MemberIndexOpt!.Value >= 0 && property.MemberIndexOpt.Value < anonymousType.Properties.Length); 266Debug.Assert(!_inExpressionLambda); 267Debug.Assert(initializerExpression != null && !initializerExpression.HasErrors); 345Debug.Assert((object)method != null); 389Debug.Assert(node.GuidString is { }); 421Debug.Assert(instance.Type.IsObjectType()); 423Debug.Assert(c.IsReference);
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (42)
38Debug.Assert(!_inExpressionLambda); 39Debug.Assert(rewrittenReceiver != null); 68Debug.Assert(_inExpressionLambda); 100Debug.Assert(!elementInitializer.AddMethod.CallsAreOmitted(initializer.SyntaxTree)); 102Debug.Assert(!elementInitializer.InvokedAsExtensionMethod); 103Debug.Assert(!elementInitializer.AddMethod.IsExtensionMethod); 104Debug.Assert(!elementInitializer.AddMethod.IsExtensionBlockMember()); 105Debug.Assert(elementInitializer.Arguments.Length == elementInitializer.AddMethod.ParameterCount); 106Debug.Assert(elementInitializer.ImplicitReceiverOpt is BoundObjectOrCollectionValuePlaceholder); 129Debug.Assert(rewrittenReceiver is { } || _inExpressionLambda); 143Debug.Assert(!_inExpressionLambda); 144Debug.Assert(initializer.Kind == BoundKind.DynamicCollectionElementInitializer); 183Debug.Assert(addMethod.Name == "Add"); 184Debug.Assert(addMethod.Parameters 187Debug.Assert(initializer.Arguments.Any()); 188Debug.Assert(!_inExpressionLambda); 231Debug.Assert(addMethod.IsStatic); 232Debug.Assert(addMethod.IsExtensionMethod); 233Debug.Assert(rewrittenReceiver is null); 272Debug.Assert(temps != null); 289Debug.Assert(!_inExpressionLambda); 309Debug.Assert(rewrittenReceiver != null); 310Debug.Assert(!_inExpressionLambda); 332Debug.Assert(memberInit is { }); 336Debug.Assert(memberInit.Arguments.Count(a => a.IsParamsArrayOrCollection) <= (memberInit.Expanded ? 1 : 0)); 360Debug.Assert(!memberInit.Expanded); 377Debug.Assert(setMember.SiteInitialization is { }); 389Debug.Assert(getMember.SiteInitialization is { }); 400Debug.Assert(assignment.Type.IsDynamic() || TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 411Debug.Assert(initializerMember is { }); 421Debug.Assert(setMember.SiteInitialization is { }); 428Debug.Assert(getMember.SiteInitialization is { }); 437Debug.Assert(rewrittenArrayAccess is { }); 441Debug.Assert(!arrayAccess.Indices.Any(a => a.IsParamsArrayOrCollection)); 452Debug.Assert(getSubArrayCall.Arguments.Length == 2); 454Debug.Assert(Binder.IsWellKnownSystemRange(rangeArgument.Type, _compilation)); 472Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 505Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 540Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 579Debug.Assert(initializers is not null); 697Debug.Assert(memberSymbol is object); 701Debug.Assert(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType, isChecked: false, ref discardedUseSiteInfo).IsImplicit ||
Lowering\LocalRewriter\LocalRewriter_PointerElementAccess.cs (2)
46Debug.Assert(rewrittenExpression.Type is { }); 47Debug.Assert(rewrittenIndex.Type is { });
Lowering\LocalRewriter\LocalRewriter_PreviousSubmissionReference.cs (4)
15Debug.Assert(targetType.TypeKind == TypeKind.Submission); 16Debug.Assert(_factory.TopLevelMethod is { IsStatic: false }); 17Debug.Assert(_factory.CurrentType is { }); 19Debug.Assert(_previousSubmissionFields != null);
Lowering\LocalRewriter\LocalRewriter_PropertyAccess.cs (4)
84Debug.Assert(argumentRefKindsOpt.IsDefaultOrEmpty); 93Debug.Assert(getMethod is { }); 94Debug.Assert(getMethod.ParameterCount == rewrittenArguments.Length); 95Debug.Assert(getMethodOpt is null || ReferenceEquals(getMethod, getMethodOpt));
Lowering\LocalRewriter\LocalRewriter_Range.cs (17)
19Debug.Assert(node != null && node.MethodOpt != null); 54Debug.Assert(operand != null); 56Debug.Assert(operand.Type is { }); 65Debug.Assert(operand.Type is { }); 79Debug.Assert(node.Type.IsNullableType()); 80Debug.Assert(left?.Type?.IsNullableType() == true || right?.Type?.IsNullableType() == true); 81Debug.Assert(!(left is null && right is null)); 82Debug.Assert(node.MethodOpt is { }); 93Debug.Assert(condition != null); 131Debug.Assert(tempOperand.Type is { }); 181Debug.Assert(left is null ^ right is null); 182Debug.Assert(constructionMethod.MetadataName == "StartAt" || 184Debug.Assert(constructionMethod.IsStatic); 186Debug.Assert(arg is { }); 192Debug.Assert(constructionMethod.MetadataName == "get_All"); 193Debug.Assert(constructionMethod.IsStatic); 194Debug.Assert(left is null && right is null);
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (2)
29Debug.Assert(type is { }); 123Debug.Assert(size > 0);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (25)
25Debug.Assert(IsBinaryStringConcatenation(operatorKind)); 26Debug.Assert(!_inExpressionLambda); 32Debug.Assert(ReferenceEquals(arguments[0], left)); 48Debug.Assert(IsBinaryStringConcatenation(originalOperator)); 74Debug.Assert(!_inExpressionLambda); 75Debug.Assert(visitedArguments.All(arg => arg.Type!.SpecialType is SpecialType.System_String or SpecialType.System_Char or SpecialType.System_Object)); 109Debug.Assert(argumentType is not null); 195Debug.Assert(method is not null); 210Debug.Assert(!_inExpressionLambda); 225Debug.Assert(ReferenceEquals(singleConcatArgument, visitedCompoundAssignmentLeftRead)); 226Debug.Assert((destinationArguments.Count == 0 && followingArgument is null) || (destinationArguments.Count != 0 && ReferenceEquals(followingArgument, destinationArguments[^1]))); 227Debug.Assert(nestedConcatArguments.IsDefault); 334Debug.Assert(constantValue.IsString || constantValue.IsChar); 357Debug.Assert(argument is not BoundBinaryOperator { InterpolatedStringHandlerData: null } op || !IsBinaryStringConcatenation(op)); 380Debug.Assert((finalArguments.Count == 0 && followingArgument is null) || (finalArguments.Count != 0 && ReferenceEquals(followingArgument, finalArguments[^1]))); 381Debug.Assert(singleConcatArgument is null ^ nestedConcatArguments.IsDefault); 521Debug.Assert(arg.Type is not null); 528Debug.Assert(readOnlySpanCtorRefParamChar.Parameters[0].RefKind != RefKind.Out); 552Debug.Assert(arg.HasAnyErrors || arg.Type.SpecialType == SpecialType.System_String); 553Debug.Assert(stringImplicitConversionToReadOnlySpan is not null); 579Debug.Assert(IsBinaryStringConcatenation(current)); 596Debug.Assert(stack.Count > 0); 608Debug.Assert(method is not null); 652Debug.Assert(expr.Type is not null); 759Debug.Assert(!IsCapturedPrimaryConstructorParameter(expr));
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (21)
18Debug.Assert(conversion.ConversionKind == ConversionKind.InterpolatedString); 20Debug.Assert(interpolatedString.InterpolationData is { Construction: not null }); 31Debug.Assert(data.BuilderType is not null); 32Debug.Assert(data.ReceiverPlaceholder is not null); 33Debug.Assert(parts.All(static p => p is BoundCall or BoundDynamicInvocation)); 51Debug.Assert(construction.ArgumentRefKindsOpt[i] == RefKind.None); 52Debug.Assert(construction.DefaultArguments[i]); 58Debug.Assert(localType.SpecialType == SpecialType.System_Boolean); 75Debug.Assert(call.Type.SpecialType == SpecialType.System_Boolean == usesBoolReturns); 98Debug.Assert(!parts.IsEmpty); 118Debug.Assert(currentExpression != null); 145Debug.Assert(node.Type is { SpecialType: SpecialType.System_String }); // if target-converted, we should not get here. 177Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue is not null); 186Debug.Assert(result is not null); 193Debug.Assert(result is not null); 194Debug.Assert(result.Type is not null); 195Debug.Assert(result.Type.SpecialType == SpecialType.System_String || result.Type.IsErrorType()); 214Debug.Assert(node.InterpolationData is { Construction: not null }); 243Debug.Assert(((BoundObjectCreationExpression)data.Construction).Arguments.All( 251Debug.Assert(arguments.All(arg => arg is not BoundConversion { Conversion: { IsInterpolatedStringHandler: true }, ExplicitCastInCode: false })); 284Debug.Assert(_statements.IsDefault ^ _expressions.IsDefault);
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (9)
57Debug.Assert(savedInputExpression != null); 131Debug.Assert(c.IsImplicit); 132Debug.Assert(c.IsBoxing || c.IsReference || c.IsIdentity); 170Debug.Assert(factory.ModuleBuilderOpt is not null); 174Debug.Assert(diagnostics is not null); 185Debug.Assert(factory.ModuleBuilderOpt is not null); 189Debug.Assert(diagnostics is not null); 199Debug.Assert(factory.ModuleBuilderOpt is not null); 203Debug.Assert(diagnostics is not null);
Lowering\LocalRewriter\LocalRewriter_TryStatement.cs (2)
17Debug.Assert(tryBlock is { }); 89Debug.Assert(rewrittenBody is { });
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (11)
54Debug.Assert(expr.Type == (object?)o.Type || expr.Type is { } && expr.Type.Equals(o.Type, TypeCompareKind.AllIgnoreOptions)); 108Debug.Assert(expr.Type is { }); 111Debug.Assert(boundConversion.Operand.Type is { }); 374Debug.Assert(expr.Type is { }); 404Debug.Assert(expr.Type is { }); 447Debug.Assert(expr.Type is { }); 450Debug.Assert(operand.Type is { }); 455Debug.Assert(underlyingConversions.Length == tupleCardinality); 514Debug.Assert(currentResult is { }); 531Debug.Assert(tuple.Type is { IsTupleType: true }); 590Debug.Assert(boolOperator.ReturnType.SpecialType == SpecialType.System_Boolean);
Lowering\LocalRewriter\LocalRewriter_TupleCreationExpression.cs (2)
39Debug.Assert(node.Type is { }); 45Debug.Assert(type.IsTupleType);
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (42)
38Debug.Assert(false); // these should have been represented as a BoundIncrementOperator 85Debug.Assert((kind == UnaryOperatorKind.DynamicTrue || kind == UnaryOperatorKind.DynamicFalse) && type.SpecialType == SpecialType.System_Boolean 87Debug.Assert(method is null); 113Debug.Assert(method is { }); 114Debug.Assert(TypeSymbol.Equals(type, method.ReturnType, TypeCompareKind.ConsiderEverything2)); 134Debug.Assert(underlyingType is { }); 277Debug.Assert(result.Type is { }); 328Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2)); 329Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 330Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 407Debug.Assert(node.MethodOpt is { }); 408Debug.Assert(node.OperandConversion is null || (node.Operand.Type!.IsReferenceType && node.MethodOpt.IsExtensionBlockMember())); 414Debug.Assert(node.Type.IsVoidType()); 422Debug.Assert(operandType is { }); 423Debug.Assert(TypeSymbol.Equals(operandType, node.Type, TypeCompareKind.AllIgnoreOptions)); 451Debug.Assert(node.OperandConversion is null); 459Debug.Assert(operandType is { }); 467Debug.Assert(TypeSymbol.Equals(operandType, transformedLHS.Type, TypeCompareKind.AllIgnoreOptions)); 588Debug.Assert(operandType is { }); 589Debug.Assert(TypeSymbol.Equals(operandType, node.Type, TypeCompareKind.ConsiderEverything2)); 625Debug.Assert(transformedLHS is not BoundPropertyAccess); 641Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression)); 661Debug.Assert(boundTemp.Type is not null); 701Debug.Assert(boundTemp.Type is not null); 704Debug.Assert(tempValue.Type is { }); 760Debug.Assert(placeholder is not null); 793Debug.Assert(node.MethodOpt is { }); 794Debug.Assert(node.MethodOpt.ParameterCount == 1); 805Debug.Assert(TypeSymbol.Equals(node.MethodOpt.GetParameterType(0), node.MethodOpt.ReturnType, TypeCompareKind.ConsiderEverything2)); 902Debug.Assert(constantOne != null); 903Debug.Assert(constantOne.SpecialType != SpecialType.None); 904Debug.Assert(binaryOperandType.SpecialType != SpecialType.None); 905Debug.Assert(binaryOperatorKind.OperandTypes() != 0); 932Debug.Assert(binaryOperatorKind.OperandTypes() == BinaryOperatorKind.PointerAndInt); 933Debug.Assert(binaryOperand.Type is { TypeKind: TypeKind.Pointer }); 934Debug.Assert(boundOne.Type is { SpecialType: SpecialType.System_Int32 }); 980Debug.Assert((object)method != null); // Should have been checked during Warnings pass 987Debug.Assert(operand.Type is { SpecialType: SpecialType.System_Decimal }); 994Debug.Assert(operand.Type is { } && operand.Type.IsNullableType() && operand.Type.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal); 1180Debug.Assert(underlyingType is { }); 1185Debug.Assert(underlyingType.IsEnumType()); 1187Debug.Assert(underlyingType is { });
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (17)
38Debug.Assert(rewrittenBody is { }); 50Debug.Assert(node.DeclarationsOpt is { }); 70Debug.Assert(declarations != null); 110Debug.Assert(node.ExpressionOpt != null); 111Debug.Assert(node.DeclarationsOpt == null); 130Debug.Assert(node.Locals.IsEmpty); // TODO: This might not be a valid assumption in presence of semicolon operator. 149Debug.Assert(rewrittenExpression.Type is { }); 214Debug.Assert(localDeclaration.InitializerOpt is { }); 219Debug.Assert((object)localType != null); //otherwise, there wouldn't be a conversion to IDisposable 224Debug.Assert(rewrittenDeclaration is { }); 357Debug.Assert((awaitKeywordOpt == default) == (awaitOpt is null)); 442Debug.Assert(awaitOpt is null || awaitKeyword != default); 499Debug.Assert(expression == null); 500Debug.Assert(method.Parameters.AsSpan()[1..].All(static (p) => (p.IsOptional || p.IsParams) && p.RefKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter)); 504Debug.Assert(method.Parameters.All(p => p.IsOptional || p.IsParams)); 507Debug.Assert(method.ParameterRefKinds.IsDefaultOrEmpty || method.ParameterRefKinds.All(static refKind => refKind is RefKind.In or RefKind.RefReadOnlyParameter or RefKind.None)); 508Debug.Assert(methodArgumentInfo.Arguments.All(arg => arg is not BoundConversion { ConversionKind: ConversionKind.InterpolatedStringHandler }));
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (3)
18Debug.Assert(node != null); 22Debug.Assert(rewrittenBody is { }); 49Debug.Assert(loop.Kind is BoundKind.WhileStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement);
Lowering\LocalRewriter\LocalRewriter.cs (38)
67Debug.Assert(factory.InstrumentationState != null); 73Debug.Assert(TypeSymbol.Equals(factory.CurrentType, (containingType ?? containingMethod.ContainingType), TypeCompareKind.ConsiderEverything2)); 102Debug.Assert(statement != null); 103Debug.Assert(compilationState != null); 148Debug.Assert(loweredStatement is { }); 214Debug.Assert(!node.HasErrors, "nodes with errors should not be lowered"); 232Debug.Assert(!node.HasErrors, "nodes with errors should not be lowered"); 244Debug.Assert(!node.HasErrors, "nodes with errors should not be lowered"); 253Debug.Assert(!nameofOperator.WasCompilerGenerated); 285Debug.Assert(visited == null || visited.HasErrors || ReferenceEquals(visited.Type, node.Type) || 322Debug.Assert(CanBePassedByReference(node)); 324Debug.Assert(CanBePassedByReference(result)); 333Debug.Assert(_factory.ModuleBuilderOpt is { }); 513Debug.Assert(_placeholderReplacementMapDoNotUseDirectly is { }); 522Debug.Assert(value.Type is { } && (value.Type.Equals(placeholder.Type, TypeCompareKind.AllIgnoreOptions) || value.HasErrors)); 531Debug.Assert(_placeholderReplacementMapDoNotUseDirectly.Count == 0); 559Debug.Assert(placeholder is { }); 560Debug.Assert(_placeholderReplacementMapDoNotUseDirectly is { }); 563Debug.Assert(removed); 587Debug.Assert(node.Type is { }); 608Debug.Assert((syntax != null) ^ (location != null)); 658Debug.Assert(node.Type.ExtendedSpecialType == InternalSpecialType.System_Type || 660Debug.Assert(node.GetTypeFromHandle is null); 663Debug.Assert(sourceType is { }); 684Debug.Assert(getTypeFromHandle is not null); 685Debug.Assert(TypeSymbol.Equals(type, getTypeFromHandle.ReturnType, TypeCompareKind.AllIgnoreOptions)); 691Debug.Assert(node.GetTypeFromHandle is null); 724Debug.Assert(statement is { }); 850Debug.Assert(node.Expression.Type is { TypeKind: TypeKind.Array }); 880Debug.Assert(parent.Parent is { }); 929Debug.Assert(assignment.Left.Kind == BoundKind.FieldAccess); 1071Debug.Assert(eventAccess.ReceiverOpt is { }); 1072Debug.Assert(eventAccess.ReceiverOpt.Type is { }); 1082Debug.Assert(fieldAccess.ReceiverOpt is { }); 1083Debug.Assert(fieldAccess.ReceiverOpt.Type is { }); 1155Debug.Assert(!member.IsStatic); 1157Debug.Assert(extensionParameter is not null); 1168Debug.Assert(Conversions.IsValidExtensionMethodThisArgConversion(this._compilation.Conversions.ClassifyConversionFromType(receiver.Type, extensionParameter.Type, isChecked: false, ref discardedUseSiteInfo)));
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (26)
361Debug.Assert(inputTemp != loweredSwitchGoverningExpression); 444Debug.Assert(node == nodesToLower[indexOfNode]); 475Debug.Assert(test != null); 500Debug.Assert(!loweredNodes.Contains(node)); 528Debug.Assert(!loweredNodes.Contains(test2)); 567Debug.Assert(foundLabel); 634Debug.Assert(cases.Length == whenTrueCases.Length + whenFalseCases.Length); 710Debug.Assert(_fac is { }); 717Debug.Assert(x.Discriminator switch 726Debug.Assert(y.Discriminator == x.Discriminator); 794Debug.Assert(c.IsImplicit); 795Debug.Assert(c.IsNumeric); 804Debug.Assert(c.IsImplicit); 805Debug.Assert(c.IsNumeric); 1076Debug.Assert(found); 1096Debug.Assert(whenNodes.Count > 1); 1097Debug.Assert(whenNodes.All(n => n.Syntax == whenClauseSyntax)); 1098Debug.Assert(whenNodes.All(n => n.WhenExpression == whenExpression)); 1099Debug.Assert(whenNodes.All(n => n.Bindings == whenNodes[0].Bindings)); 1100Debug.Assert(whenNodes.All(n => GetDagNodeLabel(n.WhenTrue) == whenTrueLabel)); 1111Debug.Assert(whenNode.WhenFalse != null); 1120Debug.Assert(_whenNodeIdentifierLocal is not null); 1174Debug.Assert(whenFalse != null); 1180Debug.Assert(whenFalse == null); 1192Debug.Assert(left.Kind == BoundKind.Local && left == binding.VariableAccess); 1214Debug.Assert(sideEffect != null);
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.ValueDispatchNode.cs (10)
88Debug.Assert(op.OperandTypes() != 0); 109Debug.Assert(Math.Abs(l - r) <= 1); 117Debug.Assert(_height < 2 * Math.Log(_weight)); 127Debug.Assert(whenTrue.Height == this.WhenTrue.Height); 128Debug.Assert(whenFalse.Height == this.WhenFalse.Height); 142Debug.Assert(op.OperandTypes() != 0); 162Debug.Assert(Math.Abs(left.Height - right.Height) <= 2); 190Debug.Assert(leftDispatch.Right.Height == right.Height); 231Debug.Assert(rightDispatch.Left.Height == left.Height); 251Debug.Assert(Math.Abs(left.Height - right.Height) < 2);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (31)
172Debug.Assert(method.Name is WellKnownMemberNames.DeconstructMethodName or WellKnownMemberNames.TryGetValueMethodName); 175Debug.Assert(method.IsExtensionMethod); 195Debug.Assert(method.Name is WellKnownMemberNames.TryGetValueMethodName); 196Debug.Assert(method.ReturnType.SpecialType == SpecialType.System_Boolean); 215Debug.Assert(inputType is { }); 220Debug.Assert(_factory.ClassifyEmitConversion(input, inputType).IsIdentity); 230Debug.Assert(!conversion.IsUserDefined); 231Debug.Assert(!conversion.IsUnion); 261Debug.Assert(e.Property.GetMethod.ParameterCount == 1); 262Debug.Assert(e.Property.GetMethod.Parameters[0].Type.SpecialType == SpecialType.System_Int32); 322Debug.Assert(!e.Target.Equals(e.Input)); 369Debug.Assert(input.Type is { }); 383Debug.Assert(!input.Type.IsNullableType()); 387Debug.Assert(!input.Type.IsNullableType()); 388Debug.Assert(input.Type.IsValueType); 398Debug.Assert(!rewrittenExpr.Type.IsSpanOrReadOnlySpanChar()); 425Debug.Assert(operatorType != BinaryOperatorKind.Error); 435Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.Equal); 444Debug.Assert(comparisonType.SpecialType switch 455Debug.Assert(c.IsNumeric || c.IsEnumeration); 459Debug.Assert(c.IsNumeric || c.IsEnumeration); 477Debug.Assert(sequenceEqual != null && asSpan != null); 510Debug.Assert(output.Type is { }); 546Debug.Assert(loweredInput.Type is { }); 566Debug.Assert(tempAssigned); 580Debug.Assert(l.LocalSymbol.DeclarationKind == LocalDeclarationKind.PatternVariable); 610Debug.Assert(savedInputExpression != null); 659Debug.Assert(field != null); 677Debug.Assert(!IsCapturedPrimaryConstructorParameter(expr)); 708Debug.Assert(!evalNode.Evaluation.Input.IsOriginalInput); 712Debug.Assert(!testNode.Test.Input.IsOriginalInput);
Lowering\LocalRewriter\LocalRewriter.PlaceholderReplacer.cs (2)
24Debug.Assert(result is not null); 31Debug.Assert(value is not null);
Lowering\LocalRewriter\LoweredDynamicOperation.cs (3)
54Debug.Assert(children.Length > 0); 63Debug.Assert(SiteInitialization == null && SiteInvocation is BoundBadExpression && _temps.IsDefaultOrEmpty); 68Debug.Assert(SiteInitialization is { });
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (18)
25Debug.Assert(factory != null); 83Debug.Assert(!isExplicit || !isArrayIndex); 120Debug.Assert(operatorKind.IsDynamic()); 158Debug.Assert(operatorKind.IsDynamic()); 205Debug.Assert(_factory.TopLevelMethod is { }); 545Debug.Assert(loweredReceiver.Type is { }); 570Debug.Assert(argumentNames.IsDefaultOrEmpty || loweredArguments.Length == argumentNames.Length); 571Debug.Assert(refKinds.IsDefault || loweredArguments.Length == refKinds.Length); 572Debug.Assert(!receiverIsStaticType || receiverRefKind == RefKind.None); 608Debug.Assert(!loweredArguments.IsDefault); 687Debug.Assert(factory.CompilationState.ModuleBuilderOpt is { }); 688Debug.Assert(factory.TopLevelMethod is { }); 689Debug.Assert(factory.CurrentFunction is { }); 715Debug.Assert(_currentDynamicCallSiteContainer is { }); 727Debug.Assert(refKinds.IsDefaultOrEmpty || refKinds.Length == loweredArguments.Length); 786Debug.Assert(_factory.CompilationState.ModuleBuilderOpt is { }); 794Debug.Assert(refKind != RefKind.RefReadOnlyParameter); 818Debug.Assert(refKind == RefKind.None || refKind == RefKind.Ref || refKind == RefKind.Out, "unexpected refKind in dynamic");
Lowering\LocalRewriter\PipelinePhaseValidator.cs (1)
101Debug.Assert(false, $"Bound nodes of kind {node.Kind} should not survive past {DoesNotSurvive(node.Kind)}");
Lowering\MethodToClassRewriter.cs (17)
40Debug.Assert(compilationState != null); 41Debug.Assert(diagnostics != null); 42Debug.Assert(diagnostics.DiagnosticBag != null); 109Debug.Assert(rewrittenMethodSymbol.IsMetadataVirtual(CompilationState.Compilation.SourceModule)); 114Debug.Assert(!rewrittenMethodSymbol.IsMetadataVirtual(CompilationState.Compilation.SourceModule)); 143Debug.Assert(methodBeingCalled.IsGenericMethod); 145Debug.Assert(typeArgs.Length == newMethod.Arity); 178Debug.Assert(wrapper.SynthesizesLoweredBoundBody); 224Debug.Assert(!NeedsProxy(node.LocalSymbol)); 274Debug.Assert(!proxies.ContainsKey(leftLocal.LocalSymbol)); 275Debug.Assert(originalRight.Kind != BoundKind.ConvertedStackAllocExpression); 282Debug.Assert(leftLocal.LocalSymbol.DeclarationKind == LocalDeclarationKind.None); 308Debug.Assert(!node.IsRef); 362Debug.Assert(member is not null); 393Debug.Assert(containingType.ContainingModule is SourceModuleSymbol); 394Debug.Assert(ReferenceEquals(methodBeingWrapped, methodBeingWrapped.ConstructedFrom)); 395Debug.Assert(!methodBeingWrapped.IsStatic);
Lowering\SpillSequenceSpiller.cs (39)
47Debug.Assert(value?.Kind != SpillSequenceBuilderKind); 217Debug.Assert(!_receiverSubstitution.ContainsKey(node.LocalSymbol)); 272Debug.Assert(builder.Value == null); 286Debug.Assert(statement != null); 290Debug.Assert(builder.Value == null); 308Debug.Assert(builder != null); 317Debug.Assert(refKind == RefKind.None); 318Debug.Assert(!sideEffectsOnly); 324Debug.Assert(refKind == RefKind.None); 325Debug.Assert(!sideEffectsOnly); 362Debug.Assert(receiverRefLocal.IsKnownToReferToTempIfReferenceType); 441Debug.Assert(call.Arguments.Length == 1); 451Debug.Assert(call.Arguments.Length == 1); 465Debug.Assert(call.Arguments.Length == 2); 473Debug.Assert(call.Arguments.Length == 1); 486Debug.Assert(objectCreationExpression.Arguments.Length == 1); 522Debug.Assert(call.Arguments.Length == 2); 591Debug.Assert(!sideEffectsOnly || refKinds.IsDefault); 592Debug.Assert(refKinds.IsDefault || refKinds.Length == args.Length); 600Debug.Assert(newList.Length == args.Length); 638Debug.Assert(sideEffectsOnly || replacement != null); 682Debug.Assert(expr != null); 683Debug.Assert(builder == null || builder.Value == null); 722Debug.Assert(exceptionFilterPrologueOpt is null || builder is null, 728Debug.Assert(builder.Value is null); 743Debug.Assert(!(node is BoundStatement)); 864Debug.Assert(node.OperandPlaceholder is null); 865Debug.Assert(node.OperandConversion is null); 934Debug.Assert(field.ReceiverOpt is object); 994Debug.Assert(!node.OperatorKind.IsDynamic()); 1048Debug.Assert(refKind == RefKind.None || !receiver.Type.IsReferenceType); 1058Debug.Assert(!receiverType.IsReferenceType); 1161Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 1249Debug.Assert(node.LeftPlaceholder is null); 1250Debug.Assert(node.LeftConversion is null); 1317Debug.Assert(node.HasValueMethodOpt == null); 1342Debug.Assert(whenNullOpt == null || !LocalRewriter.ReadIsSideeffecting(whenNullOpt)); 1388Debug.Assert(replacer._replaced == 1, "should have replaced exactly one node"); 1428Debug.Assert(node.InitializerExpressionOpt == null);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (6)
67Debug.Assert(!badRegion); 98Debug.Assert(local.RefKind != RefKind.None); 107Debug.Assert(parameter.TypeWithAnnotations.IsRestrictedType()); 118Debug.Assert(!allVariables.Any((s, method) => s.Symbol is ParameterSymbol { ContainingSymbol: var container } && container != method && container is not SynthesizedPrimaryConstructor, method)); 270Debug.Assert(parameter.IsThis || parameter.RefKind == RefKind.None); 306Debug.Assert(!topLevelMethod.IsExtensionBlockMember()); // extension methods were replaced with implementation methods earlier in the pipeline
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (22)
117Debug.Assert(F != null); 118Debug.Assert(originalMethod != null); 119Debug.Assert(state != null); 120Debug.Assert(nonReusableLocalProxies != null); 121Debug.Assert(!nonReusableFieldsForCleanup.IsDefault); 122Debug.Assert(diagnostics != null); 123Debug.Assert(hoistedVariables != null); 124Debug.Assert(nextFreeHoistedLocalSlot >= 0); 152Debug.Assert(thisProxyReplacement.Type is not null); 181Debug.Assert(localOrParameter.Kind == SymbolKind.Local || localOrParameter.Kind == SymbolKind.Parameter); 213Debug.Assert(TypeSymbol.Equals(frameClass, result.Type, TypeCompareKind.ConsiderEverything2)); 288Debug.Assert(!NeedsProxy(local) || proxies.ContainsKey(local)); 319Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.Spill || 540Debug.Assert(!node.Locals.IsEmpty); 547Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.UserDefined && 633Debug.Assert(!node.IsRef); 644Debug.Assert(leftLocal.SynthesizedKind == SynthesizedLocalKind.Spill || 646Debug.Assert(node.IsRef); 670Debug.Assert(assignedLocal.SynthesizedKind switch 679Debug.Assert(awaitSyntax != null); 835Debug.Assert(proxy != null); 851Debug.Assert(proxy != null);
Lowering\StateMachineRewriter\RefInitializationHoister.cs (13)
67Debug.Assert( 74Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.Spill || 76Debug.Assert(local.GetDeclaratorSyntax() != null); 78Debug.Assert(local.SynthesizedKind switch 98Debug.Assert(TypeSymbol.Equals(type, replacement.Type, TypeCompareKind.ConsiderEverything2)); 195Debug.Assert(field.ReceiverOpt != null); 240Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.Out); 261Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.In); 262Debug.Assert(conditional.IsRef); 284Debug.Assert(_reportedError || isFieldAccessOfStruct || expr.Type!.IsTypeParameter()); 285Debug.Assert(_reportedError || expr is BoundLocal { LocalSymbol.RefKind: RefKind.None } 293Debug.Assert(assignedLocal.SynthesizedKind == SynthesizedLocalKind.Spill); 303Debug.Assert(expr.Type is not null);
Lowering\StateMachineRewriter\ResumableStateMachineStateAllocator.cs (3)
52Debug.Assert(SyntaxBindingUtilities.BindsToResumableStateMachineState(awaitOrYieldReturnSyntax)); 60Debug.Assert(!_matchedStates[(int)state * direction]); 82Debug.Assert(f.ModuleBuilderOpt != null);
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (3)
51Debug.Assert((object)type != null); 52Debug.Assert(slotDebugInfo.SynthesizedKind.IsLongLived() == (slotIndex >= 0)); 98Debug.Assert(parameter is { IsThis: false });
Lowering\StateMachineRewriter\StateMachineRewriter.cs (15)
46Debug.Assert(body != null); 47Debug.Assert(method != null); 48Debug.Assert(stateMachineType is not null); 49Debug.Assert(compilationState != null); 50Debug.Assert(diagnostics != null); 51Debug.Assert(diagnostics.DiagnosticBag != null); 52Debug.Assert(stateMachineStateDebugInfoBuilder.IsEmpty); 63Debug.Assert(TypeSymbol.Equals(F.CurrentType, method.ContainingType, TypeCompareKind.ConsiderEverything2)); 64Debug.Assert(F.Syntax == body.Syntax); 157Debug.Assert(variable.Kind == SymbolKind.Local || variable.Kind == SymbolKind.Parameter); 178Debug.Assert(synthesizedKind == SynthesizedLocalKind.Spill || 183Debug.Assert(local.RefKind == RefKind.None); 317Debug.Assert((object)method.ThisParameter != null); 385Debug.Assert(CanGetThreadId()); 525Debug.Assert(!method.IsIterator || !method.IsAsync); // an override handles async-iterators
Lowering\StateMachineRewriter\StateMachineTypeSymbol.cs (2)
24Debug.Assert(kickoffMethod != null); 57Debug.Assert(base.GetAttributes().Length == 0);
Lowering\StateMachineRewriter\SynthesizedStateMachineMethod.cs (1)
74Debug.Assert(base.GetAttributes().Length == 0);
Lowering\SynthesizedMethodBaseSymbol.cs (8)
54Debug.Assert((object)containingType != null); 55Debug.Assert((object)baseMethod != null); 63Debug.Assert(typeMap != null); 64Debug.Assert(this.TypeMap == null); 65Debug.Assert(!typeParameters.IsDefault); 66Debug.Assert(_typeParameters.IsDefault); 155Debug.Assert(base.GetAttributes().IsEmpty); 163Debug.Assert(base.GetReturnTypeAttributes().IsEmpty);
Lowering\SynthesizedSubmissionFields.cs (2)
33Debug.Assert(compilation != null); 34Debug.Assert(submissionClass.IsSubmissionClass);
Lowering\SyntheticBoundNodeFactory.cs (79)
121Debug.Assert(node != null); 122Debug.Assert(compilationState != null); 123Debug.Assert(diagnostics != null); 139Debug.Assert(TopLevelMethod is null || TypeSymbol.Equals(TopLevelMethod.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2)); 145Debug.Assert(CurrentFunction is null || 155Debug.Assert(ModuleBuilderOpt is { }); 177Debug.Assert(CurrentType is { }); 185Debug.Assert(CurrentType is { }); 193Debug.Assert(CurrentType is { }); 201Debug.Assert(CurrentType is { }); 209Debug.Assert(CurrentType is { }); 218Debug.Assert(ModuleBuilderOpt is { }); 229Debug.Assert(CurrentFunction is { IsStatic: false, ThisParameter: { } }); 240Debug.Assert(CurrentFunction is { IsStatic: false }); 272Debug.Assert(receiverOpt is null || receiverOpt.Type is { } && 280Debug.Assert((receiverOpt is null) == property.IsStatic); 284Debug.Assert(!(receiverOpt is { Type: ArrayTypeSymbol { IsSZArray: true } } && 289Debug.Assert(accessor is not null); 295Debug.Assert((receiverOpt is null) == property.IsStatic); 297Debug.Assert(accessor is not null); 366Debug.Assert(result is not null); 407Debug.Assert(result is not null); 444Debug.Assert(left.Type is { } && right.Type is { } && 563Debug.Assert(CurrentFunction is { }); 575Debug.Assert(useSiteInfo.Diagnostics.IsNullOrEmpty()); 576Debug.Assert(conversion.Kind != ConversionKind.NoConversion); 580Debug.Assert(CurrentFunction.RefKind == RefKind.None); 590Debug.Assert(CurrentFunction is { }); 669Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 670Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 676Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 677Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 706Debug.Assert(c.IsImplicit); 707Debug.Assert(c.IsBoxing || c.IsReference || c.IsIdentity); 836Debug.Assert(methodSymbol.IsStatic); 844Debug.Assert(methodSymbol.IsStatic); 845Debug.Assert(methodSymbol.IsGenericMethod); 846Debug.Assert(methodSymbol.Arity == typeArgs.Length); 854Debug.Assert(methodSymbol.IsStatic); 883Debug.Assert(method.ParameterCount == args.Length); 925Debug.Assert(method.ParameterCount == args.Length); 940Debug.Assert(valueTypeReceiver.Type is { }); 941Debug.Assert(TypeSymbol.Equals(valueTypeReceiver.Type, referenceTypeReceiver.Type, TypeCompareKind.ConsiderEverything2)); 947Debug.Assert(left.Type!.Equals(right.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) || left.Type.IsErrorType()); 948Debug.Assert(left.Type.IsReferenceType); 976Debug.Assert(thenClause != null); 1058Debug.Assert(result.Type is { }); 1065Debug.Assert(result.Type is { }); 1074Debug.Assert(result.Type is { }); 1104Debug.Assert(ex.Type is { SpecialType: CodeAnalysis.SpecialType.System_Int32 }); 1131Debug.Assert(statements[0] is null); 1148Debug.Assert(!labels.Contains(v2)); 1177Debug.Assert(stringConst.IsString || stringConst.IsNull); 1188Debug.Assert(charConst.IsChar || charConst.IsDefaultValue); 1199Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1205Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1218Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1225Debug.Assert(CurrentFunction is { ThisParameter: { } }); 1270Debug.Assert(type.CanBeAssignedNull()); 1289Debug.Assert(systemType.ExtendedSpecialType == InternalSpecialType.System_Type || 1303Debug.Assert(TypeSymbol.Equals(systemType, getTypeFromHandle.ReturnType, TypeCompareKind.AllIgnoreOptions)); 1325Debug.Assert(this.CompilationState is { DynamicOperationContextType: { } }); 1347Debug.Assert(result.Type.IsErrorType() || result.Type!.IsDerivedFrom(result.GetMethodFromHandle!.ReturnType, TypeCompareKind.AllIgnoreOptions, ref discardedUseSiteInfo)); 1454Debug.Assert(result.Type.IsErrorType() || result.Type!.IsDerivedFrom(result.GetMethodFromHandle!.ReturnType, TypeCompareKind.AllIgnoreOptions, ref discardedUseSiteInfo)); 1471Debug.Assert(systemReflectionMethodOrConstructorInfo.ExtendedSpecialType == InternalSpecialType.System_Reflection_MethodInfo || 1534Debug.Assert(arg.Type is { }); 1641Debug.Assert(expression is { Type: { SpecialType: CodeAnalysis.SpecialType.System_Boolean } }); 1662Debug.Assert(argument.Type is { }); 1664Debug.Assert(containingMethod is { }); 1665Debug.Assert(kind != SynthesizedLocalKind.UserDefined); 1682Debug.Assert(argument.GetRefKind() != RefKind.In); 1739Debug.Assert(node.Type is { }); 1762Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 1768Debug.Assert( 1838Debug.Assert(loweredLeft != null); 1839Debug.Assert(loweredRight != null); 1840Debug.Assert((object)returnType != null); 1841Debug.Assert(returnType.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 1842Debug.Assert(loweredLeft.IsLiteralNull() != loweredRight.IsLiteralNull());
Lowering\UnmatchedGotoFinder.cs (1)
30Debug.Assert(unmatchedLabelsCache != null);
Operations\CSharpOperationFactory_Methods.cs (8)
64Debug.Fail($"Unexpected syntax kind: {syntax.Kind()}"); 150Debug.Assert(boundConversion.SymbolOpt is not null); 202Debug.Assert(property is not null); 227Debug.Assert(attribute.Constructor is not null); 326Debug.Assert(methodOrIndexer.GetIsVararg() ^ parameters.Length == arguments.Length); 383Debug.Assert(argumentsInEvaluationBuilder.All(static arg => arg is not null)); 415Debug.Assert(arguments.Length >= declarations.Length); 471Debug.Assert(currentDeclarationIndex == declarations.Length);
Operations\CSharpOperationFactory.cs (48)
520Debug.Assert(initializer.Initializers.All(i => i is ISimpleAssignmentOperation)); 534Debug.Assert(declaredTypeOpt != null); 545Debug.Assert(declaredTypeOpt != null); 702Debug.Assert(type is not null); 726Debug.Assert(isImplicit); 727Debug.Assert(type is not null); 826Debug.Assert(!boundObjectInitializerMember.Expanded); 873Debug.Assert(boundObjectInitializerMember.Type.IsDynamic()); 1032Debug.Assert(!forceOperandImplicitLiteral || boundConversion.Operand is BoundLiteral); 1063Debug.Assert(!forceOperandImplicitLiteral); 1064Debug.Assert(!boundOperand.GetInterpolatedStringHandlerData().IsDefault); 1072Debug.Assert(!forceOperandImplicitLiteral); 1076Debug.Assert(boundConversion.SymbolOpt is object); 1090Debug.Assert(isImplicit || target.Syntax != syntax || target.IsImplicit || boundConversion.ConversionGroupOpt != null); 1110Debug.Assert(boundOperand.Kind == BoundKind.BadExpression || 1113Debug.Assert(!forceOperandImplicitLiteral); 1126Debug.Assert(!forceOperandImplicitLiteral); 1215Debug.Assert(typeOperand is not null); 1226Debug.Assert(typeOperand is not null); 1237Debug.Assert(typeOperand is not null); 1304Debug.Assert(!objectCreation.Type.IsAnonymousType); 1328Debug.Fail("Unhandled case: " + collectionCreation.GetType()); 1407Debug.Assert(!IsMemberInitializer(boundAssignmentOperator)); 1421Debug.Assert(IsMemberInitializer(boundAssignmentOperator)); 1539Debug.Assert(stack.Count > 0); 1554Debug.Assert(left is not null && stack.Count == 0); 1604Debug.Assert(boundBinaryOperator.InterpolatedStringHandlerData is not null); 1717Debug.Assert(lengthSymbol is not null); 1718Debug.Assert(indexerSymbol is not null); 2031Debug.Assert(boundForEachStatement.IterationVariables.Length == 1); 2075Debug.Assert(boundCatchBlock.ExceptionFilterPrologueOpt is null); 2097Debug.Assert((boundUsingStatement.DeclarationsOpt == null) != (boundUsingStatement.ExpressionOpt == null)); 2098Debug.Assert(boundUsingStatement.ExpressionOpt is object || boundUsingStatement.Locals.Length > 0); 2190Debug.Assert(node.Parent != null); 2198Debug.Fail($"Unexpected syntax: {kind}"); 2285Debug.Assert(boundExpressionStatement.Syntax == sequence.Value.Syntax); 2322Debug.Assert(positionInfo == null || boundInterpolatedString.InterpolationData is null or { BuilderType: null }); 2365Debug.Assert(parts.Length == positionInfo.Length); 2388Debug.Assert(bad.ChildBoundNodes.Length == 2416Debug.Assert(alignment is null); 2417Debug.Assert(format is null); 2425Debug.Assert(valueOperation.IsImplicit); 2435Debug.Assert(valueOperation.Syntax != part.Syntax); 2485Debug.Assert(conversion.Conversion.IsInterpolatedStringHandler); 2778Debug.Assert(boundSwitchExpression.DefaultLabel is GeneratedLabelSymbol); 2819Debug.Assert(boundSwitchLabel.Pattern.Kind == BoundKind.DiscardPattern); 2960Debug.Assert(nameSyntax is not null); 3009Debug.Assert(!patternDisposeInfo.Method.IsStatic);
Parser\Blender.cs (5)
37Debug.Assert(lexer != null); 93Debug.Assert(lexer != null); 94Debug.Assert(changes != null); 95Debug.Assert(newPosition >= 0); 134Debug.Assert(token.Kind() != SyntaxKind.None, "how could we not get a real token back?");
Parser\Blender.Cursor.cs (1)
132Debug.Assert(this.CurrentNodeOrToken.IsNode);
Parser\Blender.Reader.cs (2)
108Debug.Assert(!_oldTreeCursor.IsFinished); 140Debug.Assert(_changeDelta > 0 || _oldTreeCursor.IsFinished);
Parser\CharacterInfo.cs (3)
55Debug.Assert(IsHexDigit(c)); 65Debug.Assert(IsBinaryDigit(c)); 75Debug.Assert(IsDecDigit(c));
Parser\DirectiveParser.cs (1)
414Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken);
Parser\DocumentationCommentParser.cs (9)
813Debug.Assert(missingNodeOrToken.IsMissing); 973Debug.Assert(CurrentToken.Kind == SyntaxKind.ThisKeyword); 987Debug.Assert(CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword); 1018Debug.Assert(CurrentToken.Kind == SyntaxKind.OperatorKeyword); 1151Debug.Assert(SyntaxFacts.IsAnyOverloadableOperator(operatorToken.Kind)); 1161Debug.Assert(kind is not (SyntaxKind.GreaterThanGreaterThanEqualsToken or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken)); // Reaching this code path is not expected 1207Debug.Assert(CurrentToken.Kind == SyntaxKind.ExplicitKeyword || 1270Debug.Assert(CurrentToken.Kind != SyntaxKind.CommaToken); 1364Debug.Assert(CurrentToken.Kind == SyntaxKind.LessThanToken);
Parser\LanguageParser_InterpolatedString.cs (16)
21Debug.Assert(expressionKind != SyntaxKind.None); 28Debug.Assert(originalToken.Text is ['"', '"', '"', ..]); 34Debug.Assert(interpolatedString.StringStartToken.Kind is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken); 35Debug.Assert(interpolatedString.Contents is [InterpolatedStringTextSyntax]); 60Debug.Assert(!interpolatedText.TextToken.ContainsDiagnostics); 69Debug.Assert(diagnosticsBuilder.Count > 0); 112Debug.Assert(this.CurrentToken.Kind == SyntaxKind.InterpolatedStringToken); 115Debug.Assert(originalToken.Text[0] is '$' or '@'); 144Debug.Assert(originalToken.ToFullString() == result.ToFullString()); // yield from text equals yield from node 154Debug.Assert(!interpolatedText.TextToken.ContainsDiagnostics); 172Debug.Assert(isInterpolatedString || interpolations.Count == 0, "Non-interpolated parsing should never produce interpolations"); 244Debug.Assert(closeQuoteText[afterWhitespace] == '"'); 514Debug.Assert(text[interpolation.OpenBraceRange.Start..interpolation.CloseBraceRange.End] == result.ToFullString()); // yield from text equals yield from node 529Debug.Assert(text[interpolation.OpenBraceRange.Start..interpolation.CloseBraceRange.End] == result.ToFullString()); // yield from text equals yield from node 586Debug.Assert(kind is Lexer.InterpolatedStringKind.Normal or Lexer.InterpolatedStringKind.Verbatim); 595Debug.Assert(token.Kind == SyntaxKind.StringLiteralToken);
Parser\LanguageParser_Patterns.cs (1)
224Debug.Assert(precedence < Precedence.Shift);
Parser\LanguageParser.cs (152)
211Debug.Assert(_recursionDepth == 0); 251Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NamespaceKeyword); 282Debug.Assert(semicolon != null || openBrace != null); 289Debug.Assert(semicolon != null); 293Debug.Assert(initialBadNodes == null); // init bad nodes should have been attached to semicolon... 309Debug.Assert(initialBadNodes == null); // init bad nodes should have been attached to open brace... 570Debug.Assert(!IsInAsync); 941Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ExternKeyword); 952Debug.Assert(this.IsNamedAssignment()); 969Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UsingKeyword); 1365Debug.Assert(!(forAccessors && forTopLevelStatements)); 1373Debug.Assert(newMod != DeclarationModifiers.Scoped); 1493Debug.Assert(modTok.Kind is not (SyntaxKind.OutKeyword or SyntaxKind.InKeyword)); 1548Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken && GetModifierExcludingScoped(this.CurrentToken) != DeclarationModifiers.None); 1666Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1702Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1754Debug.Assert(!IsInAsync); 1776Debug.Assert(CurrentToken.ContextualKind is SyntaxKind.RecordKeyword or SyntaxKind.ExtensionKeyword or SyntaxKind.UnionKeyword); 1786Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword or SyntaxKind.InterfaceKeyword || 1790Debug.Assert(!IsInAsync); 1970Debug.Assert(name is not null); 1986Debug.Assert(name is not null); 2002Debug.Assert(name is not null); 2018Debug.Assert(name is not null); 2037Debug.Assert(name is not null); 2056Debug.Assert(name is null); 2057Debug.Assert(baseList is null); 2168Debug.Assert((_termState & TerminatorState.IsEndOfTypeSignature) != 0); 2321Debug.Assert(list.Count > 0); 2608Debug.Assert(!IsInAsync); 2609Debug.Assert(parentKind == SyntaxKind.CompilationUnit); 2896Debug.Assert(identifierOrThisOpt != null || IsStartOfPropertyBody(index: 0)); 3257Debug.Assert(!IsInAsync); 3258Debug.Assert(parentKind != SyntaxKind.CompilationUnit); 3390Debug.Assert(identifierOrThisOpt != null || IsStartOfPropertyBody(index: 0)); 3565Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ColonToken or SyntaxKind.EqualsGreaterThanToken); 3590Debug.Assert(this.CurrentToken.Kind == SyntaxKind.TildeToken); 3735Debug.Assert(!IsInAsync); 3867Debug.Assert(!style.IsMissing || haveExplicitInterfaceName == explicitInterfaceOpt is not null); 4061Debug.Assert(!opToken.IsMissing); 4072Debug.Assert(opToken.IsMissing); // ConvertToMissingWithTrailingTrivia should have converted to a missing token. 4074Debug.Assert(type != null); // How could it be? The only caller got it from ParseReturnType. 4093Debug.Assert(!opToken.IsMissing); 4225Debug.Assert(thisKeyword.Kind == SyntaxKind.ThisKeyword); 4299Debug.Assert(IsStartOfPropertyBody(index: 0)); 4365Debug.Assert( 4709Debug.Assert(accessorName.ContainsDiagnostics); 4759Debug.Assert(accessorName.ContainsDiagnostics); 4962Debug.Assert(parent.Kind() == SyntaxKind.ParameterList); 5059Debug.Assert(!(isFunctionPointerParameter && isLambdaParameter), "Can't be parsing parameters for both a function pointer and a lambda at the same time"); 5111Debug.Assert(this.CurrentToken.Kind == SyntaxKind.FixedKeyword); 5129Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EventKeyword); 5155Debug.Assert(typeParameterList == null, "Exit condition of ParseMemberName in this scenario"); 5180Debug.Assert(identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword); 5188Debug.Assert(identifier != null); 5189Debug.Assert(identifier.Kind == SyntaxKind.IdentifierToken); 5330Debug.Assert(localFunction == null); 5360Debug.Assert(variables.Count == 0); 5410Debug.Assert(localFunction is null); 5422Debug.Assert(list.Count > 0); 5738Debug.Assert(argumentList is null); 5739Debug.Assert(initializer is null); 5747Debug.Assert(this.CurrentToken.Kind != SyntaxKind.EqualsToken); 5826Debug.Assert(this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken); 5883Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 5916Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EnumKeyword); 6263Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6336Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6420Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6433Debug.Assert(start.Kind == SyntaxKind.LessThanToken); 6434Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6606Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6732Debug.Assert(list.Count > 0); 6812Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6936Debug.Assert(beforeIdentifierPointSet); 6981Debug.Assert(!ReferenceEquals(tmp, explicitInterfaceName), "We should have consumed something and updated explicitInterfaceName"); 7119Debug.Assert(separator.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken); 7260Debug.Assert(mode != ParseTypeMode.NewExpression); 7292Debug.Assert(this.CurrentToken.Kind is SyntaxKind.IdentifierToken); 7303Debug.Assert(result is ScanTypeFlags.GenericTypeOrExpression or ScanTypeFlags.GenericTypeOrMethod or ScanTypeFlags.NonGenericTypeOrExpression); 7324Debug.Assert(result is ScanTypeFlags.GenericTypeOrExpression or ScanTypeFlags.GenericTypeOrMethod or ScanTypeFlags.NonGenericTypeOrExpression); 7478Debug.Assert(IsFunctionPointerStart()); 7519Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 7675Debug.Assert(type != null); 7742Debug.Assert(type != null); 7749Debug.Assert(this.CurrentToken.Kind == SyntaxKind.QuestionToken); 8070Debug.Assert(IsFunctionPointerStart()); 8119Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8142Debug.Assert(list.Count > 0); 8199Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8587Debug.Assert(PeekToken(1).Kind != SyntaxKind.OpenParenToken); 8593Debug.Assert(PeekToken(2).Kind != SyntaxKind.OpenParenToken); 8941Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 8969Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 8989Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 9414Debug.Assert(this.CurrentToken.Kind is SyntaxKind.TryKeyword or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9426Debug.Assert(@try.ContainsDiagnostics); 9427Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9490Debug.Assert(this.CurrentToken.Kind == SyntaxKind.CatchKeyword); 9573Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 9590Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DoKeyword); 9631Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9652Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9796Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForEachKeyword || this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9845Debug.Assert(discard.Kind == SyntaxKind.UnderscoreToken); 9898Debug.Assert(mode is ParseTypeMode.Normal or ParseTypeMode.FirstElementOfPossibleTupleLiteral or ParseTypeMode.AfterTupleComma); 10013Debug.Assert(this.CurrentToken.Kind == SyntaxKind.GotoKeyword); 10079Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IfKeyword); 10144Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ElseKeyword); 10167Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LockKeyword); 10179Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ReturnKeyword); 10189Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword); 10226Debug.Assert(this.CurrentToken.Kind is SyntaxKind.SwitchKeyword or SyntaxKind.CaseKeyword); 10272Debug.Assert(parenExpression.GetDiagnostics().Length == 0); 10302Debug.Assert(this.IsPossibleSwitchSection()); 10352Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword); 10374Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ThrowKeyword); 10384Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UnsafeKeyword); 10509Debug.Assert(st != ScanTypeFlags.NullableType); 10520Debug.Assert(this.CurrentToken.Kind == SyntaxKind.WhileKeyword); 10534Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.ColonToken); 10595Debug.Assert(variables.Count == 0); 10802Debug.Assert(localFunction == null); 10904Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken); 11900Debug.Assert(IsExpectedAssignmentOperator(operatorToken.Kind)); 11901Debug.Assert(GetPrecedence(operatorExpressionKind) == Precedence.Assignment); 11942Debug.Assert(IsAtDotDotToken()); 12194Debug.Assert(expr != null); 12283Debug.Assert(this.CurrentToken.Kind == SyntaxKind.BaseKeyword); 12546Debug.Assert(openKind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken); 12547Debug.Assert(closeKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken); 12548Debug.Assert((openKind == SyntaxKind.OpenParenToken) == (closeKind == SyntaxKind.CloseParenToken)); 12744Debug.Assert(checkedOrUnchecked.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 12787Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12818Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12894Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 12982Debug.Assert(!inSwitchArmPattern || forPattern, "Can't be in a switch arm without also being in a pattern"); 13308Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 13327Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 13386Debug.Assert(IsAnonymousType()); 13389Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBraceToken); 13676Debug.Assert(this.CurrentToken.Kind is SyntaxKind.NewKeyword or SyntaxKind.StackAllocKeyword); 13874Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword); 14261Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword); 14294Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.JoinKeyword); 14314Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.LetKeyword); 14327Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword); 14335Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.OrderByKeyword); 14368Debug.Assert(list.Count > 0); 14398Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.SelectKeyword); 14406Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.GroupKeyword); 14416Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword);
Parser\Lexer_RawStringLiteral.cs (5)
57Debug.Assert(startingQuoteCount >= 3); 73Debug.Assert(info.Kind is (SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)); 94Debug.Assert(info.StringValue == null); 97Debug.Assert(!this.HasErrors); 137Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar()));
Parser\Lexer_StringLiteral.cs (26)
17Debug.Assert(quoteCharacter is '\'' or '"'); 63Debug.Assert(this.CurrentLexemeWidth > 0); 134Debug.Assert(ch == '\\'); 194Debug.Assert(TextWindow.PeekChar() == '@'); 208Debug.Assert(TextWindow.PeekChar() == '"'); 390Debug.Assert(_lexer.TextWindow.Position != start); 463Debug.Assert(startingDollarSignCount > 0); 467Debug.Assert(startingDollarSignCount == 0); 468Debug.Assert(totalAtCount == 0); 474Debug.Assert(totalAtCount + startingDollarSignCount + startingQuoteCount >= 2); 534Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 548Debug.Assert(kind is InterpolatedStringKind.Normal or InterpolatedStringKind.Verbatim); 554Debug.Assert(IsAtEnd(kind)); 569Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 577Debug.Assert(IsAtEnd(kind)); 593Debug.Assert(closeQuoteCount >= startingQuoteCount); 623Debug.Assert(closeQuoteCount >= startingQuoteCount); 640Debug.Assert(closeQuoteCount >= startingQuoteCount); 788Debug.Assert(kind == InterpolatedStringKind.Verbatim); 800Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 837Debug.Assert(kind is InterpolatedStringKind.MultiLineRaw or InterpolatedStringKind.SingleLineRaw); 869Debug.Assert(kind is InterpolatedStringKind.Normal or InterpolatedStringKind.Verbatim); 898Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 972Debug.Assert(_lexer.TextWindow.PeekChar() == ':'); 1058Debug.Assert(colonRange.Equals(default(Range))); 1158Debug.Assert(start == _lexer.TextWindow.PeekChar());
Parser\Lexer.cs (52)
120Debug.Assert(options != null); 329Debug.Assert(info.Kind != SyntaxKind.IdentifierToken || info.StringValue != null); 411Debug.Assert(SyntaxFacts.IsPunctuationOrKeyword(info.Kind)); 614Debug.Assert(TextWindow.PeekChar() == '@'); 738Debug.Assert(TextWindow.PeekChar() == '@'); 764Debug.Assert(TextWindow.PeekChar() == '$'); 1037Debug.Assert(info.Text != null); 1135Debug.Assert(hasUSuffix && hasLSuffix); 1600Debug.Assert(string.Equals(info.Text.Substring(0, objectAddressOffset + 1), "@0x", StringComparison.OrdinalIgnoreCase)); 1636Debug.Assert(InXmlCrefOrNameAttributeValue); 1695Debug.Assert(consumedSurrogate == SlidingTextWindow.InvalidCharacter, "Since consumedChar == '\\'"); 2070Debug.Assert(firstCh is '<' or '|' or '=' or '>'); 2210Debug.Assert(delimiter is '/' or '@'); 2211Debug.Assert(TextWindow.PeekChar() == delimiter && TextWindow.PeekChar(1) == '*'); 2277Debug.Assert(SyntaxFacts.IsWhitespace(TextWindow.PeekChar())); 2312Debug.Assert(this.CurrentLexemeWidth > 0); 2712Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2807Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) || TextWindow.PeekChar() == SlidingTextWindow.InvalidCharacter); 2843Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 2844Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 2888Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2902Debug.Assert(TextWindow.PeekChar() == '<'); 2951Debug.Assert(TextWindow.PeekChar() == '&'); 3210Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3211Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3278Debug.Assert(false, "Should have picked up leading indentationTrivia, but didn't."); 3294Debug.Assert(false, "Should have picked up leading indentationTrivia, but didn't."); 3306Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3383Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3384Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3450Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3541Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3542Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3601Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3602Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3686Debug.Assert(TextWindow.Position > beforeConsumed, "First character or entity has been consumed."); 3797Debug.Assert(info.Text == null, "Haven't tried to set it yet."); 3798Debug.Assert(info.StringValue == null, "Haven't tried to set it yet."); 3886Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 4007Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 4008Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 4129Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 4130Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 4260Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 4261Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 4472Debug.Assert(this.StyleIs(XmlDocCommentStyle.Delimited)); 4601Debug.Assert(info == null, "Never produce a diagnostic while peeking."); 4609Debug.Assert(ch != SlidingTextWindow.InvalidCharacter, "Precondition established by all callers; required for correctness of AdvanceChar() call."); 4637Debug.Assert(character == '\\'); 4687Debug.Assert(character == 'u' || character == 'x'); 4741Debug.Assert(TextWindow.PeekChar() == '&'); 4855Debug.Assert(codepoint > 0x0000FFFF && codepoint <= 0x0010FFFF);
Parser\LexerCache.cs (1)
192Debug.Assert(span.Length > 0);
Parser\QuickScanner.cs (3)
234Debug.Assert(state == QuickScanState.Bad || state == QuickScanState.Done, "can only exit with Bad or Done"); 241Debug.Assert(tokenLength > 0); 269Debug.Assert(quickWidth == token.FullWidth);
Parser\SlidingTextWindow.cs (4)
119Debug.Assert(!_freed); 271Debug.Assert(_positionInText >= 0, "Position in text cannot be negative."); 290Debug.Assert(SyntaxFacts.IsNewLine(this.PeekChar())); 296Debug.Assert(SyntaxFacts.IsNewLine(currentChar));
Parser\SyntaxParser.cs (29)
173Debug.Assert(offset >= 0); 185Debug.Assert(offset >= 0 && offset < _tokenCount); 211Debug.Assert(_resetCount == point.ResetCount); 240Debug.Assert(_allowModeReset); 255Debug.Assert(_blendedTokens != null); 295Debug.Assert(_blendedTokens != null); 370Debug.Assert(tokenResult.Token != null); 382Debug.Assert(token != null); 406Debug.Assert(shiftOffset > 0); 434Debug.Assert(shiftOffset > 0); 468Debug.Assert(n >= 0); 523Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 539Debug.Assert(SyntaxFacts.IsAnyToken(expected)); 577Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 591Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 612Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 647Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 661Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 694Debug.Assert(missingNodeOrToken.IsMissing); 756Debug.Assert(!node.IsMissing); 767Debug.Assert(nodeOrToken.Width > 0 || nodeOrToken.RawKind is (int)SyntaxKind.EndOfFileToken); 785Debug.Assert(missingNodeOrToken.IsMissing); 861Debug.Assert(child.IsMissing, "All children of a missing node or token should themselves be missing."); 866Debug.Assert(childToken.Text == "", "All missing tokens should have no text"); 875Debug.Assert(allTrivia.Count > 0, "How can a token with skipped text not have trivia at all?"); 889Debug.Fail("This should not be reachable. We should have hit a skipped token in the trivia of this token."); 893Debug.Fail("This should not be reachable. We should have hit a child token with skipped text within this node."); 1125Debug.Assert(!token.IsMissing); 1187Debug.Assert(!assertIfFalse);
SourceGeneration\CSharpSyntaxHelper.cs (3)
44Debug.Assert(attribute is AttributeSyntax); 45Debug.Assert(attribute.Parent is AttributeListSyntax); 46Debug.Assert(attribute.Parent.Parent is not null);
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
107Debug.Assert(ctor.MethodKind == MethodKind.Constructor && typeDeclaration.ParameterList is object);
SymbolDisplay\SymbolDisplay.cs (2)
268Debug.Assert(semanticModelOpt == null); 269Debug.Assert(positionOpt < 0);
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (2)
44Debug.Assert(value.GetType().GetTypeInfo().IsPrimitive || value is string || value is decimal); 46Debug.Assert(valueString != null);
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (6)
26Debug.Assert(IsMinimizing); 51Debug.Assert(IsMinimizing); 61Debug.Assert(IsMinimizing); 64Debug.Assert(symbol.ContainingNamespace != null || symbol.IsGlobalNamespace); 95Debug.Assert(Format.GlobalNamespaceStyle == SymbolDisplayGlobalNamespaceStyle.Included || 131Debug.Assert(IsMinimizing);
SymbolDisplay\SymbolDisplayVisitor.cs (3)
90Debug.Assert(visitor != this); 228Debug.Assert(this.IsFirstSymbolVisited, "Don't call with IsFirstSymbolVisited = false if OmittedAsContaining"); 371Debug.Assert((object)containingType != null || (symbol.ContainingSymbol is ITypeSymbol));
SymbolDisplay\SymbolDisplayVisitor.Members.cs (7)
395Debug.Assert(containingType != null); 615Debug.Assert(!conventionTypes.IsDefaultOrEmpty); 626Debug.Assert(conventionType.Name.StartsWith("CallConv")); 690Debug.Assert(operatorKind != SyntaxKind.None); 736Debug.Assert(conversionKind != SyntaxKind.None); 932Debug.Assert(containingType != null || (symbol.ContainingSymbol is ITypeSymbol)); 1057Debug.Assert(implementedMember.ContainingType != null);
SymbolDisplay\SymbolDisplayVisitor.Types.cs (8)
254Debug.Assert(symbol.DelegateInvokeMethod is not null); 317Debug.Assert(symbol.IsTupleType); 412Debug.Assert(symbol.Arity > 0); 495Debug.Assert(symbol.DelegateInvokeMethod is not null); 545Debug.Assert(tupleSymbol.IsTupleType); 584Debug.Assert(symbol.IsTupleType); 750Debug.Assert(!symbol.IsRefLikeType); 1002Debug.Assert(extension.IsExtension);
Symbols\AbstractTypeMap.cs (5)
27Debug.Assert((object)previous.ConstructedFrom == (object)previous); 166Debug.Assert(builder.Count == customModifiers.Length); 196Debug.Assert(0 <= interfaces.Length && interfaces.Length <= 2); 200Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T> 205Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T>
Symbols\AliasSymbol.cs (4)
58Debug.Assert(locations.Length == 1 || (locations.IsEmpty && aliasName == "global")); // It looks like equality implementation depends on this condition. 59Debug.Assert(containingSymbol is not null); 291Debug.Assert(syntax.Alias is object); 330Debug.Assert(won, "Only one thread can win the alias target CompareExchange");
Symbols\AnonymousTypes\AnonymousTypeDescriptor.cs (3)
54Debug.Assert(!this.Fields.IsDefault); 104Debug.Assert(!newFieldTypes.IsDefault); 105Debug.Assert(newFieldTypes.Length == this.Fields.Length);
Symbols\AnonymousTypes\AnonymousTypeField.cs (1)
74Debug.Assert(this.Name != null && this.Location != null && this.TypeWithAnnotations.HasType);
Symbols\AnonymousTypes\AnonymousTypeManager.cs (6)
19Debug.Assert(compilation != null); 57Debug.Assert((object)type != null); 58Debug.Assert(type.IsAnonymousType); 69Debug.Assert(type.IsAnonymousType); 81Debug.Assert(!newFieldTypes.IsDefault); 82Debug.Assert(type.IsAnonymousType);
Symbols\AnonymousTypes\AnonymousTypeManager.SymbolCollection.cs (3)
34Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor)); 35Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Diagnostics_DebuggerHiddenAttribute__ctor)); 36Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Diagnostics_DebuggerBrowsableAttribute__ctor));
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (22)
102Debug.Assert(_sourceLocationsSeen.ContainsKey(location)); 156Debug.Assert(refKinds.IsNull || parameterCount == refKinds.Capacity - (returnsVoid ? 0 : 1)); 159Debug.Assert(key.Name != null); 182Debug.Assert(typeDescr.Location.IsInSource); // AnonymousDelegateTemplateSymbol requires a location in source for ordering. 192Debug.Assert(fields.All(f => hasDefaultScope(useUpdatedEscapeRules, f))); 202Debug.Assert(needsIndexedName); 203Debug.Assert(i == fields.Length - 2); 204Debug.Assert(field.Type.IsSZArray()); 218Debug.Assert(nTypeArguments != 0); 226Debug.Assert(lastParam.Type.IsSZArray()); 264Debug.Assert(typeArguments.Length == template.TypeParameters.Length); 287Debug.Assert(typeParameters.Length == template.TypeParameters.Length); 339Debug.Assert(changed); 382Debug.Assert(isContainedIn(yOwner, xOwner)); 410Debug.Assert(ReferenceEquals(this, anonymous.Manager)); 554Debug.Assert(!builder.Any()); 572Debug.Assert(!builder.Any()); 594Debug.Assert(!builder.Any()); 711Debug.Assert((object)type != null); 720Debug.Assert((object)type != null); 721Debug.Assert(type.IsAnonymousType); 732Debug.Assert((object)method != null);
Symbols\AnonymousTypes\PublicSymbols\AnonymousType.TypePublicSymbol.cs (1)
55Debug.Assert(membersCount == _members.Length);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.DelegateTemplateSymbol.cs (7)
41Debug.Assert(refKinds.IsNull || parameterCount == refKinds.Capacity - (voidReturnTypeOpt is { } ? 0 : 1)); 103Debug.Assert(SmallestLocation != null); 104Debug.Assert(SmallestLocation != Location.None); 136Debug.Assert(field.Type.IsSZArray()); 137Debug.Assert(i == parameterCount - 1); 163Debug.Assert(SmallestLocation != null); 164Debug.Assert(SmallestLocation != Location.None);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.FieldSymbol.cs (1)
26Debug.Assert((object)property != null);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.PropertySymbol.cs (5)
47Debug.Assert((object)container != null); 48Debug.Assert((object)field != null); 49Debug.Assert(fieldTypeWithAnnotations.HasType); 50Debug.Assert(index >= 0); 51Debug.Assert(!locations.IsDefault);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TemplateSymbol.cs (1)
78Debug.Assert(membersCount == _members.Length);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TypeOrDelegateTemplateSymbol.cs (4)
68Debug.Assert(_smallestLocation != null); 81Debug.Assert(value != null); 83Debug.Assert(oldValue == null || 94Debug.Assert(location.IsInSource);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TypeParameterSymbol.cs (2)
27Debug.Assert((object)container != null); 28Debug.Assert(!string.IsNullOrEmpty(name));
Symbols\ArrayTypeSymbol.cs (7)
30Debug.Assert(elementTypeWithAnnotations.HasType); 414Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 480Debug.Assert(nullableAnnotation != DefaultNullableAnnotation); 518Debug.Assert(constructedInterfaces.Length <= 2); 576Debug.Assert(rank >= 1); 639Debug.Assert(!sizes.IsDefaultOrEmpty || !lowerBounds.IsDefault); 640Debug.Assert(lowerBounds.IsDefaultOrEmpty || (!lowerBounds.IsEmpty && (lowerBounds.Length != rank || !lowerBounds.All(b => b == 0))));
Symbols\AssemblySymbol.cs (27)
69Debug.Assert((object)_corLibrary == null); 527Debug.Assert(SpecialMembers.GetDescriptor(feature).DeclaringSpecialType == SpecialType.System_Runtime_CompilerServices_RuntimeFeature); 680Debug.Assert(result?.IsErrorType() != true); 725Debug.Assert(parts.Length > 0); 735Debug.Assert(!type.IsErrorType()); 747Debug.Assert(!type.IsErrorType()); 762Debug.Assert(type?.IsErrorType() != true); 779Debug.Assert(!typeInfo.IsByRef); 782Debug.Assert(!typeInfo.ContainsGenericParameters); 808Debug.Assert(!typeInfo.IsArray); 818Debug.Assert(currentTypeInfo.IsGenericTypeDefinition || !currentTypeInfo.IsGenericType); 839Debug.Assert(symbol?.IsErrorType() != true); 855Debug.Assert(symbol is null || typeArgumentIndex == genericArguments.Length); 874Debug.Assert(!symbol.IsErrorType()); 879Debug.Assert(typeArgumentIndex == genericArguments.Length); 889Debug.Assert(remainingTypeArguments >= symbol.Arity); 928Debug.Assert(warnings is null || isWellKnownType); 935Debug.Assert(result?.IsErrorType() != true); 957Debug.Assert(corLibCandidate?.IsErrorType() != true); 966Debug.Assert(this is SourceAssemblySymbol, 984Debug.Assert(!(this is SourceAssemblySymbol && assembly.IsMissing)); // Non-source assemblies can have missing references 992Debug.Assert(candidate?.IsErrorType() != true); 999Debug.Assert(!TypeSymbol.Equals(candidate, result, TypeCompareKind.ConsiderEverything)); 1043Debug.Assert(result?.IsErrorType() != true); 1066Debug.Assert((object)result.ContainingType == null || IsValidWellKnownType(result.ContainingType), 1080Debug.Assert(result?.IsErrorType() != true); 1081Debug.Assert(result is null || ReferenceEquals(result.ContainingAssembly, assembly));
Symbols\Attributes\AttributeData.cs (20)
88Debug.Assert(!attributeType.IsErrorType()); 216Debug.Assert(!this.HasErrors); 217Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 245Debug.Assert(arguments.AttributeSyntaxOpt is object); 296Debug.Assert(arguments.AttributeSyntaxOpt is object); 339Debug.Assert((object)targetSymbol != null); 340Debug.Assert(targetSymbol.Kind == SymbolKind.Assembly || targetSymbol.Kind == SymbolKind.NamedType || targetSymbol.Kind == SymbolKind.Method); 341Debug.Assert(this.IsSecurityAttribute(compilation)); 382Debug.Assert((object)targetSymbol != null); 383Debug.Assert(targetSymbol.Kind == SymbolKind.Assembly || targetSymbol.Kind == SymbolKind.NamedType || targetSymbol.Kind == SymbolKind.Method); 384Debug.Assert(typedValue.ValueInternal is object); 508Debug.Assert(!this.HasErrors); 516Debug.Assert(AttributeClass is object); 572Debug.Assert(!this.HasErrors); 575Debug.Assert(ctorArgument.Kind == TypedConstantKind.Enum || ctorArgument.Kind == TypedConstantKind.Primitive); 597Debug.Assert(!this.HasErrors); 600Debug.Assert(ctorArgument.Kind == TypedConstantKind.Enum || ctorArgument.Kind == TypedConstantKind.Primitive); 623Debug.Assert(!this.HasErrors); 672Debug.Assert(target is SourceAssemblySymbol || target.ContainingAssembly is SourceAssemblySymbol); 805Debug.Assert(attribute is SourceAttributeData);
Symbols\Attributes\PEAttributeData.cs (1)
111Debug.Assert(lazyConstructorArguments != null && lazyNamedArguments != null);
Symbols\Attributes\RetargetingAttributeData.cs (4)
30Debug.Assert(underlying is SourceAttributeData or SynthesizedAttributeData); 31Debug.Assert(attributeClass is object || underlying.HasErrors); 54Debug.Assert(AttributeClass is object || _underlying.HasErrors); 62Debug.Assert(AttributeConstructor is null);
Symbols\Attributes\SourceAttributeData.cs (17)
41Debug.Assert(compilation is object); 42Debug.Assert(applicationNode is object); 43Debug.Assert(!isConditionallyOmitted || attributeClass is object && attributeClass.IsConditional); 44Debug.Assert(!constructorArguments.IsDefault); 45Debug.Assert(!namedArguments.IsDefault); 46Debug.Assert(constructorArgumentsSourceIndices.IsDefault || 48Debug.Assert(attributeConstructor is object || hasErrors); 129Debug.Assert(!this.HasErrors); 130Debug.Assert(this.AttributeConstructor is object); 131Debug.Assert(parameterIndex >= 0); 132Debug.Assert(parameterIndex < this.AttributeConstructor.ParameterCount); 139Debug.Assert(attributeSyntax.ArgumentList != null); 140Debug.Assert(this.AttributeConstructor.ParameterCount <= attributeSyntax.ArgumentList.Arguments.Count); 152Debug.Assert(this.AttributeConstructor.Parameters[parameterIndex].IsOptional || 158Debug.Assert(sourceArgIndex >= 0); 159Debug.Assert(sourceArgIndex < attributeSyntax.ArgumentList!.Arguments.Count); 475Debug.Assert(attributeClass is object);
Symbols\Attributes\WellKnownAttributeData\PropertyEarlyWellKnownAttributeData.cs (1)
32Debug.Assert(value != null);
Symbols\Attributes\WellKnownAttributeData\TypeWellKnownAttributeData.cs (2)
28Debug.Assert((object)_comImportCoClass == null); 29Debug.Assert((object)value != null);
Symbols\Attributes\WellKnownAttributeData\TypeWellKnownEarlyAttributeData.cs (1)
60Debug.Assert(value is -1 or > 0);
Symbols\BaseTypeAnalysis.cs (9)
20Debug.Assert((object)depends != null); 21Debug.Assert((object)on != null); 22Debug.Assert(on.IsDefinition); 65Debug.Assert((object)depends != null); 66Debug.Assert((object)on != null); 67Debug.Assert(on.IsDefinition); 82Debug.Assert((object)type != null); 175Debug.Assert((object)type != null); 188Debug.Assert((object)(field.AssociatedSymbol as EventSymbol) == null,
Symbols\Compilation_UsedAssemblies.cs (3)
174Debug.Assert(!dependency.IsLinked); 192Debug.Assert(retargetingAssembly.Modules[0].ReferencedAssemblySymbols.Contains(underlyingDependency)); 253Debug.Assert(!added || !wasFrozen);
Symbols\Compilation_WellKnownMembers.cs (27)
58Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 70Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 83Debug.Assert(member >= 0 && member < WellKnownMember.Count); 127Debug.Assert(type.IsValid()); 155Debug.Assert(result?.IsErrorType() != true); 169Debug.Assert(conflicts is (null, null)); 186Debug.Assert( 224Debug.Assert(wellKnownType == WellKnownType.System_Attribute || 270Debug.Assert(!isStatic); 405Debug.Assert(isOptionalUse || WellKnownMembers.IsSynthesizedAttributeOptional(constructor)); 428Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(constructor)); 451Debug.Assert(isOptionalUse); 469Debug.Assert(!systemByte.HasUseSiteError); 472Debug.Assert(!systemUnit32.HasUseSiteError); 520Debug.Assert(!modifyCompilation || !_needsGeneratedAttributes_IsFrozen); 581Debug.Assert(ShouldEmitNativeIntegerAttributes()); 645Debug.Assert(ShouldEmitNativeIntegerAttributes()); 718Debug.Assert(errorReported); 743Debug.Assert((object)debuggableAttribute != null, "GetWellKnownType unexpectedly returned null"); 820Debug.Assert(type.ContainsDynamic()); 840Debug.Assert(type.ContainsTuple()); 846Debug.Assert(!names.IsDefault, "should not need the attribute when no tuple names"); 935Debug.Assert(flagsBuilder.Any()); 936Debug.Assert(flagsBuilder.Contains(true)); 959Debug.Assert(!transformFlagsBuilder.Any()); 1007Debug.Assert(!isNestedNamedType); 1085Debug.Assert(type.ContainingAssembly?.RuntimeSupportsNumericIntPtr != true);
Symbols\ConstantValueUtils.cs (1)
50Debug.Assert(value != null);
Symbols\ConstraintsHelper.cs (31)
139Debug.Assert(currentCompilation == null || typeParameter.IsFromCompilation(currentCompilation)); 161Debug.Assert(!constraintType.Type.ContainsDynamic()); 223Debug.Assert(inherited || currentCompilation == null || constraintType.TypeKind != TypeKind.Delegate); 257Debug.Assert(inherited || currentCompilation == null); 263Debug.Assert(inherited || currentCompilation == null); 269Debug.Assert(inherited || currentCompilation == null); 322Debug.Assert((effectiveBaseClass.SpecialType == SpecialType.System_Object) || (deducedBaseType.SpecialType != SpecialType.System_Object)); 328Debug.Assert(effectiveBaseClass.SpecialType == SpecialType.System_Object); 329Debug.Assert(interfaces.Length == 0); 359Debug.Assert(!withTypeParametersBinder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 397Debug.Assert(!withTypeParametersBinder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 419Debug.Assert(constraintClauses.Length == arity); 431Debug.Assert((constraintKind & (TypeParameterConstraintKind.ValueTypeFromConstraintTypes | TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes)) == 0); 474Debug.Assert(!deducedBase.IsValueType || typeParameter.HasReferenceTypeConstraint); 612Debug.Assert(tuple.IsTupleType); 683Debug.Assert(typeArgumentsSyntax.Count == 0 /*omitted*/ || typeArgumentsSyntax.Count == type.Arity); 907Debug.Assert(typeParameters.Length == typeArguments.Length); 908Debug.Assert(!args.Conversions.IncludeNullability || (nullabilityDiagnosticsBuilderOpt != null)); 915Debug.Assert(typeParameters.All(tp => ReferenceEquals(tp.ContainingSymbol, constructedContainingSymbol.OriginalDefinition))); 1064Debug.Assert(substitution != null); 1067Debug.Assert(ReferenceEquals(typeParameter.ContainingSymbol, constructedContainingSymbol.OriginalDefinition)); 1410Debug.Assert(iface.IsInterfaceType()); 1515Debug.Assert(type.TypeKind is TypeKind.Class or TypeKind.Struct); 1552Debug.Assert(IsValidEncompassedByArgument(a)); 1553Debug.Assert(IsValidEncompassedByArgument(b)); 1556Debug.Assert(!conversions.IncludeNullability); 1594Debug.Assert(!type.ConstructedFrom.Equals(type, TypeCompareKind.ConsiderEverything)); 1616Debug.Assert(method.ConstructedFrom != method 1624Debug.Assert((object)deducedBase != null); 1625Debug.Assert((object)effectiveBase != null); 1627Debug.Assert(deducedBase.IsErrorType() ||
Symbols\ConstructedNamedTypeSymbol.cs (4)
71Debug.Assert(constructedFrom.Arity == typeArgumentsWithAnnotations.Length); 72Debug.Assert(constructedFrom.Arity != 0); 99Debug.Assert(typeArguments.Length == n); 100Debug.Assert(typeArguments.Length > 0);
Symbols\CustomModifier.cs (1)
21Debug.Assert((object)modifier != null);
Symbols\DiscardSymbol.cs (1)
16Debug.Assert(typeWithAnnotations.Type is object);
Symbols\DynamicTypeEraser.cs (1)
20Debug.Assert((object)objectType != null);
Symbols\DynamicTypeSymbol.cs (2)
234Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 245Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\ErrorMethodSymbol.cs (1)
287Debug.Assert(MethodKind == MethodKind.Constructor);
Symbols\ErrorTypeSymbol.cs (4)
73Debug.Assert(ResultKind != LookupResultKind.Viable, "Shouldn't have viable result kind on error symbol"); 488Debug.Assert(this.IsDefinition); 489Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol?.OriginalDefinition)); 569Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\EventSymbol.cs (4)
267Debug.Assert(this.IsDefinition); 268Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 269Debug.Assert(newOwner.IsDefinition || newOwner is SubstitutedNamedTypeSymbol); 289Debug.Assert(this.IsDefinition);
Symbols\ExtendedErrorTypeSymbol.cs (3)
35Debug.Assert(((object?)containingSymbol == null) || 41Debug.Assert(unreported == false || errorInfo != null); 79Debug.Assert(candidateSymbols.IsEmpty || resultKind != LookupResultKind.Viable, "Shouldn't use LookupResultKind.Viable with candidate symbols");
Symbols\Extensions\ReceiverParameterSymbol.cs (1)
36Debug.Assert(_underlyingParameter.InterpolatedStringHandlerArgumentIndexes.IsEmpty);
Symbols\Extensions\RewrittenLambdaOrLocalFunctionSymbol.cs (2)
20Debug.Assert(lambdaOrLocalFunctionSymbol.AssociatedSymbol is null); 21Debug.Assert(lambdaOrLocalFunctionSymbol.TryGetThisParameter(out var thisParameter) && thisParameter is null);
Symbols\Extensions\RewrittenMethodSymbol.cs (2)
21Debug.Assert(originalMethod.IsDefinition); 22Debug.Assert(originalMethod.ExplicitInterfaceImplementations.IsEmpty);
Symbols\Extensions\SourceExtensionImplementationMethodSymbol.cs (5)
25Debug.Assert(sourceMethod.IsExtensionBlockMember()); 26Debug.Assert(sourceMethod.IsStatic || sourceMethod.ContainingType.ExtensionParameter is not null); 135Debug.Assert(parameters.Count == ParameterCount); 180Debug.Assert(string.Equals(result, withIncludes, System.StringComparison.Ordinal)); 227Debug.Assert(_underlyingParameter.ContainingSymbol is not NamedTypeSymbol);
Symbols\Extensions\SynthesizedExtensionMarker.cs (4)
29Debug.Assert(extensionType.IsDefinition); 30Debug.Assert(extensionType.IsExtension); 31Debug.Assert(parameterList is not null); 93Debug.Assert(parameterTypeSyntax is not null);
Symbols\FieldOrPropertyInitializer.cs (1)
31Debug.Assert(((syntax.IsKind(SyntaxKind.EqualsValueClause) || syntax.IsKind(SyntaxKind.Parameter)) && fieldOpt != null) || syntax is StatementSyntax);
Symbols\FieldSymbol.cs (9)
329Debug.Assert(this.IsDefinition); 330Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 353Debug.Assert(IsDefinition); 414Debug.Assert(!(this is TupleElementFieldSymbol or TupleErrorFieldSymbol)); 423Debug.Assert(!(this is TupleElementFieldSymbol or TupleErrorFieldSymbol)); 437Debug.Assert(!(this is TupleElementFieldSymbol)); 450Debug.Assert(!(this is TupleElementFieldSymbol)); 473Debug.Assert(!(this is TupleElementFieldSymbol or TupleErrorFieldSymbol or Retargeting.RetargetingFieldSymbol)); 491Debug.Assert(tupleElementPosition < NamedTypeSymbol.ValueTupleRestPosition);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (17)
59Debug.Assert(refKind != RefKind.None); 212Debug.Assert(specifierType?.IsErrorType() != true); 213Debug.Assert(specifierType is null || ReferenceEquals(specifierType.ContainingAssembly, compilation.Assembly.CorLibrary)); 280Debug.Assert(callingConvention == CallingConvention.Unmanaged); 312Debug.Assert(refKind is RefKind.None or RefKind.In or RefKind.Ref or RefKind.Out); 323Debug.Assert(refKind != RefKind.Out && refKind != RefKind.In); 350Debug.Assert(RefKind == signature.RefKind); 363Debug.Assert(thisParam.RefKind == otherParam.RefKind); 451Debug.Assert(originalParameters.Length == substitutedParameterTypes.Length); 452Debug.Assert(substitutedRefCustomModifiers.IsDefault || originalParameters.Length == substitutedRefCustomModifiers.Length); 496Debug.Assert(refKind != RefKind.Out); 497Debug.Assert(refCustomModifiers.IsDefaultOrEmpty || refKind != RefKind.None); 498Debug.Assert(parameterRefCustomModifiers.IsDefault || parameterRefCustomModifiers.Length == parameterTypes.Length); 509Debug.Assert(refCustomModifiers.IsEmpty || refKind != RefKind.None); 545Debug.Assert(retAndParamTypes.Length > 0); 554Debug.Assert(RefKind != RefKind.Out); 812Debug.Assert(!isVararg || HasUseSiteError);
Symbols\FunctionPointers\FunctionPointerParameterSymbol.cs (1)
18Debug.Assert(typeWithAnnotations.HasType);
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (3)
127Debug.Assert(nullableAnnotation != DefaultNullableAnnotation); 163Debug.Assert(this.Equals(other, TypeCompareKind.AllIgnoreOptions)); 209Debug.Assert(modifierType.ContainingAssembly is not null || modifierType.IsErrorType());
Symbols\FunctionTypeSymbol.cs (7)
66Debug.Assert((object?)_lazyDelegateType == Uninitialized); 67Debug.Assert(_expression is null); 68Debug.Assert(expression.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 81Debug.Assert(_binder is { }); 82Debug.Assert(_calculateDelegate is { }); 83Debug.Assert(_expression is { }); 162Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
Symbols\LexicalSortKey.cs (4)
56Debug.Assert(position >= 0); 57Debug.Assert(treeOrdinal >= 0); 114Debug.Assert(comparison != 0); 137Debug.Assert(other.IsInitialized);
Symbols\MemberSignatureComparer.cs (7)
379Debug.Assert(!considerExplicitlyImplementedInterfaces || considerName, "Doesn't make sense to consider interfaces separately from name."); 389Debug.Assert((_typeComparison & TypeCompareKind.FunctionPointerRefOutInRefReadonlyMatch) == 0, 391Debug.Assert(_refKindCompareMode == RefKindCompareMode.RefOutInRefReadonlyMatch || 486Debug.Assert(sawInterfaceInName2); 615Debug.Assert(typeParameters1.Length == typeParameters2.Length); 740Debug.Assert(params1.Length == params2.Length); 798Debug.Assert(refKindCompareMode == RefKindCompareMode.RefOutInRefReadonlyMatch);
Symbols\MemberSymbolExtensions.cs (16)
133Debug.Assert(member.GetMemberArityIncludingExtension() != 0); 144Debug.Assert(property.IsExtensionBlockMember()); 159Debug.Assert(originalTypeParameters.Length == method.Arity + method.ContainingType.Arity); 231Debug.Assert(property.IsExtensionBlockMember()); 233Debug.Assert(extension.Arity > 0); 234Debug.Assert(extension.Arity == typeArguments.Length); 257Debug.Assert((object)constructed != null); 283Debug.Assert(method.IsExtensionBlockMember()); 297Debug.Assert(receiverType is not null); 298Debug.Assert(property.IsExtensionBlockMember()); 375Debug.Assert(symbol.ContainingType.IsInterface); 796Debug.Assert(member.IsDefinition); 808Debug.Assert(member.IsDefinition); 820Debug.Assert(member.IsDefinition); 833Debug.Assert(member.IsDefinition); 845Debug.Assert(member.IsDefinition);
Symbols\MergedNamespaceSymbol.cs (2)
81Debug.Assert(namespacesToMerge.Length != 0); 101Debug.Assert(ns.ConstituentNamespaces.Length == 1);
Symbols\Metadata\PE\DynamicTypeDecoder.cs (16)
46Debug.Assert(!dynamicTransformFlags.IsEmpty); 47Debug.Assert((object)containingAssembly != null); 71Debug.Assert((object)metadataType != null); 112Debug.Assert((object)metadataType != null); 113Debug.Assert((object)containingAssembly != null); 114Debug.Assert(!dynamicTransformFlags.IsDefault); 131Debug.Assert(checkLength || decoder._dynamicTransformFlags.LastIndexOf(true) < decoder._index); 142Debug.Assert(_index >= 0); 173Debug.Assert(!_haveCustomModifierFlags, "This shouldn't happen during decoding."); 195Debug.Assert(customModifiersCount >= 0); 211Debug.Assert(_index >= 0); 221Debug.Assert(!flag); 234Debug.Assert(newContainingType.IsGenericType); 305Debug.Assert(!flag); 328Debug.Assert(!flag); 350Debug.Assert(!flag);
Symbols\Metadata\PE\MemberRefMetadataDecoder.cs (5)
38Debug.Assert((object)containingType != null); 78Debug.Assert(cumulativeArity <= position); 104Debug.Assert((object)typeArgument == null); 249Debug.Assert(candidateMethodTypeMap != null); 277Debug.Assert(candidateMethodTypeMap != null);
Symbols\Metadata\PE\MetadataDecoder.cs (16)
58Debug.Assert((object)moduleSymbol != null); 101Debug.Assert(position >= 0 && position < type.Arity); 121Debug.Assert(result?.IsErrorType() != true); 169Debug.Assert(result?.IsErrorType() != true); 310Debug.Assert((object)result != null); 313Debug.Assert(cache != null); 316Debug.Assert(ReferenceEquals(newresult, result) || (newresult.Kind == SymbolKind.ErrorType)); 364Debug.Assert((object)assembly != null); 372Debug.Assert(candidate?.IsGenericType != true); 373Debug.Assert(candidate?.IsErrorType() != true); 374Debug.Assert(candidate is null || ReferenceEquals(candidate.ContainingAssembly, assembly)); 388Debug.Assert(!(assembly is SourceAssemblySymbol) || !((SourceAssemblySymbol)assembly).SourceModule.MightContainNoPiaLocalTypes()); 490Debug.Assert(typeSymbol.IsDefinition); 517Debug.Assert(typeSymbol is PENamedTypeSymbol || typeSymbol is ErrorTypeSymbol); 540Debug.Assert(!targetTypeSymbol.IsTupleType); 544Debug.Assert(scope.Kind == SymbolKind.NamedType || scope.Kind == SymbolKind.ErrorType);
Symbols\Metadata\PE\NativeIntegerTypeDecoder.cs (4)
41Debug.Assert(type.ContainsErrorType()); 42Debug.Assert(result is null); 47Debug.Assert(result is object); 102Debug.Assert(type.TypeKind == TypeKind.Error);
Symbols\Metadata\PE\NullableTypeDecoder.cs (3)
27Debug.Assert(metadataType.HasType); 28Debug.Assert(accessSymbol.IsDefinition); 29Debug.Assert((object)accessSymbol.ContainingModule == containingModule);
Symbols\Metadata\PE\PEAssemblySymbol.cs (2)
75Debug.Assert(assembly != null); 76Debug.Assert(documentationProvider != null);
Symbols\Metadata\PE\PEEventSymbol.cs (2)
65Debug.Assert(!handle.IsNil); 163Debug.Assert(candidateAssociatedField.DeclaredAccessibility == Accessibility.Private);
Symbols\Metadata\PE\PEFieldSymbol.cs (9)
59Debug.Assert((value & ~(FlowAnalysisAnnotations.DisallowNull | FlowAnalysisAnnotations.AllowNull | FlowAnalysisAnnotations.MaybeNull | FlowAnalysisAnnotations.NotNull)) == 0); 80Debug.Assert(value == 0 || result); 87Debug.Assert(IsVolatile == isVolatile); 96Debug.Assert(RefKind == refKind); 161Debug.Assert((object)moduleSymbol != null); 162Debug.Assert((object)containingType != null); 163Debug.Assert(!fieldDef.IsNil); 313Debug.Assert((object)eventSymbol != null); 314Debug.Assert(TypeSymbol.Equals(eventSymbol.ContainingType, _containingType, TypeCompareKind.ConsiderEverything2));
Symbols\Metadata\PE\PEGlobalNamespaceSymbol.cs (1)
32Debug.Assert((object)moduleSymbol != null);
Symbols\Metadata\PE\PEMethodSymbol.cs (34)
129Debug.Assert((long)value == ((long)value & MethodKindMask)); 165Debug.Assert(EnumUtilities.ContainsAllValues<MethodKind>((int)MethodKindMask)); 166Debug.Assert(EnumUtilities.ContainsAllValues<NullableContextKind>((int)NullableContextMask)); 178Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 185Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 191Debug.Assert((long)methodKind == ((long)methodKind & MethodKindMask)); 193Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 203Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 258Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 422Debug.Assert((object)moduleSymbol != null); 423Debug.Assert((object)containingType != null); 424Debug.Assert(!methodDef.IsNil); 436Debug.Assert((uint)implFlags <= ushort.MaxValue); 449Debug.Assert((uint)localflags <= ushort.MaxValue); 475Debug.Assert(flag != 0 && ((ushort)flag & ((ushort)flag - 1)) == 0); 633Debug.Assert(_packedFlags.IsExplicitOverrideIsPopulated); 646Debug.Assert(_packedFlags.IsExplicitOverrideIsPopulated); 711Debug.Fail("Not expecting to get here; if we end up here through ENC, add tests to verify"); 742Debug.Assert(!memberNotNull.IsDefault); 750Debug.Assert(!memberNotNullWhenTrue.IsDefault); 756Debug.Assert(!memberNotNullWhenFalse.IsDefault); 817Debug.Assert((methodKind == MethodKind.PropertyGet) || (methodKind == MethodKind.PropertySet)); 827Debug.Assert((methodKind == MethodKind.EventAdd) || (methodKind == MethodKind.EventRemove)); 835Debug.Assert(TypeSymbol.Equals(propertyOrEventSymbol.ContainingType, _containingType, TypeCompareKind.ConsiderEverything2)); 843Debug.Assert( 1032Debug.Assert(!attributeData.IsDefault); 1558Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.Uninitialized)); 1559Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound)); 1653Debug.Assert(!result.IsDefault); 1681Debug.Assert(MethodKind == MethodKind.Constructor); 1737Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyData, UnmanagedCallersOnlyAttributeData.Uninitialized) 1763Debug.Assert(result != null); 1830Debug.Assert(AssociatedSymbol?.GetCallerUnsafeMode(ConsList<FieldSymbol>.Empty) != CallerUnsafeMode.Implicit); 1870Debug.Assert(_uncommonFields is null or { _lazyOverloadResolutionPriority: 0 });
Symbols\Metadata\PE\PEModuleSymbol.cs (19)
138Debug.Assert(ordinal >= 0); 144Debug.Assert(ordinal > 0); 150Debug.Assert(ordinal > 0); 155Debug.Assert((object)assemblySymbol != null); 156Debug.Assert(module != null); 380Debug.Assert(added); 452Debug.Assert((object)_lazyEventRegistrationTokenSymbol != null); 469Debug.Assert((object)_lazyEventRegistrationTokenTableSymbol != null); 484Debug.Assert((object)_lazySystemTypeSymbol != null); 495Debug.Assert(currentModuleResult?.IsErrorType() != true); 499Debug.Assert(isAcceptableSystemTypeSymbol(currentModuleResult)); 534Debug.Assert(isAcceptableSystemTypeSymbol(referencedAssemblyResult)); 603Debug.Assert(result?.IsErrorType() != true); 659Debug.Assert(forwarder.Value.FirstIndex >= 0, "First index should never be negative"); 661Debug.Assert((object)firstSymbol != null, "Invalid indexes (out of bound) are discarded during reading metadata in PEModule.EnsureForwardTypeToAssemblyMap()"); 666Debug.Assert((object)secondSymbol != null, "Invalid indexes (out of bound) are discarded during reading metadata in PEModule.EnsureForwardTypeToAssemblyMap()"); 682Debug.Assert(symbol is object); 683Debug.Assert(symbol.IsDefinition); 684Debug.Assert((object)symbol.ContainingModule == this);
Symbols\Metadata\PE\PENamedTypeSymbol.cs (34)
99Debug.Assert(result != s_noUncommonProperties || result.IsDefaultValue(), "default value was modified"); 318Debug.Assert(!handle.IsNil); 319Debug.Assert((object)container != null); 320Debug.Assert(arity == 0 || this is PENamedTypeSymbolGeneric); 321Debug.Assert(markerType is null == markerMethod.IsNil); 322Debug.Assert(markerType is null || container.IsType); 358Debug.Assert(ReferenceEquals(_name, metadataName) == (_name == metadataName)); 371Debug.Assert(markerType is null); 464Debug.Assert(!uncommon.MarkerMethodHandle.IsNil); 476Debug.Assert(this.IsExtension); 477Debug.Assert(method.IsDefinition); 478Debug.Assert(method.ContainingType == (object)this); 967Debug.Assert(uncommon.lazyHasRequiredMembers.Value() == hasRequiredMembers); 973Debug.Assert(uncommon.lazyIsClosed.Value() == isClosed); 1429Debug.Assert(instanceIndex == uncommon.lazyInstanceEnumFields.Length); 1430Debug.Assert(staticIndex == staticFields.Length || staticFields[staticIndex].Kind != SymbolKind.Field); 1452Debug.Assert((object)associatedField.AssociatedSymbol != null); 1453Debug.Assert(!nonEventFields.Contains(associatedField)); 1504Debug.Assert(result.Count == count); 1729Debug.Assert(SymbolKind.Field.ToSortOrder() < SymbolKind.Method.ToSortOrder()); 1730Debug.Assert(SymbolKind.Method.ToSortOrder() < SymbolKind.Property.ToSortOrder()); 1731Debug.Assert(SymbolKind.Property.ToSortOrder() < SymbolKind.Event.ToSortOrder()); 1732Debug.Assert(SymbolKind.Event.ToSortOrder() < SymbolKind.NamedType.ToSortOrder()); 1828Debug.Assert(field.AssociatedSymbol.Kind == SymbolKind.Event); 1863Debug.Assert(previous.Kind.ToSortOrder() <= current.Kind.ToSortOrder()); 1876Debug.Assert(members is object); 2043Debug.Assert(exchangeResult == null); 2095Debug.Assert(!MangleName); 2690Debug.Assert(found || !module.ShouldImportMethod(typeDef, methodDef, this.ContainingPEModule.ImportOptions)); 2774Debug.Assert(DeriveCompilerFeatureRequiredDiagnostic() is null); 3011Debug.Assert(!conditionalSymbols.IsDefault); 3217Debug.Assert(this.SpecialType == SpecialType.System_IntPtr || this.SpecialType == SpecialType.System_UIntPtr); 3265Debug.Assert(genericParameterHandles.Count > 0); 3330Debug.Assert(_arity > 0);
Symbols\Metadata\PE\PENamespaceSymbol.cs (4)
100Debug.Assert(lazyTypes != null); 213Debug.Assert(typesByNS != null); 344Debug.Assert(isNoPiaLocalType); 345Debug.Assert(result is not null);
Symbols\Metadata\PE\PENestedNamespaceSymbol.cs (4)
75Debug.Assert(name != null); 76Debug.Assert((object)containingNamespace != null); 77Debug.Assert(typesByNS != null); 132Debug.Assert(lazyNamespaces != null && lazyTypes != null);
Symbols\Metadata\PE\PEParameterSymbol.cs (27)
98Debug.Assert(EnumUtilities.ContainsAllValues<WellKnownAttributeFlags>(WellKnownAttributeDataMask)); 99Debug.Assert(EnumUtilities.ContainsAllValues<RefKind>(RefKindMask)); 100Debug.Assert(EnumUtilities.ContainsAllValues<FlowAnalysisAnnotations>(FlowAnalysisAnnotationsMask)); 101Debug.Assert(EnumUtilities.ContainsAllValues<ScopedKind>(ScopeMask)); 148Debug.Assert(value == 0 || result); 247Debug.Assert((object)moduleSymbol != null); 248Debug.Assert((object)containingSymbol != null); 249Debug.Assert(ordinal >= 0); 250Debug.Assert(typeWithAnnotations.HasType); 334Debug.Assert(refKind != RefKind.None); 370Debug.Assert(refKind == this.RefKind); 371Debug.Assert(hasNameInMetadata == this.HasNameInMetadata); 372Debug.Assert(_name is not null); 420Debug.Assert(parameter.RefKind != RefKind.RefReadOnlyParameter); 458Debug.Assert(_refCustomModifiers.IsEmpty || isByRef); 553Debug.Assert(!_handle.IsNil); 595Debug.Assert(!_handle.IsNil); 846Debug.Assert(indexes != s_defaultStringHandlerAttributeIndexes); 857Debug.Assert(indexes != s_defaultStringHandlerAttributeIndexes); 868Debug.Assert(indexes != s_defaultStringHandlerAttributeIndexes); 870Debug.Assert(initialized == s_defaultStringHandlerAttributeIndexes || indexes == initialized || indexes.SequenceEqual(initialized)); 915Debug.Assert(!ContainingSymbol.IsExtensionBlockMember()); 1007Debug.Assert(!_handle.IsNil); 1021Debug.Assert(!_handle.IsNil); 1112Debug.Assert(_lazyIsParams == 0 || _lazyIsParams == result); 1121Debug.Assert(!_lazyHiddenAttributes.IsDefault); 1130Debug.Assert(!_handle.IsNil);
Symbols\Metadata\PE\PEPropertySymbol.cs (8)
216Debug.Assert((object)moduleSymbol != null); 217Debug.Assert((object)containingType != null); 218Debug.Assert(!handle.IsNil); 224Debug.Assert(propertyParams.Length > 0); 930Debug.Assert((getMethodParams == null) == ((object)getMethod == null)); 931Debug.Assert((setMethodParams == null) == ((object)setMethod == null)); 1141Debug.Assert(IsIndexer || IsIndexedProperty || this.IsExtensionBlockMember()); 1153Debug.Assert(_uncommonFields is null or { _lazyOverloadResolutionPriority: 0 });
Symbols\Metadata\PE\PETypeParameterSymbol.cs (20)
71Debug.Assert((object)moduleSymbol != null); 72Debug.Assert((object)definingSymbol != null); 73Debug.Assert(ordinal >= 0); 74Debug.Assert(!handle.IsNil); 153Debug.Assert(!inProgress.ContainsReference(this)); 154Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol)); 198Debug.Assert(!HasNotNullConstraint && !HasValueTypeConstraint); 322Debug.Assert(isNotNullable == true); 366Debug.Assert(fromTypes == true); 375Debug.Assert(fromNonTypeConstraints == null || fromNonTypeConstraints == true); 376Debug.Assert(fromTypes != true); 382Debug.Assert(!constraintTypes.IsDefaultOrEmpty); 392Debug.Assert(fromType == true); 546Debug.Assert(type.HasType && type.SpecialType == SpecialType.System_Object); 583Debug.Assert(!HasValueTypeConstraint); 671Debug.Assert(!inProgress.ContainsReference(this)); 672Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol)); 677Debug.Assert(!constraintTypes.IsDefault); 708Debug.Assert(_lazyCachedConstraintsUseSiteInfo.IsInitialized); 715Debug.Assert(_lazyCachedConstraintsUseSiteInfo.IsInitialized);
Symbols\Metadata\PE\SymbolFactory.cs (1)
142Debug.Assert(typeParameters.Length > 0);
Symbols\Metadata\PE\TupleTypeDecoder.cs (3)
264Debug.Assert(decodedContainingType.IsGenericType); 297Debug.Assert(elementNames.IsDefault || elementNames.Length == tupleCardinality); 351Debug.Assert(numberOfElements > 0);
Symbols\MetadataOrSourceAssemblySymbol.cs (11)
50Debug.Assert(module.GetReferencedAssemblies().Length == 0); 60Debug.Assert(result?.IsErrorType() != true); 70Debug.Assert(_lazySpecialTypes is not null); 83Debug.Assert(typeId != SpecialType.None); 84Debug.Assert(ReferenceEquals(corType.ContainingAssembly, this)); 85Debug.Assert(corType.ContainingModule.Ordinal == 0); 86Debug.Assert(ReferenceEquals(this.CorLibrary, this)); 96Debug.Assert(ReferenceEquals(corType, _lazySpecialTypes[(int)typeId]) || 103Debug.Assert(_cachedSpecialTypes > 0 && _cachedSpecialTypes < (int)InternalSpecialType.NextAvailable); 137Debug.Assert(!underlyingType.IsNativeIntegerType); 186Debug.Assert(module.GetReferencedAssemblies().Length == 0);
Symbols\MetadataOrSourceOrRetargetingAssemblySymbol.cs (2)
58Debug.Assert(result != IVTConclusion.NoRelationshipClaimed); 72Debug.Assert(!assertUnexpectedGiver, "We are performing a check for an unrelated assembly which likely indicates a bug.");
Symbols\MethodSymbol.cs (12)
238Debug.Assert(this.RefKind != RefKind.Out); 404Debug.Assert(!(this is IAttributeTargetSymbol)); //such types must override 542Debug.Assert(conditionalSymbols != null); 726Debug.Assert(!this.IsExtensionBlockMember()); 906Debug.Assert(this.IsDefinition); 907Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 970Debug.Assert(this.IsDefinition); 1029Debug.Assert(callConvTypedConstant.Kind == TypedConstantKind.Type); 1055Debug.Assert((node == null) == (diagnostics == null)); 1291Debug.Assert(obsoleteData != ObsoleteAttributeData.Uninitialized, "getting synthesized attributes before attributes are decoded"); 1324Debug.Assert(this.IsDefinition); 1325Debug.Assert(this.IsExtensionBlockMember());
Symbols\MethodSymbolExtensions.cs (3)
23Debug.Assert((object)method != null); 86Debug.Assert(method.IsGenericMethod == (typeArguments.Length > 0)); 97Debug.Assert((object)hiddenMethod != null);
Symbols\MissingAssemblySymbol.cs (1)
34Debug.Assert(identity != null);
Symbols\MissingCorLibrarySymbol.cs (2)
44Debug.Assert(this == CorLibrary); 65Debug.Assert(module.GetReferencedAssemblies().Length == 0);
Symbols\MissingMetadataTypeSymbol.cs (2)
347Debug.Assert(this.SpecialType == SpecialType.System_IntPtr || this.SpecialType == SpecialType.System_UIntPtr); 357Debug.Assert(other.SpecialType == this.SpecialType);
Symbols\MissingModuleSymbol.cs (3)
33Debug.Assert((object)assembly != null); 34Debug.Assert(ordinal >= -1); 217Debug.Assert(name != null);
Symbols\MissingNamespaceSymbol.cs (3)
25Debug.Assert((object)containingModule != null); 33Debug.Assert((object)containingNamespace != null); 34Debug.Assert(name != null);
Symbols\NamedTypeSymbol.cs (55)
319Debug.Assert(includeInstance || includeStatic); 338Debug.Assert(method.MethodKind == MethodKind.Constructor); 346Debug.Assert(method.MethodKind == MethodKind.StaticConstructor); 377Debug.Assert(((PropertySymbol)candidate).IsIndexer); 418Debug.Assert(method.MethodKind != MethodKind.ReducedExtension); 428Debug.Assert(thisParam is not null); 453Debug.Assert((options & ~(LookupOptions.AllMethodsOnArityZero 457Debug.Assert(name is not null || alternativeName is null); 536Debug.Assert(member.Kind != SymbolKind.NamedType); 635Debug.Assert(IsScriptClass); 641Debug.Assert(IsScriptClass); 647Debug.Assert(IsScriptClass); 680Debug.Assert(!(fileIdentifier != null && !MangleName && Arity > 0)); 851Debug.Assert(!_lazyRequiredMembers.IsDefault); 876Debug.Assert(!_lazyRequiredMembers.IsDefault); 1195Debug.Assert(count == otherTypeArguments.Length); 1308Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 1349Debug.Assert(typeA.IsGenericType); 1350Debug.Assert(typeA.Equals(typeB, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 1529Debug.Assert(!unbound || typeArguments.All(TypeWithAnnotationsIsErrorType)); 1669Debug.Assert(this.IsDefinition); 1670Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 1763Debug.Assert(owner.ContainingModule.HasUnifiedReferences); 2049Debug.Assert(IsUnionType); 2078Debug.Assert(interfaceForDefinition.IsInterface); 2087Debug.Assert(!interfaceForDefinition.Equals(definitionFactoryMethods[j].ContainingType, TypeCompareKind.ConsiderEverything)); 2117Debug.Assert(definitionFactoryMethod.IsDefinition); 2118Debug.Assert(definitionFactoryMethod.MethodKind == MethodKind.Constructor); 2146Debug.Assert(shadowingMethods is not null); 2154Debug.Assert(result.Count == 0 || 2186Debug.Assert(unionType.IsDefinition); 2187Debug.Assert(unionType.IsUnionType); 2188Debug.Assert(factory.IsDefinition || factory.ContainingType.IsInterface); 2244Debug.Assert(IsUnionType); 2251Debug.Assert(this.IsDefinition); 2280Debug.Assert(type.IsDefinition); 2370Debug.Assert(IsUnionType); 2372Debug.Assert(lazyUncommonProperties._lazyUnionData is not null); 2386Debug.Assert(IsClosed); 2388Debug.Assert(lazyUncommonProperties._lazyClosedClassData is not null); 2397Debug.Assert(ctor.MethodKind is MethodKind.Constructor); 2443Debug.Assert(unionTypeDefinition.IsDefinition); 2449Debug.Assert(valueProperty.Type.IsObjectType()); 2533Debug.Assert(this.IsUnionType); 2534Debug.Assert(this.IsDefinition); 2703Debug.Assert(this.IsUnionType); 2727Debug.Assert(bestMatch is null || 2730Debug.Assert(!bestMatchConversion.IsReference || !conversion.IsNullable); 2731Debug.Assert(!conversion.IsReference || !bestMatchConversion.IsNullable); 2732Debug.Assert(!bestMatchConversion.IsReference || !conversion.IsBoxing); 2733Debug.Assert(!conversion.IsReference || !bestMatchConversion.IsBoxing); 2772Debug.Assert(!containerForDefinition.Equals(definitionTryGetValueMethods[j].ContainingType, TypeCompareKind.ConsiderEverything)); 2864Debug.Assert(this.IsUnionType); 2930Debug.Assert(tupleCardinality < ValueTupleRestPosition); 2963Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\NamespaceOrTypeSymbol.cs (8)
224Debug.Assert(memberT.MergedDeclaration.Declarations.SelectAsArray(decl => decl.NameLocation).SequenceEqual(memberT.Locations)); 257Debug.Assert(!emittedTypeName.IsNull); 260Debug.Assert(scope is not MergedNamespaceSymbol); 261Debug.Assert(scope is NamespaceSymbol or NamedTypeSymbol); 273Debug.Assert(!isTopLevel || scope.ToDisplayString(SymbolDisplayFormat.QualifiedNameOnlyFormat) == emittedTypeName.NamespaceName); 277Debug.Assert(!emittedTypeName.UnmangledTypeName.Equals(emittedTypeName.TypeName) && emittedTypeName.InferredArity > 0); 303Debug.Assert(ReferenceEquals(emittedTypeName.UnmangledTypeName, emittedTypeName.TypeName) && emittedTypeName.InferredArity == 0); 326Debug.Assert(forcedArity == emittedTypeName.InferredArity);
Symbols\NamespaceSymbol.cs (2)
237Debug.Assert(types.Length == 1); 344Debug.Assert((object)assembly != null);
Symbols\NativeIntegerTypeSymbol.cs (15)
33Debug.Assert(underlyingType.TupleData is null); 34Debug.Assert(!underlyingType.IsNativeIntegerType); 35Debug.Assert(underlyingType.SpecialType == SpecialType.System_IntPtr || underlyingType.SpecialType == SpecialType.System_UIntPtr); 36Debug.Assert(!underlyingType.ContainingAssembly.RuntimeSupportsNumericIntPtr); 88Debug.Assert(_underlyingType.Equals(underlyingMember.ContainingSymbol)); 173Debug.Assert(useSiteInfo.DiagnosticInfo is null); // If assert fails, add unit test for use site diagnostic. 279Debug.Assert(!symbolA.Equals(symbolB, TypeCompareKind.ConsiderEverything)); 280Debug.Assert(!symbolB.Equals(symbolA, TypeCompareKind.ConsiderEverything)); 281Debug.Assert(symbolA.Equals(symbolB, TypeCompareKind.IgnoreNativeIntegers)); 282Debug.Assert(symbolB.Equals(symbolA, TypeCompareKind.IgnoreNativeIntegers)); 283Debug.Assert(symbolA.GetHashCode() == symbolB.GetHashCode()); 324Debug.Assert(_specialType == SpecialType.System_IntPtr || _specialType == SpecialType.System_UIntPtr); 352Debug.Assert(!underlyingMethod.IsGenericMethod); 454Debug.Assert(container != null); 510Debug.Assert(underlyingProperty.ParameterCount == 0);
Symbols\NonMissingAssemblySymbol.cs (3)
121Debug.Assert(result is null || ((object)result.ContainingAssembly == (object)this && !result.IsErrorType())); 173Debug.Assert(result is null || ((object)result.ContainingAssembly == (object)this && !result.IsErrorType())); 225System.Diagnostics.Debug.Assert(TypeSymbol.Equals(result1, result, TypeCompareKind.ConsiderEverything2)); // object identity may differ in error cases
Symbols\NonMissingModuleSymbol.cs (4)
156Debug.Assert(moduleReferences != null); 166Debug.Assert(_moduleReferences == null); 172Debug.Assert(_moduleReferences != null); 203Debug.Assert(result?.IsErrorType() != true);
Symbols\NoPiaAmbiguousCanonicalTypeSymbol.cs (1)
47Debug.Assert(Arity == 0);
Symbols\NoPiaIllegalGenericInstantiationSymbol.cs (1)
39Debug.Assert(Arity == 0);
Symbols\NoPiaMissingCanonicalTypeSymbol.cs (1)
71Debug.Assert(Arity == 0);
Symbols\NullableAnnotationExtensions.cs (9)
28Debug.Assert(a != NullableAnnotation.Ignored); 29Debug.Assert(b != NullableAnnotation.Ignored); 39Debug.Assert(a != NullableAnnotation.Ignored); 40Debug.Assert(b != NullableAnnotation.Ignored); 50Debug.Assert(a != NullableAnnotation.Ignored); 51Debug.Assert(b != NullableAnnotation.Ignored); 65Debug.Assert(a != NullableAnnotation.Ignored); 66Debug.Assert(b != NullableAnnotation.Ignored); 128Debug.Assert(annotation != NullableAnnotation.Ignored);
Symbols\ObsoleteAttributeHelpers.cs (8)
47Debug.Assert(obsoleteAttributeData == null || !obsoleteAttributeData.IsUninitialized); 155Debug.Assert(result?.IsObsoleteDiagnostic() != false); 161Debug.Assert(data != null); 170Debug.Assert(!data.IsUninitialized); 180Debug.Assert(data.Message == null); 181Debug.Assert(!data.IsError); 189Debug.Assert(!data.IsError); 206Debug.Assert(!isColInit || symbol.Name == WellKnownMemberNames.CollectionInitializerAddMethodName);
Symbols\OverriddenOrHiddenMembersHelpers.cs (23)
86Debug.Assert(member.Kind == SymbolKind.Method || member.Kind == SymbolKind.Property || member.Kind == SymbolKind.Event); 106Debug.Assert(associatedPropertyOrEvent.Kind == SymbolKind.Event); 112Debug.Assert(!member.IsAccessor()); 243Debug.Assert(accessor.IsAccessor()); 244Debug.Assert((object)associatedProperty != null); 335Debug.Assert(accessor.IsAccessor()); 336Debug.Assert((object)associatedEvent != null); 411Debug.Assert(!member.IsAccessor()); 414Debug.Assert(containingType.IsInterfaceType()); 500Debug.Assert(overriddenMembers.Length == 0); 506Debug.Assert(overriddenMembers.IsEmpty); 542Debug.Assert(!member.IsAccessor()); 622Debug.Assert(memberIsFromSomeCompilation || minCustomModifierCount == int.MaxValue, "Metadata members require exact custom modifier matches."); 669Debug.Assert(!(param.TypeWithAnnotations.CustomModifiers.Any() || param.RefCustomModifiers.Any())); 670Debug.Assert(!param.Type.HasCustomModifiers(flagNonDefaultArraySizesOrLowerBounds: false)); 755Debug.Assert((object)hiddenMember != null); 791Debug.Assert((object)representativeMember != null); 792Debug.Assert(representativeMember.Kind == SymbolKind.Property || !representativeMember.ContainingType.IsDefinition); 853Debug.Assert((object)representativeMember != null); 854Debug.Assert(representativeMember.Kind != SymbolKind.Field); 855Debug.Assert(representativeMember.Kind != SymbolKind.NamedType); 856Debug.Assert(representativeMember.Kind == SymbolKind.Property || !representativeMember.ContainingType.IsDefinition); 964Debug.Assert(runtimeOverriddenMethod is { });
Symbols\OverriddenOrHiddenMembersResult.cs (1)
56Debug.Assert(!substitutedOverridingMember.IsDefinition);
Symbols\PlaceholderTypeArgumentSymbol.cs (1)
46Debug.Assert(Arity == 0);
Symbols\PointerTypeSymbol.cs (3)
29Debug.Assert(pointedAtType.HasType); 276Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 307Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\PropertySymbol.cs (3)
380Debug.Assert(this.IsDefinition); 381Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 399Debug.Assert(this.IsDefinition);
Symbols\PublicModel\ArrayTypeSymbol.cs (2)
26Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 27Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\AssemblySymbol.cs (1)
93Debug.Assert(conclusion != IVTConclusion.NoRelationshipClaimed);
Symbols\PublicModel\DynamicTypeSymbol.cs (2)
23Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 24Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\ErrorTypeSymbol.cs (2)
24Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 25Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\FieldSymbol.cs (1)
20Debug.Assert(underlying is object);
Symbols\PublicModel\FunctionPointerTypeSymbol.cs (2)
42Debug.Assert(nullableAnnotation != this.NullableAnnotation); 43Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation);
Symbols\PublicModel\LocalSymbol.cs (1)
19Debug.Assert(underlying is object);
Symbols\PublicModel\MethodSymbol.cs (1)
27Debug.Assert(underlying is object);
Symbols\PublicModel\ModuleSymbol.cs (1)
18Debug.Assert(underlying is object);
Symbols\PublicModel\NamedTypeSymbol.cs (1)
212Debug.Assert(!isExtension
Symbols\PublicModel\NamespaceSymbol.cs (1)
19Debug.Assert(underlying is object);
Symbols\PublicModel\NonErrorNamedTypeSymbol.cs (4)
18Debug.Assert(underlying is object); 19Debug.Assert(!underlying.IsErrorType()); 25Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 26Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\NonSourceAssemblySymbol.cs (2)
17Debug.Assert(underlying is object); 18Debug.Assert(!(underlying is Symbols.SourceAssemblySymbol));
Symbols\PublicModel\ParameterSymbol.cs (1)
20Debug.Assert(underlying is object);
Symbols\PublicModel\PointerTypeSymbol.cs (3)
19Debug.Assert(underlying is object); 25Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 26Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\PropertySymbol.cs (1)
20Debug.Assert(underlying is object);
Symbols\PublicModel\RangeVariableSymbol.cs (1)
17Debug.Assert(underlying is object);
Symbols\PublicModel\SourceAssemblySymbol.cs (1)
17Debug.Assert(underlying is object);
Symbols\PublicModel\TypeParameterSymbol.cs (3)
19Debug.Assert(underlying is object); 25Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 26Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\RangeVariableSymbol.cs (3)
61Debug.Assert(_location.SourceTree != null); 63Debug.Assert(token.Kind() == SyntaxKind.IdentifierToken); 65Debug.Assert(node is QueryClauseSyntax || node is QueryContinuationSyntax || node is JoinIntoClauseSyntax);
Symbols\ReducedExtensionMethodSymbol.cs (18)
40Debug.Assert(method.IsExtensionMethod && method.MethodKind != MethodKind.ReducedExtension); 41Debug.Assert(method.ParameterCount > 0); 42Debug.Assert((object)receiverType != null); 75Debug.Assert(method.IsExtensionMethod && method.MethodKind != MethodKind.ReducedExtension); 88Debug.Assert(!method.TypeArgumentsWithAnnotations.IsEmpty); 94Debug.Assert((object)reducedFrom != null); 95Debug.Assert(reducedFrom.IsExtensionMethod); 96Debug.Assert((object)reducedFrom.ReducedFrom == null); 97Debug.Assert(reducedFrom.ConstructedFrom == reducedFrom); 98Debug.Assert(reducedFrom.ParameterCount > 0); 116Debug.Assert(method.IsExtensionMethod); 117Debug.Assert(method.MethodKind != MethodKind.ReducedExtension); 118Debug.Assert(method.ParameterCount > 0); 119Debug.Assert((object)thisType != null); 282Debug.Assert(_reducedFrom.ConstructedFrom == _reducedFrom); 568Debug.Assert(count == 1); 630Debug.Assert(containingMethod != null); 631Debug.Assert(underlyingParameter.Ordinal > 0);
Symbols\ReferenceManager.cs (33)
93Debug.Assert(csReference.Compilation._lazyAssemblySymbol is object); 120Debug.Assert(AssemblyIdentityComparer.SimpleNameComparer.Equals(identity1.Name, identity2.Name)); 126Debug.Assert(referencedAssemblySymbols.IsEmpty()); 206Debug.Assert(successful); 212Debug.Assert(compilation._lazyAssemblySymbol is object); 251Debug.Assert(!HasCircularReference); 260Debug.Assert(assembly is object); 302Debug.Assert(!HasCircularReference); 316Debug.Assert(ReferenceEquals(compilation._referenceManager, this)); 333Debug.Assert(assemblyModules.Length == referencedModulesReferences.Length + 1); 398Debug.Assert(bindingResult.Length == allAssemblyData.Length); 433Debug.Assert(allAssemblyData[i].IsLinked == bound.AssemblySymbol.IsLinked); 517Debug.Assert(ReferenceEquals(compilation._referenceManager, this) || HasCircularReference); 543Debug.Assert(newSymbols.Count > 0); 571Debug.Assert(currentBindingResult.AssemblySymbol is object); 572Debug.Assert(currentBindingResult.ReferenceBinding is object); 593Debug.Assert(linkedAssemblySymbol is object); 624Debug.Assert(current.AssemblySymbol is object); 645Debug.Assert(currentBindingResult.AssemblySymbol is object); 646Debug.Assert(currentBindingResult.ReferenceBinding is object); 686Debug.Assert(newIndex == filteredReferencedAssemblies.Length); 722Debug.Assert(currentBindingResult.AssemblySymbol is object); 723Debug.Assert(currentBindingResult.ReferenceBinding is object); 768Debug.Assert(moduleSymbols.Length == 1 + modules.Length); 784Debug.Assert(bindingResult[0].ReferenceBinding is object); 786Debug.Assert(boundReference.ReferenceIdentity is object); 823Debug.Assert(referenceBinding.IsBound); 824Debug.Assert(referenceBinding.ReferenceIdentity is object); 826Debug.Assert(assembly is object); 875Debug.Assert(!referencedAssemblies.IsDefault); 1102Debug.Assert(sourceReferencedAssemblies.Length == sourceReferencedAssemblySymbols.Length); 1128Debug.Assert(result.Count == builderSize); 1162Debug.Assert(!(asm is RetargetingAssemblySymbol));
Symbols\RefKindExtensions.cs (1)
16Debug.Assert(refKind <= RefKind.RefReadOnly);
Symbols\Retargeting\RetargetingAssemblySymbol.cs (2)
104Debug.Assert((object)underlyingAssembly != null); 218Debug.Fail("We are performing a check for an unrelated assembly which likely indicates a bug.");
Symbols\Retargeting\RetargetingEventSymbol.cs (1)
36Debug.Assert(!(underlyingEvent is RetargetingEventSymbol));
Symbols\Retargeting\RetargetingFieldSymbol.cs (2)
38Debug.Assert((object)retargetingModule != null); 39Debug.Assert(!(underlyingField is RetargetingFieldSymbol));
Symbols\Retargeting\RetargetingMethodSymbol.cs (3)
61Debug.Assert((object)retargetingModule != null); 62Debug.Assert((object)underlyingMethod != null); 63Debug.Assert(!(underlyingMethod is RetargetingMethodSymbol));
Symbols\Retargeting\RetargetingModuleSymbol.cs (9)
82Debug.Assert((object)retargetingAssembly != null); 83Debug.Assert((object)underlyingModule != null); 102Debug.Assert(_underlyingModule.Ordinal == 0); // Always a source module 198Debug.Assert(referencedAssemblySymbols.Length == moduleReferences.Identities.Length); 199Debug.Assert(referencedAssemblySymbols.Length <= underlyingBoundReferences.Length); // Linked references are filtered out. 216Debug.Assert(identityComparer.Compare(moduleReferences.Identities[i], definitionIdentity) != AssemblyIdentityComparer.ComparisonResult.NotEquivalent); 217Debug.Assert(identityComparer.Compare(moduleReferences.Identities[i], underlyingBoundReferences[j].Identity) != AssemblyIdentityComparer.ComparisonResult.NotEquivalent); 231Debug.Assert(ReferenceEquals(destinationData.To, referencedAssemblySymbols[i])); 242Debug.Assert(j == underlyingBoundReferences.Length);
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (8)
53Debug.Assert((object)retargetingModule != null); 54Debug.Assert(!(underlyingType is RetargetingNamedTypeSymbol)); 118Debug.Assert(this.IsExtension); 119Debug.Assert(method.IsDefinition); 120Debug.Assert(method.ContainingType == (object)this); 192Debug.Assert((object)method != null); 302Debug.Assert(!underlyingResult.IsErrorType()); 303Debug.Assert((object)_underlyingType == underlyingResult.ContainingSymbol);
Symbols\Retargeting\RetargetingNamespaceSymbol.cs (6)
46Debug.Assert((object)retargetingModule != null); 47Debug.Assert((object)underlyingNamespace != null); 48Debug.Assert(!(underlyingNamespace is RetargetingNamespaceSymbol)); 139Debug.Assert(t.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 231Debug.Assert((object)underlying.ContainingModule == (object)_retargetingModule.UnderlyingModule); 232Debug.Assert(!underlying.IsErrorType());
Symbols\Retargeting\RetargetingParameterSymbol.cs (4)
33Debug.Assert(!(underlyingParameter is RetargetingParameterSymbol)); 178Debug.Assert((object)retargetingMethod != null); 200Debug.Assert((object)retargetingProperty != null); 222Debug.Assert((object)retargetingType != null);
Symbols\Retargeting\RetargetingPropertySymbol.cs (3)
42Debug.Assert((object)retargetingModule != null); 43Debug.Assert(!(underlyingProperty is RetargetingPropertySymbol)); 173Debug.Assert(!impls.IsDefault);
Symbols\Retargeting\RetargetingSymbolTranslator.cs (39)
44Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 50Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 56Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 62Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 66Debug.Assert(correspondingTupleField is TupleErrorFieldSymbol); 88Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 94Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 100Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 111Debug.Assert((object)retargetingModule != null); 164Debug.Assert(symbol.Kind != SymbolKind.NamedType || ((NamedTypeSymbol)symbol).PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 207Debug.Assert(type.IsDefinition); 241Debug.Assert(!retargetFrom.IsLinked); 283Debug.Assert(module.Ordinal == 0); 284Debug.Assert(!type.IsExplicitDefinitionOfNoPiaLocalType); 303Debug.Assert(module.Ordinal > 0); 305Debug.Assert(ReferenceEquals(((PEModuleSymbol)module).Module, addedModule.Module)); 350Debug.Assert(signatureIndex == 0 || signatureIndex == 1); 364Debug.Assert((object)type.ContainingAssembly != (object)RetargetingAssembly.UnderlyingAssembly); 386Debug.Assert((object)result != null); 403Debug.Assert(!type.ContainingModule.Equals(addedModule) && 435Debug.Assert(result is PENamedTypeSymbol peResult && peResult.Handle == type.Handle); 461Debug.Assert(result1?.IsErrorType() != true); 472Debug.Assert(result1.Arity == type.Arity); 475Debug.Assert(TypeSymbol.Equals(result1, result, TypeCompareKind.ConsiderEverything2)); 499Debug.Assert(originalDefinition.Arity == 0 || !ReferenceEquals(type.ConstructedFrom, type)); 510Debug.Assert((object)type.ContainingType == null || !type.ContainingType.IsUnboundGenericType()); 578Debug.Assert(newParameters.Count == newArguments.Count); 741Debug.Assert(newModifiers == null || newModifiers.Count == oldModifiers.Length); 842Debug.Assert(nts.TypeKind == TypeKind.Error || nts.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 854Debug.Assert(ts.TypeKind == TypeKind.Error || ts.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 876Debug.Assert(ReferenceEquals(method.ContainingModule, this.UnderlyingModule)); 877Debug.Assert(ReferenceEquals(method, method.OriginalDefinition)); 884Debug.Assert((object)method == method.ConstructedFrom); 901Debug.Assert(!retargetedType.IsDefinition); 913Debug.Assert(retargetedType.IsDefinition); 926Debug.Assert(ReferenceEquals(property.ContainingModule, this.UnderlyingModule)); 927Debug.Assert(ReferenceEquals(property, property.OriginalDefinition)); 1048Debug.Assert((object)typeParameter.ContainingSymbol == _toFind); 1320Debug.Assert(ReferenceEquals(symbol, _retargetingModule.UnderlyingModule));
Symbols\Retargeting\RetargetingTypeParameterSymbol.cs (2)
43Debug.Assert((object)retargetingModule != null); 44Debug.Assert(!(underlyingTypeParameter is RetargetingTypeParameterSymbol));
Symbols\SignatureOnlyMethodSymbol.cs (1)
48Debug.Assert(returnType.IsDefault || isInitOnly == CustomModifierUtils.HasIsExternalInitModifier(returnType.CustomModifiers));
Symbols\SignatureOnlyParameterSymbol.cs (2)
30Debug.Assert((object)type.Type != null); 31Debug.Assert(!refCustomModifiers.IsDefault);
Symbols\Source\AttributeLocation.cs (1)
119Debug.Assert(result == AttributeLocation.None ^ SyntaxFacts.IsAttributeTargetSpecifier(kind));
Symbols\Source\ConstantEvaluationHelpers.cs (12)
57Debug.Assert(order.Count == 0); 63Debug.Assert(graph.Count >= 1); 76Debug.Assert(fields.All(f => map.Contains(f))); 159Debug.Assert(graph.Count > 0); 269Debug.Assert(graph.Count > 0); 339Debug.Assert(node.Dependencies != null); 340Debug.Assert(node.DependedOnBy != null); 346Debug.Assert(ok); 347Debug.Assert(n.DependedOnBy.Contains(field)); 354Debug.Assert(ok); 355Debug.Assert(n.Dependencies.Contains(field)); 365Debug.Assert(graph.Values.Sum(n => n.DependedOnBy.Count) == graph.Values.Sum(n => n.Dependencies.Count));
Symbols\Source\CustomModifierUtils.cs (9)
29Debug.Assert((object)sourceMethod != null); 32Debug.Assert((object)sourceMethod == sourceMethod.ConstructedFrom); 71Debug.Assert(sourceType.Equals(destinationType, TypeCompareKind.AllIgnoreOptions)); 105Debug.Assert(transformResult && position == length); 107Debug.Assert(resultType.Equals(sourceType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreNativeIntegers)); // Same custom modifiers as source type. 110Debug.Assert(resultType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds)); 117Debug.Assert(!destinationParameters.IsDefault); 118Debug.Assert(destinationParameters.All(p => p is SourceParameterSymbolBase)); 119Debug.Assert(sourceParameters.Length == destinationParameters.Length);
Symbols\Source\ExplicitInterfaceHelpers.cs (3)
112Debug.Assert(idx < fullName.Length); 131Debug.Assert((object)unsubstitutedInterfaceType != null); 133Debug.Assert((object)explicitInterfaceType != null);
Symbols\Source\ExtensionGroupingInfo.cs (22)
41Debug.Assert(sourceNamedType.ExtensionGroupingName is not null); 52Debug.Assert(sourceNamedType.ExtensionMarkerName is not null); 91Debug.Assert(groupingNamesMatch || !HaveSameILSignature(type1, type2), 95Debug.Assert(markerNamesMatch || !HaveSameCSharpSignature(type1, type2), 98Debug.Assert(groupingNamesMatch || !markerNamesMatch, "If the marker names are equal, then the grouping names must also be equal."); 115Debug.Assert(extension.IsExtension); 144Debug.Assert(Cci.TypeMemberVisibility.Public > Cci.TypeMemberVisibility.Assembly); 145Debug.Assert(Cci.TypeMemberVisibility.Assembly > Cci.TypeMemberVisibility.Private); 154Debug.Assert(memberVisibility is Cci.TypeMemberVisibility.Public or Cci.TypeMemberVisibility.Assembly or Cci.TypeMemberVisibility.Private); 175Debug.Assert(extension.IsExtension); 196Debug.Assert(extension.IsExtension); 216Debug.Assert(extension1.IsExtension); 217Debug.Assert(extension2.IsExtension); 251Debug.Assert(extension1.IsExtension); 252Debug.Assert(extension2.IsExtension); 463Debug.Assert(extension.IsExtension); 464Debug.Assert(extension.IsDefinition); 705Debug.Assert(other is { }); 736Debug.Assert(containingType is not null); 753Debug.Assert((object)method != null); 776Debug.Assert((object)property != null); 901Debug.Assert(other is { });
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (12)
99Debug.Assert(completed); 102Debug.Assert(_lazyCustomAttributesBag.IsSealed); 171Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 175Debug.Assert(!attribute.HasErrors); 176Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 321Debug.Assert(!boundAttributes.IsDefault); 322Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 323Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 324Debug.Assert(_lazyCustomAttributesBag != null); 325Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 326Debug.Assert(symbolPart == AttributeLocation.None); 335Debug.Assert(boundAttributes.Any());
Symbols\Source\GlobalExpressionVariable.cs (7)
38Debug.Assert(DeclaredAccessibility == Accessibility.Private); 52Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax); 73Debug.Assert(fieldsBeingBound != null); 102Debug.Assert(type.HasType || isVar); 107Debug.Assert(_lazyType != null); 135Debug.Assert((object)originalType == null || 179Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax);
Symbols\Source\ImplicitNamedTypeSymbol.cs (1)
24Debug.Assert(declaration.Kind == DeclarationKind.ImplicitClass ||
Symbols\Source\LambdaSymbol.cs (8)
56Debug.Assert(syntaxReferenceOpt is not null); 57Debug.Assert(containingSymbol.DeclaringCompilation == compilation); 171Debug.Assert(inferredReturnType.HasType); 172Debug.Assert((object)_returnType.Type == ReturnTypeIsBeingInferred); 173Debug.Assert(refKind != RefKind.RefReadOnly); 307Debug.Assert(diagnostics.DiagnosticBag is { }); 308Debug.Assert(diagnostics.DependenciesBag is { }); 343Debug.Assert(parameterTypes.Length == parameterRefKinds.Length);
Symbols\Source\LocalFunctionOrSourceMemberMethodSymbol.cs (1)
38Debug.Assert(TypeSymbol.Equals(_lazyIteratorElementType.Value.Type, elementType.Type, TypeCompareKind.ConsiderEverything));
Symbols\Source\LocalFunctionSymbol.cs (12)
45Debug.Assert(containingSymbol.DeclaringCompilation == binder.Compilation); 56Debug.Assert(diagnostics.DiagnosticBag is { }); 57Debug.Assert(diagnostics.DependenciesBag is { }); 219Debug.Assert(diagnostics.DiagnosticBag is { }); 220Debug.Assert(diagnostics.DependenciesBag is { }); 280Debug.Assert(diagnostics.DiagnosticBag is { }); 281Debug.Assert(diagnostics.DependenciesBag is { }); 284Debug.Assert(returnTypeSyntax is not ScopedTypeSyntax); 320Debug.Assert(_refKind == RefKind.None 498Debug.Assert(tpEnclosing.ContainingSymbol.Kind == SymbolKind.NamedType); 527Debug.Assert(diagnostics.DiagnosticBag is { }); 528Debug.Assert(diagnostics.DependenciesBag is { });
Symbols\Source\ModifierUtils.cs (8)
50Debug.Assert(!isForTypeDeclaration || !isForInterfaceMember); 57Debug.Assert((allowedModifiers & (DeclarationModifiers.Override | DeclarationModifiers.Virtual)) == 0); 79Debug.Assert(oneError != DeclarationModifiers.None); 138Debug.Assert(modifier.Kind() == SyntaxKind.ScopedKeyword); 220Debug.Assert(oneError != DeclarationModifiers.None); 233Debug.Assert(location.SourceTree is not null); 247Debug.Assert(location.SourceTree is not null); 295Debug.Assert(!isExplicitInterfaceImplementation);
Symbols\Source\ParameterHelpers.cs (16)
76Debug.Assert(ordinal == 0); 77Debug.Assert(paramsKeyword.Kind() == SyntaxKind.None); 141Debug.Assert(addRefReadOnlyModifier, "If addReadonlyRef isn't true, we must have found a different location to encode the readonlyness of a function pointer"); 183Debug.Assert(!parsingFunctionPointer || owner is FunctionPointerMethodSymbol); 227Debug.Assert(methodOwner?.MethodKind != MethodKind.LambdaMethod); 265Debug.Assert(parameterContext is ParameterContext.Default or ParameterContext.FunctionPointer or ParameterContext.ExtensionReceiverParameter); 307Debug.Assert(parameterSyntax.Type != null); 312Debug.Assert(refnessKeyword.Kind() != SyntaxKind.None); 320Debug.Assert(parameter is SourceComplexParameterSymbolBase || !parameter.IsParams); // Only SourceComplexParameterSymbolBase validates 'params' type. 321Debug.Assert(parameter is SourceComplexParameterSymbolBase || parameter is not SourceParameterSymbol s || s.DeclaredScope == ScopedKind.None); // Only SourceComplexParameterSymbolBase validates 'scope'. 391Debug.Assert(moduleBuilder.Compilation.ShouldEmitNativeIntegerAttributes()); 414Debug.Assert(compilation.ShouldEmitNativeIntegerAttributes()); 433Debug.Assert(!parameter.IsThis); 532Debug.Assert(extensionMember.IsExtensionBlockMember()); 556Debug.Assert(extensionMemberArity == 0); // we currently only apply the check for members which may not be generic 875Debug.Assert(containingSymbol is null
Symbols\Source\QuickAttributeChecker.cs (4)
77Debug.Assert(!_sealed); 126Debug.Assert(_sealed); 165Debug.Assert(QuickAttributes.Last == QuickAttributes.AssemblySignatureKey); 197Debug.Assert(attributeDescription.Name.EndsWith(nameof(System.Attribute)));
Symbols\Source\SourceAssemblySymbol.cs (57)
122Debug.Assert(compilation != null); 123Debug.Assert(assemblySimpleName != null); 124Debug.Assert(!String.IsNullOrWhiteSpace(moduleName)); 125Debug.Assert(!netModules.IsDefault); 497Debug.Assert(!DeclaringCompilation.Options.Errors.IsEmpty); 652Debug.Assert((object)compilationRelaxationsAttribute != null, "GetWellKnownType unexpectedly returned null"); 661Debug.Assert((object)runtimeCompatibilityAttribute != null, "GetWellKnownType unexpectedly returned null"); 694Debug.Assert((object)unverifiableCodeAttribute != null, "GetWellKnownType unexpectedly returned null"); 706Debug.Assert((object)securityPermissionAttribute != null, "GetWellKnownType unexpectedly returned null"); 713Debug.Assert((object)securityAction != null, "GetWellKnownType unexpectedly returned null"); 925Debug.Assert(thisThreadCompleted); 938Debug.Assert(locationOpt != null || filter != null, "If no location or filter was specified, then the module members should be completed"); 949Debug.Assert(thisThreadCompleted); 1071Debug.Assert(moduleNs.Extent.Kind == NamespaceKind.Module); 1212Debug.Assert(!attribute.HasErrors); 1224Debug.Assert(!attribute.HasErrors); 1241Debug.Assert(success); 1318Debug.Assert(attributesFromNetModules.Any()); 1319Debug.Assert(netModuleNames.Any()); 1320Debug.Assert(attributesFromNetModules.Length == netModuleNames.Length); 1455Debug.Assert(lazyNetModuleAttributesBag.IsSealed); 1461Debug.Assert(attributeMatches is QuickAttributes.AssemblyKeyFile 1487Debug.Assert(attributesFromNetModules.Any()); 1488Debug.Assert(netModuleNames.Any()); 1489Debug.Assert(attributesFromNetModules.Length == netModuleNames.Length); 1547Debug.Assert(attributesBag.IsSealed); 1600Debug.Assert(!attributes.IsDefault); 1601Debug.Assert(!netmoduleAttributes.IsDefault); 1615Debug.Assert(!attributes.IsDefault); 1628Debug.Assert(_lazyOmittedAttributeIndices == null || !_lazyOmittedAttributeIndices.Any(i => i < 0 || i >= this.GetAttributes().Length)); 1629Debug.Assert(_lazySourceAttributesBag.IsSealed); 1630Debug.Assert(_lazyNetModuleAttributesBag.IsSealed); 1631Debug.Assert(index >= 0); 1632Debug.Assert(index < this.GetAttributes().Length); 1751Debug.Assert(added); 1757Debug.Assert(removed); 1782Debug.Assert(attributesBag.IsSealed); 1832Debug.Assert(!boolType.HasUseSiteError, 1972Debug.Assert(!int32Type.HasUseSiteError, 1992Debug.Assert(!boolType.HasUseSiteError, "Use site errors should have been checked ahead of time (type bool)."); 2026Debug.Assert(!stringType.HasUseSiteError, "Use site errors should have been checked ahead of time (type string)."); 2036Debug.Assert(!stringType.HasUseSiteError, "Use site errors should have been checked ahead of time (type string)."); 2110Debug.Assert(conclusion != IVTConclusion.NoRelationshipClaimed); 2207Debug.Assert(!arguments.Attribute.HasErrors); 2226Debug.Assert(forwardedType.TypeKind != TypeKind.Error); 2278Debug.Assert(!attrData.HasErrors); 2368Debug.Assert(!attribute.HasErrors); 2369Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 2617Debug.Assert(!attribute.HasErrors); 2660Debug.Assert( 2664Debug.Assert( 2672Debug.Assert(_unusedFieldWarnings.IsDefault, "We shouldn't have computed the diagnostics if we're still noting definitions."); 2693Debug.Assert(this.HasComplete(CompletionPart.Module), 2715Debug.Assert(success, "Once CompletionPart.Module is set, no-one should be modifying the map."); 2798Debug.Assert(!_unusedFieldWarnings.IsDefault); 2844Debug.Assert(forcedArity == emittedName.InferredArity); 2860Debug.Assert((object)originalDefinition.ContainingType == null, "How did a nested type get forwarded?");
Symbols\Source\SourceClonedParameterSymbol.cs (1)
28Debug.Assert((object)originalParam != null);
Symbols\Source\SourceComplexParameterSymbol.cs (51)
56Debug.Assert((syntaxRef == null) || (syntaxRef.GetSyntax().IsKind(SyntaxKind.Parameter))); 254Debug.Assert(diagnostics.DiagnosticBag != null); 259Debug.Assert(previousValue == ConstantValue.Unset); 262Debug.Assert(completedOnThisThread); 272Debug.Assert(_lazyDefaultSyntaxValue is not null); 293Debug.Assert(completedOnThisThread); 314Debug.Assert(binder.GetBinder(syntax) == null); 359Debug.Assert(diagnostics.DiagnosticBag != null); 388Debug.Assert(binder.InParameterDefaultValue); 389Debug.Assert(binder.ContainingMemberOrLambda == ContainingSymbol); 488Debug.Assert(!this.ContainingSymbol.IsPartialImplementation()); 504Debug.Assert(!this.ContainingSymbol.IsPartialDefinition()); 525Debug.Assert(PartialImplementationPart is null); 587Debug.Assert(!ReferenceEquals(copyFrom, this)); 621Debug.Assert(!attributeType.IsErrorType()); 684Debug.Assert(constructorArguments.Length == 1); 733Debug.Assert(description.Equals(AttributeDescription.DefaultParameterValueAttribute) || 762Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 765Debug.Assert(!attribute.HasErrors); 766Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 767Debug.Assert(AttributeDescription.InterpolatedStringHandlerArgumentAttribute.Signatures.Length == 2); 787Debug.Assert(_lazyHasOptionalAttribute == ThreeState.True); 922Debug.Assert(syntax != null); 923Debug.Assert(diagnostics != null); 960Debug.Assert(!attribute.HasErrors); 972Debug.Assert(description.Equals(AttributeDescription.DateTimeConstantAttribute)); 979Debug.Assert(!diagnose || diagnosticsOpt != null); 999Debug.Assert(attribute.CommonConstructorArguments.Length == 1); 1071Debug.Assert(this.GetAttributeDeclarations().Any(attrLists => attrLists.Any(attrList => attrList.Contains(node)))); 1283Debug.Assert(attributeIndex is 0 or 1); 1284Debug.Assert(arguments.Attribute.IsTargetAttribute(AttributeDescription.InterpolatedStringHandlerArgumentAttribute) && arguments.Attribute.CommonConstructorArguments.Length == 1); 1285Debug.Assert(arguments.AttributeSyntaxOpt is not null); 1369Debug.Assert(arguments.AttributeSyntaxOpt is not null); 1384Debug.Assert(name != null); 1447Debug.Assert(!boundAttributes.IsDefault); 1448Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1449Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1450Debug.Assert(_lazyCustomAttributesBag != null); 1451Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 1452Debug.Assert(symbolPart == AttributeLocation.None); 1516Debug.Assert(!ReferenceEquals(copyFrom, this)); 1538Debug.Assert(_lazyHasOptionalAttribute.HasValue()); 1576Debug.Assert(filter == null); 1598Debug.Assert(ParameterSyntax is not null); 1606Debug.Assert(completedOnThisThread); 1653Debug.Assert(!addMethods.IsDefaultOrEmpty); 1700Debug.Assert(collectionBuilderMethods.Length <= 1); 1704Debug.Assert(diagnostics.HasAnyErrors(), $"{nameof(binder.GetCollectionBuilderMethods)} should have reported an error in this case"); 1718Debug.Assert(elementType is { }); 1799Debug.Assert(!refCustomModifiers.IsEmpty); 1804Debug.Assert(refKind != RefKind.None || _refCustomModifiers.IsEmpty);
Symbols\Source\SourceConstructorSymbol.cs (13)
53Debug.Assert(reported); 122Debug.Assert(syntaxReferenceOpt != null); 222Debug.Assert(PartialDefinitionPart is null); 302Debug.Assert(this.IsPartialDefinition); 303Debug.Assert(!ReferenceEquals(this, implementation)); 304Debug.Assert(ReferenceEquals(this.OtherPartOfPartial, implementation)); 339Debug.Assert(this.ParameterCount == implementation.ParameterCount); 375Debug.Assert(definition.IsPartialDefinition); 376Debug.Assert(implementation.IsPartialImplementation); 378Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || ReferenceEquals(alreadySetImplPart, implementation)); 379Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || ReferenceEquals(alreadySetDefPart, definition)); 384Debug.Assert(ReferenceEquals(definition._otherPartOfPartial, implementation)); 385Debug.Assert(ReferenceEquals(implementation._otherPartOfPartial, definition));
Symbols\Source\SourceConstructorSymbolBase.cs (3)
31Debug.Assert(syntax.Kind() is SyntaxKind.ConstructorDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.UnionDeclaration); 107Debug.Assert(!IsPartial); 180Debug.Assert(position >= 0 && tree != null);
Symbols\Source\SourceCustomEventAccessorSymbol.cs (5)
38Debug.Assert(syntax != null); 39Debug.Assert(syntax.Kind() == SyntaxKind.AddAccessorDeclaration || syntax.Kind() == SyntaxKind.RemoveAccessorDeclaration); 64Debug.Assert(syntaxReferenceOpt != null); 86Debug.Assert(PartialImplementationPart is null); 90Debug.Assert(PartialDefinitionPart is null
Symbols\Source\SourceCustomEventSymbol.cs (1)
149Debug.Assert(containingType.IsInterface);
Symbols\Source\SourceDelegateMethodSymbol.cs (3)
43Debug.Assert(_parameters.IsDefault); 55Debug.Assert(returnTypeSyntax is not ScopedTypeSyntax); 323Debug.Assert(location != null);
Symbols\Source\SourceDestructorSymbol.cs (2)
50Debug.Assert(syntax.ParameterList.Parameters.Count == 0); 91Debug.Assert(syntaxReferenceOpt != null);
Symbols\Source\SourceEnumConstantSymbol.cs (7)
40Debug.Assert(otherConstantOffset == 0); 45Debug.Assert(otherConstantOffset > 0); 125Debug.Assert(!this.IsFixedSizeBuffer); 172Debug.Assert(syntax.EqualsValue != null); 178Debug.Assert(syntax.EqualsValue != null); 197Debug.Assert((object)otherConstant != null); 198Debug.Assert(otherConstantOffset > 0);
Symbols\Source\SourceEventAccessorSymbol.cs (5)
109Debug.Assert(compilation != null); 127Debug.Assert(this.MethodKind == MethodKind.EventRemove); 155Debug.Assert(!_lazyReturnType.IsDefault); 165Debug.Assert(!_lazyReturnType.IsDefault); 205Debug.Assert(this.Locations.Length == 1);
Symbols\Source\SourceEventSymbol.cs (21)
166Debug.Assert(syntax.Parent?.Parent is not null); 218Debug.Assert(!ReferenceEquals(definitionPart, this)); 231Debug.Assert(wasCompletedThisThread); 242Debug.Assert(PartialDefinitionPart is null); 346Debug.Assert(!attribute.HasErrors); 347Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 575Debug.Assert(explicitInterfaceImplementation); 619Debug.Assert(!IsStatic || !IsOverride); // Otherwise should have been reported and cleared earlier. 620Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 770Debug.Assert(_lazyIsWindowsRuntimeEvent.HasValue()); 787Debug.Assert(explicitInterfaceImplementations.Length == 1); 789Debug.Assert((object?)this.OverriddenEvent == null); 920Debug.Assert(this.IsPartialDefinition); 921Debug.Assert(!ReferenceEquals(this, implementation)); 922Debug.Assert(ReferenceEquals(this.OtherPartOfPartial, implementation)); 993Debug.Assert(definition.IsPartialDefinition); 994Debug.Assert(implementation.IsPartialImplementation); 996Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || ReferenceEquals(alreadySetImplPart, implementation)); 997Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || ReferenceEquals(alreadySetDefPart, definition)); 1002Debug.Assert(ReferenceEquals(definition._otherPartOfPartial, implementation)); 1003Debug.Assert(ReferenceEquals(implementation._otherPartOfPartial, definition));
Symbols\Source\SourceFieldLikeEventSymbol.cs (11)
35Debug.Assert(declaratorSyntax.Parent is object); 215Debug.Assert(field.Name == _name); 249Debug.Assert(ev.IsPartialDefinition); 279Debug.Assert(IsPartialDefinition); 287Debug.Assert(IsExtern); 295Debug.Assert(false); 303Debug.Assert(IsPartialDefinition); 311Debug.Assert(IsExtern); 321Debug.Assert(false); 330Debug.Assert(IsPartialDefinition); 339Debug.Assert(false);
Symbols\Source\SourceFieldSymbol.cs (10)
24Debug.Assert((object)containingType != null); 116Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 117Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 120Debug.Assert(!attribute.HasErrors); 121Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 181Debug.Assert(name != null); 182Debug.Assert(syntax != null); 357Debug.Assert(value != Microsoft.CodeAnalysis.ConstantValue.Unset); 358Debug.Assert((GetLazyConstantValue(earlyDecodingWellKnownAttributes) == Microsoft.CodeAnalysis.ConstantValue.Unset) || 376Debug.Assert(wasSetThisThread);
Symbols\Source\SourceFixedFieldSymbol.cs (5)
38Debug.Assert(this.IsFixedSizeBuffer); 75Debug.Assert(declarator.ArgumentList.ContainsDiagnostics, "The parser should have caught this."); 100Debug.Assert(sizeConstant != null); 101Debug.Assert(sizeConstant.IsIntegral || diagnostics.HasAnyErrors() || sizeExpression.HasErrors); 137Debug.Assert(_fixedSize != FixedSizeNotInitialized);
Symbols\Source\SourceLabelSymbol.cs (1)
31Debug.Assert(identifierNodeOrToken.IsToken || identifierNodeOrToken.IsNode);
Symbols\Source\SourceLocalSymbol.cs (35)
81Debug.Assert(identifierToken.Kind() != SyntaxKind.None); 82Debug.Assert(declarationKind != LocalDeclarationKind.None); 83Debug.Assert(scopeBinder != null); 84Debug.Assert(containingSymbol.DeclaringCompilation == scopeBinder.Compilation); 175Debug.Assert(closestTypeSyntax != null); 176Debug.Assert(nodeBinder != null); 197Debug.Assert( 209Debug.Assert(!(nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm) || nodeBinder is SwitchExpressionArmBinder); 245Debug.Assert(declarationKind != LocalDeclarationKind.ForEachIterationVariable); 375Debug.Assert(concurrentTypeResolutions < 50); 414Debug.Assert(!free); 415Debug.Assert(reference != CSharpSyntaxTree.Dummy.GetRoot()); 423Debug.Assert(added); // This assert can fail if there is a race between multiple threads. We can remove it if it becomes a problem, confirming the case. 436Debug.Assert(localTypeInferenceInProgress == s_LocalTypeInferenceInProgress); 438Debug.Assert(removed); 439Debug.Assert(free == (localTypeInferenceInProgress.Count == 0)); 467Debug.Assert(declType.HasType); 486Debug.Assert(newType.Type is object); 492Debug.Assert((object)originalType?.DefaultType == null || 531Debug.Assert(node is VariableDeclaratorSyntax); 537Debug.Assert(node is VariableDeclaratorSyntax); 541Debug.Assert(node is ForEachStatementSyntax || node is SingleVariableDesignationSyntax); 545Debug.Assert(node is CatchDeclarationSyntax); 552Debug.Assert(node is SingleVariableDesignationSyntax); 633Debug.Assert(declarationKind != LocalDeclarationKind.ForEachIterationVariable); 634Debug.Assert(initializer != null); 677Debug.Assert(inProgress != this); 707Debug.Assert(boundInitValue != null); 730Debug.Assert(declarationKind == LocalDeclarationKind.ForEachIterationVariable); 778Debug.Assert(assignment.IsDeconstruction()); 785Debug.Assert(this.ScopeBinder.GetBinder((ForEachVariableStatementSyntax)_deconstruction) == _nodeBinder); 812Debug.Assert(declarationKind is LocalDeclarationKind.OutVariable or LocalDeclarationKind.PatternVariable); 813Debug.Assert( 823Debug.Assert(!(nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm) || nodeBinder is SwitchExpressionArmBinder); 882Debug.Assert(this.DeclarationKind is LocalDeclarationKind.DeclarationExpressionVariable or LocalDeclarationKind.OutVariable);
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (27)
199Debug.Assert(methodImpl is { Body: not null, Implemented: not null }); 356Debug.Assert(this.InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics[implementedInterface].Contains(implementedInterface)); 373Debug.Assert((object)directInterface != null); 387Debug.Assert((object)interfacePropertyOrEvent != null); 673Debug.Assert((object)sourceField == null || (object)sourceField.AssociatedSymbol == null || 687Debug.Assert(symbol.Kind == SymbolKind.Field || symbol.Kind == SymbolKind.NamedType); 762Debug.Assert((object)overridingMember != null); 763Debug.Assert(overriddenOrHiddenMembers != null); 771Debug.Assert(overridingMemberIsMethod ^ overridingMemberIsProperty ^ overridingMemberIsEvent); 776Debug.Assert(!overriddenMembers.IsDefault); 781Debug.Assert(!hiddenMembers.IsDefault); 895Debug.Assert(AccessCheck.IsSymbolAccessible(overriddenMember, overridingType, ref discardedUseSiteInfo)); 899Debug.Assert(overriddenMember.Kind == overridingMember.Kind); 949Debug.Assert(overridingMember.ObsoleteState != ThreeState.Unknown); 950Debug.Assert(leastOverriddenMember.ObsoleteState != ThreeState.Unknown); 1004Debug.Assert(overridingMemberIsMethod); 1105Debug.Assert(diagnosticInfo is { }); 1297Debug.Assert(baseMethod.ParameterCount == overrideMethod.ParameterCount - overrideParameterOffset); 1401Debug.Assert(conversions.IncludeNullability); 1490Debug.Assert(reportMismatchInParameterType is { }); 1501Debug.Assert(baseMethod.ParameterCount == overrideMethod.ParameterCount - overrideParameterOffset); 1542Debug.Assert(reportMismatchInParameterType is { }); 1552Debug.Assert(baseMethod.ParameterCount == overrideMethod.ParameterCount - overrideParameterOffset); 1578Debug.Assert(implementedMember is not null || overridingMember.IsDefinition); 1631Debug.Assert(overriddenOrHiddenMembers != null); 1632Debug.Assert(!overriddenOrHiddenMembers.OverriddenMembers.Any()); //since hidingMethod.IsOverride is false 1635Debug.Assert(!hiddenMembers.IsDefault);
Symbols\Source\SourceMemberContainerSymbol.cs (105)
113Debug.Assert(EnumUtilities.ContainsAllValues<SpecialType>(SpecialTypeMask)); 114Debug.Assert(EnumUtilities.ContainsAllValues<InternalSpecialType>(SpecialTypeMask)); //This assert might false fail in the future, we don't really need to be able to represent NextAvailable 115Debug.Assert(EnumUtilities.ContainsAllValues<NullableContextKind>(NullableContextMask)); 146Debug.Assert(BitsAreUnsetOrSame(_flags, bitsToSet)); 235Debug.Assert(containingSymbol is NamespaceSymbol { IsGlobalNamespace: true } || !declaration.Declarations.Any(static d => d.IsSimpleProgram)); 264Debug.Assert(typeKind is TypeKind.Struct or TypeKind.Class || !HasPrimaryConstructor); 664Debug.Assert(thisThreadCompleted); 719Debug.Assert(thisThreadCompleted); 730Debug.Assert((incompletePart & CompletionPart.NamedTypeSymbolAll) == 0); 870Debug.Assert(!useSiteDiagnostics.IsDefault); 879Debug.Assert(!useSiteDependencies.IsDefault); 1179Debug.Assert(!nonTypeMembers.IsDefault); 1180Debug.Assert(!staticInitializers.IsDefault); 1181Debug.Assert(staticInitializers.All(g => !g.IsDefault)); 1182Debug.Assert(!instanceInitializers.IsDefault); 1183Debug.Assert(instanceInitializers.All(g => !g.IsDefault)); 1185Debug.Assert(!nonTypeMembers.Any(static s => s is TypeSymbol)); 1186Debug.Assert(haveIndexers == nonTypeMembers.Any(static s => s.IsIndexer())); 1253Debug.Assert(ctorInitializerLength >= 0); 1276Debug.Assert(distanceFromCtorBody > 0); 1484Debug.Assert(s_emptyTypeMembers.Count == 0); 1568Debug.Assert(symbol is not null); 1573Debug.Assert(attr is SourceAttributeData); 2060Debug.Assert(IsFileLocal); 2068Debug.Assert(fileIdentifier.FilePathChecksumOpt.IsDefault); 2397Debug.Assert(method1.ParameterCount == method2.ParameterCount); 2477Debug.Assert(checkCollisionWithTypeParameters || typeParameterNames == null); 2529Debug.Assert(!membersByName[indexerName.AsMemory()].Any(SymbolExtensions.IsIndexer)); 2621Debug.Assert(cloneMembersByName); 2625Debug.Assert(masterExtension is not null); 2661Debug.Assert(!newMembers.IsEmpty); 2665Debug.Assert(newMembers.All(static (m, membersUnordered) => membersUnordered.Contains(m), membersUnordered)); 2782Debug.Assert(value == _lazyKnownCircularStruct); 2793Debug.Assert(TypeKind == TypeKind.Struct); 2812Debug.Assert(field.AssociatedSymbol is not EventSymbol, "Didn't expect to find a field-like event backing field in the member list."); 3027Debug.Assert(!this.IsExtension); 3110Debug.Assert(IsSubmissionClass || IsScriptClass); 3136Debug.Assert(ReferenceEquals(this, this.OriginalDefinition)); 3149Debug.Assert(f.AssociatedSymbol is not EventSymbol, "Didn't expect to find a field-like event backing field in the member list."); 3422Debug.Assert(!nonTypeMembersWithPartialImplementations.IsDefault); 3426Debug.Assert(!nonTypeMembersWithPartialImplementations.Any(static s => s is TypeSymbol)); 3427Debug.Assert(declarationWithParameters is object || primaryConstructor is null); 3442Debug.Assert(!initializers.IsDefault); 3450Debug.Assert(!group.IsDefaultOrEmpty); 3457Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i - 1].First().Syntax, compilation), new LexicalSortKey(initializers[i].Last().Syntax, compilation)) < 0); 3462Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i].First().Syntax, compilation), new LexicalSortKey(initializers[i + 1].Last().Syntax, compilation)) < 0); 3467Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i].First().Syntax, compilation), new LexicalSortKey(initializers[i].Last().Syntax, compilation)) < 0); 3492Debug.Assert(declaredMembersAndInitializers != DeclaredMembersAndInitializers.UninitializedSentinel); 3517Debug.Assert(InstanceInitializersForPositionalMembers.Count != 0); 3518Debug.Assert(declaredMembers.PrimaryConstructor is object); 3519Debug.Assert(declaredMembers.DeclarationWithParameters is object); 3520Debug.Assert(declaredMembers.DeclarationWithParameters.SyntaxTree == InstanceInitializersForPositionalMembers[0].Syntax.SyntaxTree); 3521Debug.Assert(declaredMembers.DeclarationWithParameters.Span.Contains(InstanceInitializersForPositionalMembers[0].Syntax.Span.Start)); 3554Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.SyntaxTree == declaredInitializers[0].Syntax.SyntaxTree); 3555Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.Span.Start < declaredInitializers[0].Syntax.Span.Start); 3564Debug.Assert(groupsBuilder.Count == groupCount); 3568Debug.Assert(!declaredMembers.InstanceInitializers.Any(g => declaredMembers.DeclarationWithParameters.SyntaxTree == g[0].Syntax.SyntaxTree && 3574Debug.Assert(groupsBuilder.Count == groupCount + 1); 3773Debug.Assert(partialMembersToMerge.Count != 0); 3814Debug.Assert(!_lazySimpleProgramEntryPoints.IsDefault); 3873Debug.Assert(result is object); 3896Debug.Assert(primaryConstructor is not null); 3897Debug.Assert(!this.IsDelegateType()); 3928Debug.Assert(HasPrimaryConstructor); 3933Debug.Assert(declared.PrimaryConstructor is not null); 3939Debug.Assert(membersAndInitializers.PrimaryConstructor is not null); 3946Debug.Assert(HasPrimaryConstructor); 3970Debug.Assert(primaryConstructor is not null); 4175Debug.Assert(symbol.IsPartialMember()); 4201Debug.Assert(pair.Key.Equals(WellKnownMemberNames.InstanceConstructorName.AsMemory())); 4212Debug.Assert(symbol.Kind != prev.Kind); 4213Debug.Assert(symbol is SourceOrdinaryMethodSymbol or SourcePropertySymbol or SourcePropertyAccessorSymbol or SourceEventAccessorSymbol); 4214Debug.Assert(prev is SourceOrdinaryMethodSymbol or SourcePropertySymbol or SourcePropertyAccessorSymbol or SourceEventAccessorSymbol); 4222Debug.Assert(symbol.IsPartialMember()); 4301Debug.Assert(symbol.IsPartialMember()); 4553Debug.Assert(!propertySymbol.IsExplicitInterfaceImplementation); // checked by caller 4604Debug.Assert(!eventSymbol.IsExplicitInterfaceImplementation); // checked by caller 4739Debug.Assert(node.SyntaxTree == initializers.Last().Syntax.SyntaxTree); 4740Debug.Assert(node.SpanStart > initializers.Last().Syntax.Span.Start); 4826Debug.Assert(property.IsIndexer); 4915Debug.Assert(TypeKind == TypeKind.Struct); 4919Debug.Assert(builder.DeclarationWithParameters is TypeDeclarationSyntax { ParameterList: not null } type 4964Debug.Assert(ctor is object); 4974Debug.Assert(declaredMembersAndInitializers.PrimaryConstructor?.GetBackingFields().Any() != true); 4983Debug.Assert(valueProperty.GetMethod is object); 4984Debug.Assert(valueProperty.SetMethod is null); 4987Debug.Assert(backingField is object); 5016Debug.Assert(typeSyntax != null); 5053Debug.Assert(memberOffset == members.Count - typesBuilder.Count); 5102Debug.Assert(declaredMembersAndInitializers.DeclarationWithParameters is object); 5106Debug.Assert(ctor is object); 5159Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false })); 5170Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol)); 5218Debug.Assert(isRecordClass); 5266Debug.Assert(isRecordClass); 5473Debug.Assert(property.GetMethod is object); 5474Debug.Assert(property.SetMethod is object); 5478Debug.Assert(backingField is object); 5540Debug.Assert(isRecordClass); 5662Debug.Assert(isRecordClass); 5995Debug.Assert(@event.IsPartial || @event.AddMethod is not null); 5996Debug.Assert(@event.IsPartial || @event.RemoveMethod is not null); 6019Debug.Assert(@event.AssociatedField is null); 6124Debug.Assert( 6329Debug.Assert(this.declaration.ContainsExtensionDeclarations);
Symbols\Source\SourceMemberFieldSymbol.cs (8)
87Debug.Assert(constToken.Kind() == SyntaxKind.ConstKeyword); 187Debug.Assert(!this.IsFixedSizeBuffer, "Subclasses representing fixed fields must override"); 253Debug.Assert((result & ~(DeclarationModifiers.AccessibilityMask | DeclarationModifiers.Fixed | DeclarationModifiers.Unsafe | DeclarationModifiers.Safe | DeclarationModifiers.New)) == 0); 360Debug.Assert(!this.IsFixedSizeBuffer, "Subclasses representing fixed fields must override"); 483Debug.Assert(fieldsBeingBound != null); 534Debug.Assert(refKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly); 553Debug.Assert(refKindToAssert == RefKind.None); // Otherwise we might need to report an error 554Debug.Assert(type.HasType || isVar);
Symbols\Source\SourceMemberMethodSymbol.cs (20)
113Debug.Assert((bits & ReturnsVoidIsSetBit) != 0); 121Debug.Assert((bits & ReturnsVoidIsSetBit) == 0); 122Debug.Assert(value || (bits & ReturnsVoidBit) == 0); 176Debug.Assert(EnumUtilities.ContainsAllValues<MethodKind>(MethodKindMask)); 177Debug.Assert(EnumUtilities.ContainsAllValues<RefKind>(RefKindMask)); 178Debug.Assert(EnumUtilities.ContainsAllValues<NullableContextKind>(NullableContextMask)); 202Debug.Assert(!returnsVoid || returnsVoidIsSet); 284Debug.Assert(!IsMetadataVirtualLocked); 340Debug.Assert(containingType is not null); 341Debug.Assert(location is not null); 342Debug.Assert(containingType.DeclaringCompilation is not null); 470Debug.Assert(lockObject != null); 590Debug.Assert(context is not null || ignoreInterfaceImplementationChanges); 603Debug.Assert(!this.IsStatic); 763Debug.Assert(arrowExpression.Parent.Kind() == SyntaxKind.PropertyDeclaration || 769Debug.Assert(this is SynthesizedClosureMethod); 800Debug.Assert(current is InMethodBinder); 1054Debug.Assert(!this.IsConstructor()); // Constructors should use IsNullableEnabledForConstructorsAndInitializers() instead. 1138Debug.Assert(this.SyntaxNode.SyntaxTree == localTree); 1155Debug.Assert(bodySyntax != null);
Symbols\Source\SourceMethodSymbol.cs (3)
130Debug.Assert(AssociatedSymbol?.GetCallerUnsafeMode(fieldsBeingBound) != CallerUnsafeMode.Implicit); 159Debug.Assert(target is not (LambdaSymbol or LocalFunctionSymbol)); 244Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Symbols\Source\SourceMethodSymbolWithAttributes.cs (36)
53Debug.Assert(arrowExpression.Parent!.Kind() == SyntaxKind.PropertyDeclaration || 61Debug.Assert(recordDecl.IsKind(SyntaxKind.RecordDeclaration)); 279Debug.Assert(!ReferenceEquals(copyFrom, this)); 333Debug.Assert(arguments.SymbolPart == AttributeLocation.None || arguments.SymbolPart == AttributeLocation.Return); 463Debug.Assert(!forceComplete); 479Debug.Assert(!forceComplete); 492Debug.Assert(earlyData is { UnmanagedCallersOnlyAttributePresent: true }); 496Debug.Assert(lateData is null or { UnmanagedCallersOnlyAttributeData: null }); 511Debug.Assert(!arguments.Attribute.HasErrors); 512Debug.Assert(arguments.SymbolPart == AttributeLocation.None || arguments.SymbolPart == AttributeLocation.Return); 526Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 530Debug.Assert(!attribute.HasErrors); 732Debug.Assert(this.IsConditional); 796Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 800Debug.Assert(!attribute.HasErrors); 838Debug.Assert(!attribute.HasErrors); 959Debug.Assert(arguments.AttributeSyntaxOpt is object); 968Debug.Assert(ContainingType is object); 1008Debug.Assert(!arguments.Attribute.HasErrors); 1019Debug.Assert(arguments.Attribute.AttributeConstructor.Parameters is [{ Type.SpecialType: SpecialType.System_Int32 }, { Type.SpecialType: SpecialType.System_String }]); 1027Debug.Assert(arguments.AttributeSyntaxOpt is not null); 1073Debug.Assert(matchingTrees.Count == 1); 1128Debug.Assert(namespaceSegments.Length > 0); 1172Debug.Assert(attributeSyntax is object); 1253Debug.Assert(matchingTrees.Count == 1); 1328Debug.Assert(namespaceSegments.Length > 0); 1378Debug.Assert(_lazyCustomAttributesBag.IsEarlyDecodedWellKnownAttributeDataComputed); 1391Debug.Assert(arguments.AttributeSyntaxOpt != null); 1407Debug.Assert(reportedError); 1447Debug.Assert(attribute.AttributeClass is not null); 1477Debug.Assert(!boundAttributes.IsDefault); 1478Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1479Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1480Debug.Assert(symbolPart == AttributeLocation.None || symbolPart == AttributeLocation.Return); 1484Debug.Assert(_lazyCustomAttributesBag != null); 1485Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed);
Symbols\Source\SourceModuleSymbol.cs (9)
58Debug.Assert((object)assemblySymbol != null); 148Debug.Assert(!_lazyAssembliesToEmbedTypesFrom.IsDefault); 161Debug.Assert(_lazyContainsExplicitDefinitionOfNoPiaLocalTypes != ThreeState.Unknown); 278Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingReferencedAssemblies)); 294Debug.Assert(locationOpt != null || filter != null, "If no location or filter was specified, then the namespace members should be completed"); 543Debug.Assert(completed); 582Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 585Debug.Assert(!attribute.HasErrors); 586Debug.Assert(arguments.SymbolPart == AttributeLocation.None);
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (8)
103Debug.Assert(!this.IsClassType() || localBase.IsObjectType() || baseLocation != null); 186Debug.Assert(!other.Equals(@interface, TypeCompareKind.ConsiderEverything)); 187Debug.Assert(other.Equals(@interface, TypeCompareKind.CLRSignatureCompareOptions)); 289Debug.Assert(basesBeingResolved == null || !basesBeingResolved.ContainsReference(this.OriginalDefinition)); 388Debug.Assert(baseTypeLocation != null); 582Debug.Assert((object)localBase != null); 725Debug.Assert(GetDeclaredInterfaces(basesBeingResolved: null).IsEmpty, "Computation skipped for enums"); 779Debug.Assert((object)GetDeclaredBaseType(basesBeingResolved: null) == null, "Computation skipped for enums");
Symbols\Source\SourceNamedTypeSymbol_Enum.cs (1)
96Debug.Assert((object)this.EnumUnderlyingType != null);
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (25)
43Debug.Assert(this.IsExtension && this.IsDefinition); 71Debug.Assert(extendedType.CustomModifiers.IsEmpty); 121Debug.Assert(typeConstraint.CustomModifiers.IsEmpty); 281Debug.Assert(array.Sizes.IsEmpty && array.LowerBounds.IsDefault); // We only deal with source array types 369Debug.Assert(this.IsExtension && this.IsDefinition); 436Debug.Assert(type.CustomModifiers.IsEmpty); 457Debug.Assert(false); 526Debug.Assert(elementType.CustomModifiers.IsEmpty); 587Debug.Assert(typeArguments[i].CustomModifiers.IsEmpty); 777Debug.Assert(callingConventionTypes[i].Name.StartsWith("CallConv", StringComparison.Ordinal)); 818Debug.Assert(attribute.AttributeClass is not null); 883Debug.Assert(argument.TypeInternal is not null); 895Debug.Assert(argument.TypeInternal is not null); 901Debug.Assert(argument.ValueInternal is not null); 908Debug.Assert(argument.TypeInternal is not null); 1033Debug.Assert(this.IsExtension); 1034Debug.Assert(method.IsDefinition); 1035Debug.Assert(method.ContainingType == (object)this); 1066Debug.Assert(IsExtension); 1084Debug.Assert(parameterList is not null); 1092Debug.Assert(count > 0); 1160Debug.Assert(bytesWritten == hash.Length); 1165Debug.Assert(bytesWritten == hash.Length); 1177Debug.Assert(extensionMember.IsExtensionBlockMember()); 1205Debug.Assert(result.ContainingType.ExtensionParameter is not null);
Symbols\Source\SourceNamedTypeSymbol.cs (43)
92Debug.Assert(false, "bad declaration kind"); 295Debug.Assert(!_typeParameterInfo.LazyTypeParameterConstraintTypes.IsDefault); 317Debug.Assert(!_typeParameterInfo.LazyTypeParameterConstraintKinds.IsDefault); 358Debug.Assert(!binder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 364Debug.Assert(constraints.Length == arity); 439Debug.Assert(!binder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 446Debug.Assert(constraints.Length == arity); 511Debug.Assert(constraintClauses.Length == arity); 541Debug.Assert(originalConstraintTypes.Length == mergedConstraintTypes.Count); 545Debug.Assert(originalConstraintTypes[j].Equals(mergedConstraintTypes[j], TypeCompareKind.ObliviousNullableModifierMatchesAny)); 664Debug.Assert(constraintClauses.Length == arity); 680Debug.Assert((constraint.Constraints & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull)) == 682Debug.Assert((mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 684Debug.Assert((constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == (mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds) || 856Debug.Assert(completed); 859Debug.Assert(_lazyCustomAttributesBag.IsSealed); 1040Debug.Assert(attributeData.CommonConstructorArguments[0].Kind == TypedConstantKind.Type); 1076Debug.Assert(this.SpecialType == SpecialType.System_Object || this.DeclaringCompilation.IsAttributeType(this)); 1117Debug.Assert(arguments.AttributeSyntaxOpt is { }); 1121Debug.Assert(!attribute.HasErrors); 1122Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 1275Debug.Assert(_lazyIsExplicitDefinitionOfNoPiaLocalType != ThreeState.Unknown); 1318Debug.Assert(diagnose == (diagnosticsOpt != null)); 1319Debug.Assert(!attribute.HasErrors); 1321Debug.Assert(!this.IsErrorType()); 1356Debug.Assert(!attribute.HasErrors); 1361Debug.Assert(argument.Kind == TypedConstantKind.Type); 1408Debug.Assert(this.IsConditional); 1409Debug.Assert(!attribute.HasErrors); 1638Debug.Assert(!boundAttributes.IsDefault); 1639Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1640Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1641Debug.Assert(_lazyCustomAttributesBag != null); 1642Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 1643Debug.Assert(symbolPart == AttributeLocation.None); 1649Debug.Assert(boundAttributes.Any()); 1699Debug.Assert(boundAttributes.Any()); 1709Debug.Assert(boundAttributes.Any()); 1753Debug.Assert(obsoleteData != ObsoleteAttributeData.Uninitialized, "getting synthesized attributes before attributes are decoded"); 1914Debug.Assert(this.SpecialType == SpecialType.System_IntPtr || this.SpecialType == SpecialType.System_UIntPtr); 1947Debug.Assert(ExtensionMarkerName is not null); 1977Debug.Assert(ObsoleteKind != ObsoleteAttributeKind.Uninitialized); 1978Debug.Assert(GetMembers().All(m => m.ObsoleteKind != ObsoleteAttributeKind.Uninitialized));
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (35)
33Debug.Assert((object)result == calculated); 37Debug.Assert(result.ExternAliases.SequenceEqual(calculated.ExternAliases)); 38Debug.Assert(result.UsingAliases.SetEquals(calculated.UsingAliases)); 39Debug.Assert(result.Usings.SequenceEqual(calculated.Usings)); 51Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetImports(this, declarationSyntax, basesBeingResolved) == Imports.Empty); 120Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetExternAliases(this, declarationSyntax).IsEmpty); 130Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetExternAliases(this, declarationSyntax).IsEmpty); 151Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliases(this, declarationSyntax, basesBeingResolved).IsEmpty); 161Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliases(this, declarationSyntax, basesBeingResolved).IsEmpty); 183Debug.Assert(result.SetEquals(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliasesMap(this, declarationSyntax, basesBeingResolved))); 193Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliasesMap(this, declarationSyntax, basesBeingResolved).IsEmpty); 215Debug.Assert(result.SequenceEqual(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingNamespacesOrTypes(this, declarationSyntax, basesBeingResolved))); 225Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingNamespacesOrTypes(this, declarationSyntax, basesBeingResolved).IsEmpty); 447Debug.Assert(result.IsEmpty); 448Debug.Assert(diagnostics.IsEmptyWithoutResolution); 564Debug.Assert(!onlyGlobal); 580Debug.Assert(calculated.UsingAliases.IsEmpty); 581Debug.Assert(calculated.UsingAliasesMap?.IsEmpty ?? true); 582Debug.Assert(calculated.UsingNamespacesOrTypes.IsEmpty); 583Debug.Assert(calculated.Diagnostics?.IsEmptyWithoutResolution ?? true); 598Debug.Assert(calculated.UsingAliases.SequenceEqual(result.UsingAliases)); 599Debug.Assert((calculated.UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty).SetEquals(result.UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty)); 600Debug.Assert(calculated.UsingNamespacesOrTypes.SequenceEqual(result.UsingNamespacesOrTypes)); 601Debug.Assert(calculated.Diagnostics?.IsEmptyWithoutResolution ?? true); 763Debug.Assert(directiveDiagnostics.DiagnosticBag is object); 764Debug.Assert(directiveDiagnostics.DependenciesBag is object); 784Debug.Assert(directiveDiagnostics.DependenciesBag.IsEmpty()); 959Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports)); 983Debug.Assert(diagnostics.DiagnosticBag is object); 984Debug.Assert(diagnostics.DependenciesBag is object); 994Debug.Assert(declaringSymbol.IsGlobalNamespace); 1008Debug.Assert(alias.UsingDirective != null); 1027Debug.Assert(declaringSymbol.IsGlobalNamespace); 1063Debug.Assert(target.IsGlobalNamespace); 1202Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports));
Symbols\Source\SourceNamespaceSymbol.cs (4)
58Debug.Assert(mergedDeclaration != null); 239Debug.Assert(wasSetThisThread); 308Debug.Assert((object)nts != null || symbol is not TypeSymbol); 347Debug.Assert((object)nts?.OriginalDefinition == nts && (object)other.OriginalDefinition == other);
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (6)
84Debug.Assert(_lazyReturnType.CustomModifiers.IsEmpty); 94Debug.Assert(_lazyExplicitInterfaceImplementations.IsDefault); 132Debug.Assert(_lazyExplicitInterfaceImplementations.IsDefault); 143Debug.Assert(_lazyExplicitInterfaceImplementations.IsDefault); 146Debug.Assert(_lazyReturnType.CustomModifiers.IsEmpty); 166Debug.Assert(result == GetParameterCountFromSyntax());
Symbols\Source\SourceOrdinaryMethodSymbol.cs (28)
63Debug.Assert(diagnostics.DiagnosticBag is object); 78Debug.Assert(syntax.ReturnType is not ScopedTypeSyntax); 135Debug.Assert(returnTypeSyntax is not ScopedTypeSyntax); 155Debug.Assert(this.RefKind == RefKind.None || !returnType.IsVoidType() || returnTypeSyntax.HasErrors); 174Debug.Assert(declaredConstraints.All(clause => clause.ConstraintTypes.IsEmpty)); 217Debug.Assert(parameterSyntax.Type != null); 282Debug.Assert(syntaxReferenceOpt != null); 303Debug.Assert(definition.IsPartialDefinition); 304Debug.Assert(implementation.IsPartialImplementation); 430Debug.Assert(PartialDefinitionPart is null); 480Debug.Assert(this.DeclaringSyntaxReferences.Length == 1); 508Debug.Assert(!ReferenceEquals(definition, implementation)); 624Debug.Assert(!ReferenceEquals(definition, implementation)); 625Debug.Assert(definition.Arity == implementation.Arity); 690Debug.Assert(this.MethodKind != MethodKind.UserDefinedOperator, "SourceUserDefinedOperatorSymbolBase overrides this"); 745Debug.Assert(!available, "Should have been parsed as partial constructor."); 797Debug.Assert(isExplicitInterfaceImplementation); 868Debug.Assert(!IsStatic || !IsOverride); // Otherwise should have been reported and cleared earlier. 869Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 1071Debug.Assert(definition.IsPartialDefinition); 1072Debug.Assert(implementation.IsPartialImplementation); 1074Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || alreadySetImplPart == implementation); 1075Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || alreadySetDefPart == definition); 1080Debug.Assert(definition._otherPartOfPartial == implementation); 1081Debug.Assert(implementation._otherPartOfPartial == definition); 1094Debug.Assert(!_typeParameterInfo.LazyTypeParameters.IsDefault); 1157Debug.Assert(syntax.ExplicitInterfaceSpecifier != null); 1169Debug.Assert(syntax.TypeParameterList != null);
Symbols\Source\SourceParameterSymbol.cs (5)
44Debug.Assert(owner is not LambdaSymbol); // therefore we don't need to deal with discard parameters 59Debug.Assert(!inModifiers.IsDefault); 111Debug.Assert((owner.Kind == SymbolKind.Method) || (owner.Kind == SymbolKind.Property) || owner is NamedTypeSymbol { IsExtension: true }); 146Debug.Assert(!(ContainingSymbol is LocalFunctionSymbol)); 175Debug.Assert(filter == null);
Symbols\Source\SourceParameterSymbolBase.cs (2)
23Debug.Assert((object)containingSymbol != null); 24Debug.Assert(containingSymbol.ContainingAssembly != null);
Symbols\Source\SourcePropertyAccessorSymbol.cs (7)
37Debug.Assert(syntax.Kind() == SyntaxKind.GetAccessorDeclaration || 222Debug.Assert(!_property.IsExpressionBodied, "Cannot have accessors in expression bodied lightweight properties"); 298Debug.Assert(explicitInterfaceImplementations.Length == 1); 338Debug.Assert(propertyAccessibility != Accessibility.NotApplicable); 633Debug.Assert(syntaxReferenceOpt != null); 690Debug.Assert(MethodKind == MethodKind.PropertySet); 873Debug.Assert(IsPartialDefinition);
Symbols\Source\SourcePropertySymbol.cs (18)
52Debug.Assert(!(getterUsesFieldKeyword || setterUsesFieldKeyword) || 143Debug.Assert(syntax.Type is not ScopedTypeSyntax); 195Debug.Assert(PartialDefinitionPart is null 299Debug.Assert(hasGetAccessorImplementation); // it's not clear how this even parsed as a property if it has no accessor list and no arrow expression. 434Debug.Assert(isExplicitInterfaceImplementation); 460Debug.Assert(location.SourceTree is not null); 520Debug.Assert(!(syntax.AccessorList is null && GetArrowExpression(syntax) != null)); 574Debug.Assert(typeSyntax is not ScopedTypeSyntax); 728Debug.Assert(this.IsPartialDefinition); 729Debug.Assert((object)this != implementation); 730Debug.Assert((object?)this.OtherPartOfPartial == implementation); 803Debug.Assert(this.ParameterCount == implementation.ParameterCount); 859Debug.Assert(definition.IsPartialDefinition); 860Debug.Assert(implementation.IsPartialImplementation); 862Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || alreadySetImplPart == implementation); 863Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || alreadySetDefPart == definition); 868Debug.Assert(definition._otherPartOfPartial == implementation); 869Debug.Assert(implementation._otherPartOfPartial == definition);
Symbols\Source\SourcePropertySymbolBase.cs (42)
105Debug.Assert(!isExpressionBodied || !(hasAutoPropertyGet || hasAutoPropertySet)); 106Debug.Assert(!isExpressionBodied || !hasInitializer); 107Debug.Assert(!isExpressionBodied || accessorsHaveImplementation); 108Debug.Assert((modifiers & DeclarationModifiers.Required) == 0 || this is SourcePropertySymbol); 174Debug.Assert(memberName == DefaultIndexerName); 186Debug.Assert(!IsIndexer); 201Debug.Assert(_lazyDeclaredBackingField is null); 278Debug.Assert(isExplicitInterfaceImplementation || _lazyExplicitInterfaceImplementations.IsEmpty); 321Debug.Assert(property.PartialImplementationPart is null); 460Debug.Assert(IsIndexer); 463Debug.Assert(indexerNameAttributeLists.Count != 0); 464Debug.Assert(!IsExplicitInterfaceImplementation); 482Debug.Assert(temp.IsEarlyDecodedWellKnownAttributeDataComputed); 499Debug.Assert(rootBinderOpt is not null); 693Debug.Assert(_lazyExplicitInterfaceImplementations.IsEmpty); 787Debug.Assert(!IsPartial); 810Debug.Assert((object?)_lazyMergedBackingField.Value == backingField); 957Debug.Assert(_getMethod is object); 958Debug.Assert(_setMethod is object); 1053Debug.Assert(typeLocation != null); 1062Debug.Assert(explicitInterfaceSpecifier != null); 1125Debug.Assert(!IsStatic || !IsOverride); // Otherwise should have been reported and cleared earlier. 1126Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 1252Debug.Assert(thisAccessor.MethodKind == MethodKind.PropertySet); 1300Debug.Assert(this.IsSealed && (GetMethod is null || SetMethod is null)); 1361Debug.Assert(!ReferenceEquals(copyFrom, this)); 1380Debug.Assert(completed); 1383Debug.Assert(_lazyCustomAttributesBag.IsSealed); 1581Debug.Assert(arguments.AttributeSyntaxOpt != null); 1584Debug.Assert(diagnostics.DiagnosticBag is object); 1587Debug.Assert(!attribute.HasErrors); 1588Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 1766Debug.Assert(!boundAttributes.IsDefault); 1767Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1768Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1769Debug.Assert(_lazyCustomAttributesBag != null); 1770Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 1771Debug.Assert(symbolPart == AttributeLocation.None); 1800Debug.Assert(this.IsIndexer || this.IsExtensionBlockMember()); 1841Debug.Assert(_state.HasComplete(CompletionPart.FinishPropertyEnsureSignature)); 1876Debug.Assert(completedOnThisThread); 1899Debug.Assert(completedOnThisThread);
Symbols\Source\SourceSimpleParameterSymbol.cs (1)
29Debug.Assert(locations.Length <= 1);
Symbols\Source\SourceTypeParameterSymbol.cs (18)
37Debug.Assert(!syntaxRefs.IsEmpty); 224Debug.Assert(!inProgress.ContainsReference(this)); 225Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol)); 352Debug.Assert(filter == null); 369Debug.Assert(this.ContainingSymbol.IsContainingSymbolOfAllTypeParameters(this.EffectiveBaseClassNoUseSiteDiagnostics)); 370Debug.Assert(this.ContainingSymbol.IsContainingSymbolOfAllTypeParameters(this.DeducedBaseTypeNoUseSiteDiagnostics)); 406Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 407Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 410Debug.Assert(!attribute.HasErrors); 411Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 511Debug.Assert(!HasValueTypeConstraint); 692Debug.Assert(!HasValueTypeConstraint); 819Debug.Assert(overriddenTypeParameters.Length == overridingTypeParameters.Length); 850Debug.Assert(overridingMethod.IsOverride); 856Debug.Assert(method.IsOverride); 871Debug.Assert(implementationMethod.IsExplicitInterfaceImplementation); 877Debug.Assert(explicitImplementations.Length <= 1); 1002Debug.Assert(map != null);
Symbols\Source\SourceUserDefinedConversionSymbol.cs (1)
97Debug.Assert(syntaxReferenceOpt != null);
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (1)
99Debug.Assert(syntaxReferenceOpt != null);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (7)
59Debug.Assert(!this.IsStatic); 123Debug.Assert(!(IsAbstract && IsExtern)); 222Debug.Assert(isExplicitInterfaceImplementation); 762Debug.Assert(!different.IsTypeParameter()); 926Debug.Assert(containingType.IsDefinition); 1018Debug.Assert(operatorDeclaration.ExplicitInterfaceSpecifier != null); 1023Debug.Assert(conversionDeclaration.ExplicitInterfaceSpecifier != null);
Symbols\Source\SynthesizedAttributeData.cs (3)
36Debug.Assert((object)wellKnownMember != null); 37Debug.Assert(!arguments.IsDefault); 38Debug.Assert(!namedArguments.IsDefault); // Frequently empty though.
Symbols\Source\SynthesizedSourceOrdinaryMethodSymbol.cs (1)
29Debug.Assert(Arity == 0);
Symbols\Source\ThisParameterSymbol.cs (1)
145Debug.Assert(containingType is not null);
Symbols\Source\TypeParameterBuilder.cs (1)
29Debug.Assert(syntaxRef.GetSyntax().IsKind(SyntaxKind.TypeParameter));
Symbols\Source\TypeParameterConstraintClause.cs (4)
85Debug.Assert(!constraintTypes.IsDefault); 118Debug.Assert((constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 135Debug.Assert(constraintClauses.Length == typeParameters.Length); 200Debug.Assert(constraintClauses.Length == typeParameters.Length);
Symbols\SpecializedSymbolCollections.cs (2)
16Debug.Assert(instance.Count == 0); 28Debug.Assert(instance.Count == 0);
Symbols\SubstitutedEventSymbol.cs (1)
21Debug.Assert(originalDefinition.IsDefinition);
Symbols\SubstitutedMethodSymbol.cs (8)
44Debug.Assert(containingSymbol is SubstitutedNamedTypeSymbol || containingSymbol is SubstitutedErrorTypeSymbol); 45Debug.Assert(TypeSymbol.Equals(originalDefinition.ContainingType, containingSymbol.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 50Debug.Assert((object)originalDefinition != null); 51Debug.Assert(originalDefinition.IsDefinition); 58Debug.Assert(ReferenceEquals(constructedFrom.ConstructedFrom, constructedFrom)); 110Debug.Assert(ReferenceEquals(_constructedFrom, this)); 124Debug.Assert(_lazyTypeParameters != null); 183Debug.Assert(notUsed.Type is null && OriginalDefinition.ReducedFrom is not null);
Symbols\SubstitutedNamedTypeSymbol.cs (6)
60Debug.Assert(originalDefinition.IsDefinition); 61Debug.Assert(!originalDefinition.IsErrorType()); 70Debug.Assert(ReferenceEquals(constructedFrom.ConstructedFrom, constructedFrom)); 123Debug.Assert(_lazyTypeParameters != null); 174Debug.Assert(!ReferenceEquals(_lazyBaseType, ErrorTypeSymbol.UnknownResultType)); 290Debug.Assert(builder is object);
Symbols\SubstitutedParameterSymbol.cs (1)
37Debug.Assert(originalParameter.IsDefinition);
Symbols\SubstitutedTypeParameterSymbol.cs (2)
23Debug.Assert(ContainingSymbol.OriginalDefinition == _underlyingTypeParameter.ContainingSymbol.OriginalDefinition); 128Debug.Assert(!HasNotNullConstraint && !HasValueTypeConstraint);
Symbols\Symbol_Attributes.cs (36)
30Debug.Assert(!(this is IAttributeTargetSymbol)); //such types must override 218Debug.Assert(arguments.Diagnostics.DiagnosticBag is not null); 219Debug.Assert(arguments.AttributeSyntaxOpt is not null); 320Debug.Assert(!attributesToBind.IsDefault); 327Debug.Assert(!binders.IsDefault); 328Debug.Assert(binders.Length == attributesToBind.Length); 364Debug.Assert(!attributeDataArray.Contains((attr) => attr != null && attr.HasErrors)); 381Debug.Assert(!boundAttributes.Any(static (attr) => attr == null)); 404Debug.Assert(!earlyDecodingOnly); 415Debug.Assert(diagnostics.DiagnosticBag is not null); 421Debug.Assert(boundAttributeArray is not null); 425Debug.Assert(boundAttribute is not null); 443Debug.Assert(lazyCustomAttributesBag.IsSealed); 449Debug.Assert(diagnostics.DiagnosticBag is not null); 474Debug.Assert(totalAttributesCount == boundAttributes.Length); 574Debug.Assert(compilation != null); 644Debug.Assert(bindersBuilder != null); 678Debug.Assert(!binder.InAttributeArgument || this is MethodSymbol { MethodKind: MethodKind.LambdaMethod or MethodKind.LocalFunction }, "Possible cycle in attribute binding"); 785Debug.Assert(boundAttributeTypes.Any()); 786Debug.Assert(attributesToBind.Any()); 787Debug.Assert(binders.Any()); 788Debug.Assert(attributeDataArray != null); 789Debug.Assert(!attributeDataArray.Contains((attr) => attr != null)); 811Debug.Assert(earlyAttributeDataOpt == null || !earlyAttributeDataOpt.HasErrors); 812Debug.Assert(boundAttributeOpt is null == earlyAttributeDataOpt is null); 828Debug.Assert(attributeSyntaxList.Any()); 829Debug.Assert(attributeTypes.Any()); 856Debug.Assert(binders.Any()); 857Debug.Assert(attributeSyntaxList.Any()); 858Debug.Assert(boundAttributes.Any()); 859Debug.Assert(binders.Length == boundAttributes.Length); 860Debug.Assert(attributeSyntaxList.Length == boundAttributes.Length); 906Debug.Assert(!attribute.HasErrors); 929Debug.Assert(this.Kind == SymbolKind.Method); 972Debug.Assert(this.ObsoleteState != ThreeState.Unknown, "ObsoleteState should be true or false now."); 973Debug.Assert(this.ExperimentalState != ThreeState.Unknown, "ExperimentalState should be true or false now.");
Symbols\Symbol.cs (12)
54Debug.Assert(!this.RequiresCompletion); 61Debug.Assert(!this.RequiresCompletion); 203Debug.Assert(!(this is SourceAssemblySymbol), "SourceAssemblySymbol must override DeclaringCompilation"); 206Debug.Assert(!(this is SourceModuleSymbol), "SourceModuleSymbol must override DeclaringCompilation"); 290Debug.Assert(ContainingType.TypeKind != TypeKind.Submission); 407Debug.Assert(declaringCompilation != null); // require that it is a source symbol 912Debug.Assert(this.Kind == SymbolKind.NamedType || this.Kind == SymbolKind.Method); 918Debug.Assert(compilation != null); 1008Debug.Assert(!s.Contains("&")); 1051Debug.Assert(compilation != null); 1180Debug.Assert(!retVal); 1554Debug.Assert(attribute is SourceAttributeData);
Symbols\SymbolCompletionState.cs (2)
50Debug.Assert(symbol.RequiresCompletion); 106Debug.Assert(HasAtMostOneBitSet(next), "ForceComplete won't handle the result correctly if more than one bit is set.");
Symbols\SymbolDistinguisher.cs (3)
33Debug.Assert(symbol0 != symbol1); 161Debug.Assert((object)unwrappedSymbol == UnwrapSymbol(unwrappedSymbol)); 194Debug.Assert(unwrappedSymbol.Kind == SymbolKind.DynamicType || unwrappedSymbol.Kind == SymbolKind.ErrorType || unwrappedSymbol.Kind == SymbolKind.FunctionPointerType);
Symbols\SymbolEqualityComparer.cs (1)
57Debug.Assert(false, "Consider optimizing as above when we need to handle a new type comparison kind.");
Symbols\SymbolExtensions.cs (5)
36Debug.Assert(type.TypeParameters.IsEmpty == (typeArguments.Length == 0)); 107Debug.Assert(!useSiteInfo.AccumulatesDependencies); 269Debug.Assert(!(symbol is TypeSymbol)); 820Debug.Assert(symbol is MethodSymbol or PropertySymbol); 831Debug.Assert(parameter.IsDefinition);
Symbols\Synthesized\GeneratedNameParser.cs (2)
179Debug.Assert((char)GeneratedNameKind.PrimaryConstructorParameter == 'P'); 200Debug.Assert(s_regexPatternString[0] == FileTypeNameStartChar);
Symbols\Synthesized\GeneratedNames.cs (50)
23Debug.Assert((char)GeneratedNameKind.AutoPropertyBackingField == 'k'); 29Debug.Assert((char)GeneratedNameKind.PrimaryConstructorParameter == 'P'); 35Debug.Assert((int)finalizeState < -2); 39Debug.Assert((char)GeneratedNameKind.IteratorFinallyMethod == 'm'); 51Debug.Assert(closureOrdinal >= -1); 52Debug.Assert(methodOrdinal >= 0); 75Debug.Assert((char)GeneratedNameKind.Extension == 'E'); 86Debug.Assert(generation >= 0); 87Debug.Assert(methodOrdinal >= -1); 94Debug.Assert((char)GeneratedNameKind.BaseMethodWrapper == 'n'); 100Debug.Assert(methodOrdinal >= -1); 101Debug.Assert(methodGeneration >= 0); 102Debug.Assert(lambdaOrdinal >= 0); 103Debug.Assert(lambdaGeneration >= 0); 112Debug.Assert(methodOrdinal >= -1); 113Debug.Assert(lambdaOrdinal >= 0); 120Debug.Assert(methodOrdinal >= -1); 121Debug.Assert(methodGeneration >= 0); 122Debug.Assert(lambdaOrdinal >= 0); 123Debug.Assert(lambdaGeneration >= 0); 138Debug.Assert(methodOrdinal >= -1); 139Debug.Assert(methodGeneration >= 0 || methodGeneration == -1 && methodOrdinal == -1); 140Debug.Assert(entityOrdinal >= -1); 141Debug.Assert(entityGeneration >= 0 || entityGeneration == -1 && entityOrdinal == -1); 142Debug.Assert(entityGeneration == -1 || entityGeneration >= methodGeneration); 143Debug.Assert(suffixTerminator != GeneratedNameConstants.IdSeparator); 211Debug.Assert((localName != null) == (kind == SynthesizedLocalKind.UserDefined)); 212Debug.Assert(slotIndex >= 0); 213Debug.Assert(kind.IsLongLived()); 227Debug.Assert(localName.IndexOf('.') == -1); 254Debug.Assert((char)GeneratedNameKind.AwaiterField == 'u'); 260Debug.Assert((char)GeneratedNameKind.LambdaCacheField == '9'); 266Debug.Assert(kind.IsLongLived()); 284Debug.Assert((char)GeneratedNameKind.DisplayClassLocalOrField == '8'); 291Debug.Assert((char)GeneratedNameKind.FixedBufferField == 'e'); 298Debug.Assert((char)GeneratedNameKind.StateMachineStateField == '1'); 304Debug.Assert((char)GeneratedNameKind.AsyncIteratorPromiseOfValueOrEndBackingField == 'v'); 310Debug.Assert((char)GeneratedNameKind.CombinedTokensField == 'x'); 316Debug.Assert((char)GeneratedNameKind.IteratorCurrentBackingField == '2'); 322Debug.Assert((char)GeneratedNameKind.DisposeModeField == 'w'); 328Debug.Assert((char)GeneratedNameKind.IteratorCurrentThreadIdField == 'l'); 334Debug.Assert((char)GeneratedNameKind.StateMachineStateIdField == 'I'); 340Debug.Assert((char)GeneratedNameKind.ThisProxyField == '4'); 351Debug.Assert((char)GeneratedNameKind.StateMachineParameterProxyField == '3'); 364Debug.Assert((char)GeneratedNameKind.DynamicCallSiteField == 'p'); 461Debug.Assert(name == MakeSynthesizedDelegateName(byRefs, returnsVoid, generation)); 467Debug.Assert((char)GeneratedNameKind.InlineArrayType == 'y'); 476Debug.Assert((char)GeneratedNameKind.ReadOnlyListType == 'z'); 492Debug.Assert((char)GeneratedNameKind.AsyncBuilderField == 't'); 532Debug.Assert((char)GeneratedNameKind.ReusableHoistedLocalField == '7');
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListEnumeratorTypeSymbol.cs (5)
59Debug.Assert(method.ReturnType.IsObjectType()); 60Debug.Assert(itemFieldReference.Type.IsTypeParameter()); 63Debug.Assert(c.IsImplicit); 64Debug.Assert(c.IsBoxing); 123Debug.Assert(property is { GetMethod: not null, SetMethod: null });
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListProperty.cs (1)
22Debug.Assert(setAccessorBody is null == interfaceProperty.SetMethod is null);
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeParameterSymbol.cs (1)
17Debug.Assert(containingType.IsClassType());
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (24)
253Debug.Assert(diagnosticInfo is { }); 487Debug.Assert(enumeratorType is not null); 495Debug.Assert(interfaceType.IsInterface); 497Debug.Assert(c.IsImplicit); 498Debug.Assert(c.IsReference); 551Debug.Assert(returnType.IsObjectType()); 553Debug.Assert(c.IsImplicit); 554Debug.Assert(c.IsReference); 594Debug.Assert(interfaceType.IsInterface); 596Debug.Assert(c.IsImplicit); 597Debug.Assert(c.IsReference); 638Debug.Assert(c.IsImplicit); 639Debug.Assert(c.IsBoxing); 660Debug.Assert(interfaceType.IsInterface); 662Debug.Assert(c.IsImplicit); 663Debug.Assert(c.IsReference); 744Debug.Assert(interfaceType.IsInterface); 746Debug.Assert(c.IsImplicit); 747Debug.Assert(c.IsReference); 788Debug.Assert(fieldType.IsTypeParameter()); 789Debug.Assert(parameterReference.Type.Equals(fieldType) || 800Debug.Assert(c.IsUnboxing || c.IsIdentity); 824Debug.Assert(symbol is { }); 825Debug.Assert(_field.Type.OriginalDefinition.Equals(symbol.ContainingType, TypeCompareKind.AllIgnoreOptions));
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (14)
26Debug.Assert(syntax.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration); 27Debug.Assert(containingType.HasPrimaryConstructor); 28Debug.Assert(containingType is SourceNamedTypeSymbol); 29Debug.Assert(containingType is IAttributeTargetSymbol); 39Debug.Assert(syntax.ParameterList != null); 60Debug.Assert(syntaxReferenceOpt != null); 111Debug.Assert(typeDecl.ParameterList is not null); 147Debug.Assert(arguments.SymbolPart == AttributeLocation.Method); 156Debug.Assert(arguments.SymbolPart == AttributeLocation.Method); 164Debug.Assert(symbolPart is AttributeLocation.Method or AttributeLocation.Return); 170Debug.Assert(attributeDeclarationSyntax.Target is object); 220Debug.Assert(count == value.Count); 229Debug.Assert(oldSet.Contains(p)); 233Debug.Assert(count == 0);
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (3)
22Debug.Assert(!containingType.IsRecordStruct); 68Debug.Assert(c.IsImplicit); 69Debug.Assert(c.IsReference);
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (3)
27Debug.Assert(!containingType.IsRecordStruct); 50Debug.Assert(modifiersAreValid(result)); 108Debug.Assert(!IsAbstract);
Symbols\Synthesized\Records\SynthesizedRecordCopyCtor.cs (2)
78Debug.Assert(IsImplicitlyDeclared); 81Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
26Debug.Assert(positionalMembers.All(p => p is PropertySymbol { GetMethod: not null } or FieldSymbol));
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (2)
48Debug.Assert(!containingType.IsRecordStruct); 101Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (1)
44Debug.Assert(name == WellKnownMemberNames.EqualityOperatorName || name == WellKnownMemberNames.InequalityOperatorName);
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (5)
27Debug.Assert(equalityContract is null == containingType.IsRecordStruct); 69Debug.Assert(_equalityContract is not null); 93Debug.Assert(!other.Type.IsStructType()); 132Debug.Assert(c.IsImplicit); 133Debug.Assert(c.IsReference);
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (2)
23Debug.Assert(containingType.IsRecordStruct == equalityContract is null); 56Debug.Assert(_equalityContract is not null);
Symbols\Synthesized\Records\SynthesizedRecordObjEquals.cs (2)
62Debug.Assert(paramAccess.Type.IsObjectType()); 64Debug.Assert(c.IsUnboxing);
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (5)
51Debug.Assert(modifiersAreValid(result)); 187Debug.Assert(!printableMembers.IsEmpty); 215Debug.Assert(value.Type is not null); 228Debug.Assert(c.IsImplicit); 229Debug.Assert(c.IsIdentity || c.IsReference || c.IsBoxing);
Symbols\Synthesized\Records\SynthesizedRecordPropertySymbol.cs (2)
64Debug.Assert(isAutoPropertyAccessor); 70Debug.Assert(isAutoPropertyAccessor);
Symbols\Synthesized\Records\SynthesizedRecordToString.cs (1)
32Debug.Assert(printMethod is object);
Symbols\Synthesized\RefKindVector.cs (2)
104Debug.Assert(i > 0); 137Debug.Assert(firstWord is not null);
Symbols\Synthesized\SynthesizedAccessorValueParameterSymbol.cs (3)
31Debug.Assert(accessor.Locations.Length <= 1); 109Debug.Assert(accessor.Locations.Length <= 1); 122Debug.Assert(accessor.Locations.Length <= 1);
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (11)
34Debug.Assert(!string.IsNullOrEmpty(name)); 95Debug.Assert(!string.IsNullOrEmpty(name)); 96Debug.Assert(property.RefKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly); 168Debug.Assert(inferredAnnotation is not NullableAnnotation.Ignored); 171Debug.Assert((NullableAnnotation)_inferredNullableAnnotation is NullableAnnotation.NotAnnotated or NullableAnnotation.Annotated); 178Debug.Assert(InfersNullableAnnotation); 183Debug.Assert(_property.GetMethod is null); 251Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 252Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 255Debug.Assert(!attribute.HasErrors); 256Debug.Assert(arguments.SymbolPart == AttributeLocation.None);
Symbols\Synthesized\SynthesizedContainer.cs (3)
29Debug.Assert(name != null); 37Debug.Assert(name != null); 69Debug.Assert(compilation != null, "SynthesizedClass is not contained in a source module?");
Symbols\Synthesized\SynthesizedEmbeddedAttributeSymbol.cs (4)
42Debug.Assert(name is object); 43Debug.Assert(containingNamespace is object); 44Debug.Assert(containingModule is object); 45Debug.Assert(baseType is object);
Symbols\Synthesized\SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol.cs (2)
30Debug.Assert(FieldName == GeneratedNames.MakeBackingFieldName(PropertyName)); 37Debug.Assert(_constructors.Length == AttributeDescription.ExtensionMarkerAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEmbeddedMemorySafetyRulesAttributeSymbol.cs (4)
83Debug.Assert(_fields.Length == 1); 84Debug.Assert(parameters.Length == 1); 103Debug.Assert(property.GetMethod is not null); 104Debug.Assert(property.SetMethod is null);
Symbols\Synthesized\SynthesizedEmbeddedNativeIntegerAttributeSymbol.cs (1)
57Debug.Assert(_constructors.Length == AttributeDescription.NativeIntegerAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEmbeddedNullableAttributeSymbol.cs (1)
61Debug.Assert(_constructors.Length == AttributeDescription.NullableAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEmbeddedNullableContextAttributeSymbol.cs (1)
45Debug.Assert(_constructors.Length == AttributeDescription.NullableContextAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEmbeddedNullablePublicOnlyAttributeSymbol.cs (1)
45Debug.Assert(_constructors.Length == AttributeDescription.NullablePublicOnlyAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (15)
50Debug.Assert((object)containingType != null); 355Debug.Assert(userMain.ParameterCount == 0 || userMain.ParameterCount == 1); 415Debug.Assert( 418Debug.Assert(!compilation.IsRuntimeAsyncEnabledIn(this)); 489Debug.Assert(containingType.IsScriptClass); 490Debug.Assert(returnType.IsVoidType()); 517Debug.Assert(ctor.ParameterCount == 0); 520Debug.Assert(initializer.ParameterCount == 0); 529Debug.Assert(!initializer.ReturnType.IsDynamic()); 532Debug.Assert(!compilation.IsRuntimeAsyncEnabledIn(this)); 579Debug.Assert(containingType.IsSubmissionClass); 580Debug.Assert(!returnType.IsVoidType()); 609Debug.Assert(ctor.ParameterCount == 1); 612Debug.Assert(initializer.ParameterCount == 0); 651Debug.Assert(TypeSymbol.Equals(initializeResult.Type, _returnType.Type, TypeCompareKind.ConsiderEverything2));
Symbols\Synthesized\SynthesizedEventAccessorSymbol.cs (3)
32Debug.Assert(IsAbstract || IsExtern || IsFieldLikeEventAccessor()); 54Debug.Assert(PartialImplementationPart is null); 129Debug.Assert(TryGetBodyBinder() is null);
Symbols\Synthesized\SynthesizedFieldSymbol.cs (1)
32Debug.Assert((object)type != null);
Symbols\Synthesized\SynthesizedFieldSymbolBase.cs (4)
31Debug.Assert((object)containingType != null); 32Debug.Assert(!string.IsNullOrEmpty(name)); 33Debug.Assert((accessibility & DeclarationModifiers.AccessibilityMask) != 0); 34Debug.Assert((accessibility & ~DeclarationModifiers.AccessibilityMask) == 0);
Symbols\Synthesized\SynthesizedGlobalMethodSymbol.cs (9)
31Debug.Assert(privateImplType is not null); 32Debug.Assert(name != null); 41Debug.Assert((object)returnType != null); 48Debug.Assert(returnType is not null); 49Debug.Assert(_returnType is null); 55Debug.Assert(!parameters.IsDefault); 56Debug.Assert(_parameters.IsDefault); 62Debug.Assert(!typeParameters.IsDefault); 63Debug.Assert(_typeParameters.IsDefault);
Symbols\Synthesized\SynthesizedImplementationMethod.cs (1)
36Debug.Assert(implementingType.IsDefinition);
Symbols\Synthesized\SynthesizedInlineArrayAsSpanMethod.cs (1)
51Debug.Assert(inlineArrayParameter.RefKind is RefKind.Ref or RefKind.In);
Symbols\Synthesized\SynthesizedInlineArrayTypeSymbol.cs (2)
33Debug.Assert(arrayLength > 0); 206Debug.Assert(compilation is { });
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (2)
22Debug.Assert((object)containingType != null); 84Debug.Assert(_containingType.TypeKind == TypeKind.Class);
Symbols\Synthesized\SynthesizedInteractiveInitializerMethod.cs (3)
28Debug.Assert(containingType.IsScriptClass); 172Debug.Assert(!this.IsStatic); 173Debug.Assert(!this.IsGenericMethod);
Symbols\Synthesized\SynthesizedIntrinsicOperatorSymbol.cs (3)
35Debug.Assert(leftType.Equals(returnType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 42Debug.Assert((leftType.IsDynamic() || rightType.IsDynamic()) == returnType.IsDynamic()); 43Debug.Assert(_containingType.IsDynamic() == returnType.IsDynamic());
Symbols\Synthesized\SynthesizedLambdaCacheFieldSymbol.cs (2)
22Debug.Assert((object)type != null); 23Debug.Assert((object)topLevelMethod != null);
Symbols\Synthesized\SynthesizedLocal.cs (6)
49Debug.Assert(!type.IsVoidType()); 50Debug.Assert(!kind.IsLongLived() || syntaxOpt != null); 51Debug.Assert(refKind != RefKind.Out); 52Debug.Assert(containingMethodOpt is null || containingMethodOpt.DeclaringCompilation is not null); 155Debug.Assert(_syntaxOpt != null); 179Debug.Assert(!_isKnownToReferToTempIfReferenceType);
Symbols\Synthesized\SynthesizedMethodSymbol.cs (1)
51Debug.Assert(!this.IsExtensionBlockMember());
Symbols\Synthesized\SynthesizedParameterSymbol.cs (11)
33Debug.Assert(type.HasType); 34Debug.Assert(name != null); 35Debug.Assert(ordinal >= 0); 309Debug.Assert(!(oldParam is SynthesizedComplexParameterSymbol)); 362Debug.Assert(!refCustomModifiers.IsDefault); 363Debug.Assert(isParams || !refCustomModifiers.IsEmpty || baseParameterForAttributes is object || defaultValue is not null || hasUnscopedRefAttribute); 364Debug.Assert(baseParameterForAttributes is null || baseParameterForAttributes.ExplicitDefaultConstantValue == defaultValue); 365Debug.Assert(baseParameterForAttributes is null || baseParameterForAttributes.RefKind == refKind); 366Debug.Assert(!isParams || container is SynthesizedDelegateInvokeMethod or SynthesizedClosureMethod, 425Debug.Assert(_baseParameterForAttributes is null); 434Debug.Assert(_baseParameterForAttributes is null);
Symbols\Synthesized\SynthesizedPrivateImplementationDetailsType.cs (2)
27Debug.Assert(globalNamespace.IsGlobalNamespace); 28Debug.Assert(objectType.IsObjectType());
Symbols\Synthesized\SynthesizedSealedPropertyAccessor.cs (4)
31Debug.Assert((object)property != null); 32Debug.Assert(property.IsSealed); 33Debug.Assert((object)overriddenAccessor != null); 95Debug.Assert(AccessCheck.IsSymbolAccessible(_overriddenAccessor, this.ContainingType, ref discardedUseSiteInfo));
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
32Debug.Assert(declaration.SyntaxReference.GetSyntax() is CompilationUnitSyntax); 158Debug.Assert(!HasUnsafeModifier, $"Revisit {nameof(CanBeCallerUnsafe)} implementation if {nameof(SynthesizedSimpleProgramEntryPointSymbol)} can be marked 'unsafe'.");
Symbols\Synthesized\SynthesizedStaticConstructor.cs (1)
406Debug.Assert(ContainingType is SynthesizedClosureEnvironment);
Symbols\Synthesized\SynthesizedSubmissionConstructor.cs (2)
19Debug.Assert(containingType.TypeKind == TypeKind.Submission); 20Debug.Assert(diagnostics != null);
Symbols\Synthesized\SynthesizedThrowSwitchExpressionExceptionMethod.cs (1)
33Debug.Assert(unmatchedValue.Type.SpecialType == SpecialType.System_Object);
Symbols\Synthesized\SynthesizedTypeParameterSymbol.cs (2)
28Debug.Assert(ContainingSymbol.OriginalDefinition != _underlyingTypeParameter.ContainingSymbol.OriginalDefinition); 30Debug.Assert(this.TypeParameterKind == (ContainingSymbol is MethodSymbol ? TypeParameterKind.Method :
Symbols\Synthesized\SynthesizedUnionCtor.cs (4)
45Debug.Assert(valueProperty.DeclaredBackingField is not null); 62Debug.Assert(F.Syntax is TypeDeclarationSyntax); 74Debug.Assert(IsImplicitlyDeclared); 77Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Symbols\Synthesized\SynthesizedUnionValuePropertySymbol.cs (1)
58Debug.Assert(isAutoPropertyAccessor);
Symbols\Synthesized\TypeSubstitutedLocalSymbol.cs (4)
22Debug.Assert(originalVariable != null); 23Debug.Assert(type.HasType); 24Debug.Assert(containingSymbol != null); 25Debug.Assert(containingSymbol.DeclaringCompilation is not null);
Symbols\SynthesizedNamespaceSymbol.cs (2)
26Debug.Assert(containingNamespace is object); 27Debug.Assert(name is object);
Symbols\Tuples\TupleErrorFieldSymbol.cs (4)
50Debug.Assert(name != null); 57Debug.Assert((correspondingDefaultFieldOpt == null) == this.IsDefaultTupleElement); 58Debug.Assert(correspondingDefaultFieldOpt == null || correspondingDefaultFieldOpt.IsDefaultTupleElement); 197Debug.Assert(newOwner.IsTupleType && newOwner.TupleElementTypesWithAnnotations.Length > TupleElementIndex);
Symbols\Tuples\TupleFieldSymbol.cs (15)
46Debug.Assert(tupleElementIndex >= 0); 47Debug.Assert(container.Equals(underlyingField.ContainingType, TypeCompareKind.IgnoreDynamicAndTupleNames) || this is TupleVirtualElementFieldSymbol, 49Debug.Assert(!(underlyingField is TupleElementFieldSymbol)); 52Debug.Assert(!container.IsDefinition); 54Debug.Assert(container.IsTupleType); 57Debug.Assert(!locations.IsDefault); 213Debug.Assert(newOwner.IsTupleType); 269Debug.Assert(container.IsTupleType); 270Debug.Assert(underlyingField.ContainingType.IsTupleType); 271Debug.Assert(name != null); 272Debug.Assert(name != underlyingField.Name || !container.Equals(underlyingField.ContainingType, TypeCompareKind.IgnoreDynamicAndTupleNames), 274Debug.Assert((correspondingDefaultFieldOpt is null) == (NamedTypeSymbol.TupleMemberName(tupleElementIndex + 1) == name)); 275Debug.Assert(!(correspondingDefaultFieldOpt is TupleErrorFieldSymbol)); 334Debug.Assert(newOwner.IsTupleType); 335Debug.Assert(newOwner.TupleElements.Length == this._containingTuple.TupleElements.Length);
Symbols\Tuples\TupleTypeSymbol.cs (29)
44Debug.Assert(!shouldCheckConstraints || syntax is object); 45Debug.Assert(elementNames.IsDefault || elementTypesWithAnnotations.Length == elementNames.Length); 46Debug.Assert(!includeNullability || shouldCheckConstraints); 67Debug.Assert(syntax is object); 109Debug.Assert(tupleCompatibleType.IsTupleType); 131Debug.Assert(TupleElementTypesWithAnnotations.Length == newElementTypes.Length); 132Debug.Assert(newElementTypes.All(t => t.HasType)); 168Debug.Assert(IsTupleType); 169Debug.Assert(newElementNames.IsDefault || this.TupleElementTypesWithAnnotations.Length == newElementNames.Length); 175Debug.Assert(IsTupleType); 236Debug.Assert(chainedTupleTypeOpt is null == elementTypes.Length < ValueTupleRestPosition); 293Debug.Assert(allMissing || destinationNames.Length == sourceLength); 520Debug.Assert(relativeMember >= WellKnownMember.System_ValueTuple_T1__Item1 && relativeMember <= WellKnownMember.System_ValueTuple_TRest__ctor); 521Debug.Assert(type.IsDefinition); 578Debug.Assert(IsTupleType); 579Debug.Assert(currentMembers.All(m => !(m is TupleVirtualElementFieldSymbol))); 658Debug.Assert(fieldSymbol.Name == defaultName, "top level underlying field must match default name"); 730Debug.Assert((object)oldUnderlying.OriginalDefinition == currentValueTuple.OriginalDefinition); 818Debug.Assert(relativeMember >= WellKnownMember.System_ValueTuple_T1__Item1 && relativeMember <= WellKnownMember.System_ValueTuple_TRest__ctor); 844Debug.Assert(fields.All(f => f is object)); 872Debug.Assert(names1.Length == names2.Length); 929Debug.Assert(underlyingType.IsTupleType); 930Debug.Assert(underlyingType.TupleElementNames.IsDefault); 976Debug.Assert(tuple.Equals(TupleUnderlyingType, TypeCompareKind.IgnoreTupleNames)); 1008Debug.Assert(tuple.Equals(TupleUnderlyingType, TypeCompareKind.IgnoreTupleNames)); 1040Debug.Assert(candidate.IsDefaultTupleElement); 1045Debug.Assert(builder.All(f => f is object)); 1089Debug.Assert((object)underlyingAssociatedField.ContainingSymbol == TupleUnderlyingType); 1090Debug.Assert(TupleUnderlyingType.GetMembers(underlyingAssociatedField.Name).IndexOf(underlyingAssociatedField) < 0);
Symbols\TypedConstantExtensions.cs (11)
32Debug.Assert(constant.Value is object); 42Debug.Assert(constant.ValueInternal is object); 44Debug.Assert(result != null); 51Debug.Assert(constant.Kind == TypedConstantKind.Enum); 55Debug.Assert(constant.ValueInternal is object); 71Debug.Assert(constant.Kind == TypedConstantKind.Enum); 142Debug.Assert(constant.ValueInternal is object); 144Debug.Assert(result is object); 150Debug.Assert(constant.Kind == TypedConstantKind.Enum); 220Debug.Assert(constant.ValueInternal is object); 222Debug.Assert(result is object);
Symbols\TypeMap.cs (9)
45Debug.Assert(allowAlpha || from.All(static tp => tp.IsDefinition)); 89Debug.Assert(s_emptyDictionary.IsEmpty()); 97Debug.Assert(s_emptyTypeMap.Mapping.IsEmpty()); 141Debug.Assert(TypeSymbol.Equals(oldOwner.ConstructedFrom, oldOwner, TypeCompareKind.ConsiderEverything2)); 147Debug.Assert(oldOwner.ConstructedFrom == oldOwner); 153Debug.Assert(oldOwner.ConstructedFrom == oldOwner); 154Debug.Assert(stopAt == null || stopAt.ConstructedFrom == stopAt); 186Debug.Assert( 198Debug.Assert(from.Length == to.Length);
Symbols\TypeParameterBounds.cs (4)
29Debug.Assert(!constraintTypes.IsDefault); 30Debug.Assert(!interfaces.IsDefault); 31Debug.Assert((object)effectiveBaseClass != null); 32Debug.Assert((object)deducedBaseType != null);
Symbols\TypeParameterSymbol.cs (6)
404Debug.Assert(constraint.TypeKind != TypeKind.TypeParameter); 451Debug.Assert(!constraintTypes.IsDefaultOrEmpty); 570Debug.Assert(fromNonTypeConstraints == null); 571Debug.Assert(fromTypes != true); 699Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 710Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\TypeParameterSymbolExtensions.cs (2)
13Debug.Assert((object)typeParameter1 != null); 14Debug.Assert((object)typeParameter2 != null);
Symbols\TypeSymbol.cs (26)
104Debug.Assert(info != s_noInterfaces || info.IsDefaultValue(), "default value was modified"); 255Debug.Assert((object)type != null); 256Debug.Assert(!type.IsTypeParameter()); 389Debug.Assert(InterfaceInfo.EmptyInterfacesAndTheirBaseInterfaces.IsEmpty); 726Debug.Assert((object)interfaceMember != null); 727Debug.Assert(!this.IsInterfaceType()); 762Debug.Assert(ignoreImplementationInInterfacesIfResultIsNotReady || !implementationInInterfacesMightChangeResult); 763Debug.Assert(!implementationInInterfacesMightChangeResult || result.Symbol is null); 809Debug.Assert(!implementingType.IsInterfaceType()); 810Debug.Assert(interfaceMember.Kind == SymbolKind.Method || interfaceMember.Kind == SymbolKind.Property || interfaceMember.Kind == SymbolKind.Event); 811Debug.Assert(interfaceMember.IsImplementableInterfaceMember()); 814Debug.Assert((object)interfaceType != null && interfaceType.IsInterface); 943Debug.Assert(!canBeImplementedImplicitlyInCSharp9 || (object)implementingBaseOpt == null); 1062Debug.Assert(!implementingType.IsInterfaceType()); 1079Debug.Assert((object)defaultImpl == null); 1080Debug.Assert((object)conflict2 != null); 1086Debug.Assert(((object)conflict2 == null)); 1304Debug.Assert(implementations.Count == 1); 1385Debug.Assert(interfaceType.IsInterface); 1551Debug.Assert(!implementingType.IsInterfaceType()); 1552Debug.Assert(interfaceMethod.IsAccessor()); 2001Debug.Assert(false); 2105Debug.Assert((object)implementingType != null); 2119Debug.Assert(interfaceMethod.Arity == implicitImpl.Arity); 2318Debug.Assert(interfaceMember.Kind != SymbolKind.Method || (object)interfaceMember == ((MethodSymbol)interfaceMember).ConstructedFrom); 2552Debug.Assert(HasInlineArrayAttribute(out var length) && length > 0);
Symbols\TypeSymbolExtensions.cs (1)
626Debug.Assert(type is FunctionPointerTypeSymbol || type.IsDelegateType());
Symbols\TypeUnification.cs (7)
27Debug.Assert(candidateSubtype.IsDefinition); 28Debug.Assert(closedType.IsClosed); 31Debug.Assert(TypeSymbol.Equals(candidateBaseType.OriginalDefinition, closedType.OriginalDefinition, TypeCompareKind.CLRSignatureCompareOptions)); 54Debug.Assert(substituted1.Type.Equals(substituted2.Type, TypeCompareKind.CLRSignatureCompareOptions)); 55Debug.Assert(substituted1.CustomModifiers.SequenceEqual(substituted2.CustomModifiers)); 126Debug.Assert(t1.Type.IsTypeParameter() || !t2.Type.IsTypeParameter()); 173Debug.Assert(!nt1.Equals(nt2, TypeCompareKind.CLRSignatureCompareOptions));
Symbols\TypeWithAnnotations.cs (24)
55Debug.Assert(defaultType?.IsNullableType() != true || defaultAnnotation == NullableAnnotation.Annotated); 56Debug.Assert(extensions != null); 92Debug.Assert(nullableAnnotation != NullableAnnotation.Ignored || typeSymbol.IsTypeParameter()); 196Debug.Assert(CustomModifiers.IsEmpty); 246Debug.Assert((object)type != null); 442Debug.Assert(NullableAnnotation != NullableAnnotation.Ignored); 450Debug.Assert(newTypeWithModifiers.NullableAnnotation.IsOblivious() || (typeSymbol.IsNullableType() && newTypeWithModifiers.NullableAnnotation.IsAnnotated())); 451Debug.Assert(newTypeWithModifiers.CustomModifiers.IsEmpty); 452Debug.Assert(NullableAnnotation != NullableAnnotation.Ignored); 484Debug.Assert(newTypeWithModifiers.Type is not IndexedTypeParameterSymbol || newTypeWithModifiers.NullableAnnotation == NullableAnnotation.Ignored); 496Debug.Assert(NullableAnnotation == NullableAnnotation.NotAnnotated); 512Debug.Assert((object)newTypeWithModifiers.DefaultType == newTypeWithModifiers.Type); 518Debug.Assert(newTypeWithModifiers.NullableAnnotation is NullableAnnotation.NotAnnotated); 528Debug.Assert(NullableAnnotation.IsOblivious()); 529Debug.Assert(newTypeWithModifiers.NullableAnnotation.IsOblivious()); 888Debug.Assert(!customModifiers.IsDefault); 964Debug.Assert(!customModifiers.IsDefault); 980Debug.Assert(defaultAnnotation == NullableAnnotation.Ignored); 986Debug.Assert(_resolved != Unresolved); 1050Debug.Assert(!asValueType); 1067Debug.Assert(!underlying.NullableAnnotation.IsAnnotated()); 1068Debug.Assert(underlying.TypeKind == TypeKind.TypeParameter); 1069Debug.Assert(underlying.CustomModifiers.IsEmpty); 1103Debug.Assert(resolvedType.IsNullableType() && CustomModifiers.IsEmpty);
Symbols\TypeWithState.cs (4)
33Debug.Assert(type?.IsNullableTypeOrTypeParameter() != true); 43Debug.Assert((object)type != null); 71Debug.Assert(state == NullableFlowState.NotNull || type?.CanContainNull() != false); 72Debug.Assert(state != NullableFlowState.MaybeDefault || type is null || type.IsTypeParameterDisallowingAnnotationInCSharp8());
Symbols\UnboundGenericType.cs (1)
89Debug.Assert(Arity == 0);
Symbols\UpdatedContainingSymbolLocal.cs (2)
27Debug.Assert(updatedContainingSymbol.DeclaringCompilation is not null); 28Debug.Assert(!assertContaining || updatedContainingSymbol.Equals(underlyingLocal.ContainingSymbol, TypeCompareKind.AllNullableIgnoreOptions));
Symbols\VarianceSafety.cs (6)
31Debug.Assert((object)interfaceType != null && interfaceType.IsInterface); 93Debug.Assert(container.IsInterfaceType()); 94Debug.Assert(container.TypeParameters.Any(static tp => tp.Variance != VarianceKind.None)); 105Debug.Assert(!container.IsDelegateType()); 301Debug.Assert(requireOutputSafety || requireInputSafety); 369Debug.Assert(requireOutputSafety || requireInputSafety);
Symbols\Wrapped\WrappedFieldSymbol.cs (1)
32Debug.Assert((object)underlyingField != null);
Symbols\Wrapped\WrappedNamedTypeSymbol.cs (1)
35Debug.Assert((object)underlyingType != null);
Symbols\Wrapped\WrappedParameterSymbol.cs (1)
28Debug.Assert((object)underlyingParameter != null);
Symbols\Wrapped\WrappedPropertySymbol.cs (1)
32Debug.Assert((object)underlyingProperty != null);
Symbols\Wrapped\WrappedTypeParameterSymbol.cs (1)
33Debug.Assert((object)underlyingTypeParameter != null);
Syntax\AttributeSyntax.cs (1)
25Debug.Assert(!String.IsNullOrEmpty(namedArgName));
Syntax\CSharpLineDirectiveMap.cs (8)
30Debug.Assert(ShouldAddDirective(directiveNode)); 188Debug.Assert(Entries[0].State == PositionState.Unmapped); 196Debug.Assert(entry.State != PositionState.Unknown && 237Debug.Assert(this.Entries[0].State == PositionState.Unmapped); 238Debug.Assert(this.Entries[0].MappedLine == this.Entries[0].UnmappedLine); 239Debug.Assert(this.Entries[0].MappedLine == 0); 240Debug.Assert(this.Entries[0].MappedPathOpt == null); 249Debug.Assert(entry.State != PositionState.Unknown &&
Syntax\CSharpPragmaWarningStateMap.cs (1)
152Debug.Assert(entries[i].CompareTo(entries[i + 1]) < 0);
Syntax\CSharpSyntaxNode.cs (4)
51Debug.Assert(result != null); 95Debug.Assert(tree != null); 102Debug.Assert(existingTree == tree, "how could this node belong to a different tree?"); 388Debug.Assert(trivia.HasStructure);
Syntax\CSharpSyntaxRewriter.cs (2)
72Debug.Assert(leadingTrivia == null || !leadingTrivia.IsList || leadingTrivia.SlotCount > 0); 73Debug.Assert(trailingTrivia == null || !trailingTrivia.IsList || trailingTrivia.SlotCount > 0);
Syntax\CSharpSyntaxTree.cs (8)
134Debug.Assert(HasCompilationUnitRoot); 144Debug.Assert(HasCompilationUnitRoot); 165Debug.Assert(!_lazyDirectives.IsNull); 293Debug.Assert(currentPos < pos); 381Debug.Assert(root != null); 396Debug.Assert(root != null); 517Debug.Assert(compilationUnit._syntaxTree == null); 677Debug.Assert(map.Entries.Length >= 1);
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (1)
31Debug.Assert(options != null);
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (3)
43Debug.Assert(root != null); 44Debug.Assert(options != null); 45Debug.Assert(textOpt == null || textOpt.Encoding == encodingOpt && textOpt.ChecksumAlgorithm == checksumAlgorithm);
Syntax\InternalSyntax\CSharpSyntaxNode.cs (1)
84System.Diagnostics.Debug.Assert(index < 11); // Max. slots 11 (TypeDeclarationSyntax)
Syntax\InternalSyntax\CSharpSyntaxRewriter.cs (1)
57Debug.Assert(visited != null && visited.Kind != SyntaxKind.None, "Cannot remove node using Syntax.InternalSyntax.SyntaxRewriter.");
Syntax\InternalSyntax\SyntaxFactory.cs (4)
136Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 137Debug.Assert(kind != SyntaxKind.IdentifierToken); 138Debug.Assert(kind != SyntaxKind.CharacterLiteralToken); 139Debug.Assert(kind != SyntaxKind.NumericLiteralToken);
Syntax\InternalSyntax\SyntaxFirstTokenReplacer.cs (2)
34Debug.Assert(replacer._foundOldToken); 47Debug.Assert(token == _oldToken);
Syntax\InternalSyntax\SyntaxLastTokenReplacer.cs (2)
33Debug.Assert(replacer._found); 52Debug.Assert(token == _oldToken);
Syntax\InternalSyntax\SyntaxToken.cs (2)
364System.Diagnostics.Debug.Assert(this.GetType() == typeof(SyntaxToken)); 370System.Diagnostics.Debug.Assert(this.GetType() == typeof(SyntaxToken));
Syntax\InternalSyntax\SyntaxTrivia.cs (1)
50Debug.Assert(this.FullWidth == this.Text.Length);
Syntax\LambdaUtilities.cs (7)
55Debug.Assert(lambdaBody.Parent is object); 63Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 66Debug.Assert(IsLambda(lambda)); 75Debug.Assert(oldBody.Parent is object); 107Debug.Assert(oldJoin.LeftExpression == oldBody || oldJoin.RightExpression == oldBody); 113Debug.Assert(oldGroup.GroupExpression == oldBody || oldGroup.ByExpression == oldBody); 230Debug.Assert(selectOrGroupClause.Parent!.Parent is object);
Syntax\LookupPosition.cs (17)
128Debug.Assert(methodDecl != null); 142Debug.Assert(accessorDecl != null); 151Debug.Assert(delegateDecl != null); 158Debug.Assert(typeDecl != null); 165Debug.Assert(namespaceDecl != null); 172Debug.Assert(namespaceDecl != null); 179Debug.Assert(constructorDecl != null); 200Debug.Assert(methodDecl != null); 201Debug.Assert(IsInMethodDeclaration(position, methodDecl)); 231Debug.Assert(localFunction != null); 264Debug.Assert(statement != null); 284Debug.Assert(section != null); 294Debug.Assert(catchClause != null); 305Debug.Assert(filterClause != null); 312Debug.Assert(statement != null); 374Debug.Assert(statement != null); 475Debug.Assert(lambdaExpressionOrQueryNode.IsAnonymousFunction() || lambdaExpressionOrQueryNode.IsQuery());
Syntax\NamespaceDeclarationSyntaxReference.cs (1)
40Debug.Assert(node is CompilationUnitSyntax || node is BaseNamespaceDeclarationSyntax);
Syntax\NullableContextStateMap.cs (6)
55Debug.Assert(contexts[i - 1].Position < contexts[i].Position); 79Debug.Assert(index >= -1); 80Debug.Assert(index < _contexts.Length); 84Debug.Assert(_contexts[index].Position <= position); 85Debug.Assert(index == _contexts.Length - 1 || position < _contexts[index + 1].Position); 108Debug.Assert(context.Position <= span.Start);
Syntax\StructuredTriviaSyntax.cs (1)
19System.Diagnostics.Debug.Assert(parent == null || position >= 0);
Syntax\SyntaxEquivalence.cs (3)
36Debug.Assert(!topLevel || ignoreChildNode == null); 69Debug.Assert(before.RawKind == after.RawKind); 147Debug.Assert(after.IsToken);
Syntax\SyntaxExtensions.cs (7)
133Debug.Assert(attributeSyntax.Parent is object); 142Debug.Assert(parent.Name.Prefix is null); 148Debug.Assert(parent.Name.Prefix is null); 198Debug.Assert(typeNode != null); 235Debug.Assert(node != null); 353Debug.Assert(expr.Kind() == SyntaxKind.TupleExpression || expr.Kind() == SyntaxKind.DeclarationExpression || expr.Kind() == SyntaxKind.IdentifierName); 443Debug.Assert(paramType is object);
Syntax\SyntaxFactory.cs (6)
1652Debug.Assert(leadingTrivia.Count == 1); 1655Debug.Assert(structure.Content.Count == 2); 1657Debug.Assert(elementSyntax.Attributes.Count == 1); 1940Debug.Assert(red._syntaxTree is null); 2295Debug.Assert(currentNode.Kind() == SyntaxKind.MemberBindingExpression || 2303Debug.Assert(currentNode != null, "binding should be enclosed in a conditional access");
Syntax\SyntaxFacts.cs (1)
583Debug.Assert(node.Green == current || current is not Syntax.InternalSyntax.MemberDeclarationSyntax and not Syntax.InternalSyntax.TypeDeclarationSyntax);
Syntax\SyntaxKindFacts.cs (6)
22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1247Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i));
Syntax\SyntaxNodeExtensions.cs (5)
20Debug.Assert(syntax != null); 34Debug.Assert(syntax != null); 149Debug.Assert(node != null); 266Debug.Assert( 371Debug.Assert(invocation.Expression is not QualifiedNameSyntax);
Syntax\SyntaxNodeRemover.cs (2)
326Debug.Assert(node.Parent is object); 366Debug.Assert(node.Parent is object);
Syntax\SyntaxNormalizer.cs (3)
334Debug.Assert(openBraceToken.IsKind(SyntaxKind.OpenBraceToken)); 351Debug.Assert(closeBraceToken.IsKind(SyntaxKind.CloseBraceToken)); 464Debug.Assert(((PropertyDeclarationSyntax)currentToken.Parent).SemicolonToken == currentToken);
Syntax\SyntaxTreeDiagnosticEnumerator.cs (1)
37Debug.Assert(root.ContainsDiagnostics, "Caller should have checked that the root has diagnostics");
Utilities\FirstAmongEqualsSet.cs (1)
76Debug.Assert(_hashSet.Count == 0);
Utilities\InterceptableLocation.cs (5)
66Debug.Assert(checksum.Length == ContentHashLength); 67Debug.Assert(path is not null); 68Debug.Assert(position >= 0); 69Debug.Assert(lineNumberOneIndexed > 0); 70Debug.Assert(characterNumberOneIndexed > 0);
Utilities\TypeSymbolExtensions.cs (1)
213Debug.Assert(visited == null || !visited.Contains(type.OriginalDefinition));
Utilities\TypeUnionValueSet.cs (12)
66Debug.Assert(!typesInUnion.IsEmpty); 67Debug.Assert(!typesInUnion.Any(t => t.CaseType.IsNullableType())); 68Debug.Assert(!typesInUnion.Any(t => t.CaseType is NamedTypeSymbol { IsClosed: true } closedType && closedType.TryGetClosedSubtypes(out var subtypes) && subtypes is not [])); 93Debug.Assert(!typesInUnion.IsEmpty); 94Debug.Assert(!typesInUnion.Any(t => t.CaseType.IsNullableType())); 163Debug.Assert(result.HasValue); 308Debug.Assert(originalClosedBase is NamedTypeSymbol { IsClosed: true }); 379Debug.Assert(_typesInUnion.SequenceEqual(other._typesInUnion)); 406Debug.Assert(_typesInUnion.SequenceEqual(other._typesInUnion)); 541Debug.Assert(left is not (IsTrueNode or IsFalseNode)); 542Debug.Assert(right is not (IsTrueNode or IsFalseNode)); 567Debug.Assert(negated is not (IsTrueNode or IsFalseNode));
Utilities\ValueSetFactory.BoolValueSetFactory.cs (1)
60Debug.Assert(relation == BinaryOperatorKind.Equal);
Utilities\ValueSetFactory.ByteTC.cs (2)
45Debug.Assert(value != byte.MaxValue); 51Debug.Assert(value != byte.MinValue);
Utilities\ValueSetFactory.CharTC.cs (3)
45Debug.Assert(value != char.MaxValue); 54Debug.Assert(result != null); 60Debug.Assert(value != char.MinValue);
Utilities\ValueSetFactory.ClosedClassTypeUnionValueSetFactory.cs (2)
21Debug.Assert(closedClassOrTypeParameter is NamedTypeSymbol { IsClosed: true } or TypeParameterSymbol { EffectiveBaseClassNoUseSiteDiagnostics.IsClosed: true }); 38Debug.Assert(!subtypes.IsDefaultOrEmpty);
Utilities\ValueSetFactory.DecimalTC.cs (8)
41Debug.Assert(value != decimal.MaxValue); 45Debug.Assert(scale == DecimalRep.FromValue(value).Normalize().scale); // assert that the input is normalized 53Debug.Assert(!(scale < 28 && low == transitionLow && mid == transitionMid && high == transitionHigh)); 59Debug.Assert(high > 0); // otherwise value == 0m 77Debug.Assert(scale > 0); // otherwise value == decimal.MaxValue 83Debug.Assert(new DecimalRep(low: low, mid: mid, high: high, isNegative: isNegative, scale: scale).Value <= value); 84Debug.Assert(result > value); 185Debug.Assert(scale <= maxScale);
Utilities\ValueSetFactory.DoubleTC.cs (2)
33Debug.Assert(!double.IsNaN(value)); 34Debug.Assert(value != double.PositiveInfinity);
Utilities\ValueSetFactory.EnumeratedValueSet.cs (3)
122Debug.Assert(object.ReferenceEquals(this._tc, other._tc)); 145Debug.Assert(object.ReferenceEquals(this._tc, other._tc)); 168Debug.Assert(object.ReferenceEquals(this._tc, other._tc));
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (2)
43Debug.Assert(relation == BinaryOperatorKind.Equal); 51Debug.Assert(result.IsEmpty);
Utilities\ValueSetFactory.FloatingValueSet.cs (4)
61Debug.Assert(sample is { }); 65Debug.Assert(_hasNaN); 103Debug.Assert(object.ReferenceEquals(this._tc, other._tc)); 118Debug.Assert(object.ReferenceEquals(this._tc, other._tc));
Utilities\ValueSetFactory.IntTC.cs (2)
55Debug.Assert(value != int.MaxValue); 61Debug.Assert(value != MinValue);
Utilities\ValueSetFactory.LongTC.cs (2)
45Debug.Assert(value != long.MaxValue); 51Debug.Assert(value != long.MinValue);
Utilities\ValueSetFactory.NumericValueSet.cs (10)
33Debug.Assert(tc.Related(LessThanOrEqual, first, last)); 39Debug.Assert(intervals.Length == 0 || tc.Related(GreaterThanOrEqual, intervals[0].first, tc.MinValue)); 42Debug.Assert(tc.Related(LessThanOrEqual, intervals[i].first, intervals[i].last)); 46Debug.Assert(tc.Related(LessThan, tc.Next(intervals[i - 1].last), intervals[i].first)); 165Debug.Assert(this._tc.GetType() == other._tc.GetType()); 211Debug.Assert(tc.Related(LessThanOrEqual, first, last)); 212Debug.Assert(tc.Related(GreaterThanOrEqual, first, tc.MinValue)); 213Debug.Assert(tc.Related(LessThanOrEqual, last, tc.MaxValue)); 214Debug.Assert(builder.Count == 0 || tc.Related(LessThanOrEqual, builder.Last().first, first)); 242Debug.Assert(this._tc.GetType() == other._tc.GetType());
Utilities\ValueSetFactory.SByteTC.cs (2)
44Debug.Assert(value != sbyte.MaxValue); 50Debug.Assert(value != sbyte.MinValue);
Utilities\ValueSetFactory.ShortTC.cs (2)
45Debug.Assert(value != short.MaxValue); 51Debug.Assert(value != short.MinValue);
Utilities\ValueSetFactory.SingleTC.cs (2)
33Debug.Assert(!float.IsNaN(value)); 34Debug.Assert(value != float.PositiveInfinity);
Utilities\ValueSetFactory.StringTC.cs (4)
20Debug.Assert(result != null); 26Debug.Assert(count > 0); 27Debug.Assert(scope >= count); 40Debug.Assert(next == count);
Utilities\ValueSetFactory.UIntTC.cs (2)
45Debug.Assert(value != uint.MaxValue); 57Debug.Assert(value != uint.MinValue);
Utilities\ValueSetFactory.ULongTC.cs (2)
45Debug.Assert(value != ulong.MaxValue); 51Debug.Assert(value != ulong.MinValue);
Utilities\ValueSetFactory.UnionTypeTypeUnionValueSetFactory.cs (1)
20Debug.Assert(unionType is NamedTypeSymbol { IsUnionType: true });
Utilities\ValueSetFactory.UShortTC.cs (2)
45Debug.Assert(value != ushort.MaxValue); 57Debug.Assert(value != ushort.MinValue);
Microsoft.CodeAnalysis.CSharp.Analyzers (1)
MetaAnalyzers\Fixers\CSharpPreferIsKindFix.cs (1)
61Debug.Fail("Unreachable.");
Microsoft.CodeAnalysis.CSharp.CodeStyle (80)
src\984dec8966cb7923\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
135Debug.Assert(labels.Count >= 1);
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
273Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement));
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs (1)
61Debug.Assert(IsBinaryLike(binaryLike));
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs (1)
33Debug.Assert(IsBinaryLike(binaryPattern));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (2)
92Debug.Assert(recursivePattern.Designation is not null, "If we got to this point variable designation cannot be null"); 96Debug.Assert(listPattern.Designation is not null, "If we got to this point variable designation cannot be null");
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
189Debug.Assert(initializer.Parent is EqualsValueClauseSyntax);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (2)
70Debug.Assert(IsIntIndexingMethod(method)); 93Debug.Assert(method.MethodKind == MethodKind.Ordinary);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (1)
132Debug.Assert(IsTwoArgumentSliceLikeMethod(sliceLikeMethod) || IsOneArgumentSliceLikeMethod(sliceLikeMethod));
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (2)
42Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement)); 43Debug.Assert(enclosingBlock.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
377Debug.Assert(constructorDeclaration.Initializer.Kind() == SyntaxKind.ThisConstructorInitializer);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (17)
59Debug.Assert(!token.ContainsDiagnostics); 235Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 241Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 311Debug.Assert(tokenText[index] == '\\'); 325Debug.Assert(tokenText[index] == '\\'); 360Debug.Assert(tokenText[index] == '\\'); 370Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 383Debug.Assert(tokenText[index] == '\\'); 394Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 403Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 414Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 427Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 448Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 457Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 471Debug.Assert(character == 'x'); 477Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 504Debug.Assert(IsHexDigit(c));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
44Debug.Assert(typeSymbol.GetParameters().IsDefaultOrEmpty, "If GetParameters extension handles record, we can remove the handling here.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
827Debug.Fail("Unhandled pattern type");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (1)
73Debug.Fail($"Unhandled compound assignment kind: {syntaxKind}");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (2)
155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia); 156Debug.Assert(trivia.Width() == trivia.FullWidth());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
48Debug.Assert(trivia.ToString() == trivia.ToFullString()); 138Debug.Assert(trivia.ToString() == trivia.ToFullString()); 323Debug.Assert(trivia.HasStructure);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
74Debug.Assert(this.SecondTokenIsFirstTokenOnLine);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (11)
34Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 42Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 54Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 62Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 74Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 82Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 133Debug.Assert(result.Tab >= 0); 134Debug.Assert(result.LineBreaks >= 0); 158Debug.Assert(Options.UseTabs); 171Debug.Assert((indentation / Options.TabSize) == result.Tab); 172Debug.Assert((indentation % Options.TabSize) == result.Space);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (3)
556Debug.Assert(previousToken != default); 557Debug.Assert(currentToken != default); 558Debug.Assert(previousToken.FullSpan.End == currentToken.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
93Debug.Assert(_options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContents) != _options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContentsWhenBlock));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (1)
365System.Diagnostics.Debug.Assert(false, "Invalid BinaryOperatorSpacingOptions");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
125Debug.Assert(oldNode.Kind() == newNode.Kind());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (3)
865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 875Debug.Fail("Unexpected node type " + node.Kind()); 912Debug.Assert(topLevel || methodLevel);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (5)
820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 1308Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1364Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1393Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1573Debug.Assert(!rewrittenType.IsReferenceType && !IsIntrinsicOrEnum(rewrittenType));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (12)
73Debug.Assert(expression != null); 106Debug.Assert(speculativeSemanticModel != null || 128Debug.Assert(semanticModel.ParentModel != null); 129Debug.Assert(!semanticModel.ParentModel.IsSpeculativeSemanticModel); 181Debug.Assert(nodeToSpeculate is ExpressionSyntax); 212Debug.Assert(originalParams.Count == replacedParams.Count); 277Debug.Assert(originalIdentifierNodes.Any()); 278Debug.Assert(originalIdentifierNodes.Count() == replacedIdentifierNodes.Count()); 297Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 298Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 372Debug.Assert(newExpression.WhenTrue == previousReplacedNode); 378Debug.Assert(newExpression.WhenFalse == previousReplacedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (1)
61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
95Debug.Assert(!typeName.StripRefIfNeeded().IsVar, "'var' special case should have prevented analysis of this variable.");
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (31)
src\50a3a051b0fef0d6\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
242Debug.Assert(IsDiscardDeclaration(variable));
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
99Debug.Assert(nextStatement.Kind() is SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (6)
85Debug.Assert(SyntaxFacts.IsAssignmentExpression(nodeToGenerate)); 86Debug.Assert(_assignmentTarget != null); 144Debug.Assert(whenClauseUnused == null, "We should not have offered to convert multiple cases if any have a when clause"); 149Debug.Assert(whenClauseUnused == null, "We should not have offered to convert multiple cases if any have a when clause"); 207Debug.Assert(statements.Count is 1 or 2); 208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement));
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
82Debug.Assert(leftSymbol.Equals(rightSymbol));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
64Debug.Assert(diagnostics.Length == 1);
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (2)
50Debug.Fail("The diagnostic can only be produced in context of a deconstruction-assignment, deconstruction-foreach or deconstruction-positionalpattern"); 101Debug.Assert(!codeActions.IsDefault);
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
63Debug.Assert(diagnostic.Properties[Constants.Kind] == Constants.SingleIfStatementForm);
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
83Debug.Assert(addAsyncModifier || node is MethodDeclarationSyntax);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (3)
70Debug.Fail("Could not find close brace in fixer"); 77Debug.Fail("Could not find previous close brace in fixer"); 84Debug.Fail("Could not match analyzer pattern");
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
72Debug.Fail("Couldn't find statement in fixer");
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
67Debug.Assert(node.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (2)
86Debug.Fail($"Unexpected node kind for local/parameter declaration or reference: '{node.Kind()}'"); 205Debug.Fail($"Unexpected kind for originalCompoundAssignment: {originalCompoundAssignment.Kind()}");
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (2)
188Debug.Assert(typeSymbol.IsTupleType); 190Debug.Assert(elements.Length == parensDesignation.Variables.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
240Debug.Assert(method.ExplicitInterfaceImplementations.Any() || method.IsOverride);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
132Debug.Assert(oldUsings.Count == newUsings.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
77Debug.Assert(_seenContextNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1235Debug.Assert(propertyDeclaration?.Type != null, "Property type should never be null"); 1782Debug.Assert(expressionOpt != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
205Debug.Assert(block.Statements.Count == 0); 240Debug.Assert(IsExpressionBody(body));
Microsoft.CodeAnalysis.CSharp.Features (144)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (2)
145Debug.Assert(desiredCaretLine.GetFirstNonWhitespacePosition() == null, "the line between the formatted braces is not empty"); 284Debug.Assert(IsValidClosingBraceToken(closeBraceToken));
BraceCompletion\CurlyBraceCompletionService.cs (1)
109Debug.Assert(s_instances[(int)indentStyle]._indentStyle == indentStyle);
ChangeSignature\CSharpChangeSignatureService.cs (1)
525Debug.Assert(false, "Unknown reference location");
ChangeSignature\UnifiedArgumentSyntax.cs (2)
19Debug.Assert(argument.Kind() is SyntaxKind.Argument or SyntaxKind.AttributeArgument); 41Debug.Assert(nameColonSyntax is NameColonSyntax);
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
154Debug.Fail("Unexpected state?");
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.FixAllProvider.cs (1)
35Debug.Assert(fixAllContext.Scope == RefactorAllScope.Solution);
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (3)
356Debug.Assert(annotatedNodesOrTokens.Count == 1, "Only a single variable declarator should have been annotated."); 363Debug.Assert(variableDeclaration.Variables.Count > 1); 364Debug.Assert(variableDeclaration.Variables.Contains(variableDeclarator));
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (5)
243Debug.Assert(!declaredNamespaceParts.IsDefault && !targetNamespaceParts.IsDefault); 249Debug.Assert(IsGlobalNamespace(declaredNamespaceParts)); 320Debug.Assert(!compilationUnit.Members.Any(m => m is BaseNamespaceDeclarationSyntax)); 423Debug.Assert(part.Length > 0); 436Debug.Assert(part.Length > 0);
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
41Debug.Assert(declaration.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (4)
108Debug.Assert(leftTarget == isPatternExpression.Pattern); 109Debug.Assert(leftReceiver == isPatternExpression.Expression); 324Debug.Assert(containingPattern.Kind() is SyntaxKind.VarPattern or SyntaxKind.DeclarationPattern or SyntaxKind.RecursivePattern); 382Debug.Assert(!names.IsDefaultOrEmpty);
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (1)
105Debug.Assert(IsClassOrStructOrInterfaceOrRecord(typeDeclaration));
ConvertBetweenRegularAndVerbatimString\AbstractConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider.cs (1)
164Debug.Assert(!chars.IsDefault);
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (3)
45Debug.Assert(whenClause == null || section.Labels.Length == 1, "We shouldn't have guards when we're combining multiple cases into a single arm"); 50Debug.Assert(label.Guards.Length == 0, "We shouldn't have guards when we're combining multiple cases into a single arm"); 125Debug.Assert(operation.SemanticModel is not null);
ConvertToRawString\ConvertStringToRawStringCodeRefactoringProvider.cs (1)
150Debug.Assert(equivalenceKey != null);
Debugging\BreakpointResolver.cs (1)
48Debug.Assert(text != null);
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (1)
53Debug.Assert(context.CodeBlock.DescendantNodesAndSelf().Contains(root));
EditAndContinue\BreakpointSpans.cs (5)
124Debug.Assert(startFallbackOpt != default || endOpt != default); 486Debug.Assert(typeDeclaration.ParameterList != null); 492Debug.Assert(typeDeclaration.ParameterList != null); 973Debug.Assert(((ArrowExpressionClauseSyntax)parent).Expression == expression); 977Debug.Assert(((SwitchExpressionArmSyntax)parent).Expression == expression);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (37)
113Debug.Assert(((PropertyDeclarationSyntax)current).Initializer != null); 136Debug.Assert(current.Parent.IsKind(SyntaxKind.VariableDeclaration)); 160Debug.Assert(current.Parent.IsKind(SyntaxKind.CompilationUnit)); 221Debug.Assert(!isBody); 229Debug.Assert(position == ((DoStatementSyntax)node).WhileKeyword.SpanStart); 230Debug.Assert(!isBody); 237Debug.Assert(position == ((PropertyDeclarationSyntax)node).Initializer!.SpanStart); 245Debug.Assert(!isBody); 265Debug.Assert(span.End == switchExpression.CloseBraceToken.Span.End); 273Debug.Assert(position == switchExpression.Span.Start); 288Debug.Assert(position == ((SwitchExpressionArmSyntax)node).Expression.SpanStart); 289Debug.Assert(!isBody); 422Debug.Assert(oldBody is ExpressionSyntax or BlockSyntax); 423Debug.Assert(newBody is ExpressionSyntax or BlockSyntax); 585Debug.Assert(statementPart is DefaultStatementPart or (int)BlockPart.OpenBrace or (int)BlockPart.CloseBrace); 605Debug.Assert(statementPart == DefaultStatementPart); 614Debug.Assert(statementPart == DefaultStatementPart); 637Debug.Assert(statementPart == DefaultStatementPart); 657Debug.Assert(statementPart == DefaultStatementPart); 1114Debug.Assert(matchingNewContainingMemberOrType == null); 1289Debug.Assert(oldCopyConstructor != null || newCopyConstructor != null); 1307Debug.Assert(node.Parent.IsKind(SyntaxKind.AccessorList)); 1356Debug.Assert(oldNode.RawKind == newNode.RawKind); 1357Debug.Assert(SupportsMove(oldNode)); 1358Debug.Assert(SupportsMove(newNode)); 1416Debug.Assert(node is null or ParameterSyntax or TypeParameterSyntax or TypeParameterConstraintClauseSyntax); 1423Debug.Assert(otherNode != null); 1570Debug.Assert(oldParameters.Length is 1 or 2); 1571Debug.Assert(newParameters.Length is 1 or 2); 1942Debug.Assert(ordinal >= 0); 1950Debug.Assert(ordinal == 0); 2268Debug.Assert(((CommonForEachStatementSyntax)node).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2526Debug.Assert(IsMember(newSymbol)); 2630Debug.Assert(current.Parent != null); 2646Debug.Assert(edit.Kind != EditKind.Update || edit.OldNode.RawKind == edit.NewNode.RawKind); 2782Debug.Assert(awaitExpression.IsKind(SyntaxKind.AwaitExpression)); 2892Debug.Assert(newActiveStatement.IsKind(SyntaxKind.WhenClause));
EditAndContinue\DeclarationBody\InstanceConstructorDeclarationBody.cs (3)
51Debug.Assert(partnerCtorBody == null || partnerCtorBody.HasExplicitInitializer); 61Debug.Assert(ExplicitBody != null); 64Debug.Assert(partnerCtorBody == null || partnerCtorBody.ExplicitBody != null);
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorDeclarationBody.cs (3)
84Debug.Assert(partnerDeclarationBody is null or PropertyOrIndexerAccessorDeclarationBody { HeaderActiveStatement: not null }); 91Debug.Assert(ExplicitBody != null); 92Debug.Assert(partnerDeclarationBody is null or PropertyOrIndexerAccessorDeclarationBody { ExplicitBody: not null });
EditAndContinue\SyntaxComparer.cs (4)
1520Debug.Assert(GetLabel(oldNode) == GetLabel(newNode) && GetLabel(oldNode) != IgnoredNode); 1556Debug.Assert(newNodeOrToken.IsToken == oldNodeOrToken.IsToken); 1565Debug.Assert(!SyntaxFactory.AreEquivalent(leftToken, rightToken) || distance == ExactMatchDist); 1573Debug.Assert(!SyntaxFactory.AreEquivalent(leftNode, rightNode) || distance == ExactMatchDist);
EditAndContinue\SyntaxUtilities.cs (3)
95Debug.Assert(allowLambda); 96Debug.Assert(syntax is ExpressionSyntax or BlockSyntax); 130Debug.Assert(false);
GenerateType\CSharpGenerateTypeService.cs (2)
328Debug.Assert(nameOrMemberAccessExpression.IsParentKind(SyntaxKind.SimpleMemberAccessExpression)); 627Debug.Assert(name is SimpleNameSyntax);
Highlighting\KeywordHighlighters\LoopHighlighter.cs (1)
84Debug.Assert(highlightBreaks || highlightContinues || labelName != null);
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (1)
62Debug.Assert(highlightBreaks || highlightGotos || labelName != null);
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (3)
30Debug.Assert(parameters.Length >= 1); 31Debug.Assert(fieldsOrProperties.Length >= 1); 32Debug.Assert(parameters.Length == fieldsOrProperties.Length);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
312Debug.Assert(matches.Contains(expression)); 378Debug.Assert(matches.Contains(expression));
NavigationBar\CSharpNavigationBarItemService.cs (1)
100Debug.Assert(member is IMethodSymbol { PartialDefinitionPart: null } or IPropertySymbol { PartialDefinitionPart: null } or IEventSymbol { PartialDefinitionPart: null },
Organizing\Organizers\MemberDeclarationsOrganizer.cs (1)
44Debug.Assert(originalList.Count == finalList.Count);
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (2)
105Debug.Assert(type.TypeKind == TypeKind.Delegate); 106Debug.Assert(objectCreationExpression.ArgumentList is not null);
Snippets\AbstractCSharpForLoopSnippetProvider.cs (1)
100Debug.Assert(inlineExpressionType is not null);
SolutionExplorer\CSharpSolutionExplorerSymbolTreeItemProvider.cs (1)
520Debug.Fail("Unhandled type: " + type.GetType().FullName);
src\984dec8966cb7923\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
135Debug.Assert(labels.Count >= 1);
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
273Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement));
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs (1)
61Debug.Assert(IsBinaryLike(binaryLike));
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs (1)
33Debug.Assert(IsBinaryLike(binaryPattern));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (2)
92Debug.Assert(recursivePattern.Designation is not null, "If we got to this point variable designation cannot be null"); 96Debug.Assert(listPattern.Designation is not null, "If we got to this point variable designation cannot be null");
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
189Debug.Assert(initializer.Parent is EqualsValueClauseSyntax);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (2)
70Debug.Assert(IsIntIndexingMethod(method)); 93Debug.Assert(method.MethodKind == MethodKind.Ordinary);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (1)
132Debug.Assert(IsTwoArgumentSliceLikeMethod(sliceLikeMethod) || IsOneArgumentSliceLikeMethod(sliceLikeMethod));
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (2)
42Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement)); 43Debug.Assert(enclosingBlock.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
377Debug.Assert(constructorDeclaration.Initializer.Kind() == SyntaxKind.ThisConstructorInitializer);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
99Debug.Assert(nextStatement.Kind() is SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (6)
85Debug.Assert(SyntaxFacts.IsAssignmentExpression(nodeToGenerate)); 86Debug.Assert(_assignmentTarget != null); 144Debug.Assert(whenClauseUnused == null, "We should not have offered to convert multiple cases if any have a when clause"); 149Debug.Assert(whenClauseUnused == null, "We should not have offered to convert multiple cases if any have a when clause"); 207Debug.Assert(statements.Count is 1 or 2); 208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement));
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
82Debug.Assert(leftSymbol.Equals(rightSymbol));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
64Debug.Assert(diagnostics.Length == 1);
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (2)
50Debug.Fail("The diagnostic can only be produced in context of a deconstruction-assignment, deconstruction-foreach or deconstruction-positionalpattern"); 101Debug.Assert(!codeActions.IsDefault);
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
63Debug.Assert(diagnostic.Properties[Constants.Kind] == Constants.SingleIfStatementForm);
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
83Debug.Assert(addAsyncModifier || node is MethodDeclarationSyntax);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (3)
70Debug.Fail("Could not find close brace in fixer"); 77Debug.Fail("Could not find previous close brace in fixer"); 84Debug.Fail("Could not match analyzer pattern");
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
72Debug.Fail("Couldn't find statement in fixer");
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
67Debug.Assert(node.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (2)
86Debug.Fail($"Unexpected node kind for local/parameter declaration or reference: '{node.Kind()}'"); 205Debug.Fail($"Unexpected kind for originalCompoundAssignment: {originalCompoundAssignment.Kind()}");
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (2)
188Debug.Assert(typeSymbol.IsTupleType); 190Debug.Assert(elements.Length == parensDesignation.Variables.Count);
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
107Debug.Assert(ctor.MethodKind == MethodKind.Constructor && typeDeclaration.ParameterList is object);
src\roslyn\src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (7)
55Debug.Assert(lambdaBody.Parent is object); 63Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 66Debug.Assert(IsLambda(lambda)); 75Debug.Assert(oldBody.Parent is object); 107Debug.Assert(oldJoin.LeftExpression == oldBody || oldJoin.RightExpression == oldBody); 113Debug.Assert(oldGroup.GroupExpression == oldBody || oldGroup.ByExpression == oldBody); 230Debug.Assert(selectOrGroupClause.Parent!.Parent is object);
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
194Debug.Assert(equivalenceKey != null);
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
40Debug.Assert(diagnostics.Length == 1);
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (10)
Microsoft.CodeQuality.Analyzers\Maintainability\CSharpUseCrossPlatformIntrinsicsFixer.cs (4)
36Debug.Fail($"Found unexpected node kind: {currentNode.RawKind}"); 44Debug.Fail($"Found unexpected number of arguments for binary operator replacement: {arguments.Count}"); 60Debug.Fail($"Found unexpected node kind: {currentNode.RawKind}"); 68Debug.Fail($"Found unexpected number of arguments for unary operator replacement: {arguments.Count}");
Microsoft.NetCore.Analyzers\Performance\CSharpPreferHashDataOverComputeHash.Fixer.cs (1)
111Debug.Fail("there is only 3 type of ComputeHash");
Microsoft.NetCore.Analyzers\Performance\CSharpRecommendCaseInsensitiveStringComparisonFixer.cs (1)
108Debug.Assert(mainInvocationInstance != null);
Microsoft.NetCore.Analyzers\Performance\CSharpUseSearchValues.Fixer.cs (2)
79Debug.Assert(invocation.Instance is not null); 96Debug.Assert(namedType.Name.Contains("Span", StringComparison.Ordinal), namedType.Name);
Microsoft.NetCore.Analyzers\Runtime\CSharpSpecifyCultureForToLowerAndToUpper.cs (1)
18Debug.Assert(node.IsKind(SyntaxKind.InvocationExpression));
Microsoft.NetCore.Analyzers\Runtime\CSharpUseOrdinalStringComparison.cs (1)
18Debug.Assert(invocationNode.IsKind(SyntaxKind.InvocationExpression));
Microsoft.CodeAnalysis.CSharp.Workspaces (101)
Classification\Worker.cs (1)
69Debug.Assert(nodeOrToken.IsNode || nodeOrToken.IsToken);
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
636Debug.Assert(IsExtensionMethod(methodDeclaration));
Recommendations\CSharpRecommendationServiceRunner.cs (1)
892Debug.Assert(!excludeInstance || !excludeStatic);
Simplification\CSharpSimplificationService.cs (1)
205Debug.Assert(tuple.IsKind(SyntaxKind.TupleExpression));
Simplification\CSharpSimplificationService.Expander.cs (4)
591Debug.Assert(name.StartsWith(originalSimpleName.Identifier.ValueText, StringComparison.Ordinal)); 894Debug.Assert(!replaceNode || rewrittenNode.Kind() == SyntaxKind.IdentifierName); 966Debug.Assert(rewrittenNode is SimpleNameSyntax); 1009Debug.Assert(false, "This method is used only replacing the '<' and '>' to '{' and '}' respectively");
Simplification\Reducers\CSharpExtensionMethodReducer.cs (1)
96Debug.Assert(false, "The expression kind is not MemberAccessExpression or IdentifierName or GenericName to be converted to Member Access Expression for Ext Method Reduction");
src\50a3a051b0fef0d6\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
242Debug.Assert(IsDiscardDeclaration(variable));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (17)
59Debug.Assert(!token.ContainsDiagnostics); 235Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 241Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 311Debug.Assert(tokenText[index] == '\\'); 325Debug.Assert(tokenText[index] == '\\'); 360Debug.Assert(tokenText[index] == '\\'); 370Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 383Debug.Assert(tokenText[index] == '\\'); 394Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 403Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 414Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 427Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 448Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 457Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 471Debug.Assert(character == 'x'); 477Debug.Fail("This should not be reachable as long as the compiler added no diagnostics."); 504Debug.Assert(IsHexDigit(c));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
44Debug.Assert(typeSymbol.GetParameters().IsDefaultOrEmpty, "If GetParameters extension handles record, we can remove the handling here.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
827Debug.Fail("Unhandled pattern type");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (1)
73Debug.Fail($"Unhandled compound assignment kind: {syntaxKind}");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (2)
155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia); 156Debug.Assert(trivia.Width() == trivia.FullWidth());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
48Debug.Assert(trivia.ToString() == trivia.ToFullString()); 138Debug.Assert(trivia.ToString() == trivia.ToFullString()); 323Debug.Assert(trivia.HasStructure);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
74Debug.Assert(this.SecondTokenIsFirstTokenOnLine);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (11)
34Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 42Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 54Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 62Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 74Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 82Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 133Debug.Assert(result.Tab >= 0); 134Debug.Assert(result.LineBreaks >= 0); 158Debug.Assert(Options.UseTabs); 171Debug.Assert((indentation / Options.TabSize) == result.Tab); 172Debug.Assert((indentation % Options.TabSize) == result.Space);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (3)
556Debug.Assert(previousToken != default); 557Debug.Assert(currentToken != default); 558Debug.Assert(previousToken.FullSpan.End == currentToken.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
93Debug.Assert(_options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContents) != _options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContentsWhenBlock));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (1)
365System.Diagnostics.Debug.Assert(false, "Invalid BinaryOperatorSpacingOptions");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
125Debug.Assert(oldNode.Kind() == newNode.Kind());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (3)
865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 875Debug.Fail("Unexpected node type " + node.Kind()); 912Debug.Assert(topLevel || methodLevel);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (5)
820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 1308Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1364Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1393Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1573Debug.Assert(!rewrittenType.IsReferenceType && !IsIntrinsicOrEnum(rewrittenType));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (12)
73Debug.Assert(expression != null); 106Debug.Assert(speculativeSemanticModel != null || 128Debug.Assert(semanticModel.ParentModel != null); 129Debug.Assert(!semanticModel.ParentModel.IsSpeculativeSemanticModel); 181Debug.Assert(nodeToSpeculate is ExpressionSyntax); 212Debug.Assert(originalParams.Count == replacedParams.Count); 277Debug.Assert(originalIdentifierNodes.Any()); 278Debug.Assert(originalIdentifierNodes.Count() == replacedIdentifierNodes.Count()); 297Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 298Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 372Debug.Assert(newExpression.WhenTrue == previousReplacedNode); 378Debug.Assert(newExpression.WhenFalse == previousReplacedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (1)
61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
95Debug.Assert(!typeName.StripRefIfNeeded().IsVar, "'var' special case should have prevented analysis of this variable.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
240Debug.Assert(method.ExplicitInterfaceImplementations.Any() || method.IsOverride);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
132Debug.Assert(oldUsings.Count == newUsings.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
77Debug.Assert(_seenContextNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1235Debug.Assert(propertyDeclaration?.Type != null, "Property type should never be null"); 1782Debug.Assert(expressionOpt != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
205Debug.Assert(block.Statements.Count == 0); 240Debug.Assert(IsExpressionBody(body));
SyncedSource\FileBasedPrograms\FileLevelDirectiveHelpers.cs (7)
105Debug.Assert(previousWhiteSpaceSpan.IsEmpty); 134Debug.Assert(!(parts.Length > 2)); 355Debug.Assert(secondPart.Length == 0, 749Debug.Assert(ItemType is null); 926Debug.Assert(NamedDirectiveComparer.Instance.Equals(existingDirective, directive)); 927Debug.Assert(existingDirective is CSharpDirective.Sdk or CSharpDirective.Property or CSharpDirective.Package); 928Debug.Assert(directive is CSharpDirective.Sdk or CSharpDirective.Property or CSharpDirective.Package);
SyncedSource\FileBasedPrograms\VirtualProjectBuilder.cs (9)
70Debug.Assert(ExternalHelpers.IsPathFullyQualified(entryPointFileFullPath)); 396Debug.Assert(compileItem.Length == 1); 531Debug.Assert(refDirective.ResolvedPath is not null); 593Debug.Assert(userSecretsId == null || !isVirtualProject); 622Debug.Assert(!string.IsNullOrWhiteSpace(artifactsPath)); 623Debug.Assert(entryPointFilePath is not null); 919Debug.Assert(processedDirectives + directives.OfType<CSharpDirective.Shebang>().Count() == directives.Length); 923Debug.Assert(entryPointFilePath is not null); 954Debug.Assert(firstSdkName == defaultSdkName && firstSdkVersion == null);
Microsoft.CodeAnalysis.Extensions.Package (163)
Compilation\CompilationExtensions.cs (1)
342Debug.Assert(type is null);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\roslyn\src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\roslyn\src\Dependencies\Collections\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\roslyn\src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\roslyn\src\Dependencies\Collections\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\roslyn\src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\roslyn\src\Dependencies\Collections\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\roslyn\src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
Symbols\IMethodSymbolExtensions.cs (2)
53Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 58Debug.Assert(!Equals(method.PartialImplementationPart, method));
Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
Symbols\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
26Debug.Fail("Unhandled symbol kind in RequiresUnsafeModifierVisitor: " + node.Kind);
Symbols\ITypeSymbolExtensions.cs (1)
540Debug.Assert(isTypeParameter2);
Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.ExternalAccess.HotReload (2)
Api\HotReloadMSBuildWorkspace.cs (2)
180Debug.Assert(project?.FilePath != null); 183Debug.Assert(oldText.Encoding != null);
Microsoft.CodeAnalysis.Features (558)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (2)
155Debug.Assert(equivalenceKey != null); 164Debug.Assert(banner.Length > 0);
AddImport\AbstractAddImportCodeRefactoringProvider.cs (2)
196Debug.Assert(qualifiedTypeReference is TQualifiedNameSyntax or TMemberAccessExpressionSyntax); 254Debug.Assert(rightSideName != null);
AddImport\AbstractAddImportFeatureService.cs (1)
612Debug.Assert(syntaxFactsService.IsAwaitExpression(awaitExpression));
AddImport\SearchScopes\SearchScope.cs (1)
85Debug.Assert(areSimilar);
AddImport\SymbolResult.cs (1)
43Debug.Assert(DesiredNameDiffersFromSourceName());
BraceCompletion\AbstractBraceCompletionService.cs (1)
58Debug.Assert(context.HasCompletionForOpeningBrace(OpeningBrace));
ChangeSignature\AbstractChangeSignatureService.cs (1)
450Debug.Assert(false, "Change Signature: Attempted to modify node twice with different semantic parameters.");
CodeFixes\Configuration\ConfigurationUpdater.cs (7)
85Debug.Assert(configurationKind != ConfigurationKind.OptionValue || !string.IsNullOrEmpty(newOptionValueOpt)); 86Debug.Assert(!string.IsNullOrEmpty(newSeverity)); 87Debug.Assert(diagnosticToConfigure != null ^ categoryToBulkConfigure != null); 88Debug.Assert((categoryToBulkConfigure != null) == (configurationKind == ConfigurationKind.BulkConfigure)); 217Debug.Assert(!codeStyleOptionValues.IsEmpty()); 236Debug.Assert(!string.IsNullOrEmpty(optionName)); 237Debug.Assert(optionValue != null);
CodeFixes\Service\CodeFixService.cs (1)
471Debug.Assert(!isInteractive);
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (3)
116Debug.Assert(!diagnostics.IsDefault); 319Debug.Assert(orderedDocuments.Length > 1); 330Debug.Assert(currentDocument.Id == oldDocument.Id);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (2)
62Debug.Assert(unambiguousFixes.All(d => d.Kind == AddImportFixKind.ProjectSymbol)); 169Debug.Assert(textChanges.Last().Span.IntersectsWith(insertSpan.End));
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (1)
133Debug.Assert(actions.Count != 0, "No code actions found for MoveType Refactoring");
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (2)
116Debug.Assert(document.Name != FileName, $"New document name is same as old document name:{FileName}"); 279Debug.Assert(!removableCandidates.Contains(ancestor));
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (5)
163Debug.Assert(namespaces.Length == originalNamespaceDeclarations.Length); 464Debug.Assert(!PathUtilities.PathsEqual(refLocation.Document.FilePath, document.FilePath)); 558Debug.Assert(newNamespace != null); 596Debug.Assert(containersToAddImports.Length > 0); 751Debug.Assert(document.Id == refLoc.Document.Id);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (2)
53Debug.Assert(state.RelativeDeclaredNamespace != null); 65Debug.Assert(parts.IsEmpty || parts.Any(static s => s.IndexOfAny(Path.GetInvalidPathChars()) < 0));
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.State.cs (1)
202Debug.Assert(relativeTo != null && @namespace != null);
Completion\CommonCompletionProvider.cs (2)
36Debug.Fail("For backwards API compat only, should not be called"); 58Debug.Fail("For backwards API compat only, should not be called");
Completion\CompletionContext.cs (1)
95Debug.Assert(!Provider.IsExpandItemProvider);
Completion\CompletionHelper.cs (1)
273Debug.Assert(isItem1Expanded && match1.Kind == PatternMatchKind.Exact && !isItem2Expanded && match2.Kind > PatternMatchKind.Prefix ||
Completion\CompletionService_GetCompletions.cs (4)
150Debug.Assert(ValidatePossibleTriggerCharacterSet(trigger.Kind, triggeredProviders, document, text, caretPosition, options)); 227Debug.Assert(lspProvider.TriggerCharacters.Contains(character), 266Debug.Assert(!completionContexts.IsDefaultOrEmpty); 275Debug.Assert(item != null);
Completion\CompletionService.cs (2)
75Debug.Fail("For backwards API compat only, should not be called"); 255Debug.Assert(item.Span == change.TextChange.Span || item.IsComplexTextEdit);
Completion\FileSystemCompletionHelper.cs (7)
43Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 44Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 61Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 68Debug.Assert(PathUtilities.IsAbsolute(fullDirectoryPath)); 75Debug.Assert(PathUtilities.IsAbsolute(fullDirectoryPath)); 82Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 216Debug.Assert(PathUtilities.IsAbsolute(fullDirectoryPath));
Completion\Providers\AbstractAwaitCompletionProvider.cs (1)
191Debug.Fail("Expected non-null value for declaration.");
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
242Debug.Assert(targetSelectionSpan.End < destinationSpan.Start);
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
113Debug.Assert(!fieldOrProperty.IsWriteableFieldOrProperty(), "Assertion failed - expected writable field/property check before calling this method.");
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (1)
115Debug.Assert(!attributeItem.TryGetProperty(AttributeFullName, out var _));
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
193Debug.Assert(result == null || PathUtilities.IsAbsolute(result));
Completion\Providers\Scripting\GlobalAssemblyCacheCompletionHelper.cs (1)
25Debug.Assert(itemRules != null);
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (3)
83Debug.Assert(anonymousObject != null); 84Debug.Assert(anonymousType != null); 204Debug.Fail("We should always be able to get an anonymous type for any anonymous creation node.");
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
171Debug.Fail("How did we not get any labels?");
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
53Debug.Assert(root is object); // we didn't remove the root
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
204Debug.Assert(remainingArgCount > 0);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (6)
268Debug.Assert(tupleExprOrTypeNode != null); 269Debug.Assert(tupleType != null); 370Debug.Assert(documentToUpdate.NodesToUpdate.IsDefault || 521Debug.Assert(containingType != null, 651Debug.Fail("We should always be able to get an tuple type for any tuple expression node."); 764Debug.Fail("We should always be able to get an tuple type for any tuple type syntax node.");
Copilot\IProposalAdjusterService.cs (1)
118Debug.Assert(allowableAdjustments is not null);
Debugging\AbstractBreakpointResolver.cs (2)
174Debug.Assert(type != null); 175Debug.Assert(names.Length >= 2);
Debugging\DebugInformationReaderProvider.cs (1)
93Debug.Assert(OperatingSystem.IsWindows());
Diagnostics\DiagnosticsUpdatedArgs.cs (2)
34Debug.Assert(diagnostics.All(d => d.ProjectId == projectId && d.DocumentId == documentId)); 35Debug.Assert(kind != DiagnosticsUpdatedKind.DiagnosticsRemoved || diagnostics.IsEmpty);
Diagnostics\Service\DiagnosticAnalyzerService_CoreAnalyze.cs (2)
36Debug.Assert(getTelemetryInfo || result.TelemetryInfo.IsEmpty); 109Debug.Assert(documentAnalysisScope.Analyzers.ToSet().IsSubsetOf(compilationWithAnalyzers.Analyzers));
Diagnostics\Service\DiagnosticAnalyzerService_GetDiagnosticsForSpan.cs (2)
318Debug.Assert(!incrementalAnalysis || kind == AnalysisKind.Semantic); 319Debug.Assert(!incrementalAnalysis || analyzers.All(analyzer => analyzer.SupportsSpanBasedSemanticDiagnosticAnalysis()));
Diagnostics\Service\DiagnosticAnalyzerService.HostAnalyzerInfo.cs (2)
174Debug.Assert(analyzer != FileContentLoadAnalyzer.Instance && analyzer != GeneratorDiagnosticsPlaceholderAnalyzer.Instance); 183Debug.Assert(analyzer != FileContentLoadAnalyzer.Instance && analyzer != GeneratorDiagnosticsPlaceholderAnalyzer.Instance);
Diagnostics\Service\DiagnosticAnalyzerService.IncrementalMemberEditAnalyzer.cs (4)
63Debug.Assert(!analysisScope.Span.HasValue); 66Debug.Assert(analyzers.All(analyzer => analyzer.SupportsSpanBasedSemanticDiagnosticAnalysis())); 179Debug.Assert(changedMember != null); 180Debug.Assert(analysisScope.Kind == AnalysisKind.Semantic);
Diagnostics\Service\DocumentAnalysisExecutor.cs (3)
159Debug.Assert(diags.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diags, compilation).Count()); 160Debug.Assert(diagnostics.Length == Extensions.ConvertToLocalDiagnostics(diags, textDocument, span).Length); 272Debug.Assert(isCompilerAnalyzer);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (5)
173Debug.Assert(lines.Count >= 1); 327Debug.Assert(!line.IsEmptyOrWhitespace()); 330Debug.Assert(lines.Count >= 1); 337Debug.Assert(line.Start + lineOffset == startPosition); 435Debug.Assert(trimmedPreviousLine.StartsWith(ExteriorTriviaText), "Unexpected: previous line does not begin with doc comment exterior trivia.");
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
253Debug.Assert(solution.WorkspaceKind is WorkspaceKind.Interactive or WorkspaceKind.MiscellaneousFiles);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (77)
670Debug.Assert(newActiveStatements.All(a => a != null)); 960Debug.Assert(!newActiveStatementSpans.IsDefault); 961Debug.Assert(oldActiveStatements.Length == newActiveStatements.Count); 962Debug.Assert(oldActiveStatements.Length == newExceptionRegions.Count); 1126Debug.Assert(!newActiveStatementSpans.IsDefault); 1127Debug.Assert(newActiveStatementSpans.IsEmpty || oldActiveStatements.Length == newActiveStatementSpans.Length); 1128Debug.Assert(oldActiveStatements.IsEmpty || oldActiveStatements.Length == newActiveStatements.Count); 1129Debug.Assert(newActiveStatements.Count == newExceptionRegions.Count); 1130Debug.Assert(oldMemberBody != null || newMemberBody != null); 1172Debug.Assert(oldDeclaration != null); 1178Debug.Assert(IsDeclarationWithSharedBody(oldDeclaration, oldMember)); 1192Debug.Assert(oldMemberBody != null); 1319Debug.Assert(oldMemberBody != null); 1320Debug.Assert(oldDeclaration != null); 1342Debug.Assert(lazyActiveOrMatchedLambdas != null); 1358Debug.Assert(!enclosingBodyMap.Forward.IsEmpty()); 1402Debug.Assert(oldEnclosingLambdaBody != null); 1403Debug.Assert(lazyActiveOrMatchedLambdas != null); 1448Debug.Assert(newSpan != default); 1458Debug.Assert(IsDeclarationWithSharedBody(oldDeclaration, oldMember)); 1569Debug.Assert(oldAncestors.Count == newAncestors.Count); 1760Debug.Assert(node != null); 1878Debug.Assert(hasAncestor && newAncestor != null); 1892Debug.Assert(hasAncestor && newAncestor != null); 2247Debug.Assert(editMap[newNode] is EditKind.Update or EditKind.Insert); 2309Debug.Assert(currentSegment.path != null); 2310Debug.Assert(lastOldStartLine >= 0); 2487Debug.Assert(previousOldEndLine >= 0); 2716Debug.Assert(inBreakState || newActiveStatementSpans.IsEmpty); 2742Debug.Assert(edit.OldNode is null || edit.NewNode is null || IsNamespaceDeclaration(edit.OldNode) == IsNamespaceDeclaration(edit.NewNode)); 2754Debug.Assert(oldSymbol is INamedTypeSymbol); 2755Debug.Assert(newSymbol is INamedTypeSymbol); 2772Debug.Assert(newTypeDeclaration != null); 2971Debug.Assert(oldSymbol is INamedTypeSymbol); 3261Debug.Assert(newDeclaration != null); 3262Debug.Assert(oldProperty.ContainingType.IsRecord); 3263Debug.Assert(newProperty.ContainingType.IsRecord); 3267Debug.Assert(synthesizedProperty.IsSynthesizedAutoProperty()); 3268Debug.Assert(synthesizedProperty.SetMethod != null); 3340Debug.Assert(newSymbol != null); 3564Debug.Assert(IsConstructorWithMemberInitializers(oldSymbol, cancellationToken) == IsConstructorWithMemberInitializers(newSymbol, cancellationToken)); 3565Debug.Assert(IsDeclarationWithInitializer(oldDeclaration) == IsDeclarationWithInitializer(newDeclaration)); 3735Debug.Assert(oldSymbol != null); 3736Debug.Assert(newSymbol != null); 3759Debug.Assert(member is IPropertySymbol or IMethodSymbol); 4272Debug.Assert(oldBody == null || oldDeclaration != null && oldMemberBody != null); 4273Debug.Assert(newBody == null || newDeclaration != null && newMemberBody != null); 4458Debug.Assert(ReturnTypesEquivalent(oldField, newField, exact: false)); 4480Debug.Assert(oldImportData.BestFitMapping == newImportData.BestFitMapping || 4535Debug.Assert(ReturnTypesEquivalent(oldMethod, newMethod, exact: false)); 4559Debug.Assert(ReturnTypesEquivalent(oldType.DelegateInvokeMethod, newType.DelegateInvokeMethod, exact: false)); 4569Debug.Assert(ReturnTypesEquivalent(oldProperty, newProperty, exact: false)); 4583Debug.Assert(ReturnTypesEquivalent(oldEvent, newEvent, exact: false)); 4700Debug.Assert(ParameterTypesEquivalent(oldMember.GetParameters(), newMember.GetParameters(), exact: true)); 5099Debug.Assert(recordType.IsRecord); 5113Debug.Assert(record.IsRecord); 5200Debug.Assert(oldSymbol != null); 5347Debug.Assert(newSymbol != null); 5532Debug.Assert(oldBody != null); 5533Debug.Assert(newBody != null); 5667Debug.Assert(oldCtor == null || MemberOrDelegateSignaturesEquivalent(oldCtor, newCtor, exact: false)); 5674Debug.Assert(newCtor.Parameters.IsEmpty); 5872Debug.Assert(IsNestedFunction(newLambda) == IsNestedFunction(oldLambda)); 6446Debug.Assert(!parameter.IsThis); 6490Debug.Assert(parameterKey.Syntax != null); 6611Debug.Assert(oldCapture.Kind == newCapture.Kind); 6685Debug.Assert(IsNestedFunction(newLambda)); 6686Debug.Assert(IsNestedFunction(oldLambda)); 6746Debug.Assert(local.Kind is not SymbolKind.RangeVariable); 6758Debug.Assert(node != null); 6830Debug.Assert(rootNodes.Count == otherRootNodes.Count); 6846Debug.Assert(otherNode.SyntaxTree == otherRoot.SyntaxTree); 6847Debug.Assert(otherRoot.FullSpan.Contains(otherNode.SpanStart)); 6850Debug.Assert(otherNode.FullSpan.Length > 0); 6859Debug.Assert(otherNode.RawKind == rightNode.RawKind); 6863Debug.Assert(!leftChild.IsToken); 6908Debug.Assert(!self.FullSpan.Contains(position), "Position is valid. How could we not find a child?");
EditAndContinue\ActiveStatement.cs (1)
48Debug.Assert(!IsStale || !IsMethodUpToDate);
EditAndContinue\ActiveStatementsMap.cs (4)
51Debug.Assert(documentPathMap.All(entry => entry.Value.IsSorted(Comparer))); 176Debug.Assert(oldRoot.SyntaxTree == oldSyntaxTree); 233Debug.Assert(builder.IsEmpty); 244Debug.Assert(builder.IsSorted(Comparer<UnmappedActiveStatement>.Create((x, y) => x.UnmappedSpan.Start.CompareTo(y.UnmappedSpan.End))));
EditAndContinue\CommittedSolution.cs (1)
283Debug.Assert(_solution.ContainsProject(documentId.ProjectId));
EditAndContinue\DebuggingSession.cs (5)
167Debug.Assert(!_isDisposed); 280Debug.Assert(!project.IgnoreForEditAndContinue()); 761Debug.Assert(oldProject.SupportsEditAndContinue()); 762Debug.Assert(newProject.SupportsEditAndContinue()); 851Debug.Assert(spans.Count == documentIds.Length);
EditAndContinue\DocumentActiveStatementChanges.cs (1)
28Debug.Assert(oldSpans[i].ExceptionRegions.Spans.Length == newExceptionRegions[i].Length);
EditAndContinue\DocumentAnalysisResults.cs (21)
122Debug.Assert(!rudeEdits.IsDefault); 123Debug.Assert(hasBlockingRudeEdits == (!rudeEdits.IsDefault && rudeEdits.HasBlockingRudeEdits())); 127Debug.Assert(activeStatementsOpt.IsDefault); 128Debug.Assert(semanticEditsOpt.IsDefault); 129Debug.Assert(exceptionRegionsOpt.IsDefault); 130Debug.Assert(lineEditsOpt.IsDefault); 131Debug.Assert(syntaxError != null || hasBlockingRudeEdits || !hasChanges); 132Debug.Assert(requiredCapabilities == EditAndContinueCapabilities.None); 136Debug.Assert(!activeStatementsOpt.IsDefault); 137Debug.Assert(syntaxError == null); 141Debug.Assert(semanticEditsOpt.IsDefault); 142Debug.Assert(exceptionRegionsOpt.IsDefault); 143Debug.Assert(lineEditsOpt.IsDefault); 144Debug.Assert(requiredCapabilities == EditAndContinueCapabilities.None); 148Debug.Assert(!semanticEditsOpt.IsDefault); 149Debug.Assert(!exceptionRegionsOpt.IsDefault); 150Debug.Assert(!lineEditsOpt.IsDefault); 153Debug.Assert(lineEditsOpt.Select(edit => edit.FileName).Distinct().Count() == lineEditsOpt.Length); 156Debug.Assert(lineEditsOpt.All(documentLineEdits => documentLineEdits.LineUpdates.IsSorted(Comparer<SourceLineUpdate>.Create( 159Debug.Assert(exceptionRegionsOpt.Length == activeStatementsOpt.Length); 160Debug.Assert(requiredCapabilities != EditAndContinueCapabilities.None);
EditAndContinue\DocumentSemanticModel.cs (1)
29Debug.Assert(syntaxTree.GetText().Length == 0);
EditAndContinue\EditAndContinueDebugInfoReader.cs (2)
51Debug.Assert(symReader != null); 52Debug.Assert(version >= 1);
EditAndContinue\EditAndContinueDiagnosticDescriptors.cs (1)
51Debug.Assert(!isNoEffect || severity == DiagnosticSeverity.Warning);
EditAndContinue\EditAndContinueDocumentAnalysesCache.cs (3)
163Debug.Assert(newMappedDocumentActiveSpan.UnmappedDocumentId == null || newMappedDocumentActiveSpan.UnmappedDocumentId == newDocument.Id); 177Debug.Assert(oldDocument == null || oldDocument.Project == oldProject); 178Debug.Assert(newDocument == null || newDocument.Project == newProject);
EditAndContinue\EditSession.cs (17)
124Debug.Assert(emitResult.Success); 125Debug.Assert(emitResult.Baseline is not null); 335Debug.Assert(!oldProject.IgnoreForEditAndContinue()); 336Debug.Assert(!newProject.IgnoreForEditAndContinue()); 607Debug.Assert(oldProject.Id == newProject.Id); 829Debug.Assert(oldNames.Comparer == AssemblyIdentityComparer.SimpleNameComparer); 965Debug.Assert(m.MatchingNodes == first.MatchingNodes); 966Debug.Assert(m.RuntimeRudeEdits == first.RuntimeRudeEdits); 1277Debug.Assert(staleDocumentPath != null); 1690Debug.Assert(oldActiveStatements.Length == newExceptionRegions.Length); 1691Debug.Assert(newActiveStatements.Length == newExceptionRegions.Length); 1708Debug.Assert(!oldActiveStatement.IsStale); 1713Debug.Assert(string.Equals(oldSpan.Path, newSpan.Path, StringComparison.Ordinal)); 1716Debug.Assert(oldActiveStatement.IsMethodUpToDate == newActiveStatement.IsMethodUpToDate); 1798Debug.Assert(newSpan.Span.End.Line - newSpan.Span.Start.Line == baseSpan.Span.End.Line - baseSpan.Span.Start.Line); 1799Debug.Assert(region.OldSpan.Span.End.Line - region.OldSpan.Span.Start.Line == baseSpan.Span.End.Line - baseSpan.Span.Start.Line); 1800Debug.Assert(newSpan.Path == region.OldSpan.Path);
EditAndContinue\EditSessionTelemetry.cs (1)
158Debug.Assert(_capabilities == EditAndContinueCapabilities.None || _capabilities == capabilities);
EditAndContinue\EmitSolutionUpdateResults.cs (7)
67Debug.Assert(SyntaxError.DataLocation != null); 68Debug.Assert(SyntaxError.Message != null); 194Debug.Assert(Solution != null); 195Debug.Assert(SyntaxError.Location.SourceTree != null); 221Debug.Assert(!diagnostics.HasDuplicates(d => d.ProjectId)); 222Debug.Assert(diagnostics.Select(re => re.ProjectId).IsSorted()); 225Debug.Assert(diagnostics
EditAndContinue\ProjectChanges.cs (4)
46Debug.Assert(!semanticEdits.IsDefault); 47Debug.Assert(!lineChanges.IsDefault); 48Debug.Assert(!activeStatementChanges.IsDefault); 49Debug.Assert(requiredCapabilities != EditAndContinueCapabilities.None);
EditAndContinue\SemanticEditInfo.cs (5)
29Debug.Assert(runtimeRudeEdits == null || matchingNodes != null); 49Debug.Assert(kind == SemanticEditKind.Delete || deletedSymbolContainer == null); 63Debug.Assert(!symbol.IsPartialDefinition()); 73Debug.Assert(!symbol.IsPartialDefinition()); 86Debug.Assert(!symbol.IsPartialDefinition());
EditAndContinue\TraceLog.cs (3)
63Debug.Assert(document.FilePath != null); 64Debug.Assert(document.Project.FilePath != null); 109Debug.Assert(document.FilePath != null);
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeLanguageDetector.cs (1)
169Debug.Assert(argName != null || argIndex != null);
EmbeddedLanguages\Json\JsonLexer.cs (5)
50Debug.Assert(chars.Length > 0); 62Debug.Assert(Position < Text.Length); 277Debug.Assert(IsAt("//")); 298Debug.Assert(IsAt("/*")); 311Debug.Assert(Position == Text.Length);
EmbeddedLanguages\Json\JsonNodes.cs (18)
21Debug.Assert(sequence != null); 22Debug.Assert(endOfFileToken.Kind == JsonKind.EndOfFile); 68Debug.Assert(textToken.Kind == JsonKind.TextToken); 95Debug.Assert(openBraceToken.Kind == JsonKind.OpenBraceToken); 96Debug.Assert(closeBraceToken.Kind == JsonKind.CloseBraceToken); 132Debug.Assert(openBracketToken.Kind == JsonKind.OpenBracketToken); 133Debug.Assert(sequence != null); 134Debug.Assert(closeBracketToken.Kind == JsonKind.CloseBracketToken); 167Debug.Assert(minusToken.Kind == JsonKind.MinusToken); 214Debug.Assert(commaToken.Kind == JsonKind.CommaToken); 240Debug.Assert(nameToken.Kind is JsonKind.StringToken or JsonKind.TextToken); 241Debug.Assert(colonToken.Kind == JsonKind.ColonToken); 242Debug.Assert(value != null); 280Debug.Assert(newKeyword.Kind == JsonKind.NewKeyword); 281Debug.Assert(nameToken.Kind == JsonKind.TextToken); 282Debug.Assert(openParenToken.Kind == JsonKind.OpenParenToken); 283Debug.Assert(sequence != null); 284Debug.Assert(closeParenToken.Kind == JsonKind.CloseParenToken);
EmbeddedLanguages\Json\JsonParser.cs (4)
123Debug.Assert(_lexer.Position == _lexer.Text.Length); 124Debug.Assert(_currentToken.Kind == JsonKind.EndOfFile); 409Debug.Assert(_currentToken.Kind == JsonKind.ColonToken); 471Debug.Assert(token.VirtualChars.Length > 0);
EmbeddedLanguages\Json\JsonParser.JsonNetSyntaxChecks.cs (2)
80Debug.Assert(chars.Length > 1); 111Debug.Assert(chars.Length > 1 && chars[0] == '0');
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionCodeFixProvider.cs (1)
44Debug.Assert(_info.IsAnyStringLiteral(stringLiteral.RawKind));
EmbeddedLanguages\RegularExpressions\RegexLexer.cs (6)
374Debug.Assert(Text[beforeSlash] == '\\'); 375Debug.Assert(Text[beforeSlash + 1].Value is 'x' or 'u'); 417Debug.Assert(Text[beforeSlash] == '\\'); 418Debug.Assert(IsOctalDigit(Text[start])); 428Debug.Assert(octalVal is >= 0 and <= 7); 444Debug.Assert(Position - start > 0);
EmbeddedLanguages\RegularExpressions\RegexNodes.cs (62)
21Debug.Assert(expression != null); 22Debug.Assert(endOfFileToken.Kind == RegexKind.EndOfFile); 76Debug.Assert(textToken.Kind == RegexKind.TextToken); 104Debug.Assert(openBracketToken.Kind == RegexKind.OpenBracketToken); 105Debug.Assert(components != null); 106Debug.Assert(closeBracketToken.Kind == RegexKind.CloseBracketToken); 147Debug.Assert(caretToken.Kind == RegexKind.CaretToken); 178Debug.Assert(left != null); 179Debug.Assert(minusToken.Kind == RegexKind.MinusToken); 180Debug.Assert(right != null); 216Debug.Assert(minusToken.Kind == RegexKind.MinusToken); 217Debug.Assert(characterClass != null); 269Debug.Assert(dotToken.Kind == RegexKind.DotToken); 308Debug.Assert(expression != null); 309Debug.Assert(asteriskToken.Kind == RegexKind.AsteriskToken); 340Debug.Assert(expression != null); 341Debug.Assert(plusToken.Kind == RegexKind.PlusToken); 372Debug.Assert(expression != null); 373Debug.Assert(questionToken.Kind == RegexKind.QuestionToken); 406Debug.Assert(quantifier != null); 407Debug.Assert(quantifier.Kind != RegexKind.LazyQuantifier); 408Debug.Assert(questionToken.Kind == RegexKind.QuestionToken); 440Debug.Assert(expression != null); 441Debug.Assert(openBraceToken.Kind == RegexKind.OpenBraceToken); 442Debug.Assert(firstNumberToken.Kind == RegexKind.NumberToken); 443Debug.Assert(closeBraceToken.Kind == RegexKind.CloseBraceToken); 489Debug.Assert(commaToken.Kind == RegexKind.CommaToken); 523Debug.Assert(commaToken.Kind == RegexKind.CommaToken); 524Debug.Assert(secondNumberToken.Kind == RegexKind.NumberToken); 558Debug.Assert(anchorToken.Kind is RegexKind.DollarToken or RegexKind.CaretToken); 585Debug.Assert(sequenceList.NodesAndTokens.Length > 0); 587Debug.Assert(sequenceList.NodesAndTokens[i].Kind == RegexKind.BarToken); 611Debug.Assert(openParenToken.Kind == RegexKind.OpenParenToken); 612Debug.Assert(closeParenToken.Kind == RegexKind.CloseParenToken); 629Debug.Assert(expression != null); 658Debug.Assert(questionToken.Kind == RegexKind.QuestionToken); 711Debug.Assert(colonToken.Kind == RegexKind.ColonToken); 712Debug.Assert(expression != null); 748Debug.Assert(colonToken.Kind == RegexKind.ColonToken); 749Debug.Assert(expression != null); 784Debug.Assert(equalsToken.Kind == RegexKind.EqualsToken); 785Debug.Assert(expression != null); 820Debug.Assert(exclamationToken.Kind == RegexKind.ExclamationToken); 821Debug.Assert(expression != null); 853Debug.Assert(lessThanToken.Kind == RegexKind.LessThanToken); 870Debug.Assert(equalsToken.Kind == RegexKind.EqualsToken); 871Debug.Assert(expression != null); 907Debug.Assert(exclamationToken.Kind == RegexKind.ExclamationToken); 908Debug.Assert(expression != null); 944Debug.Assert(greaterThanToken.Kind == RegexKind.GreaterThanToken); 945Debug.Assert(expression != null); 981Debug.Assert(expression != null); 1023Debug.Assert(minusToken.Kind == RegexKind.MinusToken); 1024Debug.Assert(expression != null); 1068Debug.Assert(result != null); 1086Debug.Assert(innerOpenParenToken.Kind == RegexKind.OpenParenToken); 1087Debug.Assert(innerCloseParenToken.Kind == RegexKind.CloseParenToken); 1129Debug.Assert(grouping != null); 1159Debug.Assert(backslashToken.Kind == RegexKind.BackslashToken); 1188Debug.Assert(typeToken.Kind == RegexKind.TextToken); 1417Debug.Assert(openBraceToken.Kind == RegexKind.OpenBraceToken); 1418Debug.Assert(closeBraceToken.Kind == RegexKind.CloseBraceToken);
EmbeddedLanguages\RegularExpressions\RegexParser.CaptureInfoAnalyzer.cs (1)
141Debug.Assert(!grouping.OpenParenToken.IsMissing);
EmbeddedLanguages\RegularExpressions\RegexParser.cs (25)
168Debug.Assert(_lexer.Position == _lexer.Text.Length); 169Debug.Assert(_currentToken.Kind == RegexKind.EndOfFile); 214Debug.Assert(token.TrailingTrivia.IsEmpty); 644Debug.Assert(token.Value == null); 938Debug.Assert(_currentToken.Kind == RegexKind.OpenParenToken); 1244Debug.Assert(openBracketToken.Kind == RegexKind.OpenBracketToken); 1265Debug.Assert(_currentToken.VirtualChars.Length == 1); 1403Debug.Assert(sequence.ChildCount > 0); 1405Debug.Assert(IsEscapedMinus(sequence.ChildAt(i).Node)); 1437Debug.Assert(RegexLexer.IsHexChar(ch)); 1498Debug.Assert(_currentToken.VirtualChars.Length == 1); 1584Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1597Debug.Assert(_currentToken.VirtualChars.Length == 1); 1630Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1643Debug.Assert(_currentToken.VirtualChars.Length == 1); 1668Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1683Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1722Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1744Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1745Debug.Assert(_lexer.Text[_lexer.Position].Value is '<' or '\''); 1827Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1831Debug.Assert(_currentToken.VirtualChars.Length == 1); 1838Debug.Assert(octalDigits.VirtualChars.Length > 0); 1905Debug.Assert(_currentToken.VirtualChars.Length == 1); 1951Debug.Assert(_lexer.Text[_lexer.Position - 1] is var ch && (ch == 'P' || ch == 'p'));
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (1)
426Debug.Assert(virtualChars.Length > 0);
EmbeddedLanguages\StackFrame\StackFrameNodeDefinitions.cs (29)
91Debug.Assert(identifier.Kind is StackFrameKind.IdentifierToken or StackFrameKind.ConstructorToken); 107Debug.Assert(dotToken.Kind == StackFrameKind.DotToken); 108Debug.Assert(left.Kind is not StackFrameKind.Constructor); 180Debug.Assert(graveAccentToken.Kind == StackFrameKind.GraveAccentToken); 181Debug.Assert(numberToken.Kind == StackFrameKind.NumberToken); 223Debug.Assert(lessThanToken.Kind == StackFrameKind.LessThanToken); 224Debug.Assert(greaterThanToken.Kind == StackFrameKind.GreaterThanToken); 225Debug.Assert(!dollarToken.HasValue || dollarToken.Value.Kind == StackFrameKind.DollarToken); 275Debug.Assert(generatedNameSeparator.Kind == StackFrameKind.GeneratedNameSeparatorToken); 276Debug.Assert(identifier.Kind == StackFrameKind.IdentifierToken); 277Debug.Assert(pipeToken.Kind == StackFrameKind.PipeToken); 278Debug.Assert(suffix.Kind == StackFrameKind.GeneratedNameSuffixToken); 316Debug.Assert(generatedNameSeparator.Kind == StackFrameKind.GeneratedNameSeparatorToken); 317Debug.Assert(dotToken.Kind == StackFrameKind.DotToken); 318Debug.Assert(stateMachineIdentifier.Kind == StackFrameKind.IdentifierToken); 365Debug.Assert(!arrayRankSpecifiers.IsDefaultOrEmpty); 392Debug.Assert(!commaTokens.IsDefault); 393Debug.Assert(openBracket.Kind == StackFrameKind.OpenBracketToken); 394Debug.Assert(closeBracket.Kind == StackFrameKind.CloseBracketToken); 395Debug.Assert(commaTokens.All(static t => t.Kind == StackFrameKind.CommaToken)); 446Debug.Assert(openToken.Kind is StackFrameKind.OpenBracketToken or StackFrameKind.LessThanToken); 447Debug.Assert(typeArguments.Length > 0); 448Debug.Assert(openToken.Kind == StackFrameKind.OpenBracketToken ? closeToken.Kind == StackFrameKind.CloseBracketToken : closeToken.Kind == StackFrameKind.GreaterThanToken); 492Debug.Assert(identifier.Kind == StackFrameKind.IdentifierToken); 521Debug.Assert(openToken.Kind == StackFrameKind.OpenParenToken); 522Debug.Assert(closeToken.Kind == StackFrameKind.CloseParenToken); 561Debug.Assert(path.Kind == StackFrameKind.PathToken); 562Debug.Assert(colon.HasValue == line.HasValue); 563Debug.Assert(!line.HasValue || line.Value.Kind == StackFrameKind.NumberToken);
EmbeddedLanguages\StackFrame\StackFrameParser.cs (1)
174Debug.Assert(nameNode is StackFrameQualifiedNameNode or StackFrameSimpleNameNode);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingSolutionCrawlerRegistrationService.cs (2)
224Debug.Assert(set.Add(Default)); 230Debug.Assert(set.Add(kind));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs (1)
105Debug.Assert(existingWorkItem.Language == item.Language);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs (1)
232Debug.Assert(!_cancellationMap.ContainsKey(key));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
254Debug.Assert(!workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.Reanalyze) || workItem.SpecificAnalyzers.Count > 0);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
181Debug.Assert(location.IsInSource); 280Debug.Assert(result);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingWorkItem.cs (1)
66Debug.Assert(documentId == null || documentId.ProjectId == projectId);
ExternalAccess\VSTypeScript\Api\VSTypeScriptCompletionProvider.cs (1)
17Debug.Fail("For backwards API compat only, should not be called");
ExtractInterface\AbstractExtractInterfaceService.cs (1)
419Debug.Assert(false, string.Format(FeaturesResources.Unexpected_interface_member_kind_colon_0, member.Kind.ToString()));
ExtractMethod\AbstractSyntaxTriviaService.cs (1)
30Debug.Assert(Enum.GetNames(typeof(TriviaLocation)).Length == TriviaLocationsCount);
FindUsages\DefinitionItemFactory.cs (2)
216Debug.Assert(originatingProjectId == null || originatingProjectId == info.ProjectId); 307Debug.Assert(location.IsInSource);
FullyQualify\AbstractFullyQualifyService.SymbolResult.cs (2)
48Debug.Assert(Symbol is INamespaceSymbol || !((INamedTypeSymbol)Symbol).IsGenericType); 49Debug.Assert(other.Symbol is INamespaceSymbol || !((INamedTypeSymbol)other.Symbol).IsGenericType);
GenerateType\AbstractGenerateTypeService.Editor.cs (3)
195Debug.Assert(targetProject.Language == LanguageNames.VisualBasic); 203Debug.Assert(_targetLanguageService != null); 542Debug.Assert(includeUsingsOrImports != null);
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
337Debug.Assert(memberSymbol.TypeKind is TypeKind.Class or TypeKind.Struct);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
989Debug.Fail("Should have found {0} in the resource string.");
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (3)
364Debug.Assert(parameters.Length >= 2); 365Debug.Assert(fieldsOrProperties.Length > 0); 366Debug.Assert(parameters.Length == fieldsOrProperties.Length);
InlineMethod\AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs (1)
498Debug.Assert(parameterSymbol is not null);
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (2)
489Debug.Assert(statementRange.FirstStatement == statementRange.LastStatement); 648Debug.Assert(subsequentSingleExitPoint is TStatementSyntax);
InvertIf\AbstractInvertIfCodeRefactoringProvider.StatementRange.cs (5)
25Debug.Assert(firstStatement != null); 26Debug.Assert(lastStatement != null); 27Debug.Assert(firstStatement.Parent != null); 28Debug.Assert(firstStatement.Parent == lastStatement.Parent); 29Debug.Assert(firstStatement.SpanStart <= lastStatement.SpanStart);
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (1)
145Debug.Assert(false, "How?");
MoveToNamespace\AbstractMoveToNamespaceService.cs (2)
203Debug.Assert(compilationUnitMembers.Count == 1); 289Debug.Assert(symbol != null && !string.IsNullOrEmpty(targetNamespace));
MoveToNamespace\MoveToNamespaceCodeAction.cs (1)
62Debug.Assert(moveToNamespaceResult.Succeeded);
NavigateTo\AbstractNavigateToSearchService.CachedDocumentSearch.cs (1)
85Debug.Assert(priorityDocuments.All(d => projects.Contains(d.Project)));
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (1)
323Debug.Assert(Enum.GetUnderlyingType(typeof(DeclaredSymbolInfoKind)) == typeof(byte));
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (1)
163Debug.Assert(priorityDocuments.All(d => projects.Contains(d.Project)));
NavigateTo\NavigateToSearcher.cs (5)
118Debug.Assert(count >= 0); 119Debug.Assert(_remainingProgressItems >= 0); 128Debug.Assert(newValue >= 0); 177Debug.Assert(_remainingProgressItems == 0); 239Debug.Assert(searchRegularDocuments || searchGeneratedDocuments);
PdbSourceDocument\ImplementationAssemblyLookupService.cs (1)
210Debug.Assert(assemblyName is not null);
PdbSourceDocument\SourceLinkMap.cs (1)
201Debug.Assert(mappedUri.Suffix.Length == 0);
QuickInfo\QuickInfoService.cs (1)
39Debug.Fail("For backwards API compat only, should not be called");
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
214Debug.Assert(startInclusive > 0);
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (3)
253Debug.Fail($"Parent node of {nameToken} is null."); 293Debug.Fail($"Parent node of {nameToken} is null."); 440Debug.Assert(method.DeclaringSyntaxReferences.Length == 1);
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (1)
421Debug.Assert(property.DeclaringSyntaxReferences.Length == 1);
Shared\Extensions\DocumentExtensions.cs (1)
37Debug.Assert(document.GetRequiredSyntaxRootSynchronously(CancellationToken.None) == root);
Shared\Utilities\ExtractTypeHelpers.cs (1)
221Debug.Assert(false, string.Format(FeaturesResources.Unexpected_interface_member_kind_colon_0, member.Kind.ToString()));
SignatureHelp\SignatureHelpItems.cs (1)
91Debug.Assert(selectedItem.Value >= 0, "actual item was not part of the final list");
Snippets\AbstractSnippetService.cs (1)
61Debug.Assert(!_identifierToProviderMap.TryGetValue(providerData.Identifier, out var _));
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (2)
73Debug.Assert(ifGenerator.IsIfOrElseIf(upperIfOrElseIf)); 74Debug.Assert(ifGenerator.IsIfOrElseIf(lowerIfOrElseIf));
SplitOrMergeIfStatements\Consecutive\AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (3)
122Debug.Assert(syntaxFacts.IsExecutableStatement(secondIfOrElseIf)); 123Debug.Assert(syntaxFacts.IsExecutableStatement(firstIfOrElseIf)); 124Debug.Assert(ifGenerator.GetElseIfAndElseClauses(firstIfOrElseIf).Length == 0);
SplitOrMergeIfStatements\Consecutive\AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
82Debug.Assert(syntaxFacts.IsExecutableStatement(ifOrElseIf)); 83Debug.Assert(ifGenerator.GetElseIfAndElseClauses(ifOrElseIf).Length == 0);
SplitOrMergeIfStatements\Nested\AbstractMergeNestedIfStatementsCodeRefactoringProvider.cs (3)
75Debug.Assert(syntaxFacts.IsExecutableStatement(innerIfStatement)); 127Debug.Assert(blockFacts.IsStatementContainer(ifOrElseIf)); 204Debug.Assert(blockFacts.GetStatementContainer(outerIfStatement) is object);
src\9547feb31df4cc5d\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (3)
275Debug.Assert(operation.Kind is OperationKind.DelegateCreation or OperationKind.AnonymousFunction); 324Debug.Assert(operation.Kind is OperationKind.LocalReference or OperationKind.ParameterReference); 525Debug.Assert(!SymbolUsageAnalysis.Run(context.GetControlFlowGraph(operationBlock), context.OwningSymbol, context.CancellationToken)
src\roslyn\src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (4)
29Debug.Assert(!isUnnecessary || this is AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer); 43Debug.Assert(!supportedDiagnostics.Any(descriptor => descriptor.CustomTags.Any(t => t == WellKnownDiagnosticTags.Unnecessary)) || this is AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer); 161Debug.Assert(_minimumReportedSeverity != null); 245Debug.Assert(editorConfigSeverity != null);
src\roslyn\src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs (2)
75Debug.Assert(options.Count > 1); 87Debug.Assert(option is { Definition.DefaultValue: ICodeStyleOption2 } == descriptor.CustomTags.Contains(WellKnownDiagnosticTags.CustomSeverityConfigurable));
src\roslyn\src\Analyzers\Core\Analyzers\DiagnosticCustomTags.cs (3)
64Debug.Assert(customTags.Length == tags.Length); 68Debug.Assert(customTags[i] == tags[i]); 74Debug.Assert(isConfigurable || enforceOnBuild == EnforceOnBuild.Never);
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (1)
337Debug.Assert(id.StartsWith("IDE", StringComparison.Ordinal));
src\roslyn\src\Analyzers\Core\Analyzers\IDEDiagnosticIdToOptionMappingHelper.cs (3)
47Debug.Assert(perLanguageValuedOption.IsPerLanguage); 83Debug.Assert(!map.TryGetValue(diagnosticId, out var existingOptions) || options.SetEquals(existingOptions)); 84Debug.Assert(options.All(option => option.Definition.IsEditorConfigOption));
src\roslyn\src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
109Debug.Assert(fieldStateMap.ContainsKey(field.OriginalDefinition)); 219Debug.Assert(IsCandidateField(field)); 293Debug.Assert(isInInstanceConstructor);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
108Debug.Assert(preference.Value == ParenthesesPreference.NeverIfUnnecessary ||
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (5)
69Debug.Fail(ex.Message); 422Debug.Assert(!analyzer.IsCompilerAnalyzer()); 454Debug.Assert(semanticModel.Compilation.Options.ReportSuppressedDiagnostics); 554Debug.Assert(diagnostic.Location.IsInSource); 555Debug.Assert(diagnostic.Location.SourceTree == tree);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
406Debug.Assert(memberReference.Parent is ICompoundAssignmentOperation compoundAssignment && 633Debug.Assert(IsCandidateSymbol(member)); 634Debug.Assert(!member.IsImplicitlyDeclared);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (3)
256Debug.Assert(unusedValueExpressionStatementSeverity.Severity != ReportDiagnostic.Suppress || 317Debug.Assert(TryGetUnusedValuePreference(diagnostic, out _)); 323Debug.Assert(TryGetUnusedValuePreference(diagnostic, out _));
src\roslyn\src\Analyzers\Core\Analyzers\UseCompoundAssignment\UseCompoundAssignmentUtilities.cs (2)
36Debug.Assert(binaryToAssignmentMap.Count == assignmentToTokenMap.Count); 37Debug.Assert(binaryToAssignmentMap.Values.All(assignmentToTokenMap.ContainsKey));
src\roslyn\src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
70Debug.Assert(elementCount >= 2 || statements.Length >= 2);
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
202Debug.Assert(syntaxFacts.IsArgument(argsArgument));
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
97Debug.Assert(false, "All conflict markers should start at the beginning of a line."); 396Debug.Assert(
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
87Debug.Assert(constructor.Parameters.Length == expressions.Length);
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
222Debug.Assert(syntaxFacts.IsInvocationExpression(invocationExpression));
src\roslyn\src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (1)
36Debug.Fail("Declared symbol must never be null here");
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (2)
43Debug.Assert(diagnostics.Select(diagnostic => diagnostic.Properties[MatchFolderAndNamespaceConstants.TargetNamespace]).Distinct().Count() == 1); 62Debug.Assert(newSolution != document.Project.Solution);
src\roslyn\src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
57Debug.Assert(missingCases || missingDefaultCase);
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (2)
70Debug.Fail("We should always be able to find the node from the diagnostic."); 77Debug.Fail("We should always be able to find the method symbol for the diagnostic.");
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedMembers\AbstractRemoveUnusedMembersCodeFixProvider.cs (1)
98Debug.Assert(childDeclarators.All(c => !declarators.Contains(c)));
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (7)
249Debug.Assert(success); 254Debug.Assert(diagnosticId == diagnostic.Id); 255Debug.Assert(AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.TryGetUnusedValuePreference(diagnostic, out var diagnosticPreference) && 257Debug.Assert(removeAssignments == AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.GetIsRemovableAssignmentDiagnostic(diagnostic)); 410Debug.Assert(semanticModel.Language != LanguageNames.VisualBasic); 517Debug.Assert(syntaxFacts.IsLeftSideOfAnyAssignment(node)); 726Debug.Assert(removeAssignments);
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
130Debug.Assert(fieldDocument.Project == propertyDocument.Project); 171Debug.Assert(fieldDocument.Project == propertyDocument.Project);
src\roslyn\src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
285Debug.Assert(syntaxFacts.IsElementAccessExpression(elementAccess));
src\roslyn\src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
48Debug.Fail("Could not get analyzer");
src\roslyn\src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (1)
81Debug.Assert(assemblyScopedNamespaceSymbol.ConstituentNamespaces.Length == 1);
src\roslyn\src\Compilers\Core\AnalyzerDriver\DeclarationInfo.cs (2)
17Debug.Assert(declaredNode != null); 18Debug.Assert(!executableCodeBlocks.IsDefault);
src\roslyn\src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (7)
308Debug.Assert(PeekNextChar() is '(' or '['); 495Debug.Assert(PeekNextChar() == '!'); 542Debug.Assert(bindingContext != null); 657Debug.Assert(PeekNextChar() == '<'); 698Debug.Assert(PeekNextChar() == '['); 884Debug.Assert(type != null); 890Debug.Assert(startIndex >= 0);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (8)
25Debug.Assert(builder.Count == 0); 50Debug.Assert(_recordCount <= byte.MaxValue); 85Debug.Assert(groupSizes.Count <= ushort.MaxValue); 102Debug.Assert(usingCount <= ushort.MaxValue); 152Debug.Assert(info.Flags.Length <= DynamicAttributeSize); 153Debug.Assert(info.LocalName.Length <= IdentifierSize); 172Debug.Assert(infos.Count > 0); 179Debug.Assert((info.SlotIndex == -1) ^ (info.ScopeStart == 0 && info.ScopeEnd == 0));
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (7)
257Debug.Assert(flagsBuilder.Count == 0); 258Debug.Assert(nameBuilder.Length == 0); 398Debug.Assert(!allModuleInfoImportStrings.IsDefault); 422Debug.Assert(!importStrings.IsDefault); 452Debug.Assert(groupBuilder.Count == 0); 493Debug.Assert(!importStrings.IsDefault); 512Debug.Assert(!importStrings.IsDefault);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\StateMachineHoistedLocalScope.cs (2)
26Debug.Assert(startOffset >= 0); 27Debug.Assert(endOffset > startOffset || startOffset == 0 && endOffset == 0);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\TupleElementNamesInfo.cs (1)
22Debug.Assert(!elementNames.IsDefault);
SyncNamespaces\AbstractSyncNamespacesService.cs (1)
38Debug.Assert(projects.All(project => project.Language == projects[0].Language));
ValueTracking\ValueTracker.OperationCollector.cs (1)
113Debug.Assert(operation is
Wrapping\BinaryExpression\AbstractBinaryExpressionWrapper.cs (3)
74Debug.Assert(exprsAndOperators.Length >= 3); 75Debug.Assert(exprsAndOperators.Length % 2 == 1, "Should have odd number of exprs and operators"); 79Debug.Assert(((i % 2) == 0 && item.IsNode) ||
Microsoft.CodeAnalysis.NetAnalyzers (561)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CollectionPropertiesShouldBeReadOnly.cs (1)
144Debug.Assert(SymbolEqualityComparer.Default.Equals(baseType, baseType.OriginalDefinition));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CollectionsShouldImplementGenericInterface.cs (1)
104Debug.Assert(interfacePairs.All(kvp => kvp.Key.TypeKind == TypeKind.Interface && kvp.Value.All(x => x.TypeKind == TypeKind.Interface)));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumShouldNotHaveDuplicatedValues.cs (1)
83Debug.Assert(added);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumsShouldHaveZeroValue.cs (2)
116Debug.Assert(context.Options.MatchesConfiguredVisibility(RuleNoZero, symbol, context.Compilation)); 117Debug.Assert(context.Options.MatchesConfiguredVisibility(RuleRename, symbol, context.Compilation));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumWithFlagsAttribute.cs (2)
103Debug.Assert(missingValues != null); 124Debug.Assert(list != null);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\Helpers\EnumHelpers.cs (1)
64Debug.Assert(enumType.TypeKind == TypeKind.Enum);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldHaveCorrectPrefix.cs (2)
60Debug.Assert(!context.Options.MatchesConfiguredVisibility(TypeParameterRule, context.Symbol, context.Compilation)); 64Debug.Assert(context.Options.MatchesConfiguredVisibility(TypeParameterRule, context.Symbol, context.Compilation));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldHaveCorrectSuffix.cs (4)
141Debug.Assert(!context.Options.MatchesConfiguredVisibility(MultipleSuffixesRule, namedTypeSymbol, context.Compilation)); 142Debug.Assert(!context.Options.MatchesConfiguredVisibility(UserSuffixRule, namedTypeSymbol, context.Compilation)); 146Debug.Assert(context.Options.MatchesConfiguredVisibility(MultipleSuffixesRule, namedTypeSymbol, context.Compilation)); 147Debug.Assert(context.Options.MatchesConfiguredVisibility(UserSuffixRule, namedTypeSymbol, context.Compilation));
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OperatorOverloadsHaveNamedAlternates.cs (1)
97Debug.Assert(methodSymbol.MethodKind is MethodKind.UserDefinedOperator or MethodKind.Conversion);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OperatorsShouldHaveSymmetricalOverloads.Fixer.cs (1)
48Debug.Assert(containingOperator.IsUserDefinedOperator());
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\PropertiesShouldNotBeWriteOnly.cs (2)
71Debug.Assert(context.Options.MatchesConfiguredVisibility(MakeMoreAccessibleRule, property, context.Compilation) == context.Options.MatchesConfiguredVisibility(AddGetterRule, property, context.Compilation)); 72Debug.Assert(descriptor == MakeMoreAccessibleRule || descriptor == AddGetterRule);
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UseEventsWhereAppropriate.cs (1)
52Debug.Assert(!HasEventLikeName(method), "fast check failed but eventual check succeeds?");
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidDeadConditionalCode.cs (3)
69var debugAssertMethods = debugAssert?.GetMembers(nameof(Debug.Assert)).OfType<IMethodSymbol>().ToArray() ?? Array.Empty<IMethodSymbol>(); 199Debug.Assert(operation.Kind is OperationKind.BinaryOperator or 237Debug.Assert(predicateKind != PredicateValueKind.Unknown);
Microsoft.CodeQuality.Analyzers\Maintainability\UseCrossPlatformIntrinsicsFixer.cs (2)
37Debug.Fail($"Found diagnostic without an associated {nameof(RuleKind)} property."); 43Debug.Fail($"Found diagnostic with an unrecognized {nameof(RuleKind)} property: {ruleKindName}.");
Microsoft.NetCore.Analyzers\ImmutableCollections\DoNotCallToImmutableCollectionOnAnImmutableCollectionValue.cs (1)
77Debug.Assert(!string.IsNullOrEmpty(metadataName));
Microsoft.NetCore.Analyzers\InteropServices\DisableRuntimeMarshallingAnalyzer.AutoLayoutTypeCache.cs (1)
38Debug.Assert(type.IsValueType);
Microsoft.NetCore.Analyzers\InteropServices\DisableRuntimeMarshallingAnalyzer.DisabledRuntimeMarshallingAssemblyAnalyzer.cs (1)
119Debug.Assert(_unmanagedFunctionPointerAttribute is not null);
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.cs (5)
394Debug.Assert(operation.Type!.Equals(osPlatformType)); 421Debug.Assert(results.Any(), "Expected at least one analysis result for lambda/local function"); 425Debug.Assert(localResult.ControlFlowGraph.OriginalOperation == containingLambdaOrLocalFunctionOperation); 444Debug.Assert(runtimeIsOSPlatformMethod == null || guardMethods.Contains(runtimeIsOSPlatformMethod)); 2170Debug.Assert(name == ObsoletedOSPlatformAttribute);
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.Value.cs (2)
62Debug.Assert(osPlatformNamesBuilder.Count > 0); 89Debug.Assert(invokedPlatformCheckMethod.Name == "IsOSPlatformVersionAtLeast");
Microsoft.NetCore.Analyzers\Performance\AvoidSingleUseOfLocalJsonSerializerOptions.cs (1)
180Debug.Assert(loop.Body is IBlockOperation);
Microsoft.NetCore.Analyzers\Performance\RecommendCaseInsensitiveStringComparison.Analyzer.cs (1)
275Debug.Assert(!invocation.Arguments.IsEmpty);
Microsoft.NetCore.Analyzers\Performance\RecommendCaseInsensitiveStringComparison.Fixer.cs (3)
101Debug.Assert(caseChangingApproachValue != null, "Unexpected offending methods"); 146Debug.Assert(mainInvocation.Arguments.Length <= 3); 168Debug.Assert(diagnosableMethodName is
Microsoft.NetCore.Analyzers\Performance\UseSearchValues.cs (1)
73Debug.Assert(invocation.Arguments.Length is 1 or 2);
Microsoft.NetCore.Analyzers\Performance\UseSearchValues.Fixer.cs (2)
355Debug.Assert(invocation.TargetMethod.Name == nameof(string.ToCharArray)); 400Debug.Assert(symbol.DeclaringSyntaxReferences.Length == 1);
Microsoft.NetCore.Analyzers\Performance\UseStartsWithInsteadOfIndexOfComparisonWithZero.Fixer.cs (1)
90Debug.Fail("This should never happen.");
Microsoft.NetCore.Analyzers\Runtime\DetectPreviewFeatureAnalyzer.cs (3)
916Debug.Fail($"Should never reach this line. This means the symbol {symbol.Name} was not processed in this analyzer"); 943Debug.Fail($"Should never reach this line. This means the symbol {previewSymbol.Name} was not processed in this analyzer"); 970Debug.Fail($"Should never reach this line. This means the symbol {previewSymbol.Name} was not processed in this analyzer");
Microsoft.NetCore.Analyzers\Runtime\DisposableFieldsShouldBeDisposed.cs (3)
77Debug.Assert(!field.IsStatic); 78Debug.Assert(disposeAnalysisHelper!.IsDisposable(field.Type)); 232Debug.Assert(disposeAnalysisHelper.IsDisposable(field.Type));
Microsoft.NetCore.Analyzers\Runtime\DisposeMethodsShouldCallBaseClassDispose.cs (1)
91Debug.Assert(disposeAnalysisHelper.GetDisposeMethodKind(invocation.TargetMethod) == disposeMethodKind);
Microsoft.NetCore.Analyzers\Runtime\DoNotPassLiteralsAsLocalizedParameters.cs (2)
124Debug.Assert(!stringContentValue.LiteralValues.IsEmpty); 225Debug.Assert(parameterSymbol.ContainingSymbol.Kind == SymbolKind.Method);
Microsoft.NetCore.Analyzers\Runtime\DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.cs (1)
131Debug.Assert(methodSymbol.ReducedFrom == null);
Microsoft.NetCore.Analyzers\Runtime\DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs (1)
127Debug.Fail($"Unexpected method name '{methodName}' for {DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectlyAnalyzer.RuleId} code fix.");
Microsoft.NetCore.Analyzers\Runtime\InstantiateArgumentExceptionsCorrectly.Fixer.cs (1)
104Debug.Assert(argumentCount == 3);
Microsoft.NetCore.Analyzers\Runtime\UseAsyncMethodInAsyncContext.cs (1)
177Debug.Assert(!invocation.Arguments.IsEmpty);
Microsoft.NetCore.Analyzers\Security\DoNotAlwaysSkipTokenValidationInDelegates.cs (1)
122Debug.Fail("Unhandled OperationKind " + delegateCreationOperation.Target.Kind);
Microsoft.NetCore.Analyzers\Security\DoNotCallDangerousMethodsInDeserialization.cs (2)
253Debug.Fail(methodSymbol.Name + " was not found in callGraph"); 281Debug.Assert(dangerousMethods.Count > 0);
Microsoft.NetCore.Analyzers\Security\DoNotDisableHttpClientCRLCheck.cs (1)
232Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\DoNotInstallRootCert.cs (1)
221Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\DoNotUseCreateEncryptorWithNonDefaultIV.cs (1)
197Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\DoNotUseInsecureCryptographicAlgorithms.cs (1)
83Debug.Fail($"Unhandled IOperation {operationAnalysisContext.Operation.Kind}");
Microsoft.NetCore.Analyzers\Security\DoNotUseInsecureDeserializerJavascriptSerializerWithSimpleTypeResolver.cs (3)
142Debug.Fail($"Unhandled PointsToAbstractValueKind {pointsTo.Kind}"); 149Debug.Fail($"Unhandled JavaScriptSerializer constructor {constructorMethod.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat)}"); 256Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\DoNotUseInsecureDeserializerJsonNetWithoutBinder.cs (2)
81Debug.Fail($"Unhandled JsonSerializer constructor {constructorMethod.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat)}"); 236Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\DoNotUseInsecureDeserializerMethodsBase.cs (1)
65Debug.Assert(!cachedDeserializationMethodNames.IsEmpty);
Microsoft.NetCore.Analyzers\Security\DoNotUseInsecureDeserializerWithoutBinderBase.cs (6)
72Debug.Assert(!string.IsNullOrWhiteSpace(this.DeserializerTypeMetadataName)); 73Debug.Assert(!string.IsNullOrWhiteSpace(this.SerializationBinderPropertyMetadataName)); 74Debug.Assert(!cachedDeserializationMethodNames.IsEmpty); 75Debug.Assert(this.BinderDefinitelyNotSetDescriptor != null); 76Debug.Assert(this.BinderMaybeNotSetDescriptor != null); 220Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\DoNotUseInsecureSettingsForJsonNet.cs (2)
80Debug.Fail($"Unhandled JsonSerializerSettings constructor {constructorMethod.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat)}"); 263Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\DoNotUseWeakKDFInsufficientIterationCount.cs (1)
217Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Security\SslProtocolsAnalyzer.cs (1)
146Debug.Fail("Unhandled IOperation " + operationAnalysisContext.Operation.Kind);
Microsoft.NetCore.Analyzers\Security\UseAutoValidateAntiforgeryToken.cs (2)
387Debug.Fail(methodSymbol.Name + " was not found in inverseGraph."); 410Debug.Fail(child.Name + " was not found in results.");
Microsoft.NetCore.Analyzers\Security\UseSecureCookiesASPNetCore.cs (1)
215Debug.Fail($"Unhandled result value {kvp.Value}");
Microsoft.NetCore.Analyzers\Tasks\UseValueTasksCorrectly.cs (1)
474assert.TargetMethod?.Name == nameof(Debug.Assert) &&
Microsoft.NetFramework.Analyzers\TypesShouldNotExtendCertainBaseTypes.cs (1)
76Debug.Assert(s_badBaseTypesToMessage.ContainsKey(baseTypeName));
src\0437c1690f5501bd\CopyAnalysis.CopyAbstractValueDomain.cs (4)
72Debug.Assert(value1.Kind.IsKnown()); 73Debug.Assert(value2.Kind.IsKnown()); 82Debug.Assert(_entitiesDomain.Equals(mergedEntities, value1.AnalysisEntities)); 87Debug.Assert(_entitiesDomain.Equals(mergedEntities, value2.AnalysisEntities));
src\0437c1690f5501bd\CopyAnalysis.CopyDataFlowOperationVisitor.cs (7)
157Debug.Assert(ReferenceEquals(sourceCopyAnalysisData, targetCopyAnalysisData) || fromPredicateKind.HasValue); 181Debug.Assert(existingValue.AnalysisEntities.Contains(analysisEntity)); 319Debug.Assert(operation.Parameter?.RefKind is RefKind.Ref or RefKind.Out); 453Debug.Assert(SymbolEqualityComparer.Default.Equals(throwBranchWithExceptionType.ExceptionType, ExceptionNamedType)); 545Debug.Assert(copyValue.AnalysisEntities.Contains(key)); 546Debug.Assert(predicate == null || copyValue.AnalysisEntities.All(predicate)); 628Debug.Assert(!inference.AlwaysSucceed || !inference.AlwaysFail);
src\11b41c7305441175\PropertySetAbstractValue.cs (1)
153Debug.Assert(index >= 0);
src\11b41c7305441175\PropertySetAbstractValue.ValuePool.cs (1)
32Debug.Assert(values[i] == i, $"{nameof(PropertySetAbstractValueKind)} isn't a contiguous enum starting at 0");
src\11b41c7305441175\PropertySetAnalysis.PropertySetDataFlowOperationVisitor.cs (12)
57Debug.Assert(analysisContext.PointsToAnalysisResult != null); 75Debug.Assert(this.TrackedTypeSymbols.Any()); 170Debug.Assert(this.DataFlowAnalysisContext.ValueContentAnalysisResult != null); 184Debug.Fail("Unhandled ConstructorMapper"); 268Debug.Fail($"Unhandled PointsToAbstractValue: Kind = {pointsToAbstractValue.Kind}, NullState = {pointsToAbstractValue.NullState}"); 297Debug.Assert(this.DataFlowAnalysisContext.ValueContentAnalysisResult != null); 303Debug.Fail("Unhandled PropertyMapper"); 378Debug.Fail("Expected to have tracked assignment operations for a given location"); 405Debug.Fail("Expected to have tracked assignment operations with locations"); 428Debug.Fail("Expected to have tracked assignment operations with unknown PointsTo"); 437Debug.Fail($"Unhandled PointsToAbstractValue: Kind = {pointsToAbstractValue.Kind}, NullState = {pointsToAbstractValue.NullState}"); 719Debug.Fail("Can LValues FlowCaptureReferences have more than one operation?");
src\11b41c7305441175\PropertySetAnalysisContext.cs (2)
114Debug.Assert(pointsToAnalysisResult != null); 115Debug.Assert(copyAnalysisResult == null);
src\40daf5e1cab76dff\TaintedDataAbstractValue.cs (3)
76Debug.Assert(value1.Kind == TaintedDataAbstractValueKind.Tainted); 77Debug.Assert(value2.Kind == TaintedDataAbstractValueKind.Tainted); 94Debug.Assert(value.Kind == TaintedDataAbstractValueKind.Tainted);
src\40daf5e1cab76dff\TaintedDataAnalysis.TaintedDataOperationVisitor.cs (5)
140Debug.Fail("Can we have a tainted data parameter with no syntax references?"); 326Debug.Fail("Are the tainted data sources misconfigured?"); 365Debug.Fail("Are the tainted data sources misconfigured?"); 404Debug.Fail("Are the tainted data sanitizers misconfigured?"); 464Debug.Assert(!this.TryGetInterproceduralAnalysisResult(invocationOperation, out _));
src\40daf5e1cab76dff\TaintedDataAnalysisContext.cs (2)
57Debug.Assert(pointsToAnalysisResult != null); 80Debug.Assert(pointsToAnalysisResult != null);
src\440320f3f10733a8\ValueContentAbstractValue.cs (4)
203Debug.Assert(value1 == ValueContainsNonLiteralState.No); 204Debug.Assert(value2 == ValueContainsNonLiteralState.No); 240Debug.Assert(IsLiteralState); 241Debug.Assert(value2.IsLiteralState);
src\440320f3f10733a8\ValueContentAnalysis.CoreAnalysisDataDomain.cs (2)
51Debug.Assert(Compare(forwardEdgeAnalysisData, resultMap) <= 0); 52Debug.Assert(Compare(backEdgeAnalysisData, resultMap) <= 0);
src\440320f3f10733a8\ValueContentAnalysis.cs (1)
63Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, wellKnownTypeProvider.Compilation));
src\440320f3f10733a8\ValueContentAnalysis.ValueContentAnalysisDomain.cs (1)
34Debug.Assert(forwardEdgeAnalysisData.IsReachableBlockData == backEdgeAnalysisData.IsReachableBlockData);
src\440320f3f10733a8\ValueContentAnalysisContext.cs (1)
81Debug.Assert(valueContentAnalysisResult == null);
src\47c588c5b8785708\ParameterValidationAnalysis.cs (1)
40Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, compilation));
src\47c588c5b8785708\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (7)
32Debug.Assert(analysisContext.OwningSymbol.Kind == SymbolKind.Method); 33Debug.Assert(analysisContext.PointsToAnalysisResult != null); 174Debug.Assert(_hazardousParameterUsageBuilder != null); 191Debug.Assert(IsNotOrMaybeValidatedLocation(location)); 288Debug.Assert(!targetMethod.IsLambdaOrLocalFunctionOrDelegate()); 317Debug.Assert(!targetMethod.IsVirtual && !targetMethod.IsOverride); 356Debug.Assert(targetMethod.MethodKind is MethodKind.LambdaMethod or MethodKind.LocalFunction);
src\47c588c5b8785708\ParameterValidationAnalysisContext.cs (3)
75Debug.Assert(pointsToAnalysisResult != null); 76Debug.Assert(copyAnalysisResult == null); 77Debug.Assert(valueContentAnalysisResult == null);
src\8ce1f4f68b646e6d\GlobalFlowStateAnalysis.GlobalFlowStateAnalysisValueSetDomain.cs (5)
77Debug.Assert(value1.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 78Debug.Assert(value2.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 143Debug.Assert(value1.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 144Debug.Assert(value2.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 227Debug.Assert(value1.Height == value2.Height);
src\8ce1f4f68b646e6d\GlobalFlowStateAnalysisValueSet.cs (13)
31Debug.Assert((!analysisValues.IsEmpty || !parents.IsEmpty) == (kind == GlobalFlowStateAnalysisValueSetKind.Known)); 32Debug.Assert(analysisValues.All(value => value != default)); 33Debug.Assert(parents.All(parent => parent != null)); 34Debug.Assert(height >= 0); 35Debug.Assert(height == 0 || kind == GlobalFlowStateAnalysisValueSetKind.Known); 36Debug.Assert(height == 0 == parents.IsEmpty); 49Debug.Assert(!analysisValues.IsEmpty || !parents.IsEmpty); 63Debug.Assert(Kind == GlobalFlowStateAnalysisValueSetKind.Known); 87Debug.Assert(Kind != GlobalFlowStateAnalysisValueSetKind.Unknown); 105Debug.Assert(Kind == GlobalFlowStateAnalysisValueSetKind.Known); 133Debug.Assert(AnalysisValues.Count > 1); 134Debug.Assert(parentsBuilder.Count > 1); 143Debug.Assert(parents.Count > 0);
src\8ce1f4f68b646e6d\GlobalFlowStateDataFlowOperationVisitor.cs (1)
85Debug.Assert(input.ContainsKey(GlobalEntity));
src\8ce1f4f68b646e6d\GlobalFlowStateValueSetFlowOperationVisitor.cs (2)
44Debug.Assert(HasPredicatedGlobalState || !negate); 62Debug.Assert(HasPredicatedGlobalState || value.Parents.IsEmpty);
src\9382845807600969\AbstractDataFlowAnalysisContext.cs (5)
45Debug.Assert(owningSymbol.Kind is SymbolKind.Method or 49Debug.Assert(Equals(owningSymbol.OriginalDefinition, owningSymbol)); 50Debug.Assert(pointsToAnalysisResult == null || 52Debug.Assert(copyAnalysisResult == null || 54Debug.Assert(valueContentAnalysisResult == null ||
src\9382845807600969\AbstractLocationDataFlowOperationVisitor.cs (5)
24Debug.Assert(analysisContext.PointsToAnalysisResult != null); 42Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData != null); 68Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 98Debug.Assert(Equals(analysisEntity.Symbol, parameter)); 108Debug.Assert(SymbolEqualityComparer.Default.Equals(analysisEntity.Symbol, parameter));
src\9382845807600969\AnalysisEntityBasedPredicateAnalysisData.cs (5)
43Debug.Assert(data1.IsReachableBlockData == data2.IsReachableBlockData); 74Debug.Assert(baseCompareResult < 0, "Non-monotonic Merge function"); 79Debug.Assert(coreAnalysisDataCompareResult <= 0, "Non-monotonic Merge function"); 94Debug.Assert(!CoreAnalysisData.IsDisposed); 95AssertValidPredicatedAnalysisData(map => Debug.Assert(!map.IsDisposed));
src\9382845807600969\AnalysisEntityDataFlowOperationVisitor.cs (21)
33Debug.Assert(!analysisContext.PredicateAnalysis || SupportsPredicateAnalysis); 65Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 81Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 102Debug.Assert(locals.Any() || flowCaptures.Any()); 118Debug.Fail("TryCreateForSymbolDeclaration failed"); 156Debug.Assert(analysisEntity.Symbol is IParameterSymbol parameter && parameter.IsParams); 257Debug.Assert(success || assignedValueEntity == null); 279Debug.Assert(addressSharedCopyValue.AnalysisEntities.Contains(targetAnalysisEntity)); 293Debug.Assert(SymbolEqualityComparer.Default.Equals(analysisEntity.Symbol, parameter)); 306Debug.Assert(Equals(analysisEntity.Symbol, parameter)); 327Debug.Assert(HasPointsToAnalysisResult); 328Debug.Assert(analysisEntity.Type.HasValueCopySemantics()); 336Debug.Assert(HasPointsToAnalysisResult); 361Debug.Assert(HasPointsToAnalysisResult); 362Debug.Assert(targetAnalysisEntity.Type.HasValueCopySemantics()); 410Debug.Assert(analysisEntity.Type.HasValueCopySemantics()); 570Debug.Assert(ShouldProcessPointsToValue(pointsToValue)); 687Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData != null); 741Debug.Assert(throwBranchWithExceptionType.ExceptionType.Equals(ExceptionNamedType)); 768Debug.Assert(tupleOperation.Elements.Length == tupleElementEntities.Length); 775Debug.Assert(tupleElementEntity.Symbol is IFieldSymbol field);
src\9382845807600969\AnalysisEntityMapAbstractDomain.cs (16)
98Debug.Assert(!map2.ContainsKey(key1)); 99Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 163Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 164Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 184Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 185Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 193Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 205Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 212Debug.Assert(!map1.ContainsKey(newKey)); 213Debug.Assert(!map2.ContainsKey(newKey)); 225Debug.Assert(Compare(map1, resultMap) <= 0); 226Debug.Assert(Compare(map2, resultMap) <= 0); 246Debug.Assert(values.Count > 0); 258Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 259Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 266Debug.Assert(isNewKey == (!map1.ContainsKey(key) && !map2.ContainsKey(key)));
src\9382845807600969\PerEntityPredicatedAnalysisData.cs (1)
21Debug.Assert(truePredicatedData != null || falsePredicatedData != null);
src\9382845807600969\PredicateAnalysisEntityDataFlowOperationVisitor.cs (2)
29Debug.Assert(PredicateAnalysis); 32Debug.Assert(!isReachable || predicatedData.IsReachableBlockData);
src\afc74d572e54ec72\DisposeAnalysis.DisposeAbstractValueDomain.cs (3)
82Debug.Assert(!mergedDisposingOperations.IsEmpty); 88Debug.Assert(!value1.DisposingOrEscapingOperations.IsEmpty || !value2.DisposingOrEscapingOperations.IsEmpty); 155Debug.Fail($"Unhandled dispose value kind merge: {value1.Kind} and {value2.Kind}");
src\afc74d572e54ec72\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (8)
33Debug.Assert(IDisposableNamedType != null); 34Debug.Assert(CollectionNamedTypes.All(ct => ct.TypeKind == TypeKind.Interface)); 35Debug.Assert(analysisContext.DisposeOwnershipTransferLikelyTypes != null); 36Debug.Assert(analysisContext.PointsToAnalysisResult != null); 178Debug.Assert(!escapedLocations.IsEmpty); 179Debug.Assert(parameter.RefKind != RefKind.None); 187Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 424Debug.Assert(disposedState == DisposeAbstractValue.NotDisposed);
src\ffd9070534249528\PointsToAnalysis.CorePointsToAnalysisDataDomain.cs (2)
120Debug.Assert(Compare(forwardEdgeAnalysisData.CoreAnalysisData, resultMap) <= 0); 121Debug.Assert(Compare(backEdgeAnalysisData.CoreAnalysisData, resultMap) <= 0);
src\ffd9070534249528\PointsToAnalysis.PointsToAbstractValueDomain.cs (5)
126Debug.Assert(value2.Kind == PointsToAbstractValueKind.KnownLValueCaptures); 132Debug.Assert(value1.Kind == PointsToAbstractValueKind.KnownLocations); 133Debug.Assert(value2.Kind == PointsToAbstractValueKind.KnownLocations); 140Debug.Assert(Compare(value1, result) <= 0); 141Debug.Assert(Compare(value2, result) <= 0);
src\ffd9070534249528\PointsToAnalysis.PointsToAnalysisDomain.cs (1)
38Debug.Assert(forwardEdgeAnalysisData.IsReachableBlockData == backEdgeAnalysisData.IsReachableBlockData);
src\ffd9070534249528\PointsToAnalysis.PointsToDataFlowOperationVisitor.cs (16)
88Debug.Assert(!ShouldBeTracked(analysisEntity)); 89Debug.Assert(!CurrentAnalysisData.TryGetValue(analysisEntity, out var existingValue) || existingValue == PointsToAbstractValue.NoLocation); 174Debug.Assert(ShouldBeTracked(analysisEntity) || !HasAbstractValue(analysisEntity)); 180Debug.Assert(value == _defaultPointsToValueGenerator.GetOrCreateDefaultValue(analysisEntity)); 181Debug.Assert(!CurrentAnalysisData.TryGetValue(analysisEntity, out var currentValue) || 251Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData == null); 279Debug.Assert(operation.Type == null || !operation.Type.IsNonNullableValueType() || defaultValue == PointsToAbstractValue.NoLocation); 286Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 448Debug.Assert(!targetAnalysisData.HasAbstractValue(key)); 449Debug.Assert(!sourceAnalysisData.HasAbstractValue(key)); 511Debug.Assert(IsValidValueForPredicateAnalysis(nullState) || nullState == NullAbstractValue.Invalid); 560Debug.Assert(IsValidValueForPredicateAnalysis(value)); 788Debug.Assert(value.NullState == NullAbstractValue.NotNull || DataFlowAnalysisContext.InterproceduralAnalysisData != null); 890Debug.Assert(operation.Initializer == null || initializerValue == pointsToAbstractValue); 1190Debug.Assert(!inference.AlwaysSucceed || !inference.AlwaysFail); 1211Debug.Assert(!inference.IsUnboxing);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CachingBase`1.cs (1)
36Debug.Assert(size > 0);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
61Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 62Debug.Assert(!child.Children.IsEmpty); 63Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
36Debug.Assert( 44Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Debug.cs (4)
11/// <inheritdoc cref="Debug.Assert(bool)"/> 13public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b); 15/// <inheritdoc cref="Debug.Assert(bool, string)"/> 18=> Debug.Assert(b, message);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\DiagnosticDescriptorHelper.cs (2)
27Debug.Assert(!isDataflowRule || ruleLevel == RuleLevel.Disabled || ruleLevel == RuleLevel.CandidateForRemoval); 30Debug.Assert(isEnabledByDefaultInAggressiveMode || ruleLevel == RuleLevel.Disabled || ruleLevel == RuleLevel.CandidateForRemoval);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
664Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 676Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\IOperationExtensions.cs (10)
324Debug.Assert(isInsideAnonymousObjectInitializer == 459Debug.Assert(success); 460Debug.Assert(cfg != null); 491Debug.Assert(operation.Kind is OperationKind.None or OperationKind.Attribute, $"Unexpected root operation kind: {operation.Kind}"); 503Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 855Debug.Assert(parameterIndex >= 0); 856Debug.Assert(parameterIndex < arguments.Length); 896Debug.Assert(parameterOrderedArguments[argument.Parameter.Ordinal] == null); 991Debug.Fail("Unhandled declaration pattern context"); 1012Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
553Debug.Assert(symbol.IsOverride);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
47Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
41Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
64Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 142Debug.Assert(parts.SymbolName[^1] == WildcardChar); 143Debug.Assert(parts.SymbolName.Length >= 2);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\PooledObjects\ArrayBuilder.cs (2)
334Debug.Assert(builder.Count == 0); 480Debug.Assert(limit <= Count);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\PooledObjects\ObjectPool.cs (3)
116Debug.Assert(size >= 1); 272Debug.Assert(_firstItem != obj, "freeing twice?"); 283Debug.Assert(value != obj, "freeing twice?");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
70Debug.Assert(instance.IsEmpty); 80Debug.Assert(added);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
98Debug.Assert(instance.Count == 0);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\PooledObjects\PooledHashSet.cs (1)
79Debug.Assert(instance.Count == 0);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
67Debug.Assert(instance.Count == 0);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
101Debug.Assert(rulesetNode.Name == RuleSetNodeName); 130Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\SmallDictionary.cs (2)
426Debug.Assert(unbalanced != currentNode); 432Debug.Assert(n.HashCode != hashCode);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\WellKnownTypeProvider.cs (1)
94Debug.Assert(result
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\Extensions\BasicBlockExtensions.cs (1)
217Debug.Assert(ordinal < basicBlock.Ordinal);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\Extensions\ControlFlowConditionKindExtensions.cs (1)
21Debug.Fail($"Unsupported conditional kind: '{controlFlowConditionKind}'");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAbstractValue.cs (10)
23Debug.Assert(analysisEntities.IsEmpty != kind.IsKnown()); 24Debug.Assert(kind != CopyAbstractValueKind.KnownReferenceCopy || analysisEntities.All(a => !a.Type.IsValueType)); 40Debug.Assert(!kind.IsKnown()); 53Debug.Assert(!analysisEntities.IsEmpty); 58Debug.Assert(AnalysisEntities.Contains(entityToRemove)); 59Debug.Assert(AnalysisEntities.Count > 1); 60Debug.Assert(Kind.IsKnown()); 67Debug.Assert(entitiesToRemove.All(AnalysisEntities.Contains)); 68Debug.Assert(AnalysisEntities.Count > 1); 69Debug.Assert(Kind.IsKnown());
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysis.cs (1)
40Debug.Fail("Expected non-null CFG");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysisData.cs (10)
51Debug.Assert(IsReachableBlockData || !data.IsReachableBlockData); 92Debug.Assert(HasPredicatedData); 168Debug.Assert(newCopyEntities.SetEquals(currentValue.AnalysisEntities)); 179Debug.Assert(predicatedData.All(kvp => kvp.Value.AnalysisEntities.IsSubsetOf(coreAnalysisData[kvp.Key].AnalysisEntities))); 205Debug.Assert(!coreCopyAnalysisData.IsDisposed); 211Debug.Assert(kvp.Value.AnalysisEntities.Contains(kvp.Key)); 215Debug.Assert(map[analysisEntity] == kvp.Value); 227Debug.Assert(kvp.Value.AnalysisEntities.Contains(defaultCopyValyeEntity)); 228Debug.Assert(map.ContainsKey(defaultCopyValyeEntity)); 238Debug.Assert(!analysisEntity.HasUnknownInstanceLocation, "Don't track entities if do not know about it's instance location");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAbstractValue.cs (6)
25Debug.Assert(kind != DisposeAbstractValueKind.Disposed); 37Debug.Assert(Kind != DisposeAbstractValueKind.NotDisposable); 44Debug.Assert(Kind != DisposeAbstractValueKind.NotDisposable); 45Debug.Assert(Kind != DisposeAbstractValueKind.Unknown); 59Debug.Assert(disposingOrEscapingOperations.IsEmpty); 65Debug.Assert(!disposingOrEscapingOperations.IsEmpty);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysis.cs (2)
57Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, wellKnownTypeProvider.Compilation)); 98Debug.Assert(wellKnownTypeProvider.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemIDisposable, out _));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysisContext.cs (3)
98Debug.Assert(pointsToAnalysisResult != null); 99Debug.Assert(copyAnalysisResult == null); 100Debug.Assert(valueContentAnalysisResult == null);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAbstractValue.cs (18)
32Debug.Assert(!locations.IsEmpty); 33Debug.Assert(locations.All(location => !location.IsNull) || nullState != NullAbstractValue.NotNull); 34Debug.Assert(nullState != NullAbstractValue.Undefined); 35Debug.Assert(nullState != NullAbstractValue.Invalid); 36Debug.Assert(!locations.Any(l => l.IsAnalysisEntityDefaultLocation && l.AnalysisEntity!.HasUnknownInstanceLocation)); 37Debug.Assert(locations.Count <= LocationThreshold); 47Debug.Assert(!lValueCapturedOperations.IsEmpty); 57Debug.Assert(kind != PointsToAbstractValueKind.KnownLocations); 58Debug.Assert(kind != PointsToAbstractValueKind.KnownLValueCaptures); 68Debug.Assert(!location.IsNull, "Use 'PointsToAbstractValue.NullLocation' singleton"); 69Debug.Assert(!location.IsNoLocation, "Use 'PointsToAbstractValue.NoLocation' singleton"); 81Debug.Assert(!locations.IsEmpty); 113Debug.Assert(!lValueCapturedOperations.IsEmpty); 119Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 146Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 163Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 164Debug.Assert(NullState != NullAbstractValue.Null); 176Debug.Assert(Locations.All(location => !location.IsNull));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.cs (2)
72Debug.Fail("Expected non-null CFG"); 99Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisContext.cs (3)
41Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None); 75Debug.Assert(pointsToAnalysisResult == null); 76Debug.Assert(valueContentAnalysisResult == null);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisData.cs (6)
75Debug.Assert(IsReachableBlockData || !data.IsReachableBlockData); 107Debug.Assert(key.CaptureId == null); 125Debug.Assert(!corePointsToAnalysisData.IsDisposed); 140Debug.Assert(value.Kind != PointsToAbstractValueKind.Undefined); 141Debug.Assert(!key.IsLValueFlowCaptureEntity || value.Kind == PointsToAbstractValueKind.KnownLValueCaptures); 142Debug.Assert(PointsToAnalysis.ShouldBeTracked(key, PointsToAnalysisKind.Complete, isDisposable));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\TrackedEntitiesBuilder.cs (2)
32Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None); 49Debug.Assert(analysisEntity.ShouldBeTrackedForPointsToAnalysis(PointsToAnalysisKind));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysis.cs (2)
202Debug.Assert(success); 205Debug.Fail("Expected non-null CFG");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysis.cs (1)
55Debug.Fail("Expected non-null CFG");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataConfig.cs (4)
199Debug.Fail($"SinkKind {sinkKind} entry missing from {typeof(T).Name} map"); 250Debug.Fail($"Unhandled SinkKind {sinkKind}"); 306Debug.Fail($"Unhandled SinkKind {sinkKind}"); 361Debug.Fail($"Unhandled SinkKind {sinkKind}");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataSymbolMap.cs (1)
115Debug.Fail("Expected non-null 'namedTypeSymbol'");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractDomain.cs (1)
58Debug.Fail("Non-monotonic merge");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractLocation.cs (4)
36Debug.Assert(isSpecialSingleton ^ (locationType != null)); 49Debug.Assert(creation != null ^ symbol != null ^ analysisEntity != null ^ captureId != null); 50Debug.Assert(locationType != null); 128Debug.Assert(Creation != null);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AddressSharedEntitiesProvider.cs (1)
83Debug.Assert(builder.All(e => !e.HasUnknownInstanceLocation));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntity.cs (16)
48Debug.Assert(!indices.IsDefault); 49Debug.Assert(symbol != null || !indices.IsEmpty || instanceReferenceOperationSyntax != null || captureId.HasValue); 50Debug.Assert(parent == null || parent.Type.HasValueCopySemantics() || !indices.IsEmpty); 51Debug.Assert(entityForInstanceLocation == null || parent == null); 52Debug.Assert(entityForInstanceLocation == null || location.Kind == PointsToAbstractValueKind.KnownLocations); 71Debug.Assert(symbol != null || !indices.IsEmpty); 78Debug.Assert(instanceReferenceOperation != null); 96Debug.Assert(symbol != null || !indices.IsEmpty); 97Debug.Assert(parent == null || parent.InstanceLocation == instanceLocation); 98Debug.Assert(entityForInstanceLocation == null || instanceLocation.Kind == PointsToAbstractValueKind.KnownLocations); 118Debug.Assert(instanceLocation.Locations.Count == 1); 119Debug.Assert(instanceLocation.Locations.Single().Creation == null); 120Debug.Assert(Equals(instanceLocation.Locations.Single().Symbol, typeSymbol)); 127Debug.Assert(EqualsIgnoringInstanceLocation(analysisEntityToMerge)); 128Debug.Assert(!InstanceLocation.Equals(analysisEntityToMerge.InstanceLocation)); 159Debug.Assert(Parent == null || result);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityFactory.cs (8)
311Debug.Assert(symbol.Kind is SymbolKind.Local or SymbolKind.Parameter or SymbolKind.Field or SymbolKind.Property); 350Debug.Assert(parentTupleOperationOpt.Elements.Length == parentTupleElementEntities.Length); 370Debug.Assert(parentEntity.InstanceLocation == instanceLocation); 397Debug.Assert(!indices.IsEmpty); 419Debug.Assert(_interproceduralCallStack.Last().Descendants().Contains(flowCaptureOrReference)); 423Debug.Assert(_controlFlowGraph.DescendantOperations().Contains(flowCaptureOrReference)); 440Debug.Assert(symbol != null || !indices.IsEmpty); 517Debug.Assert(symbol.Kind == SymbolKind.Local || symbol.Kind == SymbolKind.Parameter || symbol.IsStatic || symbol.IsLambdaOrLocalFunction());
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysis.cs (19)
231Debug.Assert(tryRegion.Kind == ControlFlowRegionKind.Try); 258Debug.Assert(needsAtLeastOnePass); 265Debug.Assert(!currentInfeasibleData.IsDisposed); 276Debug.Assert(enclosingTryAndCatchRegion.Kind == ControlFlowRegionKind.TryAndCatch); 277Debug.Assert(block.EnclosingRegion.Kind is ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter); 278Debug.Assert(block.EnclosingRegion.FirstBlockOrdinal == block.Ordinal); 279Debug.Assert(!catchBlockInput.IsDisposed); 350Debug.Assert(finallyRegion.Kind == ControlFlowRegionKind.Finally); 378Debug.Assert(!ReferenceEquals(dataToDispose, newSuccessorInput)); 426Debug.Assert(compare <= 0, "The newly computed abstract value must be greater or equal than the previous one."); 437Debug.Assert(currentSuccessorInput == null || AnalysisDomain.Compare(currentSuccessorInput, newSuccessorInput) <= 0); 453Debug.Assert(dominatorBlockOrdinal >= block.Ordinal); 454Debug.Assert(dominatorBlockOrdinal >= successorBlock.Ordinal); 468Debug.Assert(IsValidWorklistState()); 490Debug.Assert(tryAndCatchRegion.Kind == ControlFlowRegionKind.TryAndCatch); 535Debug.Assert(compare <= 0, "The newly computed abstract value must be greater or equal than the previous one."); 625Debug.Assert(basicBlock.EnclosingRegion.Kind == ControlFlowRegionKind.Finally); 727Debug.Assert(finallyRegion.Kind == ControlFlowRegionKind.Finally); 781Debug.Assert(builder[block] == null || AnalysisDomain.Compare(builder[block]!, newInput) <= 0, "Non-monotonic update");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysisResult.cs (4)
107Debug.Assert(operation.GetRoot() != ControlFlowGraph.OriginalOperation, 117Debug.Assert(operation.GetAncestor<IBlockOperation>(OperationKind.Block, predicate: b => b.Parent == null) == null); 158Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 169Debug.Assert(lambdaOrLocalFunctionOperation.Kind is OperationKind.AnonymousFunction or OperationKind.LocalFunction);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (103)
174Debug.Assert(!_currentAnalysisData.IsDisposed); 179Debug.Assert(!value.IsDisposed); 188Debug.Assert(_currentBasicBlock != null); 231Debug.Assert(ExceptionNamedType != null); 427Debug.Assert(_pendingArgumentsToReset.Count == 0); 428Debug.Assert(_pendingArgumentsToPostProcess.Count == 0); 548Debug.Assert(entryBlock.Kind == BasicBlockKind.Entry); 561Debug.Assert(result); 581Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit); 631Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 632Debug.Assert(DataFlowAnalysisContext.ControlFlowGraph.LocalFunctions.Contains(localFunction)); 640Debug.Assert(_visitedLambdas.Contains(lambda)); 648Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit); 742Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None); 785Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None); 820Debug.Assert(implicitTaskPointsToValueOpt.Kind == PointsToAbstractValueKind.KnownLocations); 849Debug.Assert(ExecutingExceptionPathsAnalysisPostPass); 850Debug.Assert(!SkipExceptionPathsAnalysisPostPass); 929Debug.Assert(ExecutingExceptionPathsAnalysisPostPass); 930Debug.Assert(!SkipExceptionPathsAnalysisPostPass); 959Debug.Assert(locals.Any() || flowCaptures.Any()); 1001/// Checks if the method is an overload of the <see cref="Debug.Assert(bool)"/> method. 1004/// <returns>True if the method is an overlaod of the <see cref="Debug.Assert(bool)"/> method.</returns> 1138Debug.Assert(parameterEntity.Symbol?.Kind == SymbolKind.Parameter); 1151Debug.Assert(CurrentBasicBlock.Kind == BasicBlockKind.Entry); 1299Debug.Fail($"Unexpected 'null' target type for '{operation.Syntax}'"); 1355Debug.Assert(PredicateAnalysis); 1361Debug.Assert(PredicateAnalysis); 1385Debug.Assert(PredicateAnalysis); 1386Debug.Assert(operation.Kind is OperationKind.BinaryOperator or 1421Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData"); 1433Debug.Assert(result); 1436Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity)); 1450Debug.Assert(!ReferenceEquals(truePredicatedData, CurrentAnalysisData)); 1455Debug.Assert(!ReferenceEquals(falsePredicatedData, CurrentAnalysisData)); 1459Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData"); 1488Debug.Assert(IsContractCheckArgument((IArgumentOperation)operation)); 1526Debug.Assert(targetEntity.CaptureId != null); 1543Debug.Assert(PredicateAnalysis); 1544Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None); 1638Debug.Fail($"Unknown pattern kind '{isPatternOperation.Pattern.Kind}'"); 1667Debug.Assert(IsContractCheckArgument(argument)); 1681Debug.Assert(result); 1824Debug.Assert(PredicateAnalysis); 1849Debug.Assert(PredicateAnalysis); 1850Debug.Assert(operation.IsComparisonOperator()); 1851Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None); 1893Debug.Assert(PredicateAnalysis); 1899Debug.Assert(PredicateAnalysis); 1905Debug.Assert(PredicateAnalysis); 1911Debug.Assert(PredicateAnalysis); 1920Debug.Assert(PredicateAnalysis); 1926Debug.Assert(PredicateAnalysis); 1932Debug.Assert(PredicateAnalysis); 1948Debug.Assert(IsLValueFlowCaptureReference(flowCaptureReference)); 2023Debug.Assert(HasPointsToAnalysisResult); 2024Debug.Assert(operation.Type!.HasValueCopySemantics()); 2042Debug.Assert(HasPointsToAnalysisResult); 2043Debug.Assert(!operation.Type!.HasValueCopySemantics()); 2265Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2266Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2267Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 2330Debug.Assert(arguments.All(arg => !_pendingArgumentsToReset.Contains(arg))); 2345Debug.Assert(popped == originalOperation); 2392Debug.Assert(arguments.All(_pendingArgumentsToReset.Contains)); 2482Debug.Assert(originalOperation.Kind == OperationKind.ObjectCreation); 2513Debug.Assert(arguments.Length == invokedMethod.Parameters.Length); 2555Debug.Assert(invokedMethod.Parameters.Length == method.GetParameters().Length || 2621Debug.Assert(success); 2632Debug.Assert(IsStandaloneAnalysisRequiredForLocalFunction(localFunction)); 2650Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2651Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2652Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 2682Debug.Assert(IsStandaloneAnalysisRequiredForLambda(lambda)); 2700Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2701Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2702Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 2997Debug.Assert(result); 3006Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity)); 3032Debug.Assert(flowCaptureEntity.CaptureId != null); 3076Debug.Assert(FlowBranchConditionKind == ControlFlowConditionKind.None); 3155Debug.Assert(operation.Initializer == null, "Object or collection initializer must have been lowered in the CFG"); 3238Debug.Assert(!arguments.IsEmpty); 3257Debug.Assert(arguments.Length >= 2); 3281Debug.Assert(IsPointsToAnalysis); 3325Debug.Assert(operation != null ^ invocationTarget != null); 3336Debug.Assert(invocation.Instance == null); 3344Debug.Assert(targetMethod.MethodKind is MethodKind.LambdaMethod or 3378Debug.Assert(knownTargetInvocations); 3385Debug.Assert(knownTargetInvocations); 3392Debug.Assert(knownTargetInvocations); 3414Debug.Assert(knownTargetInvocations); 3459Debug.Assert(methodTargetsOptBuilder.Count > 0 || lambdaTargets.Count > 0); 3477Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData)); 3489Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData)); 3493Debug.Assert(mergedCurrentAnalysisData == null || ReferenceEquals(mergedCurrentAnalysisData, CurrentAnalysisData)); 3584Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation)); 3602Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation)); 3679Debug.Assert(elementEntities.Length == elementValueBuilder.Count); 3680Debug.Assert(elementEntities.Length == operation.Elements.Length); 3758Debug.Assert(caughtExceptionType != null || CurrentBasicBlock.IsFirstBlockOfFinally(out _)); 3791Debug.Assert(CurrentBasicBlock.IsFirstBlockOfFinally(out _)); 3825Debug.Assert(operation.Kind == OperationKind.YieldReturn, "IReturnOperation must have been lowered in the CFG");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DictionaryAnalysisData.cs (17)
34Debug.Assert(!IsDisposed); 42Debug.Assert(!IsDisposed); 47Debug.Assert(!IsDisposed); 56Debug.Assert(!IsDisposed); 70Debug.Assert(!IsDisposed); 79Debug.Assert(!IsDisposed); 86Debug.Assert(!IsDisposed); 92Debug.Assert(!IsDisposed); 98Debug.Assert(!IsDisposed); 104Debug.Assert(!IsDisposed); 110Debug.Assert(!IsDisposed); 116Debug.Assert(!IsDisposed); 122Debug.Assert(!IsDisposed); 128Debug.Assert(!IsDisposed); 134Debug.Assert(!IsDisposed); 142Debug.Assert(!IsDisposed); 148Debug.Assert(!IsDisposed);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\LValueFlowCapturesProvider.cs (1)
70Debug.Fail("Flow capture used as both an r-value and an l-value?");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\MapAbstractDomain.cs (1)
92Debug.Fail("Non-monotonic merge");
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\PredicatedAnalysisData.cs (12)
63Debug.Assert(!_lazyPredicateDataMap.IsDisposed); 69Debug.Assert(!value.TruePredicatedData.IsDisposed); 70Debug.Assert(builder.Add(value.TruePredicatedData)); 75Debug.Assert(!value.FalsePredicatedData.IsDisposed); 76Debug.Assert(builder.Add(value.FalsePredicatedData)); 89Debug.Assert(predicatedEntity.IsCandidatePredicateEntity()); 90Debug.Assert(predicatedEntity.CaptureId != null, "Currently we only support predicated data tracking for flow captures"); 103Debug.Assert(HasPredicatedDataForEntity(predicatedEntity)); 126Debug.Assert(HasPredicatedDataForEntity(fromEntity)); 142Debug.Assert(HasPredicatedDataForEntity(predicatedEntity)); 173Debug.Assert(HasPredicatedData); 435Debug.Assert(_lazyPredicateDataMap.IsDisposed);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\ThrownExceptionInfo.cs (2)
48Debug.Assert(enclosingRegion.NestedRegions[0].Kind == ControlFlowRegionKind.Try); 69Debug.Assert(interproceduralCallStack != InterproceduralCallStack);
Microsoft.CodeAnalysis.Razor.Compiler (306)
CSharp\DefaultTagHelperDescriptorFactory.cs (1)
327Debug.Assert(result.Length == 2 || result.Length == 0,
CSharp\RequiredAttributeParser.cs (4)
104Debug.Assert(!AtEnd, "Cannot move past the end of the input."); 176Debug.Assert(_diagnostics.Length == 0, "Diagnostics should only be added if we fail to parse."); 250Debug.Assert(At('[')); 329Debug.Assert(!AtEnd);
CSharp\SymbolExtensions.cs (1)
93Debug.Assert(endIndex >= 0, "Symbol name ends in '<' but does not contain '>'!");
Language\AllowedChildTagDescriptor.cs (2)
35Debug.Assert(parent != null); 36Debug.Assert(_parent == null);
Language\BoundAttributeDescriptor.cs (2)
111Debug.Assert(parent != null); 112Debug.Assert(_parent == null);
Language\BoundAttributeParameterDescriptor.cs (2)
65Debug.Assert(parent != null); 66Debug.Assert(_parent == null);
Language\CodeGeneration\CodeWriter.cs (7)
161Debug.Fail("Do not use this indexer without reimplementing it more efficiently."); 411Debug.Assert(chunkIndex >= 0); 412Debug.Assert(charIndex >= 0); 504Debug.Assert(page is not null); 505Debug.Assert(chunkIndex >= 0); 506Debug.Assert(charIndex >= 0); 538Debug.Assert(destination.Length == 0, "We didn't fill the whole span!");
Language\CodeGeneration\CodeWriter.WriteInterpolatedStringHandler.cs (1)
81Debug.Assert(!typeof(T).IsValueType, $"Handle {typeof(T).FullName} to avoid boxing to {nameof(IWriteableValue)}");
Language\CodeGeneration\CodeWriterExtensions.cs (6)
207Debug.Assert(group >= 0 && group < 1000, "Digit group should be in the range [0, 999]"); 211Debug.Assert(!first, "The first group should never be 0."); 692Debug.Assert(context == null || context.CodeWriter == writer); 911Debug.Assert(index == -1); // We've hit all of the double-quotes. 967Debug.Assert(false, "Unknown escape character."); 974Debug.Assert(index == -1); // We've hit all of chars that need escaping.
Language\Components\ComponentDiagnosticFactory.cs (5)
225Debug.Assert(childContent1.ParameterName == childContent2.ParameterName); 226Debug.Assert(childContent1.IsParameterized); 227Debug.Assert(childContent2.IsParameterized); 249Debug.Assert(component.Component.IsGenericTypedComponent()); 266Debug.Assert(component.Component.IsGenericTypedComponent());
Language\Components\ComponentGenericTypePass.cs (2)
350Debug.Assert(bindings != null || hasTypeArgumentSpecified == true); 357Debug.Assert(attribute.TypeName is not null);
Language\Components\ComponentInjectDirectivePass.cs (2)
33Debug.Assert(hasType || isMalformed); 38Debug.Assert(hasMemberName || isMalformed);
Language\Components\ComponentLoweringPass.cs (1)
347Debug.Assert(node.StartTagSpan.HasValue, "Component tags should always have a start tag span.");
Language\Components\ComponentMarkupEncodingPass.cs (1)
196Debug.Assert(builder.Length > 0, "How could builder be empty if content was not?");
Language\Components\ComponentNodeWriter.cs (8)
831Debug.Assert(!hasFormName); 868Debug.Assert(_currentAttributeValues.Count == 0); 1051Debug.Assert(!hasRenderMode); 1288Debug.Assert(attribute.BoundAttribute?.ContainingType is not null); 1298Debug.Assert(node.HasDiagnostics, "We should have reported an error for mixed content."); 1590Debug.Assert(node.HasDiagnostics, "We should have reported an error for mixed content."); 1761Debug.Assert(token is HtmlIntermediateToken); 1789Debug.Assert(token is HtmlIntermediateToken);
Language\Components\ComponentRenderModeDirectivePass.cs (2)
34Debug.Assert(directives.Length == 1); 119Debug.Assert(@namespace.Children.Count == childCount + 1);
Language\Components\ScopeStack.cs (1)
70Debug.Assert(_stack is not null && _stack.Count > 0);
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (1)
199Debug.Assert(!imports.IsDefaultOrEmpty);
Language\DefaultRazorProjectFileSystem.cs (1)
152Debug.Assert(span.Length == pathSpan.Length, "The span should be the same length as the path.");
Language\DefaultRazorTagHelperContextDiscoveryPhase.cs (2)
267Debug.Assert(!IsInitialized); 430Debug.Assert(!IsInitialized);
Language\DefaultTagHelperResolutionPhase.cs (1)
834Debug.Assert(first.AbsoluteIndex <= last.AbsoluteIndex,
Language\DocumentationDescriptor.FormattedDescriptor.cs (1)
24Debug.Assert(
Language\Extensions\DefaultTagHelperTargetExtension.cs (2)
461Debug.Assert(tagHelperNode.Children.Contains(propertyNode)); 462Debug.Assert(propertyNode.IsIndexerNameMatch);
Language\Extensions\MetadataAttributePass.cs (2)
21Debug.Assert(_identifierFeature is not null); 124Debug.Assert(_identifierFeature != null);
Language\Extensions\PreallocatedAttributeTargetExtension.cs (2)
138Debug.Assert(tagHelperNode.Children.Contains(propertyNode)); 139Debug.Assert(propertyNode.IsIndexerNameMatch);
Language\HtmlConventions.cs (1)
94Debug.Assert(char.IsUpper(input[i]));
Language\Intermediate\IntermediateNodeFormatter.cs (2)
66Debug.Assert(children != null); 91Debug.Assert(key != null);
Language\Intermediate\IntermediateNodeWalker.Stack.cs (2)
46Debug.Assert(!IsEmpty); 64Debug.Assert(_stackPointer == 0, "We should only grow the ancestor stack when the stack pointer reaches 0.");
Language\Intermediate\LazyContent.cs (1)
57Debug.Assert(_contentFactory is not null, "Content factory should not be null at this point.");
Language\Intermediate\ReferenceCaptureIntermediateNode.cs (1)
57Debug.Assert(IsComponentCapture);
Language\Intermediate\TagHelperDirectiveAttributeIntermediateNode.cs (1)
27Debug.Assert(!match.IsParameterMatch);
Language\Legacy\AutoCompleteEditHandler.cs (2)
83Debug.Assert(canCompleteBrace is not null); 88Debug.Assert(canCompleteBrace is null);
Language\Legacy\ClassifiedSpanVisitor.cs (2)
419Debug.Assert(_currentBlock != null, "Current block should not be null when writing a span for a node."); 437Debug.Assert(_currentBlock != null, "Current block should not be null when writing a span for a token.");
Language\Legacy\CSharpCodeParser.cs (14)
254Debug.Assert(_htmlParser != null, "HtmlParser should have been set during initialization"); 429Debug.Assert(TokenBuilder.Count == 0, "We should not have any tokens left."); 1068Debug.Assert(transition.Kind == SyntaxKind.Transition); 1317Debug.Assert(CurrentToken.Kind == SyntaxKind.Identifier || CurrentToken.Kind == SyntaxKind.Keyword); 1318Debug.Assert(string.Equals(CurrentToken.Content, directive, StringComparison.Ordinal)); 2095Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && result.HasValue); 2112Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && result.HasValue); 2276Debug.Assert(result is CSharpSyntaxKind.CaseKeyword or CSharpSyntaxKind.DefaultKeyword); 2571Debug.Assert(transition != null); 2654Debug.Assert(directiveBuilder.Count == 0, "We should not have built any blocks so far."); 2809Debug.Assert(whitespace.Count == 0, "Expected empty builder."); 3100Debug.Assert(CurrentToken.Kind == SyntaxKind.Transition); 3103Debug.Assert(CurrentToken.Kind is SyntaxKind.Identifier or SyntaxKind.Keyword); 3115Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword &&
Language\Legacy\DirectiveCSharpTokenizer.cs (2)
34Debug.Assert(Buffer.Length == 0); 45Debug.Assert(Buffer.Length == 0);
Language\Legacy\DirectiveHtmlTokenizer.cs (2)
32Debug.Assert(Buffer.Length == 0); 45Debug.Assert(Buffer.Length == 0);
Language\Legacy\HtmlLanguageCharacteristics.cs (1)
84Debug.Fail("FlipBracket must be called with a bracket character");
Language\Legacy\HtmlMarkupParser.cs (8)
44Debug.Assert(_codeParser != null, "CodeParser should have been set during initialization"); 1149Debug.Assert(nameParsingResult is AttributeNameParsingResult.Success); 1213Debug.Assert(nameTokens.Count == 0); 1601Debug.Assert(CurrentToken.Kind == SyntaxKind.Text && string.Equals(CurrentToken.Content, "cdata", StringComparison.OrdinalIgnoreCase)); 1760Debug.Assert(false, "Unexpected tokens after NullGenerateWhitespaceAndNewLine"); 1872Debug.Assert(EndOfFile); 1879Debug.Assert(whitespaceTokens.Count == 0, "Expected empty builder."); 2192Debug.Assert(right != null);
Language\Legacy\HtmlTokenizer.cs (6)
52Debug.Assert(token.Content == content); 79Debug.Fail("Invalid TokenizerState"); 221Debug.Assert(AtToken()); 249Debug.Assert(CurrentCharacter == '-'); 254Debug.Fail("Unexpected token!"); 271Debug.Assert(SyntaxFacts.IsNewLine(CurrentCharacter));
Language\Legacy\ImplicitExpressionEditHandler.cs (3)
417Debug.Assert(change.IsInsert); 427Debug.Assert(change.IsInsert); 431Debug.Assert(!IsAtEndOfSpan(target, change));
Language\Legacy\NativeCSharpLanguageCharacteristics.cs (1)
169Debug.Fail("FlipBracket must be called with a bracket character");
Language\Legacy\NativeCSharpTokenizer.cs (3)
176Debug.Fail("Invalid TokenizerState"); 693Debug.Assert(Char.IsDigit(CurrentCharacter)); 721Debug.Assert(SyntaxFacts.IsIdentifierStartCharacter(CurrentCharacter));
Language\Legacy\ParserHelpers.cs (1)
100Debug.Assert(entity.Span is ['&',.., ';'], "At this point, entity must start with '&' and end with ';'.");
Language\Legacy\RoslynCSharpLanguageCharacteristics.cs (1)
161Debug.Fail("FlipBracket must be called with a bracket character");
Language\Legacy\RoslynCSharpTokenizer.cs (28)
97Debug.Assert(CurrentState == RoslynCSharpTokenizerState.TriviaForCSharpToken, $"Unexpected state: {CurrentState}"); 98Debug.Assert(_currentCSharpTokenTriviaEnumerator is (_, isLeading: false)); 99Debug.Assert(_resultCache.Count > 0); 136Debug.Assert(_currentCSharpTokenTriviaEnumerator is not null); 140Debug.Fail("Invalid TokenizerState"); 148Debug.Assert(type != SyntaxKind.CSharpOperator, "CSharpOperator should be handled by getting the interned text from C#"); 172Debug.Fail("This should be handled by using the C# lexer's interned string in NumericLiteral()"); 189Debug.Fail("This should be handled by using the C# lexer's interned string in Operator()"); 204Debug.Fail("This should be handled by using the C# lexer's interned string in Operator()"); 220Debug.Assert(leadingTriviaResult.ContextualKind == CSharpSyntaxKind.None); 221Debug.Assert(leadingTriviaResult.Token.IsKind(CSharpSyntaxKind.None)); 315Debug.Assert(nextResult.Token.IsKind(CSharpSyntaxKind.None)); 316Debug.Assert(nextResult.Token.FullSpan.Length == 0); 352Debug.Assert(content == Buffer.ToString()); 408Debug.Assert(expectedPrefix != null); 409Debug.Assert(expectedPostfix != null); 410Debug.Assert(expectedPrefix == expectedPostfix); 440Debug.Assert(expectedPrefix[^1] == '"'); 465Debug.Assert(_currentCSharpTokenTriviaEnumerator is not null); 483Debug.Assert(CurrentCharacter == '@'); 550Debug.Assert(directiveTrivia != null); 617Debug.Assert(currentChar == '#'); 733Debug.Assert(_resultCache.All(r => r.position <= nextResult.Token.FullSpan.Start)); 739Debug.Assert(_resultCache[^1].result is { Token.FullSpan.Length: 0 }); 740Debug.Assert(!nextResult.Token.HasLeadingTrivia); 759Debug.Assert(_resultCache.Count > 0); 777Debug.Assert(isOnlyWhitespaceOnLine == _isOnlyWhitespaceOnLine); 797Debug.Assert(currentPosition > position);
Language\Legacy\SpanEditHandlerBuilder.cs (2)
61Debug.Assert(_currentInstance is null || _currentInstance.Tokenizer == Tokenizer); 79Debug.Assert(_defaultLanguageEditHandler is not null);
Language\Legacy\TagHelperParseTreeRewriter.cs (2)
603Debug.Assert(firstChild is MarkupTextLiteralSyntax); 635Debug.Assert(firstChild is MarkupTextLiteralSyntax);
Language\Legacy\Tokenizer.cs (7)
77Debug.Assert(Buffer.Length == 0); 88Debug.Assert(Buffer.Length == 0); 91Debug.Assert(EndOfFile || !CurrentStart.Equals(CurrentLocation)); 194Debug.Assert(Buffer.Length == 0); 195Debug.Assert(CurrentErrors.Count == 0); 206Debug.Assert(tokenContent == Buffer.ToString(), $"Token content mismatch: '{tokenContent}' != '{Buffer}'. Token Type: '{type}'."); 396Debug.Assert(CurrentCharacter == current, "CurrentCharacter Assumption violated", "Assumed that the current character would be {0}, but it is actually {1}", current, CurrentCharacter);
Language\Legacy\TokenizerBackedParser.cs (6)
184Debug.Assert(!EndOfFile && CurrentToken.Kind == expectedType); 304Debug.Assert(!expectsEmptyBuilder || result.Count == 0, "Expected empty builder."); 323Debug.Assert(result.Count == 0, "Expected empty builder."); 373Debug.Assert(At(SyntaxKind.RazorCommentTransition)); 432Debug.Assert(!EndOfFile && CurrentToken != null); 440Debug.Assert(!EndOfFile && CurrentToken != null && kind == CurrentToken.Kind);
Language\NamespaceComputer.cs (1)
248Debug.Assert(_source != null);
Language\RazorCodeDocument.cs (9)
158Debug.Assert(value is not null); 180Debug.Assert(value is not null); 205Debug.Assert(!value.IsDefault); 206Debug.Assert(value.IsEmpty || value.All(static t => t is not null)); 229Debug.Assert(value is not null); 252Debug.Assert(value is not null); 274Debug.Assert(value is not null); 321Debug.Assert(validateResult, "We couldn't compute the namespace, but have a cached value, so something has gone wrong"); 322Debug.Assert(validateNamespace == @namespace, $"We cached a namespace of {@namespace} but calculated that it should be {validateNamespace}");
Language\RazorCodeDocumentExtensions.cs (1)
163Debug.Assert(directive is RazorUsingDirectiveSyntax || directive.DirectiveBody.Keyword.GetContent() == SyntaxConstants.CSharp.AddTagHelperKeyword);
Language\RazorCSharpDocument.cs (1)
42Debug.Fail("input not sorted");
Language\RazorHtmlWriter.cs (2)
53Debug.Assert( 311Debug.Assert(nextIndex <= text.Length, "The next index should not exceed the length of the source text.");
Language\RazorProjectEngineBuilder.cs (1)
44Debug.Fail($"Encountered an {nameof(IRazorFeature)} that is not an {nameof(IRazorEngineFeature)} or {nameof(IRazorProjectEngineFeature)}.");
Language\RazorProjectFileSystem.cs (2)
88Debug.Assert(!string.IsNullOrEmpty(path)); 134Debug.Assert(span[fileName.Length..].IsEmpty);
Language\RequiredAttributeDescriptor.cs (2)
57Debug.Assert(parent != null); 58Debug.Assert(_parent == null);
Language\RequiredAttributeDescriptorBuilder.cs (1)
71Debug.Assert(nameSpan.Length > 0, "Name should not be empty at this point.");
Language\SpanComputer.cs (4)
101Debug.Assert(_lastToken.Kind != SyntaxKind.None, "Last token should not be None when first token is set."); 106Debug.Assert(start <= end, "Start position should not be greater than end position."); 125Debug.Assert(_lastToken.Kind != SyntaxKind.None, "Last token should not be None when first token is set."); 130Debug.Assert(start <= end, "Start position should not be greater than end position.");
Language\Syntax\ChildSyntaxList.cs (5)
131Debug.Assert(idx >= 0); 215Debug.Assert(node.Span.Contains(targetPosition)); 221Debug.Assert(!green.IsList); 298Debug.Assert(idx >= 0); 392Debug.Assert(_node != null);
Language\Syntax\GreenNode.cs (4)
92Debug.Assert(node is not null); 120Debug.Assert(0 <= offset && offset < Width); 126Debug.Assert(i < SlotCount); 224Debug.Assert(span.IsEmpty);
Language\Syntax\InternalSyntax\SyntaxList.cs (8)
57Debug.Assert(child0 != null); 58Debug.Assert(child1 != null); 66Debug.Assert(child0 != null); 67Debug.Assert(child1 != null); 68Debug.Assert(child2 != null); 82Debug.Assert(nodes[i] != null); 96Debug.Assert(nodes[i] != null); 395Debug.Assert(offset >= 0 && offset < Width);
Language\Syntax\InternalSyntax\SyntaxListBuilder.cs (2)
95Debug.Assert(_nodes[i].Value != null); 149Debug.Assert(newSize >= requiredSize);
Language\Syntax\InternalSyntax\SyntaxListOfT.cs (3)
43Debug.Assert(index >= 0); 44Debug.Assert(index <= _node.SlotCount); 67Debug.Assert(index == 0);
Language\Syntax\InternalSyntax\SyntaxListPool.cs (2)
40Debug.Assert(!_allocated.Contains(item)); 60Debug.Assert(_allocated.Contains(item));
Language\Syntax\SyntaxList`1.cs (6)
103Debug.Assert(index == 0); 185Debug.Assert(builder.Count == count + tokens.Length); 251Debug.Assert(builder.Count == count + nodeCount); 400Debug.Assert(builder.Count == index + nodeCount); 405Debug.Assert(builder.Count == newCount + nodeCount); 439Debug.Assert(Node == null || Count != 0);
Language\Syntax\SyntaxNavigator.cs (4)
152Debug.Assert(child.IsNode); 194Debug.Assert(child.IsNode); 236Debug.Assert(child.IsNode); 278Debug.Assert(child.IsNode);
Language\Syntax\SyntaxNode.cs (4)
119Debug.Assert(IsList); 191Debug.Assert(childNodeOrToken.Span.Contains(position), "ChildThatContainsPosition's return value does not contain the requested position."); 469Debug.Assert(curNode.Kind is < SyntaxKind.FirstAvailableTokenKind and >= 0); 470Debug.Assert(curNode.Span.Contains(position));
Language\Syntax\SyntaxNode.Iterators.cs (4)
121Debug.Assert(_stack != null); 137Debug.Assert(_stack != null); 154Debug.Assert(_stack != null); 200Debug.Assert(_selector is not null || typeof(TResult) == typeof(SyntaxNode),
Language\Syntax\SyntaxNodeExtensions.cs (2)
78Debug.Assert(false, "Node position should stay within document length."); 113Debug.Assert(false, "Node position should stay within document length.");
Language\Syntax\SyntaxNodeOrToken.cs (8)
35Debug.Assert(!node.Green.IsList, "node cannot be a list"); 43Debug.Assert(parent == null || !parent.Green.IsList, "parent cannot be a list"); 44Debug.Assert(token != null || (parent == null && position == 0 && index == 0), "parts must form a token"); 45Debug.Assert(token == null || token.IsToken, "token must be a token"); 46Debug.Assert(index >= 0, "index must not be negative"); 47Debug.Assert(parent == null || token != null, "null token cannot have parent"); 79Debug.Assert(UnderlyingNode != null); 280Debug.Assert(
Language\Syntax\SyntaxRewriter.cs (2)
19Debug.Assert(!node.IsToken); 20Debug.Assert(!node.IsList);
Language\Syntax\SyntaxToken.cs (4)
26Debug.Assert(parent == null || !parent.Green.IsList, "list cannot be a parent"); 27Debug.Assert(token == null || token.IsToken, "token must be a token"); 38Debug.Assert(token == null || token.IsToken, "token must be a token"); 56Debug.Assert(Node != null);
Language\Syntax\SyntaxTokenList.cs (8)
32Debug.Assert(tokenOrList != null || (position == 0 && index == 0 && parent == null)); 33Debug.Assert(position >= 0); 34Debug.Assert(tokenOrList == null || tokenOrList.IsToken || tokenOrList.IsList); 127Debug.Assert(node.IsList || index == 0); 200Debug.Assert(builder.Count == count + tokens.Length); 261Debug.Assert(builder.Count == count + tokenCount); 385Debug.Assert(builder.Count == index + tokenCount); 390Debug.Assert(builder.Count == newCount + tokenCount);
Language\Syntax\SyntaxTokenList.Enumerator.cs (2)
84Debug.Assert(_singleNodeOrList != null); 86Debug.Assert(_current != null);
Language\Syntax\SyntaxTokenList.Reversed.cs (2)
77Debug.Assert(_singleNodeOrList != null); 79Debug.Assert(_current != null);
Language\Syntax\SyntaxVisitor.cs (8)
22Debug.Assert(!node.IsToken); 23Debug.Assert(!node.IsList); 33Debug.Assert(!node.IsToken); 34Debug.Assert(!node.IsList); 50Debug.Assert(!node.IsToken); 51Debug.Assert(!node.IsList); 59Debug.Assert(!node.IsToken); 60Debug.Assert(!node.IsList);
Language\Syntax\SyntaxWalker.cs (4)
22Debug.Assert(!node.IsToken); 23Debug.Assert(!node.IsList); 36Debug.Assert(!node.IsToken); 37Debug.Assert(!node.IsList);
Language\TagHelperBinder.cs (2)
147Debug.Assert( 195Debug.Assert(tempRulesBuilder.Count == 0);
Language\TagHelperBinder.TagHelperSet.cs (4)
112Debug.Assert(_valueOrArray is null, "Cannot increase size once items have been added."); 118Debug.Assert(_index < _size, "Cannot add more items."); 128Debug.Assert(_valueOrArray is null or TagHelperDescriptor[]); 141Debug.Assert(_index == _size, "Must have added all items.");
Language\TagHelperCollection_Factories.cs (1)
216Debug.Assert(collections.Length >= 2);
Language\TagHelperCollection.MultiSegmentCollection.cs (3)
31Debug.Assert(segments.Length > 0, "Segments cannot be empty."); 41Debug.Assert(segments[i].Length > 0, "Segments cannot be empty."); 54Debug.Assert(index >= 0 && index < _segments.Length);
Language\TagHelperCollection.SegmentBuilder.cs (1)
104Debug.Assert(!segment.IsEmpty, "SegmentBuilder should not contain an empty segment.");
Language\TagHelperCollection.SegmentCollectionBase.cs (1)
63Debug.Assert(UseLookupTable);
Language\TagHelperCollection.SingleSegmentCollection.cs (2)
26Debug.Assert(segment.Length > 0, "Segments cannot be empty."); 35Debug.Assert(index == 0);
Language\TagHelperDiscoverer.cs (1)
27Debug.Assert(producers.Length <= 30, "Too many TagHelperProducer kinds to fit in a cache key.");
Language\TagHelperMatchingConventions.cs (2)
278Debug.Assert(false, "Unknown name comparison."); 297Debug.Assert(false, "Unknown value comparison.");
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (2)
463Debug.Assert(attribute.AttributeClass != null); 499Debug.Assert(false, $"Need to add support for '{arg.Kind}' and make sure the output is 'global::' prefixed.");
Language\TagMatchingRuleDescriptor.cs (2)
64Debug.Assert(parent != null); 65Debug.Assert(_parent == null);
Language\TypeNameObject.cs (3)
62Debug.Assert(knownTypeNames.Count < byte.MaxValue, "Too many known type names to fit in a byte index."); 86Debug.Assert(index >= 0 && index < s_knownTypeNames.Length); 94Debug.Assert(stringValue is null || !s_typeNameToIndex.ContainsKey(stringValue));
Language\VirtualRazorProjectFileSystem.cs (2)
56Debug.Assert(directory != null); 133Debug.Assert(!string.IsNullOrEmpty(path));
Mvc.Version2_X\AssemblyAttributeInjectionPass.cs (1)
65Debug.Assert(index >= 0);
Mvc.Version2_X\RazorPageDocumentClassifierPass.cs (1)
112Debug.Assert(pageDirective != null);
Mvc\InjectDirective.cs (2)
72Debug.Assert(hasType || isMalformed); 77Debug.Assert(hasMemberName || isMalformed);
Mvc\PageDirective.cs (3)
82Debug.Assert(content.Length >= 2); 83Debug.Assert(content.StartsWith("\"", StringComparison.Ordinal)); 84Debug.Assert(content.EndsWith("\"", StringComparison.Ordinal));
Mvc\RazorPageDocumentClassifierPass.cs (1)
131Debug.Assert(pageDirective != null);
Mvc\ViewComponentTagHelperTargetExtensionBase.cs (1)
89Debug.Assert(tagHelper.TagMatchingRules.Length == 1);
SourceGenerators\SourceGeneratorProjectEngine.cs (6)
50Debug.Assert(_discoveryPhase is not null); 51Debug.Assert(_discoveryPhaseIndex >= 0); 52Debug.Assert(_rewritePhaseIndex >= 0); 53Debug.Assert(_discoveryPhaseIndex < _rewritePhaseIndex); 73Debug.Assert(sgDocument.CodeDocument.GetSyntaxTree() is not null); 172Debug.Assert(codeDocument.GetReferencedTagHelpers() is not null);
Microsoft.CodeAnalysis.Rebuild (3)
CSharpCompilationFactory.cs (2)
33Debug.Assert(optionsReader.GetLanguageName() == LanguageNames.CSharp); 40Debug.Assert(optionsReader.GetLanguageName() == LanguageNames.CSharp);
VisualBasicCompilationFactory.cs (1)
40Debug.Assert(optionsReader.GetLanguageName() == LanguageNames.VisualBasic);
Microsoft.CodeAnalysis.ResxSourceGenerator (547)
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\b310f676f7308b7f\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 160Debug.Assert(cfg.Parent != null); 161Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 162Debug.Assert(parentAnalysisData != null); 319Debug.Assert(lambdaOrLocalFunctionCfg != null); 329Debug.Assert(anonymousFunctionCfg != null); 338Debug.Assert(localFunction.IsLocalFunction()); 346Debug.Assert(localFunctionCfg != null); 362Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 503Debug.Assert(localFunction.IsLocalFunction()); 504Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 594Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\roslyn\src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\roslyn\src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (13)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 280Debug.Assert(_value is V, "Item must be a a V"); 309Debug.Assert(this.Count >= 1); 315Debug.Assert(_value is V, "_value must be a V"); 343Debug.Assert(_count >= 1);
src\roslyn\src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
410Debug.Assert(!IsUnixLikePlatform); 428Debug.Assert(IsAbsolute(root)); 884Debug.Assert(parts[toSkip - 1] == string.Empty);
src\roslyn\src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 87Debug.Assert(tail != null); 98Debug.Assert(this != Empty); 108Debug.Assert(this != Empty);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Debug.cs (8)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 21/// <inheritdoc cref="Debug.Assert(bool, string)"/> 24=> Debug.Assert(condition, message); 26/// <inheritdoc cref="Debug.Assert(bool, string)"/> 32Debug.Fail(message.ToStringAndClear()); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG 74Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (2)
151Debug.Assert(e.InnerException is object); 153Debug.Assert(false, "Unreachable");
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\roslyn\src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
85Debug.Assert(false, message);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\roslyn\src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\roslyn\src\Dependencies\Collections\Internal\ArraySortHelper.cs (44)
67Debug.Assert(comparer != null, "Check the arguments in the caller!"); 86Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 343Debug.Assert(index >= 0 && length >= 0 && (array.Length - index >= length), "Check the arguments in the caller!"); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\roslyn\src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\roslyn\src\Dependencies\Collections\Internal\HashHelpers.cs (3)
91Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); 113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\roslyn\src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
156Debug.Assert(segmentSize == 1 || (segmentSize & (segmentSize - 1)) == 0, "Expected size of 1, or a power of 2");
src\roslyn\src\Dependencies\Collections\Internal\ThrowHelper.cs (2)
293Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); 331Debug.Fail("The enum value is not defined, please check the ExceptionResource Enum.");
src\roslyn\src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\roslyn\src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (6)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length); 491Debug.Assert(offset == (_secondOffset & SegmentedArrayHelper.GetOffsetMask<T>()), "Aligned views must start at the same segment offset");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 302Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty"); 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 521Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 648Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 649Debug.Assert(newSize >= _entries.Length); 707Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 784Debug.Assert(_entries.Length > 0, "entries should be non-empty"); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count); 204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty"); 205Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized"); 258Debug.Assert(comparer is not null); 296Debug.Assert(entries.Length > 0, "entries should be non-empty"); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646"); 901Debug.Assert(_entries.Length > 0, "_entries should be non-empty"); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty"); 1063Debug.Assert(comparer is not null); 1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow"); 1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first"); 1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\roslyn\src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\roslyn\src\Dependencies\Contracts\ErrorReporting\FatalError.cs (1)
51Debug.Assert(s_handler == null, "Handler already set");
src\roslyn\src\Dependencies\Contracts\ExceptionUtilities.cs (1)
24Debug.Assert(false, output);
src\roslyn\src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
521Debug.Assert(builder.Count == 0); 676Debug.Assert(start >= 0 && length >= 0); 677Debug.Assert(start + length <= items.Count); 704Debug.Assert(start >= 0 && length >= 0); 705Debug.Assert(start + length <= items.Length); 719Debug.Assert(start >= 0 && length >= 0); 720Debug.Assert(start + length <= items.Length); 744Debug.Assert(limit <= Count);
src\roslyn\src\Dependencies\PooledObjects\ObjectPool`1.cs (5)
95Debug.Assert(size >= 1); 112Debug.Assert(size >= 1); 250Debug.Assert(obj != null, "freeing null?"); 252Debug.Assert(_firstItem != obj, "freeing twice?"); 263Debug.Assert(value != obj, "freeing twice?");
src\roslyn\src\Dependencies\PooledObjects\PooledDictionary.cs (1)
71Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledHashSet.cs (1)
60Debug.Assert(instance.Count == 0);
src\roslyn\src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
34Debug.Assert(pool != null); 108Debug.Assert(builder.Builder.Length == 0);
src\roslyn\src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\roslyn\src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (11)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 488Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 495Debug.Assert(_lock is not null, "Should only be invoked when _lock is non-null"); 528Debug.Assert(_completionRefCount == 0, $"Expected {nameof(_completionRefCount)} == 0, got {_completionRefCount}"); 540Debug.Assert(!Cancellation.IsCancellationRequested); 556Debug.Assert(taskSet, "Complete should only be called once.");
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
26Debug.Assert(childrenCount != 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
495Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 507Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (7)
210Debug.Assert(isInsideAnonymousObjectInitializer == 288Debug.Assert(success); 289Debug.Assert(cfg != null); 320Debug.Assert(operation.Kind is OperationKind.None or OperationKind.Attribute, $"Unexpected root operation kind: {operation.Kind}"); 333Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 495Debug.Assert(parameterIndex >= 0); 496Debug.Assert(parameterIndex < arguments.Length);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
61Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (12)
80Debug.Assert(expectedValueText == actualValueText); 86Debug.Assert(currentVC.Span.Start >= token.SpanStart, "First span has to start after the start of the string token"); 90Debug.Assert(currentVC.Span.Start == token.SpanStart + 1 || 99Debug.Assert(currentVC.Span.End <= nextVC.Span.Start, "Virtual character spans have to be ordered."); 108Debug.Assert(currentVC.Span.End == nextVC.Span.Start, "Virtual character spans have to be touching."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 147Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics."); 153Debug.Assert(false, "This should not be reachable as long as the compiler added no diagnostics.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (4)
100Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 101Debug.Assert(_span.End == virtualChars._span.Start); 111Debug.Assert(chars1._leafCharacters == chars2._leafCharacters); 175Debug.Assert(chars1._tokenStart == chars2._tokenStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
119Debug.Fail("Unhandled declaration pattern context"); 153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (2)
248Debug.Fail("Could not find common ancestor."); 271Debug.Fail("Could not find common ancestor.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 216Debug.Assert(branch.Destination == null); 221Debug.Assert(branch.Destination == null); 227Debug.Assert(branch.Destination != null); 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 262Debug.Assert(enclosing.NestedRegions[0] == region); 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 325Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 337Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 375Debug.Assert(startAt > 0); 376Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 391Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\LValueFlowCaptureProvider.cs (1)
76Debug.Assert(kind == FlowCaptureKind.LValueAndRValueCapture || !rvalueFlowCaptureIds.Contains(captureId), "Flow capture used as both an r-value and an l-value, but with incorrect flow capture kind");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (1)
411Debug.Assert(s_serializationVersion == 5, "After increasing the serialization version, add an upgrade path here.");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (5)
92Debug.Assert(BitConverter.IsLittleEndian); 185Debug.Assert(value == null || !value.GetType().GetTypeInfo().IsEnum, "Enum should not be written with WriteValue. Write them as ints instead."); 195Debug.Assert(!typeInfo.IsEnum, "Enums should not be written with WriteObject. Write them out as integers instead."); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (18)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1072Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1073Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1157Debug.Assert(parameter1.HasExplicitDefaultValue, "Expected all unspecified parameter to have default values"); 1158Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\LightweightOverloadResolution.cs (3)
114Debug.Assert(foundParameterIndex < parameters.Length); 239Debug.Assert(parameterIndex >= 0); 240Debug.Assert(parameterIndex < method.Parameters.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (4)
34Debug.Assert(span.Start >= start, "Bad generator."); 86Debug.Assert(current < length); 108Debug.Assert(current < length); 127Debug.Assert(char.IsUpper(identifier[current - 1]));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
155Debug.Assert(similarityWeight <= _threshold);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
342Debug.Assert(type is null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
53Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 58Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
26Debug.Fail("Unhandled symbol kind in RequiresUnsafeModifierVisitor: " + node.Kind);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
540Debug.Assert(isTypeParameter2);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.Scripting (64)
Hosting\AssemblyLoader\MetadataShadowCopy.cs (2)
34Debug.Assert(primaryModule != null); 35Debug.Assert(metadataCopy != null);
Hosting\AssemblyLoader\MetadataShadowCopyProvider.cs (5)
42Debug.Assert(@public != null); 43Debug.Assert(@private != null); 583Debug.Assert(assemblyDirectory != null); 584Debug.Assert(assemblyFileName != null); 585Debug.Assert(culture != null);
Hosting\AssemblyLoader\ShadowCopy.cs (3)
27Debug.Assert(stream != null); 28Debug.Assert(originalPath != null); 29Debug.Assert(fullPath != null);
Hosting\CommandLine\CommandLineRunner.cs (7)
34Debug.Assert(console != null); 35Debug.Assert(compiler != null); 36Debug.Assert(scriptCompiler != null); 37Debug.Assert(objectFormatter != null); 76Debug.Assert(Compiler.Arguments.IsScriptRunner); 138Debug.Assert(scriptOptions is not null); 366Debug.Assert(text != null);
Hosting\CommandLine\ConsoleIO.cs (2)
23Debug.Assert(output != null); 24Debug.Assert(input != null);
Hosting\InteractiveScriptGlobals.cs (2)
59Debug.Assert(outputWriter != null); 60Debug.Assert(objectFormatter != null);
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.cs (2)
327Debug.Assert(obj != null); 644Debug.Assert(array.Rank > 1);
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.FormattedMember.cs (1)
28Debug.Assert((name != null) || (index >= 0));
Hosting\ObjectFormatter\ObjectFormatterHelpers.cs (2)
277Debug.Assert(type != null); 410Debug.Assert(str != null && start >= 0 && end >= start);
Hosting\Resolvers\NuGetPackageResolver.cs (1)
25Debug.Assert(parts.Length > 0);
Hosting\Resolvers\RuntimeMetadataReferenceResolver.cs (1)
149Debug.Assert(!paths.IsDefault);
Script.cs (5)
41Debug.Assert(sourceText != null); 42Debug.Assert(options != null); 43Debug.Assert(compiler != null); 44Debug.Assert(builder != null); 403Debug.Assert(!preceding.IsDefault);
ScriptBuilder.cs (1)
62Debug.Assert(assemblyLoader != null);
ScriptExecutionState.cs (3)
63Debug.Assert(index >= 0 && index < SubmissionStateCount); 74Debug.Assert(_frozen == 0); 75Debug.Assert((exceptionHolderOpt != null) == (catchExceptionOpt != null));
ScriptOptions.cs (5)
160Debug.Assert(filePath != null); 161Debug.Assert(!references.IsDefault); 162Debug.Assert(!namespaces.IsDefault); 163Debug.Assert(metadataResolver != null); 164Debug.Assert(sourceResolver != null);
ScriptState.cs (3)
44Debug.Assert(executionState != null); 45Debug.Assert(script != null); 104Debug.Assert(state != null);
ScriptVariable.cs (2)
24Debug.Assert(instance != null); 25Debug.Assert(field != null);
src\roslyn\src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\roslyn\src\Compilers\Shared\GlobalAssemblyCacheHelpers\ClrGlobalAssemblyCache.cs (3)
249Debug.Assert(info.pszCurrentAssemblyPathBuf != null); 250Debug.Assert(info.pszCurrentAssemblyPathBuf[info.cchBuf - 1] == '\0'); 253Debug.Assert(result.IndexOf('\0') == -1);
src\roslyn\src\Compilers\Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs (10)
203Debug.Assert(propertyId == PropertyId.NULL_PUBLIC_KEY_TOKEN || propertyId == PropertyId.NULL_PUBLIC_KEY); 215Debug.Assert(hr == FUSION_E_INVALID_NAME); 345Debug.Assert(data.IndexOf('\0') == -1); 349Debug.Assert(p[data.Length] == '\0'); 507Debug.Assert(displayName != null); 515Debug.Assert(result != null); 533Debug.Assert(candidateVersion != null); 538Debug.Assert(bestVersion != null); 547Debug.Assert(candidateCulture != null); 552Debug.Assert(bestCulture != null);
Microsoft.CodeAnalysis.VisualBasic (1124)
Analysis\Analyzer.vb (1)
26Debug.Assert(diagnostics IsNot Nothing)
Analysis\FlowAnalysis\AbstractFlowPass.Regions.vb (3)
54Debug.Assert(Me._firstInRegion IsNot Nothing) 65Debug.Assert(Me._regionPlace = RegionPlace.Before) 73Debug.Assert(IsInside)
Analysis\FlowAnalysis\DataFlowPass.LocalState.vb (1)
102Debug.Assert(Not assigned.IsNull)
Analysis\FlowAnalysis\DataFlowPass.VariableIdentifier.vb (2)
24Debug.Assert(symbol IsNot Nothing) 48Debug.Assert(obj IsNot Nothing)
Analysis\FlowAnalysis\FlowAnalysisInfo.vb (5)
25Debug.Assert(_compilation IsNot Nothing) 26Debug.Assert(_symbol IsNot Nothing) 27Debug.Assert(_node IsNot Nothing) 48Debug.Assert(_firstInRegion IsNot Nothing) 49Debug.Assert(_lastInRegion IsNot Nothing)
Analysis\FlowAnalysis\ReadWriteWalker.vb (1)
202Debug.Assert(node.RangeVariables.Length = 1)
Binding\BlockBaseBinder.vb (1)
46Debug.Assert(Not locals.IsEmpty)
BoundTree\BoundExpressionExtensions.vb (12)
151Debug.Assert(node.IsSupportingAssignment()) 288Debug.Assert(Not propertyAccess.PropertySymbol.ReturnsByRef OrElse (newAccessKind And PropertyAccessKind.Set) = 0) 371Debug.Assert(node.Value.IsBad OrElse node.Type.IsValidForConstantValue(node.Value)) 410Debug.Assert(expression IsNot Nothing) 423Debug.Assert(expression IsNot Nothing) 459Debug.Assert(type IsNot Nothing OrElse node.Kind = BoundKind.Literal OrElse node.Kind = BoundKind.Parenthesized) 474Debug.Assert(node.Type Is Nothing) 637Debug.Assert(node.IsValue) 638Debug.Assert(Not node.IsLValue) 639Debug.Assert(Not node.IsPropertyOrXmlPropertyAccess() OrElse node.GetAccessKind() = PropertyAccessKind.Get) 640Debug.Assert(Not node.IsLateBound() OrElse node.GetLateBoundAccessKind() = LateBoundAccessKind.Get) 641Debug.Assert(If(node.Type Is Nothing,
BoundTree\BoundLateInvocation.vb (4)
18Debug.Assert(newAccessKind = LateBoundAccessKind.Unknown OrElse 33Debug.Assert((AccessKind And LateBoundAccessKind.Call) = 0 OrElse (AccessKind And Not LateBoundAccessKind.Call) = 0) 36Debug.Assert(DirectCast(Member, BoundLateMemberAccess).AccessKind = Me.AccessKind) 39Debug.Assert(Type.IsObjectType())
BoundTree\BoundNewT.vb (1)
16Debug.Assert(Type.TypeKind = TypeKind.TypeParameter)
BoundTree\BoundSequence.vb (5)
16Debug.Assert(Me.ValueOpt IsNot Nothing OrElse Me.HasErrors OrElse Me.Type.SpecialType = SpecialType.System_Void) 27Debug.Assert(Me.ValueOpt IsNot Nothing) 37Debug.Assert(Type.IsVoidType()) 39Debug.Assert(Type.IsSameTypeIgnoringAll(ValueOpt.Type)) 47Debug.Assert(val.IsValue AndAlso Not val.IsLValue AndAlso val.Type IsNot Nothing)
BoundTree\BoundTypeOrValueExpression.vb (2)
45Debug.Assert(valueExpression IsNot Nothing, "Field 'valueExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 46Debug.Assert(typeExpression IsNot Nothing, "Field 'typeExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)")
CodeGen\ResumableStateMachineStateAllocator.vb (4)
47Debug.Assert(SyntaxBindingUtilities.BindsToResumableStateMachineState(awaitOrYieldReturnSyntax)) 55Debug.Assert(Not _matchedStates(state * direction)) 77Debug.Assert(f.CompilationState IsNot Nothing) 78Debug.Assert(f.CompilationState.ModuleBuilderOpt IsNot Nothing)
CommandLine\VisualBasicCommandLineArguments.vb (1)
116Debug.Assert(diagnostics Is Nothing OrElse diagnostics.Any())
Compilation\DocumentationComments\DocumentationCommentCompiler.Namespace.vb (2)
30Debug.Assert(Me._assemblyName IsNot Nothing) 50Debug.Assert(Not Me._isForSingleSymbol, "Do not expect a doc comment query for a single namespace")
Compilation\DocumentationComments\DocumentationCommentWalker.vb (6)
46Debug.Assert(symbol IsNot Nothing) 47Debug.Assert(syntaxTree IsNot Nothing) 48Debug.Assert(diagnostics IsNot Nothing) 59Debug.Assert(node IsNot Nothing) 60Debug.Assert(name IsNot Nothing) 148Debug.Assert(Not reference.ContainsDiagnostics)
Compilation\DocumentationComments\DocWriter.vb (4)
55Debug.Assert(Me._indentDepth >= 0) 108Debug.Assert(Me._indentDepth = t.InitialIndentDepth, 118Debug.Assert(depth >= 0) 129Debug.Assert(False, "Didn't expect nesting to reach depth " & depth)
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (2)
35Debug.Assert(diagnostics IsNot Nothing) 142Debug.Assert(parent IsNot Nothing)
Compilation\LookupSymbolsInfo.vb (1)
30Debug.Assert(info.Count = 0)
Declarations\SingleNamespaceDeclaration.vb (1)
84Debug.Assert(Not singleDeclarations.IsEmpty)
Generated\BoundNodes.xml.Generated.vb (427)
225Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 233Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 294Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 301Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 313Debug.Assert(underlyingLValue IsNot Nothing, "Field 'underlyingLValue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 314Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 353Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 360Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 372Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 379Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 391Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 398Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 424Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 431Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 457Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 469Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 497Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 509Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 573Debug.Assert(Not (symbols.IsDefault), "Field 'symbols' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 574Debug.Assert(Not (childBoundNodes.IsDefault), "Field 'childBoundNodes' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 629Debug.Assert(Not (childBoundNodes.IsDefault), "Field 'childBoundNodes' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 663Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 702Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 744Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 745Debug.Assert(Not (indices.IsDefault), "Field 'indices' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 746Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 801Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 802Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 836Debug.Assert(sourceType IsNot Nothing, "Field 'sourceType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 837Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 879Debug.Assert(field IsNot Nothing, "Field 'field' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 880Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 888Debug.Assert(field IsNot Nothing, "Field 'field' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 889Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 923Debug.Assert(method IsNot Nothing, "Field 'method' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 924Debug.Assert(getMethodFromHandle IsNot Nothing, "Field 'getMethodFromHandle' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 925Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 934Debug.Assert(method IsNot Nothing, "Field 'method' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 935Debug.Assert(getMethodFromHandle IsNot Nothing, "Field 'getMethodFromHandle' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 936Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 978Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1020Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1028Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1062Debug.Assert(namespaceSymbol IsNot Nothing, "Field 'namespaceSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1117Debug.Assert(method IsNot Nothing, "Field 'method' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1118Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1131Debug.Assert(method IsNot Nothing, "Field 'method' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1132Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1168Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1175Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1201Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1210Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1252Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1260Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1294Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1301Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1327Debug.Assert(document IsNot Nothing, "Field 'document' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1328Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1336Debug.Assert(document IsNot Nothing, "Field 'document' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1337Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1371Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1372Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1435Debug.Assert(underlyingExpression IsNot Nothing, "Field 'underlyingExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1436Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1483Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1484Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1523Debug.Assert(left IsNot Nothing, "Field 'left' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1524Debug.Assert(right IsNot Nothing, "Field 'right' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1525Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1596Debug.Assert(underlyingExpression IsNot Nothing, "Field 'underlyingExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1597Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1652Debug.Assert(bitwiseOperator IsNot Nothing, "Field 'bitwiseOperator' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1653Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1716Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1723Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1749Debug.Assert(left IsNot Nothing, "Field 'left' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1750Debug.Assert(right IsNot Nothing, "Field 'right' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1751Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1814Debug.Assert(byRefLocal IsNot Nothing, "Field 'byRefLocal' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1815Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1870Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1871Debug.Assert(methodGroup IsNot Nothing, "Field 'methodGroup' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1921Debug.Assert(condition IsNot Nothing, "Field 'condition' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1922Debug.Assert(whenTrue IsNot Nothing, "Field 'whenTrue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1923Debug.Assert(whenFalse IsNot Nothing, "Field 'whenFalse' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1924Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1987Debug.Assert(testExpression IsNot Nothing, "Field 'testExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1988Debug.Assert(elseExpression IsNot Nothing, "Field 'elseExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 1989Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2060Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2067Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2079Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2080Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2172Debug.Assert(lambda IsNot Nothing, "Field 'lambda' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2214Debug.Assert(Not (elementPlaceholders.IsDefault), "Field 'elementPlaceholders' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2215Debug.Assert(Not (convertedElements.IsDefault), "Field 'convertedElements' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2262Debug.Assert(underlyingExpression IsNot Nothing, "Field 'underlyingExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2263Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2310Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2311Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2382Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2383Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2446Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2447Debug.Assert(targetType IsNot Nothing, "Field 'targetType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2448Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2542Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2676Debug.Assert(Not (methods.IsDefault), "Field 'methods' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2734Debug.Assert(Not (properties.IsDefault), "Field 'properties' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2828Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2898Debug.Assert(Not (clauses.IsDefault), "Field 'clauses' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2932Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2933Debug.Assert(Not (indices.IsDefault), "Field 'indices' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 2996Debug.Assert(Not (clauses.IsDefault), "Field 'clauses' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3030Debug.Assert(method IsNot Nothing, "Field 'method' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3031Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3032Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3127Debug.Assert(Not (constructorArguments.IsDefault), "Field 'constructorArguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3128Debug.Assert(Not (namedArguments.IsDefault), "Field 'namedArguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3129Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3195Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3266Debug.Assert(member IsNot Nothing, "Field 'member' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3267Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3338Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3339Debug.Assert(memberAccess IsNot Nothing, "Field 'memberAccess' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3381Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3401Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3451Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3452Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3486Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3511Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3512Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3575Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3609Debug.Assert(Not (declarations.IsDefault), "Field 'declarations' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3610Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3660Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3669Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3711Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3712Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3754Debug.Assert(Not (initializers.IsDefault), "Field 'initializers' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3782Debug.Assert(Not (initializers.IsDefault), "Field 'initializers' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3821Debug.Assert(Not (initializers.IsDefault), "Field 'initializers' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3852Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3883Debug.Assert(method IsNot Nothing, "Field 'method' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3884Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3950Debug.Assert(Not (bounds.IsDefault), "Field 'bounds' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 3951Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4022Debug.Assert(inferredType IsNot Nothing, "Field 'inferredType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4023Debug.Assert(Not (bounds.IsDefault), "Field 'bounds' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4024Debug.Assert(initializer IsNot Nothing, "Field 'initializer' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4025Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4099Debug.Assert(Not (initializers.IsDefault), "Field 'initializers' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4133Debug.Assert(fieldSymbol IsNot Nothing, "Field 'fieldSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4134Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4205Debug.Assert(propertySymbol IsNot Nothing, "Field 'propertySymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4206Debug.Assert(Not (arguments.IsDefault), "Field 'arguments' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4207Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4302Debug.Assert(eventSymbol IsNot Nothing, "Field 'eventSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4303Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4345Debug.Assert(Not (locals.IsDefault), "Field 'locals' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4346Debug.Assert(Not (statements.IsDefault), "Field 'statements' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4396Debug.Assert(Not (fields.IsDefault), "Field 'fields' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4397Debug.Assert(statement IsNot Nothing, "Field 'statement' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4452Debug.Assert(localSymbol IsNot Nothing, "Field 'localSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4515Debug.Assert(Not (localDeclarations.IsDefault), "Field 'localDeclarations' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4516Debug.Assert(initializer IsNot Nothing, "Field 'initializer' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4517Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4567Debug.Assert(Not (localDeclarations.IsDefault), "Field 'localDeclarations' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4635Debug.Assert(initialValue IsNot Nothing, "Field 'initialValue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4671Debug.Assert(Not (initializedFields.IsDefault), "Field 'initializedFields' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4672Debug.Assert(initialValue IsNot Nothing, "Field 'initialValue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4706Debug.Assert(Not (initializedProperties.IsDefault), "Field 'initializedProperties' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4707Debug.Assert(initialValue IsNot Nothing, "Field 'initialValue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4741Debug.Assert(parameter IsNot Nothing, "Field 'parameter' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4742Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4784Debug.Assert(statement IsNot Nothing, "Field 'statement' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4818Debug.Assert(Not (locals.IsDefault), "Field 'locals' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4819Debug.Assert(Not (sideEffects.IsDefault), "Field 'sideEffects' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4820Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4875Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4909Debug.Assert(condition IsNot Nothing, "Field 'condition' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4910Debug.Assert(consequence IsNot Nothing, "Field 'consequence' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4960Debug.Assert(expressionStatement IsNot Nothing, "Field 'expressionStatement' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4961Debug.Assert(Not (caseBlocks.IsDefault), "Field 'caseBlocks' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 4962Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5028Debug.Assert(caseStatement IsNot Nothing, "Field 'caseStatement' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5029Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5071Debug.Assert(Not (caseClauses.IsDefault), "Field 'caseClauses' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5275Debug.Assert(continueLabel IsNot Nothing, "Field 'continueLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5276Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5285Debug.Assert(continueLabel IsNot Nothing, "Field 'continueLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5286Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5314Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5315Debug.Assert(continueLabel IsNot Nothing, "Field 'continueLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5316Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5382Debug.Assert(condition IsNot Nothing, "Field 'condition' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5383Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5384Debug.Assert(continueLabel IsNot Nothing, "Field 'continueLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5385Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5427Debug.Assert(controlVariable IsNot Nothing, "Field 'controlVariable' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5428Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5429Debug.Assert(continueLabel IsNot Nothing, "Field 'continueLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5430Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5474Debug.Assert(leftOperandPlaceholder IsNot Nothing, "Field 'leftOperandPlaceholder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5475Debug.Assert(rightOperandPlaceholder IsNot Nothing, "Field 'rightOperandPlaceholder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5476Debug.Assert(addition IsNot Nothing, "Field 'addition' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5477Debug.Assert(subtraction IsNot Nothing, "Field 'subtraction' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5478Debug.Assert(lessThanOrEqual IsNot Nothing, "Field 'lessThanOrEqual' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5479Debug.Assert(greaterThanOrEqual IsNot Nothing, "Field 'greaterThanOrEqual' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5558Debug.Assert(initialValue IsNot Nothing, "Field 'initialValue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5559Debug.Assert(limitValue IsNot Nothing, "Field 'limitValue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5560Debug.Assert(stepValue IsNot Nothing, "Field 'stepValue' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5561Debug.Assert(controlVariable IsNot Nothing, "Field 'controlVariable' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5562Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5563Debug.Assert(continueLabel IsNot Nothing, "Field 'continueLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5564Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5630Debug.Assert(collection IsNot Nothing, "Field 'collection' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5631Debug.Assert(enumeratorInfo IsNot Nothing, "Field 'enumeratorInfo' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5632Debug.Assert(controlVariable IsNot Nothing, "Field 'controlVariable' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5633Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5634Debug.Assert(continueLabel IsNot Nothing, "Field 'continueLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5635Debug.Assert(exitLabel IsNot Nothing, "Field 'exitLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5677Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5685Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5719Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5727Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5761Debug.Assert(tryBlock IsNot Nothing, "Field 'tryBlock' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5762Debug.Assert(Not (catchBlocks.IsDefault), "Field 'catchBlocks' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5820Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5894Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5907Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5943Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5950Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5976Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 5988Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6016Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6023Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6049Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6056Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6082Debug.Assert(sourceType IsNot Nothing, "Field 'sourceType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6083Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6091Debug.Assert(sourceType IsNot Nothing, "Field 'sourceType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6092Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6126Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6133Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6159Debug.Assert(localSymbol IsNot Nothing, "Field 'localSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6160Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6174Debug.Assert(localSymbol IsNot Nothing, "Field 'localSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6175Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6219Debug.Assert(localSymbol IsNot Nothing, "Field 'localSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6220Debug.Assert(emitExpressions IsNot Nothing, "Field 'emitExpressions' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6221Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6236Debug.Assert(localSymbol IsNot Nothing, "Field 'localSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6237Debug.Assert(emitExpressions IsNot Nothing, "Field 'emitExpressions' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6238Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6290Debug.Assert(parameterSymbol IsNot Nothing, "Field 'parameterSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6291Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6301Debug.Assert(parameterSymbol IsNot Nothing, "Field 'parameterSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6302Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6352Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6360Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6394Debug.Assert(originalArgument IsNot Nothing, "Field 'originalArgument' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6395Debug.Assert(inConversion IsNot Nothing, "Field 'inConversion' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6396Debug.Assert(inPlaceholder IsNot Nothing, "Field 'inPlaceholder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6397Debug.Assert(outConversion IsNot Nothing, "Field 'outConversion' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6398Debug.Assert(outPlaceholder IsNot Nothing, "Field 'outPlaceholder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6469Debug.Assert(originalArgument IsNot Nothing, "Field 'originalArgument' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6470Debug.Assert(localSymbol IsNot Nothing, "Field 'localSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6517Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6525Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6559Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6567Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6601Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6643Debug.Assert(Not (statements.IsDefault), "Field 'statements' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6677Debug.Assert(condition IsNot Nothing, "Field 'condition' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6678Debug.Assert(label IsNot Nothing, "Field 'label' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6728Debug.Assert(originalExpression IsNot Nothing, "Field 'originalExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6729Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6730Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6780Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6781Debug.Assert(Not (parameters.IsDefault), "Field 'parameters' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6782Debug.Assert(bindingCache IsNot Nothing, "Field 'bindingCache' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6799Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6800Debug.Assert(Not (parameters.IsDefault), "Field 'parameters' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6801Debug.Assert(bindingCache IsNot Nothing, "Field 'bindingCache' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6869Debug.Assert(lambdaSymbol IsNot Nothing, "Field 'lambdaSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6870Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6949Debug.Assert(lastOperator IsNot Nothing, "Field 'lastOperator' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6950Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6984Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 6991Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7003Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7004Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7038Debug.Assert(conversionCall IsNot Nothing, "Field 'conversionCall' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7039Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7073Debug.Assert(Not (rangeVariables.IsDefault), "Field 'rangeVariables' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7074Debug.Assert(compoundVariableType IsNot Nothing, "Field 'compoundVariableType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7075Debug.Assert(Not (binders.IsDefault), "Field 'binders' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7076Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7086Debug.Assert(Not (rangeVariables.IsDefault), "Field 'rangeVariables' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7087Debug.Assert(compoundVariableType IsNot Nothing, "Field 'compoundVariableType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7088Debug.Assert(Not (binders.IsDefault), "Field 'binders' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7089Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7125Debug.Assert(source IsNot Nothing, "Field 'source' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7126Debug.Assert(Not (rangeVariables.IsDefault), "Field 'rangeVariables' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7127Debug.Assert(compoundVariableType IsNot Nothing, "Field 'compoundVariableType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7128Debug.Assert(Not (binders.IsDefault), "Field 'binders' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7129Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7176Debug.Assert(underlyingExpression IsNot Nothing, "Field 'underlyingExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7177Debug.Assert(Not (rangeVariables.IsDefault), "Field 'rangeVariables' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7178Debug.Assert(compoundVariableType IsNot Nothing, "Field 'compoundVariableType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7179Debug.Assert(Not (binders.IsDefault), "Field 'binders' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7180Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7214Debug.Assert(underlyingExpression IsNot Nothing, "Field 'underlyingExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7215Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7249Debug.Assert(lambdaSymbol IsNot Nothing, "Field 'lambdaSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7250Debug.Assert(Not (rangeVariables.IsDefault), "Field 'rangeVariables' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7251Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7309Debug.Assert(rangeVariable IsNot Nothing, "Field 'rangeVariable' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7310Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7311Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7353Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7354Debug.Assert(Not (parameters.IsDefault), "Field 'parameters' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7355Debug.Assert(compilation IsNot Nothing, "Field 'compilation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7365Debug.Assert(binder IsNot Nothing, "Field 'binder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7366Debug.Assert(Not (parameters.IsDefault), "Field 'parameters' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7367Debug.Assert(compilation IsNot Nothing, "Field 'compilation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7417Debug.Assert(underlyingExpression IsNot Nothing, "Field 'underlyingExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7418Debug.Assert(Not (rangeVariables.IsDefault), "Field 'rangeVariables' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7419Debug.Assert(compoundVariableType IsNot Nothing, "Field 'compoundVariableType' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7420Debug.Assert(Not (binders.IsDefault), "Field 'binders' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7421Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7471Debug.Assert(group IsNot Nothing, "Field 'group' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7472Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7506Debug.Assert(rangeVariable IsNot Nothing, "Field 'rangeVariable' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7507Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7515Debug.Assert(rangeVariable IsNot Nothing, "Field 'rangeVariable' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7516Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7550Debug.Assert(eventAccess IsNot Nothing, "Field 'eventAccess' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7551Debug.Assert(handler IsNot Nothing, "Field 'handler' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7579Debug.Assert(eventAccess IsNot Nothing, "Field 'eventAccess' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7580Debug.Assert(handler IsNot Nothing, "Field 'handler' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7606Debug.Assert(eventAccess IsNot Nothing, "Field 'eventAccess' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7607Debug.Assert(handler IsNot Nothing, "Field 'handler' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7633Debug.Assert(eventSymbol IsNot Nothing, "Field 'eventSymbol' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7634Debug.Assert(eventInvocation IsNot Nothing, "Field 'eventInvocation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7676Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7677Debug.Assert(usingInfo IsNot Nothing, "Field 'usingInfo' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7678Debug.Assert(Not (locals.IsDefault), "Field 'locals' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7744Debug.Assert(lockExpression IsNot Nothing, "Field 'lockExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7745Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7787Debug.Assert(xmlNamespace IsNot Nothing, "Field 'xmlNamespace' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7788Debug.Assert(localName IsNot Nothing, "Field 'localName' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7789Debug.Assert(objectCreation IsNot Nothing, "Field 'objectCreation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7790Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7840Debug.Assert(xmlNamespace IsNot Nothing, "Field 'xmlNamespace' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7841Debug.Assert(objectCreation IsNot Nothing, "Field 'objectCreation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7842Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7884Debug.Assert(declaration IsNot Nothing, "Field 'declaration' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7885Debug.Assert(Not (childNodes.IsDefault), "Field 'childNodes' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7886Debug.Assert(rewriterInfo IsNot Nothing, "Field 'rewriterInfo' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7887Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7937Debug.Assert(objectCreation IsNot Nothing, "Field 'objectCreation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7938Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7996Debug.Assert(target IsNot Nothing, "Field 'target' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7997Debug.Assert(data IsNot Nothing, "Field 'data' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7998Debug.Assert(objectCreation IsNot Nothing, "Field 'objectCreation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 7999Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8049Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8050Debug.Assert(objectCreation IsNot Nothing, "Field 'objectCreation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8051Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8093Debug.Assert(name IsNot Nothing, "Field 'name' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8094Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8095Debug.Assert(objectCreation IsNot Nothing, "Field 'objectCreation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8096Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8159Debug.Assert(argument IsNot Nothing, "Field 'argument' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8160Debug.Assert(Not (childNodes.IsDefault), "Field 'childNodes' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8161Debug.Assert(rewriterInfo IsNot Nothing, "Field 'rewriterInfo' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8162Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8212Debug.Assert(memberAccess IsNot Nothing, "Field 'memberAccess' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8213Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8247Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8248Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8282Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8283Debug.Assert(objectCreation IsNot Nothing, "Field 'objectCreation' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8284Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8430Debug.Assert(body IsNot Nothing, "Field 'body' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8501Debug.Assert(activeHandlerLocal IsNot Nothing, "Field 'activeHandlerLocal' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8502Debug.Assert(resumeTargetLocal IsNot Nothing, "Field 'resumeTargetLocal' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8503Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8550Debug.Assert(value IsNot Nothing, "Field 'value' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8551Debug.Assert(Not (jumps.IsDefault), "Field 'jumps' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8598Debug.Assert(resumeTargetTemporary IsNot Nothing, "Field 'resumeTargetTemporary' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8599Debug.Assert(resumeLabel IsNot Nothing, "Field 'resumeLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8600Debug.Assert(resumeNextLabel IsNot Nothing, "Field 'resumeNextLabel' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8601Debug.Assert(Not (jumps.IsDefault), "Field 'jumps' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8664Debug.Assert(operand IsNot Nothing, "Field 'operand' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8665Debug.Assert(awaitableInstancePlaceholder IsNot Nothing, "Field 'awaitableInstancePlaceholder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8666Debug.Assert(getAwaiter IsNot Nothing, "Field 'getAwaiter' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8667Debug.Assert(awaiterInstancePlaceholder IsNot Nothing, "Field 'awaiterInstancePlaceholder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8668Debug.Assert(isCompleted IsNot Nothing, "Field 'isCompleted' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8669Debug.Assert(getResult IsNot Nothing, "Field 'getResult' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8670Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8749Debug.Assert(Not (locals.IsDefault), "Field 'locals' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8750Debug.Assert(Not (spillFields.IsDefault), "Field 'spillFields' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8751Debug.Assert(Not (statements.IsDefault), "Field 'statements' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8850Debug.Assert(original IsNot Nothing, "Field 'original' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8851Debug.Assert(start IsNot Nothing, "Field 'start' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8852Debug.Assert(source IsNot Nothing, "Field 'source' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8853Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8916Debug.Assert(receiver IsNot Nothing, "Field 'receiver' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8917Debug.Assert(placeholder IsNot Nothing, "Field 'placeholder' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8918Debug.Assert(accessExpression IsNot Nothing, "Field 'accessExpression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8968Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 8982Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9026Debug.Assert(receiver IsNot Nothing, "Field 'receiver' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9027Debug.Assert(whenNotNull IsNot Nothing, "Field 'whenNotNull' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9028Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9099Debug.Assert(valueTypeReceiver IsNot Nothing, "Field 'valueTypeReceiver' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9100Debug.Assert(referenceTypeReceiver IsNot Nothing, "Field 'referenceTypeReceiver' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9101Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9148Debug.Assert(argument IsNot Nothing, "Field 'argument' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9149Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9196Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9197Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9236Debug.Assert(Not (contents.IsDefault), "Field 'contents' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9237Debug.Assert(type IsNot Nothing, "Field 'type' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)") 9284Debug.Assert(expression IsNot Nothing, "Field 'expression' cannot be null (use Null=""allow"" in BoundNodes.xml to remove this check)")
Lowering\Diagnostics\DiagnosticsPass_ExpressionLambdas.vb (6)
69Debug.Assert(node.Declarations.All(Function(d) d.Kind = BoundKind.AnonymousTypePropertyAccess)) 117Debug.Assert(placeholder IsNot Nothing) 128Debug.Assert(assignment.LeftOnTheRightOpt Is Nothing) 297Debug.Assert(operand IsNot Nothing AndAlso 308Debug.Assert(Me.IsInExpressionLambda) 309Debug.Assert(lambda IsNot Nothing)
Lowering\Diagnostics\DiagnosticsPass.vb (5)
32Debug.Assert(node IsNot Nothing) 33Debug.Assert(containingSymbol IsNot Nothing) 138Debug.Assert(_containingSymbol.IsLambdaMethod) ' What else can it be? 174Debug.Assert(info.ExpressionPlaceholder IsNot Nothing) 211Debug.Assert(_expressionsBeingVisited.Peek Is node)
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter_ConditionalExpresion.vb (7)
126Debug.Assert(nullableType.IsNullableType) 185Debug.Assert((conversion.ConversionKind And ConversionKind.UserDefined) <> 0) 192Debug.Assert(outConv IsNot Nothing AndAlso 195Debug.Assert(TypeSymbol.Equals(method.ReturnType, callType, TypeCompareKind.ConsiderEverything)) 196Debug.Assert(TypeSymbol.Equals(toType, conversion.Type, TypeCompareKind.ConsiderEverything)) 200Debug.Assert(TypeSymbol.Equals(expectedParameterType.GetNullableUnderlyingTypeOrSelf, realParameterType.GetNullableUnderlyingTypeOrSelf, TypeCompareKind.ConsiderEverything)) 208Debug.Assert((innerConversion And ConversionKind.NarrowingNullable) = ConversionKind.NarrowingNullable)
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter_Conversion.vb (14)
25Debug.Assert(node.ExtendedInfoOpt Is Nothing) 34Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 43Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 66Debug.Assert(conversion = ConversionKind.WideningNothingLiteral OrElse 96Debug.Assert(semantics = ConversionSemantics.Default) 149Debug.Assert(semantics <> ConversionSemantics.TryCast) 159Debug.Assert(semantics <> ConversionSemantics.TryCast) 162Debug.Assert(Not TypeSymbol.Equals(interimType, typeTo, TypeCompareKind.ConsiderEverything)) 177Debug.Assert(semantics <> ConversionSemantics.TryCast) 187Debug.Assert(semantics <> ConversionSemantics.TryCast) 190Debug.Assert(Not TypeSymbol.Equals(interimType, typeTo, TypeCompareKind.ConsiderEverything)) 295Debug.Assert(semantics <> ConversionSemantics.TryCast) 367Debug.Assert(method.ParameterCount = 1) 393Debug.Assert(outerConversion.Type.IsSameTypeIgnoringAll(resultType))
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter_UnaryOperator.vb (7)
27Debug.Assert(TypeSymbol.Equals(origArgType, node.Type, TypeCompareKind.ConsiderEverything)) 34Debug.Assert((node.OperatorKind And UnaryOperatorKind.UserDefined) = 0) 117Debug.Assert(node.Type.IsBooleanType()) 118Debug.Assert(node.Operand.Type.IsNullableOfBoolean()) 155Debug.Assert(resultType.IsBooleanType) 156Debug.Assert(lambdaParameter.Type.IsNullableType) 189Debug.Assert(Not isLifted OrElse Not node.Call.Method.ReturnType.IsNullableType)
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter.vb (31)
137Debug.Assert(block.Statements(0).Kind <> BoundKind.SequencePoint) 138Debug.Assert(block.Statements.Length = 1 OrElse 147Debug.Assert(block.Locals.IsEmpty OrElse 176Debug.Assert(False) 308Debug.Assert(saveRecursionDepth = _recursionDepth) 331Debug.Assert(Not p.IsByRef, "DiagnosticsPass should have reported an error") 351Debug.Assert(Not node.LambdaSymbol.IsAsync AndAlso Not node.LambdaSymbol.IsIterator, 353Debug.Assert(node.WasCompilerGenerated OrElse node.IsSingleLine, 406Debug.Assert(origReceiverOpt IsNot Nothing OrElse fieldIsShared) 412Debug.Assert(origReceiverOpt IsNot Nothing) 433Debug.Assert(origReceiverOpt IsNot Nothing OrElse propertyIsShared) 439Debug.Assert(origReceiverOpt IsNot Nothing) 440Debug.Assert(origReceiverOpt.Kind <> BoundKind.MyBaseReference AndAlso origReceiverOpt.Kind <> BoundKind.MyClassReference) 456Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 457Debug.Assert(node.RelaxationReceiverPlaceholderOpt Is Nothing) 458Debug.Assert(node.MethodGroupOpt Is Nothing) 461Debug.Assert(delegateType.TypeKind = TYPEKIND.Delegate) 532Debug.Assert(arg.Type Is Me.Int32Type) 543Debug.Assert(expressions(i).Type Is Me.Int32Type) 585Debug.Assert(initializer.CreateTemporaryLocalForInitialization, 593Debug.Assert(initializers(i).Kind = BoundKind.AssignmentOperator) 596Debug.Assert(assignment.LeftOnTheRightOpt Is Nothing) 605Debug.Assert(DirectCast(assignment.Left, BoundPropertyAccess).AccessKind = PropertyAccessKind.Set) 611Debug.Assert(leftSymbol IsNot Nothing) 615Debug.Assert(initializer.PlaceholderOpt IsNot Nothing) 616Debug.Assert(Not BoundNodeFinder.ContainsNode(right, initializer.PlaceholderOpt, _recursionDepth, convertInsufficientExecutionStackExceptionToCancelledByStackGuardException:=True), "Should be addressed in DiagnosticsPass") 617Debug.Assert(leftSymbol.Kind = SymbolKind.Field OrElse leftSymbol.Kind = SymbolKind.Property) 642Debug.Assert(initializers(i).Kind = BoundKind.Call) 683Debug.Assert(properties.Length = node.Arguments.Length) 739Debug.Assert(arrayType.IsSZArray, "Not SZArray should be addressed in DiagnosticsPass") 790Debug.Assert(type.IsValueType)
Lowering\LambdaRewriter\LambdaRewriter.Analysis.vb (9)
138Debug.Assert(Not node.HasErrors) 254Debug.Assert(local.ContainingSymbol = Me._currentParent OrElse 301Debug.Assert(node.LambdaSymbol IsNot Nothing) 338Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 349Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 360Debug.Assert(conversion.ExtendedInfoOpt Is Nothing) 385Debug.Assert(DirectCast(variableOrParameter, ParameterSymbol).IsMe) 417Debug.Assert(container IsNot Nothing) 540Debug.Assert(False, "should not have nodes like this")
Lowering\LocalRewriter\LocalRewriter_AddRemoveHandler.vb (2)
198Debug.Assert(False, "All event accesses should be handled by AddHandler/RemoveHandler/RaiseEvent.") 252Debug.Assert(node.Kind = BoundKind.Parenthesized, "node can only be EventAccess or Parenthesized")
Lowering\LocalRewriter\LocalRewriter_AnonymousTypeCreationExpression.vb (2)
21Debug.Assert(fieldsCount > 0) 80Debug.Assert(local IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_AsNewLocalDeclarations.vb (4)
21Debug.Assert(localDeclaration.InitializerOpt Is Nothing) 53Debug.Assert(node.Syntax IsNot Nothing) 54Debug.Assert(node.Syntax.Kind = SyntaxKind.VariableDeclarator) 82Debug.Assert(objectInitializer.PlaceholderOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.vb (19)
27Debug.Assert(midResult.Original Is node.LeftOnTheRightOpt OrElse 42Debug.Assert((accessKind And PropertyAccessKind.Set) <> 0) 43Debug.Assert(((accessKind And PropertyAccessKind.Get) = 0) = (node.LeftOnTheRightOpt Is Nothing)) 51Debug.Assert(nodeLeft.Kind <> BoundKind.FieldAccess OrElse 78Debug.Assert(assignmentTarget.IsLValue) 91Debug.Assert(assignmentTarget Is setNode) 140Debug.Assert(node.LeftOnTheRightOpt Is Nothing) 155Debug.Assert(Not _rewrittenNodes.Contains(node), "LocalRewriter: Rewriting the same node several times.") 195Debug.Assert( 207Debug.Assert(setNode.AccessKind = PropertyAccessKind.Set) 216Debug.Assert(backingField IsNot Nothing, "autoproperty must have a backing field") 253Debug.Assert((accessKind And LateBoundAccessKind.Set) <> 0) 254Debug.Assert(((accessKind And LateBoundAccessKind.Get) = 0) = (node.LeftOnTheRightOpt Is Nothing)) 358Debug.Assert(nodeToCheck.ConstantValueOpt.IsNothing) 427Debug.Assert((conversionKind And ConversionKind.UserDefined) = 0) 462Debug.Assert(node.Left.IsLValue AndAlso node.LeftOnTheRightOpt IsNot Nothing AndAlso 465Debug.Assert(midResult.Type.IsStringType()) 499Debug.Assert(temporaries.IsDefault) 500Debug.Assert(copyBack.IsDefault)
Lowering\LocalRewriter\LocalRewriter_Block.vb (1)
43Debug.Assert(builder.Count < node.Locals.Length)
Lowering\LocalRewriter\LocalRewriter_Call.vb (7)
17Debug.Assert(Not node.IsConstant, "Constant calls should become literals by now") 200Debug.Assert(temporaries.IsDefault OrElse changed) 262Debug.Assert(originalArgument.GetAccessKind() = If( 268Debug.Assert(originalArgument.GetLateBoundAccessKind() = (LateBoundAccessKind.Get Or LateBoundAccessKind.Set)) 274Debug.Assert(originalArgument.GetAccessKind() = PropertyAccessKind.Unknown) 277Debug.Assert(originalArgument.GetLateBoundAccessKind() = LateBoundAccessKind.Unknown) 316Debug.Assert(secondUse.IsLValue)
Lowering\LocalRewriter\LocalRewriter_ConditionalAccess.vb (9)
33Debug.Assert(node.Type IsNot Nothing) 71Debug.Assert(newPlaceholderId <> 0) 107Debug.Assert(newPlaceholderId <> 0) 142Debug.Assert(needWhenNotNullPart OrElse needWhenNullPart) 148Debug.Assert(receiver Is Nothing) 149Debug.Assert(newPlaceHolder Is Nothing) 153Debug.Assert(receiver Is Nothing) 156Debug.Assert(receiver Is Nothing) 157Debug.Assert(node.Type.IsVoidType())
Lowering\LocalRewriter\LocalRewriter_DoLoop.vb (4)
16Debug.Assert(node IsNot Nothing) 30Debug.Assert(node.ConditionOpt IsNot Nothing AndAlso node.ConditionIsTop) 64Debug.Assert(node.ConditionOpt IsNot Nothing AndAlso Not node.ConditionIsTop) 148Debug.Assert(node.ConditionOpt Is Nothing)
Lowering\LocalRewriter\LocalRewriter_FieldOrPropertyInitializer.vb (4)
40Debug.Assert( 51Debug.Assert(_currentMethodOrLambda IsNot Nothing) 117Debug.Assert(node.MemberAccessExpressionOpt IsNot Nothing) 126Debug.Assert(objectInitializer.PlaceholderOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_ForEach.vb (8)
209Debug.Assert(collectionExpression.Type.SpecialType = SpecialType.System_String OrElse 359Debug.Assert(kind.IsLongLived()) 366Debug.Assert(expressionType.SpecialType <> SpecialType.System_Object) 397Debug.Assert(expressionType.SpecialType <> SpecialType.System_Object) 586Debug.Assert(enumeratorInfo.EnumeratorPlaceholder IsNot Nothing) 592Debug.Assert(enumeratorInfo.MoveNext.Type.SpecialType = SpecialType.System_Boolean) 670Debug.Assert(Not needTryFinally) 757Debug.Assert(rewrittenDisposeConversion IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_ForTo.vb (7)
37Debug.Assert(node.OperatorsOpt Is Nothing) 370Debug.Assert(initialConst.IsFloating) 416Debug.Assert(Compilation.GetSpecialType(SpecialType.System_Object) Is rewrittenControlVariable.Type) 454Debug.Assert(rewrittenInitCondition IsNot Nothing) 511Debug.Assert(rewrittenLoopCondition IsNot Nothing) 563Debug.Assert(controlVariable.IsLValue) 657Debug.Assert(operatorsOpt Is Nothing OrElse positiveFlag IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_HostObjectMemberReference.vb (2)
14Debug.Assert(_previousSubmissionFields IsNot Nothing) 15Debug.Assert(Not _topMethod.IsShared)
Lowering\LocalRewriter\LocalRewriter_LateAddressOf.vb (1)
36Debug.Assert(delegateInvoke.MethodKind = MethodKind.DelegateInvoke)
Lowering\LocalRewriter\LocalRewriter_LateInvocation.vb (3)
20Debug.Assert(node.Member IsNot Nothing, "late invocation always has a member that is invoked") 50Debug.Assert(invocation.AccessKind = LateBoundAccessKind.Get) 51Debug.Assert(receiverExpression.Kind <> BoundKind.LateMemberAccess)
Lowering\LocalRewriter\LocalRewriter_ObjectCreation.vb (12)
40Debug.Assert(result.Type.Equals(DirectCast(node.Type, NamedTypeSymbol).CoClassType)) 44Debug.Assert(Conversions.ConversionExists(conv)) 48Debug.Assert(node.Type.IsSameTypeIgnoringAll(result.Type)) 140Debug.Assert(method IsNot Nothing) 184Debug.Assert(node.PlaceholderOpt IsNot Nothing) 240Debug.Assert(tempLocalSymbol Is Nothing) 241Debug.Assert(tempLocal Is Nothing) 254Debug.Assert(tempLocalSymbol IsNot Nothing) 255Debug.Assert(tempLocal IsNot Nothing) 306Debug.Assert(node.PlaceholderOpt IsNot Nothing) 360Debug.Assert(assignment.LeftOnTheRightOpt Is Nothing) 418Debug.Assert(sequence.ValueOpt IsNot Nothing AndAlso sequence.ValueOpt.Kind = BoundKind.ObjectCreationExpression)
Lowering\LocalRewriter\LocalRewriter_OmittedArgument.vb (1)
15Debug.Assert(node.Type.IsObjectType)
Lowering\LocalRewriter\LocalRewriter_PreviousSubmissionReference.vb (3)
15Debug.Assert(targetType.TypeKind = TypeKind.Submission) 16Debug.Assert(Not _topMethod.IsShared) 17Debug.Assert(_previousSubmissionFields IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_Query.vb (4)
115Debug.Assert(IdentifierComparison.Equals(parameterName, nodeRangeVariables(firstUnmappedRangeVariable).Name)) 121Debug.Assert(firstUnmappedRangeVariable = nodeRangeVariables.Length) 167Debug.Assert(IdentifierComparison.Equals(propertyDefName, rangeVariables(firstUnmappedRangeVariable).Name)) 235Debug.Assert(node.GroupPlaceholderOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_RaiseEvent.vb (5)
30Debug.Assert(receiver.Kind = BoundKind.FieldAccess) 36Debug.Assert(fieldAccessReceiver Is Nothing OrElse 116Debug.Assert(fieldType.Name = "EventRegistrationTokenTable") 121Debug.Assert(getOrCreateMethod IsNot Nothing, "Checked during initial binding") 122Debug.Assert(TypeSymbol.Equals(getOrCreateMethod.ReturnType, fieldType.OriginalDefinition, TypeCompareKind.ConsiderEverything), "Shape of well-known member")
Lowering\LocalRewriter\LocalRewriter_RedimClause.vb (1)
18Debug.Assert(node.ArrayTypeOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_Return.vb (5)
16Debug.Assert(node.FunctionLocalOpt Is Nothing OrElse 48Debug.Assert(node.FunctionLocalOpt IsNot Nothing) 85Debug.Assert(node.FunctionLocalOpt Is Nothing) 108Debug.Assert(node.ExitLabelOpt Is Nothing) 109Debug.Assert(node.FunctionLocalOpt Is Nothing)
Lowering\LocalRewriter\LocalRewriter_SelectCase.vb (21)
102Debug.Assert(node.WasCompilerGenerated) 205Debug.Assert(statementBuilder IsNot Nothing) 206Debug.Assert(Not caseBlocks.IsDefault) 260Debug.Assert(startFrom <= caseBlocks.Length) 270Debug.Assert(generateUnstructuredExceptionHandlingResumeCode = ShouldGenerateUnstructuredExceptionHandlingResumeCode(curCaseBlock)) 285Debug.Assert(curCaseBlock.Syntax.Kind = SyntaxKind.CaseElseBlock) 286Debug.Assert(Not curCaseBlock.CaseStatement.CaseClauses.Any()) 289Debug.Assert(startFrom = caseBlocks.Length - 1) 298Debug.Assert(curCaseBlock.Syntax.Kind = SyntaxKind.CaseBlock) 325Debug.Assert(node.Syntax.Kind = SyntaxKind.CaseStatement) 326Debug.Assert(node.ConditionOpt IsNot Nothing) 333Debug.Assert(node.Syntax.Kind = SyntaxKind.CaseElseStatement) 341Debug.Assert(Not node.HasErrors) 342Debug.Assert(node.ExpressionStatement.Expression.Type.IsStringType) 343Debug.Assert(node.RecommendSwitchTable) 355Debug.Assert(simpleCaseClause.ValueOpt IsNot Nothing) 356Debug.Assert(simpleCaseClause.ConditionOpt Is Nothing) 363Debug.Assert(relationalCaseClause.OperatorKind = BinaryOperatorKind.Equals) 364Debug.Assert(relationalCaseClause.ValueOpt IsNot Nothing) 365Debug.Assert(relationalCaseClause.ConditionOpt Is Nothing) 373Debug.Assert(constant IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_StringConcat.vb (1)
36Debug.Assert(node.Type.IsStringType() AndAlso
Lowering\LocalRewriter\LocalRewriter_SyncLock.vb (2)
188Debug.Assert(tempLockTaken.Type.IsBooleanType()) 256Debug.Assert(boundLockTakenLocal.Type.IsBooleanType())
Lowering\LocalRewriter\LocalRewriter_Throw.vb (1)
23Debug.Assert(node.Syntax.Kind = SyntaxKind.ErrorStatement, "Must be an Error statement.")
Lowering\LocalRewriter\LocalRewriter_Try.vb (3)
16Debug.Assert(_unstructuredExceptionHandling.Context Is Nothing) 167Debug.Assert(_currentLineTemporary Is Nothing) 168Debug.Assert((Me._flags And RewritingFlags.AllowCatchWithErrorLineNumberReference) <> 0)
Lowering\LocalRewriter\LocalRewriter_UnaryOperators.vb (12)
18Debug.Assert(node.Operand.Type.IsNullableOfBoolean()) 49Debug.Assert((binary.OperatorKind And BinaryOperatorKind.Lifted) <> 0) 111Debug.Assert(node.Operand.Type.IsObjectType() AndAlso node.Type.IsObjectType()) 123Debug.Assert(opKind = UnaryOperatorKind.Not) 139Debug.Assert(node.Operand.Type.IsDecimalType() AndAlso node.Type.IsDecimalType()) 147Debug.Assert(opKind = UnaryOperatorKind.Minus) 240Debug.Assert(resultType.IsNullableType()) 243Debug.Assert(operand.Type.IsNullableType, "operand must be nullable") 266Debug.Assert(callInput.Type.IsSameTypeIgnoringAll(operatorCall.Method.Parameters(0).Type), 283Debug.Assert(whenHasValue.Type.IsSameTypeIgnoringAll(resultType), "result type must be same as resultType") 288Debug.Assert(temps Is Nothing AndAlso inits Is Nothing) 313Debug.Assert(Not operandValue.Type.IsNullableType)
Lowering\LocalRewriter\LocalRewriter_UnstructuredExceptionHandling.vb (25)
35Debug.Assert(_currentLineTemporary Is Nothing) 65Debug.Assert(node.ContainsOnError OrElse node.ContainsResume) 67Debug.Assert(_unstructuredExceptionHandling.Context Is Nothing) 68Debug.Assert(_unstructuredExceptionHandling.ExceptionHandlers Is Nothing) 69Debug.Assert(_unstructuredExceptionHandling.ResumeTargets Is Nothing) 70Debug.Assert(_unstructuredExceptionHandling.OnErrorResumeNextCount = 0) 71Debug.Assert(_unstructuredExceptionHandling.ActiveHandlerTemporary Is Nothing) 72Debug.Assert(_unstructuredExceptionHandling.ResumeTargetTemporary Is Nothing) 73Debug.Assert(_unstructuredExceptionHandling.CurrentStatementTemporary Is Nothing) 74Debug.Assert(_unstructuredExceptionHandling.ResumeNextLabel Is Nothing) 75Debug.Assert(_unstructuredExceptionHandling.ResumeLabel Is Nothing) 77Debug.Assert(_currentMethodOrLambda Is _topMethod) 366Debug.Assert(node.OnErrorKind = OnErrorStatementKind.GoToZero) 373Debug.Assert(Not node.WasCompilerGenerated) 435Debug.Assert(node.ResumeKind = ResumeStatementKind.Plain) 439Debug.Assert(Not node.WasCompilerGenerated) 450Debug.Assert(InsideValidUnstructuredExceptionHandlingResumeContext()) 458Debug.Assert(InsideValidUnstructuredExceptionHandlingResumeContext()) 481Debug.Assert(TypeOf statement.Syntax Is ExpressionSyntax) 524Debug.Assert(statement.Syntax.Kind = SyntaxKind.ElseIfBlock AndAlso 530Debug.Assert((statement.Syntax.Kind = SyntaxKind.CaseBlock OrElse statement.Syntax.Kind = SyntaxKind.CaseElseBlock) AndAlso 536Debug.Assert(statement.Syntax.Kind = SyntaxKind.ModifiedIdentifier AndAlso 543Debug.Assert((statement.Syntax.Kind = SyntaxKind.RedimClause AndAlso 549Debug.Assert(TypeOf statement.Syntax Is ExecutableStatementSyntax) 583Debug.Assert(_leaveRestoreUnstructuredExceptionHandlingContextTracker.Peek Is node)
Lowering\LocalRewriter\LocalRewriter_Using.vb (1)
124Debug.Assert(node.ResourceExpressionOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_With.vb (8)
57Debug.Assert(Not locals.IsDefault) 58Debug.Assert(Not initializers.IsDefault) 59Debug.Assert(placeholder IsNot Nothing) 60Debug.Assert(replaceWith IsNot Nothing) 148Debug.Assert(currentType IsNot Nothing) 155Debug.Assert(currentType.IsValueType) 177Debug.Assert(fieldType IsNot Nothing) 193Debug.Assert(Not _valueTypesCleanUpCache(currentType))
Lowering\LocalRewriter\LocalRewriter_XmlLiteralFixupData.vb (1)
45Debug.Assert(Not Me.IsEmpty)
Lowering\MethodToClassRewriter\MethodToClassRewriter.MyBaseMyClassWrapper.vb (7)
41Debug.Assert(originalMethodBeingCalled.IsGenericMethod) 44Debug.Assert(typeArgs.Length = newMethod.Arity) 61Debug.Assert(receiver IsNot Nothing) 62Debug.Assert(receiver.IsMyClassReference() OrElse receiver.IsMyBaseReference()) 63Debug.Assert(method IsNot Nothing) 84Debug.Assert(isMyBase OrElse receiver.Kind = BoundKind.MyClassReference) 99Debug.Assert(wrappedMethod.ConstructedFrom() Is method)
Lowering\SynthesizedSubmissionFields.vb (2)
30Debug.Assert(compilation IsNot Nothing) 31Debug.Assert(submissionClass.IsSubmissionClass)
Lowering\SyntheticBoundNodeFactory.vb (41)
72Debug.Assert(compilationState IsNot Nothing) 157Debug.Assert(Me.CurrentMethod IsNot Nothing AndAlso Not Me.CurrentMethod.IsShared) 164Debug.Assert(Me.CurrentMethod IsNot Nothing AndAlso Not Me.CurrentMethod.IsShared) 177Debug.Assert(Me.CurrentMethod IsNot Nothing AndAlso Not Me.CurrentMethod.IsShared) 198Debug.Assert(propertySym.IsShared) 204Debug.Assert(receiver.Type.GetMembers(propertySym.Name).OfType(Of PropertySymbol)().Single() = propertySym) 206Debug.Assert(Not propertySym.IsShared) 215Debug.Assert(Not propertySym.IsShared)