Skip to content

Suggested solution to SYSLIB1054 results in compiler error CS8796 #113162

@Aniobodo

Description

@Aniobodo

Version Used:
.NET SDK 9.0.200

Repro:

using System.Runtime.InteropServices;

namespace ConsoleApp1;
public static class InfoBox
{
    [DllImport("user32.dll", CharSet = CharSet.Unicode)]
    static extern int InfoBoxA(nint hWnd,
        string lpText,
        string lpCaption,
        uint uType);
}

Steps to Reproduce:

  1. Create a project with the above repro in Visual Studio 2022.
  2. SYSLIB1054: Respond to the Quick Action tip (Yellow light bulb) on the method by accepting the suggestion.
  3. Recognise the new error CS8796
2025-03-05.Accepting.the.suggestion.from.Quick.Action.tip.results.in.compiler.error.CS8796.mp4

Diagnostic Id:
CS8796

Expected Behavior:
No error if Quick Action suggestion is accepted

Actual Behavior:
Accepting the suggestion from Quick Action tip results in compiler error CS8796

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions