96 references to Throw
Microsoft.Extensions.Diagnostics.ResourceMonitoring (96)
CircularBuffer.cs (1)
17
_ =
Throw
.IfLessThan(size, 1);
Linux\LinuxUtilizationParserCgroupV1.cs (15)
113
Throw
.InvalidOperationException($"Could not get cpu usage from '{_cpuacctUsage}'. Expected positive number, but got '{new string(usage)}'.");
133
Throw
.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(bufferWriter.Buffer.WrittenSpan)}'.");
149
Throw
.InvalidOperationException(
199
Throw
.InvalidOperationException($"Could not parse '{_memoryLimitInBytes}' content. Expected to find available memory in bytes but got '{new string(memoryBuffer)}' instead.");
220
Throw
.InvalidOperationException($"Unable to find total_inactive_file from '{_memoryStat}'.");
228
Throw
.InvalidOperationException($"The value of total_inactive_file found in '{_memoryStat}' is not a positive number: '{new string(inactiveMemorySlice)}'.");
241
Throw
.InvalidOperationException(
251
Throw
.InvalidOperationException($"The total memory usage read from '{_memoryUsageInBytes}' is lesser than inactive memory usage read from '{_memoryStat}'.");
268
Throw
.InvalidOperationException($"Could not parse '{_memInfo}'. We expected first line of the file to start with '{MemTotal}' but it was '{new string(firstLine)}' instead.");
277
Throw
.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get total memory usage on first line but we've got: '{new string(firstLine)}'.");
282
Throw
.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get memory usage followed by the unit (kB, MB, GB) but found no unit: '{new string(firstLine)}'.");
367
Throw
.InvalidOperationException(
426
Throw
.InvalidOperationException($"Could not parse '{_cpuCfsQuotaUs}'. Expected an integer but got: '{new string(quotaBuffer)}'.");
444
Throw
.InvalidOperationException($"Could not parse '{_cpuCfsPeriodUs}'. Expected to get an integer but got: '{new string(periodBuffer)}'.");
474
Throw
.InvalidOperationException($"Could not parse '{_cpuPodWeight}' content. Expected to find CPU weight but got '{new string(cpuPodWeightBuffer)}' instead.");
Linux\LinuxUtilizationParserCgroupV2.cs (30)
124
Throw
.InvalidOperationException($"The file '{_cpuCgroupInfoFile}' is empty or could not be read.");
131
Throw
.InvalidOperationException($"Invalid format in file '{_cpuCgroupInfoFile}'. Expected content with ':' separator.");
179
Throw
.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(bufferWriter.Buffer.WrittenSpan)}'.");
195
Throw
.InvalidOperationException(
300
Throw
.InvalidOperationException($"Could not parse '{_memoryLimitInBytes}' content. Expected to find available memory in bytes but got '{new string(memoryBuffer)}' instead.");
333
Throw
.InvalidOperationException(
371
Throw
.InvalidOperationException($"Unable to find inactive_file from '{_memoryStat}'.");
380
Throw
.InvalidOperationException($"The value of inactive_file found in '{_memoryStat}' is not a positive number: '{new string(inactiveMemorySlice)}'.");
398
Throw
.InvalidOperationException($"The total memory usage read from '{_memoryUsageInBytes}' is lesser than inactive memory read from '{_memoryStat}'.");
415
Throw
.InvalidOperationException($"Could not parse '{_memInfo}'. We expected first line of the file to start with '{MemTotal}' but it was '{new string(firstLine)}' instead.");
424
Throw
.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get total memory usage on first line but we've got: '{new string(firstLine)}'.");
429
Throw
.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get memory usage followed by the unit (kB, MB, GB) but found no unit: '{new string(firstLine)}'.");
514
Throw
.InvalidOperationException(
532
Throw
.InvalidOperationException($"Could not parse '{memoryMinFile}' content. Expected to find memory minimum in bytes but got '{new string(memoryMinBuffer)}' instead.");
553
Throw
.InvalidOperationException($"Could not parse '{memoryLowFile}' content. Expected to find memory low in bytes but got '{new string(memoryLowBuffer)}' instead.");
576
Throw
.InvalidOperationException($"Could not parse '{cpuUsageFile}'. Expected to find 'usage_usec' but it was not present in the file content.");
584
Throw
.InvalidOperationException($"Could not get usage_usec from '{cpuUsageFile}'. Expected positive number, but got '{new string(content.Slice(usageIndex))}'.");
591
Throw
.InvalidOperationException($"Could not parse '{cpuUsageFile}'. Expected to find 'nr_periods' but it was not present in the file content.");
599
Throw
.InvalidOperationException($"Could not get nr_periods from '{cpuUsageFile}'. Expected positive number, but got '{new string(content.Slice(periodsIndex))}'.");
690
Throw
.InvalidOperationException($"Could not parse '{cpuLimitsFile}'. Expected an integer but got: '{new string(quotaBuffer)}'.");
700
Throw
.InvalidOperationException($"Could not parse '{cpuLimitsFile}'. Expected to get an integer but got: '{new string(cpuPeriodSlice)}'.");
717
Throw
.InvalidOperationException($"Could not read content from '{cpuLimitsFile}'. The file was empty.");
729
Throw
.InvalidOperationException($"Could not parse period value from '{cpuLimitsFile}'. Expected an integer after 'max' but got: '{new string(content)}'.");
744
Throw
.InvalidOperationException($"Could not parse period value from '{cpuLimitsFile}'. Expected an integer after '-1' but got: '{new string(content)}'.");
756
Throw
.InvalidOperationException($"Could not parse quota value from '{cpuLimitsFile}'. Expected an integer but got: '{new string(content)}'.");
769
Throw
.InvalidOperationException($"Could not parse period value from '{cpuLimitsFile}'. Expected an integer after quota but got: '{new string(content)}'.");
809
Throw
.InvalidOperationException(
817
Throw
.InvalidOperationException(
823
Throw
.ArgumentOutOfRangeException("CPU weight",
848
Throw
.InvalidOperationException(
Linux\Network\LinuxNetworkUtilizationParser.cs (4)
80
Throw
.InvalidOperationException($"Could not split contents. We expected every line to contain more than {Target - 1} elements, but it has only {numRanges} elements.");
130
Throw
.IfOutOfRange(state);
147
Throw
.InvalidOperationException($"Could not parse '{file}'. File was empty.");
153
Throw
.InvalidOperationException($"Could not parse '{file}'. We expected first line of the file to start with '{Sl}' but it was '{firstLine}' instead.");
ResourceMonitoringBuilderExtensions.cs (4)
32
_ =
Throw
.IfNull(builder);
33
_ =
Throw
.IfNull(configure);
49
_ =
Throw
.IfNull(builder);
50
_ =
Throw
.IfNull(section);
ResourceMonitoringServiceCollectionExtensions.cs (4)
39
_ =
Throw
.IfNull(services);
58
_ =
Throw
.IfNull(services);
59
_ =
Throw
.IfNull(configure);
129
_ =
Throw
.IfNull(builder);
ResourceMonitorService.cs (3)
73
var optionsValue =
Throw
.IfMemberNull(options, options.Value);
90
_ =
Throw
.IfLessThanOrEqual(window.Ticks, 0);
91
_ =
Throw
.IfGreaterThan(window.Ticks, _collectionWindow.Ticks);
ResourceUtilization.cs (2)
68
CpuUsedPercentage = Math.Min(Hundred,
Throw
.IfLessThan(cpuUsedPercentage / guaranteedCpuUnits, 0.0));
69
MemoryUsedInBytes =
Throw
.IfLessThan(memoryUsedInBytes, 0);
Snapshot.cs (6)
54
_ =
Throw
.IfLessThan(memoryUsageInBytes, 0);
55
_ =
Throw
.IfLessThan(kernelTimeSinceStart.Ticks, 0);
56
_ =
Throw
.IfLessThan(userTimeSinceStart.Ticks, 0);
78
_ =
Throw
.IfLessThan(memoryUsageInBytes, 0);
79
_ =
Throw
.IfLessThan(kernelTimeSinceStart.Ticks, 0);
80
_ =
Throw
.IfLessThan(userTimeSinceStart.Ticks, 0);
src\Shared\BufferWriterPool\BufferWriter.cs (4)
74
_ =
Throw
.IfLessThan(value, 0);
121
_ =
Throw
.IfOutOfRange(count, 0, _buffer.Length - WrittenCount);
182
Throw
.InvalidOperationException("Exceeded array capacity");
189
_ =
Throw
.IfLessThan(sizeHint, 0);
src\Shared\BufferWriterPool\BufferWriterPool.cs (2)
28
_ =
Throw
.IfLessThan(maxCapacity, 1);
29
_ =
Throw
.IfLessThan(maxBufferWriterCapacity, 1);
src\Shared\BufferWriterPool\BufferWriterPooledObjectPolicy.cs (2)
37
MaximumRetainedCapacity =
Throw
.IfLessThan(maximumRetainedCapacity, 1);
63
_ =
Throw
.IfNull(obj);
src\Shared\Data.Validation\TimeSpanAttribute.cs (3)
88
_ =
Throw
.IfNullOrWhitespace(min);
101
_ =
Throw
.IfNullOrWhitespace(min);
102
_ =
Throw
.IfNullOrWhitespace(max);
src\Shared\Pools\PoolFactory.cs (12)
42
_ =
Throw
.IfLessThan(maxCapacity, 1);
57
_ =
Throw
.IfNull(policy);
58
_ =
Throw
.IfLessThan(maxCapacity, 1);
75
_ =
Throw
.IfLessThan(maxCapacity, 1);
88
_ =
Throw
.IfLessThan(maxCapacity, 1);
89
_ =
Throw
.IfLessThan(maxStringBuilderCapacity, 1);
116
_ =
Throw
.IfLessThan(maxCapacity, 1);
134
_ =
Throw
.IfLessThan(maxCapacity, 1);
135
_ =
Throw
.IfLessThan(listCapacity, 0);
155
_ =
Throw
.IfLessThan(maxCapacity, 1);
174
_ =
Throw
.IfLessThan(maxCapacity, 1);
196
_ =
Throw
.IfLessThan(maxCapacity, 1);
SystemResources.cs (4)
62
GuaranteedCpuUnits =
Throw
.IfLessThanOrEqual(guaranteedCpuUnits, 0.0);
63
MaximumCpuUnits =
Throw
.IfLessThanOrEqual(maximumCpuUnits, 0.0);
64
GuaranteedMemoryInBytes =
Throw
.IfLessThan(guaranteedMemoryInBytes, 1UL);
65
MaximumMemoryInBytes =
Throw
.IfLessThan(maximumMemoryInBytes, 1UL);