CppAst.NET icon indicating copy to clipboard operation
CppAst.NET copied to clipboard

CppParser.ParseFiles() functions differently when run during a pre-build event in VS19, but works normally elsewhere

Open Ragingram2 opened this issue 3 years ago • 4 comments

I am developing a small preprocessor for a game engine that I am working on with some friends, and we are using CppAST.Net in the preprocessor to autogenerate some files for runtime reflection.

The development of the preprocessor was going well, until I tried to run it during a pre-build event in visual studio where it wouldn't parse all of the files that I gave it. When run from the debugger or from a local published version of the application the program generates the AST in 30-40 seconds, finds 19 classes, 4 of which have the reflectable attribute, and generates 4 files for each of those classes (16 in total). But when the application is run during a pre-build event it only takes 5-6 seconds, finds 8 classes (non of which are reflectable) and generates no files.

I have been testing and debugging for the last week and I am completely at a loss. If anyone has any ideas on what this could be any help would be appreciated.

Some of my suspicions that I have yet to be able to prove/disprove is that the VS19 build output cmd prompt may have some different env variables that prevent certain functions from being called or are blocking certain .Net libraries. I have also checked my output, and there are no errors to be found.

Ragingram2 avatar Mar 24 '22 12:03 Ragingram2

I will be posting logs, and screenshots a little later

Ragingram2 avatar Mar 24 '22 12:03 Ragingram2

Successful Run from this .bat file image Log: Output.txt

Failed run from the pre-build event image using these arguments image Log Output.txt

Ragingram2 avatar Mar 24 '22 21:03 Ragingram2

Are you checking/outputing that the result of parsing doesn't have any error or messages? (e.g compilation.Diagnostics.HasErrors and compilation.Diagnostics.Messages)

xoofx avatar Mar 24 '22 22:03 xoofx

yep, my program outputs errors to the log, and prints that the ast generation failed in the console

Ragingram2 avatar Mar 24 '22 22:03 Ragingram2