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
If try tracing inside lambdas, compiler runs for infinite time #7591
If I put TRACE_EVENT or TRACE_EVENT_BEGIN macros inside a lambda, the MSVC compiler runs for infinite time without finish.
To reproduce
Try to compile this simple code with perfetto v52.0-6942f195e and toolchain: VS 2026 18.10.1, MSVC 14.51.36231, v145, Release x64.
I noticed the same problem also with older versions of MSVC.
The same issue happens also if you don't create tracing session and don't call the lambda: you can comment all lines from perfetto::TraceConfig config; to return (excluded) and the issue remains.
Problem solved: there is an issue with the default options of MSVC. It compiles correcty if I set language standard ≥C++20 (flag /std:c++20 or higher). With older standard or the default, the compilation flag /Zc:lambda is needed in order to use TRACE_EVENT inside lambdas. Probably it's related with this MSVC remark.
Activity
[-]If try tracing inside with lambdas, compiler runs for infinite time[/-][+]If try tracing inside lambdas, compiler runs for infinite time[/+]primiano commentedon Sep 23, 2026
it's a bit surprising, but if it happens only with MSVC might likely be some MSVC bug worth filing there.
Otherwise can you (ask AI help to) to narrow it down to what's causing it?
We are unlikely to look at some issue that affects only MSVC
diriki commentedon Sep 28, 2026
Problem solved: there is an issue with the default options of MSVC. It compiles correcty if I set language standard ≥C++20 (flag /std:c++20 or higher). With older standard or the default, the compilation flag /Zc:lambda is needed in order to use TRACE_EVENT inside lambdas. Probably it's related with this MSVC remark.
primiano commentedon Sep 28, 2026
Oh thanks a lot for finding this. I truly appreciate it.
We should definitely add this to our documentation.
I'll reopen the bug to keep track of the doc additions