27630 references to Length
aspire (116)
Certificates\CertificateGeneration\CertificateManager.cs (8)
234if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
699Array.Clear(keyBytes, 0, keyBytes.Length);
700Array.Clear(pem, 0, pem.Length);
706Array.Clear(keyBytes, 0, keyBytes.Length);
707Array.Clear(pem, 0, pem.Length);
757Array.Clear(bytes, 0, bytes.Length);
785Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Aspire.Azure.Messaging.EventHubs (2)
Aspire.Azure.Messaging.EventHubs.Tests (1)
Aspire.Azure.Messaging.ServiceBus (2)
Aspire.Azure.Messaging.WebPubSub (2)
Aspire.Azure.Npgsql (1)
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (1)
Aspire.Azure.Security.KeyVault.Tests (2)
Aspire.Azure.Storage.Queues (2)
Aspire.Cli.EndToEnd.Tests (1)
Aspire.Cli.Tests (30)
Aspire.Components.Common.TestUtilities (1)
Aspire.Confluent.Kafka.Tests (1)
Aspire.Dashboard (53)
Aspire.Dashboard.Tests (17)
Aspire.Deployment.EndToEnd.Tests (2)
Aspire.Hosting (53)
Dcp\DcpExecutor.cs (10)
1198var serviceName = _nameGenerator.GetServiceName(sp.ModelResource, endpoint, endpoints.Length > 1, serviceNames);
1847Array.Clear(keyPem, 0, keyPem.Length);
1848Array.Clear(keyBytes, 0, keyBytes.Length);
1854Array.Clear(pfxBytes, 0, pfxBytes.Length);
2304Array.Clear(keyPem, 0, keyPem.Length);
2316Array.Clear(pfxBytes, 0, pfxBytes.Length);
2887Array.Clear(keyBytes, 0, keyBytes.Length);
2888Array.Clear(pemKey, 0, pemKey.Length);
2893Array.Clear(keyBytes, 0, keyBytes.Length);
2926if (pfxCandidate.Length > 0)
Exec\ExecResourceManager.cs (3)
204if (args is not null && args.Length > 0)
227_logger.LogDebug("Exec resource '{ResourceName}' will run command '{Command}' with {ArgsCount} args '{Args}'.", execResourceName, exe, args?.Length ?? 0, string.Join(' ', args ?? []));
258_logger.LogDebug("Exec container resource '{ResourceName}' will run command '{Command}' with {ArgsCount} args '{Args}'.", execResourceName, exe, args?.Length ?? 0, string.Join(' ', args ?? []));
Aspire.Hosting.Analyzers (5)
Aspire.Hosting.Azure (1)
Aspire.Hosting.Azure.AppConfiguration (3)
Aspire.Hosting.Azure.AppContainers (7)
Aspire.Hosting.Azure.AppService (3)
Aspire.Hosting.Azure.CognitiveServices (3)
Aspire.Hosting.Azure.ContainerRegistry (3)
Aspire.Hosting.Azure.CosmosDB (4)
Aspire.Hosting.Azure.EventHubs (3)
Aspire.Hosting.Azure.Functions (1)
Aspire.Hosting.Azure.KeyVault (3)
Aspire.Hosting.Azure.Search (3)
Aspire.Hosting.Azure.ServiceBus (3)
Aspire.Hosting.Azure.SignalR (3)
Aspire.Hosting.Azure.Sql (1)
Aspire.Hosting.Azure.Storage (4)
Aspire.Hosting.Azure.Tests (5)
Aspire.Hosting.Azure.WebPubSub (3)
Aspire.Hosting.CodeGeneration.Java (2)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (1)
Aspire.Hosting.Docker (3)
Aspire.Hosting.Foundry (3)
Aspire.Hosting.Foundry.Tests (1)
Aspire.Hosting.Integration.Analyzers (3)
Aspire.Hosting.JavaScript (1)
Aspire.Hosting.JavaScript.Tests (1)
Aspire.Hosting.Kubernetes (1)
Aspire.Hosting.Maui (1)
Aspire.Hosting.PostgreSQL (1)
Aspire.Hosting.PostgreSQL.Tests (1)
Aspire.Hosting.Qdrant.Tests (1)
Aspire.Hosting.RemoteHost (42)
Aspire.Hosting.RemoteHost.Tests (4)
Aspire.Hosting.Testing (1)
Aspire.Hosting.Testing.Tests (5)
Aspire.Hosting.Tests (33)
Aspire.Hosting.Yarp (2)
Aspire.Hosting.Yarp.Tests (2)
Aspire.Microsoft.Azure.Cosmos (2)
Aspire.Microsoft.EntityFrameworkCore.Cosmos (2)
Aspire.Milvus.Client.Tests (1)
Aspire.Playground.Tests (4)
Aspire.Qdrant.Client.Tests (1)
Aspire.RabbitMQ.Client.Tests (2)
Aspire.RabbitMQ.Client.v6.Tests (2)
Aspire.Templates.Tests (1)
Aspire.TestUtilities (4)
AspireJavaScript.MinimalApi (1)
aspire-managed (3)
AspireWithMaui.WeatherApi (1)
AspireWithNode.AspNetCoreApi (1)
AzureFunctionsEndToEnd.Functions (1)
Binding.Http.IntegrationTests (1)
cdac-build-tool (2)
CodeStyleConfigFileGenerator (2)
ConfigurationSchemaGenerator (3)
Contract.Fault.IntegrationTests (4)
Contract.Message.IntegrationTests (7)
crossgen2 (6)
csc (2)
CSharpSyntaxGenerator (6)
CustomResources.AppHost (2)
Deployers.ApiService (1)
DnnAnalyzer (2)
dotnet (112)
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.9.0-1.26307.102\contentFiles\cs\net11.0\BuildProtocol.cs (1)
331responseBuffer.Length,
dotnet-dev-certs (16)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (8)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
702Array.Clear(keyBytes, 0, keyBytes.Length);
703Array.Clear(pem, 0, pem.Length);
709Array.Clear(keyBytes, 0, keyBytes.Length);
710Array.Clear(pem, 0, pem.Length);
760Array.Clear(bytes, 0, bytes.Length);
788Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
dotnet-format (17)
dotnet-Microsoft.XmlSerializer.Generator (10)
dotnet-sourcelink (1)
dotnet-svcutil.xmlserializer (5)
dotnet-svcutil-lib (1538)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlEncodedRawTextWriter.cs (12)
161bufBytes = new byte[bufChars.Length];
179if (bom.Length != 0)
181this.stream.Write(bom, 0, bom.Length);
658Debug.Assert(count >= 0 && index + count <= buffer.Length);
682Debug.Assert(count >= 0 && index + count <= buffer.Length);
860encoder.Convert(bufChars, startOffset, endOffset - startOffset, bufBytes, bufBytesUsed, bufBytes.Length - bufBytesUsed, false, out chEnc, out bEnc, out completed);
863if (bufBytesUsed >= (bufBytes.Length - 16))
885encoder.Convert(bufChars, 1, 0, bufBytes, 0, bufBytes.Length, true, out chEnc, out bEnc, out completed);
1569if (_lastMarkPos + 1 == _textContentMarks.Length)
1578Debug.Assert(_lastMarkPos + 1 == _textContentMarks.Length);
1579int[] newTextContentMarks = new int[_textContentMarks.Length * 2];
1580Array.Copy(_textContentMarks, newTextContentMarks, _textContentMarks.Length);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImpl.cs (39)
1614if (buffer.Length - index < count)
1674if (buffer.Length - index < count)
1733if (buffer.Length - index < count)
1793if (buffer.Length - index < count)
1866if (buffer.Length - index < count)
2912bufferSize = _ps.bytes.Length;
2927if (_ps.bytes == null || _ps.bytes.Length < bufferSize)
2934if (_ps.chars == null || _ps.chars.Length < bufferSize + 1)
2941while (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0)
2943int read = stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed);
2961int preambleLen = preamble.Length;
3407if (_ps.charsUsed == _ps.chars.Length - 1)
3415char[] newChars = new char[_ps.chars.Length * 2];
3416BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
3425if (_ps.bytes.Length - _ps.bytesUsed < MaxByteSequenceLen)
3427byte[] newBytes = new byte[_ps.bytes.Length * 2];
3434charsRead = _ps.chars.Length - _ps.charsUsed - 1;
3442int charsLen = _ps.chars.Length;
3465char[] newChars = new char[_ps.chars.Length * 2];
3466BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
3489charsRead = _ps.chars.Length - _ps.charsUsed - 1;
3497if (_ps.bytePos == _ps.bytesUsed && _ps.bytes.Length - _ps.bytesUsed > 0)
3499int read = _ps.stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed);
3521charsRead = _ps.textReader.Read(_ps.chars, _ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1);
3533Debug.Assert(_ps.charsUsed < _ps.chars.Length);
3544Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1);
5131if (_attrDuplSortingArray == null || _attrDuplSortingArray.Length < _attrCount)
7771Debug.Assert(nodeIndex < _nodes.Length);
7772Debug.Assert(_nodes[_nodes.Length - 1] == null);
7785Debug.Assert(nodeIndex < _nodes.Length);
7786if (nodeIndex >= _nodes.Length - 1)
7788NodeData[] newNodes = new NodeData[_nodes.Length * 2];
7789Array.Copy(_nodes, 0, newNodes, 0, _nodes.Length);
7792Debug.Assert(nodeIndex < _nodes.Length);
8245else if (_parsingStatesStackTop + 1 == _parsingStatesStack.Length)
8247ParsingState[] newParsingStateStack = new ParsingState[_parsingStatesStack.Length * 2];
8248Array.Copy(_parsingStatesStack, 0, newParsingStateStack, 0, _parsingStatesStack.Length);
8293if (array.Length - index < count)
9689Debug.Assert(endPos < chars.Length);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (41)
355for (int i = 0; i < xmlNodes.Length; i++)
385XmlCustomFormatter.WriteArrayBase64(_w, (byte[])o, 0, ((byte[])o).Length);
1019XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1037XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1059XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1158XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1300int arrayLength = a.Length;
1740for (int i = 0; i < values.Length; i++)
1915for (int i = 0; i < mapping.Members.Length; i++)
1928for (int j = 0; j < mapping.Members.Length; j++)
1968for (int i = 0; i < mapping.Members.Length; i++)
1982for (int j = 0; j < mapping.Members.Length; j++)
2012for (int j = 0; j < mapping.Members.Length; j++)
2031if (isRpc && member.IsReturnValue && member.Elements.Length > 0)
2063Writer.Write(mapping.Members.Length.ToString());
2067WriteExtraMembers(mapping.Members.Length.ToString(), "pLength");
2152if (constants.Length > 0)
2160for (int i = 0; i < constants.Length; i++)
2180for (int i = 0; i < constants.Length; i++)
2191for (int i = 0; i < constants.Length; i++)
2449for (int i = 0; i < members.Length; i++)
2488for (int i = 0; i < members.Length; i++)
2494bool checkShouldPersist = m.CheckShouldPersist && (m.Elements.Length > 0 || m.Text != null);
2750!(elements.Length == 1 && elements[0].Mapping is ArrayMapping))
2759if (elements.Length == 0 && text == null) return;
2877int count = elements.Length + (text == null ? 0 : 1);
2905if (elements.Length == 0 && text == null) return;
2906if (elements.Length == 1 && text == null)
2929for (int i = 0; i < elements.Length; i++)
2993if (elements.Length - anyCount > 0) Writer.Write("else ");
3090if (elements.Length > 0)
3112if (elements.Length > 0)
3606for (int i = 0; i < members.Length; i++)
3663for (int i = 0; i < choiceMapping.Constants.Length; i++)
3737for (int i = 0; i < parameterTypes.Length; i++)
3921for (int i = 0; i < structMapping.Members.Length; i++)
3945for (int i = 0; i < enumFields.Length; i++)
3996for (int i = 0; i < memberInfos.Length; i++)
4044for (int i = 0; i < paramTypes.Length; i++)
4047if (i < (paramTypes.Length - 1))
4109for (int i = 0; i < args.Length; i++)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlWriterDelegator.cs (15)
489writer.WriteBase64(bytes, 0, bytes.Length);
666for (int i = 0; i < value.Length; i++)
673dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
685for (int i = 0; i < value.Length; i++)
692dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
704for (int i = 0; i < value.Length; i++)
711dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
723for (int i = 0; i < value.Length; i++)
730dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
742for (int i = 0; i < value.Length; i++)
749dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
761for (int i = 0; i < value.Length; i++)
768dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
780for (int i = 0; i < value.Length; i++)
787dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
FrameworkFork\System.Runtime.Serialization\System\Text\Base64Encoding.cs (32)
69if (index > chars.Length)
70throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("index", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
73if (count > chars.Length - index)
74throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, chars.Length - index)));
129if (charIndex > chars.Length)
130throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("charIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
134if (charCount > chars.Length - charIndex)
135throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("charCount", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, chars.Length - charIndex)));
141if (byteIndex > bytes.Length)
142throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("byteIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, bytes.Length)));
157byte* pbMax = _bytes + bytes.Length - byteIndex;
212if (charIndex > chars.Length)
213throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("charIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
217if (charCount > chars.Length - charIndex)
218throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("charCount", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, chars.Length - charIndex)));
224if (byteIndex > bytes.Length)
225throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("byteIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, bytes.Length)));
240byte* pbMax = _bytes + bytes.Length - byteIndex;
305if (byteIndex > bytes.Length)
306throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("byteIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, bytes.Length)));
309if (byteCount > bytes.Length - byteIndex)
310throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("byteCount", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex)));
317if (charIndex > chars.Length)
318throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("charIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
319if (charCount < 0 || charCount > chars.Length - charIndex)
399if (byteIndex > bytes.Length)
400throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("byteIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, bytes.Length)));
403if (byteCount > bytes.Length - byteIndex)
404throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("byteCount", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex)));
411if (charIndex > chars.Length)
412throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("charIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
414if (charCount < 0 || charCount > chars.Length - charIndex)
FrameworkFork\System.Runtime.Serialization\System\Text\BinHexEncoding.cs (14)
56if (charIndex > chars.Length)
57throw new ArgumentOutOfRangeException("charIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length));
60if (charCount > chars.Length - charIndex)
61throw new ArgumentOutOfRangeException("charCount", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, chars.Length - charIndex));
66if (byteIndex > bytes.Length)
67throw new ArgumentOutOfRangeException("byteIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, bytes.Length));
69if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
127if (byteIndex > bytes.Length)
128throw new ArgumentOutOfRangeException("byteIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, bytes.Length));
131if (byteCount > bytes.Length - byteIndex)
132throw new ArgumentOutOfRangeException("byteCount", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex));
138if (charIndex > chars.Length)
139throw new ArgumentOutOfRangeException("charIndex", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length));
140if (charCount < 0 || charCount > chars.Length - charIndex)
FrameworkFork\System.Runtime.Serialization\System\Xml\ArrayHelper.cs (7)
32while (read < array.Length)
34int actual = ReadArray(reader, localName, namespaceUri, array, read, array.Length - read);
40if (read < array.Length || reader.NodeType == XmlNodeType.EndElement)
47if (totalRead != array.Length || arrayCount > 0)
53Array.Copy(arrays[i], 0, newArray, offset, arrays[i].Length);
54offset += arrays[i].Length;
72int actual = ReadArray(reader, localName, namespaceUri, array, 0, array.Length);
FrameworkFork\System.Runtime.Serialization\System\Xml\EncodingStreamWrapper.cs (13)
210if (bom.Length > 0)
211_stream.Write(bom, 0, bom.Length);
390if (!Compare(s_encodingAttr, buffer, i - s_encodingAttr.Length + 1))
416if (encCount == s_encodingUTF8.Length && CompareCaseInsensitive(s_encodingUTF8, buffer, encStart))
420else if (encCount == s_encodingUnicodeLE.Length && CompareCaseInsensitive(s_encodingUnicodeLE, buffer, encStart))
424else if (encCount == s_encodingUnicodeBE.Length && CompareCaseInsensitive(s_encodingUnicodeBE, buffer, encStart))
428else if (encCount == s_encodingUnicode.Length && CompareCaseInsensitive(s_encodingUnicode, buffer, encStart))
431ThrowEncodingMismatch(s_safeUTF8.GetString(buffer, encStart, encCount), s_safeUTF8.GetString(s_encodingUTF8, 0, s_encodingUTF8.Length));
444for (int i = 0; i < key.Length; i++)
457for (int i = 0; i < key.Length; i++)
629_byteCount = _stream.Read(_bytes, _byteCount, (_chars.Length - 1) * 2);
721int size = _chars.Length < count ? _chars.Length : count;
FrameworkFork\System.Runtime.Serialization\System\Xml\UniqueId.cs (13)
90if (offset > guid.Length)
91throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, guid.Length)));
92if (guidLength > guid.Length - offset)
130if (offset > chars.Length)
131throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
134if (count > chars.Length - offset)
135throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, chars.Length - offset)));
274if (offset > chars.Length)
275throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
277if (count > chars.Length - offset)
361if (offset > buffer.Length)
362throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, buffer.Length)));
364if (guidLength > buffer.Length - offset)
FrameworkFork\System.Runtime.Serialization\System\Xml\ValueHandle.cs (6)
455if (actualLength != buffer.Length)
525return Base64Encoding.GetString(bytes, 0, bytes.Length);
654DiagnosticUtility.DebugAssert(offset + count <= chars.Length, string.Format("offset '{0}' + count '{1}' MUST BE <= chars.Length '{2}'", offset, count, chars.Length));
737DiagnosticUtility.DebugAssert(byteOffset + actualByteCount < bytes.Length,
738string.Format("byteOffset {0} + actualByteCount {1} MUST BE < bytes.Length {2}", byteOffset, actualByteCount, bytes.Length));
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseReader.cs (33)
297else if (_elementNodes.Length == _depth)
331else if (_attributeNodes.Length == attributeIndex)
488if (_attributeNodes != null && _attributeNodes.Length > 16)
490if (_elementNodes != null && _elementNodes.Length > 16)
1071for (int i = 0; i < localNames.Length; i++)
1086for (int i = 0; i < localNames.Length; i++)
1113for (int i = 0; i < localNames.Length; i++)
1128for (int i = 0; i < localNames.Length; i++)
1149if (offset > chars.Length)
1150throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, chars.Length)));
1153if (count > chars.Length - offset)
1154throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, chars.Length - offset)));
1179if (offset > buffer.Length)
1180throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, buffer.Length)));
1183if (count > buffer.Length - offset)
1184throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
1295if (value.Length > _quotas.MaxArrayLength)
1303return ReadContentAsBase64(_quotas.MaxArrayLength, _bufferReader.Buffer.Length);
1339if (offset > buffer.Length)
1340throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, buffer.Length)));
1343if (count > buffer.Length - offset)
1344throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
1866if (_chars == null || _chars.Length < count)
2469if (_indeces != null && _indeces.Length > 32)
2479if (_indeces != null && _indeces.Length == _attributeCount && IsSorted())
2483for (int i = 0; i < newIndeces.Length; i++)
2492for (int i = 0; i < _indeces.Length - 1; i++)
2569if (_namespaces != null && _namespaces.Length > 32)
2571if (_attributes != null && _attributes.Length > 4)
2593nameSpace.Uri.SetValue(3, xmlBuffer.Length - 3);
2630for (int i = 0; i < _shortPrefixUri.Length; i++)
2694else if (_attributes.Length == _attributeCount)
2732else if (_namespaces.Length == _nsCount)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (9)
41if (offset > buffer.Length)
42throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, buffer.Length)));
45if (count > buffer.Length - offset)
46throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
1006BufferReader.InsertBytes(buffer, 0, buffer.Length);
1211if (offset > array.Length)
1212throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, array.Length)));
1215if (count > array.Length - offset)
1216throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, array.Length - offset)));
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryReader.cs (20)
42return CreateBinaryReader(buffer, 0, buffer.Length, quotas);
84return CreateTextReader(buffer, 0, buffer.Length, quotas);
239for (int i = 0; i < localNames.Length; i++)
265for (int i = 0; i < localNames.Length; i++)
411while (read < buffer.Length)
415actual = ReadContentAsBase64(buffer, read, buffer.Length - read);
417actual = ReadContentAsBinHex(buffer, read, buffer.Length - read);
423if (read < buffer.Length)
431Buffer.BlockCopy(buffers[i], 0, buffer, offset, buffers[i].Length);
432offset += buffers[i].Length;
485Guid[] guids = new Guid[values.Length];
486for (int i = 0; i < values.Length; i++)
493UniqueId[] uniqueIds = new UniqueId[values.Length];
494for (int i = 0; i < values.Length; i++)
507for (int i = 0; i < strings.Length; i++)
527for (int i = 0; i < strings.Length; i++)
897if (offset > array.Length)
898throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", string.Format(SRSerialization.OffsetExceedsBufferSize, array.Length)));
901if (count > array.Length - offset)
902throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", string.Format(SRSerialization.SizeExceedsRemainingBufferSpace, array.Length - offset)));
FrameworkFork\System.ServiceModel\Internals\System\Runtime\UrlUtility.cs (4)
90return AsciiEncoding.GetString(bytes, 0, bytes.Length);
151bytes = UrlEncodeBytesToBytesInternalNonAscii(bytes, 0, bytes.Length, false);
153return AsciiEncoding.GetString(bytes, 0, bytes.Length);
173return UrlEncodeBytesToBytesInternal(bytes, 0, bytes.Length, false);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingChannels.cs (18)
54Connection.Write(SessionEncoder.EndBytes, 0, SessionEncoder.EndBytes.Length, true, timeout);
59return Connection.WriteAsync(SessionEncoder.EndBytes, 0, SessionEncoder.EndBytes.Length, true, timeout);
90return this.Connection.BeginWrite(SessionEncoder.EndBytes, 0, SessionEncoder.EndBytes.Length,
200int startSize = ClientDuplexEncoder.ModeBytes.Length + SessionEncoder.CalcStartSize(encodedVia, encodedContentType);
205startSize += ClientDuplexEncoder.PreambleEndBytes.Length;
209Buffer.BlockCopy(ClientDuplexEncoder.ModeBytes, 0, startBytes, 0, ClientDuplexEncoder.ModeBytes.Length);
210SessionEncoder.EncodeStart(startBytes, ClientDuplexEncoder.ModeBytes.Length, encodedVia, encodedContentType);
213Buffer.BlockCopy(ClientDuplexEncoder.PreambleEndBytes, 0, startBytes, preambleEndOffset, ClientDuplexEncoder.PreambleEndBytes.Length);
267await connection.WriteAsync(ClientDuplexEncoder.PreambleEndBytes, 0, ClientDuplexEncoder.PreambleEndBytes.Length, true, timeoutHelper.RemainingTime());
270int ackBytesRead = await connection.ReadAsync(ackBuffer, 0, ackBuffer.Length, timeoutHelper.RemainingTime());
301connection.Write(ClientDuplexEncoder.PreambleEndBytes, 0, ClientDuplexEncoder.PreambleEndBytes.Length, true, timeoutHelper.RemainingTime());
305int ackBytesRead = connection.Read(ackBuffer, 0, ackBuffer.Length, timeoutHelper.RemainingTime());
495int size = connection.Read(faultBuffer, offset, faultBuffer.Length, timeoutHelper.RemainingTime());
518size = connection.Read(faultBuffer, offset, faultBuffer.Length, timeoutHelper.RemainingTime());
535connection.Write(encodedUpgrade.EncodedBytes, 0, encodedUpgrade.EncodedBytes.Length, true, timeoutHelper.RemainingTime());
539int size = connection.Read(buffer, 0, buffer.Length, timeoutHelper.RemainingTime());
569await connection.WriteAsync(encodedUpgrade.EncodedBytes, 0, encodedUpgrade.EncodedBytes.Length, true, timeout);
573int size = await connection.ReadAsync(buffer, 0, buffer.Length, timeout);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingEncoders.cs (15)
80(_encodedBytes[_encodedBytes.Length / 2] << 8) |
81_encodedBytes[_encodedBytes.Length - 1];
98if (_encodedBytes.Length != otherBytes.Length)
101for (int i = 0; i < _encodedBytes.Length; i++)
209return via.EncodedBytes.Length + contentType.EncodedBytes.Length;
214Buffer.BlockCopy(via.EncodedBytes, 0, buffer, offset, via.EncodedBytes.Length);
215Buffer.BlockCopy(contentType.EncodedBytes, 0, buffer, offset + via.EncodedBytes.Length, contentType.EncodedBytes.Length);
343return via.EncodedBytes.Length + contentType.EncodedBytes.Length;
348Buffer.BlockCopy(via.EncodedBytes, 0, buffer, offset, via.EncodedBytes.Length);
349Buffer.BlockCopy(contentType.EncodedBytes, 0, buffer, offset + via.EncodedBytes.Length, contentType.EncodedBytes.Length);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SessionConnectionReader.cs (4)
148var result = _connection.BeginRead(0, _buffer.Length, timeoutHelper.RemainingTime(), TaskHelpers.OnAsyncCompletionCallback, tcs);
205(EnvelopeSize - EnvelopeOffset) >= _buffer.Length)
207bytesRead = _connection.Read(EnvelopeBuffer, EnvelopeOffset, _buffer.Length, timeoutHelper.RemainingTime());
212bytesRead = _connection.Read(_buffer, 0, _buffer.Length, timeoutHelper.RemainingTime());
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\PrimitiveOperationFormatter.cs (18)
519if (parts.Length != parameters.Length)
521new ArgumentException(string.Format(SRServiceModel.SFxParameterCountMismatch, "parts", parts.Length, "parameters", parameters.Length), "parameters"));
526for (int i = nextPartIndex; i < parts.Length; i++)
584if (parts.Length != parameters.Length)
586new ArgumentException(string.Format(SRServiceModel.SFxParameterCountMismatch, "parts", parts.Length, "parameters", parameters.Length), "parameters"));
589for (int i = 0; i < parts.Length; i++)
813writer.WriteBase64(arrayValue, 0, arrayValue.Length);
819writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
825writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
831writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
837writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
843writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
849writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
855writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\DataProtectionSecurityStateEncoder.cs (5)
34_entropy = DiagnosticUtility.Utility.AllocateByteArray(entropy.Length);
35Buffer.BlockCopy(entropy, 0, _entropy, 0, entropy.Length);
52result = DiagnosticUtility.Utility.AllocateByteArray(_entropy.Length);
53Buffer.BlockCopy(_entropy, 0, result, 0, _entropy.Length);
63result.AppendFormat("{0} Entropy Length={1}", Environment.NewLine, (_entropy == null) ? 0 : _entropy.Length);
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityUtils.cs (13)
173for (int i = 0; i < s_TokenImpersonationLevelOrder.Length; i++)
436while (read < buffer.Length)
438int actual = reader.ReadContentAsBase64(buffer, read, buffer.Length - read);
446if (read < buffer.Length)
454Buffer.BlockCopy(buffers[i], 0, buffer, offset, buffers[i].Length);
455offset += buffers[i].Length;
852byte[] copy = Fx.AllocateByteArray(buffer.Length);
853Buffer.BlockCopy(buffer, 0, copy, 0, buffer.Length);
859certificate = (rawData == null || rawData.Length == 0) ? null : new X509Certificate2(rawData);
965if (partsWithSlashDelimiter.Length == 2 && partsWithAtDelimiter.Length == 1)
972else if (partsWithSlashDelimiter.Length == 1 && partsWithAtDelimiter.Length == 2)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSUtilitySpecificationVersion.cs (6)
98writer.WriteChars(creationTime, 0, creationTime.Length);
103writer.WriteChars(expiryTime, 0, expiryTime.Length);
154stream.Write(_fragment1, 0, _fragment1.Length);
156stream.Write(_fragment2, 0, _fragment2.Length);
158stream.Write(_fragment3, 0, _fragment3.Length);
160stream.Write(_fragment4, 0, _fragment4.Length);
dotnet-svcutil-lib.Tests (2)
dotnet-user-jwts (13)
dotnet-user-secrets (7)
dotnet-watch (1)
EventSourceGenerator (1)
Extensibility.MessageEncoder.IntegrationTests (1)
Extensibility.WebSockets.IntegrationTests (3)
GenerateAnalyzerNuspec (8)
GenerateDocumentationAndConfigFiles (154)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
106if (trivia.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
99where nameSplit.Length == 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (6)
23=> CreateReadableStream(bytes, bytes.Length);
81for (long c = 0; c < chunks.Length; c++)
218Read(this.chunks, 0, this.length, array, 0, array.Length);
232var copyCount = Math.Min(chunk.Length, count);
315Array.Clear(chunk, 0, chunk.Length);
338Array.Clear(chunks[chunkIndex], chunkOffset, chunks[chunkIndex].Length - chunkOffset);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
55if (typeArguments.Length == 0)
ilasm (2)
ILAssembler (43)
ilc (6)
ILCompiler.Compiler (290)
Compiler\TypePreinit.cs (52)
176if (ehRegions != null && ehRegions.Length > 0)
195Value[] locals = new Value[localTypes.Length];
196for (int i = 0; i < localTypes.Length; i++)
572if (finalizerMethodILBytes.Length != 1 || finalizerMethodILBytes[0] != (byte)ILOpcode.ret)
1040if (index >= locals.Length)
1063if (index >= locals.Length)
1095if (index >= storage.Length)
1534if (addition > previousByRef.PointedToBytes.Length - previousByRef.PointedToOffset
1818if (sizeBytes > addressValue.PointedToBytes.Length - addressValue.PointedToOffset
1911if (rvaData.Length % elementSize != 0)
1913retVal = new SpanValue(elementType, rvaData, 0, rvaData.Length);
2315public override int Size => InstanceBytes.Length;
2352Array.Copy(vtvalue.InstanceBytes, InstanceBytes, InstanceBytes.Length);
2359|| vtvalue.InstanceBytes.Length != InstanceBytes.Length)
2365for (int i = 0; i < InstanceBytes.Length; i++)
2391if (InstanceBytes.Length != size)
2418public override int Size => _entryType.InstanceFieldSize.AsInt * _targetFields.Length;
2478for (int i = 0; i < _targetFields.Length; i++)
2483Debug.Assert(_entryType.GetField("Vtable"u8).Offset.AsInt == _guidBytes[i].Length);
2541&& guidValue.Size == _parent._guidBytes[_index].Length)
2543Array.Copy(guidValue.InstanceBytes, _parent._guidBytes[_index], _parent._guidBytes[_index].Length);
2575&& field.Offset.AsInt < _parent._entryType.InstanceFieldSize.AsInt * _parent._targetFields.Length)
2609public override int Size => _methods.Length * _type.Context.Target.PointerSize;
2680Array.Copy(other._methods, _methods, other._methods.Length);
2719&& _parent._methods.Length - _index >= otherStruct._methods.Length)
2721Array.Copy(otherStruct._methods, 0, _parent._methods, _index, otherStruct._methods.Length);
2732|| mdType.InstanceFieldSize.AsInt > (_parent._methods.Length - _index) * _parent._type.Context.Target.PointerSize)
2739Array.Copy(_parent._methods, _index, slots, 0, slots.Length);
2755if (index >= _parent._methods.Length)
2791if (_index + numSlots > _parent._methods.Length)
2911Debug.Assert(index <= bytes.Length);
2912Debug.Assert(length <= bytes.Length - index);
3107if ((uint)size > (uint)(PointedToBytes.Length - PointedToOffset))
3126if (PointedToOffset + src.Length > PointedToBytes.Length)
3129Array.Copy(src, 0, PointedToBytes, PointedToOffset, src.Length);
3137|| ((MetadataType)type).InstanceFieldSize.AsInt > PointedToBytes.Length - PointedToOffset)
3144Array.Copy(PointedToBytes, PointedToOffset, result.InstanceBytes, 0, result.InstanceBytes.Length);
3334if (bytes.Length != _data.Length)
3337Array.Copy(bytes, _data, bytes.Length);
3357Debug.Assert(valueToStore.InstanceBytes.Length == _elementSize);
3358Array.Copy(valueToStore.InstanceBytes, 0, _data, index * _elementSize, valueToStore.InstanceBytes.Length);
3448int length = _value.Length - startOffset - sizeof(char) /* terminating null */;
3533Array.Copy(valuetype.InstanceBytes, 0, result._data, type.Context.Target.PointerSize, valuetype.InstanceBytes.Length);
3548Array.Copy(_data, type.Context.Target.PointerSize, result.InstanceBytes, 0, result.InstanceBytes.Length);
3572builder.EmitBytes(_data, pointerSize, _data.Length - pointerSize);
3597if (fieldOffset + fieldSize > _instanceBytes.Length - _offset)
3619if (fieldOffset + fieldSize > _instanceBytes.Length - _offset)
3649if (fieldOffset + fieldSize > _instanceBytes.Length - _offset)
ILCompiler.DependencyAnalysisFramework (1)
ILCompiler.Diagnostics (9)
ILCompiler.MetadataTransform (64)
ILCompiler.ReadyToRun (233)
ILCompiler.RyuJit (67)
ILCompiler.TypeSystem (137)
illink (39)
ILLink.RoslynAnalyzer (9)
ILLink.Tasks (2)
Infrastructure.Common (9)
Infrastructure.Tests (24)
PowerShellScripts\ExpandTestMatrixGitHubTests.cs (10)
125Assert.Equal(3, expanded.Include.Length);
312Assert.Equal(3, expanded.Include.Length);
364Assert.Equal(3, expanded.Include.Length);
397Assert.Equal(2, expanded.Include.Length);
426Assert.Equal(3, expanded.Include.Length);
465Assert.Equal(3, expanded.Include.Length);
499Assert.Equal(3, expanded.Include.Length);
589Assert.Equal(3, regularEntries.Length);
593Assert.Equal(6, splitEntries.Length);
611Assert.Equal(9, allNoNugets.Length);
installer.tasks (19)
Keycloak.ApiService (1)
Microsoft.Analyzers.Extra (1)
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.Analyzers.Local (3)
Microsoft.Analyzers.Local.Tests (4)
Microsoft.AspNetCore (2)
Microsoft.AspNetCore.Antiforgery (27)
Microsoft.AspNetCore.App.Analyzers (4)
Microsoft.AspNetCore.Authentication (1)
Microsoft.AspNetCore.Authentication.Abstractions (1)
Microsoft.AspNetCore.Authentication.Cookies (1)
Microsoft.AspNetCore.Authentication.OAuth (1)
Microsoft.AspNetCore.Authorization (3)
Microsoft.AspNetCore.Authorization.Policy (2)
Microsoft.AspNetCore.Components (87)
Microsoft.AspNetCore.Components.Analyzers (2)
Microsoft.AspNetCore.Components.Authorization (2)
Microsoft.AspNetCore.Components.Endpoints (31)
Microsoft.AspNetCore.Components.Forms (6)
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
Microsoft.AspNetCore.Components.Server (53)
Microsoft.AspNetCore.Components.Web (4)
Microsoft.AspNetCore.Connections.Abstractions (6)
Microsoft.AspNetCore.Cors (1)
Microsoft.AspNetCore.Cryptography.Internal (1)
Microsoft.AspNetCore.Cryptography.KeyDerivation (15)
Microsoft.AspNetCore.DataProtection (73)
Cng\DpapiSecretSerializerHelper.cs (9)
55return ProtectWithDpapiCore(pbPlaintextSecret, (uint)plaintextSecret.Length, pbPurpose, (uint)_purpose.Length, fLocalMachine: protectToLocalMachine);
61Array.Clear(plaintextSecret, 0, plaintextSecret.Length);
134cbData: (uint)plaintextSecret.Length);
139Array.Clear(plaintextSecret, 0, plaintextSecret.Length);
204return UnprotectWithDpapiCore(pbProtectedSecret, (uint)protectedSecret.Length, pbPurpose, (uint)_purpose.Length);
268cbData: (uint)protectedData.Length);
329cbData: (uint)protectedData.Length);
Managed\ManagedAuthenticatedEncryptor.cs (5)
637CryptoUtil.Assert(ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes, "ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes");
638Buffer.BlockCopy(ciphertext, 0, retVal, idx, ciphertext.Length);
648CryptoUtil.Assert(digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes, "digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes");
649Buffer.BlockCopy(digest, 0, retVal, idx, digest.Length);
653CryptoUtil.Assert(idx == retVal.Length, "idx == retVal.Length");
Microsoft.AspNetCore.DataProtection.Abstractions (7)
Microsoft.AspNetCore.DataProtection.Extensions (6)
Microsoft.AspNetCore.DeveloperCertificates.XPlat (11)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (8)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
702Array.Clear(keyBytes, 0, keyBytes.Length);
703Array.Clear(pem, 0, pem.Length);
709Array.Clear(keyBytes, 0, keyBytes.Length);
710Array.Clear(pem, 0, pem.Length);
760Array.Clear(bytes, 0, bytes.Length);
788Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Microsoft.AspNetCore.Diagnostics (7)
Microsoft.AspNetCore.Diagnostics.HealthChecks (1)
Microsoft.AspNetCore.Diagnostics.Middleware (15)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (12)
Microsoft.AspNetCore.HeaderParsing (1)
Microsoft.AspNetCore.HostFiltering (2)
Microsoft.AspNetCore.Hosting (28)
Microsoft.AspNetCore.Http (12)
Microsoft.AspNetCore.Http.Abstractions (46)
Microsoft.AspNetCore.Http.Connections (10)
Microsoft.AspNetCore.Http.Extensions (64)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (16)
69if (parameters.Length == 0)
77for (var i = 0; i < parameters.Length; i++)
91List<ParameterInfo> list = new(parameters.Length);
107if (constructor is not null && constructorParameters is { Length: > 0 })
144if (constructorAttributes == null || constructorAttributes is { Length: 0 })
151var mergedAttributes = new Attribute[constructorAttributes.Length + propertyAttributes.Length];
152Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
153Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
162if (constructorAttributes == null || constructorAttributes is { Length: 0 })
171var mergedAttributes = new object[constructorAttributes.Length + propertyAttributes.Length];
172Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
173Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.HttpLogging (20)
Microsoft.AspNetCore.HttpOverrides (33)
Microsoft.AspNetCore.Identity (7)
Microsoft.AspNetCore.Localization (4)
Microsoft.AspNetCore.Mvc.Abstractions (15)
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
Microsoft.AspNetCore.Mvc.ApiExplorer (17)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (16)
69if (parameters.Length == 0)
77for (var i = 0; i < parameters.Length; i++)
91List<ParameterInfo> list = new(parameters.Length);
107if (constructor is not null && constructorParameters is { Length: > 0 })
144if (constructorAttributes == null || constructorAttributes is { Length: 0 })
151var mergedAttributes = new Attribute[constructorAttributes.Length + propertyAttributes.Length];
152Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
153Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
162if (constructorAttributes == null || constructorAttributes is { Length: 0 })
171var mergedAttributes = new object[constructorAttributes.Length + propertyAttributes.Length];
172Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
173Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
Microsoft.AspNetCore.Mvc.Core (114)
Microsoft.AspNetCore.Mvc.Cors (1)
Microsoft.AspNetCore.Mvc.DataAnnotations (1)
Microsoft.AspNetCore.Mvc.Formatters.Xml (1)
Microsoft.AspNetCore.Mvc.Localization (1)
Microsoft.AspNetCore.Mvc.Razor (9)
Microsoft.AspNetCore.Mvc.RazorPages (21)
Microsoft.AspNetCore.Mvc.TagHelpers (14)
Cache\DistributedCacheTagHelperService.cs (10)
168var keyLength = BitConverter.GetBytes(serializedKey.Length);
170buffer.Write(keyLength, 0, keyLength.Length);
171buffer.Write(serializedKey, 0, serializedKey.Length);
172buffer.Write(value, 0, value.Length);
185buffer.Read(keyLengthBuffer, 0, keyLengthBuffer.Length);
189buffer.Read(serializedKeyBuffer, 0, serializedKeyBuffer.Length);
194decoded = new byte[value.Length - keyLengthBuffer.Length - serializedKeyBuffer.Length];
195buffer.Read(decoded, 0, decoded.Length);
Microsoft.AspNetCore.Mvc.ViewFeatures (43)
Microsoft.AspNetCore.OutputCaching (21)
Microsoft.AspNetCore.RateLimiting (1)
Microsoft.AspNetCore.Razor (1)
Microsoft.AspNetCore.Razor.Runtime (3)
Microsoft.AspNetCore.Razor.Utilities.Shared (27)
Microsoft.AspNetCore.ResponseCaching (10)
Microsoft.AspNetCore.ResponseCompression (5)
Microsoft.AspNetCore.Rewrite (5)
Microsoft.AspNetCore.Routing (92)
Microsoft.AspNetCore.Routing.Abstractions (6)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.IIS (1)
Microsoft.AspNetCore.Server.Kestrel.Core (163)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (8)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
702Array.Clear(keyBytes, 0, keyBytes.Length);
703Array.Clear(pem, 0, pem.Length);
709Array.Clear(keyBytes, 0, keyBytes.Length);
710Array.Clear(pem, 0, pem.Length);
760Array.Clear(bytes, 0, bytes.Length);
788Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (5)
Microsoft.AspNetCore.Session (13)
DistributedSession.cs (7)
146if (encodedKey.KeyBytes.Length > KeyLengthLimit)
157var copy = new byte[value.Length];
158Buffer.BlockCopy(src: value, srcOffset: 0, dst: copy, dstOffset: 0, count: value.Length);
326SerializeNumAs2Bytes(output, keyBytes.Length);
327output.Write(keyBytes, 0, keyBytes.Length);
328SerializeNumAs4Bytes(output, entry.Value.Length);
329output.Write(entry.Value, 0, entry.Value.Length);
Microsoft.AspNetCore.SignalR.Common (5)
Microsoft.AspNetCore.SignalR.Core (22)
Microsoft.AspNetCore.StaticFiles (4)
Microsoft.AspNetCore.WebSockets (3)
Microsoft.AspNetCore.WebUtilities (24)
BufferedReadStream.cs (7)
253_bufferCount = _inner.Read(_buffer, 0, _buffer.Length);
281if (minCount > _buffer.Length)
283throw new ArgumentOutOfRangeException(nameof(minCount), minCount, "The value must be smaller than the buffer size: " + _buffer.Length);
296int read = _inner.Read(_buffer, _bufferOffset + _bufferCount, _buffer.Length - _bufferCount - _bufferOffset);
314if (minCount > _buffer.Length)
316throw new ArgumentOutOfRangeException(nameof(minCount), minCount, "The value must be smaller than the buffer size: " + _buffer.Length);
329int read = await _inner.ReadAsync(_buffer.AsMemory(_bufferOffset + _bufferCount, _buffer.Length - _bufferCount - _bufferOffset), cancellationToken);
Microsoft.Build (329)
BackEnd\Components\RequestBuilder\RequestBuilder.cs (14)
343Assumed.Equal(projectFiles.Length, properties.Length, "Properties and project counts not the same");
344Assumed.Equal(projectFiles.Length, toolsVersions.Length, "Tools versions and project counts not the same");
346FullyQualifiedBuildRequest[] requests = new FullyQualifiedBuildRequest[projectFiles.Length];
348for (int i = 0; i < projectFiles.Length; ++i)
388Assumed.Equal(requests.Length, results.Length, "# results != # requests");
587WaitHandle[] allHandles = new WaitHandle[handles.Length + 1];
589Array.Copy(handles, 0, allHandles, 1, handles.Length);
1004Assumed.Equal(requests.Length, results.Length, "# results != # requests");
1024for (int i = 0; i < requests.Length; i++)
1225ProjectErrorUtilities.VerifyThrowInvalidProject(allTargets.Length > 0,
BackEnd\Components\RequestBuilder\TaskHost.cs (26)
293ErrorUtilities.VerifyThrowArgument((targetOutputsPerProject == null) || (projectFileNames.Length == targetOutputsPerProject.Length), "General.TwoVectorsMustHaveSameLength", projectFileNames.Length, targetOutputsPerProject?.Length ?? 0, "projectFileNames", "targetOutputsPerProject");
295BuildEngineResult result = BuildProjectFilesInParallel(projectFileNames, targetNames, globalProperties, new List<String>[projectFileNames.Length], toolsVersion, includeTargetOutputs);
301Assumed.Equal(targetOutputsPerProject.Length, result.TargetOutputsPerProject.Count, $"{targetOutputsPerProject.Length} != {result.TargetOutputsPerProject.Count}");
303for (int i = 0; i < targetOutputsPerProject.Length; i++)
977if (projectFileNames.Length == 1 && projectFileNames[0] == null && globalProperties[0] == null && (undefineProperties == null || undefineProperties[0] == null) && toolsVersion[0] == null)
991for (int i = 0; i < targetNames.Length; i++)
1157if (projectFileNames.Length == 1 && projectFileNames[0] == null && globalProperties[0] == null && (undefineProperties == null || undefineProperties[0] == null) && toolsVersion[0] == null)
1170for (int i = 0; i < targetNames.Length; i++)
1182PropertyDictionary<ProjectPropertyInstance>[] propertyDictionaries = new PropertyDictionary<ProjectPropertyInstance>[projectFileNames.Length];
1184for (int i = 0; i < projectFileNames.Length; i++)
1218Assumed.Equal(results.Length, projectFileNames.Length, $"{results.Length}!={projectFileNames.Length}.");
1222targetOutputsPerProject = new List<IDictionary<string, ITaskItem[]>>(results.Length);
1226for (int i = 0; i < results.Length; i++)
1237ITaskItem[] clonedTaskItem = new ITaskItem[resultEntry.Value.Items.Length];
1238for (int j = 0; j < resultEntry.Value.Items.Length; j++)
1263Assumed.True(results.Length == projectFileNames.Length || !overallSuccess, $"The number of results returned {results.Length} cannot be less than the number of project files {projectFileNames.Length} unless one of the results indicated failure.");
Evaluation\Expander.cs (43)
2540ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2590ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2639ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2663ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2741ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2810ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2882ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2901ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
2914ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
3147ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
3164ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
3198ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
3231ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
3264ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
4028args = new object[_arguments.Length];
4031for (int n = 0; n < _arguments.Length; n++)
4085if (objectInstance != null && args.Length == 1 && (String.Equals("Equals", _methodMethodName, StringComparison.OrdinalIgnoreCase) || String.Equals("CompareTo", _methodMethodName, StringComparison.OrdinalIgnoreCase)))
4104if (_methodMethodName.Equals("GetPathOfFileAbove") && args.Length == 1)
4162IEnumerable<MethodInfo> methods = _receiverType.GetMethods(_bindingFlags).Where(m => m.Name.Equals(_methodMethodName) && m.GetParameters().Length == args.Length);
4246for (int i = index; i < args.Length; i++)
4265ErrorUtilities.ThrowArgument("CouldNotDifferentiateBetweenCompatibleMethods", _methodMethodName, args.Length);
4616object[] coercedArguments = new object[args.Length];
4621for (int n = 0; n < parameters.Length; n++)
4786Type[] types = new Type[_arguments.Length];
4787for (int n = 0; n < _arguments.Length; n++)
4832if (parameters.Length == _arguments.Length)
4909return parameters.Length > 0
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Extensions\IEnumerableExtensions.cs (1)
329return source.Length == 0;
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Extensions\ImmutableArrayExtensions.cs (1)
847int last = copy.Length - 1;
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Segmented\ImmutableSegmentedHashSet`1.cs (1)
355if (array.Length < index + Count)
Microsoft.Build.Framework (54)
Microsoft.Build.Tasks.CodeAnalysis (19)
Microsoft.Build.Tasks.Core (230)
AssemblyDependency\ResolveAssemblyReference.cs (31)
1176AbsolutePath[] result = new AbsolutePath[paths.Length];
1177for (int i = 0; i < paths.Length; i++)
1212AbsolutePath[] result = new AbsolutePath[paths.Length];
1213for (int i = 0; i < paths.Length; i++)
2236if (_cache == null && AssemblyInformationCachePaths != null && AssemblyInformationCachePaths.Length > 0)
2375for (int i = 0; i < _targetFrameworkDirectories.Length; i++)
2388if (installedAssemblyTableInfo?.Length > 0)
2399bool targetingProfile = !String.IsNullOrEmpty(ProfileName) && ((_fullFrameworkFolders.Length > 0) || (FullFrameworkAssemblyTables.Length > 0));
2413if (inclusionListSubsetTableInfo.Length > 0 && (redistList?.Count > 0))
2467for (int i = 0; i < redistList.Errors.Length; ++i)
2848MSBuildEventSource.Log.RarOverallStop(_assemblyNames?.Length ?? -1, _assemblyFiles?.Length ?? -1, _resolvedFiles?.Length ?? -1, _resolvedDependencyFiles?.Length ?? -1, _copyLocalFiles?.Length ?? -1, _findDependencies);
2865MSBuildEventSource.Log.RarOverallStop(_assemblyNames?.Length ?? -1, _assemblyFiles?.Length ?? -1, _resolvedFiles?.Length ?? -1, _resolvedDependencyFiles?.Length ?? -1, _copyLocalFiles?.Length ?? -1, _findDependencies);
2971if (fullRedistAssemblyTableInfo.Length > 0)
3002for (int i = 0; i < fullFrameworkRedistList.Errors.Length; ++i)
3055bool targetFrameworkSubsetIsSet = TargetFrameworkSubsets.Length != 0 || InstalledAssemblySubsetTables.Length != 0;
3059bool fullFrameworkFoldersIsSet = _fullFrameworkFolders.Length > 0;
3060bool fullFrameworkTableLocationsIsSet = FullFrameworkAssemblyTables.Length > 0;
3158if (IgnoreDefaultInstalledAssemblySubsetTables && _installedAssemblySubsetTables.Length == 0)
3165if (_targetFrameworkSubsets.Length == 0 && _installedAssemblySubsetTables.Length == 0)
3248if (TargetFrameworkDirectories?.Length == 1)
Microsoft.Build.Tasks.Git (16)
Microsoft.Build.Utilities.Core (35)
Microsoft.CodeAnalysis (354)
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (15)
224if (count < 0 || count > startLines.Length || count > startColumns.Length || count > endLines.Length || count > endColumns.Length)
387encodedLength = bytes.Length;
388value = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
547if (metadata.Length == 0)
552if (metadata.Length > CustomMetadataByteLimit)
557metadata.Length,
568symWriter.SetSymAttribute(0, "MD2", metadata.Length, pb);
612if (data.Length == 0)
623symWriter.SetSourceServerData(dataPtr, data.Length);
639if (data.Length == 0)
650symWriter.SetSourceLinkData(dataPtr, data.Length);
761Buffer.BlockCopy(data, 4, guidBytes, 0, guidBytes.Length);
InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
Microsoft.CodeAnalysis.Analyzers (175)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
106if (trivia.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
99where nameSplit.Length == 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (6)
23=> CreateReadableStream(bytes, bytes.Length);
81for (long c = 0; c < chunks.Length; c++)
218Read(this.chunks, 0, this.length, array, 0, array.Length);
232var copyCount = Math.Min(chunk.Length, count);
315Array.Clear(chunk, 0, chunk.Length);
338Array.Clear(chunks[chunkIndex], chunkOffset, chunks[chunkIndex].Length - chunkOffset);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
55if (typeArguments.Length == 0)
Microsoft.CodeAnalysis.AnalyzerUtilities (157)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
106if (trivia.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
99where nameSplit.Length == 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (6)
23=> CreateReadableStream(bytes, bytes.Length);
81for (long c = 0; c < chunks.Length; c++)
218Read(this.chunks, 0, this.length, array, 0, array.Length);
232var copyCount = Math.Min(chunk.Length, count);
315Array.Clear(chunk, 0, chunk.Length);
338Array.Clear(chunks[chunkIndex], chunkOffset, chunks[chunkIndex].Length - chunkOffset);
Microsoft.CodeAnalysis.CodeStyle (159)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
106if (trivia.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
99where nameSplit.Length == 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (6)
23=> CreateReadableStream(bytes, bytes.Length);
81for (long c = 0; c < chunks.Length; c++)
218Read(this.chunks, 0, this.length, array, 0, array.Length);
232var copyCount = Math.Min(chunk.Length, count);
315Array.Clear(chunk, 0, chunk.Length);
338Array.Clear(chunks[chunkIndex], chunkOffset, chunks[chunkIndex].Length - chunkOffset);
Microsoft.CodeAnalysis.CodeStyle.Fixes (7)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
55if (typeArguments.Length == 0)
Microsoft.CodeAnalysis.CSharp (860)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.CSharp.Features (19)
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
Microsoft.CodeAnalysis.Extensions.Package (66)
Microsoft.CodeAnalysis.Features (35)
Microsoft.CodeAnalysis.Razor.Compiler (157)
Microsoft.CodeAnalysis.Rebuild (4)
Microsoft.CodeAnalysis.ResxSourceGenerator (154)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
106if (trivia.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
99where nameSplit.Length == 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (6)
23=> CreateReadableStream(bytes, bytes.Length);
81for (long c = 0; c < chunks.Length; c++)
218Read(this.chunks, 0, this.length, array, 0, array.Length);
232var copyCount = Math.Min(chunk.Length, count);
315Array.Clear(chunk, 0, chunk.Length);
338Array.Clear(chunks[chunkIndex], chunkOffset, chunks[chunkIndex].Length - chunkOffset);
Microsoft.CodeAnalysis.Scripting (17)
Microsoft.CodeAnalysis.VisualBasic (101)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.VisualBasic.Features (5)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Microsoft.CodeAnalysis.Workspaces (199)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
106if (trivia.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
99where nameSplit.Length == 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (6)
23=> CreateReadableStream(bytes, bytes.Length);
81for (long c = 0; c < chunks.Length; c++)
218Read(this.chunks, 0, this.length, array, 0, array.Length);
232var copyCount = Math.Min(chunk.Length, count);
315Array.Clear(chunk, 0, chunk.Length);
338Array.Clear(chunks[chunkIndex], chunkOffset, chunks[chunkIndex].Length - chunkOffset);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
55if (typeArguments.Length == 0)
Microsoft.CodeAnalysis.Workspaces.MSBuild (4)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (22)
Microsoft.CSharp (166)
Microsoft\CSharp\RuntimeBinder\RuntimeBinder.cs (19)
79Debug.Assert(args.Length >= 1);
156int arity = callPayload.TypeArguments?.Length ?? 0;
181DynamicMetaObject[] newArgs = new DynamicMetaObject[args.Length - 1];
182Array.Copy(args, 1, newArgs, 0, args.Length - 1);
258ArgumentObject[] array = new ArgumentObject[parameters.Length];
259for (int i = 0; i < parameters.Length; i++)
346LocalVariableSymbol[] locals = new LocalVariableSymbol[parameterExpressions.Length];
348for (int i = 0; i < parameterExpressions.Length; i++)
617TypeArray typeArgumentsAsTypeArray = typeArguments?.Length > 0
754int arity = payload.TypeArguments?.Length ?? 0;
841BindingFlag.BIND_RVALUEREQUIRED | BindingFlag.BIND_STMTEXPRONLY, memGroup, CreateArgumentListEXPR(arguments, locals, 1, arguments.Length)) as ExprCall;
854if (conditions.Length > 0)
969Debug.Assert(arguments.Length == 1);
1010Debug.Assert(arguments.Length == 2);
1220Debug.Assert(arguments.Length == 1);
1256Debug.Assert(arguments.Length == 1);
1280Debug.Assert(arguments.Length >= 2);
1293indexerArguments = CreateArgumentListEXPR(arguments, locals, 1, arguments.Length - 1);
1305int indexOfLast = arguments.Length - 1;
Microsoft.Data.Analysis (33)
Microsoft.Data.Analysis.Tests (52)
Microsoft.Deployment.DotNet.Releases (11)
Microsoft.Diagnostics.DataContractReader (2)
Microsoft.Diagnostics.DataContractReader.Contracts (5)
Microsoft.Diagnostics.DataContractReader.DataGenerator (6)
Microsoft.Diagnostics.DataContractReader.Legacy (43)
Microsoft.Diagnostics.NETCore.Client (33)
DiagnosticsIpc\IpcAdvertise.cs (10)
30private static readonly int IpcAdvertiseV1SizeInBytes = Magic_V1.Length + 16 + 8 + 2; // 34 bytes
49int read = await stream.ReadAsync(buffer, totalRead, buffer.Length - totalRead, token).ConfigureAwait(false);
56while (totalRead < buffer.Length);
59byte[] magic = new byte[Magic_V1.Length];
60Array.Copy(buffer, magic, Magic_V1.Length);
61index += Magic_V1.Length;
87Array.Copy(Magic_V1, buffer, Magic_V1.Length);
88index += Magic_V1.Length;
91Array.Copy(cookieBuffer, 0, buffer, index, cookieBuffer.Length);
92index += cookieBuffer.Length;
DiagnosticsServerRouter\DiagnosticsServerRouterFactory.cs (4)
1352using Task<int> readTask = ipcClientStream.ReadAsync(buffer, 0, buffer.Length, cancelReadConnect.Token);
1413await tcpClientStream.WriteAsync(buffer, 0, buffer.Length, token).ConfigureAwait(false);
1558int bytesRead = await _backendStream.ReadAsync(buffer, 0, buffer.Length, token).ConfigureAwait(false);
1601int bytesRead = await _frontendStream.ReadAsync(buffer, 0, buffer.Length, token).ConfigureAwait(false);
Microsoft.DiaSymReader (37)
Writer\SymUnmanagedWriterImpl.cs (19)
169if (algorithmId != default && checksum.Length > 0)
173documentWriter.SetCheckSum(algorithmId, (uint)checksum.Length, checksum);
185documentWriter.SetSource((uint)source.Length, source);
209if (count < 0 || count > startLines.Length || count > startColumns.Length || count > endLines.Length || count > endColumns.Length)
378encodedLength = bytes.Length;
379value = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
480if (yieldOffsets.Length != resumeOffsets.Length)
487int count = yieldOffsets.Length;
530if (metadata.Length == 0)
542symWriter.SetSymAttribute(0, "MD2", metadata.Length, pb);
586if (data.Length == 0)
597symWriter.SetSourceServerData(dataPtr, data.Length);
613if (data.Length == 0)
624symWriter.SetSourceLinkData(dataPtr, data.Length);
735Buffer.BlockCopy(data, 4, guidBytes, 0, guidBytes.Length);
Microsoft.DotNet.ApiCompat.Task (19)
Microsoft.DotNet.ApiCompatibility (18)
Microsoft.DotNet.ApiSymbolExtensions (5)
Microsoft.DotNet.Arcade.Sdk (5)
Microsoft.DotNet.Build.Manifest (2)
Microsoft.DotNet.Build.Tasks.Feed (2)
Microsoft.DotNet.Build.Tasks.Installers (26)
Microsoft.DotNet.Build.Tasks.Packaging (36)
Microsoft.DotNet.Build.Tasks.TargetFramework (2)
Microsoft.DotNet.Build.Tasks.Templating (4)
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Microsoft.DotNet.Build.Tasks.Workloads (5)
Microsoft.DotNet.Cli.Definitions (8)
Microsoft.DotNet.Cli.Utils (19)
Microsoft.DotNet.CMake.Sdk (2)
Microsoft.DotNet.CodeAnalysis (3)
Microsoft.DotNet.GenFacades (1)
Microsoft.DotNet.HotReload.Utils.Generator.Frontend (1)
Microsoft.DotNet.HotReload.Utils.Generator.Tasks (4)
Microsoft.DotNet.HotReload.Watch (22)
Microsoft.DotNet.HotReload.WebAssembly.Browser (6)
Microsoft.DotNet.Internal.DependencyInjection.Testing (2)
Microsoft.DotNet.InternalAbstractions (2)
Microsoft.DotNet.NuGetRepack.Tasks (2)
Microsoft.DotNet.PackageTesting (6)
Microsoft.DotNet.ProjectTools (9)
Microsoft.DotNet.SdkResolver (1)
Microsoft.DotNet.SharedFramework.Sdk (12)
Microsoft.DotNet.SourceBuild.Tasks (1)
Microsoft.DotNet.StrongName (7)
Microsoft.DotNet.TemplateLocator (12)
Microsoft.DotNet.XliffTasks (5)
Microsoft.Extensions.AI (7)
Microsoft.Extensions.AI.Abstractions (16)
Microsoft.Extensions.AI.Abstractions.Tests (9)
Microsoft.Extensions.AI.Evaluation.NLP (22)
Microsoft.Extensions.AI.Evaluation.NLP.Tests (7)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (5)
Microsoft.Extensions.AI.Integration.Tests (5)
Microsoft.Extensions.AI.OpenAI (2)
Microsoft.Extensions.AI.OpenAI.Tests (8)
Microsoft.Extensions.AI.Tests (4)
Microsoft.Extensions.AsyncState.Tests (1)
Microsoft.Extensions.Caching.Abstractions (2)
Microsoft.Extensions.Caching.Hybrid (21)
Microsoft.Extensions.Caching.Hybrid.Tests (17)
PayloadTests.cs (8)
48var maxLen = HybridCachePayload.GetMaxBytes(key, tags, bytes.Length);
78var maxLen = HybridCachePayload.GetMaxBytes(key, tags, bytes.Length);
112var maxLen = HybridCachePayload.GetMaxBytes(key, tags, bytes.Length);
142var maxLen = HybridCachePayload.GetMaxBytes(key, tags, bytes.Length);
178var maxLen = HybridCachePayload.GetMaxBytes(key, tags, bytes.Length);
232var maxLen = HybridCachePayload.GetMaxBytes(key, tags, bytes.Length);
259var maxLen = HybridCachePayload.GetMaxBytes(key, tags, bytes.Length) + 1;
345var maxLen = HybridCachePayload.GetMaxBytes(key, writeTags, bytes.Length);
Microsoft.Extensions.Caching.Memory (1)
Microsoft.Extensions.Compliance.Abstractions.Tests (3)
Microsoft.Extensions.Compliance.Testing.Tests (5)
Microsoft.Extensions.Configuration.Binder (15)
Microsoft.Extensions.DataIngestion (9)
Microsoft.Extensions.DataIngestion.Tests (11)
Microsoft.Extensions.DependencyInjection (35)
Microsoft.Extensions.DependencyInjection.Abstractions (46)
Microsoft.Extensions.DependencyModel (10)
Microsoft.Extensions.Diagnostics (1)
Microsoft.Extensions.Diagnostics.Abstractions (2)
Microsoft.Extensions.Diagnostics.HealthChecks (4)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (15)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (6)
Microsoft.Extensions.Diagnostics.Testing (2)
Microsoft.Extensions.DotNetDeltaApplier (7)
Microsoft.Extensions.FileProviders.Embedded (3)
Microsoft.Extensions.Hosting (1)
Microsoft.Extensions.Http (3)
Microsoft.Extensions.Http.Diagnostics (6)
Microsoft.Extensions.Http.Diagnostics.Tests (4)
Microsoft.Extensions.Http.Resilience.Tests (2)
Microsoft.Extensions.Identity.Core (19)
PasswordHasher.cs (13)
148var outputBytes = new byte[13 + salt.Length + subkey.Length];
153Buffer.BlockCopy(salt, 0, outputBytes, 13, salt.Length);
154Buffer.BlockCopy(subkey, 0, outputBytes, 13 + saltSize, subkey.Length);
174if (decodedHashedPassword.Length == 0)
228if (hashedPassword.Length != 1 + SaltSize + Pbkdf2SubkeyLength)
234Buffer.BlockCopy(hashedPassword, 1, salt, 0, salt.Length);
237Buffer.BlockCopy(hashedPassword, 1 + salt.Length, expectedSubkey, 0, expectedSubkey.Length);
270int subkeyLength = hashedPassword.Length - 13 - salt.Length;
276Buffer.BlockCopy(hashedPassword, 13 + salt.Length, expectedSubkey, 0, expectedSubkey.Length);
Microsoft.Extensions.Localization (1)
Microsoft.Extensions.Logging (11)
Microsoft.Extensions.Logging.Abstractions (9)
Microsoft.Extensions.Logging.Console (6)
Microsoft.Extensions.Logging.EventSource (3)
Microsoft.Extensions.Logging.Generators (2)
Microsoft.Extensions.Options (1)
Microsoft.Extensions.Options.Contextual (2)
Microsoft.Extensions.Options.DataAnnotations (1)
Microsoft.Extensions.Options.SourceGeneration (5)
Microsoft.Extensions.Primitives (10)
Microsoft.Extensions.ServiceDiscovery (2)
Microsoft.Extensions.ServiceDiscovery.Dns (9)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (4)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (2)
Microsoft.Extensions.Telemetry (22)
Microsoft.Extensions.Telemetry.Abstractions (4)
Microsoft.Extensions.Telemetry.Abstractions.Tests (4)
Microsoft.Extensions.Telemetry.Tests (19)
Microsoft.Extensions.TimeProvider.Testing.Tests (1)
Microsoft.Extensions.Validation (7)
Microsoft.Gen.BuildMetadata (1)
Microsoft.Gen.BuildMetadata.Unit.Tests (1)
Microsoft.Gen.ComplianceReports (1)
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
Microsoft.Gen.ContextualOptions (1)
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
Microsoft.Gen.Logging (1)
Microsoft.Gen.Logging.Generated.Tests (1)
Microsoft.Gen.Logging.Unit.Tests (2)
Microsoft.Gen.MetadataExtractor (4)
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
Microsoft.Gen.Metrics (1)
Microsoft.Gen.Metrics.Unit.Tests (1)
Microsoft.Gen.MetricsReports (4)
Microsoft.Gen.MetricsReports.Unit.Tests (1)
Microsoft.Interop.ComInterfaceGenerator (1)
Microsoft.Interop.JavaScript.JSImportGenerator (9)
Microsoft.Interop.LibraryImportGenerator (1)
Microsoft.Interop.SourceGeneration (2)
Microsoft.JSInterop (18)
Microsoft.Maui (53)
Microsoft.Maui.Controls (135)
Layout\BoundsTypeConverter.cs (10)
30 hasX = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh[0], NumberStyles.Number, CultureInfo.InvariantCulture, out x);
31 hasY = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh[1], NumberStyles.Number, CultureInfo.InvariantCulture, out y);
32 hasW = xywh.Length == 4 && double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out w);
33 hasH = xywh.Length == 4 && double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out h);
35 if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh[2].Trim(), StringComparison.OrdinalIgnoreCase) == 0)
41 if (!hasH && xywh.Length == 4 && string.Compare("AutoSize", xywh[3].Trim(), StringComparison.OrdinalIgnoreCase) == 0)
47 if (hasX && hasY && xywh.Length == 2)
49 if (hasX && hasY && hasW && hasH && xywh.Length == 4)
Microsoft.Maui.Controls.BindingSourceGen (5)
Microsoft.Maui.Controls.Build.Tasks (41)
CompiledConverters\BoundsTypeConverter.cs (11)
25 if (xywh.Length != 2 && xywh.Length != 4)
28 hasX = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh[0], NumberStyles.Number, CultureInfo.InvariantCulture, out x);
29 hasY = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh[1], NumberStyles.Number, CultureInfo.InvariantCulture, out y);
30 hasW = xywh.Length == 4 && double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out w);
31 hasH = xywh.Length == 4 && double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out h);
33 if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh[2].Trim(), StringComparison.OrdinalIgnoreCase) == 0)
39 if (!hasH && xywh.Length == 4 && string.Compare("AutoSize", xywh[3].Trim(), StringComparison.OrdinalIgnoreCase) == 0)
45 if (hasX && hasY && xywh.Length == 2)
Microsoft.Maui.Controls.DesignTools (17)
Microsoft.Maui.Controls.Foldable (1)
Microsoft.Maui.Controls.SourceGen (4)
Microsoft.Maui.Controls.Xaml (22)
Microsoft.Maui.Graphics (34)
Microsoft.Maui.Graphics.Skia (9)
Microsoft.Maui.Graphics.Win2D.WinUI.Desktop (5)
Microsoft.Maui.Resizetizer (14)
Microsoft.ML.AutoML (103)
Sweepers\SmacSweeper.cs (16)
125Runtime.Contracts.Assert(data.GetRowCount() == targets.Length, "This data view will have as many rows as there have been evaluations");
160ParameterSet[] randomChallengers = _randomSweeper.ProposeSweeps(numOfCandidates - eiChallengers.Length, previousRuns);
164ParameterSet[] configs = new ParameterSet[eiChallengers.Length + randomChallengers.Length];
165Array.Copy(eiChallengers, 0, configs, 0, eiChallengers.Length);
166Array.Copy(randomChallengers, 0, configs, eiChallengers.Length, randomChallengers.Length);
197Runtime.Contracts.Assert(randomConfigs.Length == randomEIs.Length);
199for (int i = 0; i < randomConfigs.Length; i++)
264for (int i = 0; i < _sweepParameters.Length; i++)
334VBuffer<Float> features = new VBuffer<Float>(transformedParams.Length, transformedParams);
369double[][] meansAndStdDevs = new double[leafValues.Length][];
370for (int i = 0; i < leafValues.Length; i++)
430double[] eis = new double[forestStatistics.Length];
431for (int i = 0; i < forestStatistics.Length; i++)
Utils\ArrayMath.cs (19)
22for (int i = 1; i < array.Length; i++)
36return Enumerable.Range(0, array.Length).OrderBy(index => array[index]).ToArray();
60double[] ret = new double[array.Length + 1];
63Array.Copy(array, index, ret, index + 1, array.Length - index);
128if (truth.Length != pred.Length)
130throw new ArgumentException($"length doesn't match, {truth.Length} != {pred.Length}");
133var diff = Enumerable.Range(0, truth.Length).Select(i => truth[i] - pred[i]).ToArray();
143if (truth.Length != pred.Length)
145throw new ArgumentException($"length doesn't match, {truth.Length} != {pred.Length}");
148var diff = Enumerable.Range(0, truth.Length).Select(i => truth[i] - pred[i]).ToArray();
157if (truth.Length != pred.Length)
159throw new ArgumentException($"length doesn't match, {truth.Length} != {pred.Length}");
162var diff = Enumerable.Range(0, truth.Length).Select(i => Math.Abs(truth[i] - pred[i])).ToArray();
Microsoft.ML.AutoML.Tests (10)
Microsoft.ML.CodeGenerator (7)
Microsoft.ML.Core (236)
CommandLine\CmdParser.cs (28)
313if (settings == null || settings.Length == 0)
494if (nicks.Length == 0 || nicks.Length == 1 && nicks[0].ToLowerInvariant() == name.ToLowerInvariant())
566for (int i = 0; i < strs.Length; i++)
589if (value == null && i + 2 < strs.Length && strs[i + 1] == "=")
611hadError |= !info.ArgDef.SetValue(this, ref values[info.Args.Length], str, "", destination);
617if (value == null && i + 2 < strs.Length && strs[i + 1] == "=")
624Contracts.Assert(0 <= arg.Index && arg.Index < info.Args.Length);
635if (i + 2 < strs.Length && strs[i + 1] == "=")
642else if (i + 1 < strs.Length)
661if (!IsCurlyGroup(value) && i + 1 < strs.Length && IsCurlyGroup(strs[i + 1]))
672if (!IsCurlyGroup(value) && i + 1 < strs.Length && IsCurlyGroup(strs[i + 1]))
758var values = new ArgValue[info.Args.Length + 1];
762for (int i = 0; i < info.Args.Length; i++)
769hadError |= info.ArgDef.Finish(this, values[info.Args.Length], destination);
1259Arg[] args = Utils.BuildArray(argumentInfo.Args.Length, i => new Arg(argumentInfo.Args[i]));
1260Array.Sort(args, 0, args.Length, Comparer<Arg>.Create((x, y) => x.SortOrder.CompareTo(y.SortOrder)));
1345Contracts.Assert(map.Count >= args.Length);
1480if (_infoCustom.ArgDef == null && _infoCustom.Args.Length == 0)
1499if (type.GenericTypeArguments.Length != 2)
1594for (int i = 0; i < arr.Length; i++)
1629for (int i = 0; i < arr.Length; i++)
1637for (int i = 0; i < res.Length; i++)
1647for (int i = 0; i < res.Length; i++)
2315switch (factoryType.GenericTypeArguments.Length)
2345if (settings == null || (settings.Length == 1 && string.IsNullOrEmpty(settings[0])))
2359if (string.IsNullOrEmpty(Name) && Settings.Length == 0)
2362if (Settings.Length == 0)
Utilities\Utils.cs (33)
63return x == null ? 0 : x.Length;
69return x == null ? 0 : x.Length;
233return FindIndexSorted(input, 0, input.Length, value);
358Contracts.Assert(0 <= min && min <= lim && lim <= input.Length);
393Contracts.Assert(0 <= min && min <= lim && lim <= input.Length);
426Contracts.Assert(0 <= min && min <= lim && lim <= input.Length);
490var res = new int[perm.Length];
491for (int i = 0; i < perm.Length; i++)
494Contracts.Assert(0 <= j && j < perm.Length);
517if (arr1.Length != arr2.Length)
520for (int i = 0; i < arr1.Length; i++)
534if (arr1.Length != arr2.Length)
537for (int i = 0; i < arr1.Length; i++)
559if (arr1.Length != arr2.Length)
562for (int i = 0; i < arr1.Length; i++)
576if (arr1.Length != arr2.Length)
579for (int i = 0; i < arr1.Length; i++)
735if (col.Index < result.Length)
748for (int i = 0; i < result.Length; i++)
862if (a.Length == 0)
864if (b.Length == 0)
866var res = new T[a.Length + b.Length];
867Array.Copy(a, res, a.Length);
868Array.Copy(b, 0, res, a.Length, b.Length);
884checked { size += a.Length; }
897if (size == ne.Length)
1190Contracts.CheckParam(meth.GetGenericArguments().Length == 1, nameof(func),
Microsoft.ML.Core.Tests (45)
UnitTests\TestVBuffer.cs (19)
236for (var j = 0; j < multResExpected.Length; j++)
262for (var j = 0; j < multResExpected.Length; j++)
294Assert.Equal(expectedValues.Length, actualValues.Length);
295for (int i = 0; i < expectedValues.Length; i++)
328T2[] values = new T2[indices.Length];
330for (int ii = 0; ii < indices.Length; ++ii)
340b = new VBuffer<T2>(a.Length, indices.Length, values, indices);
373T2[] values = new T2[indices.Length];
375for (int ii = 0; ii < indices.Length; ++ii)
382b = new VBuffer<T2>(a.Length, indices.Length, values, indices);
505TDst[] values = new TDst[indices.Length];
508for (int i = 0; i < indices.Length; ++i)
514dst = new VBuffer<TDst>(a.Length, indices.Length, values, indices);
981for (int i = count; i < indices.Length; ++i)
983if (indices.Length == 0 && rgen.Next(2) == 0)
987for (int i = 0; i < values.Length; ++i)
989if (values.Length == 0 && rgen.Next(2) == 0)
1099Contracts.Assert(cases == Enum.GetValues(typeof(GenLogic)).Length);
Microsoft.ML.CpuMath (19)
Microsoft.ML.CpuMath.UnitTests (32)
UnitTests.cs (32)
64for (int i = 0; i < testMatrix2.Length; i++)
354for (int i = 0; i < expected.Length; i++)
380for (int i = 0; i < expected.Length; i++)
407for (int i = 0; i < expected.Length; i++)
412CpuMathUtils.Scale(defaultScale, src, dst, dst.Length);
433for (int i = 0; i < expected.Length; i++)
461for (int i = 0; i < expected.Length; i++)
466CpuMathUtils.AddScale(defaultScale, src, dst, dst.Length);
518for (int i = 0; i < expected.Length; i++)
523CpuMathUtils.AddScaleCopy(defaultScale, src, dst, result, dst.Length);
545for (int i = 0; i < dst.Length; i++)
550for (int i = 0; i < expected.Length; i++)
555CpuMathUtils.Add(src, dst, dst.Length);
607for (int i = 0; i < src2.Length; i++)
614for (int i = 0; i < expected.Length; i++)
619CpuMathUtils.MulElementWise(src1, src2, dst, dst.Length);
638for (int i = 0; i < src.Length; i++)
661for (int i = 0; i < src.Length; i++)
687for (int i = 0; i < src.Length; i++)
709for (int i = 0; i < src.Length; i++)
735for (int i = 0; i < src.Length; i++)
759for (int i = 0; i < src.Length; i++)
788for (int i = 0; i < src.Length; i++)
814for (int i = 0; i < dst.Length; i++)
820for (int i = 0; i < dst.Length; i++)
825var actual = CpuMathUtils.DotProductDense(src, dst, dst.Length);
847for (int i = 0; i < dst.Length; i++)
879for (int i = 0; i < dst.Length; i++)
885for (int i = 0; i < dst.Length; i++)
891var actual = CpuMathUtils.L2DistSquared(src, dst, dst.Length);
941for (int i = 0; i < expected.Length; i++)
947CpuMathUtils.SdcaL1UpdateDense(defaultScale, src.Length, src, defaultScale, v, w);
Microsoft.ML.Data (1165)
DataLoadSave\Binary\BinaryLoader.cs (28)
512ectx.Assert(args.Length == 1);
643for (int i = 0; i < _aliveColumns.Length; ++i)
1256Utils.BuildSubsetMaps(toc.Length, columnsNeeded, out activeIndices, out _colToActivesIndex);
1257_actives = new TableOfContentsEntry[activeIndices.Length];
1258for (int i = 0; i < activeIndices.Length; ++i)
1264_pipes = new ReadPipe[parent.RowCount > 0 ? _actives.Length : 0];
1265_pipeGetters = new Delegate[_actives.Length];
1285if (_pipes.Length == 0)
1291for (int c = 0; c < _pipeGetters.Length; ++c)
1301int pipeBuffers = 2 * ((_parent._threads + _pipes.Length - 1) / _pipes.Length);
1303for (int c = 0; c < _pipes.Length; ++c)
1354for (int c = 0; c < _pipes.Length; ++c)
1385long decompressSequenceLim = (long)_numBlocks * _actives.Length;
1386for (int w = 0; w < pipeWorkers.Length; ++w)
1395int pipeIndex = (int)(seq % _pipes.Length);
1426for (int c = 0; c < _pipes.Length; ++c)
1431for (int c = 0; c < _pipes.Length; ++c)
1969Ch.CheckParam(column.Index < _colToActivesIndex.Length, nameof(column));
1977for (int c = 0; c < _pipes.Length; ++c)
2013if (!more && _pipes.Length > 0)
2037Ch.CheckParam(column.Index < _colToActivesIndex.Length, nameof(column), "requested column not active.");
2075for (int i = 1; i < _blockShuffleOrder.Length; ++i)
2090Ch.Assert(pos / _rowsPerBlock < _blockShuffleOrder.Length);
2198isLiveAndCol.Key ? "" : " (DEAD!)", typeDesc, blockLookups.Length, col.RowsPerBlock);
2211string deadDisc = deadMtoc.Length > 0 ? string.Format(" ({0} dead)", deadMtoc.Length) : "";
2213mtoc.Length, deadDisc, metadataTocSize, metadataSize);
DataView\Transposer.cs (48)
105_cols = new DataViewSchema.Column[columns.Length];
112for (int c = 0; c < columns.Length; ++c)
132for (int c = 0; c < _cols.Length; ++c)
149_splitLim = new int[_cols.Length];
153for (int c = 0; c < _cols.Length; ++c)
172ch.Trace("{0} of {1} input columns sliced into {2} columns", slicedCount, _cols.Length, toSave.Count);
210int[] indices = new int[columns.Length];
211for (int c = 0; c < columns.Length; ++c)
225for (int c = 0; c < columns.Length; ++c)
247_host.Assert(0 <= tcol && tcol < _cols.Length);
502_rbuffIndices = new int[_rbuff.Length];
523int maxPossibleSize = _rbuff.Length * vecLen;
526Array.Clear(_rbuffIndices, 0, _rbuffIndices.Length);
553var heap = new Heap<KeyValuePair<int, int>>((p1, p2) => p1.Key > p2.Key || (p1.Key == p2.Key && p1.Value > p2.Value), _rbuff.Length);
644if (++irbuff == _rbuff.Length)
670Ch.Assert(_indices[s].Length == _len);
671Ch.Assert(_values[s].Length == _len);
748_splitters = new Splitter[toSlice.Length];
749_incolToLim = new int[toSlice.Length];
754for (int c = 0; c < toSlice.Length; ++c)
775for (int c = 0; c < _splitters.Length; ++c)
787_host.Assert(outputColumnCount == _colToSplitIndex.Length);
791for (int c = 0; c < _splitters.Length; ++c)
813_host.Assert(0 <= incol && incol < _incolToLim.Length);
826_host.Assert(0 <= col && col < _colToSplitIndex.Length);
853for (int i = 0; i < result.Length; ++i)
870activeSplitters = new bool[_splitters.Length];
873for (int i = 0; i < activeSplitters.Length; ++i)
941for (int i = 0; i < ends.Length; ++i)
947for (int i = 0; i < ends.Length; ++i)
950ends[ends.Length - 1] = vectorSize;
1078public override int ColumnCount { get { return _lims.Length; } }
1101Contracts.Assert(lims[lims.Length - 1] == type.Size);
1104_types = new VectorDataViewType[_lims.Length];
1106for (int c = 1; c < _lims.Length; ++c)
1111for (int c = 0; c < _lims.Length; ++c)
1144_srcIndicesLims = new int[Lims.Length];
1146_getters = new ValueGetter<VBuffer<T>>[Lims.Length];
1147for (int c = 0; c < _getters.Length; ++c)
1169Contracts.Check(IsColumnActive(column) && column.Index < _getters.Length);
1227Contracts.Assert(_inputValue.Length == Parent._lims[Parent._lims.Length - 1]);
1237Array.Clear(_srcIndicesLims, 0, _srcIndicesLims.Length);
1242for (int i = 0; i < Lims.Length; ++i)
1274Ch.Assert(Utils.Size(activeSplitters) == slicer._splitters.Length);
1277_sliceRows = new DataViewRow[_slicer._splitters.Length];
1278var activeSrc = new bool[slicer._splitters.Length];
1285for (int i = 0; i < activeSplitters.Length; ++i)
1375ctx.Assert(genTypeArgs.Length == 1);
Deprecated\Vector\VectorUtils.cs (18)
27return CpuMathUtils.DotProductDense(a, b, a.Length);
305Contracts.Check(0 <= offset && offset <= a.Length);
306Contracts.Check(b.Length <= a.Length - offset, "VBuffer b must be no longer than a.Length - offset.");
420return L2DistSquaredHalfSparse(a.AsSpan(0, a.Length), b.GetValues(), b.GetIndices());
430Contracts.CheckParam(src.Length == dst.Length, nameof(dst), "Arrays must have the same dimensionality.");
431if (src.Length == 0)
433CpuMathUtils.Add(src, dst, src.Length);
471Contracts.Check(0 <= offset && offset <= dst.Length);
472Contracts.Check(src.Length <= dst.Length - offset, "Vector src must be no longer than dst.Length - offset.");
499Contracts.Check(src.Length == dst.Length, "Arrays must have the same dimensionality.");
504CpuMathUtils.AddScale(c, src, dst, src.Length);
520if (a == null || a.Length == 0)
538Array.Clear(dst, 0, dst.Length);
543Contracts.Check(a.Length == b.Length, "Arrays must have the same dimensionality.");
546for (int i = 0; i < a.Length; i++)
Evaluators\BinaryClassifierEvaluator.cs (8)
337overallDvBldr.AddColumn(MetricKinds.ColumnNames.StratCol, GetKeyValueGetter(dictionaries), (ulong)dictionaries.Length, stratCol.ToArray());
358confDvBldr.AddColumn(MetricKinds.ColumnNames.StratCol, GetKeyValueGetter(dictionaries), (ulong)dictionaries.Length, confStratCol.ToArray());
363dst = new VBuffer<ReadOnlyMemory<char>>(aggregator.ClassNames.Length, aggregator.ClassNames);
378dvBldr.AddColumn(MetricKinds.ColumnNames.StratCol, GetKeyValueGetter(dictionaries), (ulong)dictionaries.Length, prStratCol.ToArray());
1454for (int i = 0; i < metrics.Length; i++)
1460if (metrics.Length != 1)
1461idv = EvaluateUtils.AddFoldIndex(Host, idv, i, metrics.Length);
1466if (metrics.Length != 1)
Evaluators\MulticlassClassificationEvaluator.cs (16)
211overallDvBldr.AddColumn(MetricKinds.ColumnNames.StratCol, GetKeyValueGetter(dictionaries), (ulong)dictionaries.Length, stratCol.ToArray());
226dst = new VBuffer<ReadOnlyMemory<char>>(allTopK.First().Length, Enumerable.Range(1, allTopK.First().Length).Select(i => new ReadOnlyMemory<char>(i.ToString().ToCharArray())).ToArray());
235confDvBldr.AddColumn(MetricKinds.ColumnNames.StratCol, GetKeyValueGetter(dictionaries), (ulong)dictionaries.Length, confStratCol.ToArray());
240dst = new VBuffer<ReadOnlyMemory<char>>(aggregator.ClassNames.Length, aggregator.ClassNames);
320var res = new double[_totalPerClassLogLoss.Length];
321for (int i = 0; i < _totalPerClassLogLoss.Length; i++)
335for (int i = 0; i < ConfusionTable.Length; i++)
418Host.Assert(score.Type.GetVectorSize() == _scoresArr.Length);
445Host.Check(_scores.Length == _scoresArr.Length);
470if (intLabel < _scoresArr.Length)
500for (int i = 0; i < _scoresArr.Length; i++)
535var editor = VBufferEditor.Create(ref slotNames, ClassNames.Length);
536for (int i = 0; i < ClassNames.Length; i++)
736foreach (var index in Enumerable.Range(0, scoresArr.Length).OrderByDescending(i => scoresArr[i]))
956for (int i = 0; i < metrics.Length; i++)
Evaluators\RankingEvaluator.cs (11)
86for (int i = 0; i < gains.Length; i++)
216overallDvBldr.AddColumn(MetricKinds.ColumnNames.StratCol, GetKeyValueGetter(dictionaries), (ulong)dictionaries.Length, stratCol.ToArray());
227groupDvBldr.AddColumn(MetricKinds.ColumnNames.StratCol, GetKeyValueGetter(dictionaries), (ulong)dictionaries.Length, groupStratCol.ToArray());
780var editor = VBufferEditor.Create(ref dst, src.Length);
922if (metrics.Length == 1)
927for (int i = 0; i < metrics.Length; i++)
933idv = EvaluateUtils.AddFoldIndex(Host, idv, i, metrics.Length);
971for (int i = 0; i < discountMap.Length; i++)
987if (truncationLevel <= discountMap.Length)
1001int relevancyLevel = labelGains.Length;
1017int topLabel = labelGains.Length - 1;
Transforms\NormalizeColumnDbl.cs (77)
51Contracts.Assert(offsets == null || offsets.Length == scales.Length);
54Contracts.Assert(scales.Length == numFeatures);
59Contracts.Assert(indices.Length < numFeatures);
60Contracts.Assert(scales.Length == indices.Length);
79for (int ii = 0; ii < indices.Length; ii++)
131for (int iv = 0; iv < scales.Length; iv++)
164for (int iiv = 0; iiv < indicesMorph.Length; iiv++)
187Contracts.Assert(indicesMorph == null || indicesMorph.Length == scalesSparse.Length);
188Contracts.Assert(offsetsSparse == null || offsetsSparse.Length == scalesSparse.Length);
209ctx.Writer.Write(binUpperBounds.Length);
218writer.WriteLine("NumNormalizationFeatures={0}", binUpperBounds.Length);
219for (int i = 0; i < binUpperBounds.Length; i++)
222for (int j = 0; j < binUpperBounds[i].Length - 1; j++)
257for (int j = 1; j < curUpperBounds.Length; j++)
259Contracts.CheckDecode(curUpperBounds[curUpperBounds.Length - 1] == TFloat.PositiveInfinity);
276ctx.Writer.Write(mean.Length);
278ctx.Writer.WriteDoublesNoCount(stddev.AsSpan(0, mean.Length));
283writer.WriteLine("NumNormalizationFeatures={0}", mean.Length);
285for (int i = 0; i < mean.Length; i++)
355var size = _min.Length;
387var size = _min.Length;
468var size = _mean.Length;
498for (int i = 0; i < _mean.Length; i++)
678host.Assert(scales.Length == cfeat);
679host.Assert(offsets == null || offsets.Length == cfeat);
743host.Assert(scales.Length == cfeat);
744host.Assert(offsets == null || offsets.Length == cfeat);
754AffineNormSerializationUtils.SaveModel(ctx, Scale.Length, null, Scale, Offset, saveText: true);
793Contracts.Check(dst.Length == Scale.Length);
803Contracts.Check(dst.Length == Scale.Length);
813Contracts.Check(dst.Length == Scale.Length);
825Contracts.Assert(input.Length == scale.Length);
826int size = scale.Length;
855Contracts.Assert(input.Length == scale.Length);
856int size = scale.Length;
899Contracts.Assert(input.Length == scale.Length);
901int size = scale.Length;
933Contracts.Assert(inz < nz.Length && ivDst == nz[inz] || inz == nz.Length && ivDst == size);
940ivDst = ++inz < nz.Length ? nz[inz] : size;
958ivDst = ++inz < nz.Length ? nz[inz] : size;
959Contracts.Assert((inz == nz.Length) == (ivDst >= size));
963Contracts.Assert(inz == nz.Length);
1088Host.Check(dst.Length == Mean.Length);
1099Contracts.Assert(input.Length == mean.Length);
1100int size = mean.Length;
1167_den = Math.Max(1, _binUpperBounds.Length - 1);
1189if (binUpperBounds.Length != 1)
1190throw host.Except("Normalizer expected {0} slots, but the input data column has 1 slot.", binUpperBounds.Length);
1240_den = new TFloat[_binUpperBounds.Length];
1241for (int i = 0; i < _binUpperBounds.Length; i++)
1242_den[i] = Math.Max(1, _binUpperBounds[i].Length - 1);
1245_offset = new TFloat[_binUpperBounds.Length];
1247for (int i = 0; i < _binUpperBounds.Length; i++)
1275if (binUpperBounds.Length != cv)
1276throw host.Except("Normalizer expected {0} slots, but the input data column has {1} slots.", binUpperBounds.Length, cv);
1302Host.Check(dst.Length == _binUpperBounds.Length);
1310Contracts.Assert(input.Length == _binUpperBounds.Length);
1311int size = _binUpperBounds.Length;
1499int binIdx = binUpperBounds.FindIndexSorted(0, binUpperBounds.Length - 1, input);
1500Contracts.Check(binIdx < binUpperBounds.Length);
1510int binIdx = binUpperBounds.FindIndexSorted(0, binUpperBounds.Length - 1, input);
1511Contracts.Check(binIdx < binUpperBounds.Length);
1585var size = Aggregator.Min.Length;
1612var cv = Aggregator.Min.Length;
1782int cv = _aggregator.Mean.Length;
1831int cv = _aggregator.Mean.Length;
1933int size = _values.Length;
1962var count = _values.Length;
2145for (int i = 0; i < _medianAggregators.Length; i++)
2165double[] scale = new double[_medianAggregators.Length];
2166double[] median = new double[_medianAggregators.Length];
2169for (int i = 0; i < _medianAggregators.Length; i++)
Transforms\NormalizeColumnSng.cs (77)
51Contracts.Assert(offsets == null || offsets.Length == scales.Length);
54Contracts.Assert(scales.Length == numFeatures);
59Contracts.Assert(indices.Length < numFeatures);
60Contracts.Assert(scales.Length == indices.Length);
79for (int ii = 0; ii < indices.Length; ii++)
131for (int iv = 0; iv < scales.Length; iv++)
164for (int iiv = 0; iiv < indicesMorph.Length; iiv++)
187Contracts.Assert(indicesMorph == null || indicesMorph.Length == scalesSparse.Length);
188Contracts.Assert(offsetsSparse == null || offsetsSparse.Length == scalesSparse.Length);
209ctx.Writer.Write(binUpperBounds.Length);
218writer.WriteLine("NumNormalizationFeatures={0}", binUpperBounds.Length);
219for (int i = 0; i < binUpperBounds.Length; i++)
222for (int j = 0; j < binUpperBounds[i].Length - 1; j++)
257for (int j = 1; j < curUpperBounds.Length; j++)
259Contracts.CheckDecode(curUpperBounds[curUpperBounds.Length - 1] == TFloat.PositiveInfinity);
276ctx.Writer.Write(mean.Length);
278ctx.Writer.WriteSinglesNoCount(stddev.AsSpan(0, mean.Length));
283writer.WriteLine("NumNormalizationFeatures={0}", mean.Length);
285for (int i = 0; i < mean.Length; i++)
355var size = _min.Length;
388var size = _min.Length;
469var size = _mean.Length;
500for (int i = 0; i < _mean.Length; i++)
836host.Assert(scales.Length == cfeat);
837host.Assert(offsets == null || offsets.Length == cfeat);
900host.Assert(scales.Length == cfeat);
901host.Assert(offsets == null || offsets.Length == cfeat);
911AffineNormSerializationUtils.SaveModel(ctx, Scale.Length, null, Scale, Offset, saveText: true);
950Contracts.Check(dst.Length == Scale.Length);
960Contracts.Check(dst.Length == Scale.Length);
970Contracts.Check(dst.Length == Scale.Length);
982Contracts.Assert(input.Length == scale.Length);
983int size = scale.Length;
1013Contracts.Assert(input.Length == scale.Length);
1014int size = scale.Length;
1058Contracts.Assert(input.Length == scale.Length);
1060int size = scale.Length;
1093Contracts.Assert(inz < nz.Length && ivDst == nz[inz] || inz == nz.Length && ivDst == size);
1100ivDst = ++inz < nz.Length ? nz[inz] : size;
1118ivDst = ++inz < nz.Length ? nz[inz] : size;
1119Contracts.Assert((inz == nz.Length) == (ivDst >= size));
1123Contracts.Assert(inz == nz.Length);
1248Host.Check(dst.Length == Mean.Length);
1259Contracts.Assert(input.Length == mean.Length);
1260int size = mean.Length;
1328_den = Math.Max(1, _binUpperBounds.Length - 1);
1350if (binUpperBounds.Length != 1)
1351throw host.Except("Normalizer expected {0} slots, but the input data column has 1 slot.", binUpperBounds.Length);
1401_den = new TFloat[_binUpperBounds.Length];
1402for (int i = 0; i < _binUpperBounds.Length; i++)
1403_den[i] = Math.Max(1, _binUpperBounds[i].Length - 1);
1406_offset = new TFloat[_binUpperBounds.Length];
1408for (int i = 0; i < _binUpperBounds.Length; i++)
1436if (binUpperBounds.Length != cv)
1437throw host.Except("Normalizer expected {0} slots, but the input data column has {1} slots.", binUpperBounds.Length, cv);
1463Host.Check(dst.Length == _binUpperBounds.Length);
1471Contracts.Assert(input.Length == _binUpperBounds.Length);
1472int size = _binUpperBounds.Length;
1662int binIdx = binUpperBounds.FindIndexSorted(0, binUpperBounds.Length - 1, input);
1663Contracts.Check(binIdx < binUpperBounds.Length);
1673int binIdx = binUpperBounds.FindIndexSorted(0, binUpperBounds.Length - 1, input);
1674Contracts.Check(binIdx < binUpperBounds.Length);
1748var size = Aggregator.Min.Length;
1775var cv = Aggregator.Min.Length;
1945int cv = _aggregator.Mean.Length;
1994int cv = _aggregator.Mean.Length;
2096int size = _values.Length;
2126var count = _values.Length;
2307for (int i = 0; i < _medianAggregators.Length; i++)
2327TFloat[] scale = new TFloat[_medianAggregators.Length];
2328TFloat[] median = new TFloat[_medianAggregators.Length];
2331for (int i = 0; i < _medianAggregators.Length; i++)
Microsoft.ML.DataView (7)
Microsoft.ML.Ensemble (88)
Microsoft.ML.EntryPoints (22)
PermutationFeatureImportance.cs (10)
105Contracts.Assert(slotNames.Length == permutationMetrics.Length,
162Contracts.Assert(slotNames.Length == permutationMetrics.Length,
192ConvertVectorToKnownSize(nameof(metric.PerClassLogLoss), metric.PerClassLogLoss.Length, ref schema);
193ConvertVectorToKnownSize(nameof(metric.PerClassLogLossStdErr), metric.PerClassLogLossStdErr.Length, ref schema);
221Contracts.Assert(slotNames.Length == permutationMetrics.Length,
275Contracts.Assert(slotNames.Length == permutationMetrics.Length,
297ConvertVectorToKnownSize(nameof(metric.DiscountedCumulativeGains), metric.DiscountedCumulativeGains.Length, ref schema);
298ConvertVectorToKnownSize(nameof(metric.NormalizedDiscountedCumulativeGains), metric.NormalizedDiscountedCumulativeGains.Length, ref schema);
299ConvertVectorToKnownSize(nameof(metric.DiscountedCumulativeGainsStdErr), metric.DiscountedCumulativeGainsStdErr.Length, ref schema);
300ConvertVectorToKnownSize(nameof(metric.NormalizedDiscountedCumulativeGainsStdErr), metric.NormalizedDiscountedCumulativeGainsStdErr.Length, ref schema);
Microsoft.ML.FastTree (491)
Dataset\SparseIntArray.cs (15)
104Contracts.Assert(values.Length == deltas.Length);
194public int DeltaLength => _deltas.Length;
202IntArray[] parts = new IntArray[assignment.Length];
203for (int i = 0; i < assignment.Length; ++i)
206parts[i] = IntArray.New(assignment[i].Length, IntArrayType.Sparse, BitsPerItem, assignment[i].Select(x => indexer[x]));
221return IntArray.New(itemIndices.Length, IntArrayType.Sparse, BitsPerItem, itemIndices.Select(x => indexer[x]));
347int currentPos = _deltas.Length > 0 ? _deltas[iSparse] : _length;
357if (++iSparse >= _deltas.Length)
377if (++iSparse >= _deltas.Length)
406int currentPos = _deltas.Length > 0 ? _deltas[iSparse] : _length;
417if (++iSparse >= _deltas.Length)
440if (++iSparse >= _deltas.Length)
474SumupCPlusPlusSparse(input, histogram, (byte*)pValues, pDeltas2, _deltas.Length,
535if (_array._deltas.Length > 0)
589for (int i = 0; i < _deltas.Length; ++i)
FastTree.cs (60)
445for (int i = 0; i < TestSets.Length; ++i)
833for (int t = 0; t < TestSets.Length; ++t)
868Contracts.Check(scores.Length == initScores.Length, "Length of initscores and scores mismatch");
869for (int i = 0; i < scores.Length; i++)
881for (int i = 0; TestSets != null && i < TestSets.Length; i++)
1048for (int i = 1; i < hotFeatureStarts.Length; ++i)
1049hotFeatureStarts[i] = hotFeatureStarts[i - 1] + BinUpperBounds[features[i - 1]].Length - 1;
1050IntArrayBits flockBits = IntArray.NumBitsNeeded(hotFeatureStarts[hotFeatureStarts.Length - 1] + 1);
1060for (int i = 0; i < lastOn.Length; ++i)
1082ch.Assert(bub.Length > 1);
1084ch.Assert(0 < bin && bin < bub.Length); // If 0, should not have been considered "on", so what the heck?
1093for (int f = 0; f < hotFeatureStarts.Length; ++f)
1124for (int i = 1; i < hotFeatureStarts.Length; ++i)
1125hotFeatureStarts[i] = hotFeatureStarts[i - 1] + BinUpperBounds[features[i - 1]].Length - 1;
1126IntArrayBits flockBits = IntArray.NumBitsNeeded(hotFeatureStarts[hotFeatureStarts.Length - 1] + 1);
1135for (int i = 0; i < lastOn.Length; ++i)
1156ch.Assert(bub.Length == 2);
1167for (int f = 0; f < hotFeatureStarts.Length; ++f)
1195ch.Assert(binnedValues.Length == values.Length);
1207var numBitsNeeded = IntArray.NumBitsNeeded(binUpperBounds.Length);
1252double firstBinFrac = (double)firstBinCount / binnedValues.Length;
1254bins = IntArray.New(values.Length, arrayType, IntArray.NumBitsNeeded(binUpperBounds.Length), binnedValues);
1405pch.SetHeader(new ProgressHeader("features"), e => e.SetProgress(0, iFeature, features.Length));
1413Host.Assert(iFeature < features.Length);
1478for (int i = 0; i < lastOn.Length; ++i)
1486if (catRangeIndex < CategoricalFeatureIndices.Length &&
1496if (bup.Length == 1)
1551if (upperBounds.Length == 1)
1566if (upperBounds.Length == 1)
1575FeatureMap = Enumerable.Range(0, NumFeatures).Where(f => BinUpperBounds[f].Length > 1).ToArray();
1621boundaries = new int[qids.Length + 1];
1622for (int i = 0; i < qids.Length; ++i)
1627boundaries[boundaries.Length - 1] = numExamples;
1766for (int i = 0; i < _instanceList.Length; i++)
1939ch.Trace("{0} features stored in {1} flocks.", NumFeatures, flocks.Length);
1951for (int i = 1; i < hotFeatureStarts.Length; ++i)
1952hotFeatureStarts[i] = hotFeatureStarts[i - 1] + BinUpperBounds[features[i - 1]].Length - 1;
1953IntArrayBits flockBits = IntArray.NumBitsNeeded(hotFeatureStarts[hotFeatureStarts.Length - 1] + 1);
1976for (int i = 0; i < kvEnums.Length; ++i)
2030for (int f = 0; f < hotFeatureStarts.Length; ++f)
2040FeatureMap = Enumerable.Range(0, NumFeatures).Where(f => BinUpperBounds[f].Length > 1).ToArray();
2045Contracts.Assert(iFeature + flock.Count <= FeatureMap.Length);
2047int lim = iFeature + flock.Count == FeatureMap.Length
2056ch.Assert(iFeature == FeatureMap.Length);
2080if (bup.Length == 1) // Trivial.
2096for (int i = 0; i < lastOn.Length; ++i)
2102if (catRangeIndex < CategoricalFeatureIndices.Length)
2112if (bup.Length == 1)
2188for (int i = 0; i < lastOn.Length; ++i)
2232if (bup.Length == 1)
2239if (countBins > Utils.ArrayMaxSize - (bup.Length - 1))
2252countBins += bup.Length - 1;
2558IntArrayBits numBitsNeeded = IntArray.NumBitsNeeded(binUpperBounds.Length);
2646Contracts.Assert(0 <= featureIndex && featureIndex < _featureIndices.Length);
2696Contracts.Assert(Utils.IsIncreasing(0, features, values.Length));
2700Utils.EnsureSize(ref workArray, _featureIndices.Length, keepOld: false);
2703Array.Clear(_perFeaturePosition, 0, _featureIndices.Length);
2705_lastRow = new int[features.Length];
2706for (int i = 0; i < _lastRow.Length; ++i)
GamModelParameters.cs (34)
69Host.CheckParam(binUpperBounds.Length == binEffects.Length, nameof(binUpperBounds), "Must have same number of features as binEffects");
70Host.CheckParam(binEffects.Length > 0, nameof(binEffects), "Must have at least one entry");
72Host.CheckParam(shapeToInputMap == null || shapeToInputMap.Length == binEffects.Length, nameof(shapeToInputMap), "Must have same number of features as binEffects");
78NumberOfShapeFunctions = binEffects.Length;
89Host.CheckParam(binUpperBounds[i].Length == binEffects[i].Length, nameof(binEffects), "Array contained wrong number of effect values");
104_inputFeatureToShapeFunctionMap = new Dictionary<int, int>(_shapeToInputMap.Length);
105for (int i = 0; i < _shapeToInputMap.Length; i++)
142_binUpperBounds[i] = reader.ReadDoubleArray(_binEffects[i].Length);
177int diff = _binEffects.Sum(e => e.Take(e.Length - 1).Select((ef, i) => ef != e[i + 1] ? 1 : 0).Sum());
178int bound = _binEffects.Sum(e => e.Length - 1);
183Host.Assert(_binUpperBounds[i].Length == _binEffects[i].Length);
291var binUpperBounds = new double[_binUpperBounds[j].Length];
307binUpperBounds[i] = new double[_binUpperBounds[j].Length];
329var binEffects = new double[_binEffects[j].Length];
345binEffects[i] = new double[_binEffects[j].Length];
392for (int i = 0; i < effects.Length; ++i)
446Host.Check(effects.Length == binThresholds.Length, "Effects array must be same length as binUpperBounds array.");
447var numLeaves = effects.Length;
4890, binIndices.Length - 1, internalNodeIndices, lteChild, gtChild, ref internalNodeId);
643var numFeatures = _pred._binEffects.Length;
647var binDocList = new List<int>[_pred._binEffects[f].Length];
648for (int e = 0; e < _pred._binEffects[f].Length; e++)
675ch.Assert(_scores.Length == _labels.Length);
676if (_labels.Length > 0 && eval != null)
701if (bin < 0 || bin > effects.Length)
820UpperBounds = up.Take(up.Length - 1);
826if (catsMap != null && index < catsMap[catsMap.Length - 1])
828for (int i = 0; i < catsMap.Length; i += 2)
TreeEnsemble\InternalRegressionTree.cs (56)
134Contracts.Assert(indices.Length <= NumNodes);
151Contracts.Assert(indices.Length <= NumNodes);
210CategoricalSplitFeatureRanges = new int[CategoricalSplitFeatures.Length][];
211for (int i = 0; i < CategoricalSplitFeatures.Length; ++i)
213if (CategoricalSplitFeatures[i] != null && CategoricalSplitFeatures[i].Length > 0)
283if (categoricalNodeIndices?.Length > 0)
377Contracts.Assert(CategoricalSplit.Length >= NumNodes);
394CategoricalSplitFeatures[indexLocal].Length > 0);
397CategoricalSplitFeatureRanges[indexLocal].Length == 2);
443checker(GtChild != null && GtChild.Length == numMaxNodes, "bad gtchild");
444checker(LteChild != null && LteChild.Length == numMaxNodes, "bad ltechild");
445checker(SplitFeatures != null && SplitFeatures.Length == numMaxNodes, "bad split feature length");
447(CategoricalSplit.Length == numMaxNodes || CategoricalSplit.Length == NumNodes), "bad categorical split length");
452(CategoricalSplitFeatures.Length == NumNodes ||
453CategoricalSplitFeatures.Length == numMaxNodes),
457(CategoricalSplitFeatureRanges.Length == NumNodes ||
458CategoricalSplitFeatureRanges.Length == numMaxNodes),
461checker(CategoricalSplitFeatureRanges.All(x => x == null || x.Length == 0 || x.Length == 2),
464for (int index = 0; index < CategoricalSplit.Length; index++)
469checker(CategoricalSplitFeatures[index].Length > 0,
475checker(CategoricalSplitFeatureRanges[index].Length == 2,
479for (int featureIndex = 0; featureIndex < CategoricalSplitFeatures[index].Length; featureIndex++)
496checker(Utils.Size(Thresholds) == 0 || Thresholds.Length == numMaxNodes, "bad threshold length");
497checker(Utils.Size(RawThresholds) == 0 || RawThresholds.Length == NumLeaves - 1, "bad rawthreshold length");
500checker(Utils.Size(_splitGain) == 0 || _splitGain.Length == numMaxNodes, "bad splitgain length");
501checker(Utils.Size(_gainPValue) == 0 || _gainPValue.Length == numMaxNodes, "bad gainpvalue length");
502checker(Utils.Size(_previousLeafValue) == 0 || _previousLeafValue.Length == numMaxNodes, "bad previous leaf value length");
503checker(LeafValues != null && LeafValues.Length == numMaxLeaves, "bad leaf value length");
517CategoricalSplit.Length * sizeof(bool) +
534CategoricalSplit.Length.ToByteArray(buffer, ref position);
541for (int i = 0; i < CategoricalSplitFeatures.Length; i++)
558if (LeafValues.Length != tree.LeafValues.Length)
563for (int node = 0; node < LeafValues.Length; ++node)
565if (node < LeafValues.Length - 1 &&
613public int MaxNumLeaves => LeafValues.Length;
618public int MaxNumNodes => LteChild.Length;
675for (int node = 0; node < LeafValues.Length; ++node)
684for (int i = 0; i < LeafValues.Length; ++i)
948if (CategoricalSplitFeatures[node].TryFindIndexSorted(0, CategoricalSplitFeatures[node].Length, index, out int ii))
1115uint numBins = (uint)dataset.Flocks[flock].BinUpperBounds(subfeature).Length;
1136Contracts.Assert(0 <= SplitFeatures[n] && SplitFeatures[n] < oldToNewFeatures.Length);
1142(CategoricalSplitFeatureRanges[n].Length == 2 || CategoricalSplitFeatureRanges[n].Length == 0));
1144for (int i = 0; i < CategoricalSplitFeatures[n].Length; i++)
1147for (int i = 0; i < CategoricalSplitFeatureRanges[n].Length; i++)
1246CategoricalSplitFeatures.Length == 0 ||
1255Contracts.Assert(CategoricalSplitFeatures.Length == NumNodes);
1257for (int i = 0; i < CategoricalSplitFeatures.Length; ++i)
1266int numNonLeaves = CategoricalSplitFeatures[i].Length;
1427int innerLoopSize = 1 + docIndices.Length / BlockingThreadPool.NumThreads; // +1 is to make sure we don't have a few left over at the end
1430var actions = new Action[(int)Math.Ceiling(1.0 * docIndices.Length / innerLoopSize)];
1432for (int d = 0; d < docIndices.Length; d += innerLoopSize)
1435var toDoc = Math.Min(d + innerLoopSize, docIndices.Length);
Utils\ToByteArrayExtensions.cs (20)
230bytes.Length.ToByteArray(buffer, ref position);
231Array.Copy(bytes, 0, buffer, position, bytes.Length);
232position += bytes.Length;
238byte[] allBytes = new byte[bytes.Length + sizeof(int)];
240bytes.Length.ToByteArray(allBytes, ref position);
241Array.Copy(bytes, 0, allBytes, position, bytes.Length);
262a.Length.ToByteArray(buffer, ref position);
263Array.Copy(a, 0, buffer, position, a.Length);
264position += a.Length;
286int length = a.Length;
319int length = a.Length;
390int length = a.Length;
423int length = a.Length;
456int length = a.Length;
489int length = a.Length;
522int length = a.Length;
557a.Length.ToByteArray(buffer, ref position);
558for (int i = 0; i < a.Length; ++i)
568for (int i = 0; i < a.Length; ++i)
600for (int i = 0; i < a.Length; ++i)
Microsoft.ML.GenAI.Core (5)
Microsoft.ML.GenAI.Core.Tests (2)
Microsoft.ML.ImageAnalytics (23)
Microsoft.ML.IntegrationTests (28)
Microsoft.ML.InternalCodeAnalyzer (4)
Microsoft.ML.KMeansClustering (22)
Microsoft.ML.LightGbm (24)
WrappedLightGbmDataset.cs (8)
157Contracts.Assert(labels.Length == GetNumRows());
159LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "label", (IntPtr)ptr, labels.Length,
167Contracts.Assert(weights.Length == GetNumRows());
170for (int i = 1; i < weights.Length; ++i)
181LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "weight", (IntPtr)ptr, weights.Length,
192LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "group", (IntPtr)ptr, groups.Length,
202Contracts.Assert(initScores.Length % GetNumRows() == 0);
204LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "init_score", (IntPtr)ptr, initScores.Length,
Microsoft.ML.Maml (2)
Microsoft.ML.Mkl.Components (61)
Microsoft.ML.NugetPackageVersionUpdater (1)
Microsoft.ML.OnnxTransformer (21)
Microsoft.ML.OnnxTransformerTest (1)
Microsoft.ML.Parquet (16)
Microsoft.ML.PCA (32)
Microsoft.ML.PerformanceTests (8)
Microsoft.ML.Predictor.Tests (17)
Microsoft.ML.Recommender (9)
Microsoft.ML.ResultProcessor (9)
Microsoft.ML.Samples (24)
Dynamic\Transforms\Text\ProduceHashedNgrams.cs (1)
69.Length);
Dynamic\Transforms\Text\ProduceHashedWordBags.cs (1)
68.Length);
Dynamic\Transforms\Text\ProduceNgrams.cs (1)
77.Length);
Dynamic\Transforms\Text\ProduceWordBags.cs (1)
74.Length);
Dynamic\Transforms\Text\RemoveDefaultStopWords.cs (1)
56.Length);
Dynamic\Transforms\Text\RemoveStopWords.cs (1)
55.Length);
Microsoft.ML.Samples.GPU (1)
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\TextClassification.cs (1)
126.Length);
Microsoft.ML.SearchSpace (12)
Microsoft.ML.StandardTrainers (186)
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (31)
296Host.Assert(labelHistogram.Length == featureHistogram.Length);
297Host.Assert(featureHistogram.All(h => h == null || h.Length == featureCount));
301_labelCount = _labelHistogram.Length;
328_labelCount = _labelHistogram.Length;
388int labelCount = labelHistogram.Length;
390for (int iLabel = 0; iLabel < labelHistogram.Length; iLabel += 1)
427float[] featureHistogram = new float[_featureHistogram[0].Length * _labelHistogram.Length];
428float[] labelHistogramExpanded = new float[_featureHistogram[0].Length * _labelHistogram.Length];
430for (int i = 0; i < _featureHistogram.Length; i++)
432Array.Copy(_featureHistogram[i], 0, featureHistogram, i * _featureHistogram[i].Length, _featureHistogram[i].Length);
434for (int i = 0; i < _featureHistogram[0].Length; i++)
436Array.Copy(_labelHistogram, 0, labelHistogramExpanded, i * _featureHistogram.Length, _featureHistogram.Length);
444var labelHistogram = ctx.AddInitializer(labelHistogramExpanded.Take(_labelHistogram.Length), new long[] { _labelHistogram.Length, 1 }, "labelHistogram");
446var featureHistogramName = ctx.AddInitializer(featureHistogram, new long[] { _featureHistogram.Length, _featureHistogram[0].Length }, "featureHistogram");
447var labelHistogramName = ctx.AddInitializer(labelHistogramExpanded, new long[] { _featureHistogram[0].Length, _labelHistogram.Length }, "labelHistogramExpanded");
448var learnedAbsentFeatureLogProb = ctx.AddInitializer(_absentFeaturesLogProb, new long[] { _absentFeaturesLogProb.Length, 1 }, "absentFeaturesLogProb");
451var typeFea = new VectorDataViewType(NumberDataViewType.Single, _featureHistogram[0].Length);
452var typeLabelByFea = new VectorDataViewType(NumberDataViewType.Single, _labelHistogram.Length, _featureHistogram[0].Length);
453var typeLabelByOne = new VectorDataViewType(NumberDataViewType.Single, _labelHistogram.Length, 1);
455var greaterOutput = ctx.AddIntermediateVariable(new VectorDataViewType(BooleanDataViewType.Instance, _featureHistogram[0].Length), "greaterOutput");
466var isFeaturePresent = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Single, 1, _featureHistogram[0].Length), "isFeaturePresent");
576var logOutput = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Single, _featureHistogram[0].Length), "LogOutput");
Standard\MulticlassClassification\OneVersusAllTrainer.cs (48)
155for (int i = 0; i < predictors.Length; i++)
223for (int i = 0; i < predictors.Length; i++)
325var dists = new IValueMapperDist[predictors.Length];
326for (int i = 0; i < predictors.Length; ++i)
363DistType = new VectorDataViewType(NumberDataViewType.Single, _impl.Predictors.Length);
395DistType = new VectorDataViewType(NumberDataViewType.Single, _impl.Predictors.Length);
409for (int i = 0; i < predictors.Length; i++)
425ctx.Writer.Write(preds.Length);
428for (int i = 0; i < preds.Length; i++)
462writer.WriteLine("double[] outputs = new double[{0}];", preds.Length);
464for (int i = 0; i < preds.Length; i++)
483for (int i = 0; i < preds.Length; i++)
538string[] outputs = new string[Predictors.Length];
542for (int i = 0; i < Predictors.Length; i++)
544var predictorOutputNames = new string[localOutputNames.Length];
573Contracts.Assert(outputNames.Length >= 2);
607Predictors = new IValueMapper[predictors.Length];
609for (int i = 0; i < predictors.Length; i++)
623var maps = new ValueMapper<VBuffer<float>, float>[Predictors.Length];
624for (int i = 0; i < Predictors.Length; i++)
627var buffer = new float[maps.Length];
636Parallel.For(0, maps.Length, i => maps[i](in tmp, ref buffer[i]));
638var editor = VBufferEditor.Create(ref dst, maps.Length);
651for (int i = 0; i < Predictors.Length; ++i)
668var type = new VectorDataViewType(NumberDataViewType.Single, probabilityOutputs.Length);
691_mappers = new IValueMapperDist[predictors.Length];
693for (int i = 0; i < predictors.Length; i++)
716var maps = new ValueMapper<VBuffer<float>, float, float>[Predictors.Length];
717for (int i = 0; i < Predictors.Length; i++)
720var buffer = new float[maps.Length];
729Parallel.For(0, maps.Length,
740NormalizeSumToOne(buffer, maps.Length);
742var editor = VBufferEditor.Create(ref dst, maps.Length);
778for (int i = 0; i < Predictors.Length; ++i)
794Contracts.Assert(outputNames.Length >= 2);
826string[] divOutputs = new string[Predictors.Length];
827for (int i = 0; i < Predictors.Length; i++)
835var type = new VectorDataViewType(NumberDataViewType.Single, divOutputs.Length);
856Predictors = new IValueMapper[predictors.Length];
858for (int i = 0; i < predictors.Length; i++)
872var maps = new ValueMapper<VBuffer<float>, float>[Predictors.Length];
873for (int i = 0; i < Predictors.Length; i++)
876var buffer = new float[maps.Length];
885Parallel.For(0, maps.Length, i => maps[i](in tmp, ref buffer[i]));
886NormalizeSoftmax(buffer, maps.Length);
888var editor = VBufferEditor.Create(ref dst, maps.Length);
916Contracts.Assert(outputNames.Length >= 2);
924var type = new VectorDataViewType(NumberDataViewType.Single, probabilityOutputs.Length);
Standard\SdcaBinary.cs (14)
546featureNormSquared = InitializeFeatureNormSquared(invariants.Length);
557ch.Assert(metricNames.Length == metrics.Length);
569Func<DataViewRowId, long, long> getIndexFromIdAndRow = GetIndexFromIdAndRowGetter(idToIdx, biasReg.Length);
580Contracts.Assert(0 <= longIdx && longIdx < invariants.Length, $"longIdx={longIdx}, invariants.Length={invariants.Length}");
811Func<DataViewRowId, long> getIndexFromId = GetIndexFromIdGetter(idToIdx, biasReg.Length);
964var reportedValues = new Double?[metrics.Length + 1];
965reportedValues[metrics.Length] = iter;
974Func<DataViewRowId, long, long> getIndexFromIdAndRow = GetIndexFromIdAndRowGetter(idToIdx, biasReg.Length);
1007metrics[(int)MetricKind.L1Sparsity] = SdcaTrainerOptions.L1Regularization == 0 ? 1 : (Double)firstWeights.GetValues().Count(w => w != 0) / weights.Length;
1023for (int i = 0; i < metrics.Length; i++)
1058public override long Length => _duals.Length;
1403for (int i = 0; i < Primes.Length; i++)
Standard\SdcaMulticlass.cs (14)
200Func<DataViewRowId, long> getIndexFromId = GetIndexFromIdGetter(idToIdx, biasReg.Length);
359int numClasses = weights.Length;
366var reportedValues = new Double?[metrics.Length + 1];
367reportedValues[metrics.Length] = iter;
375Func<DataViewRowId, long, long> getIndexFromIdAndRow = GetIndexFromIdAndRowGetter(idToIdx, biasReg.Length);
459for (int i = 0; i < metrics.Length; i++)
558Host.CheckParam(weights.Length > 0, nameof(weights));
559Host.CheckParam(weights.Length == bias.Length, nameof(weights));
561return new MaximumEntropyModelParameters(Host, weights, bias, bias.Length, weights[0].Length, null, stats: null);
655Host.CheckParam(weights.Length > 0, nameof(weights));
656Host.CheckParam(weights.Length == bias.Length, nameof(weights));
658return new LinearMulticlassModelParameters(Host, weights, bias, bias.Length, weights[0].Length, null, stats: null);
Microsoft.ML.Sweeper (86)
Algorithms\KdoSweeper.cs (35)
113var numSweeps = Math.Min(numOfCandidates, _args.NumberInitialPopulation - prevRuns.Length);
117if (prevRuns.Length < _args.NumberInitialPopulation)
125} while (rcs.Length < 1 && attempts < 100);
128if (rcs.Length == 0)
141if (viableRuns.Length == 0 && prevRuns.Length > 0)
161int totalHistoryLength = history.Length;
164if (history.Length > _args.HistoryLength)
179_host.Assert(history.Length == weights.Length && parentIndicies.Max() < history.Length);
182for (int i = 0; i < parentIndicies.Length; i++)
185children.Add(SampleChild(parent.ParameterSet, parent.MetricValue, history.Length, previousRuns, rMean, rVar, parent.IsMetricMaximizing));
219for (int i = 0; i < _sweepParameters.Length; i++)
251double[] stddevs = Enumerable.Repeat(_args.Simple ? 0.2 : bandwidthScale, mu.Length).ToArray();
254for (int j = 0; j < sampledPoint.Length; j++)
297int d = stddevs.Length;
323double[] weights = new double[history.Length];
325for (int i = 0; i < history.Length; i++)
329bool isMinimizing = history.Length > 0 && !history[0].IsMetricMaximizing;
336for (int i = 0; i < weights.Length; i++)
373for (int i = 0; i < weights.Length; i++)
381for (int i = 0; i < weights.Length; i++)
406for (int i = 0; i < weights.Length; i++)
454int d = mu.Length;
455_host.Assert(d > 0 && diagonalCovariance.Length == d);
458_host.Assert(diagonalCovariance[i].Length == d);
476for (int i = 0; i < points.Length; i++)
479points[i] = VectorTransformAdd(mu, _spu.NormalRVs(mu.Length, 0, 1), a);
487int d = m.Length;
502if (x.Length != y.Length)
503return x.Length > y.Length ? 1 : -1;
505for (int i = 0; i < x.Length; i++)
Algorithms\SmacSweeper.cs (19)
130_host.Assert(view.GetRowCount() == targets.Length, "This data view will have as many rows as there have been evaluations");
171ParameterSet[] randomChallengers = _randomSweeper.ProposeSweeps(numOfCandidates - eiChallengers.Length, previousRuns);
175ParameterSet[] configs = new ParameterSet[eiChallengers.Length + randomChallengers.Length];
176Array.Copy(eiChallengers, 0, configs, 0, eiChallengers.Length);
177Array.Copy(randomChallengers, 0, configs, eiChallengers.Length, randomChallengers.Length);
211_host.Assert(randomConfigs.Length == randomEIs.Length);
213for (int i = 0; i < randomConfigs.Length; i++)
273for (int i = 0; i < _sweepParameters.Length; i++)
344VBuffer<float> features = new VBuffer<float>(transformedParams.Length, transformedParams);
360double[][] meansAndStdDevs = new double[leafValues.Length][];
361for (int i = 0; i < leafValues.Length; i++)
413double[] eis = new double[forestStatistics.Length];
414for (int i = 0; i < forestStatistics.Length; i++)
424for (int i = 0; i < _sweepParameters.Length; i++)
439_host.Assert(parameterSet.Count == _sweepParameters.Length);
440_host.Assert(index >= 0 && index <= _sweepParameters.Length);
Microsoft.ML.Sweeper.Tests (14)
Microsoft.ML.TensorFlow (53)
Microsoft.ML.TensorFlow.Tests (19)
TensorflowTests.cs (19)
321Assert.Equal(sample.OneDim.Length, oneDimValues.Length);
325Assert.Equal(sample.TwoDim.Length, twoDimValues.Length);
329Assert.Equal(sample.ThreeDim.Length, threeDimValues.Length);
333Assert.Equal(sample.FourDim.Length, fourDimValues.Length);
337Assert.Equal(sample.FourDimKnown.Length, fourDimKnownValues.Length);
764if (directories != null && directories.Length > 0)
972for (int i = 0; i < onePrediction.PredictedLabels.Length; i++)
1208for (var i = 0; i < predictions.Length; i++)
1210for (var j = 0; j < predictions[i].PredictedScores.Length; j++)
1301Assert.Equal(2, prediction.Prediction.Length);
1364for (int i = 0; i < input.A.Length; i++)
1555string[] labels = new string[directories.Length];
1556for (int j = 0; j < labels.Length; j++)
1584Assert.Equal((int)labelCountFirst, predictionFirst.Score.Length);
1585Assert.Equal((int)labelCountSecond, predictionSecond.Score.Length);
1714string[] labels = new string[directories.Length];
1715for (int j = 0; j < labels.Length; j++)
1743Assert.Equal((int)labelCountFirst, predictionFirst.Score.Length);
1744Assert.Equal((int)labelCountSecond, predictionSecond.Score.Length);
Microsoft.ML.TestFramework (25)
Microsoft.ML.TestFrameworkCommon (1)
Microsoft.ML.Tests (81)
Microsoft.ML.TimeSeries (114)
SrCnnEntireAnomalyDetector.cs (39)
182return col => 0 <= col && col < active.Length && active[col];
485results = new double[values.Length][];
486for (int i = 0; i < results.Length; ++i)
491else if (results.Length > values.Length)
493Array.Resize<double[]>(ref results, values.Length);
502Array.Resize(ref _seriesToDetect, values.Length);
503for (int i = 0; i < values.Length; ++i)
513_mean = sum / values.Length;
514_std = Math.Sqrt((squareSum - (sum * sum) / values.Length) / values.Length);
554int length = _backAddArray.Length;
613AverageFilter(_ifftMagList, Math.Min(_ifftMagList.Length, _judgementWindowSize));
651for (int i = data.Length - _lookaheadWindowSize - 2; i < data.Length - 1; ++i)
656Array.Resize(ref _backAddArray, data.Length + _backAddWindowSize);
657for (int i = 0; i < data.Length; ++i)
663_backAddArray[data.Length + i] = predictedValue;
669var n = data.Length;
681int length = data.Length;
718for (int i = 0; i < results.Length; ++i)
727for (int i = 0; i < values.Length; ++i)
741for (int i = 0; i < results.Length; ++i)
756for (int i = 0; i < values.Length; ++i)
783for (int i = 0; i < values.Length; ++i)
813for (int i = 0; i < results.Length; ++i)
837for (int i = 0; i < results.Length; ++i)
888for (int i = 0; i < scores.Length; ++i)
899Array.Resize(ref _deAnomalyData, data.Length);
900Array.Copy(data, _deAnomalyData, data.Length);
906int end = Math.Min(data.Length - 1, idx + step);
917while (fitValues.Count < minPointsToFit && (start > 0 || end < data.Length - 1))
921end = Math.Min(data.Length - 1, idx + step);
955int length = data.Length;
977int window = Math.Min(data.Length / 3, 512);
984for (int i = 0; i < _trends.Length; ++i)
1004Array.Resize(ref _units, _trends.Length);
1005for (int i = 0; i < _units.Length; ++i)
1025int tLen = data.Length;
TrajectoryMatrix.cs (7)
120_ectx.Check(data.Length >= seriesLength, "The series length cannot be greater than the data length.");
150FftUtils.ComputeForwardFft(_inputRe, _allZerosIm, _cachedSeriesFftRe, _cachedSeriesFftIm, _inputRe.Length);
176FftUtils.ComputeForwardFft(_inputRe, _allZerosIm, _cachedSeriesFftRe, _cachedSeriesFftIm, _inputRe.Length);
312FftUtils.ComputeForwardFft(_inputRe, _allZerosIm, _outputRe, _outputIm, _inputRe.Length);
327FftUtils.ComputeBackwardFft(_outputRe, _outputIm, _outputRe, _outputIm, _inputRe.Length);
416FftUtils.ComputeForwardFft(_inputRe, _allZerosIm, _outputRe, _outputIm, _inputRe.Length);
431FftUtils.ComputeBackwardFft(_outputRe, _outputIm, _outputRe, _outputIm, _inputRe.Length);
Microsoft.ML.TimeSeries.Tests (6)
Microsoft.ML.Tokenizers (87)
Model\SentencePieceUnigramModel.cs (31)
134if ((uint)id >= (uint)(_vocabReverse.Length))
146int remainingLength = normalizedString.Length - normalizedStringCountFromEnd;
149char[] utf16NormalizedString = ArrayPool<char>.Shared.Rent(normalizedString.Length << 1);
150normalizedString.AsSpan().Slice(normalizedString.Length - normalizedStringCountFromEnd).CopyTo(utf16NormalizedString.AsSpan(utf16NormalizedString.Length - normalizedStringCountFromEnd));
155text.CopyTo(normalizedString.AsSpan(normalizedString.Length - normalizedStringCountFromEnd - text.Length));
161int remainingLength = normalizedString.Length - normalizedStringCountFromEnd;
166char[] utf16NormalizedString = ArrayPool<char>.Shared.Rent(normalizedString.Length << 1);
167normalizedString.AsSpan().Slice(normalizedString.Length - normalizedStringCountFromEnd).CopyTo(utf16NormalizedString.AsSpan(utf16NormalizedString.Length - normalizedStringCountFromEnd));
172bool res = Helpers.ConvertUtf8ToUtf16(utf8Bytes, normalizedString.AsSpan(normalizedString.Length - normalizedStringCountFromEnd - expectedCount), out int bytesConsumed, out int charsWritten);
185Helpers.ArrayPoolGrow(ref normalizedString, normalizedString.Length << 1);
198Helpers.ArrayPoolGrow(ref normalizedString, normalizedString.Length << 1);
294Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) * 3 <= buffer.Length * sizeof(int));
729Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
810else if (unknownTokensTracking.Length == unknownTokensCount)
827Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
848Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
874Debug.Assert(unknownTokensCount > 0 && unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
916Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
1122(int Id, int UtfStartOffset, int Utf8Length)[] ids = ArrayPool<(int Id, int UtfStartOffset, int Utf8Length)>.Shared.Rent(bestPathEndsAt.Length);
1125int idsIndex = ids.Length - 1;
1144if ((!ByteFallback || !unknownEncountered) && (maxTokenCount == int.MaxValue || (tokenCount + ids.Length - idsIndex <= maxTokenCount)))
1148tokenCount += ids.Length - idsIndex;
1166for (int i = idsIndex; tokenCount < maxTokenCount && i < ids.Length; i++)
1285if (splits.Length == 0)
1288normalizedText = normalizedString is not null ? normalizedString.AsSpan(normalizedString.Length - normalizedStringCountFromEnd).ToString() : null;
1292(int Offset, int Length) current = splits[splits.Length - 1];
1300for (int i = splits.Length - 1; i >= 0; i--)
1326normalizedText = normalizedString is not null ? normalizedString.AsSpan().Slice(normalizedString.Length - normalizedStringCountFromEnd).ToString() : null;
1344normalizedText = normalizedString is not null ? normalizedString.AsSpan().Slice(normalizedString.Length - normalizedStringCountFromEnd).ToString() : null;
Microsoft.ML.Tokenizers.Tests (251)
BpeTests.cs (33)
305Assert.Equal(expectedTokens.Length, encoding.Count);
306Assert.Equal(offsets.Length, encoding.Count);
307Assert.Equal(ids.Length, encoding.Count);
308Assert.Equal(ids.Length, idsList.Count);
309Assert.Equal(ids.Length, tokenizer.CountTokens(sentence));
339for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
343Assert.True(idsConsumed < ids.Length);
353Assert.Equal(ids.Length, idsConsumed);
488Assert.Equal(expectedIds, tokenizer.EncodeToIds(text, expectedIds.Length, out string? normalizedText, out int length));
491Assert.Equal(expectedIds, tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length, out normalizedText, out length));
495Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text, expectedIds.Length - 2, out normalizedText, out length));
497int expectedLength = expectedOffsets[expectedOffsets.Length - 3].Index + expectedOffsets[expectedOffsets.Length - 3].Length;
499Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 2, out normalizedText, out length));
503Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text));
504Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text.AsSpan()));
506Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text, expectedIds.Length - 3, out normalizedText, out int tokenCount));
508Assert.Equal(expectedIds.Length - 3, tokenCount);
509Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text.AsSpan(), expectedIds.Length - 3, out normalizedText, out tokenCount));
511Assert.Equal(expectedIds.Length - 3, tokenCount);
513Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text, 3, out normalizedText, out tokenCount));
516Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text.AsSpan(), 3, out normalizedText, out tokenCount));
851Assert.Equal(ids.Length, idsConsumed);
854Assert.Equal(ids.Length, idsConsumed);
856Assert.True(idsConsumed < ids.Length);
859Assert.True(idsConsumed < ids.Length);
CodeGenTests.cs (68)
312for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
316Assert.True(idsConsumed < ids.Length);
326Assert.Equal(ids.Length, idsConsumed);
379Assert.Equal(ids, codeGenTokenizer.EncodeToIds(text, ids.Length, out string? normalizedText, out int length));
382Assert.Equal(ids, codeGenTokenizer.EncodeToIds(text.AsSpan(), ids.Length, out normalizedText, out length));
386Assert.Equal(expectedIds, codeGenTokenizer.EncodeToIds(text, expectedIds.Length, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
389Assert.Equal(expectedIds, codeGenTokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
393Assert.Equal(expectedIdsWithSpace, codeGenTokenizer.EncodeToIds(text, expectedIdsWithSpace.Length, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
396Assert.Equal(expectedIdsWithSpace, codeGenTokenizer.EncodeToIds(text.AsSpan(), expectedIdsWithSpace.Length, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
400int expectedTokensToExclude = expectedOffsets.Length > 1 && expectedOffsets[expectedOffsets.Length - 1].Index == expectedOffsets[expectedOffsets.Length - 2].Index ? 2 : 1;
401Assert.Equal(ids.Take(ids.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text, ids.Length - 1, out normalizedText, out length));
404int expectedLength = offsets.Length > expectedTokensToExclude ? offsets[offsets.Length - expectedTokensToExclude - 1].Index + offsets[offsets.Length - expectedTokensToExclude - 1].Length : 0;
406Assert.Equal(ids.Take(ids.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text.AsSpan(), ids.Length - 1, out normalizedText, out length));
410Assert.Equal(expectedIds.Take(expectedIds.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text, expectedIds.Length - 1, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
413Assert.Equal(expectedIds.Take(expectedIds.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 1, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
417Assert.Equal(expectedIdsWithSpace.Take(expectedIdsWithSpace.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text, expectedIdsWithSpace.Length - 1, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
420Assert.Equal(expectedIdsWithSpace.Take(expectedIdsWithSpace.Length - expectedTokensToExclude), codeGenTokenizer.EncodeToIds(text.AsSpan(), expectedIdsWithSpace.Length - 1, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out length));
428Assert.Equal(ids.Length, codeGenTokenizer.CountTokens(text));
429Assert.Equal(ids.Length, codeGenTokenizer.CountTokens(text.AsSpan()));
431Assert.Equal(expectedIds.Length, codeGenTokenizer.CountTokens(text, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false));
432Assert.Equal(expectedIds.Length, codeGenTokenizer.CountTokens(text.AsSpan(), addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false));
434Assert.Equal(expectedIdsWithSpace.Length, codeGenTokenizer.CountTokens(text, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false));
435Assert.Equal(expectedIdsWithSpace.Length, codeGenTokenizer.CountTokens(text.AsSpan(), addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false));
443Assert.Equal(offsets[offsets.Length - 1].Index + offsets[offsets.Length - 1].Length, codeGenTokenizer.GetIndexByTokenCount(text, ids.Length, out normalizedText, out int tokenCount));
445Assert.Equal(ids.Length, tokenCount);
446Assert.Equal(offsets[offsets.Length - 1].Index + offsets[offsets.Length - 1].Length, codeGenTokenizer.GetIndexByTokenCount(text.AsSpan(), ids.Length, out normalizedText, out tokenCount));
448Assert.Equal(ids.Length, tokenCount);
450Assert.Equal(expectedOffsets[expectedOffsets.Length - 1].Index + expectedOffsets[expectedOffsets.Length - 1].Length, codeGenTokenizer.GetIndexByTokenCount(text, expectedIds.Length, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out tokenCount));
452Assert.Equal(expectedIds.Length, tokenCount);
453Assert.Equal(expectedOffsets[expectedOffsets.Length - 1].Index + expectedOffsets[expectedOffsets.Length - 1].Length, codeGenTokenizer.GetIndexByTokenCount(text.AsSpan(), expectedIds.Length, addPrefixSpace: false, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out tokenCount));
455Assert.Equal(expectedIds.Length, tokenCount);
457Assert.Equal(expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Index + expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Length, codeGenTokenizer.GetIndexByTokenCount(text, expectedIdsWithSpace.Length, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out tokenCount));
459Assert.Equal(expectedIdsWithSpace.Length, tokenCount);
460Assert.Equal(expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Index + expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Length, codeGenTokenizer.GetIndexByTokenCount(text.AsSpan(), expectedIdsWithSpace.Length, addPrefixSpace: true, addBeginningOfSentence: false, addEndOfSentence: false, out normalizedText, out tokenCount));
462Assert.Equal(expectedIdsWithSpace.Length, tokenCount);
468int expectedIndex = offsets.Length > 1 && offsets[offsets.Length - 1].Index == offsets[offsets.Length - 2].Index ? text.Length : offsets[offsets.Length - 1].Index;
484expectedIndex = offsets.Length > 1 && expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Index == expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 2].Index ? text.Length : expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Index;
501for (int i = 0; i < tokens.Length; i++)
1017calculatedLengthUsingOffsets = expectedTokenCountFromEnd > 0 ? offsets[offsets.Length - expectedTokenCountFromEnd].Index : input.Length;
EnglishRobertaTests.cs (26)
194Assert.Equal(expectedIds, tokenizer.EncodeToIds(text, expectedIds.Length, out string? normalizedText, out int length));
197Assert.Equal(expectedIds, tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length, out normalizedText, out length));
201Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text, expectedIds.Length - 2, out normalizedText, out length));
203int expectedLength = expectedOffsets[expectedOffsets.Length - 3].Index + expectedOffsets[expectedOffsets.Length - 3].Length;
205Assert.Equal(expectedIds.Take(expectedIds.Length - 2), tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 2, out normalizedText, out length));
209Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text));
210Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text.AsSpan()));
212Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text, expectedIds.Length - 3, out normalizedText, out int tokenCount));
214Assert.Equal(expectedIds.Length - 3, tokenCount);
215Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text.AsSpan(), expectedIds.Length - 3, out normalizedText, out tokenCount));
217Assert.Equal(expectedIds.Length - 3, tokenCount);
219Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text, 3, out normalizedText, out tokenCount));
222Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text.AsSpan(), 3, out normalizedText, out tokenCount));
272Assert.Equal(((int[])p[1]).Length, idsCount);
289for (int i = 0; i < tokens.Length; i++)
317for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
321Assert.True(idsConsumed < ids.Length);
329Assert.Equal(ids.Length, idsConsumed);
LlamaTests.cs (42)
251Assert.Equal(ids.Length, llamaTokenizer.CountTokens(input));
255for (int i = 0; i < tokens.Length; i++)
274Assert.Equal(isEmptyInput ? 0 : ids.Length - 1, bpe.CountTokens(normalizedInput.AsSpan(), addBeginningOfSentence: false, addEndOfSentence: false, considerNormalization: false));
284Assert.Equal(isEmptyInput ? 0 : ids.Length, bpe.CountTokens(normalizedInput.AsSpan(), addBeginningOfSentence: false, addEndOfSentence: true, considerNormalization: false));
294Assert.Equal(isEmptyInput ? 0 : ids.Length + 1, bpe.CountTokens(normalizedInput.AsSpan(), addBeginningOfSentence: true, addEndOfSentence: true, considerNormalization: false));
308for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
312Assert.True(idsConsumed < ids.Length);
322Assert.Equal(ids.Length, idsConsumed);
558Assert.Equal(expectedIds, tokenizer.EncodeToIds(text, expectedIds.Length, out string? normalizedString, out int length));
561Assert.Equal(expectedIds, tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length, out normalizedString, out length));
579expectedIds1.Length,
588expectedIds1.Length,
596Assert.Equal(expectedIds1.Take(expectedIds1.Length - 6), sentencePieceBpe.EncodeToIds(
600expectedIds1.Length - 6,
606(int Index, int Length)[] expectedOffsets1 = addBeginningOfSentence ? expectedOffsets.Take(expectedIds1.Length - 6).ToArray() : expectedOffsets.Skip(1).Take(expectedIds1.Length - 6).ToArray();
608int expectedLength = expectedOffsets1[expectedOffsets1.Length - 1].Index + expectedOffsets1[expectedOffsets1.Length - 1].Length;
611Assert.Equal(expectedIds1.Take(expectedIds1.Length - 6), sentencePieceBpe.EncodeToIds(
615expectedIds1.Length - 6,
632Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text));
633Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text.AsSpan()));
635Assert.Equal(expectedOffsets[expectedOffsets.Length - 7].Index + expectedOffsets[expectedOffsets.Length - 7].Length, tokenizer.GetIndexByTokenCount(text, expectedIds.Length - 6, out string? normalizedString, out int tokenCount));
637Assert.Equal(expectedIds.Length - 6, tokenCount);
638Assert.Equal(expectedOffsets[expectedOffsets.Length - 7].Index + expectedOffsets[expectedOffsets.Length - 7].Length, tokenizer.GetIndexByTokenCount(text.AsSpan(), expectedIds.Length - 6, out normalizedString, out tokenCount));
640Assert.Equal(expectedIds.Length - 6, tokenCount);
642Assert.Equal(expectedOffsets[expectedOffsets.Length - 7].Index, tokenizer.GetIndexByTokenCountFromEnd(text, 7, out normalizedString, out tokenCount));
645Assert.Equal(expectedOffsets[expectedOffsets.Length - 7].Index, tokenizer.GetIndexByTokenCountFromEnd(text.AsSpan(), 7, out normalizedString, out tokenCount));
697accumulatedStringFromEnd = (encodedTokens.Count == i ? DummyPrefix : (i % 2 == 0 ? $"{DummyPrefix}Hello" : specialTokens[specialTokens.Length - 1 - (i / 2)])) + accumulatedStringFromEnd;
846for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
860for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
885for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
899for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
SentencePieceTests.cs (12)
766ms.Write(model, 0, model.Length);
784ms.Write(prefix, 0, prefix.Length);
785ms.Write(modelBytes, 0, modelBytes.Length);
786ms.Position = prefix.Length; // skip past prefix
802ms.Write(modelProtoBytes, 0, modelProtoBytes.Length);
875WriteVarint((ulong)bytes.Length);
876_ms.Write(bytes, 0, bytes.Length);
882WriteVarint((ulong)value.Length);
883_ms.Write(value, 0, value.Length);
900WriteVarint((ulong)submessage.Length);
901_ms.Write(submessage, 0, submessage.Length);
927_ms.Write(bytes, 0, bytes.Length);
TiktokenTests.cs (34)
177for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
181Assert.True(idsConsumed < ids.Length);
191Assert.Equal(ids.Length, idsConsumed);
643Assert.Equal(expectedIds, tokenizer.EncodeToIds(text, expectedIds.Length, out string? normalizedText, out int length));
646Assert.Equal(expectedIds, tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length, out normalizedText, out length));
650Assert.Equal(expectedIds.Take(expectedIds.Length - 4), tokenizer.EncodeToIds(text, expectedIds.Length - 4, out normalizedText, out length));
652int expectedLength = expectedOffsets[expectedOffsets.Length - 5].Index + expectedOffsets[expectedOffsets.Length - 5].Length;
654Assert.Equal(expectedIds.Take(expectedIds.Length - 4), tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 4, out normalizedText, out length));
658Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text));
659Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text.AsSpan()));
661Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text, expectedIds.Length - 3, out normalizedText, out int tokenCount));
663Assert.Equal(expectedIds.Length - 3, tokenCount);
664Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text.AsSpan(), expectedIds.Length - 3, out normalizedText, out tokenCount));
666Assert.Equal(expectedIds.Length - 3, tokenCount);
668Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text, 3, out normalizedText, out tokenCount));
671Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text.AsSpan(), 3, out normalizedText, out tokenCount));
752Assert.Equal(expectedIds.Length, GPT4.CountTokens(text));
754for (int tokenCount = 1; tokenCount <= ids.Length; tokenCount++)
757Assert.True(count <= ids.Length);
761Assert.True(count < ids.Length - 1);
775Assert.True(count <= ids.Length);
779Assert.True(ids.Length - tokenCount > 0);
780Assert.True(offsets[offsets.Length - tokenCount].Index < offsets[offsets.Length - tokenCount - 1].Index + offsets[offsets.Length - tokenCount - 1].Length);
785Assert.Equal(offsets[offsets.Length - count].Index, index);
UnigramTests.cs (24)
357int[] expectedIds = new int[ids.Length * 2 + 3];
359Array.Copy(ids, 0, expectedIds, 1, ids.Length);
360expectedIds[ids.Length + 1] = _unigramTokenizerWithSpecialTokens.SpecialTokens!["<pad>"];
361Array.Copy(ids, 0, expectedIds, ids.Length + 2, ids.Length);
362expectedIds[ids.Length * 2 + 2] = _unigramTokenizerWithSpecialTokens.EndOfSentenceId;
365string[] expectedTokens = new string[tokens.Length * 2 + 3];
367Array.Copy(tokens, 0, expectedTokens, 1, tokens.Length);
368expectedTokens[tokens.Length + 1] = "<pad>";
369Array.Copy(tokens, 0, expectedTokens, tokens.Length + 2, tokens.Length);
370expectedTokens[tokens.Length * 2 + 2] = _unigramTokenizerWithSpecialTokens.EndOfSentenceToken;
421for (int i = 1; i <= ids.Length; i++)
437if (ints.Count > ids.Length)
453if (ints.Count > ids.Length)
465int[] expectedIds = new int[ids.Length * 2 + 3];
467Array.Copy(ids, 0, expectedIds, 1, ids.Length);
468expectedIds[ids.Length + 1] = _unigramTokenizerWithSpecialTokens.SpecialTokens!["<pad>"];
469Array.Copy(ids, 0, expectedIds, ids.Length + 2, ids.Length);
470expectedIds[ids.Length * 2 + 2] = _unigramTokenizerWithSpecialTokens.EndOfSentenceId;
473for (int i = 1; i <= expectedIds.Length; i++)
493int totalTokens = ids.Length;
544Assert.Equal(ids.Length, idsConsumed);
Microsoft.ML.TorchSharp (36)
AutoFormerV2\Anchors.cs (6)
67for (int idx = 0; idx < this.pyramidLevels.Length; ++idx)
100var numAnchors = ratios.Length * scales.Length;
106anchors[RangeUtil.ToTensorIndex(..), RangeUtil.ToTensorIndex(2..)] = baseSize * torch.tile(scales, new long[] { 2, ratios.Length }).transpose(1, 0);
112anchors[RangeUtil.ToTensorIndex(..), 2] = torch.sqrt(areas / torch.repeat_interleave(ratios, new long[] { scales.Length }));
113anchors[RangeUtil.ToTensorIndex(..), 3] = torch.mul(anchors[RangeUtil.ToTensorIndex(..), 2], torch.repeat_interleave(ratios, new long[] { scales.Length }));
Microsoft.ML.Transforms (611)
Microsoft.ML.Vision (61)
DnnRetrainTransform.cs (56)
276var inputsForTraining = new string[_inputs.Length + 1];
277var inputColIndices = new int[inputsForTraining.Length];
278var isInputVector = new bool[inputsForTraining.Length];
279var tfInputTypes = new TF_DataType[inputsForTraining.Length];
280var tfInputShapes = new Shape[inputsForTraining.Length];
282for (int i = 0; i < _inputs.Length; i++)
286for (int i = 0; i < inputsForTraining.Length - 1; i++)
290var index = inputsForTraining.Length - 1;
302tfInputs = new TF_Output[_tfInputNodes.Length + 2]; //Inputs + Label + Learning Rate.
304tfInputs = new TF_Output[_tfInputNodes.Length + 1]; //Inputs + Label.
306Array.Copy(_tfInputNodes, tfInputs, _tfInputNodes.Length);
308tfInputs[_tfInputNodes.Length] = new TF_Output(labelOp, labelOpIdx);
310tfInputs[_tfInputNodes.Length + 1] = new TF_Output(lr.Item1, lr.Item2);
346for (int i = 0; i < inputsForTraining.Length; i++)
380for (int i = 0; i < inputs.Length; i++)
384if (tensor.Length > 0 && tensor[0].TensorDataPointer != IntPtr.Zero)
390if (tensor.Length > 1 && tensor[1].TensorDataPointer != IntPtr.Zero)
430if (tmpParamDir != null && tmpParamDir.Length > 0)
453if (tmpParamDir != null && tmpParamDir.Length > 0)
485var srcTensorGetters = new ITensorValueGetter[inputColIndices.Length];
486for (int i = 0; i < inputColIndices.Length; i++)
511for (int j = 0; j < inputs.Length; j++)
517for (int j = 0; j < outputs.Length; j++)
550_tfInputNodes = new TF_Output[_inputs.Length];
551_tfOutputNodes = new TF_Output[_outputs.Length];
553for (int index = 0; index < _tfInputOperations.Length; index += 1)
556for (int index = 0; index < _tfOutputOperations.Length; index += 1)
578var tfInputTypes = new TF_DataType[inputs.Length];
579var tfInputShapes = new Shape[inputs.Length];
580var tfInputOperations = new (Operation, int)[inputs.Length];
618c_api.TF_GraphGetTensorShape(graph, output, dims, dims.Length, cstatus.Handle);
625var tfOutputTypes = new TF_DataType[outputs.Length];
626var outputTypes = new DataViewType[outputs.Length];
628var tfOutputOperations = new (Operation, int)[outputs.Length];
630for (int i = 0; i < outputs.Length; i++)
648for (int j = 0; j < dims.Length; j++)
650if (dims == null || dims.Length == 0)
691ctx.Writer.Write(_inputs.Length);
696ctx.Writer.Write(_outputs.Length);
710w.Write(modelFilePaths.Length);
770_inputColIndices = new int[_parent._inputs.Length];
771_isInputVector = new bool[_parent._inputs.Length];
772_fullySpecifiedShapes = new Shape[_parent._inputs.Length];
773for (int i = 0; i < _parent._inputs.Length; i++)
793if (shape == null || (shape.Length == 0))
833for (int ishape = 1; ishape < l.Length; ishape++)
932for (int i = 0; i < _parent._inputs.Length; i++)
937Contracts.Assert(tensors.Length > 0);
939for (int j = 0; j < activeOutputColNames.Length; j++)
948return col => Enumerable.Range(0, _parent._outputs.Length).Any(i => activeOutput(i)) && _inputColIndices.Any(i => i == col);
953var info = new DataViewSchema.DetachedColumn[_parent._outputs.Length];
954for (int i = 0; i < _parent._outputs.Length; i++)
985if (tfShape.dims.Length != 0)
1070if (tfShape.dims.Length != 0)
1257for (var i = 0; i < _options.InputColumns.Length; i++)
1268for (var i = 0; i < _options.OutputColumns.Length; i++)
Microsoft.NET.Build.Containers (40)
Microsoft.NET.Build.Tasks (61)
Microsoft.NET.HostModel (33)
Microsoft.Net.Http.Headers (3)
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (17)
Microsoft.NET.Sdk.Publish.Tasks (8)
Microsoft.NET.Sdk.Razor.Tasks (17)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (171)
Microsoft.NET.Sdk.WorkloadManifestReader (12)
Microsoft.Private.Windows.Core (20)
Microsoft.SourceLink.AzureDevOpsServer.Git (19)
Microsoft.SourceLink.AzureRepos.Git (21)
Microsoft.SourceLink.Bitbucket.Git (12)
Microsoft.SourceLink.Common (9)
Microsoft.SourceLink.Gitea (10)
Microsoft.SourceLink.Gitee (10)
Microsoft.SourceLink.GitHub (10)
Microsoft.SourceLink.GitLab (10)
Microsoft.SourceLink.GitWeb (10)
Microsoft.TemplateEngine.Cli (9)
Microsoft.TemplateEngine.Core (66)
Operations\Include.cs (11)
96while (totalBytesRead < composite.Length)
98int bytesRead = data!.Read(composite, totalBytesRead, composite.Length - totalBytesRead);
110byte[] newBuffer = new byte[composite.Length + pageSize];
111Buffer.BlockCopy(composite, 0, newBuffer, 0, composite.Length);
115while (totalBytesRead < composite.Length)
117int bytesRead = data!.Read(composite, totalBytesRead, composite.Length - totalBytesRead);
134composite = Encoding.Convert(realEncoding, processor.Encoding, composite, bom.Length, totalBytesRead - bom.Length);
135nBytesToWrite = composite.Length;
139offset = bom.Length;
140nBytesToWrite = totalBytesRead - bom.Length;
TokenConfig.cs (16)
31int realEnd = end != -1 ? end : (data.Length - start - 1);
51byte[] buffer = new byte[pre.Length + core.Length + post.Length];
53if (pre.Length > 0)
55Buffer.BlockCopy(pre, 0, buffer, 0, pre.Length);
58if (core.Length > 0)
60Buffer.BlockCopy(core, 0, buffer, pre.Length, core.Length);
63if (post.Length > 0)
65Buffer.BlockCopy(post, 0, buffer, pre.Length + core.Length, post.Length);
68return new Token(buffer, pre.Length, buffer.Length - post.Length - 1);
Util\ProcessorState.cs (17)
64CurrentBufferLength = ReadExactBytes(source, CurrentBuffer, 0, CurrentBuffer.Length);
68_bomSize = bom.Length;
120int nRead = ReadExactBytes(_source, tmp, CurrentBufferLength - CurrentBufferPosition, tmp.Length - CurrentBufferLength);
160if (CurrentBufferLength < CurrentBuffer.Length && bytesToPreserveInBuffer == 0)
359if (_target.Position - _bomSize < buffer.Length)
365_target.Position -= buffer.Length;
368int nRead = ReadExactBytes(_target, buffer, 0, buffer.Length);
390if (_target.Position - _bomSize < buffer.Length)
396_target.Position -= buffer.Length;
411if (_target.Position - _bomSize < buffer.Length)
417_target.Position -= buffer.Length;
420int nRead = ReadExactBytes(_target, buffer, 0, buffer.Length);
442if (_target.Position - _bomSize < buffer.Length)
448_target.Position -= buffer.Length;
472int sz = bufferLength == CurrentBuffer.Length ? match.MaxLength : match.MinLength;
531if (count + offset > buffer.Length)
534count = buffer.Length - offset;
Microsoft.TemplateEngine.Edge (4)
Microsoft.TemplateEngine.Utils (35)
InMemoryFileSystem.cs (27)
49for (int i = 0; i < parts.Length; ++i)
73for (int i = 0; i < parts.Length - 1; ++i)
84if (!currentDir.Files.TryGetValue(parts[parts.Length - 1], out FileSystemFile targetFile))
86targetFile = new FileSystemFile(parts[parts.Length - 1], Path.Combine(currentDir.FullPath, parts[parts.Length - 1]));
87currentDir.Files[parts[parts.Length - 1]] = targetFile;
115for (int i = 0; i < parts.Length; ++i)
152for (int i = 0; i < parts.Length; ++i)
185for (int i = 0; i < parts.Length; ++i)
265for (int i = 0; i < parts.Length; ++i)
347for (int i = 0; i < parts.Length; ++i)
447for (int i = 0; i < parts.Length - 1; ++i)
458_ = currentDir.Files.Remove(parts[parts.Length - 1]);
473for (int i = 0; i < parts.Length - 1; ++i)
483return currentDir.Files.ContainsKey(parts[parts.Length - 1]);
503for (int i = 0; i < parts.Length - 1; ++i)
514if (!currentDir.Files.TryGetValue(parts[parts.Length - 1], out FileSystemFile targetFile))
561for (int i = 0; i < parts.Length - 1; ++i)
572if (!currentDir.Files.TryGetValue(parts[parts.Length - 1], out FileSystemFile targetFile))
593for (int i = 0; i < parts.Length - 1; ++i)
604if (!currentDir.Files.TryGetValue(parts[parts.Length - 1], out FileSystemFile targetFile))
624for (int i = 0; i < parts.Length - 1; ++i)
635if (!currentDir.Files.TryGetValue(parts[parts.Length - 1], out FileSystemFile targetFile))
655for (int i = 0; i < parts.Length - 1; ++i)
666if (!currentDir.Files.TryGetValue(parts[parts.Length - 1], out FileSystemFile targetFile))
717for (int i = 0; i < parts.Length; ++i)
864_ = target.Read(_data, 0, _data.Length);
Microsoft.TestPlatform.AdapterUtilities (16)
Microsoft.TestPlatform.Build (1)
Microsoft.TestPlatform.CoreUtilities (8)
Microsoft.TestPlatform.CrossPlatEngine (6)
Microsoft.TestPlatform.Extensions.BlameDataCollector (1)
Microsoft.TestPlatform.Filter.Source (4)
Microsoft.TestPlatform.PlatformAbstractions (1)
Microsoft.TestUtilities (2)
Microsoft.VisualBasic.Core (328)
Microsoft\VisualBasic\CompilerServices\NewLateBinding.vb (54)
124If members Is Nothing OrElse members.Length = 0 Then
179(Arguments IsNot Nothing AndAlso Arguments.Length > 0) _
245reportErrors OrElse arguments.Length <> 0 OrElse baseReference.IsArray,
296If argumentNames.Length > 0 Then
332reportErrors = reportErrors OrElse arguments.Length <> 0 OrElse baseReference.IsArray
344Return argumentNames.Length = 0
354For index As Integer = 0 To copyBack.Length - 1
433If typeArguments.Length > 0 Then
438If arguments.Length = 0 Then
447If argumentNames.Length > arguments.Length OrElse
448(copyBack IsNot Nothing AndAlso copyBack.Length <> arguments.Length) Then
468ElseIf arguments.Length > 0 AndAlso members.Length = 1 AndAlso IsZeroArgumentCall(members(0)) Then
534If members Is Nothing OrElse members.Length = 0 Then
560If arguments.Length > 0 AndAlso members.Length = 1 AndAlso IsZeroArgumentCall(members(0)) Then
590DirectCast(member, MethodInfo).GetParameters().Length = 0) OrElse
592DirectCast(member, PropertyInfo).GetIndexParameters().Length = 0))
649If argumentNames.Length > 0 Then
657If argumentNames.Length > arguments.Length Then
661If arguments.Length < 1 Then
743Return argumentNames.Length = 0
750If members Is Nothing OrElse members.Length = 0 Then
964If members.Length = 0 And OptimisticSet Then
970If TypeArguments.Length > 0 Then
974If Arguments.Length = 1 Then
995If ArgumentNames.Length > Arguments.Length Then
1002If TypeArguments.Length = 0 Then
1071If TypeArguments.Length = 0 Then
1108If members Is Nothing OrElse members.Length = 0 Then
1113If arguments.Length = 1 AndAlso rValueBase AndAlso baseReference.IsValueType Then
1189If argumentNames.Length > arguments.Length OrElse
1190(copyBack IsNot Nothing AndAlso copyBack.Length <> arguments.Length) Then
1200If HasFlag(invocationFlags, BindingFlagsSetProperty) AndAlso arguments.Length < 1 Then
1213If members Is Nothing OrElse members.Length = 0 Then
1295Debug.Assert(members IsNot Nothing AndAlso members.Length > 0, "expected members")
1299argumentNames.Length <= arguments.Length,
1320Dim argumentCount As Integer = arguments.Length
1324If arguments.Length = 0 Then
1337System.Array.Copy(savedArguments, arguments, arguments.Length)
1432Dim lastParameter As ParameterInfo = parameters(parameters.Length - 1)
1497Dim callArguments As Object() = New Object(parameters.Length - 1) {}
1500Dim argumentCount As Integer = arguments.Length
1504Debug.Assert(arguments.Length > 0, "must have an argument for property set Value")
1507System.Array.Copy(savedArguments, arguments, arguments.Length)
1517Dim lastParameter As ParameterInfo = parameters(parameters.Length - 1)
1518callArguments(parameters.Length - 1) =
Microsoft\VisualBasic\CompilerServices\OverloadResolution.vb (74)
48If leftSignature.Length >= rightSignature.Length Then
59For index As Integer = shorterSignature.Length To longerSignature.Length - 1
65For i As Integer = 0 To shorterSignature.Length - 1
493Debug.Assert(arguments Is Nothing OrElse arguments.Length = argumentCount, "Inconsistency in arguments!!!")
728Debug.Assert(arguments Is Nothing OrElse arguments.Length = argumentCount, "Inconsistency in arguments!!!")
732typeArgumentCount = typeArguments.Length
735Dim candidates As List(Of Method) = New List(Of Method)(members.Length)
737If members.Length = 0 Then
793candidateSignature = New ParameterInfo(setParameters.Length - 2) {}
794System.Array.Copy(setParameters, candidateSignature, candidateSignature.Length)
894Loop While index < members.Length AndAlso members(index).DeclaringType Is currentScope
896Loop While keepSearching AndAlso index < members.Length
1171Debug.Assert(parameterTypeParameters.Length = argumentTypeArguments.Length,
1174For index As Integer = 0 To argumentTypeArguments.Length - 1
1385Do While paramIndex < parameters.Length
1432If typeArguments.Length = 0 Then
1449Debug.Assert(arguments.Length <= parameters.Length OrElse
1453Dim argIndex As Integer = argumentNames.Length
1458Do While argIndex < arguments.Length
1497If argIndex = arguments.Length - 1 AndAlso arguments(argIndex) Is Nothing Then
1503Do While argIndex < arguments.Length
1527Debug.Assert(arguments.Length - argIndex <= 1,
1531If arguments.Length - argIndex <> 1 Then
1570If argumentNames.Length > 0 OrElse paramIndex < parameters.Length Then
1571matchedParameters = CreateMatchTable(parameters.Length, paramIndex - 1)
1576If argumentNames.Length > 0 Then
1578Debug.Assert(parameters.Length > 0, "expected some parameters here") 'Candidate collection guarantees this.
1590Dim namedArgumentMapping As Integer() = New Integer(argumentNames.Length - 1) {}
1593Do While argIndex < argumentNames.Length
1646For index As Integer = 0 To matchedParameters.Length - 1
1672Debug.Assert(typeArguments.Length = targetProcedure.TypeParameters.Length, "expected length match")
1676For typeArgumentIndex As Integer = 0 To typeArguments.Length - 1
1717Debug.Assert(matchedArguments.Length = parameters.Length OrElse
1718matchedArguments.Length = parameters.Length + 1,
1720Debug.Assert(arguments.Length <= parameters.Length OrElse
1727If namedArgumentMapping IsNot Nothing Then argIndex = namedArgumentMapping.Length
1732Do While argIndex < arguments.Length
1754Dim remainingArgumentCount As Integer = arguments.Length - argIndex
1762Do While argIndex < arguments.Length
1775Debug.Assert(arguments.Length - argIndex = 1,
1795If namedArgumentMapping IsNot Nothing OrElse paramIndex < parameters.Length Then
1796matchedParameters = CreateMatchTable(parameters.Length, paramIndex - 1)
1803Debug.Assert(parameters.Length > 0, "expected some parameters here") 'Candidate collection guarantees this.
1816Do While argIndex < namedArgumentMapping.Length
1832For index As Integer = 0 To matchedParameters.Length - 1
1857Debug.Assert(arguments.Length <= parameters.Length OrElse
1861Dim argIndex As Integer = argumentNames.Length
1866Do While argIndex < arguments.Length
1895Do While argIndex < arguments.Length
1915Debug.Assert(arguments.Length - argIndex <= 1,
1918If arguments.Length - argIndex <> 1 Then
1940If argumentNames.Length > 0 Then
1942Debug.Assert(parameters.Length > 0, "expected some parameters here") 'Candidate collection guarantees this.
1945Do While argIndex < argumentNames.Length
1995For index As Integer = 0 To copyBack.Length - 1
2006Debug.Assert(copyBack.Length = arguments.Length, "array sizes must match")
2007Debug.Assert(parameterResults.Length = targetProcedure.Parameters.Length, "parameter arrays must match")
2013If namedArgumentMapping IsNot Nothing Then argIndex = namedArgumentMapping.Length
2018Do While argIndex < arguments.Length
2039Do While argIndex < namedArgumentMapping.Length
2166Dim argIndex As Integer = argumentNames.Length
2167Do While argIndex < arguments.Length
2231Do While argIndex < argumentNames.Length
2825arguments.Length,
Microsoft\VisualBasic\FileIO\FileSystem.vb (22)
756FileStream.Write(data, 0, data.Length)
1286ByteCount = FileStream.Read(ByteBuffer, 0, ByteBuffer.Length)
1311Dim AdditionalByteCount As Integer = FileStream.Read(ByteBuffer, ByteCount, ByteBuffer.Length - ByteCount)
1313Debug.Assert(ByteCount <= ByteBuffer.Length)
1323ByteCount = FileStream.Read(ByteBuffer, 0, ByteBuffer.Length)
1400If wildcards Is Nothing OrElse wildcards.Length = 0 Then
1497Debug.Assert(DInfo.GetFiles(IO.Path.GetFileName(FullPath)).Length = 1, "Must found exactly 1")
1500Debug.Assert(DInfo.GetDirectories(IO.Path.GetFileName(FullPath)).Length = 1,
2189ByteBufferStartIndex = m_Preamble.Length
2190Count -= m_Preamble.Length ' Reduce the valid byte count if ByteBuffer was shrunk.
2203Dim CharBuffer(m_PreviousCharBuffer.Length + ExpectedCharCount - 1) As Char
2206destinationArray:=CharBuffer, destinationIndex:=0, length:=m_PreviousCharBuffer.Length)
2210chars:=CharBuffer, charIndex:=m_PreviousCharBuffer.Length)
2214If CharBuffer.Length > m_SearchText.Length Then
2215If m_PreviousCharBuffer.Length <> m_SearchText.Length Then
2218Array.Copy(sourceArray:=CharBuffer, sourceIndex:=(CharBuffer.Length - m_SearchText.Length),
2245Debug.Assert(BigBuffer.Length > SmallBuffer.Length, "BigBuffer should be longer")
2246If BigBuffer.Length < SmallBuffer.Length Or SmallBuffer.Length = 0 Then
2249For i As Integer = 0 To SmallBuffer.Length - 1
Microsoft.VisualBasic.Forms (3)
Microsoft.VisualStudio.TestPlatform.Common (18)
Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger (9)
Microsoft.VisualStudio.TestPlatform.ObjectModel (12)
Microsoft.Web.XmlTransform (1)
Microsoft.Win32.Registry (17)
Microsoft.Win32.SystemEvents (3)
Mono.Cecil (156)
Mono.Cecil.Mdb (24)
Mono.Cecil.Pdb (37)
Mono.Cecil.Rocks (3)
MSBuild (110)
XMake.cs (73)
787&& switchesNotFromAutoResponseFile[CommandLineSwitches.ParameterizedSwitch.MaxCPUCount].Length == 0
788&& switchesFromAutoResponseFile[CommandLineSwitches.ParameterizedSwitch.MaxCPUCount].Length == 0
804bool outputPropertiesItemsOrTargetResults = getProperty.Length > 0 || getItem.Length > 0 || getTargetResult.Length > 0;
816getProperty.Length > 0 ? "getProperty" :
817getItem.Length > 0 ? "getItem" :
820else if ((getProperty.Length > 0 || getItem.Length > 0) && (targets is null || targets.Length == 0))
904if (outputPropertiesItemsOrTargetResults && targets?.Length > 0 && result is not null)
1128if (getProperty.Length == 1 && getItem.Length == 0)
1161else if (getProperty.Length == 1 && getItem.Length == 0 && getTargetResult.Length == 0)
1356if (loggers.Length == 1 &&
1606bool restoreOnly = targets.Length == 1 && string.Equals(targets[0], MSBuildConstants.RestoreTargetName, StringComparison.OrdinalIgnoreCase);
2239bool minimizeStdOutOutput = getProperty.Length + getItem.Length + getTargetResult.Length > 0 && getResultOutputFile.Length == 0;
2457if (parameterAndValue[0].Equals("default", StringComparison.InvariantCultureIgnoreCase) && parameterAndValue.Length > 1)
2490terminalLoggerArg = switches[switches.Length - 1];
2557return terminalLoggerParameters?.Length > 0 ? MSBuildApp.AggregateParameters(string.Empty, terminalLoggerParameters) : string.Empty;
2654if (parameters.Length == 1 && bool.TryParse(parameters[0], out bool boolValue))
2688if (parameters.Length == 1 && bool.TryParse(parameters[0], out var boolValue))
2738if (parameters.Length > 0)
2742parentPacketVersion = byte.Parse(parameters[parameters.Length - 1], CultureInfo.InvariantCulture);
2746CommunicationsUtilities.Trace($"Invalid node packet version value '{parameters[parameters.Length - 1]}': {ex.Message}");
2751CommunicationsUtilities.Trace($"Node packet version value '{parameters[parameters.Length - 1]}' out of range: {ex.Message}");
2772if (parameters.Length > 0)
2777enableNodeReuse = bool.Parse(parameters[parameters.Length - 1]);
2781CommandLineSwitchException.Throw("InvalidNodeReuseValue", parameters[parameters.Length - 1], ex.Message);
2785CommandLineSwitchException.Throw("InvalidNodeReuseValue", parameters[parameters.Length - 1], ex.Message);
2800if (parameters.Length > 0)
2804writer = FileUtilities.OpenWrite(parameters[parameters.Length - 1], append: false);
2808CommandLineSwitchException.Throw("InvalidPreprocessPath", parameters[parameters.Length - 1], ex.Message);
2819if (parameters.Length > 0)
2823writer = FileUtilities.OpenWrite(parameters[parameters.Length - 1], append: false);
2827CommandLineSwitchException.Throw("TargetsCouldNotBePrinted", parameters[parameters.Length - 1], ex.Message);
2882if (parameters.Length > 0)
2886value = bool.Parse(parameters[parameters.Length - 1]);
2890CommandLineSwitchException.Throw(resourceName, parameters[parameters.Length - 1], ex.Message);
2894CommandLineSwitchException.Throw(resourceName, parameters[parameters.Length - 1], ex.Message);
2911if (parameters == null || parameters.Length == 0)
2918var profilerFile = parameters[parameters.Length - 1];
2933CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
2938CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
2943CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
2977if (input.Length > 0)
3079if (parameters.Length > 0)
3083cpuCount = int.Parse(parameters[parameters.Length - 1], CultureInfo.InvariantCulture);
3087CommandLineSwitchException.Throw("InvalidMaxCPUCountValue", parameters[parameters.Length - 1], ex.Message);
3091CommandLineSwitchException.Throw("InvalidMaxCPUCountValue", parameters[parameters.Length - 1], ex.Message);
3094CommandLineSwitchException.VerifyThrow(cpuCount > 0 && cpuCount <= 1024, "InvalidMaxCPUCountValueOutsideRange", parameters[parameters.Length - 1]);
3112Assumed.LessThanOrEqual(parameters.Length, 1, "Expect exactly one project at a time.");
3117if (parameters.Length == 1)
3244if (projectExtensionsToIgnore?.Length > 0)
3294if (parameters.Length > 0)
3298return parameters[parameters.Length - 1];
3319Debug.Assert((parameterSections.Length >= 1) && (parameterSections.Length <= 2),
3323CommandLineSwitchException.VerifyThrow((parameterSections[0].Length > 0) && (parameterSections.Length == 2),
3373if (verbositySwitchParameters.Length > 0)
3376originalVerbosity = ProcessVerbositySwitch(verbositySwitchParameters[verbositySwitchParameters.Length - 1]);
3435for (int i = 0; i < parametersToAggregate.Length; i++)
3460for (int i = 0; i < groupedFileLoggerParameters.Length; i++)
3480if (groupedFileLoggerParameters[i].Length > 0)
3515if (binaryLoggerParameters == null || binaryLoggerParameters.Length == 0)
3574if ((consoleLoggerParameters?.Length > 0))
3696if ((fileLoggerParameters?.Length > 0))
3784value = (nameValuePair.Length > 1) ? nameValuePair[1] : null;
4264if (features.Length == 1)
NuGet.Build.Tasks (19)
NuGet.Build.Tasks.Console (7)
NuGet.Build.Tasks.Pack (1)
NuGet.CommandLine.XPlat (18)
NuGet.Commands (16)
NuGet.Common (5)
NuGet.Configuration (2)
NuGet.Frameworks (9)
NuGet.LibraryModel (2)
NuGet.PackageManagement (7)
NuGet.Packaging (149)
Signing\Cms\NativeCms.cs (9)
75length: countersignatureSignatureValue.Length);
198Marshal.Copy(attributeValue.pbData, bytes, startIndex: 0, length: bytes.Length);
229if (!NativeMethods.CryptMsgUpdate(handle, input, (uint)input.Length, fFinal: true))
244var unmanagedCert = hb.Alloc(encodedCert.Length);
245Marshal.Copy(encodedCert, 0, unmanagedCert, encodedCert.Length);
248cbData = (uint)encodedCert.Length,
438var unmanagedData = hb.Alloc(data.Length);
439Marshal.Copy(data, 0, unmanagedData, data.Length);
442cbData = (uint)data.Length,
Signing\DerEncoding\DerEncoder.cs (57)
141return SegmentedEncodeUnsignedInteger(bigEndianBytes, 0, bigEndianBytes.Length);
155Debug.Assert(bigEndianBytes.Length > 0);
156Debug.Assert(bigEndianBytes.Length >= count - offset);
195EncodeLength(dataBytes.Length),
236Debug.Assert(unusedBits == 0 || data!.Length > 0);
238byte[] encodedData = new byte[data!.Length + 1];
241Buffer.BlockCopy(data, 0, encodedData, 1, data.Length);
255encodedData[data.Length] &= lastByteSemanticMask;
260EncodeLength(encodedData.Length),
313int lastBitProvided = (bigEndianBytes!.Length * 8) - 1;
369Debug.Assert(semanticBytes <= bigEndianBytes.Length);
387EncodeLength(dataSegment.Length),
405EncodeLength(data!.Length),
519return SegmentedEncodeUtf8String(chars!, 0, chars!.Length);
533Debug.Assert(offset <= chars!.Length);
535Debug.Assert(count <= chars.Length - offset);
548EncodeLength(encodedBytes.Length),
573EncodeLength(data.Length),
601EncodeLength(data.Length),
623EncodeLength(data.Length),
645EncodeLength(data.Length),
663return IsValidPrintableString(chars!, 0, chars!.Length);
681Debug.Assert(offset <= chars!.Length);
683Debug.Assert(count <= chars.Length - offset);
707return SegmentedEncodePrintableString(chars!, 0, chars!.Length);
721Debug.Assert(offset <= chars!.Length);
723Debug.Assert(count <= chars.Length);
724Debug.Assert(offset + count <= chars.Length);
743EncodeLength(encodedString.Length),
757return SegmentedEncodeIA5String(chars!, 0, chars!.Length);
771Debug.Assert(offset <= chars!.Length);
773Debug.Assert(count <= chars.Length);
774Debug.Assert(offset + count <= chars.Length);
798EncodeLength(encodedString.Length),
848EncodeLength(asciiDateBytes.Length),
902EncodeLength(asciiDateBytes.Length),
932payloadLength += segment.Length;
939byte[] encodedSequence = new byte[1 + encodedLength.Length + payloadLength];
945Buffer.BlockCopy(encodedLength, 0, encodedSequence, writeStart, encodedLength.Length);
947writeStart += encodedLength.Length;
952Debug.Assert(segments!.Length == 3);
958Buffer.BlockCopy(segment!, 0, encodedSequence, writeStart, segment!.Length);
959writeStart += segment.Length;
1080length += segment.Length;
1092Buffer.BlockCopy(segment, 0, concatenated, offset, segment.Length);
1093offset += segment.Length;
1107Debug.Assert(x!.Length == 3, $"x.Length is {x.Length} when it should be 3");
1108Debug.Assert(y!.Length == 3, $"y.Length is {y.Length} when it should be 3");
1139Debug.Assert(x[0].Length == 1, $"x[0].Length is {x[0].Length} when it should be 1");
1140Debug.Assert(y[0].Length == 1, $"y[0].Length is {y[0].Length} when it should be 1");
1149comparison = x[2].Length - y[2].Length;
1154for (int i = 0; i < x[2].Length; i++)
NuGet.ProjectModel (15)
NuGet.Protocol (12)
NuGet.Resolver (3)
NuGet.Versioning (21)
Pipelines.AppHost (1)
PresentationBuildTasks (133)
PresentationCore (704)
MS\Internal\IO\Packaging\NetStream.cs (4)
140if (offset + count > buffer.Length)
337while (Read(buf, 0, buf.Length) > 0)
473_responseStream.BeginRead(_readBuf, 0, _readBuf.Length, new AsyncCallback(ReadCallBack), this);
1005_responseStream.BeginRead(_readBuf, 0, _readBuf.Length, new AsyncCallback(ReadCallBack), this);
PresentationFramework (874)
System\Windows\Controls\Grid.cs (66)
438Array.Clear(_definitionIndices, 0, _definitionIndices.Length);
446Array.Clear(_roundingErrors, 0, _roundingErrors.Length);
466Debug.Assert(DefinitionsU.Length > 0 && DefinitionsV.Length > 0);
635bool canResolveStarsU = extData.CellGroup2 > PrivateCells.Length;
722Debug.Assert(DefinitionsU.Length > 0 && DefinitionsV.Length > 0);
733for (int currentCell = 0; currentCell < PrivateCells.Length; ++currentCell)
818value = definitions[(columnIndex + 1) % definitions.Length].FinalOffset;
840value = definitions[(rowIndex + 1) % definitions.Length].FinalOffset;
936for (int i = PrivateCells.Length - 1; i >= 0; --i)
953ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1),
956RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1)
962cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
966cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
968Debug.Assert(0 <= cell.ColumnIndex && cell.ColumnIndex < DefinitionsU.Length);
969Debug.Assert(0 <= cell.RowIndex && cell.RowIndex < DefinitionsV.Length);
1067Debug.Assert(ExtData.DefinitionsU != null && ExtData.DefinitionsU.Length > 0);
1114Debug.Assert(ExtData.DefinitionsV != null && ExtData.DefinitionsV.Length > 0);
1129for (int i = 0; i < definitions.Length; ++i)
1173double[] minSizes = isRows ? new double[DefinitionsV.Length] : new double[DefinitionsU.Length];
1175for (int j=0; j<minSizes.Length; j++)
1193} while (i < PrivateCells.Length);
1200for (int i=0; i<minSizes.Length; i++)
1245if (cellsHead >= PrivateCells.Length)
1298} while (i < PrivateCells.Length);
1427Debug.Assert(0 < count && 0 <= start && (start + count) <= definitions.Length);
1454Debug.Assert(0 < count && 0 <= start && (start + count) <= definitions.Length);
1482Debug.Assert(1 < count && 0 <= start && (start + count) <= definitions.Length);
1684for (int i = 0; i < definitions.Length; ++i)
1780int defCount = definitions.Length;
2078for (int i = 0; i < definitions.Length; ++i)
2114int nonStarIndex = definitions.Length; // traverses from the last entry down
2130for (int i = 0; i < definitions.Length; ++i)
2258Array.Sort(definitionIndices, 0, definitions.Length, new DistributionOrderIndexComparer(definitions));
2261for (int i = 0; i < definitions.Length; ++i)
2264double final = definitions[definitionIndex].SizeCache + (sizeToDistribute / (definitions.Length - i));
2289for (int i = 0; i < definitions.Length; ++i)
2296Array.Sort(definitionIndices, 0, definitions.Length, new RoundingErrorIndexComparer(roundingErrors));
2302int i = definitions.Length - 1;
2319while ((adjustedSize < finalSize && !_AreClose(adjustedSize, finalSize)) && i < definitions.Length)
2336for (int i = 0; i < definitions.Length; ++i)
2338definitions[(i + 1) % definitions.Length].FinalOffset = definitions[i].FinalOffset + definitions[i].SizeCache;
2359int defCount = definitions.Length;
2705for (int i = 0; i < definitions.Length; ++i)
2759for (int i = 0; i < definitions.Length; ++i)
2765Array.Sort(definitionIndices, 0, definitions.Length, new RoundingErrorIndexComparer(roundingErrors));
2771int i = definitions.Length - 1;
2788while ((adjustedSize < finalSize && !_AreClose(adjustedSize, finalSize)) && i < definitions.Length)
2806for (int i = 0; i < definitions.Length; ++i)
2808definitions[(i + 1) % definitions.Length].FinalOffset = definitions[i].FinalOffset + definitions[i].SizeCache;
2915Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3120int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3123|| extData.TempDefinitions.Length < requiredLength )
3135|| extData.TempDefinitions.Length < requiredLength )
3153int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3155if (_definitionIndices == null || _definitionIndices.Length < requiredLength)
3171int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3177else if (_roundingErrors == null || _roundingErrors.Length < requiredLength)
4045for (int i = 1; i < grid.DefinitionsU.Length; ++i)
4053for (int i = 1; i < grid.DefinitionsV.Length; ++i)
System\Windows\Documents\TextSchema.cs (22)
54_inheritableTextElementProperties = new DependencyProperty[textElementPropertyList.Length + Typography.TypographyPropertiesList.Length];
55Array.Copy(textElementPropertyList, 0, _inheritableTextElementProperties, 0, textElementPropertyList.Length);
56Array.Copy(Typography.TypographyPropertiesList, 0, _inheritableTextElementProperties, textElementPropertyList.Length, Typography.TypographyPropertiesList.Length);
66_inheritableBlockProperties = new DependencyProperty[blockPropertyList.Length + _inheritableTextElementProperties.Length];
67Array.Copy(blockPropertyList, 0, _inheritableBlockProperties, 0, blockPropertyList.Length);
68Array.Copy(_inheritableTextElementProperties, 0, _inheritableBlockProperties, blockPropertyList.Length, _inheritableTextElementProperties.Length);
77_inheritableTableCellProperties = new DependencyProperty[tableCellPropertyList.Length + _inheritableTextElementProperties.Length];
78Array.Copy(tableCellPropertyList, _inheritableTableCellProperties, tableCellPropertyList.Length);
79Array.Copy(_inheritableTextElementProperties, 0, _inheritableTableCellProperties, tableCellPropertyList.Length, _inheritableTextElementProperties.Length);
655for (int i = 0; i < _inheritableBlockProperties.Length; i++)
664for (int i = 0; i < _paragraphProperties.Length; i++)
680for (int i = 0; i < _inheritableTextElementProperties.Length; i++)
689for (int i = 0; i < _inlineProperties.Length; i++)
704for (int i = 0; i < _nonFormattingCharacterProperties.Length; i++)
735for (i = 0; i < _structuralCharacterProperties.Length; i++)
741return (i < _structuralCharacterProperties.Length);
PresentationFramework.Aero (1)
PresentationFramework.Aero2 (1)
PresentationFramework.AeroLite (1)
src\wpf\src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
33values.Length != 5 ||
PresentationFramework.Classic (1)
src\wpf\src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
33values.Length != 5 ||
PresentationFramework.Luna (1)
src\wpf\src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
33values.Length != 5 ||
PresentationFramework.Royale (1)
src\wpf\src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (1)
33values.Length != 5 ||
PresentationFramework-SystemCore (5)
PresentationUI (7)
QuarantineTools.Tests (2)
ReachFramework (65)
PrintConfig\PTProvider.cs (9)
390IntPtr umDevMode = Marshal.AllocCoTaskMem(devMode.Length);
394Marshal.Copy(devMode, 0, umDevMode, devMode.Length);
400(uint)devMode.Length,
631CopyIStreamToArray(stream, result, (uint)result.Length);
647Invariant.Assert(src.Length >= byteCount);
671int bytesToWrite = Math.Min(data.Length, (int)(byteCount - totalBytesWritten));
705Invariant.Assert(dst.Length >= byteCount);
725int bytesToRead = Math.Min(data.Length, (int)(byteCount - totalBytesRead));
727Array.Clear(data, 0, data.Length);
RepoTasks (14)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (8)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
702Array.Clear(keyBytes, 0, keyBytes.Length);
703Array.Clear(pem, 0, pem.Length);
709Array.Clear(keyBytes, 0, keyBytes.Length);
710Array.Clear(pem, 0, pem.Length);
760Array.Clear(bytes, 0, bytes.Length);
788Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
Roslyn.Diagnostics.Analyzers (160)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (26)
17Debug.Assert(start <= array.Length);
19if (start + length > array.Length)
21length = array.Length - start;
31T[] newArray = new T[array.Length + 1];
37if (position < array.Length)
39Array.Copy(array, position, newArray, position + 1, array.Length - position);
48return InsertAt(array, array.Length, item);
53T[] newArray = new T[array.Length + items.Length];
59if (position < array.Length)
61Array.Copy(array, position, newArray, position + items.Length, array.Length - position);
70return InsertAt(array, array.Length, items);
80if (position + length > array.Length)
82length = array.Length - position;
85T[] newArray = new T[array.Length - length];
91if (position < newArray.Length)
93Array.Copy(array, position + length, newArray, position, newArray.Length - position);
101T[] newArray = new T[array.Length];
102Array.Copy(array, newArray, array.Length);
114ReverseContents(array, 0, array.Length);
132var high = array.Length - 1;
165if (first == null || second == null || first.Length != second.Length)
170for (var i = 0; i < first.Length; i++)
191int high = array.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
106if (trivia.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
99where nameSplit.Length == 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (6)
23=> CreateReadableStream(bytes, bytes.Length);
81for (long c = 0; c < chunks.Length; c++)
218Read(this.chunks, 0, this.length, array, 0, array.Length);
232var copyCount = Math.Min(chunk.Length, count);
315Array.Clear(chunk, 0, chunk.Length);
338Array.Clear(chunks[chunkIndex], chunkOffset, chunks[chunkIndex].Length - chunkOffset);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
55if (typeArguments.Length == 0)
Roslyn.Diagnostics.CSharp.Analyzers (1)
Roslyn.Diagnostics.VisualBasic.Analyzers (1)
rzc (23)
ScenarioTests.Common.Tests (8)
sdk-tasks (34)
Security.TransportSecurity.IntegrationTests (1)
Shared (21)
ServerSentEvents\SseParser_1.cs (9)
284Debug.Assert(searchOffset <= _lineBuffer.Length, $"{searchOffset}, {_lineBuffer.Length}");
309if (_lineOffset + _lineLength == _lineBuffer.Length)
321else if (_lineLength == _lineBuffer.Length)
323GrowBuffer(ref _lineBuffer, _lineBuffer.Length * 2);
407if (_dataBuffer is null || _dataLength + _lineLength + 1 > _dataBuffer.Length)
499_lineBuffer, offset, _lineBuffer.Length - offset);
525new ValueTask<int>(_stream.ReadAsync(_lineBuffer, offset, _lineBuffer.Length - offset, cancellationToken))
564Array.Copy(toReturn, buffer, toReturn.Length);
Stress.ApiService (1)
Stress.AppHost (1)
SuperFileCheck (10)
System.CodeDom (44)
System.Collections (82)
System.Collections.Concurrent (33)
System\Collections\Concurrent\ConcurrentBag.cs (7)
289if (index > array.Length - count)
785var newArray = new T[_array.Length << 1];
789Array.Copy(_array, newArray, _array.Length);
793Array.Copy(_array, headIdx, newArray, 0, _array.Length - headIdx);
794Array.Copy(_array, 0, newArray, _array.Length - headIdx, headIdx);
1024Debug.Assert(arrayIndex >= 0 && arrayIndex <= array.Length);
1033Debug.Assert(arrayIndex <= array.Length - count);
System.Collections.Immutable (146)
System\Collections\Immutable\ImmutableArray_1.Builder.cs (13)
55get { return _elements.Length; }
63if (value != _elements.Length)
229if (result.Length != _count)
369this.Count += items.Length;
371Array.Copy(items, 0, _elements, offset, items.Length);
384this.Count += items.Length;
386Array.Copy(items, 0, _elements, offset, items.Length);
397Requires.Range(length >= 0 && length <= items.Length, nameof(length));
705Requires.Range(index >= 0 && index + this.Count <= array.Length, nameof(index));
731Requires.Range(destinationIndex >= 0 && destinationIndex + length <= destination.Length, nameof(destinationIndex));
741if (_elements.Length < capacity)
743int newCapacity = Math.Max(_elements.Length * 2, capacity);
1096Array.Copy(_elements, copied + removed, _elements, copied, _elements.Length - (copied + removed));
System.Collections.NonGeneric (30)
System\Collections\Queue.cs (20)
87int firstPart = (_array.Length - _head < numToCopy) ? _array.Length - _head : numToCopy;
91Array.Copy(_array, 0, q._array, _array.Length - _head, numToCopy);
113Array.Clear(_array, _head, _array.Length - _head);
136int arrayLen = array.Length;
143int firstPart = (_array.Length - _head < numToCopy) ? _array.Length - _head : numToCopy;
147Array.Copy(_array, 0, array, index + _array.Length - _head, numToCopy);
154if (_size == _array.Length)
156int newcapacity = (int)((long)_array.Length * (long)_growFactor / 100);
157if (newcapacity < _array.Length + MinimumGrow)
159newcapacity = _array.Length + MinimumGrow;
165_tail = (_tail + 1) % _array.Length;
187_head = (_head + 1) % _array.Length;
234index = (index + 1) % _array.Length;
242return _array[(_head + i) % _array.Length];
261Array.Copy(_array, _head, arr, 0, _array.Length - _head);
262Array.Copy(_array, 0, arr, _array.Length - _head, _tail);
282Array.Copy(_array, _head, newarray, 0, _array.Length - _head);
283Array.Copy(_array, 0, newarray, _array.Length - _head, _tail);
System.Collections.Specialized (5)
System.CommandLine (11)
System.CommandLine.StaticCompletions (13)
System.ComponentModel.Annotations (10)
System.ComponentModel.Composition (71)
System.ComponentModel.Composition.Registration (3)
System.ComponentModel.TypeConverter (115)
System.Composition.Convention (4)
System.Composition.Hosting (9)
System.Composition.TypedParts (10)
System.Configuration.ConfigurationManager (34)
System.Console (14)
System.Data.Common (686)
System\Data\DataTableReader.cs (23)
47if (dataTables.Length == 0)
52_tables = new DataTable[dataTables.Length];
53for (int i = 0; i < dataTables.Length; i++)
143if ((_tableCounter == _tables.Length - 1))
364return tempBuffer.Length;
368int byteCount = Math.Min(tempBuffer.Length - srcIndex, length);
371throw ADP.InvalidSourceBufferIndex(tempBuffer.Length, srcIndex, nameof(dataIndex));
373else if ((bufferIndex < 0) || (bufferIndex > 0 && bufferIndex >= buffer.Length))
375throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, nameof(bufferIndex));
427return tempBuffer.Length;
431int charCount = Math.Min(tempBuffer.Length - srcIndex, length);
434throw ADP.InvalidSourceBufferIndex(tempBuffer.Length, srcIndex, nameof(dataIndex));
436else if ((bufferIndex < 0) || (bufferIndex > 0 && bufferIndex >= buffer.Length))
438throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, nameof(bufferIndex));
680Array.Copy(_currentDataRow!.ItemArray, values, _currentDataRow.ItemArray.Length > values.Length ? values.Length : _currentDataRow.ItemArray.Length);
681return (_currentDataRow.ItemArray.Length > values.Length ? values.Length : _currentDataRow.ItemArray.Length);
826for (int j = 0; j < dependency.Length; j++)
System\Data\ProviderBase\SchemaMapping.cs (28)
201bool[] readOnly = new bool[mapped.Length];
202for (int i = 0; i < readOnly.Length; ++i)
212for (int i = 0; i < readOnly.Length; ++i)
220for (int i = 0; i < mapped.Length; ++i)
232for (int i = 0; i < readOnly.Length; ++i)
284Debug.Assert(_mappedLength == _indexMap!.Length, "incorrect precomputed length");
299Debug.Assert(_mappedLength == Math.Min(_readerDataValues!.Length, _mappedDataValues!.Length), "incorrect precomputed length");
314for (int i = 0; i < _xmlMap.Length; ++i)
390for (int i = 0; i < _readerDataValues!.Length; ++i)
439for (int i = 0; i < _chapterMap!.Length; ++i)
458int rowLength = _chapterMap!.Length;
513for (int i = 0; i < fieldNames.Length; ++i)
524Debug.Assert(len <= rgcol.Length, "invalid len passed to ResizeArray");
657for (int x = 0; x < _xmlMap.Length; ++x)
770Debug.Assert(_dataReader.FieldCount <= schemaRows.Length, "unexpected fewer rows in Schema than FieldCount");
772if (0 == schemaRows.Length)
780bool addPrimaryKeys = (((0 == _dataTable.PrimaryKey.Length) && ((4 <= (int)_loadOption) || (0 == _dataTable.Rows.Count)))
803for (int sortedIndex = 0; sortedIndex < schemaRows.Length; ++sortedIndex)
825chapterIndexMap = new bool[schemaRows.Length];
834_xmlMap = new int[schemaRows.Length];
843_xmlMap = new int[schemaRows.Length];
859columnIndexMap = CreateIndexMap(schemaRows.Length, unsortedIndex);
891for (int x = 0; x < _xmlMap.Length; ++x)
1022keys ??= new DataColumn[schemaRows.Length];
1039columnIndexMap = CreateIndexMap(schemaRows.Length, unsortedIndex);
1076if (keyCount < keys.Length)
1112dataValues = SetupMapping(schemaRows.Length, columnCollection, chapterColumn, chapterValue);
System\Data\SQLTypes\SQLChars.cs (17)
72_lCurLen = _rgchBuf.Length;
152_ => (_rgchBuf == null) ? -1L : _rgchBuf.Length,
274ArgumentOutOfRangeException.ThrowIfGreaterThan(value, _rgchBuf.Length);
300ArgumentOutOfRangeException.ThrowIfGreaterThan(offsetInBuffer, buffer.Length);
304ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offsetInBuffer);
348if (offset > _rgchBuf.Length)
352ArgumentOutOfRangeException.ThrowIfGreaterThan(offsetInBuffer, buffer.Length);
355ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offsetInBuffer);
357if (count > _rgchBuf.Length - offset)
433Debug.Assert(FStream() || (_rgchBuf != null && _lCurLen <= _rgchBuf.Length));
436Debug.Assert(_rgchWorkBuf == null || _rgchWorkBuf.Length == 1);
456if (_rgchBuf == null || _rgchBuf.Length < lStreamLen)
473_lCurLen = (_rgchBuf == null) ? x_lNull : _rgchBuf.Length;
650ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, buffer.Length);
652ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offset);
666ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, buffer.Length);
668ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - offset);
System\Data\SQLTypes\SQLString.cs (5)
140: this(lcid, compareOptions, data, 0, data.Length, fUnicode)
156: this(lcid, compareOptions, data, 0, data.Length, true)
723int cbX = rgDataX.Length;
724int cbY = rgDataY.Length;
917return SqlBinary.HashByteArray(rgbSortKey, rgbSortKey.Length);
System.Data.Odbc (94)
System\Data\Odbc\OdbcConnectionHandle.cs (3)
227ODBC32.SQLRETURN retcode = Interop.Odbc.SQLGetConnectAttrW(this, attribute, buffer, buffer.Length, out cbActual);
240ODBC32.SQLRETURN retcode = Interop.Odbc.SQLGetInfoW(this, info, buffer, checked((short)buffer.Length), out cbActual);
246ODBC32.SQLRETURN retcode = Interop.Odbc.SQLGetInfoW(this, info, buffer, checked((short)buffer.Length), ADP.PtrZero);
System.Data.OleDb (165)
OleDbDataReader.cs (53)
155return ((null != metadata) ? metadata.Length : 0);
263if ((null != metadata) && (0 < metadata.Length))
265if ((0 < metadata.Length) && _useIColumnsRowset && (null != _connection))
295if (null != _metadata && 0 < _metadata.Length)
306if (null != _metadata && 0 < _metadata.Length)
326schemaTable.MinimumCapacity = metadata.Length;
374if (_visibleFieldCount < metadata.Length)
384for (int i = 0; i < metadata.Length; ++i)
414if (_visibleFieldCount < metadata.Length)
752for (int i = 0; i < bindings.Length; ++i)
860return value.Length;
863int byteCount = Math.Min(value.Length - srcIndex, length);
866throw ADP.InvalidSourceBufferIndex(value.Length, srcIndex, "dataIndex");
868else if ((bufferIndex < 0) || (bufferIndex >= buffer.Length))
870throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, "bufferIndex");
905else if ((bufferIndex < 0) || (bufferIndex >= buffer.Length))
907throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, "bufferIndex");
1160int count = Math.Min(values.Length, _visibleFieldCount);
1161for (int i = 0; (i < _metadata!.Length) && (i < count); ++i)
1410return (0 < _metadata!.Length);
1418Debug.Assert(0 <= _metadata!.Length, "incorrect state for fieldCount");
1431Debug.Assert(0 <= _metadata.Length, "incorrect state for fieldCount");
1450for (int i = 0; (i < bindings.Length) && (i < _nextAccessorForRetrieval); ++i)
1469Debug.Assert(null != _metadata && 0 < _metadata.Length, "no columns");
1474for (int i = 0; i < dbBindings.Length; ++i)
1518int[] indexToBinding = new int[metadata.Length];
1519int[] indexWithinBinding = new int[metadata.Length];
1526for (int i = 0; i < indexToBinding.Length; ++i)
1555for (int i = 0; i < indexToBinding.Length; ++i)
1560bindingCount = metadata.Length;
1565for (int i = 0; i < indexToBinding.Length; ++i)
1578for (int index = 0; index < metadata.Length; ++index)
1580Debug.Assert(indexToBinding[index] < dbbindings.Length, "bad indexToAccessor");
1585for (int i = index; (i < metadata.Length) && (bindingCount == indexWithinBinding[i]); ++i)
1669for (int i = 0; i < dbbindings.Length; ++i)
1674for (int k = 0; k < columnBindings.Length; ++k)
1844bool[] mustRelease = new bool[columnBindings.Length];
1845StringMemHandle?[] sptr = new StringMemHandle[columnBindings.Length];
1849for (int i = 0; i < columnBindings.Length; ++i)
1874hr = irow.GetColumns((IntPtr)access.Length, access);
1882for (int i = 0; i < mustRelease.Length; i++)
1913if (_metadata.Length <= 0)
1919for (int i = 0; i < _metadata.Length; ++i)
1933for (int i = 0; i < _metadata.Length; ++i)
1988Hashtable baseColumnNames = new Hashtable(_metadata.Length * 2);
1990for (int i = _metadata.Length - 1; 0 <= i; --i)
1998for (int i = 0; i < _metadata.Length; ++i)
2085for (int i = 0; i < _metadata!.Length; ++i)
2130bool[] keys = new bool[_metadata!.Length];
2131bool[]? uniq = new bool[_metadata.Length];
2202for (int i = 0; i < _metadata.Length; ++i)
2217for (int i = 0; i < _metadata.Length; ++i)
2505if ((null != metadata) && (0 < metadata.Length))
System.Diagnostics.DiagnosticSource (39)
System.Diagnostics.EventLog (61)
System\Diagnostics\EventLogInternal.cs (20)
724while (idx < entries.Length)
728oldestEntry + idx, buf, buf.Length, out bytesRead, out minBytesNeeded);
740else if (minBytesNeeded > buf.Length)
745oldestEntry + idx, buf, buf.Length, out bytesRead, out _);
759while (sum < bytesRead && idx < entries.Length)
766if (idx != entries.Length)
904cache, cache.Length, out bytesRead, out minBytesNeeded);
919if (minBytesNeeded > cache.Length)
925cache, cache.Length, out bytesRead, out _);
1195for (int i = 0; i < interestedComponents.Length; i++)
1344strings = new string[values.Length];
1345for (int i = 0; i < values.Length; i++)
1358if (strings.Length >= 256)
1361for (int i = 0; i < strings.Length; i++)
1379IntPtr[] stringRoots = new IntPtr[strings.Length];
1380GCHandle[] stringHandles = new GCHandle[strings.Length];
1384for (int strIndex = 0; strIndex < strings.Length; strIndex++)
1393sid, (short)strings.Length, rawData.Length, stringsRootHandle.AddrOfPinnedObject(), rawData);
1402for (int i = 0; i < strings.Length; i++)
System\Diagnostics\Reader\NativeWrapper.cs (6)
299bool status = UnsafeNativeMethods.EvtRender(context, eventHandle, flags, buffer.Length, buffer, out buffUsed, out _);
307status = UnsafeNativeMethods.EvtRender(context, eventHandle, flags, buffer.Length, buffer, out buffUsed, out _);
1079UnsafeNativeMethods.EvtStringVariant[] stringVariants = new UnsafeNativeMethods.EvtStringVariant[values.Length];
1080for (int i = 0; i < values.Length; i++)
1086bool status = UnsafeNativeMethods.EvtFormatMessage(handle, eventHandle, 0xffffffff, values.Length, stringVariants, UnsafeNativeMethods.EvtFormatMessageFlags.EvtFormatMessageEvent, 0, emptyBuffer, out bufferNeeded);
1107status = UnsafeNativeMethods.EvtFormatMessage(handle, eventHandle, 0xffffffff, values.Length, stringVariants, UnsafeNativeMethods.EvtFormatMessageFlags.EvtFormatMessageEvent, bufferNeeded, buffer, out bufferNeeded);
System.Diagnostics.PerformanceCounter (33)
System.Diagnostics.Process (26)
System.Diagnostics.TextWriterTraceListener (3)
System.Diagnostics.TraceSource (1)
System.DirectoryServices (75)
System\DirectoryServices\DirectorySearcher.cs (8)
646adsSearch.ExecuteSearch(Filter, properties, properties.Length, out resultsHandle);
815Marshal.Copy((INTPTR_INTPTRCAST)(&sortKey), sortKeyBytes, 0, sortKeyBytes.Length);
842vlvValue.contextIDlength = _vlv.DirectoryVirtualListViewContext._context.Length;
852Marshal.Copy(vlvPtr, vlvBytes, 0, vlvBytes.Length);
898IntPtr ptr = Marshal.AllocHGlobal(structSize * prefs.Length);
902for (int i = 0; i < prefs.Length; i++)
908adsSearch.SetSearchPreference(ptr, prefs.Length);
912for (int i = 0; i < prefs.Length; i++)
System.DirectoryServices.AccountManagement (42)
System.DirectoryServices.Protocols (89)
System\DirectoryServices\Protocols\common\BerConverter.cs (24)
55if (valueCount >= value.Length)
77if (valueCount >= value.Length)
99if (valueCount >= value.Length)
128if (valueCount >= value.Length)
151if (valueCount >= value.Length)
170tempValues = new byte[stringValues.Length][];
171for (int i = 0; i < stringValues.Length; i++)
192if (valueCount >= value.Length)
215if (valueCount >= value.Length)
323berValue.bv_len = new CLong(value.Length);
324berValue.bv_val = Marshal.AllocHGlobal(value.Length);
325Marshal.Copy(value, 0, berValue.bv_val, value.Length);
405stringArray = new string[byteArrayresult.Length];
406for (int i = 0; i < byteArrayresult.Length; i++)
469IntPtr tmp = Marshal.AllocHGlobal(tempValue.Length);
470Marshal.Copy(tempValue, 0, tmp, tempValue.Length);
472error = BerPal.PrintByteArray(berElement, new string(fmt, 1), memHandle, (uint)tempValue.Length, tag);
528berValArray = Utility.AllocHGlobalIntPtrArray(tempValue.Length + 1);
530managedBervalArray = new BerVal[tempValue.Length];
533for (i = 0; i < tempValue.Length; i++)
542managedBervalArray[i].bv_len = new CLong(byteArray.Length);
543managedBervalArray[i].bv_val = Marshal.AllocHGlobal(byteArray.Length);
544Marshal.Copy(byteArray, 0, managedBervalArray[i].bv_val, byteArray.Length);
563for (int i = 0; i < tempValue.Length; i++)
System\DirectoryServices\Protocols\ldap\LdapConnection.cs (23)
530serverControlArray = Utility.AllocHGlobalIntPtrArray(managedServerControls.Length + 1);
532for (int i = 0; i < managedServerControls.Length; i++)
539pServerControlArray[managedServerControls.Length] = null;
546clientControlArray = Utility.AllocHGlobalIntPtrArray(managedClientControls.Length + 1);
548for (int i = 0; i < managedClientControls.Length; i++)
555pClientControlArray[managedClientControls.Length] = null;
611bv_len = new CLong(byteArray.Length),
612bv_val = Marshal.AllocHGlobal(byteArray.Length)
614Marshal.Copy(byteArray, 0, berValuePtr.bv_val, byteArray.Length);
637addModCount = (modifications == null ? 1 : modifications.Length + 1);
673if (val != null && val.Length != 0)
677bv_len = new CLong(val.Length),
678bv_val = Marshal.AllocHGlobal(val.Length)
680Marshal.Copy(val, 0, berValuePtr.bv_val, val.Length);
774for (int i = 0; i < managedServerControls.Length; i++)
787for (int i = 0; i < managedServerControls.Length; i++)
807for (int i = 0; i < managedClientControls.Length; i++)
821for (int i = 0; i < managedClientControls.Length; i++)
1211if (byteControlValue == null || byteControlValue.Length == 0)
1224bv_len = new CLong(byteControlValue.Length),
1225bv_val = Marshal.AllocHGlobal(sizeof(byte) * byteControlValue.Length)
1312bv_len = new CLong(byteArray.Length),
1313bv_val = Marshal.AllocHGlobal(byteArray.Length)
System.Drawing.Common (105)
System\Drawing\Graphics.cs (18)
2060int count = destPoints.Length;
2077int count = destPoints.Length;
2133int count = destPoints.Length;
2142(GdiPlus.PointF*)p, destPoints.Length,
2178int count = destPoints.Length;
2187(GdiPlus.PointF*)p, destPoints.Length,
2231int count = destPoints.Length;
2240(GdiPlus.Point*)p, destPoints.Length,
2406CheckErrorStatus(PInvokeGdiPlus.GdipDrawLinesI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length));
3005if (destPoints.Length != 3)
3014(GdiPlus.PointF*)p, destPoints.Length,
3034if (destPoints.Length != 3)
3043(GdiPlus.Point*)p, destPoints.Length,
3140if (destPoints.Length != 3)
3149(GdiPlus.PointF*)p, destPoints.Length,
3173if (destPoints.Length != 3)
3182(GdiPlus.Point*)p, destPoints.Length,
3518CheckStatus(PInvokeGdiPlus.GdipComment(NativeGraphics, (uint)data.Length, b));
System\Drawing\Printing\PrinterSettings.PaperSizeCollection.cs (3)
26public int Count => _array.Length;
41void ICollection.CopyTo(Array array, int index) => Array.Copy(_array, index, array, 0, _array.Length);
43public void CopyTo(PaperSize[] paperSizes, int index) => Array.Copy(_array, index, paperSizes, 0, _array.Length);
System\Drawing\Printing\PrinterSettings.PaperSourceCollection.cs (3)
26public int Count => _array.Length;
41void ICollection.CopyTo(Array array, int index) => Array.Copy(_array, index, array, 0, _array.Length);
43public void CopyTo(PaperSource[] paperSources, int index) => Array.Copy(_array, index, paperSources, 0, _array.Length);
System\Drawing\Printing\PrinterSettings.PrinterResolutionCollection.cs (3)
23public int Count => _array.Length;
38void ICollection.CopyTo(Array array, int index) => Array.Copy(_array, index, array, 0, _array.Length);
40public void CopyTo(PrinterResolution[] printerResolutions, int index) => Array.Copy(_array, index, printerResolutions, 0, _array.Length);
System.Formats.Asn1 (11)
System.Formats.Cbor (1)
System.Formats.Nrbf (16)
System.Formats.Tar (19)
System.IO.Compression (74)
System\IO\Compression\DeflateZLib\DeflateStream.cs (10)
327int n = _stream.Read(_buffer, 0, _buffer.Length);
341else if (n > _buffer.Length)
479int n = await _stream.ReadAsync(new Memory<byte>(_buffer, 0, _buffer.Length), cancellationToken).ConfigureAwait(false);
493else if (n > _buffer.Length)
950int bytesRead = _deflateStream._inflater.Inflate(_arrayPoolBuffer, 0, _arrayPoolBuffer.Length);
963await _deflateStream._stream.CopyToAsync(this, _arrayPoolBuffer.Length, _cancellationToken).ConfigureAwait(false);
993int bytesRead = _deflateStream._inflater.Inflate(_arrayPoolBuffer, 0, _arrayPoolBuffer.Length);
1006_deflateStream._stream.CopyTo(this, _arrayPoolBuffer.Length);
1034else if (count > buffer.Length - offset)
1083else if (count > buffer.Length - offset)
System\IO\Compression\ZipArchiveEntry.cs (19)
152if (_storedEntryNameBytes.Length > ushort.MaxValue)
545Debug.Assert(_storedEntryNameBytes.Length <= ushort.MaxValue);
546Debug.Assert(_fileComment.Length <= ushort.MaxValue);
599int currExtraFieldDataLength = ZipGenericExtraField.TotalSize(_cdUnknownExtraFields, _cdTrailingExtraFieldData?.Length ?? 0);
616+ _storedEntryNameBytes.Length
619+ _fileComment.Length;
660BinaryPrimitives.WriteUInt16LittleEndian(cdStaticHeader[ZipCentralDirectoryFileHeader.FieldLocations.FilenameLength..], (ushort)_storedEntryNameBytes.Length);
662BinaryPrimitives.WriteUInt16LittleEndian(cdStaticHeader[ZipCentralDirectoryFileHeader.FieldLocations.FileCommentLength..], (ushort)_fileComment.Length);
686if (_fileComment.Length > 0)
714for (int i = 0; i < compressedBytes.Length - 1; i++)
718compressedBytes[compressedBytes.Length - 1] = new byte[_compressedSize % maxSingleBufferSize];
736for (int i = 0; i < _compressedBytes.Length - 1; i++)
740_archive.ArchiveStream.ReadAtLeast(_compressedBytes[_compressedBytes.Length - 1], (int)(_compressedSize % maxSingleBufferSize), throwOnEndOfStream: true);
1073Debug.Assert(_storedEntryNameBytes.Length <= ushort.MaxValue);
1134int currExtraFieldDataLength = ZipGenericExtraField.TotalSize(_lhUnknownExtraFields, _lhTrailingExtraFieldData?.Length ?? 0);
1154_archive.ArchiveStream.Seek(ZipLocalFileHeader.SizeOfLocalHeader + _storedEntryNameBytes.Length, SeekOrigin.Current);
1202BinaryPrimitives.WriteUInt16LittleEndian(lfStaticHeader[ZipLocalFileHeader.FieldLocations.FilenameLength..], (ushort)_storedEntryNameBytes.Length);
1276_archive.ArchiveStream.Write(compressedBytes, 0, compressedBytes.Length);
1413+ _storedEntryNameBytes.Length + Zip64ExtraField.OffsetToFirstField,
System\IO\Compression\ZipBlocks.Async.cs (6)
63int bytesRead = await stream.ReadAtLeastAsync(blockContents, blockContents.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
88int bytesRead = await stream.ReadAtLeastAsync(blockContents, blockContents.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
151int bytesRead = await stream.ReadAtLeastAsync(blockBytes, blockBytes.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
156bytesRead = await stream.ReadAtLeastAsync(blockBytes, blockBytes.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
234if (archiveComment.Length > 0)
245int bytesRead = await stream.ReadAtLeastAsync(blockContents, blockContents.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
System.IO.Compression.Brotli (3)
System.IO.Compression.ZipFile (2)
System.IO.FileSystem.DriveInfo (2)
System.IO.FileSystem.Watcher (11)
System.IO.Hashing (3)
System.IO.IsolatedStorage (9)
System.IO.Packaging (14)
System.IO.Pipelines (3)
System.IO.Pipes (1)
System.IO.Ports (26)
System\IO\Ports\SerialPort.cs (25)
668if (buffer.Length - offset < count)
809if (buffer.Length - offset < count)
821Debug.Assert(buffer.Length - offset >= count, "invalid offset/count!");
951Debug.Assert((buffer.Length - offset - totalCharsFound) >= currentCharsFound, "internal buffer to read one full unicode char sequence is not sufficient!");
1004_internalSerialStream.ReadExactly(bytesReceived, CachedBytesToRead, bytesReceived.Length - CachedBytesToRead); // get everything
1026int numCharsReceived = localDecoder.GetCharCount(bytesReceived, 0, bytesReceived.Length);
1027int lastFullCharIndex = bytesReceived.Length;
1031Buffer.BlockCopy(bytesReceived, 0, _inBuffer, 0, bytesReceived.Length); // put it all back!
1034_readLen = bytesReceived.Length;
1045_readLen = bytesReceived.Length - (lastFullCharIndex + 1);
1047Buffer.BlockCopy(bytesReceived, lastFullCharIndex + 1, _inBuffer, 0, bytesReceived.Length - (lastFullCharIndex + 1));
1146if (readBuffer.Length > 0)
1157MaybeResizeBuffer(readBuffer.Length + bytesToSave);
1159Buffer.BlockCopy(readBuffer, 0, _inBuffer, _readLen, readBuffer.Length);
1160_readLen += readBuffer.Length;
1185_internalSerialStream.Write(bytesToWrite, 0, bytesToWrite.Length, _writeTimeout);
1200if (buffer.Length - offset < count)
1203if (buffer.Length == 0) return;
1206Write(byteArray, 0, byteArray.Length);
1220if (buffer.Length - offset < count)
1222if (buffer.Length == 0) return;
1321if (additionalByteLength + _readLen <= _inBuffer.Length)
1325if (CachedBytesToRead + additionalByteLength <= _inBuffer.Length / 2)
1330int newLength = Math.Max(CachedBytesToRead + additionalByteLength, _inBuffer.Length * 2);
1332Debug.Assert(_inBuffer.Length >= _readLen, "ResizeBuffer - readLen > inBuffer.Length");
System.Linq (85)
System\Linq\OrderedEnumerable.SpeedOpt.cs (21)
18if (buffer.Length <= 1)
23TElement[] array = new TElement[buffer.Length];
32List<TElement> list = new(buffer.Length);
33if (buffer.Length >= 2)
35Fill(buffer, SetCountAndGetSpan(list, buffer.Length));
37else if (buffer.Length == 1)
67if (buffer.Length <= minIdx)
72if (buffer.Length <= maxIdx)
74maxIdx = buffer.Length - 1;
79return [GetEnumerableSorter().ElementAt(buffer, buffer.Length, minIdx)];
92if (buffer.Length <= minIdx)
97if (buffer.Length <= maxIdx)
99maxIdx = buffer.Length - 1;
104return new List<TElement>(1) { GetEnumerableSorter().ElementAt(buffer, buffer.Length, minIdx) };
154if (index < buffer.Length)
157return GetEnumerableSorter().ElementAt(buffer, buffer.Length, index);
218if (minIdx < buffer.Length)
221return (maxIdx < buffer.Length - 1) ?
222GetEnumerableSorter().ElementAt(buffer, buffer.Length, maxIdx) :
240for (int i = 1; i < items.Length; ++i)
482int count = buffer.Length;
System.Linq.AsyncEnumerable (23)
System.Linq.Expressions (301)
System.Linq.Parallel (97)
System.Linq.Queryable (16)
System.Management (36)
System.Memory (12)
System.Net.Http (124)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (9)
48for (int i = 0; i < _blocks.Length; i++)
184Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
187uint blockArraySize = (uint)_blocks.Length;
255Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
272for (uint i = firstUnallocatedBlock; i < _blocks.Length; i++)
310Debug.Assert(start + length <= blocks.Length * BlockSize);
355Debug.Assert(0 <= startInBlock, $"Invalid startInBlock={startInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
356Debug.Assert(startInBlock < endInBlock, $"Invalid startInBlock={startInBlock}, endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
357Debug.Assert(endInBlock <= BlockSize, $"Invalid endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
System.Net.Http.WinHttpHandler (14)
System.Net.HttpListener (43)
System\Net\Managed\HttpResponseStream.Managed.cs (7)
72ms.Write(bytes, 0, bytes.Length);
80InternalWrite(bytes, 0, bytes.Length);
106ms.Write(bytes, 0, bytes.Length);
181ms.Write(bytes, 0, bytes.Length);
195InternalWrite(bytes, 0, bytes.Length);
225ms.Write(bytes, 0, bytes.Length);
235InternalWrite(bytes, 0, bytes.Length);
System.Net.Mail (31)
System.Net.NameResolution (12)
System.Net.NetworkInformation (27)
System.Net.Ping (7)
System.Net.Primitives (16)
System.Net.Quic (25)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (9)
48for (int i = 0; i < _blocks.Length; i++)
184Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
187uint blockArraySize = (uint)_blocks.Length;
255Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
272for (uint i = firstUnallocatedBlock; i < _blocks.Length; i++)
310Debug.Assert(start + length <= blocks.Length * BlockSize);
355Debug.Assert(0 <= startInBlock, $"Invalid startInBlock={startInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
356Debug.Assert(startInBlock < endInBlock, $"Invalid startInBlock={startInBlock}, endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
357Debug.Assert(endInBlock <= BlockSize, $"Invalid endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
System.Net.Requests (19)
System\Net\CommandStream.cs (9)
190while (_index < _commands!.Length)
215BeginWrite(sendBuffer, 0, sendBuffer.Length, s_writeCallbackDelegate, this);
219Write(sendBuffer, 0, sendBuffer.Length);
281if (index < 0 || index >= commands!.Length ||
291if (_index >= _commands!.Length)
520BeginRead(state.Buffer, 0, state.Buffer.Length, s_readCallbackDelegate, state);
525bytesRead = Read(state.Buffer, 0, state.Buffer.Length);
630BeginRead(state.Buffer, 0, state.Buffer.Length, s_readCallbackDelegate, state);
635bytesRead = Read(state.Buffer, 0, state.Buffer.Length);
System.Net.Security (74)
System.Net.ServerSentEvents (13)
System.Net.Sockets (47)
System\Net\Sockets\Socket.cs (10)
938if (addresses.Length == 0)
1108return Send(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags);
1115return Send(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None);
1398return SendTo(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags, remoteEP);
1405return SendTo(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None, remoteEP);
1517return Receive(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags);
1524return Receive(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None);
1904return ReceiveFrom(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags, ref remoteEP);
1911return ReceiveFrom(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None, ref remoteEP);
2231int optionLength = optionValue != null ? optionValue.Length : 0;
System.Net.WebClient (24)
System\Net\WebClient.cs (21)
459_contentLength = data.Length;
526_contentLength = fs.Length + formHeaderBytes.Length + boundaryBytes.Length;
614_contentLength = buffer.Length;
841writeStream.SetLength(copyBuffer.Length);
849while ((bytesRead = readStream.Read(copyBuffer, 0, copyBuffer.Length)) != 0)
888writeStream.SetLength(copyBuffer.Length);
958writeStream.Write(header, 0, header.Length);
967int bytesRead = readStream.Read(buffer, 0, buffer.Length);
976for (int pos = 0; pos < buffer.Length;)
978int toWrite = buffer.Length - pos;
990writeStream.Write(footer, 0, footer.Length);
1026_progress.BytesSent += header.Length;
1047for (int pos = 0; pos < buffer.Length;)
1049int toWrite = buffer.Length - pos;
1064_progress.BytesSent += footer.Length;
1162return enc.GetString(data, bomLengthInData, data.Length - bomLengthInData);
1380_contentLength = requestData.Length;
1428_contentLength = data.Length;
1435chunkSize = (int)Math.Min((long)DefaultCopyBufferLength, data.Length);
1511chunkSize = (int)Math.Min((long)DefaultCopyBufferLength, buffer.Length);
System.Net.WebHeaderCollection (2)
System.Net.WebProxy (1)
System.Net.WebSockets (13)
System.Net.WebSockets.Client (4)
System.Numerics.Tensors (13)
System.ObjectModel (3)
System.Private.CoreLib (1648)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Array.cs (106)
37return array.Length == 0 ?
54if (larray.Length != newSize)
66(uint)Math.Min(newSize, larray.Length));
125if (lengths.Length == 0)
136for (int i = 0; i < lengths.Length; i++)
141return InternalCreate(t, lengths.Length, pLengths, null);
151if (lengths.Length != lowerBounds.Length)
153if (lengths.Length == 0)
164for (int i = 0; i < lengths.Length; i++)
170return InternalCreate(t, lengths.Length, pLengths, pLowerBounds);
178int[] intLengths = new int[lengths.Length];
180for (int i = 0; i < lengths.Length; ++i)
255if (t.GetArrayRank() != lengths.Length)
262for (int i = 0; i < lengths.Length; i++)
267return InternalCreateFromArrayType(t, lengths.Length, pLengths, null);
301if (lengths.Length != lowerBounds.Length)
311if (t.GetArrayRank() != lengths.Length)
321for (int i = 0; i < lengths.Length; i++)
327return InternalCreateFromArrayType(t, lengths.Length, pLengths, pLowerBounds);
773return Length;
786return Length - 1;
818if (Rank != indices.Length)
876if (Rank != indices.Length)
924if (Rank != indices.Length)
927int[] intIndices = new int[indices.Length];
929for (int i = 0; i < indices.Length; ++i)
984if (Rank != indices.Length)
987int[] intIndices = new int[indices.Length];
989for (int i = 0; i < indices.Length; ++i)
1016int ICollection.Count => Length;
1092if (o == null || this.Length != o.Length)
1100while (i < o.Length && c == 0)
1124if (other is not Array o || o.Length != this.Length)
1130while (i < o.Length)
1152for (int i = (this.Length >= 8 ? this.Length - 8 : 0); i < this.Length; i++)
1177return BinarySearch(array, array.GetLowerBound(0), array.Length, value, null);
1216return BinarySearch(array, array.GetLowerBound(0), array.Length, value, comparer);
1243if (array.Length - (index - lb) < length)
1380return BinarySearch(array, 0, array.Length, value, null);
1387return BinarySearch(array, 0, array.Length, value, comparer);
1404if (array.Length - index < length)
1422TOutput[] newArray = new TOutput[array.Length];
1423for (int i = 0; i < array.Length; i++)
1442Copy(this, GetLowerBound(0), array!, index, Length);
1480for (int i = 0; i < array.Length; i++)
1498if ((uint)startIndex > (uint)array.Length)
1503if ((uint)count > (uint)(array.Length - startIndex))
1534for (int i = 0; i < array.Length; i++)
1567values = new T[Math.Min((uint)span.Length * 2, (uint)array.Length)];
1576return values?.Length == foundCount ? values : span[..foundCount].ToArray();
1586return FindIndex(array, 0, array.Length, match);
1596return FindIndex(array, startIndex, array.Length - startIndex, match);
1606if (startIndex < 0 || startIndex > array.Length)
1611if (count < 0 || startIndex > array.Length - count)
1642for (int i = array.Length - 1; i >= 0; i--)
1659return FindLastIndex(array, array.Length - 1, array.Length, match);
1684if (array.Length == 0)
1695if (startIndex < 0 || startIndex >= array.Length)
1730for (int i = 0; i < array.Length; i++)
1744return IndexOf(array, value, array.GetLowerBound(0), array.Length);
1758return IndexOf(array, value, startIndex, array.Length - startIndex + lb);
1775if (startIndex < lb || startIndex > array.Length + lb)
1777if (count < 0 || count > array.Length - startIndex + lb)
1884return IndexOf(array, value, 0, array.Length);
1894return IndexOf(array, value, startIndex, array.Length - startIndex);
1904if ((uint)startIndex > (uint)array.Length)
1909if ((uint)count > (uint)(array.Length - startIndex))
1966return LastIndexOf(array, value, array.Length - 1 + lb, array.Length);
1993if (array.Length == 0)
1998if (startIndex < lb || startIndex >= array.Length + lb)
2107return LastIndexOf(array, value, array.Length - 1, array.Length);
2117return LastIndexOf(array, value, startIndex, (array.Length == 0) ? 0 : (startIndex + 1));
2127if (array.Length == 0)
2147if ((uint)startIndex >= (uint)array.Length)
2218Reverse(array, array.GetLowerBound(0), array.Length);
2237if (array.Length - (index - lowerBound) < length)
2296if (array.Length > 1)
2297SpanHelpers.Reverse(ref MemoryMarshal.GetArrayDataReference(array), (nuint)array.Length);
2308if (array.Length - index < length)
2325Sort(array, null, array.GetLowerBound(0), array.Length, null);
2338Sort(keys, items, keys.GetLowerBound(0), keys.Length, null);
2371Sort(array, null, array.GetLowerBound(0), array.Length, comparer);
2386Sort(keys, items, keys.GetLowerBound(0), keys.Length, comparer);
2422if (keys.Length - (index - keysLowerBound) < length || (items != null && (index - keysLowerBound) > items.Length - length))
2513if (array.Length > 1)
2515var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2524Sort(keys, items, 0, keys.Length, null);
2541Sort(array, 0, array.Length, comparer);
2548Sort(keys, items, 0, keys.Length, comparer);
2559if (array.Length - index < length)
2577if (keys.Length - index < length || (items != null && index > items.Length - length))
2606var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2622for (int i = 0; i < array.Length; i++)
2639/// <see cref="Length"/> property may return larger value than this property for multi-dimensional arrays.</para>
3073new Span<T>(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), array.Length).Slice(adjustedIndex, length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\ConfigurableArrayPool.cs (14)
43for (int i = 0; i < buckets.Length; i++)
70if (index < _buckets.Length)
84log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, _buckets[i].Id);
89while (++i < _buckets.Length && i != index + MaxBucketsToTry);
105log.BufferRented(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId);
106log.BufferAllocated(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId, index >= _buckets.Length ?
118if (array.Length == 0)
126int bucket = Utilities.SelectBucketIndex(array.Length);
129bool haveBucket = bucket < _buckets.Length;
149log.BufferReturned(bufferId, array.Length, Id);
152log.BufferDropped(bufferId, array.Length, Id, ArrayPoolEventSource.NoBucketId, ArrayPoolEventSource.BufferDroppedReason.OverMaximumSize);
196if (_index < buffers.Length)
234if (array.Length != _bufferLength)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (27)
61if (tlsBuckets is not null && (uint)bucketIndex < (uint)tlsBuckets.Length)
69log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
77if ((uint)bucketIndex < (uint)perCoreBuckets.Length)
87log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
120log.BufferRented(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId);
121log.BufferAllocated(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId, bucketIndex >= _buckets.Length ?
136int bucketIndex = Utilities.SelectBucketIndex(array.Length);
146if ((uint)bucketIndex < (uint)tlsBuckets.Length)
157if (array.Length != Utilities.GetMaxSizeForBucket(bucketIndex))
177if (log.IsEnabled() && array.Length != 0)
179log.BufferReturned(array.GetHashCode(), array.Length, Id);
182log.BufferDropped(array.GetHashCode(), array.Length, Id,
203for (int i = 0; i < perCoreBuckets.Length; i++)
228for (int i = 0; i < buckets.Length; i++)
232log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
253for (int i = 0; i < buckets.Length; i++)
274log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
333for (int i = 0; i < partitions.Length; i++)
351for (int i = 0; i < partitions.Length; i++)
354if (++index == partitions.Length) index = 0;
371for (int i = 0; i < partitions.Length; i++)
374if (++index == partitions.Length) index = 0;
382for (int i = 0; i < partitions.Length; i++)
405if ((uint)count < (uint)arrays.Length)
429if ((uint)count < (uint)arrays.Length)
488log.BufferTrimmed(array.GetHashCode(), array.Length, id);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\Concurrent\ConcurrentDictionary.cs (34)
187for (int i = 1; i < locks.Length; i++)
192var countPerLock = new int[locks.Length];
229_budget = buckets.Length / locks.Length;
352_budget = tables._buckets.Length / tables._locks.Length;
725var newTables = new Tables(new VolatileNode[HashHelpers.GetPrime(_initialCapacity)], tables._locks, new int[tables._countPerLock.Length], tables._comparer);
727_budget = Math.Max(1, newTables._buckets.Length / newTables._locks.Length);
763if (array.Length - count < index)
905if ((uint)i >= (uint)buckets.Length)
1876if (array.Length - count < index)
1958int newLength = tables._buckets.Length;
1973if (upgradeComparer is null && GetCountNoLocks() < tables._buckets.Length / 4)
1985if ((newLength = tables._buckets.Length * 2) < 0 ||
2002if (_growLockArray && tables._locks.Length < MaxLockNumber)
2004newLocks = new object[tables._locks.Length * 2];
2005Array.Copy(tables._locks, newLocks, tables._locks.Length);
2006for (int i = tables._locks.Length; i < newLocks.Length; i++)
2013var newCountPerLock = new int[newLocks.Length];
2042_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
2066Debug.Assert(locksAcquired == _tables._locks.Length);
2099for (int i = 1; i < locks.Length; i++)
2105Debug.Assert(locksAcquired == locks.Length);
2229return buckets[HashHelpers.FastMod((uint)hashcode, (uint)buckets.Length, tables._fastModBucketsMultiplier)]._node;
2233return buckets[(uint)hashcode % (uint)buckets.Length]._node;
2246bucketNo = HashHelpers.FastMod((uint)hashcode, (uint)buckets.Length, tables._fastModBucketsMultiplier);
2250bucketNo = (uint)hashcode % (uint)buckets.Length;
2252lockNo = bucketNo % (uint)tables._locks.Length; // doesn't use FastMod, as it would require maintaining a different multiplier
2281_fastModBucketsMultiplier = HashHelpers.GetFastModMultiplier((uint)buckets.Length);
2715var items = new DebugViewDictionaryItem<TKey, TValue>[keyValuePairs.Length];
2716for (int i = 0; i < items.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Queue.cs (27)
52if (_size != _array.Length) _tail = _size;
60public int Capacity => _array.Length;
80Array.Clear(_array, _head, _array.Length - _head);
99if (arrayIndex < 0 || arrayIndex > array.Length)
104if (array.Length - arrayIndex < _size)
112int firstPart = Math.Min(_array.Length - _head, numToCopy);
117Array.Copy(_array, 0, array, arrayIndex + _array.Length - _head, numToCopy);
135int arrayLen = array.Length;
151int firstPart = (_array.Length - _head < numToCopy) ? _array.Length - _head : numToCopy;
157Array.Copy(_array, 0, array, index + _array.Length - _head, numToCopy);
169if (_size == _array.Length)
278Array.IndexOf(_array, item, _head, _array.Length - _head) >= 0 ||
301Array.Copy(_array, _head, arr, 0, _array.Length - _head);
302Array.Copy(_array, 0, arr, _array.Length - _head, _tail);
322Array.Copy(_array, _head, newarray, 0, _array.Length - _head);
323Array.Copy(_array, 0, newarray, _array.Length - _head, _tail);
340if (tmp == _array.Length)
355int threshold = (int)(_array.Length * 0.9);
372if (capacity == _array.Length)
387if (_array.Length < capacity)
392return _array.Length;
397Debug.Assert(_array.Length < capacity);
402int newcapacity = GrowFactor * _array.Length;
409newcapacity = Math.Max(newcapacity, _array.Length + MinimumGrow);
460if ((uint)index < (uint)array.Length)
470index -= array.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\Hashtable.cs (39)
430for (int i = 0; i < _buckets.Length; i++)
454int bucket = lbuckets.Length;
483uint hashcode = InitHash(key, lbuckets.Length, out uint seed, out uint incr);
487int bucketNumber = (int)(seed % (uint)lbuckets.Length);
498bucketNumber = (int)(((long)bucketNumber + incr) % (uint)lbuckets.Length);
499} while (b.hash_coll < 0 && ++ntry < lbuckets.Length);
513for (int i = _buckets.Length; --i >= 0;)
521for (int i = _buckets.Length; --i >= 0;)
540for (int i = lbuckets.Length; --i >= 0;)
559for (int i = lbuckets.Length; --i >= 0;)
579if (array.Length - arrayIndex < Count)
590for (int i = lbuckets.Length; --i >= 0;)
611for (int i = lbuckets.Length; --i >= 0;)
632uint hashcode = InitHash(key, lbuckets.Length, out uint seed, out uint incr);
636int bucketNumber = (int)(seed % (uint)lbuckets.Length);
677bucketNumber = (int)(((long)bucketNumber + incr) % (uint)lbuckets.Length);
678} while (b.hash_coll < 0 && ++ntry < lbuckets.Length);
694int rawsize = HashHelpers.ExpandPrime(_buckets.Length);
701rehash(_buckets.Length);
726for (nb = 0; nb < _buckets.Length; nb++)
845uint hashcode = InitHash(key, _buckets.Length, out uint seed, out uint incr);
849int bucketNumber = (int)(seed % (uint)_buckets.Length);
912bucketNumber = (int)(((long)bucketNumber + incr) % (uint)_buckets.Length);
913} while (++ntry < _buckets.Length);
943uint incr = unchecked((uint)(1 + ((seed * HashHelpers.HashPrime) % ((uint)newBuckets.Length - 1))));
944int bucketNumber = (int)(seed % (uint)newBuckets.Length);
960bucketNumber = (int)(((long)bucketNumber + incr) % (uint)newBuckets.Length);
975uint hashcode = InitHash(key, _buckets.Length, out uint seed, out uint incr);
979int bn = (int)(seed % (uint)_buckets.Length); // bucketNumber
1003bn = (int)(((long)bn + incr) % (uint)_buckets.Length);
1004} while (b.hash_coll < 0 && ++ntry < _buckets.Length);
1065info.AddValue(HashSizeName, _buckets.Length); // This is the length of the bucket array.
1160if (serKeys.Length != serValues.Length)
1164for (int i = 0; i < serKeys.Length; i++)
1196if (array.Length - arrayIndex < _hashtable._count)
1231if (array.Length - arrayIndex < _hashtable._count)
1411_bucket = hashtable._buckets.Length;
1490_bucket = _hashtable._buckets.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\DefaultBinder.cs (60)
37if (match == null || match.Length == 0)
53int[][] paramOrder = new int[candidates.Length][];
55for (i = 0; i < candidates.Length; i++)
60paramOrder[i] = new int[(par.Length > args.Length) ? par.Length : args.Length];
78Type[] paramArrayTypes = new Type[candidates.Length];
80Type[] argTypes = new Type[args.Length];
85for (i = 0; i < args.Length; i++)
101for (i = 0; i < candidates.Length; i++)
115if (args.Length != 0)
128else if (par.Length > args.Length)
133for (j = args.Length; j < par.Length - 1; j++)
154else if (par.Length < args.Length)
189int argsToCheck = (paramArrayType != null) ? par.Length - 1 : args.Length;
202if (index < args.Length)
257for (; j < args.Length; j++)
285if (j == args.Length)
305state = new BinderState((int[])paramOrder[0].Clone(), args.Length, paramArrayTypes[0] != null);
313if (parms.Length == args.Length)
325else if (parms.Length > args.Length)
332if (k < args.Length)
358objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[0], args.Length - paramArrayPos);
359Array.Copy(args, paramArrayPos, (Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
396state = new BinderState((int[])paramOrder[currentMin].Clone(), args.Length, paramArrayTypes[currentMin] != null);
403if (parameters.Length == args.Length)
415else if (parameters.Length > args.Length)
419for (i = 0; i < args.Length; i++)
443objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[currentMin], args.Length - paramArrayPos);
444Array.Copy(args, paramArrayPos, (Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
471for (i = 0; i < candidates.Length; i++)
547Type[] realTypes = new Type[types.Length];
548for (i = 0; i < types.Length; i++)
557if (match == null || match.Length == 0)
565for (i = 0; i < candidates.Length; i++)
568if (par.Length != types.Length)
570for (j = 0; j < types.Length; j++)
600if (j == types.Length)
611int[] paramOrder = new int[types.Length];
612for (i = 0; i < types.Length; i++)
647if (match == null || match.Length == 0)
656int indexesLength = (indexes != null) ? indexes.Length : 0;
657for (i = 0; i < candidates.Length; i++)
662if (par.Length != indexesLength)
763int paramArrayPos = args.Length - 1;
764if (args.Length == binderState._originalSize)
771object[] newArgs = new object[args.Length];
773for (int i = paramArrayPos, j = 0; i < newArgs.Length; i++, j++)
782if (args.Length > binderState._originalSize)
797MethodBase[] aExactMatches = new MethodBase[match.Length];
800for (int i = 0; i < match.Length; i++)
808for (j = 0; j < types.Length; j++)
816if (j < types.Length)
840int typesLength = (types != null) ? types.Length : 0;
841for (int i = 0; i < match.Length; i++)
879for (int i = 0; i < types.Length; i++)
1164object?[] varsCopy = new object[vars.Length];
1165for (int i = 0; i < vars.Length; i++)
1170for (int i = 0, j = 0; i < vars.Length; j++)
1172if (paramOrder[j] < vars.Length)
1194for (int i = 0; i < names.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeMetadataGenerator.cs (10)
24EventParameterInfo[] eventParams = new EventParameterInfo[parameters.Length];
25for (int i = 0; i < parameters.Length; i++)
52EventParameterInfo[] eventParams = new EventParameterInfo[typeInfos.Length];
53for (int i = 0; i < typeInfos.Length; i++)
92if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(EmptyStruct)))
167WriteToBuffer(pMetadata, totalMetadataLength, ref offset, (uint)parameters.Length);
196WriteToBuffer(pMetadata, totalMetadataLength, ref offset, (uint)parameters.Length);
277EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (uint)properties.Length);
330EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (uint)properties.Length);
423EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (uint)properties.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (39)
446return (manifestBytes == null) ? null : Encoding.UTF8.GetString(manifestBytes, 0, manifestBytes.Length);
526for (int i = 0; i < m_traits.Length - 1; i += 2)
784uint metadataLength = (metadata != null) ? (uint)metadata.Length : 0;
1116if (arg1 == null || arg1.Length == 0)
1129int blobSize = arg1.Length;
1154if (arg2 == null || arg2.Length == 0)
1167int blobSize = arg2.Length;
1453var argValues = new object?[args.Length];
1454for (int i = 0; i < args.Length; i++)
1658if (m_traits != null && m_traits.Length % 2 != 0)
1792for (int i = 0; i < decodedObjects.Length; i++, data++)
1942Marshal.Copy(data->DataPointer, blob, 0, blob.Length);
2106int paramCount = Math.Min(eventTypes.typeInfos.Length, args.Length); // parameter count mismatch get logged in LogEventArgsMismatches
2107var eventData = new object?[eventTypes.typeInfos.Length];
2127if (args.Length != infos.Length)
2129ReportOutOfBandMessage(SR.Format(SR.EventSource_EventParametersMismatch, eventId, args.Length, infos.Length));
2133for (int i = 0; i < args.Length; i++)
2158ReportOutOfBandMessage(SR.Format(SR.EventSource_EventParametersMismatch, eventCallbackArgs.EventId, eventDataCount, metadata.Parameters.Length));
2168args = new object?[Math.Min(eventDataCount, metadata.Parameters.Length)];
2172for (int i = 0; i < args.Length; i++, data++)
2181for (int i = 0; i < args.Length; i++, data++)
2302uint metadataLength = (metadata != null) ? (uint)metadata.Length : 0;
2404if (eventChannel != EventChannel.None && this.m_channelData != null && this.m_channelData.Length > (int)eventChannel)
2564var names = new string[parameters.Length];
2565for (int i = 0; i < names.Length; i++)
2584var types = new Type[parameters.Length];
2585for (int i = 0; i < types.Length; i++)
2955int dataLeft = rawManifest.Length;
3139for (int i = 0; i < methods.Length; i++)
3264for (int fieldIdx = 0; fieldIdx < args.Length; fieldIdx++)
3315bNeedsManifest = (flags & EventManifestOptions.OnlyIfNeededForRegistration) == 0 || manifest.GetChannelData().Length > 0;
3322res = (res.Length > 0) ? res : null;
3476if (args.Length > 0 && args[0].ParameterType == typeof(Guid) &&
3479var newargs = new ParameterInfo[args.Length - 1];
3480Array.Copy(args, 1, newargs, 0, args.Length - 1);
3549int eventListenerParameterCount = eventParameters.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs (11)
442descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1);
443descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1);
455for (int i = 0; i < eventTypes.typeInfos.Length; i++)
537int descriptorsLength = eventTypes.dataCount + eventTypes.typeInfos.Length * 2 + 3;
549descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1);
550descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1);
553for (int i = 0; i < eventTypes.typeInfos.Length; i++)
620descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1);
621descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1);
746for (int i = 0; i < m_traits.Length - 1; i += 2)
773int startPos = providerMetadata.Length - traitMetaData.Count;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfo.cs (65)
166Debug.Assert(abbreviatedDayNames.Length == 7, "[DateTimeFormatInfo.GetAbbreviatedDayOfWeekNames] Expected 7 day names in a week");
180Debug.Assert(m_superShortDayNames.Length == 7, "[DateTimeFormatInfo.InternalGetSuperShortDayNames] Expected 7 day names in a week");
194Debug.Assert(dayNames.Length == 7, "[DateTimeFormatInfo.GetDayOfWeekNames] Expected 7 day names in a week");
208Debug.Assert(abbreviatedMonthNames.Length == 12 || abbreviatedMonthNames.Length == 13,
223Debug.Assert(monthNames.Length == 12 || monthNames.Length == 13,
266Debug.Assert(allLongTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long time patterns");
269Debug.Assert(allShortTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short time patterns");
272Debug.Assert(allLongDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long date patterns");
275Debug.Assert(allShortDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short date patterns");
278Debug.Assert(allYearMonthPatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some year month patterns");
391for (int i = 0; i < OptionalCalendars.Length; i++)
487for (int i = 0; i < EraNames.Length; i++)
498for (int i = 0; i < AbbreviatedEraNames.Length; i++)
506for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++)
535if ((uint)era >= names.Length)
550if (AbbreviatedEraNames.Length == 0)
564if ((uint)era >= (uint)names.Length)
1043Debug.Assert(values.Length >= length);
1063if (value.Length != 7)
1068CheckNullValue(value, value.Length);
1088if (value.Length != 7)
1093CheckNullValue(value, value.Length);
1108if (value.Length != 7)
1113CheckNullValue(value, value.Length);
1130if (value.Length != 13)
1135CheckNullValue(value, value.Length - 1);
1151if (value.Length != 13)
1156CheckNullValue(value, value.Length - 1);
1182if ((uint)month >= (uint)monthNamesArray.Length)
1184ThrowHelper.ThrowArgumentOutOfRange_Range(nameof(month), month + 1, 1, monthNamesArray.Length);
1201Debug.Assert(m_genitiveAbbreviatedMonthNames.Length == 13,
1211Debug.Assert(genitiveMonthNames.Length == 13,
1229Debug.Assert(leapYearMonthNames.Length == 13,
1240if ((uint)dow >= (uint)names.Length)
1255if ((uint)dow >= (uint)names.Length)
1272string[] result = new string[patterns1.Length * patterns2.Length];
1276for (int i = 0; i < patterns1.Length; i++)
1278for (int j = 0; j < patterns2.Length; j++)
1328if ((uint)dow >= (uint)names.Length)
1340if ((uint)month >= (uint)names.Length)
1352if ((uint)month >= (uint)names.Length)
1371Debug.Assert(patterns != null && patterns.Length > 0,
1384for (i = 0; i < patterns.Length; i++)
1395if (i < patterns.Length)
1407newPatterns = new string[patterns.Length + 1];
1410Array.Copy(patterns, 0, newPatterns, 1, patterns.Length);
1451Debug.Assert(allYearMonthPatterns.Length > 0,
1472Debug.Assert(allShortDatePatterns.Length > 0,
1493Debug.Assert(allLongDatePatterns.Length > 0,
1513Debug.Assert(allShortTimePatterns.Length > 0,
1533Debug.Assert(allLongTimePatterns.Length > 0,
1595if (patterns.Length == 0)
1600for (int i = 0; i < patterns.Length; i++)
1657if (value.Length != 13)
1662CheckNullValue(value, value.Length - 1);
1678if (value.Length != 13)
1683CheckNullValue(value, value.Length - 1);
2019for (int i = 0; i < dateWords.Length; i++)
2098for (int i = 1; i <= eras.Length; i++)
2119for (int i = 1; i <= jaDtfi.Calendar.Eras.Length; i++)
2132for (int i = 1; i <= twDtfi.Calendar.Eras.Length; i++)
2167for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (16)
355if (buffer.Length - index < count)
434if (buffer.Length - index < count)
466_ = byteBuffer.Length; // allow JIT to prove object is not null
527int newMaxCharsPerBuffer = _encoding.GetMaxCharCount(byteBuffer.Length);
600int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
614_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
627_isBlocked = (_byteLen < _byteBuffer.Length);
704int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
718_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
731_isBlocked = (_byteLen < _byteBuffer.Length);
965else if ((arrayPoolBuffer.Length - arrayPoolBufferPos) < (charLen - charPos))
1056if (buffer.Length - index < count)
1143int len = await tmpStream.ReadAsync(new Memory<byte>(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos), cancellationToken).ConfigureAwait(false);
1193_isBlocked = (_byteLen < tmpByteBuffer.Length);
1267if (buffer.Length - index < count)
1365_isBlocked = (_byteLen < tmpByteBuffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodBuilder.cs (1)
26if (names.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (8)
176return Convert(srcEncoding, dstEncoding, bytes, 0, bytes.Length);
529return GetByteCount(chars, 0, chars.Length);
540return GetByteCount(chars, 0, chars.Length);
596return GetBytes(chars, 0, chars.Length);
761return GetCharCount(bytes, 0, bytes.Length);
798return GetChars(bytes, 0, bytes.Length);
1002return GetString(bytes, 0, bytes.Length);
1383_bytes -= byteBuffer.Length; // Didn't use how many ever bytes we're falling back
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (20)
69if (chars.Length - index < count)
210if (chars.Length - charIndex < charCount)
215if ((uint)byteIndex > bytes.Length)
223return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
277if ((uint)byteIndex > bytes.Length)
285return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
356return bytes.Length;
371if (bytes.Length - index < count)
437if (bytes.Length == 0)
444char[] chars = new char[bytes.Length];
449GetCharsCommon(pBytes, bytes.Length, pChars, chars.Length);
471if (bytes.Length - byteIndex < byteCount)
476if ((uint)charIndex > (uint)chars.Length)
484return GetCharsCommon(pBytes + byteIndex, byteCount, pChars + charIndex, chars.Length - charIndex);
504if (bytes.Length - index < count)
516GetCharsCommon(pBytes + index, count, pChars, chars.Length);
557string result = string.FastAllocateString(bytes.Length);
561GetCharsCommon(pBytes, bytes.Length, pChars, result.Length);
582if (bytes.Length - index < count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (25)
240Debug.Assert(m_ChunkOffset + m_ChunkChars.Length >= m_ChunkOffset, "The length of the string is greater than int.MaxValue.");
250Debug.Assert(currentBlock.m_ChunkLength <= currentBlock.m_ChunkChars.Length);
268get => m_ChunkChars.Length + m_ChunkOffset;
336if ((uint)(chunkLength + chunkOffset) > (uint)result.Length || (uint)chunkLength > (uint)sourceArray.Length)
457int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length));
459if (newLen > chunk.m_ChunkChars.Length)
471Debug.Assert(newLen == chunk.m_ChunkChars.Length, "The new chunk should be larger or equal to the one it is replacing.");
665if (_chunks.Length <= pos)
716if (((nuint)(uint)chunkLength + (nuint)(uint)repeatCount) <= (nuint)(uint)chunkChars.Length)
744int firstLength = chunkChars.Length - chunkLength;
748m_ChunkLength = chunkChars.Length;
781if (charCount > value.Length - startIndex)
893int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
897Debug.Assert(m_ChunkLength == 0 && m_ChunkChars.Length >= count);
924if (destinationIndex > destination.Length - count)
1056if ((uint)chars.Length > (uint)nextCharIndex)
1150Append(ref MemoryMarshal.GetArrayDataReference(value), value.Length);
1416Insert(index, ref MemoryMarshal.GetArrayDataReference(value), value.Length);
1440if (startIndex > value.Length - charCount)
2382if (((uint)chunkLength + (uint)valueCount) <= (uint)chunkChars.Length)
2418int firstLength = m_ChunkChars.Length - m_ChunkLength;
2422m_ChunkLength = m_ChunkChars.Length;
2499Debug.Assert(gapStart < sourceChunk.m_ChunkChars.Length, "gap starts at end of buffer. Should not happen");
2630get => new Span<char>(m_ChunkChars, m_ChunkLength, m_ChunkChars.Length - m_ChunkLength);
2765if (!doNotMoveFollowingChars && chunk.m_ChunkLength <= DefaultCapacity * 2 && chunk.m_ChunkChars.Length - chunk.m_ChunkLength >= count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (13)
48var newQueues = new WorkStealingQueue[oldQueues.Length + 1];
49Array.Copy(oldQueues, newQueues, oldQueues.Length);
64if (oldQueues.Length == 0)
76var newQueues = new WorkStealingQueue[oldQueues.Length - 1];
79Array.Copy(oldQueues, 1, newQueues, 0, newQueues.Length);
81else if (pos == oldQueues.Length - 1)
83Array.Copy(oldQueues, newQueues, newQueues.Length);
88Array.Copy(oldQueues, pos + 1, newQueues, pos, newQueues.Length - pos);
152var newArray = new object?[m_array.Length << 1];
153for (int i = 0; i < m_array.Length; i++)
475queueIndex = _assignedWorkItemQueueThreadCounts.Length - 1;
774int c = queues.Length;
1772for (int i = 0; i < items.Length; i++)
System\Array.NativeAot.cs (6)
229for (int i = 0; i < arrayOfArrays.Length; i++)
527int length = @this.Length;
535return Unsafe.As<T[]>(this).Length;
566return Array.IndexOf(@this, item, 0, @this.Length) >= 0;
572Array.Copy(@this, 0, array, arrayIndex, @this.Length);
611return Array.IndexOf(@this, item, 0, @this.Length);
System\Exception.NativeAot.cs (8)
51Array.Copy(_corDbgStackTrace, ips, ips.Length);
67if (_idxFirstFreeStackTraceEntry >= _corDbgStackTrace.Length)
75IntPtr[] newArray = new IntPtr[_corDbgStackTrace.Length * 2];
76for (int i = 0; i < _corDbgStackTrace.Length; i++)
157IntPtr[] newStackTrace = new IntPtr[stackTrace.Length];
158Array.Copy(stackTrace, 0, newStackTrace, 0, stackTrace.Length);
170IntPtr[] newStackTrace = new IntPtr[stackTrace.Length + 1];
171Array.Copy(stackTrace, 0, newStackTrace, 0, stackTrace.Length);
System.Private.CoreLib.Generators (31)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (28)
254int arrayLen = decomposedLeft.Length + decomposedRight.Length;
258var retVal = new INamedTypeSymbol[decomposedLeft.Length + decomposedRight.Length];
259Array.Copy(decomposedLeft, retVal, decomposedLeft.Length);
260Array.Copy(decomposedRight, 0, retVal, decomposedLeft.Length, decomposedRight.Length);
325if (decomposedLeft.Length == 0)
327else if (decomposedRight.Length == 0)
330if ((decomposedLeft.Length > 1) || (decomposedRight.Length > 1))
339if (decomposedLeft.Length == 0 || decomposedRight.Length == 0)
341if (decomposedLeft.Length != 0 || decomposedRight.Length != 0)
347var retVal = new INamedTypeSymbol[decomposedLeft.Length + decomposedRight.Length][];
348Array.Copy(decomposedLeft, retVal, decomposedLeft.Length);
349Array.Copy(decomposedRight, 0, retVal, decomposedLeft.Length, decomposedRight.Length);
354if (decomposedLeft.Length != 0 || decomposedRight.Length != 0)
364if (decomposedOperand.Length != 0)
371if (decomposedTrue.Length != 0 || decomposedFalse.Length != 0)
602if (decomposedCondition.Length == 0)
621for (int andClauseIndex = 0; andClauseIndex < decomposedCondition.Length; andClauseIndex++)
670if (decomposedCondition.Length == 1)
System.Private.DataContractSerialization (460)
System\Runtime\Serialization\Json\XmlJsonReader.cs (18)
721if (offset > buffer.Length)
723throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
726if (count > buffer.Length - offset)
728throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
743if (offset > chars.Length)
745throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
748if (count > chars.Length - offset)
750throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
780if (offset > buffer.Length)
782throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.JsonOffsetExceedsBufferSize, buffer.Length));
785if (count > buffer.Length - offset)
787throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.JsonSizeExceedsRemainingBufferSpace, buffer.Length - offset));
821if (offset > array.Length)
823throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
826if (count > array.Length - offset)
828throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
1011else if (_scopes.Length == _scopeDepth)
1493if ((_scopes != null) && (_scopes.Length > JsonGlobals.maxScopeSize))
System\Runtime\Serialization\XmlWriterDelegator.cs (15)
564writer.WriteBase64(bytes, 0, bytes.Length);
712for (int i = 0; i < value.Length; i++)
719dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
727for (int i = 0; i < value.Length; i++)
734dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
742for (int i = 0; i < value.Length; i++)
749dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
757for (int i = 0; i < value.Length; i++)
764dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
772for (int i = 0; i < value.Length; i++)
779dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
787for (int i = 0; i < value.Length; i++)
794dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
802for (int i = 0; i < value.Length; i++)
809dictionaryWriter.WriteArray(null, itemName, itemNamespace, value, 0, value.Length);
System\Text\Base64Encoding.cs (32)
54if (index > chars.Length)
55throw new ArgumentOutOfRangeException(nameof(index), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
57if (count > chars.Length - index)
58throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - index));
105if (charIndex > chars.Length)
106throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
109if (charCount > chars.Length - charIndex)
110throw new ArgumentOutOfRangeException(nameof(charCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - charIndex));
114if (byteIndex > bytes.Length)
115throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
130byte* pbMax = _bytes + bytes.Length - byteIndex;
178if (charIndex > chars.Length)
179throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
182if (charCount > chars.Length - charIndex)
183throw new ArgumentOutOfRangeException(nameof(charCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - charIndex));
187if (byteIndex > bytes.Length)
188throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
203byte* pbMax = _bytes + bytes.Length - byteIndex;
261if (byteIndex > bytes.Length)
262throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
264if (byteCount > bytes.Length - byteIndex)
265throw new ArgumentOutOfRangeException(nameof(byteCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex));
270if (charIndex > chars.Length)
271throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
272if (charCount < 0 || charCount > chars.Length - charIndex)
345if (byteIndex > bytes.Length)
346throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
348if (byteCount > bytes.Length - byteIndex)
349throw new ArgumentOutOfRangeException(nameof(byteCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex));
354if (charIndex > chars.Length)
355throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
357if (charCount < 0 || charCount > chars.Length - charIndex)
System\Text\BinHexEncoding.cs (14)
28if (charIndex > chars.Length)
29throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
31if (charCount > chars.Length - charIndex)
32throw new ArgumentOutOfRangeException(nameof(charCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - charIndex));
35if (byteIndex > bytes.Length)
36throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
38if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
67if (byteIndex > bytes.Length)
68throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.Format(SR.OffsetExceedsBufferSize, bytes.Length));
70if (byteCount > bytes.Length - byteIndex)
71throw new ArgumentOutOfRangeException(nameof(byteCount), SR.Format(SR.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex));
75if (charIndex > chars.Length)
76throw new ArgumentOutOfRangeException(nameof(charIndex), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
77if (charCount < 0 || charCount > chars.Length - charIndex)
System\Xml\ArrayHelper.cs (7)
34while (read < array.Length)
36int actual = ReadArray(reader, localName, namespaceUri, array, read, array.Length - read);
44if (read < array.Length || reader.NodeType == XmlNodeType.EndElement)
50if (totalRead != array.Length || arrayCount > 0)
56Array.Copy(arrays![i], 0, newArray, offset, arrays[i].Length);
57offset += arrays[i].Length;
75int actual = ReadArray(reader, localName, namespaceUri, array, 0, array.Length);
System\Xml\EncodingStreamWrapper.cs (9)
388if (encCount == s_encodingUTF8.Length && CompareCaseInsensitive(s_encodingUTF8, buffer, encStart))
392else if (encCount == s_encodingUnicodeLE.Length && CompareCaseInsensitive(s_encodingUnicodeLE, buffer, encStart))
396else if (encCount == s_encodingUnicodeBE.Length && CompareCaseInsensitive(s_encodingUnicodeBE, buffer, encStart))
400else if (encCount == s_encodingUnicode.Length && CompareCaseInsensitive(s_encodingUnicode, buffer, encStart))
403ThrowEncodingMismatch(DataContractSerializer.UTF8NoBom.GetString(buffer, encStart, encCount), DataContractSerializer.UTF8NoBom.GetString(s_encodingUTF8, 0, s_encodingUTF8.Length));
416for (int i = 0; i < key.Length; i++)
601_byteCount = _stream.Read(_bytes, _byteCount, (_chars.Length - 1) * 2);
700int size = _chars.Length < count ? _chars.Length : count;
System\Xml\UniqueId.cs (13)
71if (offset > guid.Length)
72throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, guid.Length));
73if (guidLength > guid.Length - offset)
99if (offset > chars.Length)
100throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
102if (count > chars.Length - offset)
103throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
205if (offset > chars.Length)
206throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
208if (count > chars.Length - offset)
285if (offset > buffer.Length)
286throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
288if (guidLength > buffer.Length - offset)
System\Xml\XmlBaseReader.cs (37)
272else if (_elementNodes.Length == _depth)
306else if (_attributeNodes.Length == attributeIndex)
466if (_attributeNodes != null && _attributeNodes.Length > 16)
468if (_elementNodes != null && _elementNodes.Length > 16)
1055for (int i = 0; i < localNames.Length; i++)
1070for (int i = 0; i < localNames.Length; i++)
1096for (int i = 0; i < localNames.Length; i++)
1111for (int i = 0; i < localNames.Length; i++)
1131if (offset > chars.Length)
1132throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
1134if (count > chars.Length - offset)
1135throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
1159if (offset > buffer.Length)
1160throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
1162if (count > buffer.Length - offset)
1163throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1304if (value.Length > _quotas.MaxArrayLength)
1312return ReadContentAsBase64(_quotas.MaxArrayLength, _bufferReader.Buffer.Length);
1347if (offset > buffer.Length)
1348throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
1350if (count > buffer.Length - offset)
1351throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1383if (offset > buffer.Length)
1384throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
1386if (count > buffer.Length - offset)
1387throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1900if (_chars == null || _chars.Length < count)
2625if (_indices != null && _indices.Length > 32)
2635if (_indices != null && _indices.Length == _attributeCount && IsSorted())
2639for (int i = 0; i < newIndices.Length; i++)
2648for (int i = 0; i < _indices!.Length - 1; i++)
2725if (_namespaces != null && _namespaces.Length > 32)
2727if (_attributes != null && _attributes.Length > 4)
2741nameSpace.Uri.SetValue(3, xmlBuffer.Length - 3);
2776for (int i = 0; i < _shortPrefixUri.Length; i++)
2863else if (_attributes.Length == _attributeCount)
2901else if (_namespaces.Length == _nsCount)
System\Xml\XmlBinaryReader.cs (9)
49if (offset > buffer.Length)
50throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length));
52if (count > buffer.Length - offset)
53throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset));
1026BufferReader.InsertBytes(buffer, 0, buffer.Length);
1230if (offset > array.Length)
1231throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
1233if (count > array.Length - offset)
1234throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
System\Xml\XmlBinaryWriter.cs (8)
109Debug.Assert(offset >= 0 && offset + 1 + sizeof(T) <= buffer.Length, "WriteTextNodeRaw");
124Debug.Assert(offset >= 0 && offset + sizeof(T) <= buffer.Length, "WriteRaw");
1185while ((count = reader.ReadValueChunk(_chars, 0, _chars.Length)) > 0)
1207while ((count = reader.ReadValueAsBase64(_bytes, 0, _bytes.Length)) > 0)
1280if (offset > array.Length)
1281throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
1283if (count > array.Length - offset)
1284throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
System\Xml\XmlCanonicalWriter.cs (50)
93_inclusivePrefixes = new string[inclusivePrefixes.Length];
94for (int i = 0; i < inclusivePrefixes.Length; ++i)
118if (_scopes != null && _scopes.Length > 16)
120if (_attributes != null && _attributes.Length > 16)
122if (_xmlnsBuffer != null && _xmlnsBuffer.Length > 1024)
153else if (_depth == _scopes.Length)
209if (prefixOffset > prefixBuffer.Length)
210throw new ArgumentOutOfRangeException(nameof(prefixOffset), SR.Format(SR.OffsetExceedsBufferSize, prefixBuffer.Length));
212if (prefixLength > prefixBuffer.Length - prefixOffset)
213throw new ArgumentOutOfRangeException(nameof(prefixLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, prefixBuffer.Length - prefixOffset));
217if (localNameOffset > localNameBuffer.Length)
218throw new ArgumentOutOfRangeException(nameof(localNameOffset), SR.Format(SR.OffsetExceedsBufferSize, localNameBuffer.Length));
220if (localNameLength > localNameBuffer.Length - localNameOffset)
221throw new ArgumentOutOfRangeException(nameof(localNameLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, localNameBuffer.Length - localNameOffset));
250for (int i = 0; i < _inclusivePrefixes!.Length; ++i)
348else if (_xmlnsOffset + byteCount > _xmlnsBuffer.Length)
350byte[] newBuffer = new byte[Math.Max(_xmlnsOffset + byteCount, _xmlnsBuffer.Length * 2)];
385if (prefixOffset > prefixBuffer.Length)
386throw new ArgumentOutOfRangeException(nameof(prefixOffset), SR.Format(SR.OffsetExceedsBufferSize, prefixBuffer.Length));
388if (prefixLength > prefixBuffer.Length - prefixOffset)
389throw new ArgumentOutOfRangeException(nameof(prefixLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, prefixBuffer.Length - prefixOffset));
393if (nsOffset > nsBuffer.Length)
394throw new ArgumentOutOfRangeException(nameof(nsOffset), SR.Format(SR.OffsetExceedsBufferSize, nsBuffer.Length));
396if (nsLength > nsBuffer.Length - nsOffset)
397throw new ArgumentOutOfRangeException(nameof(nsLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, nsBuffer.Length - nsOffset));
436if (prefixOffset > prefixBuffer.Length)
437throw new ArgumentOutOfRangeException(nameof(prefixOffset), SR.Format(SR.OffsetExceedsBufferSize, prefixBuffer.Length));
439if (prefixLength > prefixBuffer.Length - prefixOffset)
440throw new ArgumentOutOfRangeException(nameof(prefixLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, prefixBuffer.Length - prefixOffset));
444if (localNameOffset > localNameBuffer.Length)
445throw new ArgumentOutOfRangeException(nameof(localNameOffset), SR.Format(SR.OffsetExceedsBufferSize, localNameBuffer.Length));
447if (localNameLength > localNameBuffer.Length - localNameOffset)
448throw new ArgumentOutOfRangeException(nameof(localNameLength), SR.Format(SR.SizeExceedsRemainingBufferSpace, localNameBuffer.Length - localNameOffset));
507if (offset > chars.Length)
508throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
510if (count > chars.Length - offset)
511throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
562if (offset > chars.Length)
563throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
565if (count > chars.Length - offset)
566throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
599if (offset > chars.Length)
600throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, chars.Length));
602if (count > chars.Length - offset)
603throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, chars.Length - offset));
663else if (_attributeCount == _attributes.Length)
681else if (_xmlnsAttributes.Length == _xmlnsAttributeCount)
877for (int i = 0; i < indices.Length; i++)
884Attribute[] attributes = new Attribute[_writer._attributes!.Length];
885for (int i = 0; i < indices.Length; i++)
System\Xml\XmlDictionaryReader.cs (20)
33return CreateBinaryReader(buffer, 0, buffer.Length, quotas);
92return CreateTextReader(buffer, 0, buffer.Length, quotas);
297for (int i = 0; i < localNames.Length; i++)
320for (int i = 0; i < localNames.Length; i++)
517while (read < buffer.Length)
521actual = ReadContentAsBase64(buffer, read, buffer.Length - read);
523actual = ReadContentAsBinHex(buffer, read, buffer.Length - read);
531if (read < buffer.Length)
539Buffer.BlockCopy(buffers[i], 0, buffer, offset, buffers[i].Length);
540offset += buffers[i].Length;
593Guid[] guids = new Guid[values.Length];
594for (int i = 0; i < values.Length; i++)
601UniqueId[] uniqueIds = new UniqueId[values.Length];
602for (int i = 0; i < values.Length; i++)
615for (int i = 0; i < strings.Length; i++)
635for (int i = 0; i < strings.Length; i++)
1010if (offset > array.Length)
1011throw new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, array.Length));
1013if (count > array.Length - offset)
1014throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, array.Length - offset));
System.Private.Reflection.Execution (36)
System.Private.StackTraceMetadata (1)
System.Private.TypeLoader (102)
System.Private.Windows.Core (39)
Windows\Win32\System\Variant\VARIANT.cs (19)
292new Span<sbyte>(psa->pvData, array.Length)
296new Span<byte>(psa->pvData, array.Length)
300new Span<short>(psa->pvData, array.Length)
304new Span<ushort>(psa->pvData, array.Length)
309new Span<int>(psa->pvData, array.Length)
315new Span<uint>(psa->pvData, array.Length)
319new Span<long>(psa->pvData, array.Length)
323new Span<ulong>(psa->pvData, array.Length)
327new Span<float>(psa->pvData, array.Length)
331new Span<double>(psa->pvData, array.Length)
336Span<VARIANT_BOOL> data = new(psa->pvData, array.Length);
348Span<DECIMAL> data = new(psa->pvData, array.Length);
360Span<long> data = new(psa->pvData, array.Length);
372Span<double> data = new(psa->pvData, array.Length);
384Span<IntPtr> data = new(psa->pvData, array.Length);
397Span<IntPtr> data = new(psa->pvData, array.Length);
409Span<VARIANT> data = new(psa->pvData, array.Length);
423else if (array.Length != 0)
876=> MemoryMarshal.CreateSpan(ref Unsafe.AsRef<T>(Marshal.UnsafeAddrOfPinnedArrayElement(array, 0).ToPointer()), array.Length);
System.Private.Windows.Core.TestUtilities (8)
System.Private.Xml (858)
System\Xml\Core\XmlEncodedRawTextWriter.cs (10)
148_bufBytes = new byte[_bufChars.Length];
654Debug.Assert(count >= 0 && index + count <= buffer.Length);
678Debug.Assert(count >= 0 && index + count <= buffer.Length);
854_encoder!.Convert(_bufChars, startOffset, endOffset - startOffset, _bufBytes!, _bufBytesUsed, _bufBytes!.Length - _bufBytesUsed, false, out chEnc, out bEnc, out _);
857if (_bufBytesUsed >= (_bufBytes.Length - 16))
877_encoder!.Convert(_bufChars, 1, 0, _bufBytes!, 0, _bufBytes!.Length, true, out _, out bEnc, out _);
1686if (_lastMarkPos + 1 == _textContentMarks!.Length)
1695Debug.Assert(_lastMarkPos + 1 == _textContentMarks!.Length);
1696int[] newTextContentMarks = new int[_textContentMarks.Length * 2];
1697Array.Copy(_textContentMarks, newTextContentMarks, _textContentMarks.Length);
System\Xml\Core\XmlEncodedRawTextWriterAsync.cs (5)
550Debug.Assert(count >= 0 && index + count <= buffer.Length);
572Debug.Assert(count >= 0 && index + count <= buffer.Length);
686_encoder!.Convert(_bufChars, startOffset, endOffset - startOffset, _bufBytes!, _bufBytesUsed, _bufBytes!.Length - _bufBytesUsed, false, out chEnc, out bEnc, out _);
689if (_bufBytesUsed >= (_bufBytes.Length - 16))
709_encoder!.Convert(_bufChars, 1, 0, _bufBytes!, 0, _bufBytes!.Length, true, out _, out bEnc, out _);
System\Xml\Core\XmlTextReaderImpl.cs (38)
1597ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1644ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1690ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1737ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
1797ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
2856bufferSize = _ps.bytes.Length;
2869if (_ps.bytes == null || _ps.bytes.Length < bufferSize)
2876if (_ps.chars == null || _ps.chars.Length < bufferSize + 1)
2883if (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0)
2885int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
3363if (_ps.charsUsed == _ps.chars.Length - 1)
3371char[] newChars = new char[_ps.chars.Length * 2];
3372BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
3382if (_ps.bytes.Length - _ps.bytesUsed < MaxByteSequenceLen)
3384byte[] newBytes = new byte[_ps.bytes.Length * 2];
3391charsRead = _ps.chars.Length - _ps.charsUsed - 1;
3399int charsLen = _ps.chars.Length;
3422char[] newChars = new char[_ps.chars.Length * 2];
3423BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
3448charsRead = _ps.chars.Length - _ps.charsUsed - 1;
3458if (_ps.bytePos == _ps.bytesUsed && _ps.bytes.Length - _ps.bytesUsed > 0)
3460int read = _ps.stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed);
3482charsRead = _ps.textReader.Read(_ps.chars, _ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1);
3494Debug.Assert(_ps.charsUsed < _ps.chars.Length);
3507Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1);
5020if (_attrDuplSortingArray == null || _attrDuplSortingArray.Length < _attrCount)
7640Debug.Assert(nodeIndex < _nodes.Length);
7641Debug.Assert(_nodes[_nodes.Length - 1] == null);
7654Debug.Assert(nodeIndex < _nodes.Length);
7655if (nodeIndex >= _nodes.Length - 1)
7657NodeData[] newNodes = new NodeData[_nodes.Length * 2];
7658Array.Copy(_nodes, newNodes, _nodes.Length);
7661Debug.Assert(nodeIndex < _nodes.Length);
8118else if (_parsingStatesStackTop + 1 == _parsingStatesStack.Length)
8120ParsingState[] newParsingStateStack = new ParsingState[_parsingStatesStack.Length * 2];
8121Array.Copy(_parsingStatesStack, newParsingStateStack, _parsingStatesStack.Length);
8170if (array.Length - index < count)
9580Debug.Assert(endPos < chars.Length);
System\Xml\Core\XmlTextReaderImplAsync.cs (23)
393ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
449ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
514ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
570ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
622ArgumentOutOfRangeException.ThrowIfGreaterThan(count, buffer.Length - index);
882bufferSize = _ps.bytes.Length;
897if (_ps.bytes == null || _ps.bytes.Length < bufferSize)
904if (_ps.chars == null || _ps.chars.Length < bufferSize + 1)
911if (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0)
913int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
1035if (_ps.charsUsed == _ps.chars.Length - 1)
1043char[] newChars = new char[_ps.chars.Length * 2];
1044BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
1053if (_ps.bytes!.Length - _ps.bytesUsed < MaxByteSequenceLen)
1055byte[] newBytes = new byte[_ps.bytes.Length * 2];
1062charsRead = _ps.chars.Length - _ps.charsUsed - 1;
1070int charsLen = _ps.chars.Length;
1093char[] newChars = new char[_ps.chars.Length * 2];
1094BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length);
1117charsRead = _ps.chars.Length - _ps.charsUsed - 1;
1125if (_ps.bytePos == _ps.bytesUsed && _ps.bytes!.Length - _ps.bytesUsed > 0)
1149charsRead = await _ps.textReader.ReadAsync(_ps.chars.AsMemory(_ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1)).ConfigureAwait(false);
1161Debug.Assert(_ps.charsUsed < _ps.chars.Length);
System\Xml\Serialization\XmlSerializationWriter.cs (41)
426for (int i = 0; i < xmlNodes.Length; i++)
455XmlCustomFormatter.WriteArrayBase64(_w, (byte[])o, 0, ((byte[])o).Length);
1054XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1070XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1089XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1175XmlCustomFormatter.WriteArrayBase64(_w, value, 0, value.Length);
1312int arrayLength = a.Length;
1558for (int i = 0; i < parameterTypes.Length; i++)
1747for (int i = 0; i < structMapping.Members!.Length; i++)
1771for (int i = 0; i < enumFields.Length; i++)
1823for (int i = 0; i < memberInfos.Length; i++)
1870for (int i = 0; i < paramTypes.Length; i++)
1873if (i < (paramTypes.Length - 1))
1935for (int i = 0; i < args.Length; i++)
2516for (int i = 0; i < values.Length; i++)
2693for (int i = 0; i < mapping.Members!.Length; i++)
2707for (int j = 0; j < mapping.Members.Length; j++)
2747for (int i = 0; i < mapping.Members!.Length; i++)
2761for (int j = 0; j < mapping.Members.Length; j++)
2792for (int j = 0; j < mapping.Members.Length; j++)
2810if (isRpc && member.IsReturnValue && member.Elements!.Length > 0)
2842Writer.Write(mapping.Members.Length.ToString(CultureInfo.InvariantCulture));
2846WriteExtraMembers(mapping.Members.Length.ToString(CultureInfo.InvariantCulture), "pLength");
2932if (constants.Length > 0)
2940for (int i = 0; i < constants.Length; i++)
2960for (int i = 0; i < constants.Length; i++)
2971for (int i = 0; i < constants.Length; i++)
3231for (int i = 0; i < members.Length; i++)
3270for (int i = 0; i < members.Length; i++)
3276bool checkShouldPersist = m.CheckShouldPersist && (m.Elements!.Length > 0 || m.Text != null);
3534!(elements.Length == 1 && elements[0].Mapping is ArrayMapping))
3543if (elements.Length == 0 && text == null) return;
3661int count = elements.Length + (text == null ? 0 : 1);
3691if (elements.Length == 0 && text == null) return;
3692if (elements.Length == 1 && text == null)
3715for (int i = 0; i < elements.Length; i++)
3783if (elements.Length - anyCount > 0) Writer.Write("else ");
3879if (elements.Length > 0)
3901if (elements.Length > 0)
4459for (int i = 0; i < members.Length; i++)
4516for (int i = 0; i < choiceMapping.Constants!.Length; i++)
System.Private.Xml.Linq (20)
System.Reflection.Context (43)
System\Reflection\Context\Projection\ProjectingType.cs (19)
240methods.Length +
241constructors.Length +
242properties.Length +
243events.Length +
244fields.Length +
245nestedTypes.Length];
248Array.Copy(methods, 0, members, i, methods.Length); i += methods.Length;
249Array.Copy(constructors, 0, members, i, constructors.Length); i += constructors.Length;
250Array.Copy(properties, 0, members, i, properties.Length); i += properties.Length;
251Array.Copy(events, 0, members, i, events.Length); i += events.Length;
252Array.Copy(fields, 0, members, i, fields.Length); i += fields.Length;
253Array.Copy(nestedTypes, 0, members, i, nestedTypes.Length); i += nestedTypes.Length;
255Debug.Assert(i == members.Length);
System.Reflection.DispatchProxy (15)
System.Reflection.Emit (105)
System\Reflection\Emit\TypeBuilderImpl.cs (45)
74_interfaces = new List<Type>(interfaces.Length);
75for (int i = 0; i < interfaces.Length; i++)
266var typeParameters = new GenericTypeParameterBuilderImpl[names.Length];
267for (int i = 0; i < names.Length; i++)
279if (data.Length <= 0 || data.Length >= 0x003f0000)
281throw new ArgumentException(SR.Argument_BadSizeForData, nameof(data.Length));
287return DefineDataHelper(name, data, data.Length, attributes);
510for (int i = 0; i < attributeInfo._namedParamNames.Length; ++i)
662for (int i = 0; i < types.Length; i++)
714if (argumentTypes.Length != parameterTypes.Length)
719for (int i = 0; i < parameterTypes.Length; i++)
942for (int i = 0; i < interfaces.Length; ++i)
1050if (types == null || types.Length == 0)
1081List<PropertyInfo> candidates = new List<PropertyInfo>(properties.Length);
1082for (int i = 0; i < properties.Length; i++)
1086(types == null || (propertyInfo.GetIndexParameters().Length == types.Length)))
1184totalCount += methods.Length;
1193totalCount += constructors.Length;
1202totalCount += properties.Length;
1221totalCount += fields.Length;
1230totalCount += nestedTypes.Length;
1237methods.CopyTo(compressMembers, i); i += methods.Length;
1238constructors.CopyTo(compressMembers, i); i += constructors.Length;
1239properties.CopyTo(compressMembers, i); i += properties.Length;
1240events.CopyTo(compressMembers, i); i += events.Length;
1241fields.CopyTo(compressMembers, i); i += fields.Length;
1259InterfaceMethods = new MethodInfo[interfaceMethods.Length],
1260TargetMethods = new MethodInfo[interfaceMethods.Length]
1263for (int i = 0; i < interfaceMethods.Length; i++)
1281for (int i = 0; i < interfaceMethods.Length; i++)
1298Type[] parameterTypes = new Type[parameterInfos.Length];
1299for (int i = 0; i < parameterInfos.Length; i++)
1339methods.Length +
1340constructors.Length +
1341properties.Length +
1343fields.Length +
1344nestedTypes.Length];
1347methods.CopyTo(members, i); i += methods.Length;
1348constructors.CopyTo(members, i); i += constructors.Length;
1349properties.CopyTo(members, i); i += properties.Length;
1351fields.CopyTo(members, i); i += fields.Length;
1381for (int i = 0; i < interfaces.Length; i++)
System.Reflection.Metadata (51)
System.Reflection.MetadataLoadContext (124)
System.Resources.Extensions (18)
System.Resources.Writer (5)
System.Runtime.Caching (22)
System.Runtime.InteropServices (7)
System.Runtime.InteropServices.JavaScript (15)
System.Runtime.Numerics (104)
System\Numerics\BigInteger.cs (93)
313if (_bits.Length is 1 && _bits[0] <= int.MaxValue)
493if (len != val.Length)
706_bits = new nuint[bits32.Length];
707Buffer.BlockCopy(bits32, 0, _bits, 0, bits32.Length * sizeof(uint));
711int nuintLen = (bits32.Length + 1) / 2;
713for (int i = 0; i < bits32.Length; i += 2)
716ulong hi = (i + 1 < bits32.Length) ? bits32[i + 1] : 0;
739bits32 = new uint[_bits.Length];
740Buffer.BlockCopy(_bits, 0, bits32, 0, _bits.Length * sizeof(uint));
744int len = _bits.Length * 2;
751for (int i = 0; i < _bits.Length; i++)
785int iu = _bits.Length - 1;
919int size = dividend._bits.Length;
932if (dividend._bits.Length < divisor._bits.Length)
939int size = dividend._bits.Length;
942size = dividend._bits.Length - divisor._bits.Length + 1;
997m = value._bits.Length > 1 ? value._bits[^2] : 0;
1000b = (long)value._bits.Length * 64 - c;
1008m = value._bits.Length > 1 ? (uint)value._bits[^2] : 0;
1009l = value._bits.Length > 2 ? (uint)value._bits[^3] : 0;
1013b = (long)value._bits.Length * 32 - c;
1129int size = (modulus._bits?.Length ?? 1) << 1;
1204int size = BigIntegerCalculator.PowBound(power, value._bits!.Length);
1242if ((_sign ^ other) < 0 || (cu = _bits.Length) > maxLimbs)
1274int cu = _bits.Length;
1307if ((_sign ^ other) < 0 || (cu = _bits.Length) > maxLimbs)
1342int cu = _bits.Length;
1571Debug.Assert(bits.Length > 0);
1576if (bits.Length - 1 == nonZeroLimbIndex)
1614length = checked(bytesPerLimb * (bits.Length - 1) + length);
1663for (int i = 0; i < bits.Length - 1; i++)
1728Debug.Assert(_bits is null || _sign == 0 ? buffer.Length == 2 : buffer.Length >= _bits.Length + 1);
1740buffer = buffer.Slice(0, _bits.Length + 1);
1803if ((_bits is null) || (_bits.Length <= 4))
1819lowBitsCount = _bits.Length - 1;
1824lowBitsCount = _bits.Length - 2;
2026int length = bits.Length;
2084if (value._bits.Length > 1)
2111int len = value._bits.Length;
2151int len = value._bits.Length;
2212return value._bits.Length <= 1 && value._sign >= 0
2226int len = value._bits.Length;
2254int len = value._bits.Length;
2515int xLen = left._bits?.Length ?? 1;
2516int yLen = right._bits?.Length ?? 1;
2534int xLen = left._bits?.Length ?? 1;
2535int yLen = right._bits?.Length ?? 1;
2544int xLen = left._bits?.Length ?? 1;
2545int yLen = right._bits?.Length ?? 1;
2742int size = value._bits.Length + 1;
2752Span<nuint> bits = RentedBuffer.Create(value._bits.Length, out RentedBuffer bitsBuffer);
2777int size = value._bits.Length + 1;
2786Span<nuint> bits = RentedBuffer.Create(value._bits.Length, out RentedBuffer bitsBuffer);
2807Span<nuint> bits = RentedBuffer.Create(value._bits.Length, out RentedBuffer bitsBuffer);
2815int size = value._bits.Length + 1;
2919int size = dividend._bits.Length;
2934if (dividend._bits.Length < divisor._bits.Length)
2940int size = dividend._bits.Length - divisor._bits.Length + 1;
2978if (dividend._bits.Length < divisor._bits.Length)
2983int size = dividend._bits.Length;
3085bitsArrayLength = bits.Length;
3117Debug.Assert(_bits.Length > 0);
3119Debug.Assert(_bits.Length > 1 || _bits[0] > int.MaxValue);
3123Debug.Assert(_bits.Length <= MaxLength);
3216for (int i = 0; i < value._bits.Length; i++)
3237while (i < value._bits.Length)
3570for (int i = 1; (part == 0) && (i < value._bits.Length); i++)
3607int result = (bits.Length - 1) * BigIntegerCalculator.BitsPerLimb;
3621if (bits.AsSpan(0, bits.Length - 1).ContainsAnyExcept(0u))
3654for (int i = bits.Length - 1; i >= 0; i--)
3665bool needsSignExtension = byteCount > bits.Length * nint.Size;
3681for (int i = bits.Length - 1; i >= 0; i--)
3732for (int i = 0; i < bits.Length; i++)
3743bool needsSignExtension = byteCount > bits.Length * nint.Size;
3750for (int i = 0; i < bits.Length; i++)
3798int result = bits.Length * nint.Size;
3808if (bits.AsSpan(0, bits.Length - 1).ContainsAnyExcept(0u))
3844: (BigInteger)(((long)value._bits.Length * BigIntegerCalculator.BitsPerLimb - 1) ^ BitOperations.LeadingZeroCount(value._bits[^1]));
4891if (value._bits.Length >= 2)
4928if (value._bits.Length >= 2)
4935if (value._bits.Length >= 4)
4941if (value._bits.Length >= 3)
4946if (value._bits.Length >= 2)
5085if (value._bits.Length >= 2)
5122if (value._bits.Length >= 2)
5129if (value._bits.Length >= 4)
5135if (value._bits.Length >= 3)
5140if (value._bits.Length >= 2)
System.Runtime.Serialization.Formatters (29)
System.Runtime.Serialization.Schema (1)
System.Security.AccessControl (20)
System.Security.Claims (9)
System.Security.Cryptography (499)
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptEncryptDecrypt.cs (2)
23NTSTATUS ntStatus = BCryptEncrypt(hKey, pbInput, input.Length, IntPtr.Zero, iv, iv == null ? 0 : iv.Length, pbOutput, output.Length, out cbResult, 0);
44NTSTATUS ntStatus = BCryptDecrypt(hKey, pbInput, input.Length, IntPtr.Zero, iv, iv == null ? 0 : iv.Length, pbOutput, output.Length, out cbResult, 0);
System\Security\Cryptography\CngAsnFormatter.cs (2)
30if (Interop.Crypt32.CryptFormatObject(X509_ASN_ENCODING, 0, dwFormatStrType, IntPtr.Zero, (byte*)oidValuePtr, rawData, rawData.Length, null, ref cbFormat))
38if (Interop.Crypt32.CryptFormatObject(X509_ASN_ENCODING, 0, dwFormatStrType, IntPtr.Zero, (byte*)oidValuePtr, rawData, rawData.Length, bufferPtr, ref cbFormat))
System\Security\Cryptography\DSA.cs (11)
101return SignData(data, 0, data.Length, hashAlgorithm);
141ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
144ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
198ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
201ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
303return VerifyData(data, 0, data.Length, signature, hashAlgorithm);
311ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
314ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
371ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
374ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
1107int qLength = dsaParameters.Q!.Length;
System\Security\Cryptography\ECDsa.cs (12)
47return SignData(data, 0, data.Length, hashAlgorithm);
55ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
58ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
112ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
115ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
723return VerifyData(data, 0, data.Length, signature, hashAlgorithm);
731ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
734ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
791ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
794ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
1018if (hash.Length <= destination.Length)
1021bytesWritten = hash.Length;
System\Security\Cryptography\PasswordDeriveBytes.cs (6)
126ib = _extra.Length - _extraCount;
153if (rgb.Length + ib > cb)
203_hash.TransformBlock(_password, 0, _password.Length, _password, 0);
207_hash.TransformBlock(_salt, 0, _salt.Length, _salt, 0);
236cs.Write(_baseValue!, 0, _baseValue!.Length);
249cs.Write(_baseValue, 0, _baseValue.Length);
System\Security\Cryptography\RSA.cs (17)
106if (destination.Length >= result.Length)
109bytesWritten = result.Length;
121if (destination.Length >= result.Length)
124bytesWritten = result.Length;
330if (destination.Length >= result.Length)
333bytesWritten = result.Length;
345if (destination.Length >= result.Length)
348bytesWritten = result.Length;
376return SignData(data, 0, data.Length, hashAlgorithm, padding);
389ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
392ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
638return VerifyData(data, 0, data.Length, signature, hashAlgorithm, padding);
652ArgumentOutOfRangeException.ThrowIfGreaterThan(offset, data.Length);
655ArgumentOutOfRangeException.ThrowIfGreaterThan(count, data.Length - offset);
735rentSize = rented.Length;
778rentSize = rented.Length;
1413if (written > rented.Length)
System\Security\Cryptography\X509Certificates\X509Pal.Windows.PublicKey.cs (9)
204if (!Interop.crypt32.CryptDecodeObject(CertEncodingType.All, lpszStructType, encodedKeyValue, encodedKeyValue.Length, CryptDecodeObjectFlags.None, null, ref cbDecoded))
208if (!Interop.crypt32.CryptDecodeObject(CertEncodingType.All, lpszStructType, encodedKeyValue, encodedKeyValue.Length, CryptDecodeObjectFlags.None, keyBlob, ref cbDecoded))
229int cbKey = p.Length;
254int cb = q.Length;
263cb = g.Length;
272cb = decodedKeyValue.Length;
322return (explicitParams != null && explicitParams.Length > 0);
334if (value == null || value.Length == 0)
360errorCode = Interop.BCrypt.BCryptGetProperty(cryptHandle, propertyName, pPropertyValue, propertyValue.Length, out numBytesNeeded, 0);
System.Security.Cryptography.Cose (17)
System.Security.Cryptography.Pkcs (127)
System.Security.Cryptography.Xml (84)
System\Security\Cryptography\Xml\CanonicalXmlAttribute.cs (3)
36hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
38hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
41hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
System\Security\Cryptography\Xml\CanonicalXmlComment.cs (5)
56hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
60hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
62hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
64hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
68hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
System\Security\Cryptography\Xml\CanonicalXmlElement.cs (3)
140hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
150hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
168hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
System\Security\Cryptography\Xml\CanonicalXmlProcessingInstruction.cs (6)
51hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
55hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
58hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
63hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
67hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
72hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
System\Security\Cryptography\Xml\EncryptedXml.cs (9)
321Buffer.BlockCopy(cipherValue, 0, IV, 0, IV.Length);
710cipher = enc.TransformFinalBlock(plaintext, 0, plaintext.Length);
727output = new byte[cipher.Length + IV.Length];
728Buffer.BlockCopy(IV, 0, output, 0, IV.Length);
729Buffer.BlockCopy(cipher, 0, output, IV.Length, cipher.Length);
770lengthIV = decryptionIV.Length;
776output = dec.TransformFinalBlock(cipherValue, lengthIV, cipherValue.Length - lengthIV);
System\Security\Cryptography\Xml\SymmetricKeyWrap.cs (35)
38byte[] rgbWKCKS = new byte[rgbWrappedKeyData.Length + 8];
51Buffer.BlockCopy(rgbWrappedKeyData, 0, rgbWKCKS, 0, rgbWrappedKeyData.Length);
52Buffer.BlockCopy(rgbCKS, 0, rgbWKCKS, rgbWrappedKeyData.Length, 8);
53byte[] temp1 = enc1.TransformFinalBlock(rgbWKCKS, 0, rgbWKCKS.Length);
54byte[] temp2 = new byte[rgbIV.Length + temp1.Length];
55Buffer.BlockCopy(rgbIV, 0, temp2, 0, rgbIV.Length);
56Buffer.BlockCopy(temp1, 0, temp2, rgbIV.Length, temp1.Length);
60return enc2.TransformFinalBlock(temp2, 0, temp2.Length);
74if (rgbEncryptedWrappedKeyData.Length != 32 && rgbEncryptedWrappedKeyData.Length != 40
75&& rgbEncryptedWrappedKeyData.Length != 48)
89byte[] temp2 = dec1.TransformFinalBlock(rgbEncryptedWrappedKeyData, 0, rgbEncryptedWrappedKeyData.Length);
94byte[] temp1 = new byte[temp2.Length - rgbIV.Length];
95Buffer.BlockCopy(temp2, 8, temp1, 0, temp1.Length);
98byte[] rgbWKCKS = dec2.TransformFinalBlock(temp1, 0, temp1.Length);
101byte[] rgbWrappedKeyData = new byte[rgbWKCKS.Length - 8];
102Buffer.BlockCopy(rgbWKCKS, 0, rgbWrappedKeyData, 0, rgbWrappedKeyData.Length);
106for (int index = rgbWrappedKeyData.Length, index1 = 0; index < rgbWKCKS.Length; index++, index1++)
123int N = rgbWrappedKeyData.Length >> 3;
125if ((rgbWrappedKeyData.Length % 8 != 0) || N <= 0)
143byte[] temp = new byte[s_rgbAES_KW_IV.Length + rgbWrappedKeyData.Length];
144Buffer.BlockCopy(s_rgbAES_KW_IV, 0, temp, 0, s_rgbAES_KW_IV.Length);
145Buffer.BlockCopy(rgbWrappedKeyData, 0, temp, s_rgbAES_KW_IV.Length, rgbWrappedKeyData.Length);
146return enc.TransformFinalBlock(temp, 0, temp.Length);
152Buffer.BlockCopy(rgbWrappedKeyData, 0, rgbOutput, 8, rgbWrappedKeyData.Length);
185int N = (rgbEncryptedWrappedKeyData.Length >> 3) - 1;
187if ((rgbEncryptedWrappedKeyData.Length % 8 != 0) || N <= 0)
206byte[] temp = dec.TransformFinalBlock(rgbEncryptedWrappedKeyData, 0, rgbEncryptedWrappedKeyData.Length);
218Buffer.BlockCopy(rgbEncryptedWrappedKeyData, 8, rgbOutput, 0, rgbOutput.Length);
System.Security.Permissions (5)
System.Security.Principal.Windows (17)
System.ServiceModel.Http (15)
System.ServiceModel.NetFramingBase (9)
System.ServiceModel.NetNamedPipe (3)
System.ServiceModel.NetTcp (3)
System.ServiceModel.Primitives (511)
Internals\System\Runtime\UrlUtility.cs (4)
91return AsciiEncoding.GetString(bytes, 0, bytes.Length);
155bytes = UrlEncodeBytesToBytesInternalNonAscii(bytes, 0, bytes.Length, false);
157return AsciiEncoding.GetString(bytes, 0, bytes.Length);
177return UrlEncodeBytesToBytesInternal(bytes, 0, bytes.Length, false);
Internals\System\Text\BinHexEncoding.cs (14)
66if (charIndex > chars.Length)
67throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(charIndex), SRP.Format(SRP.OffsetExceedsBufferSize, chars.Length)));
70if (charCount > chars.Length - charIndex)
71throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(charCount), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, chars.Length - charIndex)));
76if (byteIndex > bytes.Length)
77throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(byteIndex), SRP.Format(SRP.OffsetExceedsBufferSize, bytes.Length)));
79if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
132if (byteIndex > bytes.Length)
133throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(byteIndex), SRP.Format(SRP.OffsetExceedsBufferSize, bytes.Length)));
136if (byteCount > bytes.Length - byteIndex)
137throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(byteCount), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, bytes.Length - byteIndex)));
143if (charIndex > chars.Length)
144throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(charIndex), SRP.Format(SRP.OffsetExceedsBufferSize, chars.Length)));
145if (charCount < 0 || charCount > chars.Length - charIndex)
Internals\System\Xml\XmlMtomReader.cs (47)
108for (int i = 0; i < encodings.Length; i++)
114_encodings = new Encoding[encodings.Length];
234for (int i = 0; i < _encodings.Length; i++)
247for (int i = 0; i < _encodings.Length; i++)
258for (int i = 0; i < _encodings.Length; i++)
271for (int i = 0; i < _encodings.Length; i++)
1214if (offset > buffer.Length)
1215throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SRP.Format(SRP.OffsetExceedsBufferSize, buffer.Length)));
1218if (count > buffer.Length - offset)
1219throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
1261if (offset > buffer.Length)
1262throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SRP.Format(SRP.OffsetExceedsBufferSize, buffer.Length)));
1265if (count > buffer.Length - offset)
1266throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
1306if (offset > buffer.Length)
1307throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SRP.Format(SRP.OffsetExceedsBufferSize, buffer.Length)));
1310if (count > buffer.Length - offset)
1311throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
1364if (offset > chars.Length)
1365throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SRP.Format(SRP.OffsetExceedsBufferSize, chars.Length)));
1368if (count > chars.Length - offset)
1369throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, chars.Length - offset)));
1411else if (_valueBuffer.Length < byteCount)
1956while (0 != Read(caller, scratch, 0, scratch.Length))
1994if (delimitter.Length > end - start)
2003for (int i = delimitter.Length - 1; i >= 1; i--)
2026ptr += delimitter.Length;
2075if (matchBuffer == null || matchBuffer.Length < delimitter.Length - read)
2076matchBuffer = new byte[delimitter.Length - read];
2078int matched = stream.ReadBlock(matchBuffer, 0, delimitter.Length - read);
2108if (start + count != delimitter.Length)
2189if (offset > buffer.Length)
2190throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SRP.Format(SRP.OffsetExceedsBufferSize, buffer.Length)));
2193if (count > buffer.Length - offset)
2194throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
2668maxOffset = stream.Read(buffer, 0, buffer.Length);
2927if (offset > buffer.Length)
2928throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SRP.Format(SRP.OffsetExceedsBufferSize, buffer.Length)));
2931if (count > buffer.Length - offset)
2932throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
2974if (storedBuffer == null || storedBuffer.Length < count)
2985else if (count <= storedBuffer.Length - storedLength + storedOffset)
3124else if (!(data[offset] < s_fqtext.Length && s_fqtext[data[offset]]))
3156if (data[offset] > s_ttext.Length)
3172for (; offset < data.Length && data[offset] < s_digits.Length && s_digits[data[offset]]; offset++)
3186if (!(data[i] < s_boundary.Length && s_boundary[data[i]]))
Internals\System\Xml\XmlMtomWriter.cs (18)
321if (count > buffer.Length - index)
322throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SRP.Format(SRP.SizeExceedsRemainingBufferSpace, buffer.Length - index)));
377Writer.WriteBase64(data.chunk, 0, data.chunk.Length);
396await Writer.WriteBase64Async(data.chunk, 0, data.chunk.Length);
526s.Write(data.chunk, 0, data.chunk.Length);
565await s.WriteAsync(data.chunk, 0, data.chunk.Length);
799while ((count = reader.ReadValueChunk(_chars, 0, _chars.Length)) > 0)
823while ((count = reader.ReadValueAsBase64(_bytes, 0, _bytes.Length)) > 0)
1079int size = XmlMtomWriter.ValidateSizeOfMessage(maxSizeInBytes, 0, MimeGlobals.CRLF.Length * 3);
1175int size = XmlMtomWriter.ValidateSizeOfMessage(maxSizeInBytes, 0, MimeGlobals.COLONSPACE.Length + MimeGlobals.CRLF.Length);
1183byte[] boundaryBytes = new byte[boundary.Length + MimeGlobals.BoundaryPrefix.Length];
1184for (int i = 0; i < MimeGlobals.BoundaryPrefix.Length; i++)
1186Encoding.ASCII.GetBytes(boundary, 0, boundary.Length, boundaryBytes, MimeGlobals.BoundaryPrefix.Length);
1200return boundaryBytes.Length;
1407int currSize = buffer.Length;
1444Write(value, 0, value.Length);
1541return chunk.Length;
System\ServiceModel\Channels\SequenceRangeCollection.cs (19)
25if (sortedRanges.Length == 0)
29else if (sortedRanges.Length == 1)
41if (sortedRanges.Length == 0)
48if (sortedRanges.Length == 1)
78if (lowerBound == sortedRanges.Length)
80SequenceRange[] returnedRanges = new SequenceRange[sortedRanges.Length + 1];
81Array.Copy(sortedRanges, returnedRanges, sortedRanges.Length);
82returnedRanges[sortedRanges.Length] = range;
89if (sortedRanges.Length == 1)
116if ((upperBound == sortedRanges.Length) || (sortedRanges[upperBound].Lower != range.Upper + 1))
123SequenceRange[] returnedRanges = new SequenceRange[sortedRanges.Length + 1];
124Array.Copy(sortedRanges, 0, returnedRanges, 1, sortedRanges.Length);
134int rangesRemaining = sortedRanges.Length - rangesRemoved + 1;
144Array.Copy(sortedRanges, upperBound + 1, returnedRanges, lowerBound + 1, sortedRanges.Length - upperBound - 1);
193if (index < 0 || index >= _ranges.Length)
195SRP.Format(SRP.ValueMustBeInRange, 0, _ranges.Length - 1)));
200public override int Count => _ranges.Length;
204if (_ranges.Length == 0)
208else if (_ranges.Length == 1)
System\ServiceModel\Dispatcher\PrimitiveOperationFormatter.cs (18)
651if (parts.Length != parameters.Length)
654new ArgumentException(SRP.Format(SRP.SFxParameterCountMismatch, "parts", parts.Length, "parameters", parameters.Length), "parameters"));
660for (int i = nextPartIndex; i < parts.Length; i++)
730if (parts.Length != parameters.Length)
733new ArgumentException(SRP.Format(SRP.SFxParameterCountMismatch, "parts", parts.Length, "parameters", parameters.Length), "parameters"));
736for (int i = 0; i < parts.Length; i++)
958writer.WriteBase64(arrayValue, 0, arrayValue.Length);
964writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
970writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
976writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
982writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
988writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
994writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
1000writer.WriteArray(null, _itemName, _itemNamespace, arrayValue, 0, arrayValue.Length);
System\ServiceModel\Security\WSUtilitySpecificationVersion.cs (6)
122writer.WriteChars(creationTime, 0, creationTime.Length);
127writer.WriteChars(expiryTime, 0, expiryTime.Length);
173stream.Write(_fragment1, 0, _fragment1.Length);
175stream.Write(_fragment2, 0, _fragment2.Length);
177stream.Write(_fragment3, 0, _fragment3.Length);
179stream.Write(_fragment4, 0, _fragment4.Length);
System.ServiceModel.Primitives.Tests (7)
System.ServiceModel.Syndication (3)
System.ServiceProcess.ServiceController (11)
System.Speech (143)
System.Text.Encoding.CodePages (62)
System.Text.Encodings.Web (5)
System.Text.Json (157)
System\Text\Json\BitStack.cs (15)
80Debug.Assert(index >= 0, $"Set - Negative - index: {index}, arrayLength: {_array.Length}");
83Debug.Assert(_array.Length <= int.MaxValue / 32 + 1, $"index: {index}, arrayLength: {_array.Length}");
89if (elementIndex >= _array.Length)
92Debug.Assert(index >= 0 && index > (int)((uint)_array.Length * 32 - 1), $"Only grow when necessary - index: {index}, arrayLength: {_array.Length}");
96Debug.Assert(elementIndex < _array.Length, $"Set - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}");
145Debug.Assert(index >= 0, $"Get - Negative - index: {index}, arrayLength: {_array.Length}");
149Debug.Assert(elementIndex < _array.Length, $"Get - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}");
165Debug.Assert(_array.Length < int.MaxValue / 2, $"Array too large - arrayLength: {_array.Length}");
166Debug.Assert(minSize >= 0 && minSize >= _array.Length);
168int nextDouble = Math.Max(minSize + 1, _array.Length * 2);
System\Text\Json\Document\JsonDocument.Parse.cs (11)
710MetadataDb database = MetadataDb.CreateLocked(utf8Json.Length);
711database.Append(tokenType, startLocation: 0, utf8Json.Length);
826Debug.Assert(rented.Length >= utf8Bom.Length);
845if (rented.Length == written)
848rented = ArrayPool<byte>.Shared.Rent(checked(toReturn.Length * 2));
849Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length);
854lastRead = stream.Read(rented, written, rented.Length - written);
909Debug.Assert(rented.Length >= JsonConstants.Utf8Bom.Length);
925if (rented.Length == written)
928rented = ArrayPool<byte>.Shared.Rent(toReturn.Length * 2);
929Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length);
System.Text.Json.SourceGeneration (12)
System.Text.RegularExpressions (217)
System\Text\RegularExpressions\RegexRunner.cs (19)
262runtrackpos = runtrack!.Length;
263runstackpos = runstack!.Length;
264runcrawlpos = runcrawl!.Length;
308runtrackpos = runtrack!.Length;
309runstackpos = runstack!.Length;
310runcrawlpos = runcrawl.Length;
476int[] newtrack = new int[runtrack!.Length * 2];
478Array.Copy(runtrack, 0, newtrack, runtrack.Length, runtrack.Length);
479runtrackpos += runtrack.Length;
489int[] newstack = new int[runstack!.Length * 2];
491Array.Copy(runstack, 0, newstack, runstack.Length, runstack.Length);
492runstackpos += runstack.Length;
501int[] newcrawl = new int[runcrawl!.Length * 2];
503Array.Copy(runcrawl, 0, newcrawl, runcrawl.Length, runcrawl.Length);
504runcrawlpos += runcrawl.Length;
532return runcrawl!.Length - runcrawlpos;
System\Text\RegularExpressions\Symbolic\BDDRangeConverter.cs (22)
55var result = new (uint, uint)[(1 << newBits) * ranges.Length];
70if (ranges[0].Item1 == 0 && ranges[ranges.Length - 1].Item2 == maximal)
76for (int i = 1; i < result.Length; i++)
115ranges = new (uint, uint)[ranges1.Length];
116for (int i = 0; i < ranges1.Length; i++)
136ranges = new (uint, uint)[rangesR.Length];
138for (int i = 1; i < rangesR.Length; i++)
145ranges = new (uint, uint)[rangesR.Length + 1];
147for (int i = 0; i < rangesR.Length; i++)
159(uint, uint) last = rangesL[rangesL.Length - 1];
169for (int i = 0; i < rangesL.Length - 1; i++)
195ranges = new (uint, uint)[rangesL.Length + rangesR.Length - 1];
196for (int i = 0; i < rangesL.Length - 1; i++)
201ranges[rangesL.Length - 1] = (last.Item1, first.Item2 | mask);
202for (int i = 1; i < rangesR.Length; i++)
204ranges[rangesL.Length - 1 + i] = (rangesR[i].Item1 | mask, rangesR[i].Item2 | mask);
209ranges = new (uint, uint)[rangesL.Length + rangesR.Length];
210for (int i = 0; i < rangesL.Length; i++)
215for (int i = 0; i < rangesR.Length; i++)
217ranges[rangesL.Length + i] = (rangesR[i].Item1 | mask, rangesR[i].Item2 | mask);
System.Text.RegularExpressions.Generator (72)
RegexGenerator.Emitter.cs (49)
1327Debug.Assert(primarySet.Chars.Length > 0);
1336indexOf = primarySet.Chars.Length switch
1474if (set.Chars is { Length: 1 })
1534literalChars.Length switch
2188for (int i = 0; i < labelMap.Length; i++)
4818Debug.Assert(args.Length is >= 1);
4821string key = $"{MethodName}{args.Length}";
4827var lines = new string[24 + args.Length];
4828lines[0] = $"/// <summary>Pushes {args.Length} value{(args.Length == 1 ? "" : "s")} onto the backtracking stack.</summary>";
4830lines[2] = $"internal static void {MethodName}(ref int[] stack, ref int pos{FormatN(", int arg{0}", args.Length)})";
4832lines[4] = $" // If there's space available for {(args.Length > 1 ? $"all {args.Length} values, store them" : "the value, store it")}.";
4835lines[7] = $" if ((uint){(args.Length > 1 ? $"(p + {args.Length - 1})" : "p")} < (uint)s.Length)";
4837for (int i = 0; i < args.Length; i++)
4841lines[9 + args.Length] = args.Length > 1 ? $" pos += {args.Length};" : " pos++;";
4842lines[10 + args.Length] = $" return;";
4843lines[11 + args.Length] = $" }}";
4844lines[12 + args.Length] = $"";
4845lines[13 + args.Length] = $" // Otherwise, resize the stack to make room and try again.";
4846lines[14 + args.Length] = $" WithResize(ref stack, ref pos{FormatN(", arg{0}", args.Length)});";
4847lines[15 + args.Length] = $"";
4848lines[16 + args.Length] = $" // <summary>Resize the backtracking stack array and push {args.Length} value{(args.Length == 1 ? "" : "s")} onto the stack.</summary>";
4849lines[17 + args.Length] = $" [MethodImpl(MethodImplOptions.NoInlining)]";
4850lines[18 + args.Length] = $" static void WithResize(ref int[] stack, ref int pos{FormatN(", int arg{0}", args.Length)})";
4851lines[19 + args.Length] = $" {{";
4852lines[20 + args.Length] = $" Array.Resize(ref stack, (pos + {args.Length - 1}) * 2);";
4853lines[21 + args.Length] = $" {MethodName}(ref stack, ref pos{FormatN(", arg{0}", args.Length)});";
4854lines[22 + args.Length] = $" }}";
4855lines[23 + args.Length] = $"}}";
4870Debug.Assert(args.Length is >= 1);
4872if (args.Length == 1)
4879string key = $"{MethodName}{args.Length}";
4883var lines = new string[5 + args.Length];
4884lines[0] = $"/// <summary>Pops {args.Length} value{(args.Length == 1 ? "" : "s")} from the backtracking stack.</summary>";
4886lines[2] = $"internal static void {MethodName}(int[] stack, ref int pos{FormatN(", out int arg{0}", args.Length)})";
4888for (int i = 0; i < args.Length; i++)
4892lines[4 + args.Length] = $"}}";
5560for (int i = 0; i < parts.Length; i++)
System.Threading.Channels (20)
System.Threading.RateLimiting (24)
System.Threading.Tasks.Dataflow (25)
System.Threading.Tasks.Parallel (13)
System.Transactions.Local (25)
System\Transactions\TransactionInterop.cs (9)
61var whereaboutsCopy = new byte[whereabouts.Length];
62Buffer.BlockCopy(whereabouts, 0, whereaboutsCopy, 0, whereabouts.Length);
97if (cookie.Length < 32)
108var cookieCopy = new byte[cookie.Length];
109Buffer.BlockCopy(cookie, 0, cookieCopy, 0, cookie.Length);
232if (propagationToken.Length < 24)
501if (propagationToken.Length < 24)
511byte[] propagationTokenCopy = new byte[propagationToken.Length];
512Array.Copy(propagationToken, propagationTokenCopy, propagationToken.Length);
System.Web.HttpUtility (4)
System.Windows.Controls.Ribbon (9)
System.Windows.Extensions (5)
System.Windows.Forms (553)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.cs (3)
781OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Refresh, null), indexStart, dataGridViewRows.Length);
1753if (dataGridViewRows.Length == 1)
1831OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Refresh, null), rowIndex, dataGridViewRows.Length, false, true, false, newCurrentCell);
System\Windows\Forms\Controls\ListView\ListView.cs (30)
464for (int i = 0; i < items.Length; i++)
509for (int i = 0; i < items.Length; i++)
2520ColumnHeader? col = (_columnHeaders is not null && _columnHeaders.Length > 0) ? _columnHeaders[0] : null;
3072for (int colIdx = _columnHeaders.Length - 1; colIdx >= 0; colIdx--)
3464for (int i = 0; i < _columnHeaders.Length; i++)
3809for (int i = 0; i < _columnHeaders.Length; i++)
3839int columnCount = _columnHeaders is null ? 0 : _columnHeaders.Length;
3999if (items is null || items.Length == 0)
4016for (int i = 0; i < items.Length; i++)
4030for (int i = 0; i < items.Length; i++)
4041for (int i = 0; i < items.Length; i++)
4095if (items is null || items.Length == 0)
4121for (int i = 0; i < items.Length; i++)
4136cColumns = (uint)(_columnHeaders is not null ? Math.Min(MAXTILECOLUMNS, _columnHeaders.Length) : 0),
4602: _columnHeaders.Length;
4727_savedSelectedItems = new List<ListViewItem>(lviArr.Length);
4728for (int i = 0; i < lviArr.Length; i++)
5292ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, _columnHeaders?.Length ?? 0);
5370int[] orderedColumns = new int[indices.Length];
5371for (int i = 0; i < indices.Length; i++)
5384(WPARAM)orderedColumns.Length,
5651for (int i = 0; i < _columnHeaders.Length; i++)
5869cLines = _columnHeaders is not null ? _columnHeaders.Length : 0,
6110if (_columnHeaders is not null && _columnHeaders.Length > nmheader->iItem)
6126if (_columnHeaders is not null && nmheader->iItem < _columnHeaders.Length &&
6161if (_columnHeaders is not null && nmheader->iItem < _columnHeaders.Length)
6219if (_columnHeaders is not null && _columnHeaders.Length > nmheader->iItem)
6341if (_columnHeaders is not null && _columnHeaders.Length > nmheader->iItem)
6359Debug.Assert(_columnHeaders!.Length > 0, "there should be a column that we need to compensate for");
6889Marshal.Copy(charBuf, 0, destPtr, Math.Min(charBuf.Length, infoTip->cchTextMax));
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (53)
375if (_selectedObjects is not null && _selectedObjects.Length > 0 && _rootEntry is not null)
889get => _selectedObjects is null || _selectedObjects.Length == 0 ? null : _selectedObjects[0];
916if (value is not null && value.Length > 0)
918for (int count = 0; count < value.Length; count++)
922throw new ArgumentException(string.Format(SR.PropertyGridSetNull, count, value.Length));
935&& _selectedObjects.Length == value.Length)
940for (int i = 0; i < value.Length && (isSame || classesSame); i++)
1046HashSet<Type>? typesWithEvents = _selectedObjects.Length > 10 ? new() : null;
1048for (int i = 0; i < _selectedObjects.Length && showEvents; i++)
1079ShowEventsButton(showEvents && _selectedObjects.Length > 0);
1081EnablePropPageButton(_selectedObjects.Length == 1 ? _selectedObjects[0] : null);
1093if (_selectedObjects!.Length > 0 && GetFlag(Flags.ReInitTab))
1117if (_selectedObjects.Length > 0)
1540int oldArraySize = tabComponents is null ? 0 : tabComponents.Length;
1741if (_selectedObjects is not null && _selectedObjects.Length > 0)
1743for (int i = 0; i < _selectedObjects.Length; i++)
1764if (_selectedObjects.Length == 1 && site.TryGetService(out IDesignerHost? designerHost))
1780if (verbs is not null && verbs.Length > 0)
2023for (int j = 0; j < _selectedObjects.Length; j++)
2144if (components is null || components.Length == 0)
2157for (int i = 0; i < tabAttribute.TabScopes.Length; i++)
2165for (int i = 1; i < components.Length && tabClasses.Count > 0; i++)
2220if (_selectedObjects is null || index < 0 || index > _selectedObjects.Length)
2428for (int i = 0; i < tabAttribute.TabClasses.Length; i++)
2441(_selectedObjects is null) || (_selectedObjects.Length == 0))
2451int objectCount = _selectedObjects.Length;
2475for (int i = 0; i < tabAttribute.TabClasses.Length; i++)
2485for (int i = 0; i < _selectedObjects.Length; i++)
2489object[] newObjects = new object[_selectedObjects.Length - 1];
2491if (i < newObjects.Length)
2494Array.Copy(_selectedObjects, i + 1, newObjects, i, newObjects.Length - i);
2541if (_selectedObjects is not null && _selectedObjects.Length > 0)
3030for (int i = 0; i < _selectedObjects.Length; i++)
3059for (index = 0; index < _viewSortButtons.Length; index++)
3112_selectedObjects.Length > 0)
3427if (tabScope <= PropertyTabScope.Component && _selectedObjects is not null && _selectedObjects.Length > 0)
3447for (int i = 0; i < tabAttribute.TabClasses.Length; i++)
3493object[] newComponents = new object[components!.Length - 1];
3495Array.Copy(components, index + 1, newComponents, index, components.Length - index - 1);
3500killTab = components is not null && components.Length == 0;
3647for (int i = 0; i < _selectedObjects.Length; ++i)
3764if (state >= (_tabs.Count * _viewSortButtons.Length))
3770state = (_tabs.Count * _viewSortButtons.Length) - 1;
3781int viewTypes = _viewSortButtons.Length;
3788Debug.Assert(view < _viewSortButtons.Length, "Can't select view type > 1");
4044for (int i = 0; _connectionPointCookies is not null && i < _connectionPointCookies.Length; i++)
4053if (_selectedObjects is null || _selectedObjects.Length == 0)
4060if (_connectionPointCookies is null || (_selectedObjects.Length > _connectionPointCookies.Length))
4062_connectionPointCookies = new AxHost.ConnectionPointCookie[_selectedObjects.Length];
4065for (int i = 0; i < _selectedObjects.Length; i++)
4149if (_selectedObjects is not null && _selectedObjects.Length > 0)
System\Windows\Forms\Layout\TableLayout.cs (34)
27if (array.Length > 1)
30sorter.QuickSort(0, array.Length - 1);
119CommonProperties.SetLayoutBounds(containerInfo.Container, new Size(SumStrips(containerInfo.Columns, 0, containerInfo.Columns.Length),
120SumStrips(containerInfo.Rows, 0, containerInfo.Rows.Length)));
180if (tempInfo.Columns is not null && containerInfo.Columns is not null && (tempInfo.Columns.Length != containerInfo.Columns.Length))
185if (tempInfo.Rows is not null && containerInfo.Rows is not null && (tempInfo.Rows.Length != containerInfo.Rows.Length))
226if (cols.Length != 0 && totalSpace.Width > usedSpace.Width)
231if (rows.Length != 0 && totalSpace.Height > usedSpace.Height)
473if (containerInfo.Rows is null || containerInfo.Rows.Length != numRows)
478if (containerInfo.Columns is null || containerInfo.Columns.Length != numColumns)
493for (int i = ++index; i < layoutInfo.Length; i++)
502index = layoutInfo.Length;
655for (int i = 0; i < strips.Length; i++)
741int colStop = Math.Min(layoutInfo.ColumnStart + layoutInfo.ColumnSpan, containerInfo.Columns.Length);
762for (int i = 0; i < strips.Length; i++)
782for (int i = 0; i < strips.Length; i++)
858int rowStop = Math.Min(layoutInfo.RowStart + layoutInfo.RowSpan, containerInfo.Rows.Length);
874for (int i = start; i < Math.Min(start + span, strips.Length); i++)
951if (!(i == strips.Length - 1) // this is not the last strip
1025for (int i = 0; i < strips.Length; i++)
1089totalPercentAllocatedSpace = maxSize - totalAbsoluteAndAutoSizeAllocatedSpace - (strips.Length * cellBorderWidth);
1093for (int i = 0; i < strips.Length; i++)
1117for (int i = 0; i < strips.Length; i++)
1151for (int i = 0; i < strips.Length; i++)
1169Debug.Assert((dontHonorConstraint || (usedSpace == SumStrips(strips, 0, strips.Length))), "Error computing usedSpace.");
1194for (int i = 0; i < childrenInfo.Length; i++)
1231for (; currentCol < colStop && currentCol < containerInfo.Columns.Length; currentCol++)
1245for (int rowIndex = currentRow; rowIndex < rowStop && rowIndex < containerInfo.Rows.Length; rowIndex++)
1428Debug.Assert((containerInfo.Columns is null && cols is null) || containerInfo.Columns!.Length == cols.Length,
1430Debug.Assert((containerInfo.Rows is null && rows is null) || containerInfo.Rows!.Length == rows.Length,
System.Windows.Forms.Analyzers.CSharp (1)
System.Windows.Forms.Design (326)
System.Windows.Forms.Primitives (11)
System.Xaml (100)
testhost (1)
testhost.arm64 (1)
testhost.x86 (1)
TestingAppHost1.MyWebApp (1)
TestProject.AppHost (2)
tlens (14)
UIAutomationClient (67)
UIAutomationClientSideProviders (63)
UIAutomationProvider (1)
UIAutomationTypes (20)
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (17)
2331get { return buffer.Length; }
2336IntPtr result = Marshal.AllocCoTaskMem(buffer.Length);
2337Marshal.Copy(buffer, 0, result, buffer.Length);
2345while (i < buffer.Length && buffer[i] != 0)
2350if (i < buffer.Length)
2360Marshal.Copy(ptr, buffer, 0, buffer.Length);
2367int count = Math.Min(bytes.Length, buffer.Length - offset);
2372if (offset < buffer.Length)
2389get { return buffer.Length; }
2394IntPtr result = Marshal.AllocCoTaskMem(buffer.Length * 2);
2395Marshal.Copy(buffer, 0, result, buffer.Length);
2403while (i < buffer.Length && buffer[i] != 0)
2408if (i < buffer.Length)
2417Marshal.Copy(ptr, buffer, 0, buffer.Length);
2423int count = Math.Min(s.Length, buffer.Length - offset);
2428if (offset < buffer.Length)
UnitTests.Common (12)
vbc (2)
VBCSCompiler (3)
vstest.console (13)
vstest.console.arm64 (13)
Yarp.Backend (1)