xoofx / CppAst.NET

CppAst is a .NET library providing a C/C++ parser for header files powered by Clang/libclang with access to the full AST, comments and macros
BSD 2-Clause "Simplified" License
494 stars 65 forks source link

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

Open Ragingram2 opened 2 years ago

Ragingram2 commented 2 years ago

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 commented 2 years ago

I will be posting logs, and screenshots a little later

Ragingram2 commented 2 years ago

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

xoofx commented 2 years ago

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)

Ragingram2 commented 2 years ago

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