question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

clr.AddReference crashes mono in Linux environment

See original GitHub issue

Environment

  • Pythonnet version: 2.5.1
  • Python version: Python 3.6.12 :: Anaconda, Inc.
  • Operating System: Linux (Ubuntu 18.04.5 LTS bionic)
  • mono version : Mono JIT compiler version 6.12.0.90

Details

  • I am trying to add reference of .Net standard library(Linux compatible) from the python code. import clr clr.AddReference(“xxxx.xx”)

The code throws the below exception and mono crashes after that

*** Assertion at assembly.c:1939, condition `is_ok (hook_error)' not met, function:mono_assembly_invoke_load_hook_internal, (null) assembly:/usr/lib/mono/4.5/mscorlib.dll type:ReflectionTypeLoadException member:(null)**


=================================================================
        Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
        Native stacktrace:
=================================================================
        0x7fec3a9382a9 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a938629 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a8c2c94 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a937842 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec59a97980 - /lib/x86_64-linux-gnu/libpthread.so.0 :
        0x7fec596d2fb7 - /lib/x86_64-linux-gnu/libc.so.6 : gsignal
        0x7fec596d4921 - /lib/x86_64-linux-gnu/libc.so.6 : abort
        0x7fec3ab1d3a7 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3ab02573 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3ab1d328 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3ab1d8e3 - /usr/lib/libmonosgen-2.0.so.1 : monoeg_assertion_message
        0x7fec3a9a1b98 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a9a28e7 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a9a4c13 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a9a43e1 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a9a6351 - /usr/lib/libmonosgen-2.0.so.1 : mono_assembly_load_reference
        0x7fec3a9ae3fb - /usr/lib/libmonosgen-2.0.so.1 : mono_class_from_typeref_checked
        0x7fec3aa0430c - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3aa045f2 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3aa9364f - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3aa942e8 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3aa949e8 - /usr/lib/libmonosgen-2.0.so.1 :
        0x7fec3a9e8dfe - /usr/lib/libmonosgen-2.0.so.1 :
        0x41cb3773 - Unknown
import clr
clr.AddReference("LiveAI.SDK")
  • If there was a crash, please include the traceback here.
    print('TODO')

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MysterTechcommented, Jan 20, 2021

Thanks @vnavkal for decrypting this for me. I got the same error while building the QuantConnect lean indicators into my python project.

1reaction
vnavkalcommented, Jan 14, 2021

@filmor I believe I’ve managed to reproduce this error as well. I posted a dockerfile in https://github.com/vnavkal/pythonnet-ex that compiles similar code to what @samuthrakumar posted and then attempts to import it via pythonnet. And when I run the image, I see a similar cryptic crash log.

It’s not clear to me whether the issue is with pythonnet or with mono. I’m happy to try further debugging steps to pin down the source of the issue further, just let me know.

Thanks in advance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I call .dll from my python code in linux via mono?
From the Python.Net Issue Tracker: from clr_loader import get_coreclr from pythonnet import set_runtime rt ...
Read more >
Mono crashes when calling .NET dll from python3.6 linux ...
I have a docker container with a debian python3.6 base image, on which I'm trying to install mono in order to call a...
Read more >
No module named 'clr' error - Support
Hello, I use a module and I get the following error when they try to import clr: “No module named 'clr' error” I...
Read more >
Running DWSIM in Docker
I'm trying to build a Linux Docker container so as to be able to automate runs for parametric ... AddReference(dwsimpath+'TcpComm.dll') clr.
Read more >
Mono is crashing after the process starts
I have a .net application running on mono 4.0.2 in ubuntu 14.04. Mono sometimes crashes after the application starts. I see this error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found