Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading clr into non-root domain #53

Open
vadimkatsman opened this issue Feb 28, 2023 · 2 comments
Open

Error loading clr into non-root domain #53

vadimkatsman opened this issue Feb 28, 2023 · 2 comments

Comments

@vadimkatsman
Copy link

vadimkatsman commented Feb 28, 2023

Environment

  • Pythonnet version: 3.0.1
  • Python version: 3.10
  • Operating System: Windows Server 2019
  • .NET Runtime: .Net Framework 4.8

Details

  • Describe what you were trying to get done.

In order to configure a specific .Net configuration file, I had to run set_runtime prior of clr load.

import os
from pathlib import Path
config_file = r"...valid path...\sctlib.py.config"
config_path = Path(config_file)
from pythonnet import set_runtime
set_runtime("netfx", domain="sctlib_py", config_file=config_path)
#set_runtime("netfx", domain="sctlib_py")
import clr

The config file is valid as it is borrowed verbatim (with exception of renaming) from the working console application.

"import clr" statement never succeeded:

Same script running with default domain works without an issue (but of course, does not recognize the config file which I need to have to target proper .Net Framework)

  • If there was a crash, please include the traceback here.
Traceback (most recent call last):
  File "D:\_WorkRoot\Tests\Python_ASR\Diarization\_Examples\Enrichment\sctlib.py", line 9, in <module>
    import clr
  File "C:\Program Files\Python310\lib\site-packages\clr.py", line 6, in <module>
    load()
  File "C:\Program Files\Python310\lib\site-packages\pythonnet\__init__.py", line 143, in load
    if func(b"") != 0:
  File "C:\Program Files\Python310\lib\site-packages\clr_loader\types.py", line 64, in __call__
    return self._callable(ffi.cast("void*", buf_arr), len(buf_arr))
RuntimeError: cannot call null pointer pointer from cdata 'int(*)(void *, int)'
@filmor filmor transferred this issue from pythonnet/pythonnet Mar 1, 2023
@filmor
Copy link
Member

filmor commented Mar 1, 2023

I am aware of the issue of loading a separate domain and have not been able to fix it, yet. There is an open PR: #42

Help in debugging and furthering this is appreciated.

@vadimkatsman
Copy link
Author

It explains. I will make few comments if you don't mind to #42.

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

No branches or pull requests

2 participants