From 88aacc6d78091467d821b898db4f7d497bfd3d36 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 2 Apr 2025 14:48:38 +0200 Subject: [PATCH 01/52] Enable running library tests --- eng/pipelines/runtime.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 48d65de310e92f..93f916671d007c 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -974,7 +974,7 @@ extends: jobParameters: testGroup: innerloop nameSuffix: AllSubsets_CoreCLR - buildArgs: -s clr.runtime+clr.alljits+clr.corelib+clr.nativecorelib+clr.tools+clr.packages+libs++libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:TestAssemblies=false + buildArgs: -s clr.runtime+clr.alljits+clr.corelib+clr.nativecorelib+clr.tools+clr.packages+libs++libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true timeoutInMinutes: 480 condition: >- or( From 42028b6150d0eb5d91980573157302dae0af232e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 4 Apr 2025 10:28:27 +0200 Subject: [PATCH 02/52] Add jobs to extra-platforms --- .../runtime-extra-platforms-android.yml | 31 +++++++++++++++++++ ...untime-extra-platforms-androidemulator.yml | 31 +++++++++++++++++++ eng/pipelines/runtime.yml | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml index 7b9d41475f30e0..dc52aaf887233d 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml @@ -83,3 +83,34 @@ jobs: parameters: creator: dotnet-bot testRunNamePrefixSuffix: Mono_$(_BuildConfig) + +# +# Android emulators +# Build the whole product using CoreCLR and run libraries tests +# +- 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: coreclr + platforms: + - android_arm64 + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] + - name: coreclrContainsChange + value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: AllSubsets_CoreCLR + isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} + buildArgs: -s clr.runtime+clr.alljits+clr.corelib+clr.nativecorelib+clr.tools+clr.packages+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) + timeoutInMinutes: 480 + # extra steps, run tests + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml index 4badaf93186c0b..a5e08d1f453ff8 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml @@ -118,3 +118,34 @@ jobs: parameters: creator: dotnet-bot testRunNamePrefixSuffix: Mono_$(_BuildConfig) + +# +# Android emulators +# Build the whole product using CoreCLR and run libraries tests +# +- 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: coreclr + platforms: + - android_x64 + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] + - name: coreclrContainsChange + value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: AllSubsets_CoreCLR + isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} + buildArgs: -s clr.runtime+clr.alljits+clr.corelib+clr.nativecorelib+clr.tools+clr.packages+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) + timeoutInMinutes: 180 + # extra steps, run tests + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 93f916671d007c..d4e847bd85fcf8 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -974,7 +974,7 @@ extends: jobParameters: testGroup: innerloop nameSuffix: AllSubsets_CoreCLR - buildArgs: -s clr.runtime+clr.alljits+clr.corelib+clr.nativecorelib+clr.tools+clr.packages+libs++libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true + buildArgs: -s clr.runtime+clr.alljits+clr.corelib+clr.nativecorelib+clr.tools+clr.packages+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true timeoutInMinutes: 480 condition: >- or( From f45a428117b6e48f93dfa16fc682e1cdd206fe88 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 7 Apr 2025 14:07:12 +0200 Subject: [PATCH 03/52] Fix System.Runtime tests --- eng/testing/tests.android.targets | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/eng/testing/tests.android.targets b/eng/testing/tests.android.targets index 3c3eb46fa28ebd..4144799c78f908 100644 --- a/eng/testing/tests.android.targets +++ b/eng/testing/tests.android.targets @@ -3,7 +3,7 @@ $(BundleTestAppTargets);BundleTestAndroidApp - + @@ -12,6 +12,10 @@ AndroidBuild + + $(DefineConstants);SINGLE_FILE_TEST_RUNNER + + @@ -22,7 +26,7 @@ AndroidTestRunner.dll - + $(PublishDir) $(BundleDir) @@ -44,7 +48,7 @@ <_InternalForceInterpret>true <_IsNative>true - + <_PublishAssemblies Include="$(PublishDir)\**\*.dll" Exclude="$(PublishDir)\**\*.resources.dll" /> <_SatelliteAssemblies Include="$(PublishDir)\**\*.resources.dll" /> @@ -73,4 +77,4 @@ - \ No newline at end of file + From 84a98553e753db74d21c8859665c6c966c9c8049 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 10 Apr 2025 15:37:22 +0200 Subject: [PATCH 04/52] Fix arm64 android coreclr tests --- .../ConfigBindingGenTestDriver.cs | 1 + .../GeneratorTests.Baselines.Options.cs | 8 ++-- .../tests/SourceGeneration.Unit.Tests/Main.cs | 41 +++++++++++++++++++ .../SourceGenerationTests/EmitterTests.cs | 1 + .../Microsoft.VisualBasic.Core.Tests.csproj | 3 +- .../CodeDom/Compiler/CompilerResultsTests.cs | 1 + 6 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs index 2c6bf5c33bcaf2..7162323bb60271 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs @@ -18,6 +18,7 @@ namespace Microsoft.Extensions.SourceGeneration.Configuration.Binder.Tests { [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public partial class ConfigurationBindingGeneratorTests : ConfigurationBinderTestsBase { internal sealed class ConfigBindingGenTestDriver diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Baselines.Options.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Baselines.Options.cs index 219c57b9e59131..e887e1b9cdec1f 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Baselines.Options.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Baselines.Options.cs @@ -72,7 +72,7 @@ public async Task Configure_T_NamedParameters_OutOfOrder(string row) using System.Collections.Generic; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; - + public class Program { public static void Main() @@ -84,7 +84,7 @@ public static void Main() {{row}} } - + public class MyClass { public string MyString { get; set; } @@ -109,7 +109,7 @@ public async Task Bind_T_NamedParameters_OutOfOrder(string row) using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; - + public class Program { public static void Main() @@ -121,7 +121,7 @@ public static void Main() {{row}} } - + public class MyClass { public string MyString { get; set; } diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs index 5a3479b42c3568..71ae23f4fa34d5 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs @@ -25,6 +25,7 @@ namespace Microsoft.Gen.OptionsValidation.Unit.Test; public class EmitterTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task TestEmitterWithCustomValidator() { string source = """ @@ -65,6 +66,7 @@ public partial struct MyOptionsValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task PotentiallyMissingAttributes() { var (diagnostics, _) = await RunGenerator(@" @@ -95,6 +97,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task IgnoredStaticMembers() { var (d, _) = await RunGenerator(@" @@ -130,6 +133,7 @@ public partial class FirstModelValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ValidationAttributeOnStaticMember() { var (d, _) = await RunGenerator(@" @@ -169,6 +173,7 @@ public partial class FirstModelValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task CircularTypeReferences() { var (diagnostics, _) = await RunGenerator(@" @@ -190,6 +195,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task InvalidValidatorInterface() { var (diagnostics, _) = await RunGenerator(@" @@ -221,6 +227,7 @@ public partial class SecondValidator } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NotValidator() { var (diagnostics, _) = await RunGenerator(@" @@ -251,6 +258,7 @@ public partial class SecondValidator } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ValidatorAlreadyImplementValidateFunction() { var (diagnostics, _) = await RunGenerator(@" @@ -289,6 +297,7 @@ public ValidateOptionsResult Validate(string name, SecondModel options) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NullValidator() { var (diagnostics, _) = await RunGenerator(@" @@ -320,6 +329,7 @@ public partial class SecondValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NoSimpleValidatorConstructor() { var (diagnostics, _) = await RunGenerator(@" @@ -357,6 +367,7 @@ public SecondValidator(int _) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NoStaticValidator() { var (diagnostics, _) = await RunGenerator(@" @@ -377,6 +388,7 @@ public static partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task BogusModelType() { var (diagnostics, _) = await RunGenerator(@" @@ -391,6 +403,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task CantValidateOpenGenericMembers() { var (diagnostics, _) = await RunGenerator(@" @@ -422,6 +435,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ClosedGenerics() { var (diagnostics, _) = await RunGenerator(@" @@ -458,6 +472,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NoEligibleMembers() { var (diagnostics, _) = await RunGenerator(@" @@ -490,6 +505,7 @@ public partial class SecondValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task AlreadyImplemented() { var (diagnostics, _) = await RunGenerator(@" @@ -513,6 +529,7 @@ public void Validate(string name, FirstModel fm) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldNotProduceInfoWhenTheClassHasABaseClass() { var (diagnostics, _) = await RunGenerator(@" @@ -538,6 +555,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldNotProduceInfoWhenTransitiveClassHasABaseClass() { var (diagnostics, _) = await RunGenerator(@" @@ -604,6 +622,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldProduceWarningWhenTheClassHasNoEligibleMembers() { var (diagnostics, _) = await RunGenerator(@" @@ -649,6 +668,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldNotProduceErrorWhenMultipleValidationAnnotationsExist() { var (diagnostics, _) = await RunGenerator(@" @@ -669,6 +689,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldNotProduceErrorWhenDataTypeAttributesAreUsed() { var (diagnostics, _) = await RunGenerator(@" @@ -703,6 +724,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldNotProduceErrorWhenConstVariableIsUsedAsAttributeArgument() { var (diagnostics, _) = await RunGenerator(@" @@ -724,6 +746,7 @@ public partial class Validator : IValidateOptions // Testing on all existing & eligible annotations extending ValidationAttribute that aren't used above [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldNotProduceAnyMessagesWhenExistingValidationsArePlaced() { var (diagnostics, _) = await RunGenerator(@" @@ -764,6 +787,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldNotProduceErrorWhenPropertiesAreUsedAsAttributeArgument() { var (diagnostics, _) = await RunGenerator(@" @@ -784,6 +808,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldSkipWhenOptionsValidatorAttributeDoesNotExist() { var (diagnostics, _) = await RunGenerator(@" @@ -804,6 +829,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldSkipAtrributeWhenAttributeSymbolCannotBeFound() { var (diagnostics, _) = await RunGenerator(@" @@ -826,6 +852,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldSkipAtrributeWhenAttributeSymbolIsNotBasedOnValidationAttribute() { var (diagnostics, _) = await RunGenerator(@" @@ -848,6 +875,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldAcceptAtrributeWhenAttributeIsInDifferentNamespace() { var (diagnostics, _) = await RunGenerator(@" @@ -874,6 +902,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldHandleAtrributePropertiesOtherThanString() { var (diagnostics, _) = await RunGenerator(@" @@ -908,6 +937,7 @@ public TestAttribute() { } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ShouldStoreFloatValuesCorrectly() { var backupCulture = CultureInfo.CurrentCulture; @@ -939,6 +969,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task MultiModelValidatorGeneratesOnlyOnePartialTypeBlock() { var (diagnostics, sources) = await RunGenerator(@" @@ -988,6 +1019,7 @@ public partial class MultiValidator : IValidateOptions, IValidateOpt } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task CircularTypeReferencesInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1009,6 +1041,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NotValidatorInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1039,6 +1072,7 @@ public partial class SecondValidator } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NullValidatorInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1070,6 +1104,7 @@ public partial class SecondValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NoSimpleValidatorConstructorInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1437,6 +1472,7 @@ public sealed partial class MyOptionsValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task CantValidateOpenGenericMembersInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1468,6 +1504,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task ClosedGenericsInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1499,6 +1536,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task NotEnumerable() { var (diagnostics, _) = await RunGenerator(@" @@ -1520,6 +1558,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task LanguageVersionTest() { string source = """ @@ -1822,6 +1861,7 @@ public sealed partial class OptionsUsingGeneratedAttributesValidator : IValidate } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task UsingInterfaceAsPropertyTypeForLengthAttributesTests() { var (diagnostics, generatedSources) = await RunGenerator(@""" @@ -1866,6 +1906,7 @@ public partial class MyOptionsValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task OptionsExtendingSystemClassTest() { string source = """ diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs index 1f54faf77d7fef..2d9ad6ae5e026e 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs @@ -18,6 +18,7 @@ namespace Microsoft.Gen.OptionsValidation.Test; public class EmitterTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public async Task TestEmitter() { var sources = new List(); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj index 688a009eb8691f..467e2665cec96b 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj @@ -2,6 +2,7 @@ $(NetCoreAppCurrent);$(NetFrameworkCurrent) true + false 1 @@ -62,4 +63,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs index aa791baa631aa8..cb60b31b6b543f 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs @@ -29,6 +29,7 @@ public void Ctor_TempFileCollection(TempFileCollection tempFiles) } [Fact] + [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public void CompiledAssembly_GetWithPathToAssemblySet_ReturnsExpectedAssembly() { var results = new CompilerResults(null) { PathToAssembly = AssemblyPathHelper.GetAssemblyLocation(typeof(CompilerResultsTests).Assembly) }; From a78d0cea8909e87ab17c278f947751017dab8e68 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 10 Apr 2025 18:13:57 +0200 Subject: [PATCH 05/52] Add TestUtilities project reference --- ...tensions.Configuration.Binder.SourceGeneration.Tests.csproj | 1 + ...osoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj | 1 + .../Microsoft.Extensions.Options.SourceGeneration.Tests.csproj | 1 + src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj | 3 +++ 4 files changed, 6 insertions(+) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj index 8a406566c1aeec..e6d67af9582483 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj @@ -48,6 +48,7 @@ + diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj index 38b388d44c6e8b..66ba860e8bf008 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj @@ -34,6 +34,7 @@ + diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj index 7f2cd358d95991..6d1474c15afaa9 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj @@ -32,6 +32,7 @@ + diff --git a/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj b/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj index 4db5a506b11789..fc6831551db58f 100644 --- a/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj +++ b/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj @@ -114,4 +114,7 @@ + + + From 3187139b38569a7031a26e7d0f51db293b109c00 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Thu, 10 Apr 2025 18:16:30 -0400 Subject: [PATCH 06/52] Add support for local android test execution on windows --- eng/testing/AndroidRunnerTemplate.cmd | 47 +++++++++++++++++++++++++++ eng/testing/tests.targets | 10 +++--- 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 eng/testing/AndroidRunnerTemplate.cmd diff --git a/eng/testing/AndroidRunnerTemplate.cmd b/eng/testing/AndroidRunnerTemplate.cmd new file mode 100644 index 00000000000000..a1535a9e2b6e52 --- /dev/null +++ b/eng/testing/AndroidRunnerTemplate.cmd @@ -0,0 +1,47 @@ +@ECHO OFF +setlocal enabledelayedexpansion + +SET EXECUTION_DIR=%~dp0 +SET ASSEMBLY_NAME=%1 +SET TARGET_ARCH=%2 +SET TARGET_OS=%3 +SET TEST_NAME=%4 +SET REPO_ROOT=%5 + +:Arg_Loop +if "%6" == "" goto ArgsDone +set "__AdditionalArgs=!__AdditionalArgs! %6"&shift&goto Arg_Loop +:ArgsDone + +SET "XHARNESS_OUT=%EXECUTION_DIR%xharness-output" + +cd %EXECUTION_DIR% + +:lock +MKDIR androidtests.lock 2>NUL +IF "%errorlevel%" NEQ "0" ( + ping -n 6 127.0.0.1 >NUL + GOTO :lock +) + +IF [%XHARNESS_CLI_PATH%] NEQ [] ( + :: When running in CI, we only have the .NET runtime available + :: We need to call the XHarness CLI DLL directly via dotnet exec + SET HARNESS_RUNNER=%REPO_ROOT%dotnet.cmd exec "%XHARNESS_CLI_PATH%" +) ELSE ( + SET HARNESS_RUNNER=%REPO_ROOT%dotnet.cmd xharness +) + +%HARNESS_RUNNER% android test --instrumentation="net.dot.MonoRunner" --package-name="net.dot.%ASSEMBLY_NAME%" --app="%EXECUTION_DIR%bin\%TEST_NAME%.apk" --output-directory="%XHARNESS_OUT%" --timeout=1800 %__AdditionalArgs% + +SET EXIT_CODE=%ERRORLEVEL% + +ECHO XHarness artifacts: %XHARNESS_OUT% + +RMDIR /Q androidtests.lock 2>NUL +EXIT /B %EXIT_CODE% + +:: ========== FUNCTIONS ========== +:NORMALIZEPATH + SET RETVAL=%~f1 + EXIT /B diff --git a/eng/testing/tests.targets b/eng/testing/tests.targets index 4ffbd60c365dc0..f05b4aa2a67c7b 100644 --- a/eng/testing/tests.targets +++ b/eng/testing/tests.targets @@ -1,14 +1,15 @@ - true - false + true + false RunnerTemplate.cmd RunnerTemplate.sh AppleHelixRunnerTemplate.sh AppleRunnerTemplate.sh - AndroidRunnerTemplate.sh + AndroidRunnerTemplate.sh + AndroidRunnerTemplate.cmd WasiRunnerTemplate.sh WasiRunnerTemplate.cmd WasmRunnerTemplate.sh @@ -172,7 +173,8 @@ TEST_ARCH=$(_AndroidArchitecture) "$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture) $(TargetOS) $(TestProjectName) $(RunTestsCommand) $(Configuration) $(AdditionalXHarnessArguments) - $(RunTestsCommand) $(AdditionalXHarnessArguments) + $(RunTestsCommand) $(AdditionalXHarnessArguments) + $(RunTestsCommand) $(RepoRoot) $(AdditionalXHarnessArguments) "$(RunScriptOutputPath)" $(JSEngine) $(AssemblyName).dll $(Scenario) From 8d9964c920c955d4165a2df4174ea42636488189 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 18 Apr 2025 14:41:38 +0200 Subject: [PATCH 07/52] Disable failing tests on Android devices --- .../ConfigBindingGenTestDriver.cs | 2 +- ...ation.Binder.SourceGeneration.Tests.csproj | 1 - .../tests/SourceGeneration.Unit.Tests/Main.cs | 82 +++++++++---------- ...Options.SourceGeneration.Unit.Tests.csproj | 1 - .../SourceGenerationTests/EmitterTests.cs | 2 +- ...ions.Options.SourceGeneration.Tests.csproj | 1 - .../tests/System.CodeDom.Tests.csproj | 3 - .../CodeDom/Compiler/CompilerResultsTests.cs | 3 +- 8 files changed, 44 insertions(+), 51 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs index 7162323bb60271..d43c095b79a529 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs @@ -18,7 +18,7 @@ namespace Microsoft.Extensions.SourceGeneration.Configuration.Binder.Tests { [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public partial class ConfigurationBindingGeneratorTests : ConfigurationBinderTestsBase { internal sealed class ConfigBindingGenTestDriver diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj index e6d67af9582483..8a406566c1aeec 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Microsoft.Extensions.Configuration.Binder.SourceGeneration.Tests.csproj @@ -48,7 +48,6 @@ - diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs index 71ae23f4fa34d5..850c4008b1cc59 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs @@ -25,7 +25,7 @@ namespace Microsoft.Gen.OptionsValidation.Unit.Test; public class EmitterTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task TestEmitterWithCustomValidator() { string source = """ @@ -66,7 +66,7 @@ public partial struct MyOptionsValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task PotentiallyMissingAttributes() { var (diagnostics, _) = await RunGenerator(@" @@ -97,7 +97,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task IgnoredStaticMembers() { var (d, _) = await RunGenerator(@" @@ -133,7 +133,7 @@ public partial class FirstModelValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ValidationAttributeOnStaticMember() { var (d, _) = await RunGenerator(@" @@ -173,7 +173,7 @@ public partial class FirstModelValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CircularTypeReferences() { var (diagnostics, _) = await RunGenerator(@" @@ -195,7 +195,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task InvalidValidatorInterface() { var (diagnostics, _) = await RunGenerator(@" @@ -227,7 +227,7 @@ public partial class SecondValidator } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NotValidator() { var (diagnostics, _) = await RunGenerator(@" @@ -258,7 +258,7 @@ public partial class SecondValidator } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ValidatorAlreadyImplementValidateFunction() { var (diagnostics, _) = await RunGenerator(@" @@ -297,7 +297,7 @@ public ValidateOptionsResult Validate(string name, SecondModel options) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NullValidator() { var (diagnostics, _) = await RunGenerator(@" @@ -329,7 +329,7 @@ public partial class SecondValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoSimpleValidatorConstructor() { var (diagnostics, _) = await RunGenerator(@" @@ -367,7 +367,7 @@ public SecondValidator(int _) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoStaticValidator() { var (diagnostics, _) = await RunGenerator(@" @@ -388,7 +388,7 @@ public static partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task BogusModelType() { var (diagnostics, _) = await RunGenerator(@" @@ -403,7 +403,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CantValidateOpenGenericMembers() { var (diagnostics, _) = await RunGenerator(@" @@ -435,7 +435,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ClosedGenerics() { var (diagnostics, _) = await RunGenerator(@" @@ -472,7 +472,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoEligibleMembers() { var (diagnostics, _) = await RunGenerator(@" @@ -505,7 +505,7 @@ public partial class SecondValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task AlreadyImplemented() { var (diagnostics, _) = await RunGenerator(@" @@ -529,7 +529,7 @@ public void Validate(string name, FirstModel fm) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceInfoWhenTheClassHasABaseClass() { var (diagnostics, _) = await RunGenerator(@" @@ -555,7 +555,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceInfoWhenTransitiveClassHasABaseClass() { var (diagnostics, _) = await RunGenerator(@" @@ -622,7 +622,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldProduceWarningWhenTheClassHasNoEligibleMembers() { var (diagnostics, _) = await RunGenerator(@" @@ -668,7 +668,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenMultipleValidationAnnotationsExist() { var (diagnostics, _) = await RunGenerator(@" @@ -689,7 +689,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenDataTypeAttributesAreUsed() { var (diagnostics, _) = await RunGenerator(@" @@ -724,7 +724,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenConstVariableIsUsedAsAttributeArgument() { var (diagnostics, _) = await RunGenerator(@" @@ -746,7 +746,7 @@ public partial class Validator : IValidateOptions // Testing on all existing & eligible annotations extending ValidationAttribute that aren't used above [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceAnyMessagesWhenExistingValidationsArePlaced() { var (diagnostics, _) = await RunGenerator(@" @@ -787,7 +787,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenPropertiesAreUsedAsAttributeArgument() { var (diagnostics, _) = await RunGenerator(@" @@ -808,7 +808,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldSkipWhenOptionsValidatorAttributeDoesNotExist() { var (diagnostics, _) = await RunGenerator(@" @@ -829,7 +829,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldSkipAtrributeWhenAttributeSymbolCannotBeFound() { var (diagnostics, _) = await RunGenerator(@" @@ -852,7 +852,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldSkipAtrributeWhenAttributeSymbolIsNotBasedOnValidationAttribute() { var (diagnostics, _) = await RunGenerator(@" @@ -875,7 +875,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldAcceptAtrributeWhenAttributeIsInDifferentNamespace() { var (diagnostics, _) = await RunGenerator(@" @@ -902,7 +902,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldHandleAtrributePropertiesOtherThanString() { var (diagnostics, _) = await RunGenerator(@" @@ -937,7 +937,7 @@ public TestAttribute() { } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldStoreFloatValuesCorrectly() { var backupCulture = CultureInfo.CurrentCulture; @@ -969,7 +969,7 @@ public partial class Validator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task MultiModelValidatorGeneratesOnlyOnePartialTypeBlock() { var (diagnostics, sources) = await RunGenerator(@" @@ -1019,7 +1019,7 @@ public partial class MultiValidator : IValidateOptions, IValidateOpt } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CircularTypeReferencesInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1041,7 +1041,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NotValidatorInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1072,7 +1072,7 @@ public partial class SecondValidator } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NullValidatorInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1104,7 +1104,7 @@ public partial class SecondValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoSimpleValidatorConstructorInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1472,7 +1472,7 @@ public sealed partial class MyOptionsValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CantValidateOpenGenericMembersInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1504,7 +1504,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ClosedGenericsInEnumeration() { var (diagnostics, _) = await RunGenerator(@" @@ -1536,7 +1536,7 @@ public partial class FirstValidator : IValidateOptions> } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NotEnumerable() { var (diagnostics, _) = await RunGenerator(@" @@ -1558,7 +1558,7 @@ public partial class FirstValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task LanguageVersionTest() { string source = """ @@ -1861,7 +1861,7 @@ public sealed partial class OptionsUsingGeneratedAttributesValidator : IValidate } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task UsingInterfaceAsPropertyTypeForLengthAttributesTests() { var (diagnostics, generatedSources) = await RunGenerator(@""" @@ -1906,7 +1906,7 @@ public partial class MyOptionsValidator : IValidateOptions } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task OptionsExtendingSystemClassTest() { string source = """ diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj index 66ba860e8bf008..38b388d44c6e8b 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Microsoft.Extensions.Options.SourceGeneration.Unit.Tests.csproj @@ -34,7 +34,6 @@ - diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs index 2d9ad6ae5e026e..5beb018ef4c38d 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs @@ -18,7 +18,7 @@ namespace Microsoft.Gen.OptionsValidation.Test; public class EmitterTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task TestEmitter() { var sources = new List(); diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj index 6d1474c15afaa9..7f2cd358d95991 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Microsoft.Extensions.Options.SourceGeneration.Tests.csproj @@ -32,7 +32,6 @@ - diff --git a/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj b/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj index fc6831551db58f..4db5a506b11789 100644 --- a/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj +++ b/src/libraries/System.CodeDom/tests/System.CodeDom.Tests.csproj @@ -114,7 +114,4 @@ - - - diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs index cb60b31b6b543f..f36b765421ba4e 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs @@ -28,8 +28,7 @@ public void Ctor_TempFileCollection(TempFileCollection tempFiles) Assert.Same(tempFiles, results.TempFiles); } - [Fact] - [ActiveIssue("Singlefile applications Assembly.Location is expected to be empty", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void CompiledAssembly_GetWithPathToAssemblySet_ReturnsExpectedAssembly() { var results = new CompilerResults(null) { PathToAssembly = AssemblyPathHelper.GetAssemblyLocation(typeof(CompilerResultsTests).Assembly) }; From 62509534969e32b1b2d7e59d18f3eac1e3fb5ef3 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 18 Apr 2025 21:21:06 +0200 Subject: [PATCH 08/52] Disable failing tests on Android devices --- .../ConfigBindingGenTestDriver.cs | 3 +- .../tests/SourceGeneration.Unit.Tests/Main.cs | 41 ------------------- .../SourceGenerationTests/EmitterTests.cs | 1 - 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs index d43c095b79a529..0353f32bbf11a1 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs @@ -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.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; @@ -18,7 +19,7 @@ namespace Microsoft.Extensions.SourceGeneration.Configuration.Binder.Tests { [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public partial class ConfigurationBindingGeneratorTests : ConfigurationBinderTestsBase { internal sealed class ConfigBindingGenTestDriver diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs index 850c4008b1cc59..2b8b872a86f931 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs @@ -24,7 +24,6 @@ namespace Microsoft.Gen.OptionsValidation.Unit.Test; public class EmitterTests { - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task TestEmitterWithCustomValidator() { @@ -65,7 +64,6 @@ public partial struct MyOptionsValidator : IValidateOptions Assert.Equal(generatedSource.Replace("\r\n", "\n"), generatedSources[0].SourceText.ToString().Replace("\r\n", "\n")); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task PotentiallyMissingAttributes() { @@ -96,7 +94,6 @@ public partial class FirstValidator : IValidateOptions Assert.Equal(DiagDescriptors.PotentiallyMissingEnumerableValidation.Id, diagnostics[1].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task IgnoredStaticMembers() { @@ -132,7 +129,6 @@ public partial class FirstModelValidator : IValidateOptions Assert.Empty(d); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ValidationAttributeOnStaticMember() { @@ -172,7 +168,6 @@ public partial class FirstModelValidator : IValidateOptions Assert.All(d, x => Assert.Equal(DiagnosticSeverity.Warning, x.DefaultSeverity)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CircularTypeReferences() { @@ -194,7 +189,6 @@ public partial class FirstValidator : IValidateOptions Assert.Equal(DiagDescriptors.CircularTypeReferences.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task InvalidValidatorInterface() { @@ -226,7 +220,6 @@ public partial class SecondValidator Assert.Equal(DiagDescriptors.DoesntImplementIValidateOptions.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NotValidator() { @@ -257,7 +250,6 @@ public partial class SecondValidator Assert.Equal(DiagDescriptors.DoesntImplementIValidateOptions.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ValidatorAlreadyImplementValidateFunction() { @@ -296,7 +288,6 @@ public ValidateOptionsResult Validate(string name, SecondModel options) Assert.Equal(DiagDescriptors.AlreadyImplementsValidateMethod.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NullValidator() { @@ -328,7 +319,6 @@ public partial class SecondValidator : IValidateOptions Assert.Equal(DiagDescriptors.NullValidatorType.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoSimpleValidatorConstructor() { @@ -366,7 +356,6 @@ public SecondValidator(int _) Assert.Equal(DiagDescriptors.ValidatorsNeedSimpleConstructor.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoStaticValidator() { @@ -387,7 +376,6 @@ public static partial class FirstValidator : IValidateOptions Assert.Equal(DiagDescriptors.CantBeStaticClass.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task BogusModelType() { @@ -402,7 +390,6 @@ public partial class FirstValidator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CantValidateOpenGenericMembers() { @@ -434,7 +421,6 @@ public partial class FirstValidator : IValidateOptions> Assert.Equal(DiagDescriptors.CantUseWithGenericTypes.Id, diagnostics[2].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ClosedGenerics() { @@ -471,7 +457,6 @@ public partial class FirstValidator : IValidateOptions> Assert.Equal(DiagDescriptors.NoEligibleMember.Id, diagnostics[3].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoEligibleMembers() { @@ -504,7 +489,6 @@ public partial class SecondValidator : IValidateOptions Assert.Equal(DiagDescriptors.NoEligibleMembersFromValidator.Id, diagnostics[1].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task AlreadyImplemented() { @@ -528,7 +512,6 @@ public void Validate(string name, FirstModel fm) Assert.Equal(DiagDescriptors.AlreadyImplementsValidateMethod.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceInfoWhenTheClassHasABaseClass() { @@ -554,7 +537,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceInfoWhenTransitiveClassHasABaseClass() { @@ -621,7 +603,6 @@ public partial class Validator : IValidateOptions Assert.Equal(DiagDescriptors.NoEligibleMember.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldProduceWarningWhenTheClassHasNoEligibleMembers() { @@ -667,7 +648,6 @@ public partial class Validator : IValidateOptions Assert.Equal("SYSLIB1206", diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenMultipleValidationAnnotationsExist() { @@ -688,7 +668,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenDataTypeAttributesAreUsed() { @@ -723,7 +702,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenConstVariableIsUsedAsAttributeArgument() { @@ -745,7 +723,6 @@ public partial class Validator : IValidateOptions } // Testing on all existing & eligible annotations extending ValidationAttribute that aren't used above - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceAnyMessagesWhenExistingValidationsArePlaced() { @@ -786,7 +763,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldNotProduceErrorWhenPropertiesAreUsedAsAttributeArgument() { @@ -807,7 +783,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldSkipWhenOptionsValidatorAttributeDoesNotExist() { @@ -828,7 +803,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldSkipAtrributeWhenAttributeSymbolCannotBeFound() { @@ -851,7 +825,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldSkipAtrributeWhenAttributeSymbolIsNotBasedOnValidationAttribute() { @@ -874,7 +847,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldAcceptAtrributeWhenAttributeIsInDifferentNamespace() { @@ -901,7 +873,6 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldHandleAtrributePropertiesOtherThanString() { @@ -936,7 +907,6 @@ public TestAttribute() { Assert.Empty(diagnostics); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ShouldStoreFloatValuesCorrectly() { @@ -968,7 +938,6 @@ public partial class Validator : IValidateOptions } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task MultiModelValidatorGeneratesOnlyOnePartialTypeBlock() { @@ -1018,7 +987,6 @@ public partial class MultiValidator : IValidateOptions, IValidateOpt Assert.Equal(3, validateMethodDeclarations.Length); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CircularTypeReferencesInEnumeration() { @@ -1040,7 +1008,6 @@ public partial class FirstValidator : IValidateOptions Assert.Equal(DiagDescriptors.CircularTypeReferences.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NotValidatorInEnumeration() { @@ -1071,7 +1038,6 @@ public partial class SecondValidator Assert.Equal(DiagDescriptors.DoesntImplementIValidateOptions.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NullValidatorInEnumeration() { @@ -1103,7 +1069,6 @@ public partial class SecondValidator : IValidateOptions Assert.Equal(DiagDescriptors.NullValidatorType.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NoSimpleValidatorConstructorInEnumeration() { @@ -1471,7 +1436,6 @@ public sealed partial class MyOptionsValidator : IValidateOptions Assert.DoesNotContain("Timeout", generatedSource); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task CantValidateOpenGenericMembersInEnumeration() { @@ -1503,7 +1467,6 @@ public partial class FirstValidator : IValidateOptions> Assert.Equal(DiagDescriptors.CantUseWithGenericTypes.Id, diagnostics[2].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task ClosedGenericsInEnumeration() { @@ -1535,7 +1498,6 @@ public partial class FirstValidator : IValidateOptions> Assert.Equal(DiagDescriptors.NoEligibleMember.Id, diagnostics[2].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task NotEnumerable() { @@ -1557,7 +1519,6 @@ public partial class FirstValidator : IValidateOptions Assert.Equal(DiagDescriptors.NotEnumerableType.Id, diagnostics[0].Id); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task LanguageVersionTest() { @@ -1860,7 +1821,6 @@ public sealed partial class OptionsUsingGeneratedAttributesValidator : IValidate // Console.WriteLine(emittedSource); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task UsingInterfaceAsPropertyTypeForLengthAttributesTests() { @@ -1905,7 +1865,6 @@ public partial class MyOptionsValidator : IValidateOptions Assert.Equal(generatedSource.Replace("\r\n", "\n"), generatedSources[0].SourceText.ToString().Replace("\r\n", "\n")); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task OptionsExtendingSystemClassTest() { diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs index 5beb018ef4c38d..da4aba73863aa8 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/EmitterTests.cs @@ -17,7 +17,6 @@ namespace Microsoft.Gen.OptionsValidation.Test; public class EmitterTests { - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public async Task TestEmitter() { From 56eea59c45a8633acc59849d0575520cd8a91018 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Sat, 19 Apr 2025 10:07:08 +0200 Subject: [PATCH 09/52] Disable failing tests --- .../GeneratorTests.Incremental.cs | 2 ++ .../tests/SourceGeneration.Unit.Tests/Main.cs | 10 +++---- .../tests/ErrObjectTests.cs | 2 ++ .../Hosting/AssemblyCatalogTests.cs | 12 ++++---- .../DirectoryCatalogDebuggerProxyTests.cs | 3 +- .../Hosting/DirectoryCatalogTests.cs | 2 +- .../tests/Mono/ConfigurationManagerTest.cs | 5 ++-- .../TraceSourceWithConfigurationTests.cs | 17 ++++++----- .../tests/XmlSerializer/XmlSerializerTests.cs | 1 + .../ModuleBuilder/ModuleBuilderDefineType.cs | 2 +- .../AssemblySaveAssemblyBuilderTests.cs | 8 ++--- .../AssemblySaveConstructorBuilderTests.cs | 2 +- .../AssemblySaveCustomAttributeTests.cs | 4 +-- .../AssemblySaveEnumBuilderTests.cs | 2 +- .../AssemblySaveILGeneratorTests.cs | 12 ++++---- .../AssemblySaveModuleBuilderTests.cs | 2 +- .../AssemblySavePropertyBuilderTests.cs | 2 +- .../AssemblySaveTypeBuilderAPIsTests.cs | 2 +- .../AssemblySaveTypeBuilderTests.cs | 2 +- .../TypeBuilder/TypeBuilderDefineField.cs | 8 ++--- .../TypeBuilder/TypeBuilderDefineMethod.cs | 6 ++-- .../TypeBuilder/TypeBuilderDefineProperty.cs | 6 ++-- .../DefaultContext/DefaultLoadContextTest.cs | 2 +- .../RefEmitLoadContextTest.cs | 2 +- .../tests/DataContractSerializer.cs | 2 ++ .../CoreCLR/AssemblyTests.cs | 3 +- .../JsonSourceGeneratorIncrementalTests.cs | 30 ++++++++++--------- 27 files changed, 82 insertions(+), 69 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs index aff9a0c20364ca..989cbee0841192 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs @@ -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.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.Extensions.Configuration.Binder.SourceGeneration; @@ -12,6 +13,7 @@ namespace Microsoft.Extensions.SourceGeneration.Configuration.Binder.Tests public partial class ConfigurationBindingGeneratorTests : ConfigurationBinderTestsBase { [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] + [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public sealed class IncrementalTests { [Fact] diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs index 2b8b872a86f931..f55323caeedc14 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGeneration.Unit.Tests/Main.cs @@ -568,7 +568,7 @@ public partial class Validator : IValidateOptions Assert.Empty(diagnostics); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [InlineData("bool")] [InlineData("int")] [InlineData("double")] @@ -623,7 +623,7 @@ public partial class Validator : IValidateOptions Assert.Equal(DiagDescriptors.NoEligibleMembersFromValidator.Id, diagnostics[0].Id); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [InlineData("private")] [InlineData("protected")] public async Task ShouldProduceWarningWhenTheClassMembersAreInaccessible(string accessModifier) @@ -1252,7 +1252,7 @@ internal sealed partial class SecondOptionsValidator : IValidateOptions Assert.Equal(0, diags.Length); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser), nameof(PlatformDetection.IsNetCore))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles), nameof(PlatformDetection.IsNetCore))] public async Task DataAnnotationAttributesWithParams() { var (diagnostics, generatedSources) = await RunGenerator(@""" @@ -1709,7 +1709,7 @@ private static CSharpCompilation CreateCompilationForOptionsSource(string assemb return result; } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [InlineData(LanguageVersion.CSharp10)] [InlineData(LanguageVersion.CSharp11)] public async Task GeneratedAttributesTest(LanguageVersion languageVersion) diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs index 4db6681ba537a5..63feb201c9bf09 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs @@ -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 Microsoft.VisualBasic.CompilerServices; using System; using Xunit; @@ -11,6 +12,7 @@ public class ErrObjectTests { [Fact] [ActiveIssue("https://github.com/mono/mono/issues/14854", TestRuntimes.Mono)] + [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public void Clear() { ProjectData.ClearProjectError(); diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs index ae0c29c15bc0dc..fd3d3c13f00557 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs @@ -349,7 +349,7 @@ public void Constructor2_NonExistentFileNameAsCodeBaseArgument_ShouldThrowFileNo }); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void Constructor2_NullReflectionContextArgument_ShouldThrowArgumentNull() { AssemblyCatalogConstructorTests.Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull((rc) => @@ -447,7 +447,7 @@ public void Constructor3_NonExistentFileNameAsCodeBaseArgument_ShouldThrowFileNo }); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void Constructor3_NullDefinitionOriginArgument_ShouldThrowArgumentNull() { AssemblyCatalogConstructorTests.Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull((dO) => @@ -544,7 +544,7 @@ public void Constructor4_NonExistentFileNameAsCodeBaseArgument_ShouldThrowFileNo }); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void Constructor4_NullReflectionContextArgument_ShouldThrowArgumentNull() { AssemblyCatalogConstructorTests.Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull((rc) => @@ -553,7 +553,7 @@ public void Constructor4_NullReflectionContextArgument_ShouldThrowArgumentNull() }); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void Constructor4_NullDefinitionOriginArgument_ShouldThrowArgumentNull() { AssemblyCatalogConstructorTests.Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull((dO) => @@ -638,7 +638,7 @@ public void Constructor8_ValueAsAssemblyArgument_ShouldSetAssemblyProperty() }); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void Constructor8_NullReflectionContextArgument_ShouldThrowArgumentNull() { AssemblyCatalogConstructorTests.Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull((rc) => @@ -648,7 +648,7 @@ public void Constructor8_NullReflectionContextArgument_ShouldThrowArgumentNull() } #pragma warning disable SYSLIB0012 - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void Constructor8_NullDefinitionOriginArgument_ShouldThrowArgumentNull() { AssemblyCatalogConstructorTests.Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull((dO) => diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs index 72ae912ef1fd8e..1e7ed03b01a963 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs @@ -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.ComponentModel.Composition.Hosting; using System.IO; using System.Linq; @@ -125,7 +126,7 @@ public void LoadedFiles_EmptyDirectory_ShouldBeFine() Assert.Equal(0, proxy.LoadedFiles.Count); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls() { diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs index c91e51eacd80e6..c1ecb81fa26f28 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs @@ -320,7 +320,7 @@ public void LoadedFiles_EmptyDirectory_ShouldBeFine() Assert.Equal(0, cat.LoadedFiles.Count); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls() { diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs index ca65cb92533a72..a27e1e563c49aa 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs @@ -42,7 +42,7 @@ namespace MonoTests.System.Configuration public class ConfigurationManagerTest { - [Fact] // OpenExeConfiguration (ConfigurationUserLevel) + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] // OpenExeConfiguration (ConfigurationUserLevel) [ActiveIssue("https://github.com/dotnet/runtime/issues/21528", TargetFrameworkMonikers.NetFramework)] public void OpenExeConfiguration1_UserLevel_None() { @@ -249,10 +249,11 @@ public void mapped_MachineConfig() Assert.Equal("machineconfig", fi.Name); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] // Doesn't pass on Mono // [Category("NotWorking")] [ActiveIssue("https://github.com/dotnet/runtime/issues/21528", TargetFrameworkMonikers.NetFramework)] + public void mapped_ExeConfiguration_null() { SysConfig config = ConfigurationManager.OpenMappedExeConfiguration(null, ConfigurationUserLevel.None); diff --git a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs index 7d39211b10872b..7f8465e39aff1c 100644 --- a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs +++ b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs @@ -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.Configuration; using System.IO; using System.Reflection; @@ -33,7 +34,7 @@ private static void CreateAndLoadConfigFile(string filename) } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void RuntimeFilterChange() @@ -94,7 +95,7 @@ public void RuntimeFilterChange() mySource.Close(); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void Refresh_RemoveSwitch() @@ -135,7 +136,7 @@ void Log() } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void Refresh_ChangeSwitch() @@ -161,7 +162,7 @@ public void Refresh_ChangeSwitch() mySource.Close(); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void Refresh_RemoveSource() @@ -195,7 +196,7 @@ public void Refresh_RemoveSource() mySourceToBeRemoved.Close(); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void ConfigWithEvents_RuntimeListener() @@ -262,7 +263,7 @@ private void SubscribeToSwitch_Initializing(object? sender, InitializingSwitchEv } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void AllTypes() @@ -307,7 +308,7 @@ public void AllTypes() Assert.IsType(filter_eventTypeFilter.Listeners[1].Filter); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void Switch_MissingValue_Throws() @@ -318,7 +319,7 @@ public void Switch_MissingValue_Throws() Assert.Contains("'value'", e.ToString()); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] public void UnsupportedAttribute_Throws() diff --git a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs index 4166f6942f7729..e6e8bd671afae7 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs @@ -2311,6 +2311,7 @@ public static void Xml_TypeWithSpecialCharacterInStringMember() #endif [ActiveIssue("34072", TestRuntimes.Mono)] [ActiveIssue("https://github.com/dotnet/runtime/issues/96799", typeof(PlatformDetection), nameof(PlatformDetection.IsReadyToRunCompiled))] + [ActiveIssue("Not allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void Xml_TypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", out var weakRef); diff --git a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs index cc68471251d56c..48cc610dd8eb86 100644 --- a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs +++ b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs @@ -95,7 +95,7 @@ void Verify(TypeBuilder type, Module module) } } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [MemberData(nameof(TestData))] public void DefineTypePersistedAssembly(string name, TypeAttributes attributes, Type parent, PackingSize packingSize, int typesize, Type[] implementedInterfaces) { diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveAssemblyBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveAssemblyBuilderTests.cs index 256039267a529c..4b909cca5300f8 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveAssemblyBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveAssemblyBuilderTests.cs @@ -14,7 +14,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveAssemblyBuilderTests { private readonly AssemblyName _assemblyName = new AssemblyName("MyAssembly"); @@ -305,7 +305,7 @@ public void AssemblyWithDifferentTypes() [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/113789", TestRuntimes.Mono)] - [InlineData(true)] + [InlineData(true)] [InlineData(false)] public unsafe void AssemblyWithInstanceBasedFunctionPointer(bool useExplicitThis) { @@ -350,7 +350,7 @@ static unsafe byte[] GenerateMethodInPersistedAssembly(bool useExplicitThis) // In this test, we use typeof(object) for the "this" pointer to ensure the IL could be re-used for other // reference types, but normally this would be the appropriate type such as typeof(MyClassWithGuidProperty). - parameterTypes: [typeof(object), typeof(IntPtr)]); + parameterTypes: [typeof(object), typeof(IntPtr)]); ILGenerator il = methodBuilder.GetILGenerator(); il.Emit(OpCodes.Ldarg_0); // this @@ -489,7 +489,7 @@ void CheckAssembly(Assembly a) Assert.Equal(42, field.GetRawConstantValue()); field = type4.GetField("FieldOffset"); Assert.NotNull(field); - + field = type4.GetField("FieldModopt"); var cmods = field.GetRequiredCustomModifiers(); Assert.Equal(1, cmods.Length); diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveConstructorBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveConstructorBuilderTests.cs index 34fe5c2aec3278..1b061f5fabbc3b 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveConstructorBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveConstructorBuilderTests.cs @@ -7,7 +7,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveConstructorBuilderTests { [Fact] diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveCustomAttributeTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveCustomAttributeTests.cs index 1fd2d53188361a..89d496684e8099 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveCustomAttributeTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveCustomAttributeTests.cs @@ -11,7 +11,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveCustomAttributeTests { private List _attributes = new List @@ -208,7 +208,7 @@ public void CreateStructWithPseudoCustomAttributesTest() Type testType = moduleFromDisk.GetTypes()[0]; IList attributesFromDisk = testType.GetCustomAttributesData(); - Assert.Equal(typeAttributes.Count - 3, attributesFromDisk.Count); // 3 pseudo attributes + Assert.Equal(typeAttributes.Count - 3, attributesFromDisk.Count); // 3 pseudo attributes Assert.True((testType.Attributes & TypeAttributes.Serializable) != 0); // SerializableAttribute Assert.True((testType.Attributes & TypeAttributes.SpecialName) != 0); // SpecialNameAttribute Assert.True((testType.Attributes & TypeAttributes.ExplicitLayout) != 0); // StructLayoutAttribute diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs index b10126675568e3..809a3e5a1bb011 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs @@ -8,7 +8,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveEnumBuilderTests { private static AssemblyName PopulateAssemblyName() diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveILGeneratorTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveILGeneratorTests.cs index 2b155556c5f2ab..39d0f74aae4534 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveILGeneratorTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveILGeneratorTests.cs @@ -10,7 +10,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveILGeneratorTests { [Fact] @@ -219,7 +219,7 @@ public void ILMaxStack_Test() il1.Emit(OpCodes.Ldarg_2); // push 1 MaxStack 7 il1.Emit(OpCodes.Ldc_I4_5); // push 1 MaxStack 8 il1.Emit(OpCodes.Ldarg_1); // push 1 MaxStack 9 - il1.Emit(OpCodes.Add); // pop 2 push 1 stack size 8 + il1.Emit(OpCodes.Add); // pop 2 push 1 stack size 8 il1.Emit(OpCodes.Sub); // pop 2 push 1 stack size 7 il1.Emit(OpCodes.Mul); // pop 2 push 1 stack size 6 il1.Emit(OpCodes.Add); // pop 2 push 1 stack size 5 @@ -630,7 +630,7 @@ public void ReferenceFieldAndMethodsInIL() MethodBuilder methodMultiply = tb.DefineMethod("Multiply", MethodAttributes.Public, typeof(int), [typeof(int)]); /* class MyType - { + { private int _field; int Multiply(int value) => _field * value; void Main(int a) @@ -643,7 +643,7 @@ void Main(int a) ILGenerator il = methodMultiply.GetILGenerator(); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldfld, field); - il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Ldarg_1); il.Emit(OpCodes.Mul); il.Emit(OpCodes.Ret); @@ -888,7 +888,7 @@ public void ReferenceStaticFieldAndMethodsInIL() FieldBuilder field = anotherType.DefineField("StaticField", typeof(int), FieldAttributes.Public | FieldAttributes.Static); MethodBuilder staticMethod = anotherType.DefineMethod("StaticMethod", MethodAttributes.Public | MethodAttributes.Static, typeof(void), Type.EmptyTypes); /*class MyType - { + { int Main(int a) { AnotherType.StaticField = a; @@ -2327,7 +2327,7 @@ static void GetCode() // Unreachable. ilg.Emit(OpCodes.Ldarg_0); - // Depth + // Depth ilg.MarkLabel(lab); ilg.Emit(OpCodes.Add); ilg.Emit(OpCodes.Ret); diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveModuleBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveModuleBuilderTests.cs index 0c8a7a2aae81cf..0731f8754f964b 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveModuleBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveModuleBuilderTests.cs @@ -7,7 +7,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveModuleBuilderTests { [Fact] diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs index 6bff85e29e928e..60dfad0dcd0775 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs @@ -10,7 +10,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySavePropertyBuilderTests { [Fact] diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderAPIsTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderAPIsTests.cs index 9cf05f68a6f71e..74ab67d8d60622 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderAPIsTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderAPIsTests.cs @@ -9,7 +9,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveTypeBuilderAPIsTests { [Fact] diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs index b052a2861961b6..1894d8d5f35b86 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs @@ -11,7 +11,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveTypeBuilderTests { private static readonly AssemblyName s_assemblyName = new AssemblyName("MyDynamicAssembly") diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs index 4b7613157c3c2a..19481655258161 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs @@ -60,7 +60,7 @@ public void DefineField(string name, Type fieldType, FieldAttributes attributes, } } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [MemberData(nameof(TestData))] public void DefineFieldPersistedAssembly(string name, Type fieldType, FieldAttributes attributes, FieldAttributes expectedAttributes) { @@ -108,7 +108,7 @@ public void DefineField_NameCollision() Assert.Throws(() => createdType.GetField("FieldName", Helpers.AllFlags)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void DefineField_NameCollisionPersistedAssembly() { PersistedAssemblyBuilder ab = AssemblySaveTools.PopulateAssemblyBuilderAndTypeBuilder(out TypeBuilder type); @@ -144,7 +144,7 @@ public void DefineField_65536Fields() Assert.Throws(() => type.CreateType()); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void DefineField_65536FieldsPersistedAssembly() { PersistedAssemblyBuilder ab = AssemblySaveTools.PopulateAssemblyBuilderAndTypeBuilder(out TypeBuilder type); @@ -179,7 +179,7 @@ public void DefineFieldMethod_LongName() Assert.Equal(Helpers.s_512Chars, method.Name); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void DefineFieldMethod_LongNamePersistedAssembly() { PersistedAssemblyBuilder ab = AssemblySaveTools.PopulateAssemblyBuilderAndTypeBuilder(out TypeBuilder type); diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethod.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethod.cs index 1694945863f92b..9989ef29c60598 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethod.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethod.cs @@ -95,7 +95,7 @@ public void DefineMethod(string name, MethodAttributes attributes, CallingConven VerifyMethod(type4, method4, name, attributes, callingConvention, returnType, parameterTypes); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [MemberData(nameof(TestData))] public void DefineMethodPersistedAssembly(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { @@ -136,10 +136,10 @@ public void DefineMethod_65536Methods() // System.TypeLoadException : Type 'TestType' from assembly 'TestAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' // contains more methods than the current implementation allows. - Assert.Throws(() => type.CreateType()); + Assert.Throws(() => type.CreateType()); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/dotnet/runtime/issues/2389", TestRuntimes.Mono)] public void DefineMethod_65536MethodsPersistedAssembly() { diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineProperty.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineProperty.cs index 99d0d572eb418f..011e2308a1f372 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineProperty.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineProperty.cs @@ -50,7 +50,7 @@ public void DefineProperty(string name, PropertyAttributes attributes, Type retu Assert.Equal(returnType ?? typeof(void), createdProperty.PropertyType); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [MemberData(nameof(TestData))] public void DefinePropertyPersistedAssembly(string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes, string expectedName, PropertyAttributes _) { @@ -91,10 +91,10 @@ public void DefineProperty_NameCollision() Assert.Equal(2, properties.Length); Assert.Equal("PropertyName", properties[0].Name); Assert.Equal("PropertyName", properties[1].Name); - Assert.Throws(() => createdType.GetProperty("PropertyName", Helpers.AllFlags)); + Assert.Throws(() => createdType.GetProperty("PropertyName", Helpers.AllFlags)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void DefineProperty_NameCollisionPersistedAssembly() { PersistedAssemblyBuilder ab = AssemblySaveTools.PopulateAssemblyBuilderAndTypeBuilder(out TypeBuilder type); diff --git a/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs b/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs index 227f4d9111a1ff..ab0814f4e1e7be 100644 --- a/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs @@ -85,7 +85,7 @@ private Assembly ResolveNullAssembly(AssemblyLoadContext sender, AssemblyName as // Does not apply to Mono AOT scenarios as it is expected the name of the .aotdata file matches // the true name of the assembly and not the physical file name. - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadInDefaultContext() { // This will attempt to load an assembly, by path, in the Default Load context via the Resolving event diff --git a/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs b/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs index 1863ad3767d1f1..3694e501adb48d 100644 --- a/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs @@ -64,7 +64,7 @@ private static void DeleteDirectory() catch { } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/dotnet/runtime/issues/31804", TestRuntimes.Mono)] public static void LoadRefEmitAssembly() { diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs index 91afc052ae742c..3eeaeae7cbf804 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs @@ -1123,6 +1123,7 @@ public static void DCS_TypeNamesWithSpecialCharacters() [SkipOnPlatform(TestPlatforms.Browser, "AssemblyDependencyResolver not supported in wasm")] #endif [ActiveIssue("34072", TestRuntimes.Mono)] + [ActiveIssue("Now allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public static void DCS_TypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", makeCollection: false, out var weakRef); @@ -1142,6 +1143,7 @@ public static void DCS_TypeInCollectibleALC() [SkipOnPlatform(TestPlatforms.Browser, "AssemblyDependencyResolver not supported in wasm")] #endif [ActiveIssue("34072", TestRuntimes.Mono)] + [ActiveIssue("Now allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public static void DCS_CollectionTypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", makeCollection: true, out var weakRef); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs index 5e043eb306f63c..dcb68abe8df352 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs @@ -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.IO; using System.Runtime.Loader; using Xunit; @@ -9,7 +10,7 @@ namespace System.Reflection.Tests { public class AssemblyTests { - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/dotnet/runtime/issues/39650", TestPlatforms.Browser)] public void CurrentLocation_HasLocaton() { diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs index 5bcb01a94bde9a..be9657cfa4b835 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs @@ -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.Collections; using System.Collections.Generic; using System.Linq; @@ -12,6 +13,7 @@ namespace System.Text.Json.SourceGeneration.UnitTests { [ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)] + [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/71962", ~RuntimeConfiguration.Release)] [SkipOnMono("https://github.com/dotnet/runtime/issues/92467")] [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotX86Process))] // https://github.com/dotnet/runtime/issues/71962 @@ -44,12 +46,12 @@ public static void CompilingEquivalentSourcesResultsInEqualModels() { string source1 = """ using System.Text.Json.Serialization; - + namespace Test { [JsonSerializable(typeof(MyPoco))] public partial class JsonContext : JsonSerializerContext { } - + public class MyPoco { public int MyProperty { get; set; } = 42; @@ -60,7 +62,7 @@ public class MyPoco string source2 = """ using System; using System.Text.Json.Serialization; - + namespace Test { // Same as above but with different implementation @@ -100,12 +102,12 @@ public static void CompilingDifferentSourcesResultsInUnequalModels() { string source1 = """ using System.Text.Json.Serialization; - + namespace Test { [JsonSerializable(typeof(MyPoco))] public partial class JsonContext : JsonSerializerContext { } - + public class MyPoco { public int MyProperty { get; set; } = 42; @@ -115,12 +117,12 @@ public class MyPoco string source2 = """ using System.Text.Json.Serialization; - + namespace Test { [JsonSerializable(typeof(MyPoco))] public partial class JsonContext : JsonSerializerContext { } - + public class MyPoco { public int MyProperty { get; } = 42; // same, but missing a getter @@ -248,12 +250,12 @@ public static void IncrementalGenerator_EquivalentSources_DoesNotRegenerate() string source1 = """ using System; using System.Text.Json.Serialization; - + namespace Test { [JsonSerializable(typeof(MyPoco))] public partial class JsonContext : JsonSerializerContext { } - + public class MyPoco { public string MyProperty { get; set; } = 42; @@ -264,7 +266,7 @@ public class MyPoco string source2 = """ using System; using System.Text.Json.Serialization; - + namespace Test { // Same as above but with different implementation @@ -317,12 +319,12 @@ public static void IncrementalGenerator_DifferentSources_Regenerates() string source1 = """ using System; using System.Text.Json.Serialization; - + namespace Test { [JsonSerializable(typeof(MyPoco))] public partial class JsonContext : JsonSerializerContext { } - + public class MyPoco { public string MyProperty { get; set; } = 42; @@ -333,12 +335,12 @@ public class MyPoco string source2 = """ using System; using System.Text.Json.Serialization; - + namespace Test { [JsonSerializable(typeof(MyPoco))] public partial class JsonContext : JsonSerializerContext { } - + public class MyPoco { public string MyProperty { get; } = 42; // same, but missing a getter From 00a94e1bd8caf0fb69ff2ec11c0cc57cd5a46a25 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Sat, 19 Apr 2025 11:26:34 +0200 Subject: [PATCH 10/52] Remove unnecessary using System directive --- src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs index 63feb201c9bf09..8267338ba51854 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs @@ -1,7 +1,6 @@ // 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 Microsoft.VisualBasic.CompilerServices; using System; using Xunit; From e3871b248c123bc2745499d856932f62cbadb47f Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Sun, 20 Apr 2025 20:31:30 +0200 Subject: [PATCH 11/52] Disable failing tests --- .../ModuleBuilder/ModuleBuilderDefineEnum.cs | 4 +- .../AssemblySaveEventBuilderTests.cs | 2 +- ...eflection.MetadataLoadContext.Tests.csproj | 2 +- .../tests/AssemblyLoadContextTest.cs | 3 +- .../tests/System.Runtime.Loader.Tests.csproj | 2 +- .../tests/DataContractSerializer.cs | 4 +- .../System.Reflection.Tests/AssemblyTests.cs | 42 +++++++++---------- .../System/AppDomainTests.cs | 6 +-- ...ystem.Text.RegularExpressions.Tests.csproj | 2 +- .../System.Threading/tests/MutexTests.cs | 7 ++++ 10 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs index 8bce42af9fac05..4e1f762cae074d 100644 --- a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs +++ b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs @@ -76,7 +76,7 @@ public void DefineEnum(string name, TypeAttributes visibility, Type underlyingTy Assert.Equal(FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName, createdUnderlyingField.Attributes); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [MemberData(nameof(DefineEnum_TestData))] public void DefineEnumPersistedAssembly(string name, TypeAttributes visibility, Type underlyingType) { @@ -103,7 +103,7 @@ public void DefineEnumPersistedAssembly(string name, TypeAttributes visibility, ab.Save(stream); Assembly assemblyFromStream = mlc.LoadFromStream(stream); Type createdEnum = assemblyFromStream.GetType(name); - if (createdEnum != null) // null when name = "a\0b\0c" + if (createdEnum != null) // null when name = "a\0b\0c" { Assert.True(createdEnum.IsEnum); Assert.Equal(Helpers.GetFullName(name), createdEnum.Name); diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEventBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEventBuilderTests.cs index f4692afe194986..8f8e5cfbd75420 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEventBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEventBuilderTests.cs @@ -9,7 +9,7 @@ namespace System.Reflection.Emit.Tests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class AssemblySaveEventBuilderTests { [Fact] diff --git a/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj b/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj index e38a35c5063c9b..62ca3a7450d708 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj +++ b/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj @@ -92,7 +92,7 @@ - + diff --git a/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs b/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs index 00e924fcb47b0a..180606e0c19845 100644 --- a/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs @@ -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.IO; using System.Reflection; using System.Reflection.Emit; @@ -106,7 +107,7 @@ public static void LoadFromAssemblyName_AssemblyNotFound() Assert.Throws(() => loadContext.LoadFromAssemblyName(asmName)); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Corelib does not exist on disc for Browser builds")] public static void LoadFromAssemblyName_ValidTrustedPlatformAssembly() { diff --git a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj index 921723bdc304ed..d42c16c7ba4d5f 100644 --- a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj +++ b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj @@ -80,7 +80,7 @@ - + diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs index 3eeaeae7cbf804..db7281d6431242 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs @@ -1123,7 +1123,7 @@ public static void DCS_TypeNamesWithSpecialCharacters() [SkipOnPlatform(TestPlatforms.Browser, "AssemblyDependencyResolver not supported in wasm")] #endif [ActiveIssue("34072", TestRuntimes.Mono)] - [ActiveIssue("Now allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [ActiveIssue("Not allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void DCS_TypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", makeCollection: false, out var weakRef); @@ -1143,7 +1143,7 @@ public static void DCS_TypeInCollectibleALC() [SkipOnPlatform(TestPlatforms.Browser, "AssemblyDependencyResolver not supported in wasm")] #endif [ActiveIssue("34072", TestRuntimes.Mono)] - [ActiveIssue("Now allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [ActiveIssue("Not allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void DCS_CollectionTypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", makeCollection: true, out var weakRef); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs index 57a5e1277fcfe9..aeeb793fcaab60 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs @@ -39,7 +39,7 @@ public class AssemblyTests : FileCleanupTestBase public AssemblyTests() { - if (PlatformDetection.IsAssemblyLoadingSupported) + if (PlatformDetection.IsAssemblyLoadingSupported && PlatformDetection.HasAssemblyFiles) { // Assembly.Location does not return the file path for single-file deployment targets. DestTestAssemblyPath = Path.Combine(base.TestDirectory, s_sourceTestAssemblyName); @@ -229,7 +229,7 @@ public void GetFile() } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void GetFile_InMemory() { var inMemBlob = File.ReadAllBytes(SourceTestAssemblyPath); @@ -241,7 +241,7 @@ public void GetFile_InMemory() Assert.Throws(() => asm.GetFiles(getResourceModules: false)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void CodeBaseInMemory() { var inMemBlob = File.ReadAllBytes(SourceTestAssemblyPath); @@ -392,7 +392,7 @@ public void Load_Invalid() Assert.Throws(() => Assembly.Load(new AssemblyName("no such assembly"))); // No such assembly } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFile() { Assembly currentAssembly = typeof(AssemblyTests).Assembly; @@ -416,20 +416,20 @@ public void LoadFile() Assert.Equal(loadedAssembly1, loadedAssembly2); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFile_NullPath_ThrowsArgumentNullException() { AssertExtensions.Throws("path", () => Assembly.LoadFile(null)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFile_NoSuchPath_ThrowsFileNotFoundException() { string rootedPath = Path.GetFullPath(Guid.NewGuid().ToString("N")); AssertExtensions.ThrowsContains(() => Assembly.LoadFile(rootedPath), rootedPath); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFile_PartiallyQualifiedPath_ThrowsArgumentException() { string path = "System.Runtime.Tests.dll"; @@ -439,7 +439,7 @@ public void LoadFile_PartiallyQualifiedPath_ThrowsArgumentException() // This test should apply equally to Unix, but this reliably hits a particular one of the // myriad ways that assembly load can fail - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] [PlatformSpecific(TestPlatforms.Windows)] public void LoadFile_ValidPEBadIL_ThrowsBadImageFormatExceptionWithPath() { @@ -450,7 +450,7 @@ public void LoadFile_ValidPEBadIL_ThrowsBadImageFormatExceptionWithPath() AssertExtensions.ThrowsContains(() => Assembly.LoadFile(path), path); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] [InlineData(0)] [InlineData(5)] [InlineData(50)] @@ -471,20 +471,20 @@ public void LoadFile_ValidPEBadIL_ThrowsBadImageFormatExceptionWithPath_ByInitia } #pragma warning disable SYSLIB0056 // AssemblyHashAlgorithm overload is not supported and throws NotSupportedException. - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFromUsingHashValue() { Assert.Throws(() => Assembly.LoadFrom("abc", null, System.Configuration.Assemblies.AssemblyHashAlgorithm.SHA1)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFrom_WithHashValue_ThrowsNotSupportedException() { Assert.Throws(() => Assembly.LoadFrom(DestTestAssemblyPath, new byte[0], Configuration.Assemblies.AssemblyHashAlgorithm.None)); } #pragma warning restore SYSLIB0056 // AssemblyHashAlgorithm overload is not supported and throws NotSupportedException. - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFrom_SamePath_ReturnsEqualAssemblies() { Assembly assembly1 = Assembly.LoadFrom(DestTestAssemblyPath); @@ -492,7 +492,7 @@ public void LoadFrom_SamePath_ReturnsEqualAssemblies() Assert.Equal(assembly1, assembly2); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFrom_SameIdentityAsAssemblyWithDifferentPath_ReturnsEqualAssemblies() { Assembly assembly1 = Assembly.LoadFrom(AssemblyPathHelper.GetAssemblyLocation(typeof(AssemblyTests).Assembly)); @@ -503,28 +503,28 @@ public void LoadFrom_SameIdentityAsAssemblyWithDifferentPath_ReturnsEqualAssembl Assert.Equal(assembly1, assembly2); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFrom_NullAssemblyFile_ThrowsArgumentNullException() { AssertExtensions.Throws("assemblyFile", () => Assembly.LoadFrom(null)); AssertExtensions.Throws("assemblyFile", () => Assembly.UnsafeLoadFrom(null)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFrom_EmptyAssemblyFile_ThrowsArgumentException() { AssertExtensions.Throws("path", null, (() => Assembly.LoadFrom(""))); AssertExtensions.Throws("path", null, (() => Assembly.UnsafeLoadFrom(""))); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadFrom_NoSuchFile_ThrowsFileNotFoundException() { Assert.Throws(() => Assembly.LoadFrom("NoSuchPath")); Assert.Throws(() => Assembly.UnsafeLoadFrom("NoSuchPath")); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void UnsafeLoadFrom_SamePath_ReturnsEqualAssemblies() { Assembly assembly1 = Assembly.UnsafeLoadFrom(DestTestAssemblyPath); @@ -532,7 +532,7 @@ public void UnsafeLoadFrom_SamePath_ReturnsEqualAssemblies() Assert.Equal(assembly1, assembly2); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void LoadModule() { Assembly assembly = typeof(AssemblyTests).Assembly; @@ -819,7 +819,7 @@ public void AssemblyLoadFromStringNeg() Assert.Throws(() => Assembly.Load("no such assembly")); // No such assembly } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void AssemblyLoadFromBytes() { Assembly assembly = typeof(AssemblyTests).Assembly; @@ -843,7 +843,7 @@ public void AssemblyLoadFromBytesNeg() Assert.Throws(() => Assembly.Load(new byte[0])); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Symbols are in a different location on iOS/tvOS/MacCatalyst")] public void AssemblyLoadFromBytesWithSymbols() { @@ -864,7 +864,7 @@ public void AssemblyReflectionOnlyLoadFromString() Assert.Throws(() => Assembly.ReflectionOnlyLoad(an.FullName)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] public void AssemblyReflectionOnlyLoadFromBytes() { Assembly assembly = typeof(AssemblyTests).Assembly; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/AppDomainTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/AppDomainTests.cs index e3c0a312eab3bb..54c473bf00b8d3 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/AppDomainTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/AppDomainTests.cs @@ -366,7 +366,7 @@ public void Load() Assert.NotNull(AppDomain.CurrentDomain.Load(typeof(AppDomainTests).Assembly.FullName)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] public void LoadBytes() { @@ -792,7 +792,7 @@ private void CopyTestAssemblies() string rootPath; string assemblyResolvePath = "AssemblyResolveTestApp"; string appOutsideTPAPath = "TestAppOutsideOfTPA"; - + if (PlatformDetection.IsiOS || PlatformDetection.IstvOS) { rootPath = Path.GetTempPath(); @@ -839,7 +839,7 @@ public static void GetPermissionSet() #pragma warning restore SYSLIB0003 // Obsolete: CAS } - public static bool FileCreateCaseSensitiveAndAssemblyLoadingSupported => PlatformDetection.FileCreateCaseSensitive && PlatformDetection.IsAssemblyLoadingSupported; + public static bool FileCreateCaseSensitiveAndAssemblyLoadingSupported => PlatformDetection.FileCreateCaseSensitive && PlatformDetection.IsAssemblyLoadingSupported && PlatformDetection.HasAssemblyFiles; [ConditionalTheory(nameof(FileCreateCaseSensitiveAndAssemblyLoadingSupported))] [MemberData(nameof(TestingCreateInstanceFromObjectHandleData))] diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj index f57cd73cf2d26a..4b7bb40521306a 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj @@ -7,7 +7,7 @@ $(NoWarn);xUnit2008;SYSLIB0036;SYSLIB1045 - true + true true true diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index b83cfd571fa203..4cb7a4ecb719df 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -236,6 +236,7 @@ public void Ctor_InvalidNames_Unix() [Theory] [MemberData(nameof(GetValidNames))] + [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] public void Ctor_ValidName(string name) { bool createdNew; @@ -386,6 +387,7 @@ public void NamedWaitHandleOptionsTest() [Theory] [MemberData(nameof(NamePrefixes_MemberData))] + [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] public void NameOptionsApiCompatibilityTest(string namePrefix) { string name = Guid.NewGuid().ToString("N"); @@ -447,6 +449,7 @@ public static IEnumerable NamePrefixAndOptionsCompatibilityTest_Member [Theory] [MemberData(nameof(NamePrefixAndOptionsCompatibilityTest_MemberData))] + [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] public void NamePrefixAndOptionsCompatibilityTest(bool currentUserOnly, bool currentSessionOnly, string namePrefix) { string name = namePrefix + Guid.NewGuid().ToString("N"); @@ -478,6 +481,7 @@ public static IEnumerable NameNamespaceTests_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Windows Nano Server and Server Core apparently use the same namespace for the Local\ and Global\ prefixes [MemberData(nameof(NameNamespaceTests_MemberData))] + [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] public void NameNamespaceTest( bool create_currentUserOnly, bool create_currentSessionOnly, @@ -592,6 +596,7 @@ public static IEnumerable AbandonExisting_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(AbandonExisting_MemberData))] + [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] public void AbandonExisting( string name, WaitHandleWaitType waitType, @@ -845,6 +850,7 @@ private static void IncrementValueInFileNTimes(Mutex mutex, string fileName, int [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/96191", TestPlatforms.Browser)] + [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] public void NamedMutex_ThreadExitDisposeRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); @@ -906,6 +912,7 @@ public void NamedMutex_ThreadExitDisposeRaceTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] public void NamedMutex_DisposeWhenLockedRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); From 33a070344f64ed83f88f2a389a16074c36692d2a Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 21 Apr 2025 11:21:45 +0200 Subject: [PATCH 12/52] Disable failing tests --- .../runtime-extra-platforms-androidemulator.yml | 2 +- .../CalendarTestWithConfigSwitch/CalendarTests.cs | 1 + .../DisabledFileLockingSwitchTests.cs | 2 +- .../tests/System.Reflection.Tests/AssemblyTests.cs | 2 +- src/libraries/System.Threading/tests/MutexTests.cs | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml index a5e08d1f453ff8..b7b3774f0b5a35 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-androidemulator.yml @@ -142,7 +142,7 @@ jobs: nameSuffix: AllSubsets_CoreCLR isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} buildArgs: -s clr.runtime+clr.alljits+clr.corelib+clr.nativecorelib+clr.tools+clr.packages+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) - timeoutInMinutes: 180 + timeoutInMinutes: 240 # extra steps, run tests postBuildSteps: - template: /eng/pipelines/libraries/helix.yml diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs index 4d1205811b8608..5f8f1edc16d421 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs @@ -10,6 +10,7 @@ namespace System.Globalization.Tests public static class CalendarTests { [Fact] + [SkipOnPlatform(TestPlatforms.Anroid, "Doesn't throw on Android")] public static void TestJapaneseCalendarDateParsing() { CultureInfo ciJapanese = new CultureInfo("ja-JP") { DateTimeFormat = { Calendar = new JapaneseCalendar() } }; diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs index 736991961ac96e..415fb4d3fa2a53 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs @@ -10,7 +10,7 @@ public class DisabledFileLockingSwitchTests [Fact] public static void ConfigSwitchIsHonored() { - Assert.Equal(OperatingSystem.IsWindows(), PlatformDetection.IsFileLockingEnabled); + Assert.Equal(OperatingSystem.IsWindows() || OperatingSystem.IsAndroid(), PlatformDetection.IsFileLockingEnabled); } } } diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs index aeeb793fcaab60..ad46b441b0216d 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs @@ -567,7 +567,7 @@ public void Location_ExecutingAssembly_IsNotNull() } #pragma warning disable SYSLIB0012 - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] // single file + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser), nameof(PlatformDetection.HasAssemblyFiles))] // single file public void CodeBase() { if (PlatformDetection.IsNativeAot) diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index 4cb7a4ecb719df..8ccd8f4857a823 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -316,7 +316,7 @@ public void Ctor_TryCreateGlobalMutexTest_Uwp(bool currentUserOnly, bool current Assert.Throws(() => new Mutex(Guid.NewGuid().ToString("N"), options))); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] [MemberData(nameof(GetValidNames))] public void OpenExisting(string name) { @@ -350,7 +350,7 @@ public void OpenExisting_InvalidNames() AssertExtensions.Throws("name", null, () => Mutex.OpenExisting(string.Empty, options: default)); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void OpenExisting_UnavailableName() { string name = Guid.NewGuid().ToString("N"); From 2dcc5807e46d5cbb861d9f151ccb1cd017e832a1 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 22 Apr 2025 09:53:37 +0200 Subject: [PATCH 13/52] Fix typo --- .../CalendarTestWithConfigSwitch/CalendarTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs index 5f8f1edc16d421..ba88d046a2bd2f 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs @@ -10,7 +10,7 @@ namespace System.Globalization.Tests public static class CalendarTests { [Fact] - [SkipOnPlatform(TestPlatforms.Anroid, "Doesn't throw on Android")] + [SkipOnPlatform(TestPlatforms.Android, "Doesn't throw on Android")] public static void TestJapaneseCalendarDateParsing() { CultureInfo ciJapanese = new CultureInfo("ja-JP") { DateTimeFormat = { Calendar = new JapaneseCalendar() } }; From 973d81f34f2c6e5afd47be28d7386c01fad15fee Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 22 Apr 2025 14:32:10 +0200 Subject: [PATCH 14/52] Disable failing tests --- src/libraries/tests.proj | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 99d10066f34a6c..102655279d4651 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -374,6 +374,24 @@ + + + + + + + + + + + + + + + + + + From b91da9052a7ed481c993c32bb45000df708ba72e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 22 Apr 2025 20:49:14 +0200 Subject: [PATCH 15/52] Disable ConfigSwitchIsHonored test --- .../DisabledFileLockingSwitchTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs index 415fb4d3fa2a53..5f12657478c85c 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs @@ -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 Xunit; namespace System.IO.Tests @@ -8,9 +9,10 @@ namespace System.IO.Tests public class DisabledFileLockingSwitchTests { [Fact] + [ActiveIssue("TODO", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void ConfigSwitchIsHonored() { - Assert.Equal(OperatingSystem.IsWindows() || OperatingSystem.IsAndroid(), PlatformDetection.IsFileLockingEnabled); + Assert.Equal(OperatingSystem.IsWindows(), PlatformDetection.IsFileLockingEnabled); } } } From c6c369637fe80166116601aa2fd48cda86de7246 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 23 Apr 2025 09:46:42 +0200 Subject: [PATCH 16/52] Disable failing tests --- .../runtime-extra-platforms-android.yml | 2 +- .../ConfigBindingGenTestDriver.cs | 3 +-- .../GeneratorTests.Incremental.cs | 3 +-- .../tests/ErrObjectTests.cs | 3 +-- .../tests/Microsoft.VisualBasic.Core.Tests.csproj | 1 - .../tests/Mono/ConfigurationManagerTest.cs | 1 - .../tests/XmlSerializer/XmlSerializerTests.cs | 3 +-- ...System.Reflection.MetadataLoadContext.Tests.csproj | 2 +- .../tests/System.Runtime.Loader.Tests.csproj | 2 +- .../tests/DataContractSerializer.cs | 6 ++---- .../CalendarTestWithConfigSwitch/CalendarTests.cs | 2 +- .../DisabledFileLockingSwitchTests.cs | 2 +- .../System.Reflection.Tests/CoreCLR/AssemblyTests.cs | 1 - .../JsonSourceGeneratorIncrementalTests.cs | 3 +-- .../System.Text.RegularExpressions.Tests.csproj | 2 +- src/libraries/tests.proj | 11 ++++------- 16 files changed, 17 insertions(+), 30 deletions(-) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml index dc52aaf887233d..417241706c4c91 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml @@ -85,7 +85,7 @@ jobs: testRunNamePrefixSuffix: Mono_$(_BuildConfig) # -# Android emulators +# Android devices # Build the whole product using CoreCLR and run libraries tests # - template: /eng/pipelines/common/platform-matrix.yml diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs index 0353f32bbf11a1..b15815d72527fc 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs @@ -18,8 +18,7 @@ namespace Microsoft.Extensions.SourceGeneration.Configuration.Binder.Tests { - [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] - [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public partial class ConfigurationBindingGeneratorTests : ConfigurationBinderTestsBase { internal sealed class ConfigBindingGenTestDriver diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs index 989cbee0841192..bb6c5baae32272 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/GeneratorTests.Incremental.cs @@ -12,8 +12,7 @@ namespace Microsoft.Extensions.SourceGeneration.Configuration.Binder.Tests { public partial class ConfigurationBindingGeneratorTests : ConfigurationBinderTestsBase { - [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] - [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public sealed class IncrementalTests { [Fact] diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs index 8267338ba51854..d833e88d0b883e 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs @@ -9,9 +9,8 @@ namespace Microsoft.VisualBasic.Tests { public class ErrObjectTests { - [Fact] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/mono/mono/issues/14854", TestRuntimes.Mono)] - [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public void Clear() { ProjectData.ClearProjectError(); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj index 467e2665cec96b..6b4dbf83662206 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent);$(NetFrameworkCurrent) true - false 1 diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs index a27e1e563c49aa..0026d6c9af8f60 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs @@ -253,7 +253,6 @@ public void mapped_MachineConfig() // Doesn't pass on Mono // [Category("NotWorking")] [ActiveIssue("https://github.com/dotnet/runtime/issues/21528", TargetFrameworkMonikers.NetFramework)] - public void mapped_ExeConfiguration_null() { SysConfig config = ConfigurationManager.OpenMappedExeConfiguration(null, ConfigurationUserLevel.None); diff --git a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs index e6e8bd671afae7..0d94c9fb861b25 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs @@ -2303,7 +2303,7 @@ public static void Xml_TypeWithSpecialCharacterInStringMember() Assert.Equal(x.Name, y.Name); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] #if XMLSERIALIZERGENERATORTESTS // Lack of AssemblyDependencyResolver results in assemblies that are not loaded by path to get // loaded in the default ALC, which causes problems for this test. @@ -2311,7 +2311,6 @@ public static void Xml_TypeWithSpecialCharacterInStringMember() #endif [ActiveIssue("34072", TestRuntimes.Mono)] [ActiveIssue("https://github.com/dotnet/runtime/issues/96799", typeof(PlatformDetection), nameof(PlatformDetection.IsReadyToRunCompiled))] - [ActiveIssue("Not allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void Xml_TypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", out var weakRef); diff --git a/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj b/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj index 62ca3a7450d708..e38a35c5063c9b 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj +++ b/src/libraries/System.Reflection.MetadataLoadContext/tests/System.Reflection.MetadataLoadContext.Tests.csproj @@ -92,7 +92,7 @@ - + diff --git a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj index d42c16c7ba4d5f..921723bdc304ed 100644 --- a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj +++ b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj @@ -80,7 +80,7 @@ - + diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs index db7281d6431242..7f5599020944f7 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs @@ -1116,14 +1116,13 @@ public static void DCS_TypeNamesWithSpecialCharacters() Assert.Equal(x.PropertyNameWithSpecialCharacters\u6F22\u00F1, y.PropertyNameWithSpecialCharacters\u6F22\u00F1); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] #if XMLSERIALIZERGENERATORTESTS // Lack of AssemblyDependencyResolver results in assemblies that are not loaded by path to get // loaded in the default ALC, which causes problems for this test. [SkipOnPlatform(TestPlatforms.Browser, "AssemblyDependencyResolver not supported in wasm")] #endif [ActiveIssue("34072", TestRuntimes.Mono)] - [ActiveIssue("Not allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void DCS_TypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", makeCollection: false, out var weakRef); @@ -1136,14 +1135,13 @@ public static void DCS_TypeInCollectibleALC() Assert.True(!weakRef.IsAlive); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] #if XMLSERIALIZERGENERATORTESTS // Lack of AssemblyDependencyResolver results in assemblies that are not loaded by path to get // loaded in the default ALC, which causes problems for this test. [SkipOnPlatform(TestPlatforms.Browser, "AssemblyDependencyResolver not supported in wasm")] #endif [ActiveIssue("34072", TestRuntimes.Mono)] - [ActiveIssue("Not allowed if IsSingleFile", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void DCS_CollectionTypeInCollectibleALC() { ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", makeCollection: true, out var weakRef); diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs index ba88d046a2bd2f..804a3a55b270ae 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs @@ -10,7 +10,7 @@ namespace System.Globalization.Tests public static class CalendarTests { [Fact] - [SkipOnPlatform(TestPlatforms.Android, "Doesn't throw on Android")] + [SkipOnPlatform(TestPlatforms.Android, "Doesn't throw on mobile")] public static void TestJapaneseCalendarDateParsing() { CultureInfo ciJapanese = new CultureInfo("ja-JP") { DateTimeFormat = { Calendar = new JapaneseCalendar() } }; diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs index 5f12657478c85c..8b83bae43f2f65 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/DisabledFileLockingSwitchTests.cs @@ -9,7 +9,7 @@ namespace System.IO.Tests public class DisabledFileLockingSwitchTests { [Fact] - [ActiveIssue("TODO", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public static void ConfigSwitchIsHonored() { Assert.Equal(OperatingSystem.IsWindows(), PlatformDetection.IsFileLockingEnabled); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs index dcb68abe8df352..0146537db43527 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/CoreCLR/AssemblyTests.cs @@ -11,7 +11,6 @@ namespace System.Reflection.Tests public class AssemblyTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/39650", TestPlatforms.Browser)] public void CurrentLocation_HasLocaton() { string location = GetExecutingAssembly().Location; diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs index be9657cfa4b835..9e590a1a545c9e 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs @@ -13,10 +13,9 @@ namespace System.Text.Json.SourceGeneration.UnitTests { [ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)] - [ActiveIssue("Not allowed if SingleFileHost", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/71962", ~RuntimeConfiguration.Release)] [SkipOnMono("https://github.com/dotnet/runtime/issues/92467")] - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotX86Process))] // https://github.com/dotnet/runtime/issues/71962 + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotX86Process), nameof(PlatformDetection.HasAssemblyFiles))] // https://github.com/dotnet/runtime/issues/71962 public static class JsonSourceGeneratorIncrementalTests { [Theory] diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj index 4b7bb40521306a..f57cd73cf2d26a 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/System.Text.RegularExpressions.Tests.csproj @@ -7,7 +7,7 @@ $(NoWarn);xUnit2008;SYSLIB0036;SYSLIB1045 - true + true true true diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 102655279d4651..983444674e53cc 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -376,20 +376,17 @@ - - - - - + + + + - - From 92a457084b77680af0f35b3493fdff913b90a2fd Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 23 Apr 2025 12:45:45 +0200 Subject: [PATCH 17/52] Fix typo --- .../Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs index d833e88d0b883e..b7c24d5057dd1b 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs @@ -9,7 +9,7 @@ namespace Microsoft.VisualBasic.Tests { public class ErrObjectTests { - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/mono/mono/issues/14854", TestRuntimes.Mono)] public void Clear() { From fd82f71453132ed9183c3d15e90cd2a13748a993 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 23 Apr 2025 12:50:23 +0200 Subject: [PATCH 18/52] Enable System.Runtime.Loader.Tests tests --- .../System.Runtime.Loader/tests/ContextualReflection.cs | 1 + src/libraries/tests.proj | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs b/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs index 1d61dbd4afd493..332777521a6ef3 100644 --- a/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs +++ b/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs @@ -22,6 +22,7 @@ class MockAssembly : Assembly public MockAssembly() {} } + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class ContextualReflectionTestFixture : IContextualReflectionTestFixture { public AssemblyLoadContext isolatedAlc { get; } diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 983444674e53cc..b995549a7767b8 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -386,7 +386,6 @@ - From eba4f6cd9e14b82830d9c37d602362a6486443f2 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 23 Apr 2025 12:54:10 +0200 Subject: [PATCH 19/52] Enable System.Text.RegularExpressions tests --- .../tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs | 2 ++ src/libraries/tests.proj | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs index 90e638570f629f..677bf16d32ff0a 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs @@ -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.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; @@ -21,6 +22,7 @@ namespace System.Text.RegularExpressions.Tests { + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public static class RegexGeneratorHelper { private static readonly CSharpParseOptions s_previewParseOptions = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Preview).WithDocumentationMode(DocumentationMode.Diagnose); diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index b995549a7767b8..18cbf4663dae14 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -380,7 +380,6 @@ - From e10afcc59d6c316653db2346590d528293d2dfbd Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 24 Apr 2025 13:16:11 +0200 Subject: [PATCH 20/52] Disable failing tests --- .../tests/ErrObjectTests.cs | 2 +- .../CodeDom/Compiler/CompilerResultsTests.cs | 2 +- .../TraceSourceWithConfigurationTests.cs | 32 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs index b7c24d5057dd1b..837652026c8a9b 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs @@ -9,7 +9,7 @@ namespace Microsoft.VisualBasic.Tests { public class ErrObjectTests { - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] [ActiveIssue("https://github.com/mono/mono/issues/14854", TestRuntimes.Mono)] public void Clear() { diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs index f36b765421ba4e..aa791baa631aa8 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs @@ -28,7 +28,7 @@ public void Ctor_TempFileCollection(TempFileCollection tempFiles) Assert.Same(tempFiles, results.TempFiles); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] public void CompiledAssembly_GetWithPathToAssemblySet_ReturnsExpectedAssembly() { var results = new CompilerResults(null) { PathToAssembly = AssemblyPathHelper.GetAssemblyLocation(typeof(CompilerResultsTests).Assembly) }; diff --git a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs index 7f8465e39aff1c..1b523f9e88d019 100644 --- a/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs +++ b/src/libraries/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/TraceSourceWithConfigurationTests.cs @@ -34,9 +34,9 @@ private static void CreateAndLoadConfigFile(string filename) } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void RuntimeFilterChange() { CreateAndLoadConfigFile("testhost_ConfigWithRuntime.config"); @@ -95,9 +95,9 @@ public void RuntimeFilterChange() mySource.Close(); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void Refresh_RemoveSwitch() { // Use a SourceSwitch that logs Error. @@ -136,9 +136,9 @@ void Log() } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void Refresh_ChangeSwitch() { // Use a SourceSwitch that logs Error. @@ -162,9 +162,9 @@ public void Refresh_ChangeSwitch() mySource.Close(); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void Refresh_RemoveSource() { // Use a SourceSwitch that logs Error. @@ -196,9 +196,9 @@ public void Refresh_RemoveSource() mySourceToBeRemoved.Close(); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void ConfigWithEvents_RuntimeListener() { CreateAndLoadConfigFile("testhost_ConfigWithRuntime.config"); @@ -263,9 +263,9 @@ private void SubscribeToSwitch_Initializing(object? sender, InitializingSwitchEv } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void AllTypes() { CreateAndLoadConfigFile("testhost_AllTypes.config"); @@ -308,9 +308,9 @@ public void AllTypes() Assert.IsType(filter_eventTypeFilter.Listeners[1].Filter); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void Switch_MissingValue_Throws() { Exception e = Assert.Throws(() => @@ -319,9 +319,9 @@ public void Switch_MissingValue_Throws() Assert.Contains("'value'", e.ToString()); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74244", TestPlatforms.tvOS | TestPlatforms.iOS | TestPlatforms.Android)] public void UnsupportedAttribute_Throws() { CreateAndLoadConfigFile("testhost_UnsupportedAttribute_Throws.config"); From 7ad54e8b89d6fb6c619344b4505319d1b6c47f17 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 24 Apr 2025 13:20:16 +0200 Subject: [PATCH 21/52] Try run disabled tests --- src/libraries/tests.proj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 18cbf4663dae14..1f060f4d732241 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -187,7 +187,7 @@ - + @@ -226,7 +226,7 @@ - + @@ -246,7 +246,7 @@ - + @@ -254,7 +254,7 @@ - + From c2612e5ce54738a86a8fda24c89763a032ad5ede Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 24 Apr 2025 15:46:04 +0200 Subject: [PATCH 22/52] Fix build --- src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs index 837652026c8a9b..5844f2ccf64d12 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs @@ -9,6 +9,7 @@ namespace Microsoft.VisualBasic.Tests { public class ErrObjectTests { + [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] [ActiveIssue("https://github.com/mono/mono/issues/14854", TestRuntimes.Mono)] public void Clear() From e061e9ddee79f71122b965eda540e678c187e437 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 24 Apr 2025 20:48:53 +0200 Subject: [PATCH 23/52] Disable failing tests --- .../tests/System/CodeDom/Compiler/CompilerResultsTests.cs | 2 +- .../System.IO.Ports/tests/SerialPort/GetPortNames.cs | 4 +++- .../System.Runtime.Loader/tests/ContextualReflection.cs | 2 +- .../FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs index aa791baa631aa8..f36b765421ba4e 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs @@ -28,7 +28,7 @@ public void Ctor_TempFileCollection(TempFileCollection tempFiles) Assert.Same(tempFiles, results.TempFiles); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public void CompiledAssembly_GetWithPathToAssemblySet_ReturnsExpectedAssembly() { var results = new CompilerResults(null) { PathToAssembly = AssemblyPathHelper.GetAssemblyLocation(typeof(CompilerResultsTests).Assembly) }; diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs index c1872f1b3ee220..bcad271e7bc0d5 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs @@ -19,7 +19,7 @@ public class GetPortNames : PortsTest /// Check that all ports either open correctly or fail with UnauthorizedAccessException (which implies they're already open) /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono, TestPlatforms.Android)] public void OpenEveryPortName() { foreach (string portName in SerialPort.GetPortNames()) @@ -41,6 +41,7 @@ public void OpenEveryPortName() /// (On Windows, the latter uses a different technique to SerialPort to find ports). /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Android)] public void AllHelperPortsAreInGetPortNames() { if (PlatformDetection.IsWindows && PlatformDetection.IsArmOrArm64Process) @@ -63,6 +64,7 @@ public void AllHelperPortsAreInGetPortNames() /// eg https://github.com/dotnet/corefx/pull/18928 / https://github.com/dotnet/corefx/pull/20668 /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Android)] public void AllGetPortNamesAreInHelperPorts() { string[] helperPortNames = PortHelper.GetPorts(); diff --git a/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs b/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs index 332777521a6ef3..8e035c8038b4bc 100644 --- a/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs +++ b/src/libraries/System.Runtime.Loader/tests/ContextualReflection.cs @@ -22,7 +22,6 @@ class MockAssembly : Assembly public MockAssembly() {} } - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class ContextualReflectionTestFixture : IContextualReflectionTestFixture { public AssemblyLoadContext isolatedAlc { get; } @@ -145,6 +144,7 @@ public void FixtureSetupAssertions() } [ActiveIssue("https://github.com/mono/mono/issues/15142", TestRuntimes.Mono)] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class ContextualReflectionTest : IClassFixture { IContextualReflectionTestFixture _fixture; diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs index c1a704287c87be..d4b5615b5c97cd 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/UpgradeToGeneratedRegexAnalyzerTests.cs @@ -15,6 +15,7 @@ namespace System.Text.RegularExpressions.Tests { [ActiveIssue("https://github.com/dotnet/runtime/issues/69823", TestRuntimes.Mono)] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] public class UpgradeToGeneratedRegexAnalyzerTests { private const string UseRegexSourceGeneratorDiagnosticId = @"SYSLIB1045"; From 10de0771c4b103bba14f4e46f58c5fcab29a9ea1 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 24 Apr 2025 20:49:26 +0200 Subject: [PATCH 24/52] Enable tests that are passing --- src/libraries/tests.proj | 103 ++++++++------------------------------- 1 file changed, 19 insertions(+), 84 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 1f060f4d732241..39137d0920716b 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -187,91 +187,39 @@ - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + + + + + - - - - - + + - - - - - - + + - - - - - - - - - + + + + + + //? @@ -374,19 +322,6 @@ - - - - - - - - - - - - - From 2bf63ac29522980810c1d5e29a25be350803eb0b Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 24 Apr 2025 21:21:01 +0200 Subject: [PATCH 25/52] Fix typo --- src/libraries/tests.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 39137d0920716b..c5cc8ff0c00270 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -219,7 +219,7 @@ - //? + From da3343aad1a37ee88bc92e9e633bb5c95093f49c Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 25 Apr 2025 10:17:47 +0200 Subject: [PATCH 26/52] Fix ActiveIssue annotation --- src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs index bcad271e7bc0d5..6c6a2b6944698f 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs @@ -19,7 +19,8 @@ public class GetPortNames : PortsTest /// Check that all ports either open correctly or fail with UnauthorizedAccessException (which implies they're already open) /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Android)] public void OpenEveryPortName() { foreach (string portName in SerialPort.GetPortNames()) From 2111a6e7317b9a6f3253cf7747b18d5f201b3ccf Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 25 Apr 2025 13:24:19 +0200 Subject: [PATCH 27/52] Disable failing tests --- .../System/EnvironmentTests.cs | 2 +- src/libraries/tests.proj | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs index 6d8e5372051759..a73dcc6a91a583 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs @@ -94,7 +94,7 @@ public void ProcessPath_Idempotent() } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Throws PNSE")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android, "Throws PNSE")] public void ProcessPath_MatchesExpectedValue() { string expectedProcessPath = PlatformDetection.IsBrowser ? null : Process.GetCurrentProcess().MainModule.FileName; diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index c5cc8ff0c00270..fdabca0db35e67 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -202,16 +202,19 @@ + + + @@ -220,6 +223,12 @@ + + + + + + From 250dfcaa4d8e5d3e039ebcc9fae80140b8257dd5 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 25 Apr 2025 13:25:18 +0200 Subject: [PATCH 28/52] Add comment --- src/libraries/tests.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index fdabca0db35e67..eeaa858a86af24 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -220,6 +220,7 @@ + From 876aa62260d67200a8cabde9116834d479530cf1 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 25 Apr 2025 15:31:19 +0200 Subject: [PATCH 29/52] Disable failing tests --- src/libraries/tests.proj | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index eeaa858a86af24..2a87d5766d7de8 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -187,7 +187,6 @@ - @@ -202,26 +201,33 @@ + + + + + + + - + From 7eb456ec4dd405d633e40a5dec4647d1054ebed6 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 28 Apr 2025 13:12:10 +0200 Subject: [PATCH 30/52] Fix test annotations --- .../Hosting/DirectoryCatalogDebuggerProxyTests.cs | 1 - .../Composition/Hosting/DirectoryCatalogTests.cs | 1 - .../tests/Mono/ConfigurationManagerTest.cs | 6 ++++-- .../System.IO.Ports/tests/SerialPort/GetPortNames.cs | 6 +++--- .../System.Runtime.Loader/tests/AssemblyLoadContextTest.cs | 1 - .../JsonSourceGeneratorIncrementalTests.cs | 1 - 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs index 1e7ed03b01a963..16759cef1f4697 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogDebuggerProxyTests.cs @@ -127,7 +127,6 @@ public void LoadedFiles_EmptyDirectory_ShouldBeFine() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls() { string directoryPath = TemporaryFileCopier.GetNewTemporaryDirectory(); diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs index c1ecb81fa26f28..cddd3ae263f2e3 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs @@ -321,7 +321,6 @@ public void LoadedFiles_EmptyDirectory_ShouldBeFine() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] public void LoadedFiles_ContainsMultipleDllsAndSomeNonDll_ShouldOnlyContainDlls() { // Add one text file diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs index 0026d6c9af8f60..d391f308c7faa6 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs @@ -42,8 +42,9 @@ namespace MonoTests.System.Configuration public class ConfigurationManagerTest { - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] // OpenExeConfiguration (ConfigurationUserLevel) + [Fact] // OpenExeConfiguration (ConfigurationUserLevel) [ActiveIssue("https://github.com/dotnet/runtime/issues/21528", TargetFrameworkMonikers.NetFramework)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public void OpenExeConfiguration1_UserLevel_None() { SysConfig config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); @@ -249,10 +250,11 @@ public void mapped_MachineConfig() Assert.Equal("machineconfig", fi.Name); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] // Doesn't pass on Mono // [Category("NotWorking")] [ActiveIssue("https://github.com/dotnet/runtime/issues/21528", TargetFrameworkMonikers.NetFramework)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", typeof(PlatformDetection), nameof(PlatformDetection.IsSingleFile))] public void mapped_ExeConfiguration_null() { SysConfig config = ConfigurationManager.OpenMappedExeConfiguration(null, ConfigurationUserLevel.None); diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs index 6c6a2b6944698f..47fa602e6f56bf 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs @@ -20,7 +20,7 @@ public class GetPortNames : PortsTest /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Not supported on Android")] public void OpenEveryPortName() { foreach (string portName in SerialPort.GetPortNames()) @@ -42,7 +42,7 @@ public void OpenEveryPortName() /// (On Windows, the latter uses a different technique to SerialPort to find ports). /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Not supported on Android")] public void AllHelperPortsAreInGetPortNames() { if (PlatformDetection.IsWindows && PlatformDetection.IsArmOrArm64Process) @@ -65,7 +65,7 @@ public void AllHelperPortsAreInGetPortNames() /// eg https://github.com/dotnet/corefx/pull/18928 / https://github.com/dotnet/corefx/pull/20668 /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Android)] + [SkipOnPlatform(TestPlatforms.Android, "Not supported on Android")] public void AllGetPortNamesAreInHelperPorts() { string[] helperPortNames = PortHelper.GetPorts(); diff --git a/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs b/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs index 180606e0c19845..3292f12de6d7b8 100644 --- a/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/AssemblyLoadContextTest.cs @@ -108,7 +108,6 @@ public static void LoadFromAssemblyName_AssemblyNotFound() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] - [SkipOnPlatform(TestPlatforms.Browser, "Corelib does not exist on disc for Browser builds")] public static void LoadFromAssemblyName_ValidTrustedPlatformAssembly() { var asmName = typeof(System.Linq.Enumerable).Assembly.GetName(); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs index 9e590a1a545c9e..115181e2079028 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorIncrementalTests.cs @@ -12,7 +12,6 @@ namespace System.Text.Json.SourceGeneration.UnitTests { - [ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)] [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/71962", ~RuntimeConfiguration.Release)] [SkipOnMono("https://github.com/dotnet/runtime/issues/92467")] [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotX86Process), nameof(PlatformDetection.HasAssemblyFiles))] // https://github.com/dotnet/runtime/issues/71962 From 945560df3c43eff677cd4af23cdd7dae7b3b7d0f Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 28 Apr 2025 13:16:54 +0200 Subject: [PATCH 31/52] Update ProjectExclusions tracking issue --- src/libraries/tests.proj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 2a87d5766d7de8..271234eea84cba 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -227,8 +227,6 @@ - - @@ -236,6 +234,8 @@ + + From b918e274cf86f0b8a7185fb3fe9576e6251e6449 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 29 Apr 2025 12:19:06 +0200 Subject: [PATCH 32/52] Disable failing tests on Android platform --- .../System.Threading/tests/MutexTests.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index 8ccd8f4857a823..8ae3fdd91287db 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -236,7 +236,7 @@ public void Ctor_InvalidNames_Unix() [Theory] [MemberData(nameof(GetValidNames))] - [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void Ctor_ValidName(string name) { bool createdNew; @@ -316,8 +316,9 @@ public void Ctor_TryCreateGlobalMutexTest_Uwp(bool currentUserOnly, bool current Assert.Throws(() => new Mutex(Guid.NewGuid().ToString("N"), options))); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(GetValidNames))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void OpenExisting(string name) { Mutex resultHandle; @@ -350,7 +351,8 @@ public void OpenExisting_InvalidNames() AssertExtensions.Throws("name", null, () => Mutex.OpenExisting(string.Empty, options: default)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void OpenExisting_UnavailableName() { string name = Guid.NewGuid().ToString("N"); @@ -387,7 +389,7 @@ public void NamedWaitHandleOptionsTest() [Theory] [MemberData(nameof(NamePrefixes_MemberData))] - [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void NameOptionsApiCompatibilityTest(string namePrefix) { string name = Guid.NewGuid().ToString("N"); @@ -449,7 +451,7 @@ public static IEnumerable NamePrefixAndOptionsCompatibilityTest_Member [Theory] [MemberData(nameof(NamePrefixAndOptionsCompatibilityTest_MemberData))] - [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void NamePrefixAndOptionsCompatibilityTest(bool currentUserOnly, bool currentSessionOnly, string namePrefix) { string name = namePrefix + Guid.NewGuid().ToString("N"); @@ -481,7 +483,7 @@ public static IEnumerable NameNamespaceTests_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Windows Nano Server and Server Core apparently use the same namespace for the Local\ and Global\ prefixes [MemberData(nameof(NameNamespaceTests_MemberData))] - [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void NameNamespaceTest( bool create_currentUserOnly, bool create_currentSessionOnly, @@ -596,7 +598,7 @@ public static IEnumerable AbandonExisting_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(AbandonExisting_MemberData))] - [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void AbandonExisting( string name, WaitHandleWaitType waitType, @@ -850,7 +852,7 @@ private static void IncrementValueInFileNTimes(Mutex mutex, string fileName, int [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/96191", TestPlatforms.Browser)] - [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void NamedMutex_ThreadExitDisposeRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); @@ -912,7 +914,7 @@ public void NamedMutex_ThreadExitDisposeRaceTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [SkipOnPlatform(TestPlatforms.Android, "The system cannot open the device or file specified")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void NamedMutex_DisposeWhenLockedRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); From b0f3952b6c2126b2939d505a844ebe8a304c0525 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 30 Apr 2025 11:48:55 +0200 Subject: [PATCH 33/52] Skip MutexTests on CoreCLR Android --- .../tests/SerialPort/GetPortNames.cs | 3 --- .../System.Threading/tests/MutexTests.cs | 18 +++++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs index 47fa602e6f56bf..c1872f1b3ee220 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/GetPortNames.cs @@ -20,7 +20,6 @@ public class GetPortNames : PortsTest /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34490", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Android, "Not supported on Android")] public void OpenEveryPortName() { foreach (string portName in SerialPort.GetPortNames()) @@ -42,7 +41,6 @@ public void OpenEveryPortName() /// (On Windows, the latter uses a different technique to SerialPort to find ports). /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] - [SkipOnPlatform(TestPlatforms.Android, "Not supported on Android")] public void AllHelperPortsAreInGetPortNames() { if (PlatformDetection.IsWindows && PlatformDetection.IsArmOrArm64Process) @@ -65,7 +63,6 @@ public void AllHelperPortsAreInGetPortNames() /// eg https://github.com/dotnet/corefx/pull/18928 / https://github.com/dotnet/corefx/pull/20668 /// [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] - [SkipOnPlatform(TestPlatforms.Android, "Not supported on Android")] public void AllGetPortNamesAreInHelperPorts() { string[] helperPortNames = PortHelper.GetPorts(); diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index 8ae3fdd91287db..763ac83cd1e846 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -236,7 +236,7 @@ public void Ctor_InvalidNames_Unix() [Theory] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void Ctor_ValidName(string name) { bool createdNew; @@ -318,7 +318,7 @@ public void Ctor_TryCreateGlobalMutexTest_Uwp(bool currentUserOnly, bool current [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void OpenExisting(string name) { Mutex resultHandle; @@ -352,7 +352,7 @@ public void OpenExisting_InvalidNames() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void OpenExisting_UnavailableName() { string name = Guid.NewGuid().ToString("N"); @@ -389,7 +389,7 @@ public void NamedWaitHandleOptionsTest() [Theory] [MemberData(nameof(NamePrefixes_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void NameOptionsApiCompatibilityTest(string namePrefix) { string name = Guid.NewGuid().ToString("N"); @@ -451,7 +451,7 @@ public static IEnumerable NamePrefixAndOptionsCompatibilityTest_Member [Theory] [MemberData(nameof(NamePrefixAndOptionsCompatibilityTest_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void NamePrefixAndOptionsCompatibilityTest(bool currentUserOnly, bool currentSessionOnly, string namePrefix) { string name = namePrefix + Guid.NewGuid().ToString("N"); @@ -483,7 +483,7 @@ public static IEnumerable NameNamespaceTests_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Windows Nano Server and Server Core apparently use the same namespace for the Local\ and Global\ prefixes [MemberData(nameof(NameNamespaceTests_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void NameNamespaceTest( bool create_currentUserOnly, bool create_currentSessionOnly, @@ -598,7 +598,7 @@ public static IEnumerable AbandonExisting_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(AbandonExisting_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void AbandonExisting( string name, WaitHandleWaitType waitType, @@ -852,7 +852,7 @@ private static void IncrementValueInFileNTimes(Mutex mutex, string fileName, int [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/96191", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void NamedMutex_ThreadExitDisposeRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); @@ -914,7 +914,7 @@ public void NamedMutex_ThreadExitDisposeRaceTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] public void NamedMutex_DisposeWhenLockedRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); From 8be70f0e9fe1b1fca020c1efc4b5fb97cc4fceac Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 30 Apr 2025 17:57:56 +0200 Subject: [PATCH 34/52] Disable tests on CoreCLR Android --- .../System.Threading/tests/MutexTests.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index 763ac83cd1e846..34fabd7ad6ac7a 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -236,7 +236,7 @@ public void Ctor_InvalidNames_Unix() [Theory] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void Ctor_ValidName(string name) { bool createdNew; @@ -318,7 +318,7 @@ public void Ctor_TryCreateGlobalMutexTest_Uwp(bool currentUserOnly, bool current [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void OpenExisting(string name) { Mutex resultHandle; @@ -352,7 +352,7 @@ public void OpenExisting_InvalidNames() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void OpenExisting_UnavailableName() { string name = Guid.NewGuid().ToString("N"); @@ -389,7 +389,7 @@ public void NamedWaitHandleOptionsTest() [Theory] [MemberData(nameof(NamePrefixes_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void NameOptionsApiCompatibilityTest(string namePrefix) { string name = Guid.NewGuid().ToString("N"); @@ -451,7 +451,7 @@ public static IEnumerable NamePrefixAndOptionsCompatibilityTest_Member [Theory] [MemberData(nameof(NamePrefixAndOptionsCompatibilityTest_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void NamePrefixAndOptionsCompatibilityTest(bool currentUserOnly, bool currentSessionOnly, string namePrefix) { string name = namePrefix + Guid.NewGuid().ToString("N"); @@ -483,7 +483,7 @@ public static IEnumerable NameNamespaceTests_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Windows Nano Server and Server Core apparently use the same namespace for the Local\ and Global\ prefixes [MemberData(nameof(NameNamespaceTests_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void NameNamespaceTest( bool create_currentUserOnly, bool create_currentSessionOnly, @@ -598,7 +598,7 @@ public static IEnumerable AbandonExisting_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(AbandonExisting_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void AbandonExisting( string name, WaitHandleWaitType waitType, @@ -852,7 +852,7 @@ private static void IncrementValueInFileNTimes(Mutex mutex, string fileName, int [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/96191", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void NamedMutex_ThreadExitDisposeRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); @@ -914,7 +914,7 @@ public void NamedMutex_ThreadExitDisposeRaceTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] public void NamedMutex_DisposeWhenLockedRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); From 917fffa6edc8045eda955a6cd051fe431b0a7f70 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 30 Apr 2025 20:08:15 +0200 Subject: [PATCH 35/52] Fix ActiveIssue annotation --- .../System.Threading/tests/MutexTests.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index 34fabd7ad6ac7a..8e3173d549a41a 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -236,7 +236,7 @@ public void Ctor_InvalidNames_Unix() [Theory] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void Ctor_ValidName(string name) { bool createdNew; @@ -318,7 +318,7 @@ public void Ctor_TryCreateGlobalMutexTest_Uwp(bool currentUserOnly, bool current [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void OpenExisting(string name) { Mutex resultHandle; @@ -352,7 +352,7 @@ public void OpenExisting_InvalidNames() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void OpenExisting_UnavailableName() { string name = Guid.NewGuid().ToString("N"); @@ -389,7 +389,7 @@ public void NamedWaitHandleOptionsTest() [Theory] [MemberData(nameof(NamePrefixes_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void NameOptionsApiCompatibilityTest(string namePrefix) { string name = Guid.NewGuid().ToString("N"); @@ -451,7 +451,7 @@ public static IEnumerable NamePrefixAndOptionsCompatibilityTest_Member [Theory] [MemberData(nameof(NamePrefixAndOptionsCompatibilityTest_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void NamePrefixAndOptionsCompatibilityTest(bool currentUserOnly, bool currentSessionOnly, string namePrefix) { string name = namePrefix + Guid.NewGuid().ToString("N"); @@ -483,7 +483,7 @@ public static IEnumerable NameNamespaceTests_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Windows Nano Server and Server Core apparently use the same namespace for the Local\ and Global\ prefixes [MemberData(nameof(NameNamespaceTests_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void NameNamespaceTest( bool create_currentUserOnly, bool create_currentSessionOnly, @@ -598,7 +598,7 @@ public static IEnumerable AbandonExisting_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(AbandonExisting_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void AbandonExisting( string name, WaitHandleWaitType waitType, @@ -852,7 +852,7 @@ private static void IncrementValueInFileNTimes(Mutex mutex, string fileName, int [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/96191", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void NamedMutex_ThreadExitDisposeRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); @@ -914,7 +914,7 @@ public void NamedMutex_ThreadExitDisposeRaceTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestRuntimes.CoreCLR, TestPlatforms.Android)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] public void NamedMutex_DisposeWhenLockedRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); From 8cae98ef7216a0630938f5324a84329c67064738 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 1 May 2025 20:26:08 +0200 Subject: [PATCH 36/52] Disable failing tests --- .../System.Threading/tests/MutexTests.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libraries/System.Threading/tests/MutexTests.cs b/src/libraries/System.Threading/tests/MutexTests.cs index 8e3173d549a41a..de4cc8bb7eaf2e 100644 --- a/src/libraries/System.Threading/tests/MutexTests.cs +++ b/src/libraries/System.Threading/tests/MutexTests.cs @@ -236,7 +236,7 @@ public void Ctor_InvalidNames_Unix() [Theory] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void Ctor_ValidName(string name) { bool createdNew; @@ -318,7 +318,7 @@ public void Ctor_TryCreateGlobalMutexTest_Uwp(bool currentUserOnly, bool current [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(GetValidNames))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void OpenExisting(string name) { Mutex resultHandle; @@ -352,7 +352,7 @@ public void OpenExisting_InvalidNames() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void OpenExisting_UnavailableName() { string name = Guid.NewGuid().ToString("N"); @@ -389,7 +389,7 @@ public void NamedWaitHandleOptionsTest() [Theory] [MemberData(nameof(NamePrefixes_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void NameOptionsApiCompatibilityTest(string namePrefix) { string name = Guid.NewGuid().ToString("N"); @@ -451,7 +451,7 @@ public static IEnumerable NamePrefixAndOptionsCompatibilityTest_Member [Theory] [MemberData(nameof(NamePrefixAndOptionsCompatibilityTest_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void NamePrefixAndOptionsCompatibilityTest(bool currentUserOnly, bool currentSessionOnly, string namePrefix) { string name = namePrefix + Guid.NewGuid().ToString("N"); @@ -483,7 +483,7 @@ public static IEnumerable NameNamespaceTests_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Windows Nano Server and Server Core apparently use the same namespace for the Local\ and Global\ prefixes [MemberData(nameof(NameNamespaceTests_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void NameNamespaceTest( bool create_currentUserOnly, bool create_currentSessionOnly, @@ -598,7 +598,7 @@ public static IEnumerable AbandonExisting_MemberData() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [MemberData(nameof(AbandonExisting_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void AbandonExisting( string name, WaitHandleWaitType waitType, @@ -852,7 +852,7 @@ private static void IncrementValueInFileNTimes(Mutex mutex, string fileName, int [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/96191", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void NamedMutex_ThreadExitDisposeRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); @@ -914,7 +914,7 @@ public void NamedMutex_ThreadExitDisposeRaceTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android, TestRuntimes.CoreCLR)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public void NamedMutex_DisposeWhenLockedRaceTest() { var mutexName = Guid.NewGuid().ToString("N"); From 2dc7c73dbfd063e8e47ea792f2a625a7b2c10681 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 6 May 2025 09:05:18 +0200 Subject: [PATCH 37/52] Disable failing tests --- .../System.IO.Pipelines/tests/PipeWriterTests.cs | 1 + src/libraries/tests.proj | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs b/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs index 85070e1534a8ee..c3128f15c98dfd 100644 --- a/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/PipeWriterTests.cs @@ -294,6 +294,7 @@ public async Task WritesUsingGetMemoryWorks() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951",platforms: TestPlatforms.Android, runtimes: TestRuntimes.CoreCLR)] public async Task CompleteWithLargeWriteThrows() { var completeDelay = TimeSpan.FromMilliseconds(10); diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 271234eea84cba..11be72465ee50c 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -238,6 +238,14 @@ + + + + + + + + From cf2209fa63ee5261a8aa4f1b00f36ae904419495 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 7 May 2025 17:24:58 +0200 Subject: [PATCH 38/52] Exclude System.Net.Security.Tests from project builds --- src/libraries/tests.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 11be72465ee50c..4237d06e8b75a4 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -234,6 +234,7 @@ + From 9c366049749c9c013b63df1d047a67c5805623e7 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 8 May 2025 00:28:09 +0200 Subject: [PATCH 39/52] Exclude System.Net.Security.Tests from project builds --- src/libraries/tests.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 4237d06e8b75a4..4634a56ad0d96b 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -192,6 +192,7 @@ + @@ -234,7 +235,6 @@ - From c2dc647483afe28a40671a589da83eb19efefa46 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 9 May 2025 19:23:33 +0200 Subject: [PATCH 40/52] Disable CoreCLR tests on Mono --- src/libraries/tests.proj | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 2f16d1c65475ef..164a6589d56b87 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -216,7 +216,6 @@ - @@ -229,6 +228,12 @@ + + + + + + From 046e100185af47f5f15d31bc9ad41ecff3a3d68e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 14 May 2025 12:12:07 +0200 Subject: [PATCH 41/52] Disable System.Net.WebSockets.Tests due to disk space limitation --- src/libraries/tests.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 164a6589d56b87..7bbd57cbab84b6 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -245,6 +245,7 @@ + From e29ad26573365fe51c8ee7cb5cccddb53b5a03c2 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 14 May 2025 14:32:13 +0200 Subject: [PATCH 42/52] Exclude debug symbols --- src/libraries/tests.proj | 1 - src/mono/msbuild/android/build/AndroidBuild.targets | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 7bbd57cbab84b6..164a6589d56b87 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -245,7 +245,6 @@ - diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets index 5e45180b07960a..ac2f8a140a945b 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.targets +++ b/src/mono/msbuild/android/build/AndroidBuild.targets @@ -22,7 +22,7 @@ <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile')) $(PlatformTarget) $(AssemblyName) - False + true From a81d29c1b4d42e0afd39547bd4b65fbc4343ba66 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 14 May 2025 14:38:07 +0200 Subject: [PATCH 43/52] Update StripDebugSymbols property --- src/mono/sample/Android/AndroidSampleApp.csproj | 1 - src/tests/build.proj | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mono/sample/Android/AndroidSampleApp.csproj b/src/mono/sample/Android/AndroidSampleApp.csproj index 74ce1168a1ab57..b0f10b8c163825 100644 --- a/src/mono/sample/Android/AndroidSampleApp.csproj +++ b/src/mono/sample/Android/AndroidSampleApp.csproj @@ -9,7 +9,6 @@ Link false $(ForceAOT) - True HelloAndroid $(AssemblyName).dll true diff --git a/src/tests/build.proj b/src/tests/build.proj index eb1c3adbb12340..92b1db3d598469 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -211,9 +211,8 @@ $(IntermediateOutputPath)\AndroidApps\$(Category) $(BuildDir)\apk $(XUnitTestBinBase)$(CategoryWithSlash)\$(Category).apk - False 127.0.0.1:9000,nosuspend,listen - True + true $(ArtifactsBinDir)microsoft.netcore.app.runtime.android-$(TargetArchitecture)\$(Configuration)\runtimes\android-$(TargetArchitecture)\ arm64-v8a armeabi-v7a From a2700f7a6bcb38b7480f91f73faa38b326b1da22 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 14 May 2025 17:12:15 +0200 Subject: [PATCH 44/52] Disable failing tests --- .../tests/StackTraceSymbolsTests.cs | 1 + .../tests/System.Reflection.Tests/AssemblyTests.cs | 1 + .../tests/System.Runtime.Tests/System/ExceptionTests.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs index b0470c1c8a5bd8..69986ad58b91e7 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs @@ -11,6 +11,7 @@ public class StackTraceSymbolsTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/dotnet/runtime/issues/51399", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", PlatformDetection.IsAndroid)] public void StackTraceSymbolsDoNotLockFile() { var asmPath = AssemblyPathHelper.GetAssemblyLocation(typeof(StackTraceSymbolsTests).Assembly); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs index ad46b441b0216d..7a405c3fae8f40 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs @@ -845,6 +845,7 @@ public void AssemblyLoadFromBytesNeg() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Symbols are in a different location on iOS/tvOS/MacCatalyst")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", PlatformDetection.IsAndroid)] public void AssemblyLoadFromBytesWithSymbols() { Assembly assembly = typeof(AssemblyTests).Assembly; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs index 4ad6379e4069d1..1a5efa534dcef0 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs @@ -109,6 +109,7 @@ public static void Exception_TargetSite_Rethrow() [Fact] [ActiveIssue("https://github.com/mono/mono/issues/15140", TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", PlatformDetection.IsAndroid)] public static void ThrowStatementDoesNotResetExceptionStackLineSameMethod() { (string, string, int) rethrownExceptionStackFrame = (null, null, 0); From 2c48518351c353e8c94ff9abcc5569bb5f62f88f Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 15 May 2025 13:28:42 +0200 Subject: [PATCH 45/52] Fix build --- .../tests/StackTraceSymbolsTests.cs | 2 +- .../tests/System.Reflection.Tests/AssemblyTests.cs | 2 +- .../tests/System.Runtime.Tests/System/ExceptionTests.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs index 69986ad58b91e7..edd78bf6e61831 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceSymbolsTests.cs @@ -11,7 +11,7 @@ public class StackTraceSymbolsTests { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))] [ActiveIssue("https://github.com/dotnet/runtime/issues/51399", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", PlatformDetection.IsAndroid)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void StackTraceSymbolsDoNotLockFile() { var asmPath = AssemblyPathHelper.GetAssemblyLocation(typeof(StackTraceSymbolsTests).Assembly); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs index 7a405c3fae8f40..eff32bc09ffe5f 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyTests.cs @@ -845,7 +845,7 @@ public void AssemblyLoadFromBytesNeg() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsAssemblyLoadingSupported), nameof(PlatformDetection.HasAssemblyFiles))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Symbols are in a different location on iOS/tvOS/MacCatalyst")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", PlatformDetection.IsAndroid)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public void AssemblyLoadFromBytesWithSymbols() { Assembly assembly = typeof(AssemblyTests).Assembly; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs index 1a5efa534dcef0..ca9912b8492847 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs @@ -109,7 +109,7 @@ public static void Exception_TargetSite_Rethrow() [Fact] [ActiveIssue("https://github.com/mono/mono/issues/15140", TestRuntimes.Mono)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", PlatformDetection.IsAndroid)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public static void ThrowStatementDoesNotResetExceptionStackLineSameMethod() { (string, string, int) rethrownExceptionStackFrame = (null, null, 0); From da619336630e2e172df295629f48b55b6c488512 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 15 May 2025 14:23:15 +0200 Subject: [PATCH 46/52] Disable tests --- .../tests/System.Runtime.Tests/System/ExceptionTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs index ca9912b8492847..885b5a1ce0433d 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ExceptionTests.cs @@ -140,6 +140,7 @@ private static (string, string, int) ThrowAndRethrowSameMethod(out (string, stri [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArm64Process))] // [ActiveIssue(https://github.com/dotnet/runtime/issues/1871)] can't use ActiveIssue for archs [ActiveIssue("https://github.com/mono/mono/issues/15141", TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114951", TestPlatforms.Android)] public static void ThrowStatementDoesNotResetExceptionStackLineOtherMethod() { (string, string, int) rethrownExceptionStackFrame = (null, null, 0); From ee7512a5d4485fef750fe6045ca718d476d6e808 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 15 May 2025 15:51:32 +0200 Subject: [PATCH 47/52] Disable failing tests --- src/libraries/tests.proj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 164a6589d56b87..6805102c052e37 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -200,6 +200,13 @@ + + + + + + + From f2d056b38a9a91ae5048934a1e0e7e07ca590b9f Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Sat, 17 May 2025 00:08:07 +0200 Subject: [PATCH 48/52] Test run --- src/libraries/tests.proj | 7 ------- src/mono/msbuild/android/build/AndroidBuild.targets | 2 +- src/tasks/AndroidAppBuilder/ApkBuilder.cs | 12 ++++++------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 6805102c052e37..164a6589d56b87 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -200,13 +200,6 @@ - - - - - - - diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets index ac2f8a140a945b..56dd94a5983986 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.targets +++ b/src/mono/msbuild/android/build/AndroidBuild.targets @@ -22,7 +22,7 @@ <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile')) $(PlatformTarget) $(AssemblyName) - true + false diff --git a/src/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs index 9dc90501b0fe14..a553e90a07e713 100644 --- a/src/tasks/AndroidAppBuilder/ApkBuilder.cs +++ b/src/tasks/AndroidAppBuilder/ApkBuilder.cs @@ -195,11 +195,11 @@ public ApkBuilder(TaskLoggingHelper logger) Directory.CreateDirectory(Path.Combine(OutputDir, "assets")); var extensionsToIgnore = new List { ".so", ".a", ".dex", ".jar" }; - if (StripDebugSymbols) - { + // if (StripDebugSymbols) + // { extensionsToIgnore.Add(".pdb"); extensionsToIgnore.Add(".dbg"); - } + // } // Copy sourceDir to OutputDir/assets-tozip (ignore native files) // these files then will be zipped and copied to apk/assets/assets.zip @@ -474,12 +474,12 @@ public ApkBuilder(TaskLoggingHelper logger) var excludedLibs = new HashSet { "libmonodroid.so" }; if (IsCoreCLR) { - if (StripDebugSymbols) - { + // if (StripDebugSymbols) + // { // exclude debugger support libs excludedLibs.Add("libmscordbi.so"); excludedLibs.Add("libmscordaccore.so"); - } + // } } if (!StaticLinkedRuntime) dynamicLibs.AddRange(Directory.GetFiles(AppDir, "*.so").Where(file => !excludedLibs.Contains(Path.GetFileName(file)))); From c1eb68e8940cb02ba7ba9ab4ad640fe590aebe65 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Sun, 18 May 2025 00:00:04 +0200 Subject: [PATCH 49/52] Use Debug config to ensure android:debuggable=true --- src/mono/msbuild/apple/build/AppleBuild.props | 2 +- src/tasks/AndroidAppBuilder/ApkBuilder.cs | 18 +++++----- .../Android/AndroidProject.cs | 33 +++++-------------- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/src/mono/msbuild/apple/build/AppleBuild.props b/src/mono/msbuild/apple/build/AppleBuild.props index a3fc8dc30b3be1..8d095afe25c08d 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.props +++ b/src/mono/msbuild/apple/build/AppleBuild.props @@ -17,7 +17,7 @@ true true - false + true <_IsLibraryMode Condition="('$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != '') or ('$(UseNativeAOTRuntime)' == 'true' and '$(NativeLib)' == 'Shared')">true diff --git a/src/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs index a553e90a07e713..2bdf5c3d8b1d94 100644 --- a/src/tasks/AndroidAppBuilder/ApkBuilder.cs +++ b/src/tasks/AndroidAppBuilder/ApkBuilder.cs @@ -195,11 +195,11 @@ public ApkBuilder(TaskLoggingHelper logger) Directory.CreateDirectory(Path.Combine(OutputDir, "assets")); var extensionsToIgnore = new List { ".so", ".a", ".dex", ".jar" }; - // if (StripDebugSymbols) - // { + if (StripDebugSymbols) + { extensionsToIgnore.Add(".pdb"); extensionsToIgnore.Add(".dbg"); - // } + } // Copy sourceDir to OutputDir/assets-tozip (ignore native files) // these files then will be zipped and copied to apk/assets/assets.zip @@ -386,8 +386,10 @@ public ApkBuilder(TaskLoggingHelper logger) File.WriteAllText(Path.Combine(OutputDir, monodroidSource), Utils.GetEmbeddedResource(monodroidSource)); AndroidProject project = new AndroidProject("monodroid", runtimeIdentifier, AndroidNdk, logger); - project.GenerateCMake(OutputDir, MinApiLevel, StripDebugSymbols); - project.BuildCMake(OutputDir, StripDebugSymbols); + project.GenerateCMake(OutputDir, MinApiLevel); + project.BuildCMake(OutputDir); + + // TODO: Strip debug symbols after build: llvm-strip --strip-unneeded lib*.so string abi = project.Abi; @@ -474,12 +476,12 @@ public ApkBuilder(TaskLoggingHelper logger) var excludedLibs = new HashSet { "libmonodroid.so" }; if (IsCoreCLR) { - // if (StripDebugSymbols) - // { + if (StripDebugSymbols) + { // exclude debugger support libs excludedLibs.Add("libmscordbi.so"); excludedLibs.Add("libmscordaccore.so"); - // } + } } if (!StaticLinkedRuntime) dynamicLibs.AddRange(Directory.GetFiles(AppDir, "*.so").Where(file => !excludedLibs.Contains(Path.GetFileName(file)))); diff --git a/src/tasks/MobileBuildTasks/Android/AndroidProject.cs b/src/tasks/MobileBuildTasks/Android/AndroidProject.cs index b482731671ac22..eab4209b219015 100644 --- a/src/tasks/MobileBuildTasks/Android/AndroidProject.cs +++ b/src/tasks/MobileBuildTasks/Android/AndroidProject.cs @@ -50,43 +50,26 @@ public void Build(string workingDir, ClangBuildOptions buildOptions, bool stripD Utils.RunProcess(logger, tools.ClangPath, workingDir: workingDir, args: clangArgs); } - public void GenerateCMake(string workingDir, bool stripDebugSymbols) + public void GenerateCMake(string workingDir) { - GenerateCMake(workingDir, DefaultMinApiLevel, stripDebugSymbols); + GenerateCMake(workingDir, DefaultMinApiLevel); } - public void GenerateCMake(string workingDir, string apiLevel = DefaultMinApiLevel, bool stripDebugSymbols = false) + public void GenerateCMake(string workingDir, string apiLevel = DefaultMinApiLevel) { // force ninja generator on Windows, the VS generator causes issues with the built-in Android support in VS var generator = Utils.IsWindows() ? "-G Ninja" : ""; string cmakeGenArgs = $"{generator} -DCMAKE_TOOLCHAIN_FILE={androidToolchainPath} -DANDROID_ABI=\"{Abi}\" -DANDROID_STL=none -DTARGETS_ANDROID=1 " + - $"-DANDROID_PLATFORM=android-{apiLevel} -B {projectName}"; - - if (stripDebugSymbols) - { - // Use "-s" to strip debug symbols, it complains it's unused but it works - cmakeGenArgs += " -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_FLAGS=\"-s -Wno-unused-command-line-argument\""; - } - else - { - cmakeGenArgs += " -DCMAKE_BUILD_TYPE=Debug"; - } + $"-DANDROID_PLATFORM=android-{apiLevel} -B {projectName} -DCMAKE_BUILD_TYPE=Debug"; Utils.RunProcess(logger, Cmake, workingDir: workingDir, args: cmakeGenArgs); } - public string BuildCMake(string workingDir, bool stripDebugSymbols = false) + public string BuildCMake(string workingDir) { - string cmakeBuildArgs = $"--build {projectName}"; - - if (stripDebugSymbols) - { - cmakeBuildArgs += " --config MinSizeRel"; - } - else - { - cmakeBuildArgs += " --config Debug"; - } + // Use Debug config to ensure android:debuggable=true, + // which is required for `adb shell run-as` to access result logs from internal storage. + string cmakeBuildArgs = $"--build {projectName} --config Debug"; Utils.RunProcess(logger, Cmake, workingDir: workingDir, args: cmakeBuildArgs); From 00fa70b39ff05877797d6d6f4d524e9d84b56417 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 19 May 2025 09:17:27 +0200 Subject: [PATCH 50/52] Fix StripDebugSymbols --- src/mono/msbuild/android/build/AndroidBuild.props | 1 + src/mono/msbuild/android/build/AndroidBuild.targets | 1 - src/mono/msbuild/apple/build/AppleBuild.props | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/msbuild/android/build/AndroidBuild.props b/src/mono/msbuild/android/build/AndroidBuild.props index 7b88d5a39943ac..8a4d423d2fe92e 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.props +++ b/src/mono/msbuild/android/build/AndroidBuild.props @@ -13,6 +13,7 @@ <_IsLibraryMode Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != ''">true <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">_MonoReadAvailableComponentsManifest + true false diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets index 56dd94a5983986..fb72946db252eb 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.targets +++ b/src/mono/msbuild/android/build/AndroidBuild.targets @@ -22,7 +22,6 @@ <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile')) $(PlatformTarget) $(AssemblyName) - false diff --git a/src/mono/msbuild/apple/build/AppleBuild.props b/src/mono/msbuild/apple/build/AppleBuild.props index 8d095afe25c08d..ba3ff16ac72337 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.props +++ b/src/mono/msbuild/apple/build/AppleBuild.props @@ -17,7 +17,7 @@ true true - true + false <_IsLibraryMode Condition="('$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != '') or ('$(UseNativeAOTRuntime)' == 'true' and '$(NativeLib)' == 'Shared')">true From a54f678ef2cfa80a939d56809aaab46d02091f05 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 19 May 2025 11:43:39 +0200 Subject: [PATCH 51/52] Fix formatting --- src/libraries/tests.proj | 8 -------- src/tasks/AndroidAppBuilder/ApkBuilder.cs | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 164a6589d56b87..9bf6d8eba21cb4 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -192,7 +192,6 @@ - @@ -202,7 +201,6 @@ - @@ -211,14 +209,12 @@ - - @@ -228,13 +224,11 @@ - - @@ -249,14 +243,12 @@ - - diff --git a/src/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs index 2bdf5c3d8b1d94..8392060b1ac99d 100644 --- a/src/tasks/AndroidAppBuilder/ApkBuilder.cs +++ b/src/tasks/AndroidAppBuilder/ApkBuilder.cs @@ -389,7 +389,7 @@ public ApkBuilder(TaskLoggingHelper logger) project.GenerateCMake(OutputDir, MinApiLevel); project.BuildCMake(OutputDir); - // TODO: Strip debug symbols after build: llvm-strip --strip-unneeded lib*.so + // TODO: https://github.com/dotnet/runtime/issues/115717 string abi = project.Abi; From 83e6860f37f8907edbf3ea4f4d5df0ed481bd380 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 21 May 2025 09:34:17 +0200 Subject: [PATCH 52/52] Test run --- .../msbuild/android/build/AndroidBuild.props | 1 - .../android/build/AndroidBuild.targets | 1 + src/tasks/AndroidAppBuilder/ApkBuilder.cs | 11 +++---- .../Android/AndroidProject.cs | 33 ++++++++++++++----- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/mono/msbuild/android/build/AndroidBuild.props b/src/mono/msbuild/android/build/AndroidBuild.props index 8a4d423d2fe92e..7b88d5a39943ac 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.props +++ b/src/mono/msbuild/android/build/AndroidBuild.props @@ -13,7 +13,6 @@ <_IsLibraryMode Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != ''">true <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseMonoRuntime)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">_MonoReadAvailableComponentsManifest - true false diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets index fb72946db252eb..56dd94a5983986 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.targets +++ b/src/mono/msbuild/android/build/AndroidBuild.targets @@ -22,6 +22,7 @@ <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile')) $(PlatformTarget) $(AssemblyName) + false diff --git a/src/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs index 8f799720844f02..21fd800c89681a 100644 --- a/src/tasks/AndroidAppBuilder/ApkBuilder.cs +++ b/src/tasks/AndroidAppBuilder/ApkBuilder.cs @@ -195,11 +195,8 @@ public ApkBuilder(TaskLoggingHelper logger) Directory.CreateDirectory(Path.Combine(OutputDir, "assets")); var extensionsToIgnore = new List { ".so", ".a", ".dex", ".jar" }; - if (StripDebugSymbols) - { - extensionsToIgnore.Add(".pdb"); - extensionsToIgnore.Add(".dbg"); - } + extensionsToIgnore.Add(".pdb"); + extensionsToIgnore.Add(".dbg"); // Copy sourceDir to OutputDir/assets-tozip (ignore native files) // these files then will be zipped and copied to apk/assets/assets.zip @@ -388,8 +385,8 @@ public ApkBuilder(TaskLoggingHelper logger) File.WriteAllText(Path.Combine(OutputDir, monodroidSource), Utils.GetEmbeddedResource(monodroidSource)); AndroidProject project = new AndroidProject("monodroid", runtimeIdentifier, AndroidNdk, logger); - project.GenerateCMake(OutputDir, MinApiLevel); - project.BuildCMake(OutputDir); + project.GenerateCMake(OutputDir, MinApiLevel, StripDebugSymbols); + project.BuildCMake(OutputDir, StripDebugSymbols); // TODO: https://github.com/dotnet/runtime/issues/115717 diff --git a/src/tasks/MobileBuildTasks/Android/AndroidProject.cs b/src/tasks/MobileBuildTasks/Android/AndroidProject.cs index eab4209b219015..b482731671ac22 100644 --- a/src/tasks/MobileBuildTasks/Android/AndroidProject.cs +++ b/src/tasks/MobileBuildTasks/Android/AndroidProject.cs @@ -50,26 +50,43 @@ public void Build(string workingDir, ClangBuildOptions buildOptions, bool stripD Utils.RunProcess(logger, tools.ClangPath, workingDir: workingDir, args: clangArgs); } - public void GenerateCMake(string workingDir) + public void GenerateCMake(string workingDir, bool stripDebugSymbols) { - GenerateCMake(workingDir, DefaultMinApiLevel); + GenerateCMake(workingDir, DefaultMinApiLevel, stripDebugSymbols); } - public void GenerateCMake(string workingDir, string apiLevel = DefaultMinApiLevel) + public void GenerateCMake(string workingDir, string apiLevel = DefaultMinApiLevel, bool stripDebugSymbols = false) { // force ninja generator on Windows, the VS generator causes issues with the built-in Android support in VS var generator = Utils.IsWindows() ? "-G Ninja" : ""; string cmakeGenArgs = $"{generator} -DCMAKE_TOOLCHAIN_FILE={androidToolchainPath} -DANDROID_ABI=\"{Abi}\" -DANDROID_STL=none -DTARGETS_ANDROID=1 " + - $"-DANDROID_PLATFORM=android-{apiLevel} -B {projectName} -DCMAKE_BUILD_TYPE=Debug"; + $"-DANDROID_PLATFORM=android-{apiLevel} -B {projectName}"; + + if (stripDebugSymbols) + { + // Use "-s" to strip debug symbols, it complains it's unused but it works + cmakeGenArgs += " -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_FLAGS=\"-s -Wno-unused-command-line-argument\""; + } + else + { + cmakeGenArgs += " -DCMAKE_BUILD_TYPE=Debug"; + } Utils.RunProcess(logger, Cmake, workingDir: workingDir, args: cmakeGenArgs); } - public string BuildCMake(string workingDir) + public string BuildCMake(string workingDir, bool stripDebugSymbols = false) { - // Use Debug config to ensure android:debuggable=true, - // which is required for `adb shell run-as` to access result logs from internal storage. - string cmakeBuildArgs = $"--build {projectName} --config Debug"; + string cmakeBuildArgs = $"--build {projectName}"; + + if (stripDebugSymbols) + { + cmakeBuildArgs += " --config MinSizeRel"; + } + else + { + cmakeBuildArgs += " --config Debug"; + } Utils.RunProcess(logger, Cmake, workingDir: workingDir, args: cmakeBuildArgs);