Fix tests on windows-latest by compiling and bundling native DLL#8
Closed
s-a wants to merge 5 commits intojonatas:mainfrom
Closed
Fix tests on windows-latest by compiling and bundling native DLL#8s-a wants to merge 5 commits intojonatas:mainfrom
s-a wants to merge 5 commits intojonatas:mainfrom
Conversation
711b48a to
4f8bdc4
Compare
This ensures the libpgquery_wrapper.dll is correctly built and included in the test runtime, allowing .NET P/Invoke to succeed during test execution on Windows CI runners.
4f8bdc4 to
b9b46b1
Compare
added 3 commits
July 8, 2025 18:15
This commit fixes a critical runtime exception that caused the application to crash immediately upon startup (`Abort trap: 6` in the build logs). Problem: The application was throwing a `System.InvalidOperationException` from the CommandLineParser library with the message: "Type GrepSQL.Options appears to be immutable, but no constructor found to accept values." Cause: The `Options` class had duplicated properties for handling both positional and named arguments (e.g., `PositionalPattern` and `Pattern`). This structure confused the parser, leading it to incorrectly infer an immutable type and fail during object construction. Solution: - The duplicated properties in the `Options` class have been consolidated into single properties (e.g., just `Pattern` and `Files`). - Both `[Value]` (for positional) and `[Option]` (for named) attributes are now applied to the same, consolidated property. - The logic in `RunGrepSql` has been updated to use these simplified properties. This change makes the `Options` class unambiguous for the parser, resolving the crash and making the argument handling more robust and clean.
The build script previously continued after the `nmake` command failed, leading to a confusing "file not found" error later. This change adds explicit exit code checks after each `nmake` call to expose the root C++ compiler/linker error immediately.
The default `nmake` target for `libpg_query` builds the static library and runs tests, but does not produce the required `pg_query.dll`. This commit changes the build command to `nmake /F Makefile.msvc dll` to specifically instruct the build system to create the dynamic link library needed for the .NET application. This resolves the "Build artifact pg_query.dll not found" error.
cd2f1b0 to
e85cd48
Compare
This commit resolves a `System.DllNotFoundException` for `libdl.so` that was causing all tests to fail on the Linux platform. The .NET runtime on the GitHub `ubuntu-latest` runner was unable to locate the dynamic linking library `libdl.so` in its standard search paths, even though it is present on the system via the `libc6-dev` package. This fix adds a command to the "Install Linux dependencies" step to create a symbolic link from the actual library location to a path where the .NET runtime can find it. This unblocks the native library loader and allows the tests to run successfully.
e85cd48 to
6b18172
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This ensures the libpgquery_wrapper.dll is correctly built and included in the test runtime, allowing .NET P/Invoke to succeed during test execution on Windows CI runners.