From d389ab955dbb65547643fa1aed52669b02c04294 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 25 Jul 2023 17:02:55 -0700 Subject: [PATCH] Fix issue references in ConvertToLibraryImportAnalyzerTests (#89225) --- .../ConvertToLibraryImportAnalyzerTests.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ConvertToLibraryImportAnalyzerTests.cs b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ConvertToLibraryImportAnalyzerTests.cs index 8e8470e..376f604 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ConvertToLibraryImportAnalyzerTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ConvertToLibraryImportAnalyzerTests.cs @@ -34,8 +34,6 @@ namespace LibraryImportGenerator.UnitTests new object[] { typeof(int*) }, new object[] { typeof(bool*) }, new object[] { typeof(char*) }, - // See issue https://github.com/dotnet/runtime/issues/71891 - // new object[] { typeof(delegate* ) }, new object[] { typeof(IntPtr) }, new object[] { typeof(ConsoleKey) }, // enum }; @@ -50,7 +48,6 @@ namespace LibraryImportGenerator.UnitTests [Theory] [MemberData(nameof(MarshallingRequiredTypes))] [MemberData(nameof(NoMarshallingRequiredTypes))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/60909", typeof(PlatformDetection), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsWindows))] public async Task TypeRequiresMarshalling_ReportsDiagnostic(Type type) { string source = DllImportWithType(type.FullName!); @@ -64,6 +61,20 @@ namespace LibraryImportGenerator.UnitTests .WithArguments("Method_Return")); } + [Fact] + public async Task FunctionPointer_ReportsDiagnostic() + { + string source = DllImportWithType("delegate* unmanaged"); + await VerifyCS.VerifyAnalyzerAsync( + source, + VerifyCS.Diagnostic(ConvertToLibraryImport) + .WithLocation(0) + .WithArguments("Method_Parameter"), + VerifyCS.Diagnostic(ConvertToLibraryImport) + .WithLocation(1) + .WithArguments("Method_Return")); + } + [Theory] [MemberData(nameof(MarshallingRequiredTypes))] [MemberData(nameof(NoMarshallingRequiredTypes))] -- 2.7.4