Closed BinToss closed 2 weeks ago
https://github.com/microsoft/CsWin32/issues/7 This related issue applies to .NET SDK 5. I'm using .NET SDK 6 which has the suggested workaround applied by default.
Might be related to how design time build is done.
Closing due to lack of activity.
Issue Description
Although the root cause seemed to have been resolved in 2021 by the Roslyn and CsWin32 teams, OmniSharp still doesn't recognize CsWin32's generated code (which works perfectly in Visual Studio IDE).
Steps to Reproduce
dotnet new wpf --langVersion 9 --lang
dotnet add package Microsoft.Windows.CsWin32 --prerelease
New-Item NativeMethods.txt
"DeviceIoControl" > NativeMethods.txt
addusing Windows.Win32
andusing Microsoft.Win32
CallDeviceIoControl()
from App.xaml.csdotnet build *.csproj
Build will succeed despite OmniSharp's Error highlights.
Expected Behavior
unsafe
project property is set totrue
by CsWin32Actual Behavior
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.64.2 C# Extension: 1.24.0
Dotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.200-preview.22055.15 Commit: a3c3a2bf3b Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\ Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc .NET SDKs installed: 3.1.416 [C:\Program Files\dotnet\sdk] 5.0.403 [C:\Program Files\dotnet\sdk] 5.0.404 [C:\Program Files\dotnet\sdk] 5.0.405 [C:\Program Files\dotnet\sdk] 6.0.100-rc.2.21505.57 [C:\Program Files\dotnet\sdk] 6.0.101 [C:\Program Files\dotnet\sdk] 6.0.200-preview.22055.15 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0-rc.2.21480.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0-rc.2.21480.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0-rc.2.21501.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |angelscript|renesackers|1.0.3| |auto-using|Fudge|0.7.15| |better-cpp-syntax|jeff-hykin|1.15.13| |cmake|twxs|0.0.17| |cmake-tools|ms-vscode|1.9.2| |code-spell-checker|streetsidesoftware|2.1.7| |code-stats-vscode|riussi|1.0.18| |codespaces|GitHub|1.5.4| |cpptools|ms-vscode|1.8.4| |cpptools-extension-pack|ms-vscode|1.1.0| |cpptools-themes|ms-vscode|1.0.0| |csharp|ms-dotnettools|1.24.0| |docomment|k--kato|0.1.30| |docs-article-templates|docsmsft|0.2.11| |docs-images|docsmsft|0.0.9| |docs-linting|docsmsft|0.0.9| |docs-metadata|docsmsft|1.0.7| |docs-preview|docsmsft|0.3.57| |docs-visual-areas|docsmsft|0.2.1| |docs-yaml|docsmsft|0.2.7| |dotnet-interactive-vscode|ms-dotnettools|1.0.3103010| |doxdocgen|cschlosser|1.4.0| |EditorConfig|EditorConfig|0.16.4| |even-better-toml|tamasfe|0.14.2| |file-header|bookworms|0.0.1| |file-icons|file-icons|1.0.29| |file-properties-viewer|brunnerh|1.0.0| |gc-excelviewer|GrapeCity|4.0.50| |github-markdown-preview|bierner|0.2.0| |gitlens|eamodio|11.7.0| |hexeditor|ms-vscode|1.9.5| |html-css-class-completion|Zignd|1.20.0| |java|redhat|1.3.0| |jupyter|ms-toolsai|2022.1.1301854968| |jupyter-keymap|ms-toolsai|1.0.0| |jupyter-renderers|ms-toolsai|1.0.6| |LinkCheckMD|blackmist|0.3.1| |live-server|ms-vscode|0.2.12| |LogFileHighlighter|emilast|2.15.0| |makefile-tools|ms-vscode|0.3.1| |markdown-checkbox|bierner|0.3.2| |markdown-emoji|bierner|0.2.1| |markdown-footnotes|bierner|0.0.7| |markdown-preview-github-styles|bierner|1.0.1| |markdown-yaml-preamble|bierner|0.1.0| |msbuild-project-tools|tintoy|0.4.3| |msbuild-tools|sterin|0.0.12| |npm-intellisense|christian-kohler|1.4.1| |nsis|idleberg|3.48.0| |nsis-plugins|idleberg|1.3.1| |nugetpackagemanagergui|aliasadidev|1.1.9| |powershell-preview|ms-vscode|2022.2.2| |prettyxml|PrateekMahendrakar|1.4.0| |python|ms-python|2022.0.1814523869| |qub-msbuild|qub|0.6.3| |rainbow-csv|mechatroner|2.0.0| |reload|natqe|0.0.6| |remote-containers|ms-vscode-remote|0.217.4| |remote-ssh|ms-vscode-remote|0.74.0| |remote-ssh-edit|ms-vscode-remote|0.74.0| |remote-wsl|ms-vscode-remote|0.64.2| |remotehub|GitHub|0.24.0| |reopenclosedtab|uyiosa-enabulele|1.1.0| |roslynator|josefpihrt-vscode|4.0.3| |ruby|rebornix|0.28.1| |sarif-viewer|MS-SarifVSCode|3.1.1| |SecurityIntelliSense|azsdktm|0.8.0| |shader|slevesque|1.1.5| |solutionextension|Tobias-Sekan|1.9.2| |test-adapter-converter|ms-vscode|0.1.5| |toml|be5invis|0.6.0| |vs-keybindings|ms-vscode|0.2.1| |vscode|unoplatform|0.2.5| |vscode-cdb|MicrosoftDebuggingPlatform|0.0.6| |vscode-codeql|GitHub|1.5.11| |vscode-conventional-commits|vivaxy|1.24.0| |vscode-detect-charset|yeluoqiuzhi|0.0.1| |vscode-devskim|MS-CST-E|0.6.8| |vscode-github-actions|cschleiden|0.22.0| |vscode-html-css|ecmel|1.11.0| |vscode-java-debug|vscjava|0.38.0| |vscode-java-dependency|vscjava|0.19.0| |vscode-java-pack|vscjava|0.21.0| |vscode-java-test|vscjava|0.34.0| |vscode-markdown-notebook|ms-vscode|0.0.26| |vscode-markdownlint|DavidAnson|0.46.0| |vscode-maven|vscjava|0.35.0| |vscode-npm-script|eg2|0.3.24| |vscode-pull-request-github|GitHub|0.36.2| |vscode-pylance|ms-python|2022.2.4| |vscode-ruby|wingrunr21|0.28.0| |vscode-solution-explorer|fernandoescolar|0.4.5| |vscode-test-explorer|hbenl|2.21.1| |vscode-typescript-next|ms-vscode|4.7.20220225| |vscode-xml|redhat|0.19.1| |vscode-xml-complete|rogalmic|0.3.0| |vscode-yaml|redhat|1.4.0| |vscodeintellicode|VisualStudioExptTeam|1.2.17| |xml|DotJoshJohnson|2.5.1|;