Skip to content

Commit fc6b020

Browse files
committed
Fix unbound hostfxr_path in load_hostfxr fallback error report
In case the glob returns empty, `hostfxr_path` would not be set, leading to an exception while building the exception.
1 parent a3d2d40 commit fc6b020

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎clr_loader/ffi/__init__.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ def load_hostfxr(dotnet_root: Path):
3030
except Exception as err: # noqa
3131
error_report.append(f"Path {hostfxr_path} gave the following error:\n{err}")
3232

33+
direct_path = dotnet_root / hostfxr_name
3334
try:
34-
return ffi.dlopen(str(dotnet_root / hostfxr_name))
35+
return ffi.dlopen(str(direct_path))
3536
except Exception as err: # noqa
36-
error_report.append(f"Path {hostfxr_path} gave the following error:\n{err}")
37+
error_report.append(f"Path {direct_path} gave the following error:\n{err}")
3738

3839
raise RuntimeError(
3940
f"Could not find a suitable hostfxr library in {dotnet_root}. The following paths were scanned:\n\n"

0 commit comments

Comments
 (0)