You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Spurious IntelliSense errors with C++20 Modules #1610
A simple project that uses C++/WinRT with the new C++20 Modules feature can build successfully with MSVC 14.52 Preview in Visual Studio Insiders, but has IntelliSense errors in the IDE that get in the way of return type deduction and similar. For instance, the example code causes this IntelliSense error:
function "winrt::Windows::Foundation::IUnknown::operator new(size_t)" (declared at line 2117 of module "winrt_base" ("D:\...\winrtmodcom\x64\Debug\Generated Files\winrt\base.h")) cannot be referenced -- it is a deleted function
More likely than not, this is simply an IDE and IntelliSense bug and I've reported it as such in DevCom-11123562. Anyone who cares about this scenario is welcome to upvote it. Having said that, if there's any workaround that can be implemented on the cppwinrt side to mitigate these IntelliSense failures, it would be a welcome improvement to the user experience.
Reproducible example
import std;
import winrt_base;
import winrt.Windows.Foundation;
winrt::Windows::Foundation::IAsyncOperation<winrt::hstring> GetStringAsync()
{
co_returnL"Hello, World!";
}
winrt::Windows::Foundation::IAsyncOperation<winrt::hstring> foo()
{
auto str = co_awaitGetStringAsync(); // IntelliSense labels this <error type> instead of figuring out it is a winrt::hstring.co_return str;
}
Expected behavior
IntelliSense should be fully functional with cppwinrt C++20 Modules in scenarios that work correctly with header files.
Actual behavior
IntelliSense reports spurious E1776 errors and fails to deduce return types
I believe this is indeed a bug in IntelliSense and the workaround is difficult to implement in C++/WinRT.
I checked the output from IntelliSense, which is as follows:
error: failed to load an
IFC entity reference in module "winrt_base"
from partition "expr.decl" element 1934 (file position 1113216,
relative position 30944)
detected during:
instantiation of type "winrt::impl::base_implements<D, I...>" at
line 8088
instantiation of class "winrt::impl::promise_base<Derived,
AsyncInterface, TProgress> [with
Derived=std::coroutine_traits<winrt::Windows::Foundation:
:IAsyncOperation<winrt::hstring>>::promise_type,
AsyncInterface=winrt::Windows::Foundation::IAsyncOperatio
n<winrt::hstring>, TProgress=void]" at line 4110 of
module "winrt.Windows.Foundation"
So it looks like this is caused by a bug in IntelliSense’s support for IFC.
A limited workaround is to add the following at the top of your source files:
In the project property pages under C/C++ / General, set Suppress Start Banner to No, or edit the .vcxproj file and add the property <SuppressStartupBanner>false</SuppressStartupBanner> to the ClCompile item. After that, building the project will print the cl command line that was used.
Next, insert the /BE option right before the name of the source file you’re currently building (e.g., main.cpp), open a VS Command Prompt, cd to the .vcxproj directory, and run the modified command to see the actual output from the IntelliSense engine.
For modules you have to do a full build of the project first to generate the IFC files, and then run the modified command. In addition, MSBuild currently seems to have a defect where it adds modules to the build command even if they aren’t used. I reported this issue on DevCom. For a C++/WinRT project this results in an extremely long command (around 48 KB), so you need to trim the command line by removing the irrelevant module references. The command I used is:
I just received some good news: the MSVC team is preparing to address the issue of IntelliSense's poor support for modules, and we can expect some improvement within this year.
Reacted by rtanabe999, pjmlp, Makoto Sakaguchi and Victor Derks
Activity
hoshiizumiya commentedon Jul 23, 2026
I could say that it can not work at all in my module proj (C++23). VS xaml intellisense too. It's my feedback link https://developercommunity.visualstudio.com/t/XAML-IntelliSense-and-Hot-Reload-stop-wo/11117521
YexuanXiao commentedon Jul 23, 2026
I believe this is indeed a bug in IntelliSense and the workaround is difficult to implement in C++/WinRT.
I checked the output from IntelliSense, which is as follows:
So it looks like this is caused by a bug in IntelliSense’s support for IFC.
A limited workaround is to add the following at the top of your source files:
How to debug IntelliSense:
In the project property pages under C/C++ / General, set Suppress Start Banner to
No, or edit the.vcxprojfile and add the property<SuppressStartupBanner>false</SuppressStartupBanner>to theClCompileitem. After that, building the project will print theclcommand line that was used.Next, insert the
/BEoption right before the name of the source file you’re currently building (e.g.,main.cpp), open a VS Command Prompt,cdto the.vcxprojdirectory, and run the modified command to see the actual output from the IntelliSense engine.For modules you have to do a full build of the project first to generate the IFC files, and then run the modified command. In addition, MSBuild currently seems to have a defect where it adds modules to the build command even if they aren’t used. I reported this issue on DevCom. For a C++/WinRT project this results in an extremely long command (around 48 KB), so you need to trim the command line by removing the irrelevant module references. The command I used is:
YexuanXiao commentedon Jul 24, 2026
I just received some good news: the MSVC team is preparing to address the issue of IntelliSense's poor support for modules, and we can expect some improvement within this year.