Skip to content

LibraryImport causes CS8795 #9579

Open
Open
@FlsPrpht

Description

@FlsPrpht

Version Used:
VS 17.10.5
.NET Runtime is 8.0.7
.NET SDK - 8.0.303.

Steps to Reproduce:
I cannot reproduce this with a newly created project and have been unable to deduce the difference between my app and the same app.

namespace CS8795
{
    using System;
    using System.Runtime.InteropServices;

    internal static partial class NativeMethods
    {
        [LibraryImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        internal static partial Boolean IsIconic(IntPtr hwnd);
    }
}

Diagnostic Id:

error CS8795: Partial method 'NativeMethods.IsIconic(nint)' must have an implementation part because it has accessibility modifiers.

Expected Behavior:
Per dotnet/vscode-csharp#5999 we should not be seeing this anymore

Actual Behavior:
I am seeing

error CS8795: Partial method 'NativeMethods.IsIconic(nint)' must have an implementation part because it has accessibility modifiers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions