var shellLink = ShellLink.Create(
$"{Environment.GetFolderPath(Environment.SpecialFolder.Programs)}\\1.lnk",
$"{Environment.GetFolderPath(Environment.SpecialFolder.Programs)}\\1.lnk",null);
What code is involved
Unhandled exception. System.InvalidProgramException: Common Language Runtime detected an invalid program. The body of method 'Void CShellLinkW..ctor()' is invalid.
at Internal.Runtime.TypeLoaderExceptionHelper.CreateInvalidProgramException(ExceptionStringID, String) + 0x36
at Vanara.PInvoke.Shell32.CShellLinkW..ctor() + 0xf
at Vanara.Windows.Shell.ShellLink..ctor() + 0x14
at Vanara.Windows.Shell.ShellLink..ctor(String, String, String, String) + 0x11
at Vanara.Windows.Shell.ShellLink.Create(String, String, String, String, String) + 0x33
at Program.<Main>$(String[] args) + 0x45
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Describe the bug and how to reproduce Minimal example https://github.com/MakesYT/ShellLinkAOT
What code is involved
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.