Error when trying to run steambot on vps debian System.MissingMethodException: Method not found: 'System.Array.Empty' - mono

I have built the solution using monodevelop on windows, then transferred the files to my vps using Filezilla. It works fine on windows. But when i try to run steambot using mono steambot.exe i get the errors:
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Array.Empty'.
at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Array.Empty'.
at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
mattimat#mattimat-ubuntu:~/steambot/SteamBot-master/Bin/Release$ mono SteamBot.exe
Missing method System.Array::Empty<[1]>() in assembly /usr/lib/mono/4.0/mscorlib.dll, referenced in assembly /home/mattimat/steambot/SteamBot-master/Bin/Release/SteamBot.exe
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Array.Empty'.
at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Array.Empty'.
at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
mattimat#mattimat-ubuntu:~/steambot/SteamBot-master/Bin/Release$
Mono version:
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-8+deb7u1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
Again, works fine on windows. VPS is Debian 7.11 x32

public static T[] System.Array.Empty<T>() was added in .Net 4.6 and thus your older version of Mono would be running .Net 4.5 and the error would be expected.
Either update your version of Mono to 4.8+ or removed the usage of Array.Empty and compile against the .Net 4.5 framework.
re: https://msdn.microsoft.com/en-us/library/dn906179(v=vs.110).aspx

Related

using p4net.api in Mono

Anyone managed to get the Perforce p4api.net work with Linux ?
My projects build correctly on Mono 2.8.4, the dlls (p4bridge.dll and p4api.net.dll are in bin/Debug, but whenever I try to execute it, I get this exception :
Unhandled Exception: System.DllNotFoundException: p4bridge.dll
at (wrapper managed-to-native) Perforce.P4.P4Bridge:ConnectA (string,string,string,string,Perforce.P4.P4CallBacks/LogMessageDelegate)
at Perforce.P4.P4Server..ctor (System.String server, System.String user, System.String pass, System.String ws_client) [0x00000] in <filename unknown>:0
at Perforce.P4.Connection.Connect (Perforce.P4.Options options) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: p4bridge.dll
at (wrapper managed-to-native) Perforce.P4.P4Bridge:ConnectA (string,string,string,string,Perforce.P4.P4CallBacks/LogMessageDelegate)
at Perforce.P4.P4Server..ctor (System.String server, System.String user, System.String pass, System.String ws_client) [0x00000] in <filename unknown>:0
at Perforce.P4.Connection.Connect (Perforce.P4.Options options) [0x00000] in <filename unknown>:0
The API is the latest (2013.3) with MonoDevelop 2.8.4 as mentionned, and all mono RPMs are up to date.
Again, as mentionned, both Perforce DLLs are copied into bin/Debug, the project compiles properly, and it does find the p4api.net.dll (as the exception shows), but not the p4bridge.dll. I'm starting to suspect that p4bridge.dll is not a managed .NET library.
Any ideas ?
--JFG
p4bridge is not a managed library so you would need to build it for each platform that you want to run on.
If you want to use P4NET.API in Mono, you could take a look at the P4Connect source code. That project includes a version of the P4NET.API library which works in OSX under Mono. They have yet to integrate that code back into the main P4NET.API library though.

MONO 3.0.2 + Ninject + MVC4: Sequence contains no matching element

I am using VS2012 RC and created a MVC4 app in .NET 4.0 mode. I use Ninject + Ninject.MVC3 as a DI container. It works on my development machine on Windows and on another machine with .NET 4.0 installed, but when I deploy it on a Linux server with Mono 3.0.2, XSP and fastcgi + lighttpd I just get a Ninject related error message:
System.InvalidOperationException
Sequence contains no matching element
at System.Linq.Enumerable.Single[DataAnnotationsModelValidatorProvider] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.Single[DataAnnotationsModelValidatorProvider] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at Ninject.Web.Mvc.NinjectMvcHttpApplicationPlugin.Start () [0x00000] in <filename unknown>:0
at Ninject.Web.Common.Bootstrapper.<Initialize>b__0 (INinjectHttpApplicationPlugin c) [0x00000] in <filename unknown>:0
at Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map[INinjectHttpApplicationPlugin] (IEnumerable`1 series, System.Action`1 action) [0x00000] in <filename unknown>:0
at Ninject.Web.Common.Bootstrapper.Initialize (System.Func`1 createKernelCallback) [0x00000] in <filename unknown>:0
at MvcApplication1.App_Start.NinjectWebCommon.Start () [0x00000] in <filename unknown>:0
at MvcApplication1.MvcApplication.Application_Start () [0x00000] in <filename unknown>:0
To clarify: I had to manually call the Start and Stop methods of the generated NinjectWebCommon class, because the [assembly: WebActivator.PreApplicationStartMethod...] attribute gets ignored (I first got error messages regarding missing default constructors, which are normal for a DI-ed controller)
I also tried subclassing NinjectHttpApplication, but I got the same error.
Any help here?
DI containers are kind of flaky in Mono in my experience. If you don't have time to dig up deeper and fix what possibly seems to be a Mono bug, I would try a different DI container.

How to make a DLL work with Unity in Mac OS X?

I've designed an application in which the user must register himself. For this I've used a Web Service, and the application running in the Unity Editor on Mac OS X, or Windows makes the request without errors.
If I build the application as a Windows executable it also works, but when I build the application for Mac OS X it no longer works (outside the Editor). The request does not work properly.
In the project I've created Plugins folder and introduced both System.Web and System.Web.Services DLLs.
Api Compability Level in Player Settings is NET 2.0.
When I try to run the Mac OS X build I get this error message in the Log:
at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000] in <filename unknown>:0
at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetRequestForMessage (System.Uri uri, System.Web.Services.Protocols.SoapClientMessage message) [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
at BGWebServiceService.login (.LoginRequestBean bean) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) BGWebServiceService:login (LoginRequestBean)
at ClientObject.loginAsyncRequest () [0x00000] in <filename unknown>:0
I've looked many forums and searched the web and I can't find the answer. I don´t know if it´s necessary to add any other folder, put the DLLs on some other place or do something else in the project.
Any help would be very appreciated.
Thank you.
I have found how to make it work.
Only, we have to add /Applications/Unity/Unity.app/Contents/Frameworks/Mono folder into our Framework´s app folder.

Could not load type from assembly in Mono

I'm running a pre-built application using Mono, and it runs alongside a DLL in the same directory (mysql.data.dll). When I run the application with Mono, I get this error:
Could not load type 'Snowlight.Storage.SqlDatabaseClient' from assembly 'Snowlight, Version=0.1.0.35857, Culture=neutral, PublicKeyToken=null'.
at System.Collections.Generic.Dictionary`2[System.Int32,Snowlight.Storage.SqlDatabaseClient].Init (Int32 capacity, IEqualityComparer`1 hcp) [0x00000] in <filename unknown>:0
at System.Collections.Generic.Dictionary`2[System.Int32,Snowlight.Storage.SqlDatabaseClient]..ctor () [0x00000] in <filename unknown>:0
at Snowlight.Storage.SqlDatabaseManager.Initialize () [0x00000] in <filename unknown>:0
at Snowlight.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Judging by <filename unknown>, I am assuming this happens because the DLL it requires isn't found, so how would I get the application to recognize it and use it?
Try running it like this from a terminal:
export MONO_LOG_LEVEL=debug
export MONO_LOG_MASK=asm
mono --debug yourapp.exe
Now every assembly lookup will be printed to the terminal, so you'll be able to find out what's being looked for where.

mono gtk hello world failing, 'Missing method'

I am trying out mono for the first time. Here are the steps I took to set it up.
Installed Kubuntu 12.04 LTS in VirtualBox
apt-get install mono-complete gtk-sharp2
Then I tried running the hello world applications in this tutorial.
http://www.mono-project.com/Mono_Basics
The command line application ran fine.
I compiled the GTK application with the following command as per the instructions:
gmcs hello.cs -pkg:gtk-sharp-2.0
When I run the application it fails with the following errors:
Missing method System.Type::op_Inequality(Type,Type) in assembly /usr/lib/mono/2.0/mscorlib.dll, referenced in assembly /usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Type.op_Inequality'.
at Gtk.Window..ctor (System.String title) [0x00000] in <filename unknown>:0
at Hello.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Type.op_Inequality'.
at Gtk.Window..ctor (System.String title) [0x00000] in <filename unknown>:0
at Hello.Main () [0x00000] in <filename unknown>:0
To me it looks like the mono libraries are incompatible with the gtk-sharp libraries.
Does anyone have any suggestions on how I can get this working?
All 12.04 Ubuntu editions have Mono defaulting to 4.0 profile (similar to .NET 4.0). You are compiling your hello.cs using gmcs compiler which is intended to target 2.0 profile (similar to .NET 2.0).
Use dmcs compiler instead of gmcs and the error will go away.