Skip to content

Commit

Permalink
Disable LibraryImport again
Browse files Browse the repository at this point in the history
  • Loading branch information
sungaila committed Jun 27, 2024
1 parent 1b2d5f9 commit a129619
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/PDFtoImage/Internals/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ private static int FPDF_GetBlock(IntPtr param, uint position, IntPtr buffer, uin

private static partial class Imports
{
#if NET7_0_OR_GREATER && !WASM
// LibraryImport is not supported by Blazor WebAssembly
#if NET7_0_OR_GREATER && FALSE
[LibraryImport("pdfium")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void FPDF_InitLibrary();
Expand Down Expand Up @@ -383,6 +384,9 @@ private static partial class Imports
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial IntPtr FPDFDOC_InitFormFillEnvironment(IntPtr document, FPDF_FORMFILLINFO formInfo);
#else
#if NET7_0_OR_GREATER
#pragma warning disable SYSLIB1054
#endif
[DllImport("pdfium", CallingConvention = CallingConvention.Cdecl)]
public static extern void FPDF_InitLibrary();

Check warning on line 391 in src/PDFtoImage/Internals/NativeMethods.cs

View workflow job for this annotation

GitHub Actions / SonarCloud

Rename this method to not shadow the outer class' member with the same name. (https://rules.sonarsource.com/csharp/RSPEC-3218)

Expand Down Expand Up @@ -456,13 +460,16 @@ private static partial class Imports
public static extern void FPDF_RemoveFormFieldHighlight(IntPtr form);

[DllImport("pdfium", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
#if NET6_0
#if NET6_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA2101:Specify marshalling for P/Invoke string arguments")]
#endif
public static extern IntPtr FPDF_LoadCustomDocument(FPDF_FILEACCESS access, string? password);

[DllImport("pdfium", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr FPDFDOC_InitFormFillEnvironment(IntPtr document, FPDF_FORMFILLINFO formInfo);
#if NET7_0_OR_GREATER
#pragma warning restore SYSLIB1054
#endif
#endif
}

Expand Down
1 change: 0 additions & 1 deletion src/WebConverter/WebConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<Features>strict</Features>
<WarningsAsErrors>nullable</WarningsAsErrors>
<NoWarn>CA1416</NoWarn>
<DefineConstants>$(DefineConstants);WASM</DefineConstants>
</PropertyGroup>

<!-- Debug builds -->
Expand Down

0 comments on commit a129619

Please sign in to comment.