csharp: Fall back to AdbcDriverInit when the derived entrypoint is absent
- Dominant language
- C#
- Stars
- 627
- Forks
- 217
- Avg merge
- 17h
- Merged PRs (30d)
- 57
Description
### What happened?
The C# driver manager derives an entrypoint of `AdbcDriver{PascalCase}Init` from the driver library filename, but performs only that single symbol lookup. If the driver does not export that exact name, loading fails with `EntryPointNotFoundException` even though the driver exports the standard `AdbcDriverInit`.
Compare this to the C/C++ driver manager which tries the derived name and then falls back to `AdbcDriverInit` (`c/driver_manager/adbc_driver_manager.cc`):
```cpp
static const char kDefaultEntrypoint[] = "AdbcDriverInit";
...
status = library.Lookup(name.c_str(), &load_handle, error);
if (status != ADBC_STATUS_OK) {
status = library.Lookup(kDefaultEntrypoint, &load_handle, error);
}
```
C# has no equivalent fallback, so drivers that load fine from Go/Python/R fail from C#:
```csharp
// Manifest declares no entrypoint; C# derives "AdbcDriverClickhouseInit"
using var driver = AdbcDriverManager.FindLoadDriver(
"clickhouse", loadOptions: AdbcLoadFlags.Default);
// System.EntryPointNotFoundException: Unable to find an entry point named
// 'AdbcDriverClickhouseInit' in shared library.
```
`nm -gU libadbc_driver_clickhouse.dylib | grep -iE 'init$'` shows the derived name is
absent but the standard one is present:
```
_AdbcClickhouseInit
_AdbcDriverInit
```
You can work around this by passing `entrypoint: "AdbcDriverInit"` in the client code.
This problem affects the ClickHouse, Exasol, MySQL, and SingleStore drivers. We opened PRs to solve this in the drivers, but we should solve it here too.
### Stack Trace
_No response_
### How can we reproduce the bug?
_No response_
### Environment/Setup
_No response_
Contributor guide
Research direction
Start with the C# driver manager's FindLoadDriver path and compare its entrypoint lookup with c/driver_manager/adbc_driver_manager.cc. Confirm how the derived AdbcDriver{PascalCase}Init name is resolved, then make the standard AdbcDriverInit lookup the fallback when the derived symbol is absent. Done means affected drivers such as ClickHouse can load without an explicit entrypoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100