SIGSEGV In System.MonoEnumInfo.get_enum_info - c#

I'm trying to run a C# app in Mono on Linux. I'm using EF6, it has some types that are mapped to enums. The first time my app queries the DB (VistaDB) I get the following stack trace (its actually much larger...)
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.MonoEnumInfo.get_enum_info (System.Type,System.MonoEnumInfo&) <IL 0x0000e, 0xffffffff>
at System.MonoEnumInfo.GetInfo (System.Type,System.MonoEnumInfo&) [0x00076] in /build/buildd/mono-3.2.8+dfsg/mcs/class/corlib/System/Enum.cs:176
at System.Enum.GetNames (System.Type) [0x0002d] in /build/buildd/mono-3.2.8+dfsg/mcs/class/corlib/System/Enum.cs:334
at System.Data.Entity.Core.Metadata.Edm.EnumType..ctor (System.Type) <IL 0x00056, 0x001eb>
at System.Data.Entity.Core.Metadata.Edm.ClrEnumType..ctor (System.Type,string,string) <IL 0x00002, 0x00027>
at System.Data.Entity.Core.Metadata.Edm.OSpaceTypeFactory.TryCreateEnumType (System.Type,System.Data.Entity.Core.Metadata.Edm.EnumType,System.Data.Entity.Core.Metadata.Edm.EdmType&) <IL 0x00027, 0x0009f>
at System.Data.Entity.Core.Metadata.Edm.OSpaceTypeFactory.TryCreateType (System.Type,System.Data.Entity.Core.Metadata.Edm.EdmType) <IL 0x0003b, 0x000eb>
at System.Data.Entity.Core.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly () <IL 0x0006c, 0x0010c>
at System.Data.Entity.Core.Metadata.Edm.ObjectItemAssemblyLoader.Load () <IL 0x00007, 0x0001f>
at System.Data.Entity.Core.Metadata.Edm.ObjectItemAssemblyLoader.LoadAssemblies (System.Collections.Generic.IEnumerable`1<System.Reflection.Assembly>,System.Data.Entity.Core.Metadata.Edm.ObjectItemLoadingSessionData) <IL 0x00019, 0x00072>
at System.Data.Entity.Core.Metadata.Edm.ObjectItemAssemblyLoader.LoadClosureAssemblies () <IL 0x00011, 0x00023>
at System.Data.Entity.Core.Metadata.Edm.ObjectItemAssemblyLoader.Load () <IL 0x00013, 0x00031>
...
Native stacktrace:
mono() [0x4b73d8]
mono() [0x50f13b]
mono() [0x423d22]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7fd7577c0340]
mono(mono_class_from_mono_type+0x6) [0x525736]
mono() [0x5428a4]
[0x41d0d6f3]
...
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Based on this I suspect there is a problem with Mono. I'm running Ubuntu 14 with Mono 3.2.8 (installed using apt-get). Has anyone else run into this? If I remove the enum mappings from EF will that fix the problem?
Update
I tried running the same on my macbook running Mono 3.4, and I got the same error. So I suspect it's a bug with Mono.

I upgraded to mono 3.6.1 and EF seems to be working well! Looks like mono 3.2.8 does not work with EF 6 and vista db

Related

postsharp is failing to work on .net core

I am trying to use postsharp on .net core 2.
I have added Postsharp 5.1.19 (preview) however, I am getting the following error when I try to build the project.
/Users/me/.nuget/packages/postsharp/5.1.9-preview/build/PostSharp.targets(5,5): Error MSB4060: The "PostSharp30" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. (MSB4060) `
Here is a detailed explanation which is essentially not aware that I am on MAC and still looking for (kernel32) and some dlls:
/Users/me/.nuget/packages/postsharp/5.1.9-preview/build/PostSharp.targets(5,5): Error MSB4061: The "PostSharp30" task could not be instantiated from "/Users/me/.nuget/packages/postsharp/5.1.9-preview/build/PostSharp.MSBuild.v5.1.9.Release.dll".
System.TypeInitializationException: The type initializer for 'PostSharp.Compiler.Client.BuildClient' threw an exception. ---> System.DllNotFoundException: kernel32
at (wrapper managed-to-native) PostSharp.Compiler.Client.ProcessUtilities.GetCurrentProcess()
at PostSharp.Compiler.Client.ProcessUtilities.GetParentProcesses () [0x00006] in <7cce0190f299453c822c4cfb425f86da>:0
at PostSharp.Compiler.Client.ProcessUtilities.DetectUnattendedProcess (System.String& log) [0x0002f] in <7cce0190f299453c822c4cfb425f86da>:0
at PostSharp.Compiler.Client.BuildClient..cctor () [0x00016] in <7cce0190f299453c822c4cfb425f86da>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at PostSharp.MSBuild.PostSharp30..ctor () [0x00018] in <7cce0190f299453c822c4cfb425f86da>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 (MSB4061)`
How can I get this working?
As you can read in the announcement:
PostSharp 5.1 will still only support Windows as the only build
platform.
So even though .NET Core projects are supported, you can build with PostSharp only on Windows, and as you said - you are on MAC.

[Linux | Cscore]avutil-55 DllNotFoundException

I am trying to run my application which uses cscore (https://github.com/filoe/cscore) and its sub namespace "CSCore.Ffmpeg"
I've already tried what the author explained in "https://github.com/filoe/cscore/blob/master/CSCore.Ffmpeg/Readme.md" ('LD_LIBRARY_PATH=./ mono MyApp.exe') without success.
My question would be how to get it working on Debian 9 using mono.
Additionally i would be grateful if anyone could tell me where i could get the required libraries for my operating system.
This is the stacktrace:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'CSCore.Ffmpeg.FfmpegCalls' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CSCore.Ffmpeg.FfmpegUtils' threw an exception. ---> System.DllNotFoundException: avutil-55
at (wrapper managed-to-native) CSCore.Ffmpeg.Interops.ffmpeg:av_log_set_callback (intptr)
at CSCore.Ffmpeg.FfmpegCalls.SetLogCallback (CSCore.Ffmpeg.FfmpegCalls+LogCallback callback) [0x00006] in <117ca019c81b40cf9cc0852c6d0ddec3>:0
at CSCore.Ffmpeg.FfmpegUtils..cctor () [0x00025] in <117ca019c81b40cf9cc0852c6d0ddec3>:0
--- End of inner exception stack trace ---
at CSCore.Ffmpeg.Interops.InteropHelper.RegisterLibrariesSearchPath (System.String path) [0x00012] in <117ca019c81b40cf9cc0852c6d0ddec3>:0
at CSCore.Ffmpeg.FfmpegCalls..cctor () [0x0008f] in <117ca019c81b40cf9cc0852c6d0ddec3>:0
--- End of inner exception stack trace ---
at CSCore.Ffmpeg.AvFormatContext..ctor (System.String url) [0x00006] in <117ca019c81b40cf9cc0852c6d0ddec3>:0
at CSCore.Ffmpeg.FfmpegDecoder..ctor (System.String url) [0x00029] in <117ca019c81b40cf9cc0852c6d0ddec3>:0
at AudioTool.AudioClient.AudioStart (System.String url) [0x00001] in <57d1cee9c20047c6a0c5acfeeccbf254>:0
at AudioTool.Program.Main (System.String[] args) [0x00038] in <57d1cee9c20047c6a0c5acfeeccbf254>:0
Thanks in advance
Ok. Solved issue by installing the appropriate linux packages and copying the libraries from '/usr/lib/x86_64-linux-gnu/' into the folder where the application is.
After that i had to look what mono expects by setting the mono loglevel to debug (LD_LIBRARY_PATH=./ MONO_LOG_LEVEL=debug mono MyApp.exe)
An error appeared (something like Mono: DllImport error loading library '/root/bot/Debug/libavutil-55.so': '/root/bot/Debug/libavutil-55.so: cannot open shared object file: No such file or directory'.
)
Then i renamed the existing libavutil.so.55 to libavutil-55.so,I repeated that for every missing include and mono accepted that.
I hope that helps everyone who has a similar problem in future.

Repetive calling of C DLL in C# (using DLLimport)

Using Mono (JIT compiler version 3.2.8) in Ubuntu 64bit, I am calling a C DLL within a C# source code using something like this:
[DllImport("/home/user/path/to/my.dll")]
private static extern void mydll(int argument1, int argument2, ref int arguemnt3,
[MarshalAs(UnmanagedType.LPArray)] double[] argument4,
[MarshalAs(UnmanagedType.LPArray)] int[] argument5,
string argument6)
This worked flawless on an older Ubuntu 32bit machine. Now, on my new 64bit machine I run into the following strange behavior.
The first time I call the DLL in the C# source code it (apparently) works fine. The DLL returns arguments as expected and no error is raised. However, any further attempt to call the same DLL in the further code fails with following errors:
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) object.__icall_wrapper_mono_array_to_lparray (object) <0xffffffff>
at (wrapper managed-to-native) mydll(int,int,int,int,int,int,int,double[],double[],double[],double[],double[],int&,int&,double[],double[],int,int[],int,double[],int,string,int,int,int,int) <0xffffffff>
at mydll (System.Collections.Generic.Dictionary`2<string, int>,double[],double[],double[],System.Collections.Generic.Dictionary`2<string, int>,System.Collections.Generic.Dictionary`2<string, double>,string) <0x0094b>
at Example.Main () <0x00457>
at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
mono() [0x4b73d8]
mono() [0x50f13b]
mono() [0x423d22]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f2898a2c340]
mono() [0x550136]
[0x4139cd9d]
Debug info from gdb:
Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
I am very new to C# and quite clueless why that happens.
Maybe anyone could enlighten me?
Thanks a lot!

Xamarin Android: Calling Native Library Methods of SO file Crashing with SIGSEGV

I am working on Android with Xamarin Studio
I have added the SO file into libs and followed the steps described in the Xamarin docs.
My application is able to build and running device But during calling a native method from SO file shared library I am getting the fallowing exception
Stacktrace:
[mono-rt]
[mono-rt] at <unknown> <0xffffffff>
[mono-rt] at (wrapper managed-to-native)_init (string,int) <IL 0x00038, 0xffffffff>
[mono-rt] at (wrapper dynamic-method) object.cbf4c5d8-8ed7-41b7-954a-1802bf0daaf0 (intptr,intptr,int,intptr) <IL 0x0001d, 0x00053>[mono-rt] at (wrapper native-to-managed) object.cbf4c5d8-8ed7-41b7-954a-1802bf0daaf0 (intptr,intptr,int,intptr) <IL 0x00026, 0xffffffff>
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries
[mono-rt] used by your application.
[libc] Fatal signal 11 (SIGSEGV) at 0x766566d3 (code=1)
I would like to know why the above crash coming how to resolve it?

Executing .Net Application using Mono on CentOS or Linux

I have develop a Test Application using WinForm in C# .Net on Visual Studio 2010. Now, I want to run this under Linux using Mono on CentOS. So I tried below command sequence -
[root#localhost TestLinux]# /usr/bin/mono ./Test.exe
I hit an exception
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: gdiplus.dll
at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] --- End of inner exception stack trace ---
at <0x00000> <unknown method>
at System.Drawing.Graphics.FromHdcInternal (IntPtr hdc) [0x00000]
at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) [0x00000]
at System.Windows.Forms.XplatUIX11..ctor () [0x00000]
at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000]
at System.Windows.Forms.XplatUI..cctor () [0x00000] --- End of inner exception stack trace ---
at <0x00000> <unknown method>
at System.Windows.Forms.Application.EnableVisualStyles () [0x00000]
at Test.Program.Main () [0x00000]
While doing some research I found that this is due to linking between gdiplus.dll and its counter part libgdiplus.so.0 on linux, need to put its entry in ldconfig cache.
[root#localhost TestLinux]# ldconfig -p | grep libgdiplus
libgdiplus.so.0 (libc6) => /usr/lib/libgdiplus.so.0
The output clearly shows that libgdiplus.so.0 is there in ldconfig cache but still the program is not working. I also tried to add DllMap entry in application configuration as below
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
<dllmap dll="gdiplus.dll" target="libgdiplus.so.0"/>
</configuration>
Please let me know if anybody stumbled upon this in past.
You have traced the error wrong.
Your mono version does not support EnableVisualStyles.
Upgrade to a version, which supports it ( as far as i remember it is >= 2.9 ) or try to disable this feature in Your .net application, which will result in "not so nice ui elements".
For me it worked, as i was working on gentoo.
Suddenly, after a emerge, my mono application did not crash anymore.
Also be sure that libgdiplus.so.0 is actually installed and on the path, it is not by default in mono. But yes, the main thing is CentOS comes with an outdated version of mono by default.

Categories

Resources