Skip to content

build(csharp): restore the strong name dropped in the move from arrow-adbc - #243

Merged
CurtHagenlocher merged 2 commits into
adbc-drivers:mainfrom
CurtHagenlocher:build-restore-strong-name
Jul 29, 2026
Merged

build(csharp): restore the strong name dropped in the move from arrow-adbc#243
CurtHagenlocher merged 2 commits into
adbc-drivers:mainfrom
CurtHagenlocher:build-restore-strong-name

Conversation

@CurtHagenlocher

Copy link
Copy Markdown
Collaborator

What's Changed

csharp/Directory.Build.props has carried <SignAssembly>true</SignAssembly> since the initial "chore: get it building" commit, but the accompanying <AssemblyOriginatorKeyFile> line and the key itself never came across from apache/arrow-adbc. SignAssembly on its own is a no-op: MSBuild passes no /keyfile to the compiler, no warning is emitted, and the driver has been shipping unsigned this whole time. The published Apache.Arrow.Adbc.Drivers.BigQuery 0.23.0 carries public key token 204f54e5a45c07df, so this was a regression in the move, not a decision.

This adds csharp/AdbcDrivers.snk — the same key adbc-drivers/hiveserver2 signs with — giving AdbcDrivers.BigQuery public key token f1f2cdc791f08e13, matching its sibling driver.

Two consequences fall out of actually signing:

  • InternalsVisibleTo must name a public key (CS1726). The bare InternalsVisibleTo("AdbcDrivers.BigQuery.Tests") only compiled because the output was unsigned. Both apache/arrow-adbc and hiveserver2 spell theirs out the same way.
  • Castle DynamicProxy needs its own grant, added in the second commit. Moq generates proxies into DynamicProxyGenAssembly2, which cannot subclass an internal type from a strong-named assembly without one. No current test hits this — the types the suite mocks are public — but the failure mode is a runtime ArgumentException at Setup() rather than a compile error, so granting it now avoids an opaque failure the first time someone mocks an internal type. hiveserver2 carries the same grant.

csharp/AdbcDrivers.snk is added to .rat-excludes, as hiveserver2 does with theirs.

Compatibility

Strictly speaking this changes assembly identity, but no published artifact is affected: AdbcDrivers.BigQuery is not on nuget.org yet, so nothing binds to the unsigned identity today. The token also necessarily differs from Apache's 204f54e5a45c07df, but the rename from Apache.Arrow.Adbc.Drivers.BigQuery had already broken that binding. Doing this before the first publish costs nothing; after it, it would be a genuine break.

Verification

  • Build clean across netstandard2.0 / net8.0 / net472, 0 warnings — notably no CS8002, confirming every package dependency is itself strong-named.
  • Unit test subset passes: 124 (net8.0) / 111 (net472).
  • All three output assemblies confirmed to carry token f1f2cdc791f08e13.
  • The DynamicProxy grant was verified in both directions with a temporary probe mocking the internal ITokenProtectedResource: the mock works with the grant and fails without it on both TFMs, with Moq's error naming the exact public key used here.

🤖 Generated with Claude Code

CurtHagenlocher and others added 2 commits July 28, 2026 20:11
…-adbc

Directory.Build.props has carried <SignAssembly>true</SignAssembly> since the
initial "chore: get it building" commit, but the accompanying
<AssemblyOriginatorKeyFile> line and the key itself never came across from
apache/arrow-adbc. SignAssembly alone is a no-op: MSBuild passes no /keyfile
to the compiler, no warning is emitted, and the driver has been shipping
unsigned. The published Apache.Arrow.Adbc.Drivers.BigQuery 0.23.0 carries
public key token 204f54e5a45c07df, so this was a regression, not a decision.

Use AdbcDrivers.snk, the same key adbc-drivers/hiveserver2 signs with, giving
AdbcDrivers.BigQuery public key token f1f2cdc791f08e13. That token necessarily
differs from the Apache one, but the assembly rename from
Apache.Arrow.Adbc.Drivers.BigQuery had already broken that identity, and
AdbcDrivers.BigQuery is not yet on nuget.org, so nothing binds to the unsigned
identity today.

Signing forces the InternalsVisibleTo for AdbcDrivers.BigQuery.Tests to name a
public key (CS1726); a bare assembly name only compiled because the output was
unsigned. Both apache/arrow-adbc and hiveserver2 spell theirs out the same way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Moq generates its proxies into DynamicProxyGenAssembly2, which cannot subclass
an internal type from a strong-named assembly without an explicit grant. No
current test hits this - the types the suite mocks are public - but the failure
mode is a runtime ArgumentException at Setup() rather than a compile error, so
granting it now avoids an opaque failure the first time someone mocks an
internal type. hiveserver2 carries the same grant.

Verified by temporarily mocking the internal ITokenProtectedResource: the mock
works with the grant and fails without it on both net8.0 and net472.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread csharp/Directory.Build.props
@CurtHagenlocher
CurtHagenlocher merged commit 2e46aa0 into adbc-drivers:main Jul 29, 2026
4 of 5 checks passed
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.

3 participants