Repository navigation
Conversation
|
Review findings
Checked and fine: the committed natvis matched the generator output at 63c212b. The ABI tag order in — posted by Claude Code on behalf of @nlohmann |
|
Hey! Glad that it's finally making it's way in the package! 💪 |
|
@sakuntalle Could you try the natvis file and/or review this PR? |
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated and/or formatted correctly, or 📎 A ready-to-apply patch is attached to the failed workflow run as the git apply amalgamation.patchThis does not require installing astyle yourself. |
Hey! Unfortunatelly I’m not part of that project anymore so I don’t have access to that codebase that was yielding the issue. |
Squashed onto develop from: - Add a type in the natvis template for detail::json_default_base - Document the json_default_base natvis fallback and regenerate natvis - Match json_default_base in both its current and 3.12.0 namespace Co-authored-by: Mihnea Magheru <sakuntalle@yahoo.com> Signed-off-by: Mihnea Magheru <sakuntalle@yahoo.com> Signed-off-by: Niels Lohmann <mail@nlohmann.me>
f9a4ea0 to
decbb6e
Compare
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated and/or formatted correctly, or 📎 A ready-to-apply patch is attached to the failed workflow run as the git apply amalgamation.patchThis does not require installing astyle yourself. |
The check ran generate_natvis.py from a develop checkout, which loads nlohmann_json.natvis.j2 from its own directory. A PR that changes the template was therefore checked against develop's template and always failed. Copy the PR's template next to the develop script before running it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Supersedes #4973 (which was based on an outdated
developand had conflicts) and fixes #4972. The template change is @sakuntalle's commit, kept with their authorship; thanks for the fix and for testing it in production for the past year!What
For every ABI namespace,
nlohmann_json.natvisnow has a visualizer forjson_default_base(the empty default base class ofbasic_json), under both of its names:json_default_base(current code, since #5238) anddetail::json_default_base(3.12.0), with the same display and expansion rules as thebasic_json<*>entry.Why this works
With 3.12.0, Visual Studio 2022 shows
nlohmann::jsonvalues asdetail::json_default_basefor some users, without any visualization. Natvis visualizers are inherited by derived types (Inheritabledefaults to true). If no entry matches the most-derived type, the debugger uses the base class's visualizer, and it evaluates the expressions against the derived object. That's whym_dataresolves even thoughjson_default_basehas no members.Known gap
We still don't know why the
basic_json<*>entry doesn't match in that setup. This PR adds a harmless fallback; it doesn't fix the root cause. If anyone can reproduce it, the output with Tools → Options → Debugging → Output Window → Natvis diagnostic messages set to Verbose would tell us.Changes
tools/generate_natvis/nlohmann_json.natvis.j2: new entries for{{ ns }}::json_default_baseand{{ ns }}::detail::json_default_base, with a comment explaining the fallback.nlohmann_json.natvis: regenerated withtools/generate_natvis/generate_natvis.py --version 3.12.0. The file grows only by the new entries (two per ABI namespace). I checked that removing the new entries gives back exactly the previous file, and that the XML is well-formed.This could not be tested in Visual Studio here (no Windows machine).
Breaking changes
No breaking changes. Only the debugger visualization file changes; the library code and public API are unchanged.
🤖 Generated with Claude Code