Skip to content

Commit 87bf48c

Browse files
fix: load .NET assemblies when running on .NET 9+
GitHub-hosted runners now ship .NET 8, 9 and 10. clr_loader 0.2.x (used with pythonnet 3.0.x, e.g. on Python 3.9) picks the runtime by string sort, so it selects .NET 9. On .NET 9+, pythonnet 3.0.x's clr.AddReference("<abs path>.dll") parses the path as an assembly name and throws FileNotFoundException before its full-path fallback runs. The error was swallowed, so imports failed with "No module named 'Microsoft.Azure'". Pass the path without the ".dll" suffix so pythonnet probes and loads "<path>.dll" directly, which works on .NET 8, 9 and 10 with pythonnet 3.0.x and 3.1.x. Also pin the e2e matrix to Python 3.13 instead of '3.x', which now resolves to 3.14 and is outside requires-python (<3.14). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d72a73c commit 87bf48c

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
strategy:
8989
matrix:
9090
os: ['ubuntu-latest', 'windows-latest']
91-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.x']
91+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
9292
dotnet-version: ['8.0.x']
9393
dist: [whl, sdist]
9494
uses: ./.github/workflows/e2e.yml

‎src/data_factory_testing_framework/_pythonnet/__init__.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
def load_dotnet_assemblies() -> None:
1111
# Load the .NET assemblies
1212
for dll in (Path(__file__).parent / "bin").glob("**/*.dll"):
13-
dll = os.path.abspath(dll)
13+
# Pass the path without the ".dll" suffix so pythonnet probes and loads "<path>.dll" directly.
14+
# With the suffix, pythonnet 3.0.x on .NET 9+ parses the path as an assembly name and fails to load it.
15+
assembly_path = os.path.splitext(os.path.abspath(dll))[0]
1416
try:
15-
clr.AddReference(dll)
17+
clr.AddReference(assembly_path)
1618
except Exception:
1719
pass
1820

0 commit comments

Comments
 (0)