Consolidate configurations and disable failing tests with ActiveIssue.
trigger: none
schedules:
-- cron: "0 8 * * *" # 8 AM UTC => 12 AM PST
+- cron: "0 8 * * 2,4" # 8 AM UTC => 12 AM PST, every Tuesday and Thursday
displayName: Outerloop scheduled build
branches:
include:
buildConfig: Release
runtimeFlavor: mono
platforms:
- - windows_x86
- - browser_wasm
- - ${{ if eq(variables['isRollingBuild'], true) }}:
- windows_x64
- linux_x64
- - linux_arm
- - linux_musl_x64
- osx_x64
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
+ - android_x64
+ - linux_arm
+ - linux_musl_x64
+ - windows_x86
jobParameters:
testScope: outerloop
nameSuffix: AllSubsets_Mono
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
- scenarios:
- - WasmTestOnBrowser
testScope: outerloop
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- - ${{ if eq(variables['isRollingBuild'], false) }}:
- - template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Debug
- runtimeFlavor: mono
- platforms:
- - windows_x64
- - linux_x64
- - linux_musl_x64
- - osx_x64
- - android_arm64
- jobParameters:
+ - template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/global-build-job.yml
+ helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
+ buildConfig: Release
+ runtimeFlavor: mono
+ platforms:
+ - browser_wasm
+ jobParameters:
+ testScope: outerloop
+ nameSuffix: AllSubsets_Mono
+ buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) -testscope outerloop /p:ArchiveTests=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
+ timeoutInMinutes: 180
+ includeAllPlatforms: ${{ variables['isRollingBuild'] }}
+ # extra steps, run tests
+ extraStepsTemplate: /eng/pipelines/libraries/helix.yml
+ extraStepsParameters:
+ scenarios:
+ - normal
testScope: outerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+host.native+libs+libs.tests -c $(_BuildConfig) -testscope outerloop /p:ArchiveTests=true
- timeoutInMinutes: 180
- includeAllPlatforms: ${{ variables['isRollingBuild'] }}
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- testScope: outerloop
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ creator: dotnet-bot
+ testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- osx_x64
jobParameters:
testScope: outerloop
- nameSuffix: CoreCLR_Release
+ nameSuffix: CoreCLR_$(_BuildConfig)
buildArgs: -s clr+host.native+libs+libs.tests -lc $(_BuildConfig) -hc $(_BuildConfig) -rc Release -testscope outerloop /p:ArchiveTests=true
timeoutInMinutes: 180
includeAllPlatforms: ${{ variables['isRollingBuild'] }}
- osx_x64
jobParameters:
testScope: outerloop
- nameSuffix: CoreCLR_Release
+ nameSuffix: CoreCLR_$(_BuildConfig)
buildArgs: -s clr+host.native+libs+libs.tests -lc $(_BuildConfig) -hc $(_BuildConfig) -rc Release -testscope outerloop /p:ArchiveTests=true
timeoutInMinutes: 180
includeAllPlatforms: ${{ variables['isRollingBuild'] }}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using Xunit;
+
+[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/88992", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.IsX86Process))]
<Compile Include="..\src\System\Diagnostics\Metrics\StringSequence.cs" Link="StringSequence.cs" />
<Compile Include="..\src\System\Diagnostics\Metrics\StringSequence.netcore.cs" Link="StringSequence.netcore.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
<Compile Include="..\src\System\Diagnostics\Metrics\StringSequence.netfx.cs" Link="StringSequence.netfx.cs" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
+ <Compile Include="AssemblyInfo.cs" />
<Compile Include="AggregationManagerTests.cs" />
<Compile Include="ExponentialHistogramTests.cs" />
<Compile Include="DiagnosticSourceTests.cs" />
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System;
using Xunit;
[assembly: SkipOnCoreClr("System.Net.Tests are flaky and/or long running: https://github.com/dotnet/runtime/issues/131", ~RuntimeConfiguration.Release)]
[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.Net.Sockets is not supported on Browser")]
+[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/88992", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.IsX86Process))]
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System;
using System.Buffers;
using System.Collections.Generic;
using System.Linq;
}
[OuterLoop("Involves GC and finalization")]
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
[InlineData(false)]
[InlineData(true)]
public void Finalizer_InvokedWhenNoLongerReferenced(bool afterAsyncOperation)
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using Xunit;
+
+[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/88992", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.IsX86Process))]
<EventSourceSupport>true</EventSourceSupport>
</PropertyGroup>
<ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
<Compile Include="AdditionalCacheTests\AdditionalCacheTests.cs" />
<Compile Include="Common\PokerChangeMonitor.cs" />
<Compile Include="Common\PokerMemoryCache.cs" />
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using Xunit;
+
+[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/88992", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.IsX86Process))]
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
<Compile Include="CheckArchitectureTests.cs" />
<Compile Include="CheckPlatformTests.cs" />
<Compile Include="RuntimeIdentifierTests.cs" />
using System.Collections.Generic;
using System.Text.Encodings.Web;
using System.Text.Unicode;
+using Microsoft.DotNet.XUnitExtensions;
using Xunit;
namespace System.Text.Json.Tests
}
{
var message = new string('>', stringLength);
- var builder = new StringBuilder();
+ var builder = new StringBuilder(stringLength);
for (int i = 0; i < stringLength; i++)
{
builder.Append("\\u003E");
}
{
var message = new string('>', stringLength);
- var builder = new StringBuilder();
+ var builder = new StringBuilder(stringLength);
for (int i = 0; i < stringLength; i++)
{
builder.Append("\\u003E");
public static void GetValueLargeEscapedTest(int stringLength)
{
var message = new string('>', stringLength);
- var builder = new StringBuilder();
+ var builder = new StringBuilder(stringLength);
for (int i = 0; i < stringLength; i++)
{
builder.Append("\\u003E");
}
catch (OutOfMemoryException)
{
- return;
+ throw new SkipTestException("Out of memory allocating large objects");
}
}
using System.Linq;
using System.Text.Encodings.Web;
using System.Text.Json.Tests;
+using Microsoft.DotNet.XUnitExtensions;
using Xunit;
namespace System.Text.Json.Serialization.Tests
[OuterLoop]
public static void SerializeLargeListOfObjects()
{
- Dto dto = new()
- {
- Prop1 = int.MaxValue,
- Prop2 = int.MinValue,
- Prop3 = "AC",
- Prop4 = 500,
- Prop5 = int.MaxValue / 2,
- Prop6 = 250M,
- Prop7 = 250M,
- Prop8 = 250M,
- Prop9 = 250M,
- Prop10 = 250M,
- Prop11 = 150M,
- Prop12 = 150M,
- Prop13 = DateTimeOffset.MaxValue,
- Prop14 = DateTimeOffset.MaxValue,
- Prop15 = DateTimeOffset.MaxValue,
- Prop16 = DateTimeOffset.MaxValue,
- Prop17 = 3,
- Prop18 = DateTime.MaxValue,
- Prop19 = DateTime.MaxValue,
- Prop20 = 25000,
- Prop21 = DateTime.MaxValue
- };
-
- // It takes a little over 4,338,000 items to reach a payload size above the Array.MaxLength value.
- List<Dto> items = Enumerable.Repeat(dto, 4_338_000).ToList();
-
try
{
- JsonSerializer.SerializeToUtf8Bytes(items);
+ Dto dto = new()
+ {
+ Prop1 = int.MaxValue,
+ Prop2 = int.MinValue,
+ Prop3 = "AC",
+ Prop4 = 500,
+ Prop5 = int.MaxValue / 2,
+ Prop6 = 250M,
+ Prop7 = 250M,
+ Prop8 = 250M,
+ Prop9 = 250M,
+ Prop10 = 250M,
+ Prop11 = 150M,
+ Prop12 = 150M,
+ Prop13 = DateTimeOffset.MaxValue,
+ Prop14 = DateTimeOffset.MaxValue,
+ Prop15 = DateTimeOffset.MaxValue,
+ Prop16 = DateTimeOffset.MaxValue,
+ Prop17 = 3,
+ Prop18 = DateTime.MaxValue,
+ Prop19 = DateTime.MaxValue,
+ Prop20 = 25000,
+ Prop21 = DateTime.MaxValue
+ };
+
+ // It takes a little over 4,338,000 items to reach a payload size above the Array.MaxLength value.
+ List<Dto> items = Enumerable.Repeat(dto, 4_338_000).ToList();
+
+ try
+ {
+ JsonSerializer.SerializeToUtf8Bytes(items);
+ }
+ catch (OutOfMemoryException) { }
+
+ items.AddRange(Enumerable.Repeat(dto, 1000).ToList());
+ Assert.Throws<OutOfMemoryException>(() => JsonSerializer.SerializeToUtf8Bytes(items));
+ }
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
}
- catch (OutOfMemoryException) { }
-
- items.AddRange(Enumerable.Repeat(dto, 1000).ToList());
- Assert.Throws<OutOfMemoryException>(() => JsonSerializer.SerializeToUtf8Bytes(items));
}
class Dto
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
+using Microsoft.DotNet.XUnitExtensions;
using Newtonsoft.Json;
using Xunit;
[OuterLoop]
public static void VeryLongInputString(int length)
{
- // Verify that deserializer does not do any multiplication or addition on the string length
- DeserializeLongJsonString(length);
+ try
+ {
+ // Verify that deserializer does not do any multiplication or addition on the string length
+ DeserializeLongJsonString(length);
+ }
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
+ }
}
private static void DeserializeLongJsonString(int stringLength)
[MemberData(nameof(LotsOfCommentsTests))]
public static void SkipLotsOfComments(string valueString, bool insideArray, string expectedString)
{
- var builder = new StringBuilder();
+ var builder = new StringBuilder(2_000_000);
if (insideArray)
{
builder.Append("[");
[MemberData(nameof(LotsOfCommentsTests))]
public static void ConsumeLotsOfComments(string valueString, bool insideArray, string expectedString)
{
- var builder = new StringBuilder();
+ var builder = new StringBuilder(2_000_000);
if (insideArray)
{
builder.Append("[");
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using Microsoft.DotNet.XUnitExtensions;
using Xunit;
namespace System.Text.Json.Tests
[OuterLoop]
public void WriteRawLargeJsonToStreamWithoutFlushing()
{
- var largeArray = new char[150_000_000];
- largeArray.AsSpan().Fill('a');
-
- // Text size chosen so that after several doublings of the underlying buffer we reach ~2 GB (but don't go over)
- JsonEncodedText text1 = JsonEncodedText.Encode(largeArray.AsSpan(0, 7_500));
- JsonEncodedText text2 = JsonEncodedText.Encode(largeArray.AsSpan(0, 5_000));
- JsonEncodedText text3 = JsonEncodedText.Encode(largeArray.AsSpan(0, 150_000_000));
-
- using (var output = new MemoryStream())
- using (var writer = new Utf8JsonWriter(output))
+ try
{
- writer.WriteStartArray();
- writer.WriteRawValue(WrapInQuotes(text1.EncodedUtf8Bytes));
- Assert.Equal(7_503, writer.BytesPending);
+ var largeArray = new char[150_000_000];
+ largeArray.AsSpan().Fill('a');
- for (int i = 0; i < 30_000; i++)
- {
- writer.WriteRawValue(WrapInQuotes(text2.EncodedUtf8Bytes));
- }
- Assert.Equal(150_097_503, writer.BytesPending);
+ // Text size chosen so that after several doublings of the underlying buffer we reach ~2 GB (but don't go over)
+ JsonEncodedText text1 = JsonEncodedText.Encode(largeArray.AsSpan(0, 7_500));
+ JsonEncodedText text2 = JsonEncodedText.Encode(largeArray.AsSpan(0, 5_000));
+ JsonEncodedText text3 = JsonEncodedText.Encode(largeArray.AsSpan(0, 150_000_000));
- for (int i = 0; i < 13; i++)
+ using (var output = new MemoryStream())
+ using (var writer = new Utf8JsonWriter(output))
{
- writer.WriteRawValue(WrapInQuotes(text3.EncodedUtf8Bytes));
- }
- Assert.Equal(2_100_097_542, writer.BytesPending);
+ writer.WriteStartArray();
+ writer.WriteRawValue(WrapInQuotes(text1.EncodedUtf8Bytes));
+ Assert.Equal(7_503, writer.BytesPending);
- // Next write forces a grow beyond max array length
+ for (int i = 0; i < 30_000; i++)
+ {
+ writer.WriteRawValue(WrapInQuotes(text2.EncodedUtf8Bytes));
+ }
+ Assert.Equal(150_097_503, writer.BytesPending);
- Assert.Throws<OutOfMemoryException>(() => writer.WriteRawValue(WrapInQuotes(text3.EncodedUtf8Bytes)));
+ for (int i = 0; i < 13; i++)
+ {
+ writer.WriteRawValue(WrapInQuotes(text3.EncodedUtf8Bytes));
+ }
+ Assert.Equal(2_100_097_542, writer.BytesPending);
- Assert.Equal(2_100_097_542, writer.BytesPending);
+ // Next write forces a grow beyond max array length
- var text4 = JsonEncodedText.Encode(largeArray.AsSpan(0, 1));
- for (int i = 0; i < 10_000_000; i++)
- {
- writer.WriteRawValue(WrapInQuotes(text4.EncodedUtf8Bytes));
- }
+ Assert.Throws<OutOfMemoryException>(() => writer.WriteRawValue(WrapInQuotes(text3.EncodedUtf8Bytes)));
+
+ Assert.Equal(2_100_097_542, writer.BytesPending);
+
+ var text4 = JsonEncodedText.Encode(largeArray.AsSpan(0, 1));
+ for (int i = 0; i < 10_000_000; i++)
+ {
+ writer.WriteRawValue(WrapInQuotes(text4.EncodedUtf8Bytes));
+ }
- Assert.Equal(2_100_097_542 + (4 * 10_000_000), writer.BytesPending);
+ Assert.Equal(2_100_097_542 + (4 * 10_000_000), writer.BytesPending);
+ }
+ }
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
}
}
[InlineData(JsonTokenType.StartObject)]
public static void WriteRawMaxUtf16InputLength(JsonTokenType tokenType)
{
- // Max raw payload length supported by the writer.
- int maxLength = int.MaxValue / 3;
-
- StringBuilder sb = new();
- sb.Append('"');
-
- for (int i = 1; i < maxLength - 1; i++)
+ try
{
- sb.Append('a');
- }
+ // Max raw payload length supported by the writer.
+ int maxLength = int.MaxValue / 3;
- sb.Append('"');
+ StringBuilder sb = new(maxLength + 2);
+ sb.Append('"');
- string payload = sb.ToString();
+ for (int i = 1; i < maxLength - 1; i++)
+ {
+ sb.Append('a');
+ }
- RunTest(OverloadParamType.ROSChar);
- RunTest(OverloadParamType.String);
- RunTest(OverloadParamType.ByteArray);
- RunTest(OverloadParamType.ROSeqByte);
+ sb.Append('"');
- void RunTest(OverloadParamType paramType)
- {
- using MemoryStream ms = new();
- using Utf8JsonWriter writer = new(ms);
+ string payload = sb.ToString();
+
+ RunTest(OverloadParamType.ROSChar);
+ RunTest(OverloadParamType.String);
+ RunTest(OverloadParamType.ByteArray);
+ RunTest(OverloadParamType.ROSeqByte);
- switch (tokenType)
+ void RunTest(OverloadParamType paramType)
{
- case JsonTokenType.String:
- WriteRawValueWithSetting(writer, payload, paramType);
- writer.Flush();
- Assert.Equal(payload.Length, writer.BytesCommitted);
- break;
- case JsonTokenType.StartArray:
- writer.WriteStartArray();
- WriteRawValueWithSetting(writer, payload, paramType);
- WriteRawValueWithSetting(writer, payload, paramType);
- writer.WriteEndArray();
- writer.Flush();
- // Start/EndArray + comma, 2 array elements
- Assert.Equal(3 + (payload.Length * 2), writer.BytesCommitted);
- break;
- case JsonTokenType.StartObject:
- writer.WriteStartObject();
- writer.WritePropertyName("1");
- WriteRawValueWithSetting(writer, payload, paramType);
- writer.WritePropertyName("2");
- WriteRawValueWithSetting(writer, payload, paramType);
- writer.WriteEndObject();
- writer.Flush();
- // Start/EndToken + comma, 2 property names, 2 property values
- Assert.Equal(3 + (4 * 2) + (payload.Length * 2), writer.BytesCommitted);
- break;
- default:
- Assert.True(false, "Unexpected test configuration");
- break;
+ using MemoryStream ms = new();
+ using Utf8JsonWriter writer = new(ms);
+
+ switch (tokenType)
+ {
+ case JsonTokenType.String:
+ WriteRawValueWithSetting(writer, payload, paramType);
+ writer.Flush();
+ Assert.Equal(payload.Length, writer.BytesCommitted);
+ break;
+ case JsonTokenType.StartArray:
+ writer.WriteStartArray();
+ WriteRawValueWithSetting(writer, payload, paramType);
+ WriteRawValueWithSetting(writer, payload, paramType);
+ writer.WriteEndArray();
+ writer.Flush();
+ // Start/EndArray + comma, 2 array elements
+ Assert.Equal(3 + (payload.Length * 2), writer.BytesCommitted);
+ break;
+ case JsonTokenType.StartObject:
+ writer.WriteStartObject();
+ writer.WritePropertyName("1");
+ WriteRawValueWithSetting(writer, payload, paramType);
+ writer.WritePropertyName("2");
+ WriteRawValueWithSetting(writer, payload, paramType);
+ writer.WriteEndObject();
+ writer.Flush();
+ // Start/EndToken + comma, 2 property names, 2 property values
+ Assert.Equal(3 + (4 * 2) + (payload.Length * 2), writer.BytesCommitted);
+ break;
+ default:
+ Assert.True(false, "Unexpected test configuration");
+ break;
+ }
}
}
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
+ }
}
private enum OverloadParamType
[OuterLoop]
public static void WriteRawUtf16LengthGreaterThanMax(int len)
{
- StringBuilder sb = new();
- sb.Append('"');
-
- for (int i = 1; i < len - 1; i++)
+ try
{
- sb.Append('a');
- }
+ StringBuilder sb = new(len + 2);
+ sb.Append('"');
- sb.Append('"');
+ for (int i = 1; i < len - 1; i++)
+ {
+ sb.Append('a');
+ }
- string payload = sb.ToString();
+ sb.Append('"');
- using MemoryStream ms = new();
- using Utf8JsonWriter writer = new(ms);
+ string payload = sb.ToString();
- // UTF-16 overloads not compatible with this length.
- Assert.Throws<ArgumentException>(() => WriteRawValueWithSetting(writer, payload, OverloadParamType.ROSChar));
- Assert.Throws<ArgumentException>(() => WriteRawValueWithSetting(writer, payload, OverloadParamType.String));
+ using MemoryStream ms = new();
+ using Utf8JsonWriter writer = new(ms);
- // UTF-8 overload is okay.
- WriteRawValueWithSetting(writer, payload, OverloadParamType.ByteArray);
- writer.Flush();
- Assert.Equal(payload.Length, Encoding.UTF8.GetString(ms.ToArray()).Length);
+ // UTF-16 overloads not compatible with this length.
+ Assert.Throws<ArgumentException>(() => WriteRawValueWithSetting(writer, payload, OverloadParamType.ROSChar));
+ Assert.Throws<ArgumentException>(() => WriteRawValueWithSetting(writer, payload, OverloadParamType.String));
- writer.Reset();
- ms.SetLength(0);
- WriteRawValueWithSetting(writer, payload, OverloadParamType.ROSeqByte);
- writer.Flush();
- Assert.Equal(payload.Length, Encoding.UTF8.GetString(ms.ToArray()).Length);
+ // UTF-8 overload is okay.
+ WriteRawValueWithSetting(writer, payload, OverloadParamType.ByteArray);
+ writer.Flush();
+ Assert.Equal(payload.Length, Encoding.UTF8.GetString(ms.ToArray()).Length);
+
+ writer.Reset();
+ ms.SetLength(0);
+ WriteRawValueWithSetting(writer, payload, OverloadParamType.ROSeqByte);
+ writer.Flush();
+ Assert.Equal(payload.Length, Encoding.UTF8.GetString(ms.ToArray()).Length);
+ }
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
+ }
}
[PlatformSpecific(TestPlatforms.Windows | TestPlatforms.OSX)]
ReadOnlySequence<byte> readonlySeq = CreateLargeReadOnlySequence(len);
Assert.Throws<ArgumentException>(() => writer.WriteRawValue(readonlySeq));
}
- catch (OutOfMemoryException) { } // Perhaps failed to allocate large arrays
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
+ }
}
[PlatformSpecific(TestPlatforms.Windows | TestPlatforms.OSX)]
[OuterLoop]
public static void WriteRawTranscodeFromUtf16ToUtf8TooLong()
{
- // Max raw payload length supported by the writer.
- int maxLength = int.MaxValue / 3;
-
- StringBuilder sb = new();
- sb.Append('"');
-
- for (int i = 1; i < maxLength - 1; i++)
+ try
{
- sb.Append('\u7684'); // Non-UTF-8 character than will expand during transcoding
- }
+ // Max raw payload length supported by the writer.
+ int maxLength = int.MaxValue / 3;
- sb.Append('"');
+ StringBuilder sb = new(maxLength + 2);
+ sb.Append('"');
- string payload = sb.ToString();
+ for (int i = 1; i < maxLength - 1; i++)
+ {
+ sb.Append('\u7684'); // Non-UTF-8 character than will expand during transcoding
+ }
- RunTest(OverloadParamType.ROSChar);
- RunTest(OverloadParamType.String);
- RunTest(OverloadParamType.ByteArray);
- RunTest(OverloadParamType.ROSeqByte);
+ sb.Append('"');
- void RunTest(OverloadParamType paramType)
- {
- using MemoryStream ms = new();
- using Utf8JsonWriter writer = new(ms);
+ string payload = sb.ToString();
+
+ RunTest(OverloadParamType.ROSChar);
+ RunTest(OverloadParamType.String);
+ RunTest(OverloadParamType.ByteArray);
+ RunTest(OverloadParamType.ROSeqByte);
- try
+ void RunTest(OverloadParamType paramType)
{
- WriteRawValueWithSetting(writer, payload, paramType);
- writer.Flush();
+ using MemoryStream ms = new();
+ using Utf8JsonWriter writer = new(ms);
+
+ try
+ {
+ WriteRawValueWithSetting(writer, payload, paramType);
+ writer.Flush();
- // All characters in the payload will be expanded during transcoding, except for the quotes.
- int expectedLength = ((payload.Length - 2) * 3) + 2;
- Assert.Equal(expectedLength, writer.BytesCommitted);
+ // All characters in the payload will be expanded during transcoding, except for the quotes.
+ int expectedLength = ((payload.Length - 2) * 3) + 2;
+ Assert.Equal(expectedLength, writer.BytesCommitted);
+ }
+ catch (OutOfMemoryException) { } // OutOfMemoryException is okay since the transcoding output is probably too large.
}
- catch (OutOfMemoryException) { } // OutOfMemoryException is okay since the transcoding output is probably too large.
+ }
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
}
}
[OuterLoop]
public void WriteLargeJsonToStreamWithoutFlushing()
{
- var largeArray = new char[150_000_000];
- largeArray.AsSpan().Fill('a');
-
- // Text size chosen so that after several doublings of the underlying buffer we reach ~2 GB (but don't go over)
- JsonEncodedText text1 = JsonEncodedText.Encode(largeArray.AsSpan(0, 7_500));
- JsonEncodedText text2 = JsonEncodedText.Encode(largeArray.AsSpan(0, 5_000));
- JsonEncodedText text3 = JsonEncodedText.Encode(largeArray.AsSpan(0, 150_000_000));
-
- using (var output = new MemoryStream())
- using (var writer = new Utf8JsonWriter(output))
+ try
{
- writer.WriteStartArray();
- writer.WriteStringValue(text1);
- Assert.Equal(7_503, writer.BytesPending);
+ var largeArray = new char[150_000_000];
+ largeArray.AsSpan().Fill('a');
- for (int i = 0; i < 30_000; i++)
- {
- writer.WriteStringValue(text2);
- }
- Assert.Equal(150_097_503, writer.BytesPending);
+ // Text size chosen so that after several doublings of the underlying buffer we reach ~2 GB (but don't go over)
+ JsonEncodedText text1 = JsonEncodedText.Encode(largeArray.AsSpan(0, 7_500));
+ JsonEncodedText text2 = JsonEncodedText.Encode(largeArray.AsSpan(0, 5_000));
+ JsonEncodedText text3 = JsonEncodedText.Encode(largeArray.AsSpan(0, 150_000_000));
- for (int i = 0; i < 13; i++)
+ using (var output = new MemoryStream())
+ using (var writer = new Utf8JsonWriter(output))
{
- writer.WriteStringValue(text3);
- }
- Assert.Equal(2_100_097_542, writer.BytesPending);
+ writer.WriteStartArray();
+ writer.WriteStringValue(text1);
+ Assert.Equal(7_503, writer.BytesPending);
- // Next write forces a grow beyond max array length
+ for (int i = 0; i < 30_000; i++)
+ {
+ writer.WriteStringValue(text2);
+ }
+ Assert.Equal(150_097_503, writer.BytesPending);
- Assert.Throws<OutOfMemoryException>(() => writer.WriteStringValue(text3));
+ for (int i = 0; i < 13; i++)
+ {
+ writer.WriteStringValue(text3);
+ }
+ Assert.Equal(2_100_097_542, writer.BytesPending);
- Assert.Equal(2_100_097_542, writer.BytesPending);
+ // Next write forces a grow beyond max array length
- var text4 = JsonEncodedText.Encode(largeArray.AsSpan(0, 1));
- for (int i = 0; i < 10_000_000; i++)
- {
- writer.WriteStringValue(text4);
- }
+ Assert.Throws<OutOfMemoryException>(() => writer.WriteStringValue(text3));
+
+ Assert.Equal(2_100_097_542, writer.BytesPending);
+
+ var text4 = JsonEncodedText.Encode(largeArray.AsSpan(0, 1));
+ for (int i = 0; i < 10_000_000; i++)
+ {
+ writer.WriteStringValue(text4);
+ }
- Assert.Equal(2_100_097_542 + (4 * 10_000_000), writer.BytesPending);
+ Assert.Equal(2_100_097_542 + (4 * 10_000_000), writer.BytesPending);
+ }
+ }
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
}
}
[InlineData(false, false)]
public void WritingTooLargeProperty(bool formatted, bool skipValidation)
{
- byte[] key;
- char[] keyChars;
-
try
{
+ byte[] key;
+ char[] keyChars;
+
key = new byte[MaxUnescapedTokenSize + 1];
keyChars = new char[MaxUnescapedTokenSize + 1];
- }
- catch (OutOfMemoryException)
- {
- return;
- }
- key.AsSpan().Fill((byte)'a');
- keyChars.AsSpan().Fill('a');
+ key.AsSpan().Fill((byte)'a');
+ keyChars.AsSpan().Fill('a');
- var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
- var output = new ArrayBufferWriter<byte>(1024);
+ var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
+ var output = new ArrayBufferWriter<byte>(1024);
- using (var jsonUtf8 = new Utf8JsonWriter(output, options))
- {
- jsonUtf8.WriteStartObject();
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartArray(keyChars));
- }
+ using (var jsonUtf8 = new Utf8JsonWriter(output, options))
+ {
+ jsonUtf8.WriteStartObject();
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartArray(keyChars));
+ }
- using (var jsonUtf8 = new Utf8JsonWriter(output, options))
+ using (var jsonUtf8 = new Utf8JsonWriter(output, options))
+ {
+ jsonUtf8.WriteStartObject();
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartArray(key));
+ }
+ }
+ catch (OutOfMemoryException)
{
- jsonUtf8.WriteStartObject();
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartArray(key));
+ throw new SkipTestException("Out of memory allocating large objects");
}
}
[InlineData(false, false)]
public void WritingTooLargePropertyStandalone(bool formatted, bool skipValidation)
{
- byte[] key;
- char[] keyChars;
-
try
{
+ byte[] key;
+ char[] keyChars;
+
key = new byte[MaxUnescapedTokenSize + 1];
keyChars = new char[MaxUnescapedTokenSize + 1];
- }
- catch (OutOfMemoryException)
- {
- return;
- }
- key.AsSpan().Fill((byte)'a');
- keyChars.AsSpan().Fill('a');
+ key.AsSpan().Fill((byte)'a');
+ keyChars.AsSpan().Fill('a');
- var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
- var output = new ArrayBufferWriter<byte>(1024);
+ var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
+ var output = new ArrayBufferWriter<byte>(1024);
- using (var jsonUtf8 = new Utf8JsonWriter(output, options))
- {
- jsonUtf8.WriteStartObject();
- Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(keyChars));
- }
+ using (var jsonUtf8 = new Utf8JsonWriter(output, options))
+ {
+ jsonUtf8.WriteStartObject();
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(keyChars));
+ }
- using (var jsonUtf8 = new Utf8JsonWriter(output, options))
+ using (var jsonUtf8 = new Utf8JsonWriter(output, options))
+ {
+ jsonUtf8.WriteStartObject();
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(key));
+ }
+ }
+ catch (OutOfMemoryException)
{
- jsonUtf8.WriteStartObject();
- Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(key));
+ throw new SkipTestException("Out of memory allocating large objects");
}
}
[InlineData(false, false)]
public void WriteLargeKeyOrValue(bool formatted, bool skipValidation)
{
- byte[] key;
- byte[] value;
-
try
{
+ byte[] key;
+ byte[] value;
+
key = new byte[MaxUnescapedTokenSize + 1];
value = new byte[MaxUnescapedTokenSize + 1];
- }
- catch (OutOfMemoryException)
- {
- return;
- }
- key.AsSpan().Fill((byte)'a');
- value.AsSpan().Fill((byte)'b');
+ key.AsSpan().Fill((byte)'a');
+ value.AsSpan().Fill((byte)'b');
- var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
+ var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
- {
- var output = new ArrayBufferWriter<byte>(1024);
- using var jsonUtf8 = new Utf8JsonWriter(output, options);
- jsonUtf8.WriteStartObject();
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(key, DateTimeTestHelpers.FixedDateTimeValue));
- Assert.Equal(0, output.WrittenCount);
- }
+ {
+ var output = new ArrayBufferWriter<byte>(1024);
+ using var jsonUtf8 = new Utf8JsonWriter(output, options);
+ jsonUtf8.WriteStartObject();
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(key, DateTimeTestHelpers.FixedDateTimeValue));
+ Assert.Equal(0, output.WrittenCount);
+ }
+ {
+ var output = new ArrayBufferWriter<byte>(1024);
+ using var jsonUtf8 = new Utf8JsonWriter(output, options);
+ jsonUtf8.WriteStartArray();
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStringValue(value));
+ Assert.Equal(0, output.WrittenCount);
+ }
+ }
+ catch (OutOfMemoryException)
{
- var output = new ArrayBufferWriter<byte>(1024);
- using var jsonUtf8 = new Utf8JsonWriter(output, options);
- jsonUtf8.WriteStartArray();
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStringValue(value));
- Assert.Equal(0, output.WrittenCount);
+ throw new SkipTestException("Out of memory allocating large objects");
}
}
[InlineData(false, false)]
public void WriteLargeKeyValue(bool formatted, bool skipValidation)
{
- var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
-
- Span<byte> key;
- Span<byte> value;
-
try
{
+ var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
+
+ Span<byte> key;
+ Span<byte> value;
+
key = new byte[MaxUnescapedTokenSize + 1];
value = new byte[MaxUnescapedTokenSize + 1];
+
+ WriteTooLargeHelper(options, key, value);
+ WriteTooLargeHelper(options, key.Slice(0, MaxUnescapedTokenSize), value);
+ WriteTooLargeHelper(options, key, value.Slice(0, MaxUnescapedTokenSize));
+ WriteTooLargeHelper(options, key.Slice(0, 10_000_000 / 3), value.Slice(0, 10_000_000 / 3), noThrow: true);
}
catch (OutOfMemoryException)
{
- return;
+ throw new SkipTestException("Out of memory allocating large objects");
}
-
- WriteTooLargeHelper(options, key, value);
- WriteTooLargeHelper(options, key.Slice(0, MaxUnescapedTokenSize), value);
- WriteTooLargeHelper(options, key, value.Slice(0, MaxUnescapedTokenSize));
- WriteTooLargeHelper(options, key.Slice(0, 10_000_000 / 3), value.Slice(0, 10_000_000 / 3), noThrow: true);
}
// NOTE: WriteLargeKeyEscapedValue test is constrained to run on Windows and MacOSX because it causes
[InlineData(false, false)]
public void WriteLargeKeyEscapedValue(bool formatted, bool skipValidation)
{
- var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
-
- Span<byte> key;
- Span<byte> value;
-
try
{
+ var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
+
+ Span<byte> key;
+ Span<byte> value;
+
// Since the byte values are 0 they will be escaped and size > MaxUnescapedTokenSize but < MaxEscapedTokenSize.
key = new byte[MaxUnescapedTokenSize / 2];
value = new byte[MaxUnescapedTokenSize / 2];
+
+ WriteTooLargeHelper(options, key, value, noThrow: true);
}
catch (OutOfMemoryException)
{
- return;
+ throw new SkipTestException("Out of memory allocating large objects");
}
-
- WriteTooLargeHelper(options, key, value, noThrow: true);
}
[Theory]
[InlineData(false, false)]
public void WriteTooLargeArguments(bool formatted, bool skipValidation)
{
- var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
-
- byte[] bytesTooLarge;
- char[] charsTooLarge;
- var bytes = new byte[5];
- var chars = new char[5];
-
try
{
+ var options = new JsonWriterOptions { Indented = formatted, SkipValidation = skipValidation };
+
+ byte[] bytesTooLarge;
+ char[] charsTooLarge;
+ var bytes = new byte[5];
+ var chars = new char[5];
+
bytesTooLarge = new byte[400_000_000];
charsTooLarge = new char[400_000_000];
- }
- catch (OutOfMemoryException)
- {
- return;
- }
- bytesTooLarge.AsSpan().Fill((byte)'a');
- charsTooLarge.AsSpan().Fill('a');
- bytes.AsSpan().Fill((byte)'a');
- chars.AsSpan().Fill('a');
+ bytesTooLarge.AsSpan().Fill((byte)'a');
+ charsTooLarge.AsSpan().Fill('a');
+ bytes.AsSpan().Fill((byte)'a');
+ chars.AsSpan().Fill('a');
- var pipe = new Pipe();
- PipeWriter output = pipe.Writer;
- using var jsonUtf8 = new Utf8JsonWriter(output, options);
+ var pipe = new Pipe();
+ PipeWriter output = pipe.Writer;
+ using var jsonUtf8 = new Utf8JsonWriter(output, options);
- jsonUtf8.WriteStartArray();
+ jsonUtf8.WriteStartArray();
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartObject(bytesTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, bytes));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytes, bytesTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, chars));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(chars, bytesTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, new DateTime(2015, 11, 9)));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, new DateTimeOffset(new DateTime(2015, 11, 9))));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, Guid.NewGuid()));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStringValue(bytesTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteCommentValue(bytesTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 10m));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 10.1));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 10.1f));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 12345678901));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, (ulong)12345678901));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteBoolean(bytesTooLarge, true));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNull(bytesTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(bytesTooLarge));
-
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartObject(charsTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, chars));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(chars, charsTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, bytes));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytes, charsTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, new DateTime(2015, 11, 9)));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, new DateTimeOffset(new DateTime(2015, 11, 9))));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, Guid.NewGuid()));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStringValue(charsTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteCommentValue(charsTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 10m));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 10.1));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 10.1f));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 12345678901));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, (ulong)12345678901));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteBoolean(charsTooLarge, true));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNull(charsTooLarge));
- Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(charsTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartObject(bytesTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, bytes));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytes, bytesTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, chars));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(chars, bytesTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, new DateTime(2015, 11, 9)));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, new DateTimeOffset(new DateTime(2015, 11, 9))));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytesTooLarge, Guid.NewGuid()));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStringValue(bytesTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteCommentValue(bytesTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 10m));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 10.1));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 10.1f));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, 12345678901));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(bytesTooLarge, (ulong)12345678901));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteBoolean(bytesTooLarge, true));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNull(bytesTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(bytesTooLarge));
+
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStartObject(charsTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, chars));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(chars, charsTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, bytes));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(bytes, charsTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, new DateTime(2015, 11, 9)));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, new DateTimeOffset(new DateTime(2015, 11, 9))));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteString(charsTooLarge, Guid.NewGuid()));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteStringValue(charsTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteCommentValue(charsTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 10m));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 10.1));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 10.1f));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, 12345678901));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNumber(charsTooLarge, (ulong)12345678901));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteBoolean(charsTooLarge, true));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WriteNull(charsTooLarge));
+ Assert.Throws<ArgumentException>(() => jsonUtf8.WritePropertyName(charsTooLarge));
- jsonUtf8.Flush();
- Assert.Equal(1, jsonUtf8.BytesCommitted);
+ jsonUtf8.Flush();
+ Assert.Equal(1, jsonUtf8.BytesCommitted);
+ }
+ catch (OutOfMemoryException)
+ {
+ throw new SkipTestException("Out of memory allocating large objects");
+ }
}
[Fact]
using System.Runtime.CompilerServices;
using System.Text;
using Microsoft.DotNet.RemoteExecutor;
+using Microsoft.DotNet.XUnitExtensions;
using Xunit;
using Xunit.Sdk;
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void DroppedIncompleteStateMachine_RaisesIncompleteAsyncMethodEvent()
{
+ if (!PlatformDetection.IsPreciseGcSupported)
+ {
+ throw new SkipTestException("Test requires precise GC");
+ }
+
RemoteExecutor.Invoke(() =>
{
using (var listener = new TestEventListener("System.Threading.Tasks.TplEventSource", EventLevel.Verbose))
}
EventWrittenEventArgs iam = events.SingleOrDefault(e => e.EventName == "IncompleteAsyncMethod");
- Assert.NotNull(iam);
+ if (iam == null)
+ {
+ sb.AppendLine("Events did not contain IncompleteAsyncMethod event.")
+ .AppendLine("List of events contained:")
+ .AppendLine(string.Join(Environment.NewLine, events.Select(e => e.EventName)))
+ .AppendLine();
+ throw new XunitException(sb.ToString());
+ }
Assert.NotNull(iam.Payload);
string description = iam.Payload[0] as string;
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using Xunit;
+
+[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/88992", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.IsX86Process))]
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
<Compile Include="NonMsdtcPromoterTests.cs" />
<Compile Include="AsyncTransactionScopeTests.cs" />
<Compile Include="IntResourceManager.cs" />