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?
Related
I have a native Xamarin.Android app I've built a few years back and I've been maintaining it since then. Lately, I tried to build a new release but the app keeps crashing. I did tens of releases in the past using the same project and compilation settings. Here's an exemple of a stack trace I get in release:
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies.
[mono-rt] at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction10-21 13:24:49.970 F/mono-rt (15785): File name: 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
[mono-rt] at Java.Interop.JniEnvironmentInfo..ctor () [0x00006] in :0
[mono-rt] at Java.Interop.JniEnvironment+c.b__35_0 () [0x00000] in :0
[mono-rt] at System.Threading.ThreadLocal`1[T].GetValueSlow () [0x00031] in :0
[mono-rt] at System.Threading.ThreadLocal`1[T].get_Value () [0x0003e] in :0
[mono-rt] at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in :0ds.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0002d] in :0
[mono-rt] at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in :0
[mono-rt] at Java.Interop.JniEnvironment+StaticMet10-21 13:24:49.970 F/mono-rt (15785): at Android.OS.Looper.get_MainLooper () [0x0000a] in :0
[mono-rt] at Android.Runtime.AndroidEnvironment.GetDefaultSyncContext () [0x00000] in :0
[mono-rt] at System.AndroidPlatform.GetDefaultSyncContext () [0x00000] in :0
[mono-rt] at System.Threading.SynchronizationContext.GetThreadLocalContext () [0x00005] in :0
[mono-rt] at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.Run (System.Threading.Tasks.Task ignored, System.Boolean canInlineContinuationTask) [0x00003] in :0
[mono-rt] at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in :0
[mono-rt] at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x0004f] in :0
[mono-rt] at System.Threading.Tasks.TaskFactory`1+c__DisplayClass38_0`1[TResult,TArg1].b__0 (System.IAsyncResult iar) [0x00008] in :0
[mono-rt] at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in 10-21 13:24:49.970 F/mono-rt (15785): at (wrapper managed-to-native) System.Runtime.Remoting.Messaging.AsyncResult.Invoke(System.Runtime.Remoting.Messaging.AsyncResult)
[mono-rt] at System.Runtime.Remoting.Messaging.AsyncResult.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in :0
[mono-rt] at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in :0
From the stack trace, I have a feeling it might be a problem with the linker, but I have tried all 3 settings (Don't link, link SDK assemblies only, link all). When changing some code here and there, I have sometimes slightly different stack traces, but nothing really helpful. Here's the compilation settings I'm using:
From time to time, the app will launch successfully without changing anytime special. It will only work once.
What I'm I missing?
I am pretty sure that you have some weird behavior in release. Since you use mono on android you may call an await function somewhere that return a Task<T> you must not use the await but .GetAwaiter().Result.
https://github.com/xamarin/xamarin-android/issues/6409
Make sure your .NET framework is patched. Microsoft released patches to .NET to allow Portable Class Libraries to properly find the appropriate runtime (KB2468871). If you are seeing the above exception (or something like it), it means you’re missing the latest .NET framework patches.
You can read more about Portable Class Libraries on MSDN.
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.
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.
I want to build my application on Asus_Z008D but I have this problem:
[Mono] Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
[mono-rt] Stacktrace:
[mono-rt]
[mono-rt]
[mono-rt] Attempting native Android stacktrace:
[mono-rt]
[mono-rt] at ???+0 [0xe20ab667]
[mono-rt] at mono_class_get_field_from_name+31 [0xe20ab73f]
[mono-rt] at ???+31 [0xf2f7e9a2]
[mono-rt] at ???+31 [0xf2f7ebe3]
[mono-rt] at Java_mono_android_Runtime_init+2127 [0xf2f812b0]
[mono-rt] at ???+2127 [0xe29dcde2]
[mono-rt]
[mono-rt] =================================================================
[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.
[mono-rt] =================================================================
[mono-rt]
[libc] Fatal signal 11 (SIGSEGV), code 1, fault addr 0x18 in tid 5091 (ru.roadaccident)
Application crashed on LaunchScreen, breakpoints in main activity and LaunchScreen not worked. On other devices app work so well; I using Xamarin.Forms in Xamarin Studio; Please, help me;
Are you building your APK to support the x86 and x86_64 architectures? The Asus_Z008D uses Intel Atom CPU, not ARM. See:
http://specdevice.com/showspec.php?id=6a09-4fd1-ffff-ffff924a117c
So if you are only building for ARM architectures, or using any libraries that are only built for ARM, the app won't work on an x86/x86_64 device.
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