Skip to content

fix(csharp): align driver and manifest loading errors with c++ - #4973

Merged
CurtHagenlocher merged 2 commits into
apache:mainfrom
amoeba:csharp-driver-not-found-tests
Oct 28, 2026
Merged

CurtHagenlocher merged 2 commits into
apache:mainfrom
amoeba:csharp-driver-not-found-tests

Conversation

@amoeba

@amoeba amoeba commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

This PR syncs the C# driver manager's failure behavior with the other driver managers.

I noticed the driver manager implementations don't perfectly align with respect to what errors they return for various driver and manifest loading failures. I'm not sure we need to have every driver manager return the exact same error class and detail but I noticed the C# driver manager returns non-ADBC errors in some cases where the other driver managers return an ADBC error with the underlying error wrapped. I think at least being consistent about when the user gets an ADBC error or not is a good starting place.

I had Opus 5.5 help me outline these cases, analyze other driver managers, and produce this table that highlights the behavioral difference in the C# driver manager:

Case C/C++ Rust C#
Driver library given by path (absolute or relative, with or without extension)
File doesn't exist ADBC NOT_FOUND ADBC INTERNAL System.ArgumentException (not an ADBC error)
File exists but can't be loaded (not a shared library, wrong architecture) ADBC NOT_FOUND ADBC INTERNAL System.DllNotFoundException (not an ADBC error)
Manifest given by path (.toml, or a path without extension with a .toml of the same name next to it)
Manifest file doesn't exist ADBC INVALID_ARGUMENT ADBC INVALID_ARGUMENT ADBC NOT_FOUND
Manifest isn't valid TOML ADBC INVALID_ARGUMENT ADBC INVALID_ARGUMENT ADBC INVALID_ARGUMENT
Manifest has no Driver.shared key ADBC INVALID_ARGUMENT ADBC INVALID_ARGUMENT ADBC INVALID_ARGUMENT
Manifest has no Driver.shared entry for this platform ADBC NOT_FOUND ADBC INVALID_ARGUMENT ADBC NOT_FOUND
Manifest's driver library doesn't exist ADBC NOT_FOUND ADBC INTERNAL System.ArgumentException (not an ADBC error)
Manifest's driver library exists but can't be loaded ADBC NOT_FOUND ADBC INTERNAL System.DllNotFoundException (not an ADBC error)
Driver given by bare name (found via search paths)
Nothing found by that name ADBC NOT_FOUND ADBC NOT_FOUND ADBC NOT_FOUND
Manifest found, its driver library doesn't exist ADBC NOT_FOUND ADBC NOT_FOUND System.ArgumentException (not an ADBC error)
Manifest found, its driver library exists but can't be loaded ADBC NOT_FOUND ADBC NOT_FOUND System.DllNotFoundException (not an ADBC error)

The PR makes C# match C++ in the above cases. Technically this could be marked as a breaking change though it's less likely that users depend on error behaviors in the same way they depend on non-error behaviors.

@amoeba amoeba changed the title fix(csharp): Return NotFound consistently when loading drivers directly fix(csharp): sync driver and manifest loading errors with other implementations Oct 28, 2026
@amoeba amoeba changed the title fix(csharp): sync driver and manifest loading errors with other implementations fix(csharp): align driver and manifest loading errors with c++ Oct 28, 2026
@amoeba
amoeba marked this pull request as ready for review October 28, 2026 22:25
@amoeba

amoeba commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Hey @CurtHagenlocher, I'm curious what you think about syncing up the error behavior like I've done here. I'm not totally sure it's critical but I thought I'd put up a PR so you could look.

@CurtHagenlocher CurtHagenlocher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great!

@CurtHagenlocher
CurtHagenlocher merged commit 075b302 into apache:main Oct 28, 2026
14 of 15 checks passed
lidavidm pushed a commit that referenced this pull request Nov 4, 2026
…th c++ (#4993)

Updates the Rust driver manager search code to return errors and error
details that match what C++ and C# do.

Each test covers a case and the table below describes what changed at
high level:

| Test | Before | After |
|---|---|---|
| `test_load_from_name_missing_or_invalid_driver` | `Internal` |
`NotFound`, with the path in the error |
| `test_manifest_wrong_arch` | `InvalidArguments` | `NotFound`, with
more detail in the error |
| `test_load_dynamic_missing_driver` | `Internal` | `NotFound`, with the
path in the error |
| `test_empty_driver_name` | `NotFound` | `InvalidArguments`, with a
clear error message |
| `test_load_from_name_invalid_manifest_by_path_or_name` |
`InvalidArguments` by path, `NotFound` by name | `InvalidArguments`
either way, and the error includes the manifest path |
| `test_relative_driver_path_disallowed` | `InvalidArguments` |
`InvalidArguments`, and the error now includes the path |

This PR makes the Rust column in the table on
#4973 match the other columns.

Continuation of:

- #4972
- #4973

This PR was created by driving Opus 5.5 around. I reviewed it with GPT
Sol 6.1 and Opus 5.5 and reviewed the tests myself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants