I'm using nunit-console for unit testing a Mono application on Debian. It runs all the tests and then crashes after reporting the failed tests. TestResult.xml is not generated. If I use nunit-console with either -out or -err argument, it runs the tests and then crashes before reporting the results.
Another weird thing is that if I cut down the number of tests (from about 800 to 100) it sometimes wont crash. Throwing out even more testcases seems to decrease the chance of crashing.
Platform: Debian 6, Mono 2.6.7, NUnit 2.4.7
Error details:
ERROR:../../mono/io-layer/handles-private.h:362:_wapi_handle_share_release: assertion failed: (info->handle_refs > 0)
Stacktrace:
at (wrapper managed-to-native) System.IO.MonoIO.Close (intptr,System.IO.MonoIOError&) <0x00050>
at (wrapper managed-to-native) System.IO.MonoIO.Close (intptr,System.IO.MonoIOError&) <0x00050>
at System.IO.FileStream.Dispose (bool) <0x000b7>
at System.IO.Stream.Close () <0x0001b>
at System.IO.StreamWriter.Dispose (bool) <0x000c8>
at System.IO.StreamWriter.Close () <0x0001b>
at NUnit.ConsoleRunner.ConsoleUi.Execute (NUnit.ConsoleRunner.ConsoleOptions) <0x007ed>
at NUnit.ConsoleRunner.Runner.Main (string[]) <0x00487>
at NUnit.ConsoleRunner.Class1.Main (string[]) <0x0000f>
at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0x00054>
Native stacktrace:
/usr/bin/cli() [0x487ad6]
/lib/libpthread.so.0(+0xeff0) [0x7fdd0379aff0]
/lib/libc.so.6(gsignal+0x35) [0x7fdd031da1b5]
/lib/libc.so.6(abort+0x180) [0x7fdd031dcfc0]
/lib/libglib-2.0.so.0(g_assertion_message+0x131) [0x7fdd03e175d1]
/lib/libglib-2.0.so.0(g_test_timer_start+0) [0x7fdd03e17b50]
/usr/bin/cli() [0x59d649]
/usr/bin/cli() [0x597658]
/usr/bin/cli() [0x597774]
/usr/bin/cli() [0x5095fc]
[0x4135b410]
Debug info from gdb:
=================================================================
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.
=================================================================
** (/usr/lib/nunit/nunit-console.exe:7436): WARNING **: process_set_termination_details: error looking up process handle 0x403
Try running NUnit with /noshadow, I recall this used to help, long time ago.
This is an old bug https://bugzilla.novell.com/show_bug.cgi?id=318809. I've not been able to find an up-to-date xamarin bug of this.
See also, https://stackoverflow.com/questions/4513928/handling-single-file-with-multiple-threads-in-mono.
So try running nunit with /nothread or better still, try mono 2.10.8.
Related
I tried running an mpi program written in C# on OSX, however, I keep getting the permission denied error.
The steps I took to install mpi:
installed homebrew
using homebrew installed mpich
installed mono (so I can get a .exe file)
created a project in Rider, specified target frameworks to be net50 (latest .net core) and net48 (assume provided by mono)
installed mpi.net nuget package
went into the Debug directory of net48 containing ConsoleApp1.exe
ran the command mpirun -np 4 ./ConsoleApp1.exe with and without sudo
However, I get the following error:
[proxy:0:0#Marins-MacBook-Pro.local] HYDU_create_process (utils/launch/launch.c:74): execvp error on file ./ConsoleApp1.exe (Permission denied)
The error is repeated once for each process.
Using finder I selected the exe file and parent folder in question and gave everyone permissions to read and write (read permissions are granted by default). However, the problem still persists.
What can I try to solve this issue?
EDIT:
I also tried with the following command:
mpiexec -n 4 mono ConsoleApp1.exe
However, I get the error:
Unhandled Exception:
System.DllNotFoundException: msmpi.dll assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) MPI.Unsafe.MPI_Finalized(int&)
at MPI.Environment.get_Finalized () [0x00000] in <fa7716c2d3a447518b7b229d8fa8506f>:0
at MPI.Environment..ctor (System.String[]& args, MPI.Threading threading) [0x00006] in <fa7716c2d3a447518b7b229d8fa8506f>:0
at MPI.Environment..ctor (System.String[]& args) [0x00000] in <fa7716c2d3a447518b7b229d8fa8506f>:0
at ConsoleApp1.Program.Main (System.String[] args) [0x00001] in <4afb3f1ea5bc4367a9a7afd6da6576a3>:0
I'm not sure whether this is the correct way to use mpi on OS X.
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!
Note: This is not a duplicate of the linked question because I'm not looking to develop a Mac application.
So I have a C# application on .NET 4.5 that has the following:
1) Windows Forms
2) References to System.Drawing, EmguCV, Aforge.NET dlls
This works perfectly on my Windows system.
When I try to run the program on a Mac system running OSX using Mono, I get the following error:
exception inside UnhandledException handler: An exception was thrown by the type initializer for System.Windows.Forms.Form
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.Form ---> System.InvalidProgramException: Invalid IL code in System.Drawing.Icon:.ctor (System.IO.Stream): method body is empty.
at (wrapper remoting-invoke-with-check) System.Drawing.Icon:.ctor (System.IO.Stream)
at System.Windows.Forms.ResourceImageLoader.GetIcon (System.String name) [0x00000] in :0
at System.Windows.Forms.Form..cctor () [0x00000] in :0
Has anyone faced anything like this? Appreciate any suggestions.
I'm working on an iOS static library binding that requires CFNetwork framework.
I've seen examples of how to DllImport the CFNetwork, but it requires that the method is extern static.
Unfortunately this appears to be invalid on the methods in the linkwith.cs
The library seems to actually work and starts a curl command, but I get an error:
-[MKNetworkOperation operationFailedWithError:] [Line 1293] State: 0
I'm assuming this is because I haven't imported CFNetwork since the library works with a regular XCode iOS project.
Also, every time I run the project in the simulator it asks if I want to allow network connections.
This doesn't occur in a normal XCode project using the library either.
Here are all the relevant files:
ApiDefinition.cs http://pastebin.com/p3S0H28X
withlink.cs http://pastebin.com/UR0X2pZ1
Build output http://pastebin.com/aTbdW2Gj
App output http://pastebin.com/Hxcuufgj
I appreciate any help you folks can provide.
Thanks!
[EDIT - 2015-08-26]
So I found this:
https://developer.xamarin.com/guides/ios/advanced_topics/native_interop/
Which unfortunately just seems to have lead me down a rabbit hole.
In our test app I put in the extra build arguments as stated in the article:
To Configure Xamarin.iOS To Link the Library, on the project options for your final executable (not the library itself, but the final program) you need to add in iOS Build's Extra argument (these are part of your project options) the "-gcc_flags" option followed by a quoted string that contains all the extra libraries that are required for your program, for example:
-gcc_flags "-L${ProjectDir} -lMylibrary -force_load ${ProjectDir}/libMyLibrary.a"
The above example will link libMyLibrary.a
You can use the -gcc_flags to specify any set of command line
arguments to pass to the GCC compiler used to do the final link of
your executable. For example, this command line, also references the
CFNetwork framework:
-gcc_flags "-L${ProjectDir} -lMylibrary -lSystemLibrary -framework CFNetwork -force_load ${ProjectDir}/libMyLibrary.a"
I replaced -lMylibrary and libMyLibrary.a with the correct names and then I got a ton of errors stating I had duplicate entries. I imagine because I am already referencing the binding DLL. Also -lSystemLibrary was throwing errors so I removed it.
Finally I tried this:
-gcc_flags "-L${ProjectDir} -framework CFNetwork"
And it builds without error, but I still get
-[MKNetworkOperation operationFailedWithError:] [Line 1288]
The app's build output can be found here:
http://pastebin.com/sLNUwYwX
Still hoping someone can help!
[EDIT 2015-09-03]
I still get the MKNetworkOperation error when running in the simulators. Now that I have my iPad back I've tried to test it on that. The app crashes completely when run on the iPad with the following output:
Foundation.MonoTouchException: Objective-C exception thrown. Name:
NSInvalidArgumentException Reason: -[ApiEngine randomStringOfLength:]:
unrecognized selector sent to instance 0x1742a3900 at
ObjCRuntime.Runtime.ThrowNSException (IntPtr ns_exception) [0x00000]
in
/Users/builder/data/lanes/1977/2c66d2fe/source/maccore/src/ObjCRuntime/Runtime.cs:167
at ObjCRuntime.Runtime.throw_ns_exception (IntPtr exc) [0x00000] in
:0 at at (wrapper native-to-managed)
ObjCRuntime.Runtime:throw_ns_exception (intptr) at at (wrapper
managed-to-native) ApiDefinition.Messaging:void_objc_msgSend
(intptr,intptr) at shared2you.Shared2YouAdManager.StartDetection ()
[0x0001b] in :0 at
s2u_xamarin_uni.AppDelegate.FinishedLaunching (UIKit.UIApplication
application, Foundation.NSDictionary launchOptions) [0x00021] in
/Users/manns41078/Desktop/Xamarin
Projects/s2u_xamarin_uni/s2u_xamarin_uni/AppDelegate.cs:50 at at
(wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain
(int,string[],intptr,intptr) at UIKit.UIApplication.Main
(System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in
/Users/builder/data/lanes/1977/2c66d2fe/source/maccore/src/UIKit/UIApplication.cs:63
at UIKit.UIApplication.Main (System.String[] args, System.String
principalClassName, System.String delegateClassName) [0x0001c] in
/Users/builder/data/lanes/1977/2c66d2fe/source/maccore/src/UIKit/UIApplication.cs:46
at s2u_xamarin_uni.Application.Main (System.String[] args) [0x00008]
in /Users/manns41078/Desktop/Xamarin
Projects/s2u_xamarin_uni/s2u_xamarin_uni/Main.cs:12
The library IS a FAT library and works in XCode no problem. Why is Xamarin giving me such heartache for a binding?? The java version was a cake walk.
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.