28215 references to Length
aspire (293)
Certificates\CertificateGeneration\CertificateManager.cs (8)
235if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
700Array.Clear(keyBytes, 0, keyBytes.Length);
701Array.Clear(pem, 0, pem.Length);
707Array.Clear(keyBytes, 0, keyBytes.Length);
708Array.Clear(pem, 0, pem.Length);
758Array.Clear(bytes, 0, bytes.Length);
786Array.Clear(pemEnvelope, 0, pemEnvelope.Length);
aspire-managed (2)
Aspire.Acquisition.Tests (4)
Aspire.Azure.AI.Inference.Tests (1)
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 (5)
Aspire.Cli.Tests (64)
Aspire.Components.Common.TestUtilities (1)
Aspire.Confluent.Kafka.Tests (1)
Aspire.Dashboard (88)
Aspire.Dashboard.Components.Tests (1)
Aspire.Dashboard.Tests (28)
Aspire.Deployment.EndToEnd.Tests (3)
Aspire.Hosting (118)
Aspire.Hosting.Analyzers (5)
Aspire.Hosting.Azure (10)
Aspire.Hosting.Azure.AppConfiguration (3)
Aspire.Hosting.Azure.AppContainers (8)
Aspire.Hosting.Azure.AppService (4)
Aspire.Hosting.Azure.CognitiveServices (3)
Aspire.Hosting.Azure.ConnectorNamespace (1)
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.Kubernetes (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 (7)
Aspire.Hosting.Azure.WebPubSub (3)
Aspire.Hosting.Blazor (3)
Aspire.Hosting.Blazor.Tests (3)
Aspire.Hosting.Browsers (9)
Aspire.Hosting.Browsers.Tests (13)
Aspire.Hosting.CodeGeneration.Go (1)
Aspire.Hosting.CodeGeneration.Java (4)
Aspire.Hosting.CodeGeneration.Java.Tests (1)
Aspire.Hosting.CodeGeneration.Python (2)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (2)
Aspire.Hosting.DevTunnels.Tests (1)
Aspire.Hosting.Docker (4)
Aspire.Hosting.Dotnet (9)
Aspire.Hosting.Dotnet.Tests (3)
Aspire.Hosting.EntityFrameworkCore (3)
Aspire.Hosting.Foundry (10)
Aspire.Hosting.Foundry.Tests (1)
Aspire.Hosting.Go (2)
Aspire.Hosting.Go.Tests (1)
Aspire.Hosting.Integration.Analyzers (6)
Aspire.Hosting.Java (18)
Aspire.Hosting.JavaScript (9)
Aspire.Hosting.JavaScript.Tests (2)
Aspire.Hosting.Kubernetes (8)
Aspire.Hosting.Kubernetes.Tests (5)
Aspire.Hosting.Maui (7)
Aspire.Hosting.PostgreSQL (1)
Aspire.Hosting.PostgreSQL.Tests (1)
Aspire.Hosting.Qdrant.Tests (1)
Aspire.Hosting.Radius.Tests (6)
Aspire.Hosting.Redis.Tests (1)
Aspire.Hosting.RemoteHost (59)
Aspire.Hosting.RemoteHost.Tests (5)
Aspire.Hosting.Rust (9)
Aspire.Hosting.Testing (1)
Aspire.Hosting.Testing.Tests (5)
Aspire.Hosting.Tests (51)
Aspire.Hosting.Yarp (5)
Aspire.Hosting.Yarp.Tests (2)
Aspire.Microsoft.Azure.Cosmos (2)
Aspire.Microsoft.EntityFrameworkCore.Cosmos (2)
Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration (2)
Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration.Tests (1)
Aspire.Milvus.Client.Tests (1)
Aspire.Playground.Tests (6)
Aspire.Qdrant.Client.Tests (1)
Aspire.RabbitMQ.Client.Tests (3)
Aspire.RabbitMQ.Client.v6.Tests (3)
Aspire.Templates.Tests (1)
Aspire.TerminalHost (5)
Aspire.TerminalHost.Tests (15)
Aspire.TestUtilities (4)
AspireJavaScript.MinimalApi (1)
AspireWithMaui.WeatherApi (1)
AspireWithNode.AspNetCoreApi (1)
AzureFunctionsEndToEnd.Functions (1)
Binding.Http.IntegrationTests (1)
BlazorHosted.WeatherApi (1)
BlazorStandalone.WeatherApi (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 (2)
dotnet-aot (103)
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 (15)
dotnet-getdocument (6)
dotnet-Microsoft.XmlSerializer.Generator (10)
dotnet-openapi (12)
dotnet-razorpagegenerator (3)
dotnet-sourcelink (1)
dotnet-sql-cache (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-svcutil.xmlserializer (5)
dotnet-user-jwts (14)
dotnet-user-secrets (7)
dotnet-watch (1)
DotNetHostedAgent (1)
EventSourceGenerator (1)
Extensibility.MessageEncoder.IntegrationTests (1)
Extensibility.WebSockets.IntegrationTests (3)
GenerateAnalyzerNuspec (8)
GenerateDocumentationAndConfigFiles (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);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
55if (typeArguments.Length == 0)
GetDocument.Insider (8)
ilasm (4)
ILAssembler (72)
GrammarVisitor.cs (62)
792if (dottedNames.Length > 1)
828if (indices.Length == 0)
836return (indices.Length, hasEllipsis) switch
1194else if (context.customAttrDecl().Length == 1 && context.PARAM() is null)
1364if (typarContexts.Length > ushort.MaxValue)
1367string.Format(DiagnosticMessageTemplates.TooManyGenericParameters, typarContexts.Length, ushort.MaxValue),
1370for (int i = 0; i < typarContexts.Length; i++)
1383for (int i = 0; i < typarContexts.Length; i++)
1453if (typarContexts.Length > ushort.MaxValue)
1456string.Format(DiagnosticMessageTemplates.TooManyGenericParameters, typarContexts.Length, ushort.MaxValue),
1459for (int i = 0; i < typarContexts.Length; i++)
1471for (int i = 0; i < typarContexts.Length; i++)
1792blob.WriteInt16((short)fieldOrProps.Length);
1794for (int i = 0; i < fieldOrProps.Length; i++)
2115_manifestResources.WriteInt32(resourceData.Length);
2507for (int i = 0; i < declarations.Length; i++)
2653if (int32s.Length >= 1)
2658if (int32s.Length >= 2)
2674if (int32s.Length >= 3)
2679if (int32s.Length >= 4)
2798var marshalBlob = marshalBlobs.Length > 0 ? VisitMarshalBlob(marshalBlobs[marshalBlobs.Length - 1]).Value : null;
3143if (ids.Length == 2)
3150if (offsets.Length == 2)
3190var builder = ImmutableArray.CreateBuilder<short>(values.Length);
3201var builder = ImmutableArray.CreateBuilder<int>(values.Length);
3213var builder = ImmutableArray.CreateBuilder<byte>(values.Length);
3225var builder = ImmutableArray.CreateBuilder<long>(values.Length);
3433if (bytes.Length >= 8)
3437else if (bytes.Length >= 4)
3880if (strings.Length >= 1 && Guid.TryParse(VisitLanguageString(strings[0]).Value, out var languageGuid))
3884if (strings.Length >= 2 && Guid.TryParse(VisitLanguageString(strings[1]).Value, out var vendorGuid))
3888if (strings.Length >= 3 && Guid.TryParse(VisitLanguageString(strings[2]).Value, out var docTypeGuid))
3952string alias = dottedNames.Length == 2 ? VisitDottedName(dottedNames[1]).Value : name;
3977if (hexBytes.Length > 0)
3979var blob = new BlobBuilder(hexBytes.Length);
4187if (context.int32() is { Length: > 0 } int32)
4228if (context.int32() is { Length: > 0 } int32)
4363if (typarContexts.Length > ushort.MaxValue)
4366string.Format(DiagnosticMessageTemplates.TooManyGenericParameters, typarContexts.Length, ushort.MaxValue),
4369for (int i = 0; i < typarContexts.Length; i++)
4377if (typarContexts.Length != 0)
4435if (typarContexts.Length != 0)
4437methodSignature.WriteCompressedInteger(typarContexts.Length);
4440for (int i = 0; i < typarContexts.Length; i++)
4538numGenericParameters = types.Length;
4539if (types.Length != 0)
4622var prefix = new BlobBuilder(arrayPointerInfo.Length);
4626for (int i = arrayPointerInfo.Length - 1; i >= 0; i--)
4649for (int i = 0; i < arrayPointerInfo.Length; i++)
4699if (strings.Length == 4)
4711Debug.Assert(strings.Length == 2);
4886if (context.compQstring() is { Length: 1 } safeArrayCustomType)
5029string? moduleName = names.Length > 0 ? VisitCompQstring(names[0]).Value : null;
5030string? entryPointName = names.Length > 1 ? VisitCompQstring(names[1]).Value : null;
5163blob.WriteCompressedInteger(secAttributes.Length);
5574if (ids.Length == 2)
5581if (offsets.Length == 2)
5649ImmutableArray<EntityRegistry.GenericParameterEntity>.Builder builder = ImmutableArray.CreateBuilder<EntityRegistry.GenericParameterEntity>(typeParameters.Length);
5676for (int i = typeModifiers.Length - 1; i >= 0; i--)
5765blob.WriteCompressedInteger(types.Length);
5896ImmutableArray<EntityRegistry.TypeEntity>.Builder builder = ImmutableArray.CreateBuilder<EntityRegistry.TypeEntity>(bounds.Length);
ilc (6)
ILCompiler.Build.Tasks (1)
ILCompiler.Compiler (309)
Compiler\TypePreinit.cs (52)
187if (ehRegions != null && ehRegions.Length > 0)
206Value[] locals = new Value[localTypes.Length];
207for (int i = 0; i < localTypes.Length; i++)
583if (finalizerMethodILBytes.Length != 1 || finalizerMethodILBytes[0] != (byte)ILOpcode.ret)
1067if (index >= locals.Length)
1090if (index >= locals.Length)
1122if (index >= storage.Length)
1561if (addition > previousByRef.PointedToBytes.Length - previousByRef.PointedToOffset
1845if (sizeBytes > addressValue.PointedToBytes.Length - addressValue.PointedToOffset
1938if (rvaData.Length % elementSize != 0)
1940retVal = new SpanValue(elementType, rvaData, 0, rvaData.Length);
2342public override int Size => InstanceBytes.Length;
2379Array.Copy(vtvalue.InstanceBytes, InstanceBytes, InstanceBytes.Length);
2386|| vtvalue.InstanceBytes.Length != InstanceBytes.Length)
2392for (int i = 0; i < InstanceBytes.Length; i++)
2418if (InstanceBytes.Length != size)
2445public override int Size => _entryType.InstanceFieldSize.AsInt * _targetFields.Length;
2505for (int i = 0; i < _targetFields.Length; i++)
2510Debug.Assert(_entryType.GetField("Vtable"u8).Offset.AsInt == _guidBytes[i].Length);
2568&& guidValue.Size == _parent._guidBytes[_index].Length)
2570Array.Copy(guidValue.InstanceBytes, _parent._guidBytes[_index], _parent._guidBytes[_index].Length);
2602&& field.Offset.AsInt < _parent._entryType.InstanceFieldSize.AsInt * _parent._targetFields.Length)
2636public override int Size => _methods.Length * _type.Context.Target.PointerSize;
2707Array.Copy(other._methods, _methods, other._methods.Length);
2746&& _parent._methods.Length - _index >= otherStruct._methods.Length)
2748Array.Copy(otherStruct._methods, 0, _parent._methods, _index, otherStruct._methods.Length);
2759|| mdType.InstanceFieldSize.AsInt > (_parent._methods.Length - _index) * _parent._type.Context.Target.PointerSize)
2766Array.Copy(_parent._methods, _index, slots, 0, slots.Length);
2782if (index >= _parent._methods.Length)
2818if (_index + numSlots > _parent._methods.Length)
2938Debug.Assert(index <= bytes.Length);
2939Debug.Assert(length <= bytes.Length - index);
3134if ((uint)size > (uint)(PointedToBytes.Length - PointedToOffset))
3153if (PointedToOffset + src.Length > PointedToBytes.Length)
3156Array.Copy(src, 0, PointedToBytes, PointedToOffset, src.Length);
3164|| ((MetadataType)type).InstanceFieldSize.AsInt > PointedToBytes.Length - PointedToOffset)
3171Array.Copy(PointedToBytes, PointedToOffset, result.InstanceBytes, 0, result.InstanceBytes.Length);
3371if (bytes.Length != _data.Length)
3374Array.Copy(bytes, _data, bytes.Length);
3394Debug.Assert(valueToStore.InstanceBytes.Length == _elementSize);
3395Array.Copy(valueToStore.InstanceBytes, 0, _data, index * _elementSize, valueToStore.InstanceBytes.Length);
3488int length = _value.Length - startOffset - sizeof(char) /* terminating null */;
3573Array.Copy(valuetype.InstanceBytes, 0, result._data, type.Context.Target.PointerSize, valuetype.InstanceBytes.Length);
3588Array.Copy(_data, type.Context.Target.PointerSize, result.InstanceBytes, 0, result.InstanceBytes.Length);
3612builder.EmitBytes(_data, pointerSize, _data.Length - pointerSize);
3656if (fieldOffset + fieldSize > _instanceBytes.Length - _offset)
3678if (fieldOffset + fieldSize > _instanceBytes.Length - _offset)
3708if (fieldOffset + fieldSize > _instanceBytes.Length - _offset)
ILCompiler.DependencyAnalysisFramework (1)
ILCompiler.Diagnostics (9)
ILCompiler.MetadataTransform (64)
ILCompiler.ReadyToRun (240)
ILCompiler.RyuJit (60)
ILCompiler.TypeSystem (137)
illink (39)
ILLink.RoslynAnalyzer (9)
ILLink.Tasks (2)
Infrastructure.Common (9)
Infrastructure.Tests (58)
PowerShellScripts\ExpandTestMatrixGitHubTests.cs (10)
126Assert.Equal(3, expanded.Include.Length);
311Assert.Equal(3, expanded.Include.Length);
363Assert.Equal(3, expanded.Include.Length);
396Assert.Equal(2, expanded.Include.Length);
425Assert.Equal(3, expanded.Include.Length);
464Assert.Equal(3, expanded.Include.Length);
498Assert.Equal(3, expanded.Include.Length);
585Assert.Equal(3, regularEntries.Length);
589Assert.Equal(6, splitEntries.Length);
607Assert.Equal(9, noNugets.Include.Length);
installer.tasks (19)
Keycloak.ApiService (1)
Microsoft.Analyzers.Extra (1)
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.Analyzers.Local (2)
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.Certificate (1)
Microsoft.AspNetCore.Authentication.Cookies (1)
Microsoft.AspNetCore.Authentication.Facebook (1)
Microsoft.AspNetCore.Authentication.Google (1)
Microsoft.AspNetCore.Authentication.JwtBearer (1)
Microsoft.AspNetCore.Authentication.MicrosoftAccount (1)
Microsoft.AspNetCore.Authentication.OAuth (1)
Microsoft.AspNetCore.Authentication.OpenIdConnect (3)
Microsoft.AspNetCore.Authentication.Twitter (1)
Microsoft.AspNetCore.Authentication.WsFederation (1)
Microsoft.AspNetCore.Authorization (3)
Microsoft.AspNetCore.Authorization.Policy (2)
Microsoft.AspNetCore.Components (90)
Microsoft.AspNetCore.Components.AI (1)
Microsoft.AspNetCore.Components.Analyzers (2)
Microsoft.AspNetCore.Components.Authorization (3)
Microsoft.AspNetCore.Components.Endpoints (34)
Microsoft.AspNetCore.Components.Forms (1)
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
Microsoft.AspNetCore.Components.Server (56)
Microsoft.AspNetCore.Components.Testing (2)
Microsoft.AspNetCore.Components.Web (4)
Microsoft.AspNetCore.Components.WebAssembly (21)
Microsoft.AspNetCore.Components.WebAssembly.Authentication (1)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Microsoft.AspNetCore.Components.WebView (24)
Microsoft.AspNetCore.Connections.Abstractions (6)
Microsoft.AspNetCore.Cors (1)
Microsoft.AspNetCore.Cryptography.Internal (1)
Microsoft.AspNetCore.Cryptography.KeyDerivation (14)
Microsoft.AspNetCore.DataProtection (67)
Managed\ManagedAuthenticatedEncryptor.cs (5)
647CryptoUtil.Assert(ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes, "ciphertext != null && ciphertext.Length == _symmetricAlgorithmBlockSizeInBytes");
648Buffer.BlockCopy(ciphertext, 0, retVal, idx, ciphertext.Length);
658CryptoUtil.Assert(digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes, "digest != null && digest.Length == _validationAlgorithmDigestLengthInBytes");
659Buffer.BlockCopy(digest, 0, retVal, idx, digest.Length);
663CryptoUtil.Assert(idx == retVal.Length, "idx == retVal.Length");
Microsoft.AspNetCore.DataProtection.Abstractions (7)
Microsoft.AspNetCore.DataProtection.Extensions (6)
Microsoft.AspNetCore.DataProtection.MicroBenchmarks (19)
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.EntityFrameworkCore (1)
Microsoft.AspNetCore.Diagnostics.HealthChecks (1)
Microsoft.AspNetCore.Diagnostics.Middleware (15)
Microsoft.AspNetCore.Diagnostics.Middleware.PerformanceTests (1)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (12)
Microsoft.AspNetCore.Grpc.JsonTranscoding (3)
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.Connections.Client (1)
Microsoft.AspNetCore.Http.Extensions (66)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (18)
68if (parameters.Length == 0)
76for (var i = 0; i < parameters.Length; i++)
90List<ParameterInfo> list = new(parameters.Length);
106if (constructor is not null && constructorParameters is { Length: > 0 })
145if (constructorAttributes == null || constructorAttributes.Length == 0)
151if (propertyAttributes.Length == 0)
158var mergedAttributes = Array.CreateInstanceFromArrayType(arrayType, constructorAttributes.Length + propertyAttributes.Length);
159Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
160Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
171if (constructorAttributes == null || constructorAttributes.Length == 0)
177if (propertyAttributes.Length == 0)
184var mergedAttributes = Array.CreateInstanceFromArrayType(arrayType, constructorAttributes.Length + propertyAttributes.Length);
185Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
186Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
Microsoft.AspNetCore.Http.RequestDelegateGenerator (18)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.HttpLogging (20)
Microsoft.AspNetCore.HttpOverrides (33)
Microsoft.AspNetCore.Identity (7)
Microsoft.AspNetCore.Identity.EntityFrameworkCore (1)
Microsoft.AspNetCore.Identity.UI (5)
Microsoft.AspNetCore.InternalTesting (1)
Microsoft.AspNetCore.JsonPatch (4)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (3)
Microsoft.AspNetCore.Localization (4)
Microsoft.AspNetCore.Mvc.Abstractions (15)
Microsoft.AspNetCore.Mvc.ApiExplorer (19)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (18)
68if (parameters.Length == 0)
76for (var i = 0; i < parameters.Length; i++)
90List<ParameterInfo> list = new(parameters.Length);
106if (constructor is not null && constructorParameters is { Length: > 0 })
145if (constructorAttributes == null || constructorAttributes.Length == 0)
151if (propertyAttributes.Length == 0)
158var mergedAttributes = Array.CreateInstanceFromArrayType(arrayType, constructorAttributes.Length + propertyAttributes.Length);
159Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
160Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
171if (constructorAttributes == null || constructorAttributes.Length == 0)
177if (propertyAttributes.Length == 0)
184var mergedAttributes = Array.CreateInstanceFromArrayType(arrayType, constructorAttributes.Length + propertyAttributes.Length);
185Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
186Array.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.NewtonsoftJson (3)
Microsoft.AspNetCore.Mvc.Razor (9)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (8)
Microsoft.AspNetCore.Mvc.RazorPages (20)
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.Testing (6)
Microsoft.AspNetCore.Mvc.ViewFeatures (38)
Microsoft.AspNetCore.OpenApi (46)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (18)
68if (parameters.Length == 0)
76for (var i = 0; i < parameters.Length; i++)
90List<ParameterInfo> list = new(parameters.Length);
106if (constructor is not null && constructorParameters is { Length: > 0 })
145if (constructorAttributes == null || constructorAttributes.Length == 0)
151if (propertyAttributes.Length == 0)
158var mergedAttributes = Array.CreateInstanceFromArrayType(arrayType, constructorAttributes.Length + propertyAttributes.Length);
159Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
160Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
171if (constructorAttributes == null || constructorAttributes.Length == 0)
177if (propertyAttributes.Length == 0)
184var mergedAttributes = Array.CreateInstanceFromArrayType(arrayType, constructorAttributes.Length + propertyAttributes.Length);
185Array.Copy(constructorAttributes, mergedAttributes, constructorAttributes.Length);
186Array.Copy(propertyAttributes, 0, mergedAttributes, constructorAttributes.Length, propertyAttributes.Length);
Microsoft.AspNetCore.OutputCaching (21)
Microsoft.AspNetCore.Owin (2)
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 (16)
Microsoft.AspNetCore.Server.IIS (17)
Core\IISHttpContext.cs (4)
482(uint)buffer.Length,
676NativeMethods.HttpResponseSetUnknownHeader(_requestNativeHandle, pHeaderName, pHeaderValue, (ushort)headerValueBytes.Length, fReplace: isFirst);
681NativeMethods.HttpResponseSetKnownHeader(_requestNativeHandle, knownHeaderIndex, pHeaderValue, (ushort)headerValueBytes.Length, fReplace: isFirst);
715NativeMethods.HttpResponseSetTrailer(_requestNativeHandle, pHeaderName, pHeaderValue, (ushort)headerValueBytes.Length, replace: isFirst);
Microsoft.AspNetCore.Server.IntegrationTesting (2)
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.DirectTls (4)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (2)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (5)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
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.Client.Core (15)
HubConnection.cs (12)
1031var newArgsCount = args.Length;
1033Span<bool> isStreaming = args.Length <= MaxStackSize
1034? stackalloc bool[MaxStackSize].Slice(0, args.Length)
1035: new bool[args.Length];
1036for (var i = 0; i < args.Length; i++)
1061if (newArgsCount == args.Length)
1071for (var i = 0; i < args.Length; i++)
1142Debug.Assert(genericTypes.Length == 1);
1445Log.PreparingBlockingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName!, args.Length);
1476Log.PreparingStreamingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName!, args.Length);
1550Log.PreparingNonBlockingInvocation(_logger, methodName, args.Length);
2730if (handlers.Length > 0)
Microsoft.AspNetCore.SignalR.Common (5)
Microsoft.AspNetCore.SignalR.Core (22)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (8)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (5)
Microsoft.AspNetCore.SignalR.Specification.Tests (5)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (5)
Microsoft.AspNetCore.SpaServices.Extensions (1)
Microsoft.AspNetCore.StaticFiles (4)
Microsoft.AspNetCore.TestHost (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 (342)
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);
1016Assumed.Equal(requests.Length, results.Length, "# results != # requests");
1036for (int i = 0; i < requests.Length; i++)
1236ProjectErrorUtilities.VerifyThrowInvalidProject(allTargets.Length > 0,
BackEnd\Components\RequestBuilder\TaskHost.cs (26)
292ErrorUtilities.VerifyThrowArgument((targetOutputsPerProject == null) || (projectFileNames.Length == targetOutputsPerProject.Length), "General.TwoVectorsMustHaveSameLength", projectFileNames.Length, targetOutputsPerProject?.Length ?? 0, "projectFileNames", "targetOutputsPerProject");
294BuildEngineResult result = BuildProjectFilesInParallel(projectFileNames, targetNames, globalProperties, new List<String>[projectFileNames.Length], toolsVersion, includeTargetOutputs);
300Assumed.Equal(targetOutputsPerProject.Length, result.TargetOutputsPerProject.Count, $"{targetOutputsPerProject.Length} != {result.TargetOutputsPerProject.Count}");
302for (int i = 0; i < targetOutputsPerProject.Length; i++)
1013if (projectFileNames.Length == 1 && projectFileNames[0] == null && globalProperties[0] == null && (undefineProperties == null || undefineProperties[0] == null) && toolsVersion[0] == null)
1027for (int i = 0; i < targetNames.Length; i++)
1193if (projectFileNames.Length == 1 && projectFileNames[0] == null && globalProperties[0] == null && (undefineProperties == null || undefineProperties[0] == null) && toolsVersion[0] == null)
1206for (int i = 0; i < targetNames.Length; i++)
1218PropertyDictionary<ProjectPropertyInstance>[] propertyDictionaries = new PropertyDictionary<ProjectPropertyInstance>[projectFileNames.Length];
1220for (int i = 0; i < projectFileNames.Length; i++)
1254Assumed.Equal(results.Length, projectFileNames.Length, $"{results.Length}!={projectFileNames.Length}.");
1258targetOutputsPerProject = new List<IDictionary<string, ITaskItem[]>>(results.Length);
1262for (int i = 0; i < results.Length; i++)
1273ITaskItem[] clonedTaskItem = new ITaskItem[resultEntry.Value.Items.Length];
1274for (int j = 0; j < resultEntry.Value.Items.Length; j++)
1299Assumed.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.ItemExpander.Transforms.cs (28)
102ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
157ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
211ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
240ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
324ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
399ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
483ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
507ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
526ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
856ProjectErrorUtilities.VerifyThrowInvalidProject(arguments == null || arguments.Length == 0, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
878ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 1, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
917ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
955ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
993ProjectErrorUtilities.VerifyThrowInvalidProject(arguments?.Length == 2, elementLocation, "InvalidItemFunctionSyntax", functionName, arguments == null ? 0 : arguments.Length);
Microsoft.Build.Framework (81)
Microsoft.Build.Tasks.CodeAnalysis (19)
Microsoft.Build.Tasks.Core (233)
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 (33)
Microsoft.CodeAnalysis (353)
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 (180)
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 (162)
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.BuildClient.Package (2)
Microsoft.CodeAnalysis.CodeStyle (164)
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 (862)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.CSharp.Features (12)
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (2)
Microsoft.CodeAnalysis.CSharp.Workspaces (12)
Microsoft.CodeAnalysis.Extensions.Package (65)
Microsoft.CodeAnalysis.Features (35)
Microsoft.CodeAnalysis.NetAnalyzers (38)
Microsoft.CodeAnalysis.Razor.Compiler (167)
Microsoft.CodeAnalysis.Rebuild (4)
Microsoft.CodeAnalysis.ResxSourceGenerator (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.Scripting (17)
Microsoft.CodeAnalysis.VisualBasic (101)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.VisualBasic.Features (8)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Microsoft.CodeAnalysis.Workspaces (204)
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 (26)
Contracts\EcmaMetadata_1.cs (6)
205BlobWriter stringsOffset = WriteStreamHeader(builder, "#Strings", (int)AlignUp((ulong)targetEcmaMetadata.StringHeap.Length, 4ul));
206BlobWriter blobOffset = WriteStreamHeader(builder, "#Blob", (int)AlignUp((ulong)targetEcmaMetadata.BlobHeap.Length, 4ul));
207BlobWriter guidOffset = WriteStreamHeader(builder, "#GUID", (int)AlignUp((ulong)targetEcmaMetadata.GuidHeap.Length, 4ul));
208BlobWriter userStringOffset = WriteStreamHeader(builder, "#US", (int)AlignUp((ulong)targetEcmaMetadata.UserStringHeap.Length, 4ul));
298for (int i = heap.Length; i < (int)AlignUp((ulong)heap.Length, 4ul); i++)
Microsoft.Diagnostics.DataContractReader.DataGenerator (6)
Microsoft.Diagnostics.DataContractReader.Legacy (57)
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.FileCatalog (4)
Microsoft.DotNet.Build.Tasks.Installers (28)
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 (13)
Microsoft.DotNet.Cli.Telemetry (5)
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 (21)
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 (14)
Microsoft.DotNet.XliffTasks (2)
Microsoft.Extensions.AI (20)
Microsoft.Extensions.AI.Abstractions (16)
Microsoft.Extensions.AI.Abstractions.Tests (13)
Microsoft.Extensions.AI.Evaluation.NLP (22)
Microsoft.Extensions.AI.Evaluation.NLP.Tests (7)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (6)
Microsoft.Extensions.AI.Evaluation.Tests (6)
Microsoft.Extensions.AI.Integration.Tests (3)
Microsoft.Extensions.AI.OpenAI (7)
Microsoft.Extensions.AI.OpenAI.Tests (10)
Microsoft.Extensions.AI.Tests (6)
Microsoft.Extensions.AsyncState.Tests (1)
Microsoft.Extensions.Caching.Abstractions (2)
Microsoft.Extensions.Caching.Hybrid (20)
Microsoft.Extensions.Caching.Hybrid.Tests (19)
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 (5)
Microsoft.Extensions.Caching.SqlServer (2)
Microsoft.Extensions.Caching.StackExchangeRedis (6)
Microsoft.Extensions.Compliance.Abstractions.Tests (3)
Microsoft.Extensions.Compliance.Testing.Tests (5)
Microsoft.Extensions.Configuration.Binder (15)
Microsoft.Extensions.Configuration.Binder.SourceGeneration (2)
Microsoft.Extensions.DataIngestion (9)
Microsoft.Extensions.DataIngestion.Tests (11)
Microsoft.Extensions.DependencyInjection (37)
Microsoft.Extensions.DependencyInjection.Abstractions (46)
Microsoft.Extensions.DependencyModel (10)
Microsoft.Extensions.Diagnostics (3)
Microsoft.Extensions.Diagnostics.Abstractions (2)
Microsoft.Extensions.Diagnostics.HealthChecks (4)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (15)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (14)
Microsoft.Extensions.Diagnostics.Testing (2)
Microsoft.Extensions.DotNetDeltaApplier (7)
Microsoft.Extensions.FileProviders.Embedded (3)
Microsoft.Extensions.FileProviders.Embedded.Manifest.Task (2)
Microsoft.Extensions.Hosting (1)
Microsoft.Extensions.Http (3)
Microsoft.Extensions.Http.Diagnostics (6)
Microsoft.Extensions.Http.Diagnostics.Tests (5)
Microsoft.Extensions.Http.Polly (1)
Microsoft.Extensions.Http.Resilience.Tests (2)
Microsoft.Extensions.Identity.Core (18)
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.ML.Tests (1)
Microsoft.Extensions.Options (2)
Microsoft.Extensions.Options.Contextual (2)
Microsoft.Extensions.Options.DataAnnotations (2)
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 (21)
Microsoft.Extensions.Telemetry.Abstractions (4)
Microsoft.Extensions.Telemetry.Abstractions.Tests (4)
Microsoft.Extensions.Telemetry.Tests (30)
Microsoft.Extensions.TimeProvider.Testing.Tests (1)
Microsoft.Extensions.Validation.ValidationsGenerator (2)
Microsoft.Extensions.VectorData.ConformanceTests (5)
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 (5)
Microsoft.ML.Core (230)
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 (44)
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 (18)
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 (1153)
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 (483)
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 (58)
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);
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 (20)
Microsoft.ML.IntegrationTests (28)
Microsoft.ML.InternalCodeAnalyzer (4)
Microsoft.ML.KMeansClustering (18)
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 (51)
Microsoft.ML.NugetPackageVersionUpdater (1)
Microsoft.ML.OnnxTransformer (20)
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)
parent\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 (52)
Microsoft.ML.TensorFlow.Tests (19)
TensorflowTests.cs (19)
305Assert.Equal(sample.OneDim.Length, oneDimValues.Length);
309Assert.Equal(sample.TwoDim.Length, twoDimValues.Length);
313Assert.Equal(sample.ThreeDim.Length, threeDimValues.Length);
317Assert.Equal(sample.FourDim.Length, fourDimValues.Length);
321Assert.Equal(sample.FourDimKnown.Length, fourDimKnownValues.Length);
748if (directories != null && directories.Length > 0)
956for (int i = 0; i < onePrediction.PredictedLabels.Length; i++)
1192for (var i = 0; i < predictions.Length; i++)
1194for (var j = 0; j < predictions[i].PredictedScores.Length; j++)
1285Assert.Equal(2, prediction.Prediction.Length);
1348for (int i = 0; i < input.A.Length; i++)
1539string[] labels = new string[directories.Length];
1540for (int j = 0; j < labels.Length; j++)
1568Assert.Equal((int)labelCountFirst, predictionFirst.Score.Length);
1569Assert.Equal((int)labelCountSecond, predictionSecond.Score.Length);
1698string[] labels = new string[directories.Length];
1699for (int j = 0; j < labels.Length; j++)
1727Assert.Equal((int)labelCountFirst, predictionFirst.Score.Length);
1728Assert.Equal((int)labelCountSecond, predictionSecond.Score.Length);
Microsoft.ML.TestFramework (25)
Microsoft.ML.TestFrameworkCommon (1)
Microsoft.ML.Tests (88)
FastTreeSumupParityTests.cs (7)
107var input = CreateInputForLength(values.Length, seed: 3, useWeights, useIndices,
256var work = new uint[values.Length];
258for (int i = 0; i < values.Length; i++)
265SegmentIntArray.ManagedSegmentFindOptimalPath(work, work.Length, maxBits, out long bits, out int transitions);
266return SegmentIntArray.FromWorkArray(work, work.Length, bits, transitions);
306count = useIndices ? docIndices.Length : length;
367for (int bin = 0; bin < expectedCounts.Length; bin++)
Microsoft.ML.TimeSeries (110)
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)
409if ((uint)id >= (uint)(_vocabReverse.Length))
421int remainingLength = normalizedString.Length - normalizedStringCountFromEnd;
424char[] utf16NormalizedString = ArrayPool<char>.Shared.Rent(normalizedString.Length << 1);
425normalizedString.AsSpan().Slice(normalizedString.Length - normalizedStringCountFromEnd).CopyTo(utf16NormalizedString.AsSpan(utf16NormalizedString.Length - normalizedStringCountFromEnd));
430text.CopyTo(normalizedString.AsSpan(normalizedString.Length - normalizedStringCountFromEnd - text.Length));
436int remainingLength = normalizedString.Length - normalizedStringCountFromEnd;
441char[] utf16NormalizedString = ArrayPool<char>.Shared.Rent(normalizedString.Length << 1);
442normalizedString.AsSpan().Slice(normalizedString.Length - normalizedStringCountFromEnd).CopyTo(utf16NormalizedString.AsSpan(utf16NormalizedString.Length - normalizedStringCountFromEnd));
447bool res = Helpers.ConvertUtf8ToUtf16(utf8Bytes, normalizedString.AsSpan(normalizedString.Length - normalizedStringCountFromEnd - expectedCount), out int bytesConsumed, out int charsWritten);
460Helpers.ArrayPoolGrow(ref normalizedString, normalizedString.Length << 1);
473Helpers.ArrayPoolGrow(ref normalizedString, normalizedString.Length << 1);
569Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) * 3 <= buffer.Length * sizeof(int));
1015Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
1096else if (unknownTokensTracking.Length == unknownTokensCount)
1113Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
1134Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
1160Debug.Assert(unknownTokensCount > 0 && unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
1202Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount);
1418(int Id, int UtfStartOffset, int Utf8Length)[] ids = ArrayPool<(int Id, int UtfStartOffset, int Utf8Length)>.Shared.Rent(bestPathEndsAt.Length);
1421int idsIndex = ids.Length - 1;
1440if ((!ByteFallback || !unknownEncountered) && (maxTokenCount == int.MaxValue || (tokenCount + ids.Length - idsIndex <= maxTokenCount)))
1444tokenCount += ids.Length - idsIndex;
1462for (int i = idsIndex; tokenCount < maxTokenCount && i < ids.Length; i++)
1591if (splits.Length == 0)
1594normalizedText = normalizedString is not null ? normalizedString.AsSpan(normalizedString.Length - normalizedStringCountFromEnd).ToString() : null;
1598(int Offset, int Length) current = splits[splits.Length - 1];
1606for (int i = splits.Length - 1; i >= 0; i--)
1632normalizedText = normalizedString is not null ? normalizedString.AsSpan().Slice(normalizedString.Length - normalizedStringCountFromEnd).ToString() : null;
1650normalizedText = 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)
180for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
184Assert.True(idsConsumed < ids.Length);
194Assert.Equal(ids.Length, idsConsumed);
655Assert.Equal(expectedIds, tokenizer.EncodeToIds(text, expectedIds.Length, out string? normalizedText, out int length));
658Assert.Equal(expectedIds, tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length, out normalizedText, out length));
662Assert.Equal(expectedIds.Take(expectedIds.Length - 4), tokenizer.EncodeToIds(text, expectedIds.Length - 4, out normalizedText, out length));
664int expectedLength = expectedOffsets[expectedOffsets.Length - 5].Index + expectedOffsets[expectedOffsets.Length - 5].Length;
666Assert.Equal(expectedIds.Take(expectedIds.Length - 4), tokenizer.EncodeToIds(text.AsSpan(), expectedIds.Length - 4, out normalizedText, out length));
670Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text));
671Assert.Equal(expectedIds.Length, tokenizer.CountTokens(text.AsSpan()));
673Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text, expectedIds.Length - 3, out normalizedText, out int tokenCount));
675Assert.Equal(expectedIds.Length - 3, tokenCount);
676Assert.Equal(expectedOffsets[expectedOffsets.Length - 4].Index + expectedOffsets[expectedOffsets.Length - 4].Length, tokenizer.GetIndexByTokenCount(text.AsSpan(), expectedIds.Length - 3, out normalizedText, out tokenCount));
678Assert.Equal(expectedIds.Length - 3, tokenCount);
680Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text, 3, out normalizedText, out tokenCount));
683Assert.Equal(expectedOffsets[expectedOffsets.Length - 3].Index, tokenizer.GetIndexByTokenCountFromEnd(text.AsSpan(), 3, out normalizedText, out tokenCount));
764Assert.Equal(expectedIds.Length, GPT4.CountTokens(text));
766for (int tokenCount = 1; tokenCount <= ids.Length; tokenCount++)
769Assert.True(count <= ids.Length);
773Assert.True(count < ids.Length - 1);
787Assert.True(count <= ids.Length);
791Assert.True(ids.Length - tokenCount > 0);
792Assert.True(offsets[offsets.Length - tokenCount].Index < offsets[offsets.Length - tokenCount - 1].Index + offsets[offsets.Length - tokenCount - 1].Length);
797Assert.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 (33)
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 (483)
Microsoft.ML.Vision (60)
DnnRetrainTransform.cs (55)
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++)
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.Extensions.Tasks (9)
Microsoft.NET.Build.Tasks (63)
Microsoft.NET.HostModel (33)
Microsoft.Net.Http.Headers (3)
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (19)
Microsoft.NET.Sdk.Publish.Tasks (8)
Microsoft.NET.Sdk.Razor.Tasks (18)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (173)
Microsoft.NET.Sdk.WorkloadManifestReader (14)
Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver (1)
Microsoft.Private.Windows.Core (20)
Microsoft.SourceLink.AzureDevOpsServer.Git (19)
Microsoft.SourceLink.AzureRepos.Git (19)
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 (32)
Microsoft.TestPlatform.Build (1)
Microsoft.TestPlatform.CommunicationUtilities (2)
Microsoft.TestPlatform.CoreUtilities (8)
Microsoft.TestPlatform.CrossPlatEngine (7)
Microsoft.TestPlatform.Extensions.BlameDataCollector (1)
Microsoft.TestPlatform.Filter.Source (4)
Microsoft.TestPlatform.PlatformAbstractions (1)
Microsoft.VisualBasic.Forms (5)
Microsoft.VisualStudio.TestPlatform.Common (18)
Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger (9)
Microsoft.VisualStudio.TestPlatform.ObjectModel (28)
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 (108)
XMake.cs (77)
1023&& switchesNotFromAutoResponseFile[CommandLineSwitches.ParameterizedSwitch.MaxCPUCount].Length == 0
1024&& switchesFromAutoResponseFile[CommandLineSwitches.ParameterizedSwitch.MaxCPUCount].Length == 0
1040bool outputPropertiesItemsOrTargetResults = getProperty.Length > 0 || getItem.Length > 0 || getTargetResult.Length > 0;
1052getProperty.Length > 0 ? "getProperty" :
1053getItem.Length > 0 ? "getItem" :
1056else if ((getProperty.Length > 0 || getItem.Length > 0) && (targets is null || targets.Length == 0))
1076? (getItem.Length == 0 ? ProjectEvaluationStage.Properties : ProjectEvaluationStage.Items)
1169if (outputPropertiesItemsOrTargetResults && targets?.Length > 0 && result is not null)
1395if (getProperty.Length == 1 && getItem.Length == 0)
1428else if (getProperty.Length == 1 && getItem.Length == 0 && getTargetResult.Length == 0)
1641if (loggers.Length == 1 &&
1888bool restoreOnly = targets.Length == 1 && string.Equals(targets[0], MSBuildConstants.RestoreTargetName, StringComparison.OrdinalIgnoreCase);
2640bool minimizeStdOutOutput = getProperty.Length + getItem.Length + getTargetResult.Length > 0 && getResultOutputFile.Length == 0;
2865if (parameterAndValue[0].Equals("default", StringComparison.InvariantCultureIgnoreCase) && parameterAndValue.Length > 1)
2898terminalLoggerArg = switches[switches.Length - 1];
2965return terminalLoggerParameters?.Length > 0 ? MSBuildApp.AggregateParameters(string.Empty, terminalLoggerParameters) : string.Empty;
3062if (parameters.Length == 1 && bool.TryParse(parameters[0], out bool boolValue))
3096if (parameters.Length == 1 && bool.TryParse(parameters[0], out var boolValue))
3146if (parameters.Length > 0)
3150parentPacketVersion = byte.Parse(parameters[parameters.Length - 1], CultureInfo.InvariantCulture);
3154CommunicationsUtilities.Trace($"Invalid node packet version value '{parameters[parameters.Length - 1]}': {ex.Message}");
3159CommunicationsUtilities.Trace($"Node packet version value '{parameters[parameters.Length - 1]}' out of range: {ex.Message}");
3174=> parameters.Length > 0 && !string.IsNullOrEmpty(parameters[parameters.Length - 1])
3175? parameters[parameters.Length - 1]
3192if (parameters.Length > 0)
3197enableNodeReuse = bool.Parse(parameters[parameters.Length - 1]);
3201CommandLineSwitchException.Throw("InvalidNodeReuseValue", parameters[parameters.Length - 1], ex.Message);
3205CommandLineSwitchException.Throw("InvalidNodeReuseValue", parameters[parameters.Length - 1], ex.Message);
3220if (parameters.Length > 0)
3224writer = FileUtilities.OpenWrite(parameters[parameters.Length - 1], append: false);
3228CommandLineSwitchException.Throw("InvalidPreprocessPath", parameters[parameters.Length - 1], ex.Message);
3239if (parameters.Length > 0)
3243writer = FileUtilities.OpenWrite(parameters[parameters.Length - 1], append: false);
3247CommandLineSwitchException.Throw("TargetsCouldNotBePrinted", parameters[parameters.Length - 1], ex.Message);
3302if (parameters.Length > 0)
3306value = bool.Parse(parameters[parameters.Length - 1]);
3310CommandLineSwitchException.Throw(resourceName, parameters[parameters.Length - 1], ex.Message);
3314CommandLineSwitchException.Throw(resourceName, parameters[parameters.Length - 1], ex.Message);
3331if (parameters == null || parameters.Length == 0)
3338var profilerFile = parameters[parameters.Length - 1];
3353CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
3358CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
3363CommandLineSwitchException.Throw("InvalidProfilerValue", parameters[parameters.Length - 1],
3397if (input.Length > 0)
3504if (parameters.Length > 0)
3508cpuCount = int.Parse(parameters[parameters.Length - 1], CultureInfo.InvariantCulture);
3512CommandLineSwitchException.Throw("InvalidMaxCPUCountValue", parameters[parameters.Length - 1], ex.Message);
3516CommandLineSwitchException.Throw("InvalidMaxCPUCountValue", parameters[parameters.Length - 1], ex.Message);
3519CommandLineSwitchException.VerifyThrow(cpuCount > 0 && cpuCount <= 1024, "InvalidMaxCPUCountValueOutsideRange", parameters[parameters.Length - 1]);
3537Assumed.LessThanOrEqual(parameters.Length, 1, "Expect exactly one project at a time.");
3542if (parameters.Length == 1)
3715if (projectExtensionsToIgnore?.Length > 0)
3765if (parameters.Length > 0)
3769return parameters[parameters.Length - 1];
3790Debug.Assert((parameterSections.Length >= 1) && (parameterSections.Length <= 2),
3794CommandLineSwitchException.VerifyThrow((parameterSections[0].Length > 0) && (parameterSections.Length == 2),
3844if (verbositySwitchParameters.Length > 0)
3847originalVerbosity = ProcessVerbositySwitch(verbositySwitchParameters[verbositySwitchParameters.Length - 1]);
3906for (int i = 0; i < parametersToAggregate.Length; i++)
3931for (int i = 0; i < groupedFileLoggerParameters.Length; i++)
3951if (groupedFileLoggerParameters[i].Length > 0)
3986if (binaryLoggerParameters == null || binaryLoggerParameters.Length == 0)
4045if ((consoleLoggerParameters?.Length > 0))
4167if ((fileLoggerParameters?.Length > 0))
4255value = (nameValuePair.Length > 1) ? nameValuePair[1] : null;
4727if (features.Length == 1)
NuGet.Build.Tasks (19)
NuGet.Build.Tasks.Console (7)
NuGet.Build.Tasks.Pack (2)
NuGet.CommandLine.XPlat (18)
NuGet.Commands (16)
NuGet.Common (5)
NuGet.Configuration (2)
NuGet.Frameworks (9)
NuGet.LibraryModel (2)
NuGet.PackageManagement (7)
NuGet.Packaging (148)
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 (11)
NuGet.Resolver (3)
NuGet.Versioning (21)
Pipelines.AppHost (1)
PresentationBuildTasks (133)
PresentationCore (700)
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 (861)
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-SystemCore (5)
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 ||
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 (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);
ResultsOfTGenerator (4)
Roslyn.Diagnostics.Analyzers (165)
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 (24)
ScenarioTests.Common.Tests (8)
sdk-tasks (42)
Security.TransportSecurity.IntegrationTests (1)
SelectTests (2)
Shared (6)
Stress.ApiService (8)
Stress.AppHost (6)
SuperFileCheck (10)
System.CodeDom (44)
System.Collections (82)
System.Collections.Concurrent (31)
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 (12)
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 (678)
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 (92)
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 (164)
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.Formats.Asn1 (13)
System.Formats.Cbor (1)
System.Formats.Nrbf (16)
System.Formats.Tar (16)
System.IO.Compression (84)
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)
969int bytesRead = _deflateStream._inflater.Inflate(_arrayPoolBuffer, 0, _arrayPoolBuffer.Length);
982await _deflateStream._stream.CopyToAsync(this, _arrayPoolBuffer.Length, _cancellationToken).ConfigureAwait(false);
1012int bytesRead = _deflateStream._inflater.Inflate(_arrayPoolBuffer, 0, _arrayPoolBuffer.Length);
1025_deflateStream._stream.CopyTo(this, _arrayPoolBuffer.Length);
1053else if (count > buffer.Length - offset)
1112else if (count > buffer.Length - offset)
System\IO\Compression\ZipArchiveEntry.cs (21)
198if (_storedEntryNameBytes.Length > ushort.MaxValue)
746Debug.Assert(_storedEntryNameBytes.Length <= ushort.MaxValue);
747Debug.Assert(_fileComment.Length <= ushort.MaxValue);
811? ZipGenericExtraField.TotalSizeExcludingTag(_cdUnknownExtraFields, _cdTrailingExtraFieldData?.Length ?? 0, WinZipAesExtraField.HeaderId)
812: ZipGenericExtraField.TotalSize(_cdUnknownExtraFields, _cdTrailingExtraFieldData?.Length ?? 0);
830+ _storedEntryNameBytes.Length
832+ _fileComment.Length;
880BinaryPrimitives.WriteUInt16LittleEndian(cdStaticHeader[ZipCentralDirectoryFileHeader.FieldLocations.FilenameLength..], (ushort)_storedEntryNameBytes.Length);
882BinaryPrimitives.WriteUInt16LittleEndian(cdStaticHeader[ZipCentralDirectoryFileHeader.FieldLocations.FileCommentLength..], (ushort)_fileComment.Length);
917if (_fileComment.Length > 0)
945for (int i = 0; i < compressedBytes.Length - 1; i++)
949compressedBytes[compressedBytes.Length - 1] = new byte[_compressedSize % maxSingleBufferSize];
967for (int i = 0; i < _compressedBytes.Length - 1; i++)
971_archive.ArchiveStream.ReadAtLeast(_compressedBytes[_compressedBytes.Length - 1], (int)(_compressedSize % maxSingleBufferSize), throwOnEndOfStream: true);
1583Debug.Assert(_storedEntryNameBytes.Length <= ushort.MaxValue);
1672? ZipGenericExtraField.TotalSizeExcludingTag(_lhUnknownExtraFields, _lhTrailingExtraFieldData?.Length ?? 0, WinZipAesExtraField.HeaderId)
1673: ZipGenericExtraField.TotalSize(_lhUnknownExtraFields, _lhTrailingExtraFieldData?.Length ?? 0);
1700_archive.ArchiveStream.Seek(ZipLocalFileHeader.SizeOfLocalHeader + _storedEntryNameBytes.Length + extraFieldLength, SeekOrigin.Current);
1747BinaryPrimitives.WriteUInt16LittleEndian(lfStaticHeader[ZipLocalFileHeader.FieldLocations.FilenameLength..], (ushort)_storedEntryNameBytes.Length);
1958_archive.ArchiveStream.Write(compressedBytes, 0, compressedBytes.Length);
2102+ _storedEntryNameBytes.Length + Zip64ExtraField.OffsetToFirstField,
System\IO\Compression\ZipBlocks.Async.cs (6)
84int bytesRead = await stream.ReadAtLeastAsync(blockContents, blockContents.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
109int bytesRead = await stream.ReadAtLeastAsync(blockContents, blockContents.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
171int bytesRead = await stream.ReadAtLeastAsync(blockBytes, blockBytes.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
176bytesRead = await stream.ReadAtLeastAsync(blockBytes, blockBytes.Length, throwOnEndOfStream: false, cancellationToken).ConfigureAwait(false);
254if (archiveComment.Length > 0)
265int 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 (11)
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 (86)
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 (24)
System.Linq.Expressions (301)
System.Linq.Parallel (98)
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 (28)
System.Net.NameResolution (16)
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)
192while (_index < _commands!.Length)
217BeginWrite(sendBuffer, 0, sendBuffer.Length, s_writeCallbackDelegate, this);
221Write(sendBuffer, 0, sendBuffer.Length);
283if (index < 0 || index >= commands!.Length ||
293if (_index >= _commands!.Length)
522BeginRead(state.Buffer, 0, state.Buffer.Length, s_readCallbackDelegate, state);
527bytesRead = Read(state.Buffer, 0, state.Buffer.Length);
637BeginRead(state.Buffer, 0, state.Buffer.Length, s_readCallbackDelegate, state);
642bytesRead = Read(state.Buffer, 0, state.Buffer.Length);
System.Net.Security (77)
System.Net.ServerSentEvents (6)
System.Net.Sockets (47)
System\Net\Sockets\Socket.cs (10)
939if (addresses.Length == 0)
1111return Send(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags);
1118return Send(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None);
1401return SendTo(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags, remoteEP);
1408return SendTo(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None, remoteEP);
1520return Receive(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags);
1527return Receive(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None);
1907return ReceiveFrom(buffer, 0, buffer != null ? buffer.Length : 0, socketFlags, ref remoteEP);
1914return ReceiveFrom(buffer, 0, buffer != null ? buffer.Length : 0, SocketFlags.None, ref remoteEP);
2234int optionLength = optionValue != null ? optionValue.Length : 0;
System.Net.WebHeaderCollection (2)
System.Net.WebProxy (1)
System.Net.WebSockets (13)
System.Net.WebSockets.Client (4)
System.Numerics.Tensors (12)
System.ObjectModel (3)
System.Private.CoreLib (1686)
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)
44for (int i = 0; i < buckets.Length; i++)
72if (index < _buckets.Length)
86log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, _buckets[i].Id);
91while (++i < _buckets.Length && i != index + MaxBucketsToTry);
107log.BufferRented(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId);
108log.BufferAllocated(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId, index >= _buckets.Length ?
121if (array.Length == 0)
129int bucket = Utilities.SelectBucketIndex(array.Length);
132bool haveBucket = bucket < _buckets.Length;
152log.BufferReturned(bufferId, array.Length, Id);
155log.BufferDropped(bufferId, array.Length, Id, ArrayPoolEventSource.NoBucketId, ArrayPoolEventSource.BufferDroppedReason.OverMaximumSize);
199if (_index < buffers.Length)
237if (array.Length != _bufferLength)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (27)
62if (tlsBuckets is not null && (uint)bucketIndex < (uint)tlsBuckets.Length)
70log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
78if ((uint)bucketIndex < (uint)perCoreBuckets.Length)
88log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
121log.BufferRented(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId);
122log.BufferAllocated(bufferId, buffer.Length, Id, ArrayPoolEventSource.NoBucketId, bucketIndex >= _buckets.Length ?
138int bucketIndex = Utilities.SelectBucketIndex(array.Length);
148if ((uint)bucketIndex < (uint)tlsBuckets.Length)
159if (array.Length != Utilities.GetMaxSizeForBucket(bucketIndex))
179if (log.IsEnabled() && array.Length != 0)
181log.BufferReturned(array.GetHashCode(), array.Length, Id);
184log.BufferDropped(array.GetHashCode(), array.Length, Id,
205for (int i = 0; i < perCoreBuckets.Length; i++)
230for (int i = 0; i < buckets.Length; i++)
234log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
255for (int i = 0; i < buckets.Length; i++)
276log.BufferTrimmed(buffer.GetHashCode(), buffer.Length, Id);
335for (int i = 0; i < partitions.Length; i++)
353for (int i = 0; i < partitions.Length; i++)
356if (++index == partitions.Length) index = 0;
373for (int i = 0; i < partitions.Length; i++)
376if (++index == partitions.Length) index = 0;
384for (int i = 0; i < partitions.Length; i++)
407if ((uint)count < (uint)arrays.Length)
431if ((uint)count < (uint)arrays.Length)
490log.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);
2103int paramCount = Math.Min(eventTypes.typeInfos.Length, args.Length); // parameter count mismatch get logged in LogEventArgsMismatches
2104var eventData = new object?[eventTypes.typeInfos.Length];
2124if (args.Length != infos.Length)
2126ReportOutOfBandMessage(SR.Format(SR.EventSource_EventParametersMismatch, eventId, args.Length, infos.Length));
2130for (int i = 0; i < args.Length; i++)
2155ReportOutOfBandMessage(SR.Format(SR.EventSource_EventParametersMismatch, eventCallbackArgs.EventId, eventDataCount, metadata.Parameters.Length));
2165args = new object?[Math.Min(eventDataCount, metadata.Parameters.Length)];
2169for (int i = 0; i < args.Length; i++, data++)
2178for (int i = 0; i < args.Length; i++, data++)
2299uint metadataLength = (metadata != null) ? (uint)metadata.Length : 0;
2401if (eventChannel != EventChannel.None && this.m_channelData != null && this.m_channelData.Length > (int)eventChannel)
2561var names = new string[parameters.Length];
2562for (int i = 0; i < names.Length; i++)
2581var types = new Type[parameters.Length];
2582for (int i = 0; i < types.Length; i++)
2952int dataLeft = rawManifest.Length;
3136for (int i = 0; i < methods.Length; i++)
3261for (int fieldIdx = 0; fieldIdx < args.Length; fieldIdx++)
3312bNeedsManifest = (flags & EventManifestOptions.OnlyIfNeededForRegistration) == 0 || manifest.GetChannelData().Length > 0;
3319res = (res.Length > 0) ? res : null;
3473if (args.Length > 0 && args[0].ParameterType == typeof(Guid) &&
3476var newargs = new ParameterInfo[args.Length - 1];
3477Array.Copy(args, 1, newargs, 0, args.Length - 1);
3546int 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)
382if (buffer.Length - index < count)
461if (buffer.Length - index < count)
493_ = byteBuffer.Length; // allow JIT to prove object is not null
554int newMaxCharsPerBuffer = _encoding.GetMaxCharCount(byteBuffer.Length);
627int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
641_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
654_isBlocked = (_byteLen < _byteBuffer.Length);
731int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos);
745_byteLen = _stream.Read(_byteBuffer, 0, _byteBuffer.Length);
758_isBlocked = (_byteLen < _byteBuffer.Length);
991else if ((arrayPoolBuffer.Length - arrayPoolBufferPos) < (charLen - charPos))
1081if (buffer.Length - index < count)
1178int len = await tmpStream.ReadAsync(new Memory<byte>(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos), cancellationToken).ConfigureAwait(false);
1228_isBlocked = (_byteLen < tmpByteBuffer.Length);
1302if (buffer.Length - index < count)
1421_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.");
642if (_chunks.Length <= pos)
693if (((nuint)(uint)chunkLength + (nuint)(uint)repeatCount) <= (nuint)(uint)chunkChars.Length)
721int firstLength = chunkChars.Length - chunkLength;
725m_ChunkLength = chunkChars.Length;
758if (charCount > value.Length - startIndex)
870int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
874Debug.Assert(m_ChunkLength == 0 && m_ChunkChars.Length >= count);
901if (destinationIndex > destination.Length - count)
1033if ((uint)chars.Length > (uint)nextCharIndex)
1127Append(ref MemoryMarshal.GetArrayDataReference(value), value.Length);
1393Insert(index, ref MemoryMarshal.GetArrayDataReference(value), value.Length);
1417if (startIndex > value.Length - charCount)
2359if (((uint)chunkLength + (uint)valueCount) <= (uint)chunkChars.Length)
2395int firstLength = m_ChunkChars.Length - m_ChunkLength;
2399m_ChunkLength = m_ChunkChars.Length;
2476Debug.Assert(gapStart < sourceChunk.m_ChunkChars.Length, "gap starts at end of buffer. Should not happen");
2607get => new Span<char>(m_ChunkChars, m_ChunkLength, m_ChunkChars.Length - m_ChunkLength);
2742if (!doNotMoveFollowingChars && chunk.m_ChunkLength <= DefaultCapacity * 2 && chunk.m_ChunkChars.Length - chunk.m_ChunkLength >= count)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\AsyncLocal.cs (22)
394Debug.Assert(keyValues.Length is >= 5 and <= MaxMultiElements);
401for (int i = 0; i < _keyValues.Length; i++)
413else if (_keyValues.Length == 5)
430var newValues = new KeyValuePair<IAsyncLocal, object?>[_keyValues.Length - 1];
432if (i != _keyValues.Length - 1) Array.Copy(_keyValues, i + 1, newValues, i, _keyValues.Length - i - 1);
448if (_keyValues.Length < MaxMultiElements)
450var newValues = new KeyValuePair<IAsyncLocal, object?>[_keyValues.Length + 1];
451Array.Copy(_keyValues, newValues, _keyValues.Length);
452newValues[_keyValues.Length] = KeyValuePair.Create(key, value);
458Array.Copy(_keyValues, manyValues, _keyValues.Length);
487Debug.Assert(keyValues.Length > MultiElementAsyncLocalValueMap.MaxMultiElements);
491(uint)Math.Min(keyValues.Length + ((long)keyValues.Length >> 1), 1 << 30));
494_next = new int[keyValues.Length];
495for (int i = 0; i < keyValues.Length; i++)
497int bucket = GetBucket(keyValues[i].Key, _buckets.Length);
528var newValues = new KeyValuePair<IAsyncLocal, object?>[_keyValues.Length + 1];
529Array.Copy(_keyValues, newValues, _keyValues.Length);
539if (_keyValues.Length == MultiElementAsyncLocalValueMap.MaxMultiElements + 1)
547var remainingValues = new KeyValuePair<IAsyncLocal, object?>[_keyValues.Length - 1];
573int bucket = GetBucket(key, _buckets.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (12)
45var newQueues = new WorkStealingQueue[oldQueues.Length + 1];
46Array.Copy(oldQueues, newQueues, oldQueues.Length);
61if (oldQueues.Length == 0)
73var newQueues = new WorkStealingQueue[oldQueues.Length - 1];
76Array.Copy(oldQueues, 1, newQueues, 0, newQueues.Length);
78else if (pos == oldQueues.Length - 1)
80Array.Copy(oldQueues, newQueues, newQueues.Length);
85Array.Copy(oldQueues, pos + 1, newQueues, pos, newQueues.Length - pos);
149var newArray = new object?[m_array.Length << 1];
150for (int i = 0; i < m_array.Length; i++)
809int c = queues.Length;
1704for (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 (458)
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 (857)
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 (37)
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);
7633Debug.Assert(nodeIndex < _nodes.Length);
7634Debug.Assert(_nodes[_nodes.Length - 1] == null);
7647Debug.Assert(nodeIndex < _nodes.Length);
7648if (nodeIndex >= _nodes.Length - 1)
7650NodeData[] newNodes = new NodeData[_nodes.Length * 2];
7651Array.Copy(_nodes, newNodes, _nodes.Length);
7654Debug.Assert(nodeIndex < _nodes.Length);
8111else if (_parsingStatesStackTop + 1 == _parsingStatesStack.Length)
8113ParsingState[] newParsingStateStack = new ParsingState[_parsingStatesStack.Length * 2];
8114Array.Copy(_parsingStatesStack, newParsingStateStack, _parsingStatesStack.Length);
8163if (array.Length - index < count)
9573Debug.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 (42)
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;
3587bool isListText = text != null && text.IsList && elements.Length == 0;
3675int count = elements.Length + (text == null ? 0 : 1);
3709if (elements.Length == 0 && text == null) return;
3710if (elements.Length == 1 && text == null)
3733for (int i = 0; i < elements.Length; i++)
3801if (elements.Length - anyCount > 0) Writer.Write("else ");
3897if (elements.Length > 0)
3919if (elements.Length > 0)
4477for (int i = 0; i < members.Length; i++)
4534for (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 (123)
System.Resources.Extensions (18)
System.Resources.Writer (5)
System.Runtime.Caching (22)
System.Runtime.InteropServices (7)
System.Runtime.InteropServices.JavaScript (15)
System.Runtime.Numerics (99)
System\Numerics\BigInteger.cs (88)
317if (_bits.Length is 1 && _bits[0] <= int.MaxValue)
497if (len != val.Length)
710_bits = new nuint[bits32.Length];
711Buffer.BlockCopy(bits32, 0, _bits, 0, bits32.Length * sizeof(uint));
715int nuintLen = (bits32.Length + 1) / 2;
717for (int i = 0; i < bits32.Length; i += 2)
720ulong hi = (i + 1 < bits32.Length) ? bits32[i + 1] : 0;
743bits32 = new uint[_bits.Length];
744Buffer.BlockCopy(_bits, 0, bits32, 0, _bits.Length * sizeof(uint));
748int len = _bits.Length * 2;
755for (int i = 0; i < _bits.Length; i++)
789int iu = _bits.Length - 1;
941int size = dividend._bits.Length;
974int size = dividend._bits.Length;
1040m = value._bits.Length > 1 ? value._bits[^2] : 0;
1043b = (long)value._bits.Length * 64 - c;
1051m = value._bits.Length > 1 ? (uint)value._bits[^2] : 0;
1052l = value._bits.Length > 2 ? (uint)value._bits[^3] : 0;
1056b = (long)value._bits.Length * 32 - c;
1351int size = (modulus._bits?.Length ?? 1) << 1;
1665int size = BigIntegerCalculator.PowBound(power, value._bits!.Length);
1703if ((_sign ^ other) < 0 || (cu = _bits.Length) > maxLimbs)
1735int cu = _bits.Length;
1768if ((_sign ^ other) < 0 || (cu = _bits.Length) > maxLimbs)
1803int cu = _bits.Length;
2032Debug.Assert(bits.Length > 0);
2037if (bits.Length - 1 == nonZeroLimbIndex)
2075length = checked(bytesPerLimb * (bits.Length - 1) + length);
2124for (int i = 0; i < bits.Length - 1; i++)
2189Debug.Assert(_bits is null || _sign == 0 ? buffer.Length == 2 : buffer.Length >= _bits.Length + 1);
2201buffer = buffer.Slice(0, _bits.Length + 1);
2264if ((_bits is null) || (_bits.Length <= 4))
2280lowBitsCount = _bits.Length - 1;
2285lowBitsCount = _bits.Length - 2;
2570if (bits.Length <= 64 / BigIntegerCalculator.BitsPerLimb)
2599int length = bits.Length;
2708Debug.Assert((uint)bits.Length <= 64 / BigIntegerCalculator.BitsPerLimb);
2712if (BigIntegerCalculator.BitsPerLimb == 32 && bits.Length > 1)
2755if (bits.Length <= 64 / BigIntegerCalculator.BitsPerLimb)
2773if (value._bits.Length > 1)
2800int len = value._bits.Length;
2840int len = value._bits.Length;
2902if (bits.Length <= 64 / BigIntegerCalculator.BitsPerLimb)
2926return value._bits.Length <= 1 && value._sign >= 0
2940int len = value._bits.Length;
2968int len = value._bits.Length;
3229int xLen = left._bits?.Length ?? 1;
3230int yLen = right._bits?.Length ?? 1;
3248int xLen = left._bits?.Length ?? 1;
3249int yLen = right._bits?.Length ?? 1;
3258int xLen = left._bits?.Length ?? 1;
3259int yLen = right._bits?.Length ?? 1;
3476int size = value._bits.Length + 1;
3486Span<nuint> bits = RentedBuffer.Create(value._bits.Length, out RentedBuffer bitsBuffer);
3511int size = value._bits.Length + 1;
3520Span<nuint> bits = RentedBuffer.Create(value._bits.Length, out RentedBuffer bitsBuffer);
3541Span<nuint> bits = RentedBuffer.Create(value._bits.Length, out RentedBuffer bitsBuffer);
3549int size = value._bits.Length + 1;
3670int size = dividend._bits.Length;
3763int size = dividend._bits.Length;
3876bitsArrayLength = bits.Length;
3908Debug.Assert(_bits.Length > 0);
3910Debug.Assert(_bits.Length > 1 || _bits[0] > int.MaxValue);
3914Debug.Assert(_bits.Length <= MaxLength);
4007for (int i = 0; i < value._bits.Length; i++)
4028while (i < value._bits.Length)
4365for (int i = 1; (part == 0) && (i < value._bits.Length); i++)
4401int result = (bits.Length - 1) * BigIntegerCalculator.BitsPerLimb;
4415if (bits.AsSpan(0, bits.Length - 1).ContainsAnyExcept(0u))
4448for (int i = bits.Length - 1; i >= 0; i--)
4459bool needsSignExtension = byteCount > bits.Length * nint.Size;
4475for (int i = bits.Length - 1; i >= 0; i--)
4526for (int i = 0; i < bits.Length; i++)
4537bool needsSignExtension = byteCount > bits.Length * nint.Size;
4544for (int i = 0; i < bits.Length; i++)
4592int result = bits.Length * nint.Size;
4602if (bits.AsSpan(0, bits.Length - 1).ContainsAnyExcept(0u))
4638: (BigInteger)(((long)value._bits.Length * BigIntegerCalculator.BitsPerLimb - 1) ^ BitOperations.LeadingZeroCount(value._bits[^1]));
5685if (value._bits.Length >= 2)
5722if (value._bits.Length >= 2)
5729if (value._bits.Length >= 4)
5735if (value._bits.Length >= 3)
5740if (value._bits.Length >= 2)
5879if (value._bits.Length >= 2)
5916if (value._bits.Length >= 2)
5923if (value._bits.Length >= 4)
5929if (value._bits.Length >= 3)
5934if (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 (497)
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 (83)
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 (178)
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);
824Debug.Assert(rented.Length >= utf8Bom.Length);
843if (rented.Length == written)
846rented = ArrayPool<byte>.Shared.Rent(checked(toReturn.Length * 2));
847Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length);
852lastRead = stream.Read(rented, written, rented.Length - written);
907Debug.Assert(rented.Length >= JsonConstants.Utf8Bom.Length);
923if (rented.Length == written)
926rented = ArrayPool<byte>.Shared.Rent(toReturn.Length * 2);
927Buffer.BlockCopy(toReturn, 0, rented, 0, toReturn.Length);
System.Text.Json.SourceGeneration (14)
System.Text.RegularExpressions (183)
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);