Fixes for outerloop-mono.yml (#88743)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 25 Jul 2023 17:39:04 +0000 (19:39 +0200)
committerGitHub <noreply@github.com>
Tue, 25 Jul 2023 17:39:04 +0000 (19:39 +0200)
Consolidate configurations and disable failing tests with ActiveIssue.

19 files changed:
eng/pipelines/libraries/outerloop-mono.yml
eng/pipelines/libraries/outerloop.yml
src/libraries/System.Diagnostics.DiagnosticSource/tests/AssemblyInfo.cs [new file with mode: 0644]
src/libraries/System.Diagnostics.DiagnosticSource/tests/System.Diagnostics.DiagnosticSource.Tests.csproj
src/libraries/System.Net.Sockets/tests/FunctionalTests/AssemblyInfo.cs
src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs
src/libraries/System.Runtime.Caching/tests/AssemblyInfo.cs [new file with mode: 0644]
src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching.Tests.csproj
src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/AssemblyInfo.cs [new file with mode: 0644]
src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonEncodedTextTests.cs
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.WriteTests.cs
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Value.ReadTests.cs
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.cs
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.WriteRaw.cs
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs
src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs
src/libraries/System.Transactions.Local/tests/AssemblyInfo.cs [new file with mode: 0644]
src/libraries/System.Transactions.Local/tests/System.Transactions.Local.Tests.csproj

index 8cca7c4..e15fc35 100644 (file)
@@ -1,7 +1,7 @@
 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:
@@ -24,14 +24,14 @@ extends:
             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
@@ -41,34 +41,29 @@ extends:
               # 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)
index 125a7ed..b6fb6bb 100644 (file)
@@ -40,7 +40,7 @@ extends:
               - 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'] }}
@@ -68,7 +68,7 @@ extends:
                 - 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'] }}
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/AssemblyInfo.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..9d9f83d
--- /dev/null
@@ -0,0 +1,7 @@
+// 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))]
index 502c8d8..7e8136e 100644 (file)
@@ -23,6 +23,7 @@
     <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" />
index 09a34bb..5afed22 100644 (file)
@@ -1,7 +1,9 @@
 // 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))]
index bf7e8c5..ded3427 100644 (file)
@@ -1,6 +1,7 @@
 // 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;
@@ -847,7 +848,7 @@ namespace System.Net.Sockets.Tests
         }
 
         [OuterLoop("Involves GC and finalization")]
-        [Theory]
+        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
         [InlineData(false)]
         [InlineData(true)]
         public void Finalizer_InvokedWhenNoLongerReferenced(bool afterAsyncOperation)
diff --git a/src/libraries/System.Runtime.Caching/tests/AssemblyInfo.cs b/src/libraries/System.Runtime.Caching/tests/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..9d9f83d
--- /dev/null
@@ -0,0 +1,7 @@
+// 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))]
index 46454a0..2bd7b79 100644 (file)
@@ -4,6 +4,7 @@
     <EventSourceSupport>true</EventSourceSupport>
   </PropertyGroup>
   <ItemGroup>
+    <Compile Include="AssemblyInfo.cs" />
     <Compile Include="AdditionalCacheTests\AdditionalCacheTests.cs" />
     <Compile Include="Common\PokerChangeMonitor.cs" />
     <Compile Include="Common\PokerMemoryCache.cs" />
diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/AssemblyInfo.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..9d9f83d
--- /dev/null
@@ -0,0 +1,7 @@
+// 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))]
index 4464887..4de2b8d 100644 (file)
@@ -4,6 +4,7 @@
     <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" />
index 0da487f..8ea5600 100644 (file)
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using System.Text.Encodings.Web;
 using System.Text.Unicode;
+using Microsoft.DotNet.XUnitExtensions;
 using Xunit;
 
 namespace System.Text.Json.Tests
@@ -235,7 +236,7 @@ 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");
@@ -302,7 +303,7 @@ 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");
@@ -362,7 +363,7 @@ namespace System.Text.Json.Tests
         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");
@@ -426,7 +427,7 @@ namespace System.Text.Json.Tests
             }
             catch (OutOfMemoryException)
             {
-                return;
+                throw new SkipTestException("Out of memory allocating large objects");
             }
         }
 
index 77e73dd..23461ca 100644 (file)
@@ -5,6 +5,7 @@ using System.Collections.Generic;
 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
@@ -161,42 +162,49 @@ 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
index 8063896..437acca 100644 (file)
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using System.Globalization;
 using System.Runtime.CompilerServices;
+using Microsoft.DotNet.XUnitExtensions;
 using Newtonsoft.Json;
 using Xunit;
 
@@ -453,8 +454,15 @@ namespace System.Text.Json.Serialization.Tests
         [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)
index 0be0fc7..0dd0b29 100644 (file)
@@ -3038,7 +3038,7 @@ namespace System.Text.Json.Tests
         [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("[");
@@ -3116,7 +3116,7 @@ namespace System.Text.Json.Tests
         [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("[");
index 929cedc..437daf3 100644 (file)
@@ -5,6 +5,7 @@ using System.Buffers;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using Microsoft.DotNet.XUnitExtensions;
 using Xunit;
 
 namespace System.Text.Json.Tests
@@ -348,46 +349,53 @@ 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");
             }
         }
 
@@ -399,63 +407,70 @@ namespace System.Text.Json.Tests
         [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
@@ -494,35 +509,42 @@ namespace System.Text.Json.Tests
         [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)]
@@ -539,7 +561,10 @@ namespace System.Text.Json.Tests
                 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)]
@@ -547,41 +572,48 @@ namespace System.Text.Json.Tests
         [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");
             }
         }
 
index e625db9..ea3ee05 100644 (file)
@@ -785,46 +785,53 @@ namespace System.Text.Json.Tests
         [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");
             }
         }
 
@@ -3016,35 +3023,35 @@ namespace System.Text.Json.Tests
         [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");
             }
         }
 
@@ -3061,35 +3068,35 @@ namespace System.Text.Json.Tests
         [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");
             }
         }
 
@@ -6378,38 +6385,38 @@ namespace System.Text.Json.Tests
         [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");
             }
         }
 
@@ -6426,25 +6433,25 @@ namespace System.Text.Json.Tests
         [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
@@ -6460,23 +6467,23 @@ namespace System.Text.Json.Tests
         [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]
@@ -6854,74 +6861,74 @@ namespace System.Text.Json.Tests
         [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]
index 2ef2b23..4364e91 100644 (file)
@@ -9,6 +9,7 @@ using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Text;
 using Microsoft.DotNet.RemoteExecutor;
+using Microsoft.DotNet.XUnitExtensions;
 using Xunit;
 using Xunit.Sdk;
 
@@ -576,6 +577,11 @@ namespace System.Threading.Tasks.Tests
         [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))
@@ -623,7 +629,14 @@ namespace System.Threading.Tasks.Tests
                     }
 
                     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;
diff --git a/src/libraries/System.Transactions.Local/tests/AssemblyInfo.cs b/src/libraries/System.Transactions.Local/tests/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..9d9f83d
--- /dev/null
@@ -0,0 +1,7 @@
+// 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))]
index e6f9cbf..bc4c5a3 100644 (file)
@@ -4,6 +4,7 @@
     <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
   </PropertyGroup>
   <ItemGroup>
+    <Compile Include="AssemblyInfo.cs" />
     <Compile Include="NonMsdtcPromoterTests.cs" />
     <Compile Include="AsyncTransactionScopeTests.cs" />
     <Compile Include="IntResourceManager.cs" />