Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue references in ConvertToLibraryImportAnalyzerTests #89225

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public static IEnumerable<object[]> NoMarshallingRequiredTypes() => new[]
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* <void>) },
new object[] { typeof(IntPtr) },
new object[] { typeof(ConsoleKey) }, // enum
};
Expand All @@ -50,7 +48,6 @@ public static IEnumerable<object[]> UnsupportedTypes() => new[]
[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!);
Expand All @@ -64,6 +61,20 @@ await VerifyCS.VerifyAnalyzerAsync(
.WithArguments("Method_Return"));
}

[Fact]
public async Task FunctionPointer_ReportsDiagnostic()
{
string source = DllImportWithType("delegate* unmanaged<void>");
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
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))]
Expand Down