diff --git a/clr_loader/hostfxr.py b/clr_loader/hostfxr.py index e32423c..3932082 100644 --- a/clr_loader/hostfxr.py +++ b/clr_loader/hostfxr.py @@ -127,7 +127,7 @@ def _get_callable(self, assembly_path: StrOrPath, typename: str, function: str): return ffi.cast("component_entry_point_fn", delegate_ptr[0]) def shutdown(self) -> None: - if self._handle is not None: + if self._handle and self._dll: self._dll.hostfxr_close(self._handle) self._handle = None