From 28f7d0947cf4a894e658e193c4f98452e24eff50 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Wed, 26 Jan 2022 12:08:05 -0500 Subject: [PATCH 1/4] [mono] Re-enable tests that call MakeGenericType with non-RuntimeType arguments Fixes https://github.com/dotnet/runtime/issues/32743 The actual fix was in https://github.com/dotnet/runtime/pull/58014 --- .../LoggerMessageGeneratedCodeTests.cs | 1 - .../LoggerMessageGeneratorEmitterTests.cs | 1 - .../LoggerMessageGeneratorParserTests.cs | 1 - .../Composition/Registration/RegistrationBuilderTests.cs | 5 ----- 4 files changed, 8 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs index d55bf4a8028d5..406bd0ae185df 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs @@ -8,7 +8,6 @@ namespace Microsoft.Extensions.Logging.Generators.Tests { - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public class LoggerMessageGeneratedCodeTests { [Fact] diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs index cc0b8ba1adfe3..304bf65b0e4b8 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs @@ -10,7 +10,6 @@ namespace Microsoft.Extensions.Logging.Generators.Tests { - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public class LoggerMessageGeneratorEmitterTests { [Fact] diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs index 3c3ce17ef0b18..6db7da1ed5470 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs @@ -13,7 +13,6 @@ namespace Microsoft.Extensions.Logging.Generators.Tests { - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public class LoggerMessageGeneratorParserTests { [Fact] diff --git a/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs b/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs index f095d38c04546..b4e0767840342 100644 --- a/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs +++ b/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs @@ -45,7 +45,6 @@ public DiscoveredCatalog() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public void ShouldSucceed() { var rb = new RegistrationBuilder(); @@ -175,7 +174,6 @@ private interface IGenericInterface { } private class ClassExportingInterface : IGenericInterface { } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public void GenericInterfaceExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ClassExportingInterface<>)); @@ -189,7 +187,6 @@ private class GenericBaseClass { } private class ClassExportingBaseClass : GenericBaseClass { } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public void GenericBaseClassExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ClassExportingBaseClass<>)); @@ -212,7 +209,6 @@ public void GenericExportInRegistrationBuilder() private class ExplicitGenericClass { } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public void ExplicitGenericExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ExplicitGenericClass<>)); @@ -224,7 +220,6 @@ public void ExplicitGenericExportInRegistrationBuilder() private class ExplicitGenericClass { } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestRuntimes.Mono)] public void ExplicitGenericArity2ExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ExplicitGenericClass<,>)); From 96486f87bbccd2b935a36a4ccfb28b98630842f6 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Jan 2022 17:25:13 -0500 Subject: [PATCH 2/4] [wasm] Disable some logging generator tests `Microsoft.Extensions.Logging.Generators.Tests.LoggerMessageGeneratorEmitterTests.*` `Microsoft.Extensions.Logging.Generators.Tests.LoggerMessageGeneratorParserTests.*` .. failing like: ``` [18:09:38] fail: [FAIL] Microsoft.Extensions.Logging.Generators.Tests.LoggerMessageGeneratorParserTests.NotPartial [18:09:38] info: System.ArgumentException : Empty path name is not legal. (Parameter 'path') [18:09:38] info: at System.IO.Strategies.FileStreamHelpers.ValidateArguments(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) [18:09:38] info: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) [18:09:38] info: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [18:09:38] info: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) [18:09:38] info: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) [18:09:38] info: at Roslyn.Utilities.StandardFileSystem.OpenFile(String filePath, FileMode mode, FileAccess access, FileShare share) [18:09:38] info: at Roslyn.Utilities.CommonCompilerFileSystemExtensions.OpenFileWithNormalizedException(ICommonCompilerFileSystem fileSystem, String filePath, FileMode fileMode, FileAccess fileAccess, FileShare fileShare) [18:09:38] info: at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation) [18:09:38] info: at SourceGenerators.Tests.RoslynTestUtils.CreateTestProject(IEnumerable`1 references, Boolean includeBaseReferences) [18:09:38] info: at SourceGenerators.Tests.RoslynTestUtils.RunGenerator(ISourceGenerator generator, IEnumerable`1 references, IEnumerable`1 sources, Boolean includeBaseReferences, CancellationToken cancellationToken) [18:09:38] info: at Microsoft.Extensions.Logging.Generators.Tests.LoggerMessageGeneratorParserTests.RunGenerator(String code, Boolean wrap, Boolean inNamespace, Boolean includeBaseReferences, Boolean includeLoggingReferences, CancellationToken cancellationToken) [18:09:38] info: at Microsoft.Extensions.Logging.Generators.Tests.LoggerMessageGeneratorParserTests.NotPartial() [18:09:38] info: --- End of stack trace from previous location --- ``` .. due to https://github.com/dotnet/runtime/issues/52062 . --- .../LoggerMessageGeneratorEmitterTests.cs | 1 + .../LoggerMessageGeneratorParserTests.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs index 304bf65b0e4b8..476055d4a88fe 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs @@ -10,6 +10,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests { + [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] public class LoggerMessageGeneratorEmitterTests { [Fact] diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs index 6db7da1ed5470..fb5c9cffc8b3d 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs @@ -13,6 +13,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests { + [ActiveIssue("https://github.com/dotnet/runtime/issues/52062", TestPlatforms.Browser)] public class LoggerMessageGeneratorParserTests { [Fact] From f61efbab8bb3dafbba48f87c94b29695186570af Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 26 Jan 2022 17:42:27 -0500 Subject: [PATCH 3/4] [tvos] Disable some failing tests `System.ComponentModel.Composition.Registration.Tests.RegistrationBuilderTests.ExplicitGenericExportInRegistrationBuilder` `System.ComponentModel.Composition.Registration.Tests.RegistrationBuilderTests.ExplicitGenericArity2ExportInRegistrationBuilder` `System.ComponentModel.Composition.Registration.Tests.RegistrationBuilderTests.GenericBaseClassExportInRegistrationBuilder` `System.ComponentModel.Composition.Registration.Tests.RegistrationBuilderTests.GenericInterfaceExportInRegistrationBuilder` `System.ComponentModel.Composition.Registration.Tests.RegistrationBuilderTests.ShouldSucceed` .. failing due to https://github.com/dotnet/runtime/issues/32743 . --- .../Composition/Registration/RegistrationBuilderTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs b/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs index b4e0767840342..4c56ed13151a3 100644 --- a/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs +++ b/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs @@ -45,6 +45,7 @@ public DiscoveredCatalog() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] public void ShouldSucceed() { var rb = new RegistrationBuilder(); @@ -174,6 +175,7 @@ private interface IGenericInterface { } private class ClassExportingInterface : IGenericInterface { } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] public void GenericInterfaceExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ClassExportingInterface<>)); @@ -187,6 +189,7 @@ private class GenericBaseClass { } private class ClassExportingBaseClass : GenericBaseClass { } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] public void GenericBaseClassExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ClassExportingBaseClass<>)); @@ -209,6 +212,7 @@ public void GenericExportInRegistrationBuilder() private class ExplicitGenericClass { } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] public void ExplicitGenericExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ExplicitGenericClass<>)); @@ -220,6 +224,7 @@ public void ExplicitGenericExportInRegistrationBuilder() private class ExplicitGenericClass { } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] public void ExplicitGenericArity2ExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ExplicitGenericClass<,>)); From 8e3b31487ebec1be4c45d1b69590aec88f4fa301 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Thu, 27 Jan 2022 09:37:40 -0500 Subject: [PATCH 4/4] Disable RegistrationBuilderTests that require ref emit on platforms that don't support it --- .../Registration/RegistrationBuilderTests.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs b/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs index 4c56ed13151a3..ab5b9a5ac0076 100644 --- a/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs +++ b/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/RegistrationBuilderTests.cs @@ -44,8 +44,7 @@ public DiscoveredCatalog() : base("") { } } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] public void ShouldSucceed() { var rb = new RegistrationBuilder(); @@ -174,8 +173,7 @@ private interface IGenericInterface { } [Export(typeof(IGenericInterface<>))] private class ClassExportingInterface : IGenericInterface { } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] public void GenericInterfaceExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ClassExportingInterface<>)); @@ -188,8 +186,7 @@ private class GenericBaseClass { } [Export(typeof(GenericBaseClass<>))] private class ClassExportingBaseClass : GenericBaseClass { } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] public void GenericBaseClassExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ClassExportingBaseClass<>)); @@ -211,8 +208,7 @@ public void GenericExportInRegistrationBuilder() [Export(typeof(ExplicitGenericClass<>))] private class ExplicitGenericClass { } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] public void ExplicitGenericExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ExplicitGenericClass<>)); @@ -223,8 +219,7 @@ public void ExplicitGenericExportInRegistrationBuilder() [Export(typeof(ExplicitGenericClass<,>))] private class ExplicitGenericClass { } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/32743", TestPlatforms.tvOS)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] public void ExplicitGenericArity2ExportInRegistrationBuilder() { CompositionContainer container = CreateRegistrationBuilderContainer(typeof(ExplicitGenericClass<,>));