IronPython + Mono error - could not load signature - mono

When trying to run IronPython from Mono, I get the following error:
wayne#arglefraster ~/Downloads/IronPython-2.7.3 ⚘ mono ipy.exe 19:19:23
Could not load signature of IronPython.Runtime.List:get_Item due to:
Failed to load language 'IronPython 2.7': Could not load type 'IronPython.Runtime.List' from assembly 'IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1'.
Fiddling around here on SO I found MONO_LOG_LEVEL=debug, and got this relevant information
Mono: Assembly Loader probing location: '/usr/lib/System.Numerics.exe'.
Mono: The following assembly referenced from /home/wayne/Downloads/IronPython-2.7.3/IronPython.dll could not be loaded:
Assembly: System.Numerics (assemblyref_index=5)
Version: 4.0.0.0
Public Key: b77a5c561934e089
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/home/wayne/Downloads/IronPython-2.7.3/).
Mono: Failed to load assembly IronPython[0xddd180]
Mono: Could not load file or assembly 'System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Could not load signature of IronPython.Runtime.List:get_Item due to:
Mono: gc took 520 usecs
Mono: Unloading domain ipy.exe[0x7faebd540cc0], assembly IronPython[0xddd180], ref_count=2
How can I get this working?

It turns out that the Numerics library wasn't installed:
wayne#arglefraster ~/Downloads/IronPython-2.7.3 ⚘ apt-cache search mono numerics
libmono-system-numerics4.0-cil - Mono System.Numerics library (for CLI 4.0)
wayne#arglefraster ~/Downloads/IronPython-2.7.3 ⚘ sudo apt-get install libmono-system-numerics4.0-cil
And off it went!

Related

Mono MSBuild error after installing reference assemblies Ubuntu 18.04

I would like to build a .net framework 4.7.2 project in Mono on Ubuntu 18.04
I installed mono-devel according to this guide:
https://www.mono-project.com/download/stable/
After installing and trying to run msbuild on one of my projects, I get this error:
/usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1195,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
I found a reference assemblies package which I installed:
mono-reference-assemblies-4.0
After installing the package and running the build again, I am getting the following error:
MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.Build.Shared.BuildEnvironmentHelper.get_Instance () [0x00017] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.Utilities.Traits.get_Instance () [0x00000] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) [0x000bb] in <0fd2831d9cb34830af9027441f77a417>:0
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.Build.Shared.BuildEnvironmentHelper.get_Instance () [0x00017] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.Utilities.Traits.get_Instance () [0x00000] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) [0x003f2] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.CommandLine.MSBuildApp.Main () [0x00028] in <0fd2831d9cb34830af9027441f77a417>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.Build.Shared.BuildEnvironmentHelper.get_Instance () [0x00017] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.Utilities.Traits.get_Instance () [0x00000] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.CommandLine.MSBuildApp.Execute (System.String commandLine) [0x003f2] in <0fd2831d9cb34830af9027441f77a417>:0
at Microsoft.Build.CommandLine.MSBuildApp.Main () [0x00028] in <0fd2831d9cb34830af9027441f77a417>:0
This error occurs wherever I run msbuild from. It seems like it should be possible to build my project.
Any help would be greatly appreciated.
mono-reference-assemblies-4.0 package doesn't come from the stable channel of the new apt source that you added to install your new version of Mono, so you're mixing versions of Mono at runtime, which is causing those weird exceptions.
The solution is to uninstall this package and switch to unstable channel (because .NET 4.7.2 is too new for the stable one).

Mono cannot find dll that seems to exist

I have just upgraded my 64-bit ubuntu 14.04.2 LTS to the latest mono. I followed the instructions on this page a few months ago, and before today had been using mono 3 without issue. Today I upgraded, which moved me to mono 4.0.1:
$ mono --version
Mono JIT compiler version 4.0.1 (tarball Tue Apr 28 11:47:58 UTC 2015)
I have successfully compiled this program using monodevelop, but the exact same issue manifests with a VS2013-compiled binary [newlines exactly as they appear in the output]:
$ file RTAM_Basic_Pre.exe
RTAM_Basic_Pre.exe: PE32 executable (console) Intel 80386 Mono/.Net Assembly, for MS Windows
$ mono RTAM_Basic_Pre.exe
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Thing is, I'm really quite sure that file exists:
$ pwd
/usr/lib/mono/gac/Microsoft.VisualBasic/11.0.0.0__b03f5f7f11d50a3a
$ ls -l
-rw-r--r-- 1 root root 350720 Apr 27 12:00 Microsoft.VisualBasic.dll
$ file Microsoft.VisualBasic.dll
Microsoft.VisualBasic.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows
It's possible that the error is the "... or one of its depedencies", but it's not clear to me how actually diagnose what's happening.
Through tracing a simple VB helloworld program with MONO_LOG_LEVEL=debug MONO_LOG_MASK=asm I found the following:
Mono: The request to load the assembly Microsoft.VisualBasic v11.0.0.0 was remapped to v10.0.0.0
Turns out the v11.0.0.0 version number is actually incorrect, this pull request should fix it: https://github.com/mono/mono-basic/pull/8
The first thing I would try in a situation like this is to see if the system can fix the dependencies itself. The first few steps on the installation guide should have set you up with the needed repositories. In the shell, try executing:
sudo apt-get install -f mono-complete
The '-f' flag should tell the system to make sure the dependencies are there.
I hope this can be of help! Apologies if that doesn't turn out to be the case. 030

Loading a DLL in the GAC

currently I have a problem with getting a DLL into the Windows GAC. I tried to follow the steps of creating a DLL and loading it as described in this blog post:
http://blogs.technet.com/b/cloudpfe/archive/2014/02/01/how-to-create-a-custom-authentication-provider-for-active-directory-federation-services-3-0-part-2.aspx
At the point where I try calling the following command:
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7514a164b89fa979")
I get an error which tells me that System.EnterpriseServices could not be found:
Exception calling "Load" with "1" argument(s): "Could not load file or
assembly 'System.EnterpriseServices, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=7514a164b89fa979' or one of its dependencies. The
system cannot find the file specified."
The specified DLL (System.EnterpriseServices) does exist* on the machine.
So now my question is, why can't this method find the DLL and what do I have to do/change to get this command to work?
NOTE: I Tried this on a vanilla Windows Server 2012 R2 with just ADFS parts installed; And I've called the command from the Powershell.
*UPDATE: The System.EnterpriseServices DLL resides in
C:\Windows\Microsoft.NET\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a
and
C:\Windows\WinSxS\amd64_system.enterpriseservices_b03f5f7f11d50a3a_4.0.9600.1638‌​4_none_53a3f9b13fac0ba5\
So it should be available from the GAC.
I think your public Key token is incorrect, you found your own answer with your update :) .
It should be
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
Give this a try.

Mono fails to load a dll

I am trying to load use a native shared library via P/Invoke. However, it won't load from under MonoDevelop. This is the console output with MONO_LOG_LEVEL=debug and MONO_LOG_MASK=dll:
Creating a V8Engine instance ...Mono: DllImport attempting to load: 'V8_Net_Proxy'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy': '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy.so': 'libv8-x64.so: cannot open shared object file: No such file or directory'.
However, the libv8-x64.so is located in the same directory as libV8_Net_Proxy.so:
/localhome/rryk/v8netmonolinux/Source/bin/Debug [mono-linux *]$ ls
libV8_Net_Proxy.so V8.Net.Console.exe.config V8.Net.dll.mdb V8.Net.Proxy.Interface.x64.dll V8.Net.SharedTypes.dll.mdb x64
libv8-x64.so V8.Net.Console.exe.mdb V8.Net.Proxy.Interface.dll V8.Net.Proxy.Interface.x64.dll.mdb V8.Net.SharedTypes.XML x86
V8.Net.Console.exe V8.Net.dll V8.Net.Proxy.Interface.dll.mdb V8.Net.SharedTypes.dll V8.Net.XML
Even more interesting is that the same very application loads the library just fine when executed from the console:
/localhome/rryk/v8netmonolinux/Source/bin/Debug [mono-linux *]$ MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll mono V8.Net.Console.exe
Creating a V8Engine instance ...Mono: DllImport attempting to load: 'V8_Net_Proxy'.
Mono: DllImport error loading library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy': '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy: cannot open shared object file: No such file or directory'.
Mono: DllImport loaded library '/localhome/rryk/v8netmonolinux/Source/bin/Debug/libV8_Net_Proxy.so'.
I also checked that the same mono binary is used both on the console and in MonoDevelop. In fact I couldn't check which binary is used by MonoDevelop, but .NET Runtimes section in the settings displays version 3.0.12. I only have one Mono binary in the system which has this version and it is the one used on the command line by default (as it's listed first in whichis):
~$ whereis mono
mono: /usr/bin/mono /etc/mono /usr/lib/mono /usr/bin/X11/mono /usr/local/bin/mono /usr/local/etc/mono /usr/local/lib/mono /usr/share/mono /usr/share/man/man1/mono.1.gz
What can cause the difference? Why doesn't Mono find the libv8-x64.so, which is located in the same directory?
Try:
LD_LIBRARY_PATH=`pwd` mono V8.Net.Console.exe

Problem running latest version of nhibernate

I downloaded latest version of NHibernate “2.1.0.2002”.
It built fine, but when I run my unit tests, I keep getting error :-
System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
It looks like somewhere it looks of old version.
Here is link
https://stackoverflow.com/questions/839112/problem-while-migrating-nhibernate-to-higher-version
This is internal error I am getting:
=== Pre-bind state information ===
LOG: DisplayName = NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
(Fully-specified)
LOG: Appbase = file:///D:/Project Files/CIS3G/Webapp/_Test_DAL/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : CIS3G.DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Project Files\CIS3G\Webapp\_Test_DAL\bin\Debug\_Test_DAL.dll.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///D:/Project Files/CIS3G/Webapp/_Test_DAL/bin/Debug/NHibernate.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Please check if you set the Specific Version-Property on your NHibernate Reference to 'true'? It doesn't seem to be the case on this error but with new NHibernate you need to provide an external ByteCodeProvider like Linfu.dll as well. Please check this also.
I've run into this before.
In my case the problem was that I was using a UnitOfWork implementation for handling Nhibernate sessionFactories.
I've been using this lib for a while so I just copied the compiled dll to a new test project with the new version of NHibernate, so I got the version problem.