Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated natvis is invalid XML #3858

Closed
2 tasks done
Avery3R opened this issue Dec 2, 2022 · 2 comments · Fixed by #3863
Closed
2 tasks done

Generated natvis is invalid XML #3858

Avery3R opened this issue Dec 2, 2022 · 2 comments · Fixed by #3863
Assignees
Labels
confirmed kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@Avery3R
Copy link

Avery3R commented Dec 2, 2022

Description

The natvis generator inserts comments before the xml node, which is invalid and causes parsing to fail.

Reproduction steps

  • Using VS2022
  • Add the generated natvis to your project
  • Go to Tools -> Options -> Debugger -> Output Window
  • Set Natvis diagnostic messages to verbose
  • Attempt to debug project and have natvis work
  • json\nlohmann_json.natvis(4,3): Fatal error: Invalid xml declaration. appears in the output window

Opening up the generated natvis in the editor within visual studio shows a red squiggly, hovering over it reveals:

Unexpected XML declaration. The XML declaration must
be the first node in the document and no white space
characters are allowed to appear before it.

Expected vs. actual results

Expected:

generated natvis starts with:

<?xml version="1.0" encoding="utf-8"?>

Reality:

generated natvis starts with:

<!-- * * * * * * * * AUTO-GENERATED FILE  * * * * * * * * -->
<!-- Edit ./tools/generate_natvis/nlohmann_json.natvis.j2 -->
<!-- * * * * * * * * AUTO-GENERATED FILE  * * * * * * * * -->
<?xml version="1.0" encoding="utf-8"?>

Minimal code example

No response

Error messages

`json\nlohmann_json.natvis(4,3): Fatal error: Invalid xml declaration.`

Compiler and operating system

Microsoft Visual Studio Community 2022 Version 17.4.2

Library version

a3e6e26

Validation

@nlohmann
Copy link
Owner

nlohmann commented Dec 3, 2022

You are right - having a comment before the <?xml tag is indeed an error.

@nlohmann
Copy link
Owner

nlohmann commented Dec 4, 2022

Can you please try the XML in PR #3863?

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Dec 9, 2022
@nlohmann nlohmann added this to the Release 3.11.3 milestone Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants