LibraryImport causes CS8795
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
**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 https://github.com/dotnet/vscode-csharp/issues/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.`
Contributor guide
Assessment
This issue has not been assessed yet.