Get MonoGame working on Raspberry Pi - mono

this is my first post here in the pi forums. My pi arrived yesterday, and i am really exited to get my Application running on the pi.
i want to do the following ... i want to make a simple Playlist with the current songs in the playlist. just the covers of the first 4 songs should be shown. I have this already done in VB.Net using XNA. I tried to port it to monogame, with an GraphicsModeException of OpenTK when running on the PI.
Even a small "Hello World" string rendering is failing with the same exception. All is done via simple spritebatch rendering
Any suggestions ?
Edit : Source and Error
Source : https://bitbucket.org/S3NS4Ti0N/coverflow-test
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Graphics.GraphicsContext ---> System.PlatformNotSupport edException: Please, refer to http://www.opentk.com for more information.
at OpenTK.Platform.Factory+UnsupportedPlatform.CreateGetCurrentGraphicsContext () [0x00000] in <filename unknown>:0
at OpenTK.Graphics.GraphicsContext..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.OpenTKGameWindow.Initialize () [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.OpenTKGameWindow..ctor () [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.OpenTKGamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.Game..ctor () [0x00000] in <filename unknown>:0
at CoverFlow.Game1..ctor () [0x00000] in <filename unknown>:0
at CoverFlow.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Graphics.GraphicsContext ---> System.Plat formNotSupportedException: Please, refer to http://www.opentk.com for more information.
at OpenTK.Platform.Factory+UnsupportedPlatform.CreateGetCurrentGraphicsContext () [0x00000] in <filename unknown>:0
at OpenTK.Graphics.GraphicsContext..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.OpenTKGameWindow.Initialize () [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.OpenTKGameWindow..ctor () [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.OpenTKGamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.Game..ctor () [0x00000] in <filename unknown>:0
at CoverFlow.Game1..ctor () [0x00000] in <filename unknown>:0
at CoverFlow.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

Mono only supports softfloat mode, while most RPi OSes default to hardfloat. hardfloat support is scheduled for the next mono release I believe. If you build the mono source from the git repo, you can get this now.

Related

Getting "Can't find custom atter constructor image" from a .dll after upgrading to Unity5

I've just upgraded to Unity5 and a small .dll I've made started to give the following error:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Missing method .ctor in assembly [myproj... .dll], type System.Runtime.Versioning.TargetFrameworkAttribute
The class System.Runtime.Versioning.TargetFrameworkAttribute could not be loaded, used in Logger
Can't find custom attr constructor image: [myproj... .dll]
mtoken: 0x0a00000e
​
The .dll worked perfectly before updating to Unity 5, and I did recompile the .dll with the unity5 version UnityEngine.dll (needed by my library), but that didn't help. Any ideas how to fix this?

How does one set the filename in Monodevelop?

I have recently installed MonoDevelop V3.0.3.2 on Linux Mint 15 MATE 64-bit.
I installed MonoDevelop through the Software Manager
I attempted to create a new project per http://monodevelop.com/Documentation/Creating_A_Simple_Solution
Unfortunately I receive an error on attempting to build that the filename has not been set. Details of error received are as follows.
System.InvalidOperationException: File name has not been set
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
at System.Diagnostics.Process.Start () [0x00000] in <filename unknown>:0
at MonoDevelop.Core.Execution.ProcessWrapper.Start () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) MonoDevelop.Core.Execution.ProcessWrapper:Start ()
at MonoDevelop.Platform.GnomePlatform.StartConsoleProcess (System.String command, System.String arguments, System.String workingDirectory, IDictionary`2 environmentVariables, System.String title, Boolean pauseWhenFinished) [0x00000] in <filename unknown>:0
at MonoDevelop.Core.Execution.ProcessService.StartConsoleProcess (System.String command, System.String arguments, System.String workingDirectory, IDictionary`2 environmentVariables, IConsole console, System.EventHandler exited) [0x00000] in <filename unknown>:0
at MonoDevelop.Debugger.Soft.SoftDebuggerEngine+<CreateDebuggerStartInfo>c__AnonStorey1.<>m__6 (System.Diagnostics.ProcessStartInfo info) [0x00000] in <filename unknown>:0
at Mono.Debugger.Soft.VirtualMachineManager.BeginLaunch (System.Diagnostics.ProcessStartInfo info, System.AsyncCallback callback, Mono.Debugger.Soft.LaunchOptions options) [0x00000] in <filename unknown>:0
at Mono.Debugging.Soft.SoftDebuggerSession.StartLaunching (Mono.Debugging.Soft.SoftDebuggerStartInfo dsi) [0x00000] in <filename unknown>:0 at Mono.Debugging.Soft.SoftDebuggerSession.OnRun (Mono.Debugging.Client.DebuggerStartInfo startInfo) [0x00000] in <filename unknown>:0
at Mono.Debugging.Client.DebuggerSession+<Run>c__AnonStorey6.<>m__3 () [0x00000] in <filename unknown>:0
How does one set the filename in Monodevelop?
EDIT: The Build of the project is working , Problem is occurring when attempting to run the application in the IDE
I had the same issue. I found out that if you install xterm, and restart monodevelop the error will be resolved. Apparently xterm is a dependency. Just go to terminal and "sudo apt-get install xterm".

Unhandled Exception while running .exe on mono framework in Ubuntu 13.04

I am using ubuntu 13.04, I installed mono-3.1.2 on Ubuntu-13.04 successfully.
Now i am trying to run C# .exe from windows visual studio.
$ mono WindowsFormsApplication1.exe
I am getting the following :-
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: /usr/local/lib/libgdiplus.so
at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.Graphics.FromHdcInternal (IntPtr hdc) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUI..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in <filename unknown>:0
at WindowsFormsApplication1.Program.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL 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: /usr/local/lib/libgdiplus.so
at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.Graphics.FromHdcInternal (IntPtr hdc) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUI..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in <filename unknown>:0
at WindowsFormsApplication1.Program.Main () [0x00000] in <filename unknown>:0
How to remove this exception , please help me.
Thanks in advance.
As #knocte pointed out, you should
Install Mono via apt-get such as sudo apt-get install mono-complete, so that libgdiplus is installed as well,
Or compile both libgdiplus and Mono from source code.
raffamaiden's answer worked for me, but there's a small spelling mistake in the answer:
dnf install libgdiplus-devel
I fixed the problem on Fedora 23 by installing libgdiplus-devel as follows:
dnf install libgdiplus-devel

Embedded mono + app.config

I have embedded mono in a c++ program and loaded a dll which requires an app.config. I am getting this kind of error, does someone have an idea on how to ship *.config with an embedded mono ?
The stack trace :
System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.ArgumentException: The 'ExeConfigFilename' argument cannot be null.
at System.Configuration.ExeConfigurationHost.CheckFileMap (ConfigurationUserLevel level, System.Configuration.ExeConfigurationFileMap map) [0x00000] in <filename unknown>:0
at System.Configuration.ExeConfigurationHost.InitForConfiguration (System.String& locationSubPath, System.String& configPath, System.String& locationConfigPath, IInternalConfigRoot root, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.C[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 onfiguration.InternalConfigurationSystem.InitForConfiguration (System.String& locationConfigPath, System.String& parentConfigPath, System.String& parentLocationConfigPath) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0
at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object
Self answer : you can't (as of 2013-04-30). To enable this behaviour, I had to change mono's framework sources mono/mcs/class/corlib/system/appdomain.cs :
public AppDomainSetup SetupInformation {
get {
return SetupInformationNoCopy; // newline
// AppDomainSetup setup = getSetup (); //old
// return new AppDomainSetup (setup); //old
}
}

Monodevelop: InvalidCastException when adding Web Reference using local WSDL

I am trying to add a Web Reference, using local WSDL/XSD files.
Unfortunately whenever I try, I get the exception below:
Am I doing something wrong?
It works with online web services.
Here is the full exception:
System.InvalidCastException: Cannot cast from source type to destination type.
at System.Xml.Serialization.XmlSchemaImporter.CollectAttributeUsesNonOverlap (System.Xml.Schema.XmlSchemaObjectCollection src, System.Xml.Serialization.ClassMap map) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSchemaImporter.ImportAttributes (System.Xml.XmlQualifiedName typeQName, System.Xml.Serialization.ClassMap cmap, System.Xml.Schema.XmlSchemaObjectCollection atts, System.Xml.Schema.XmlSchemaAnyAttribute anyat, System.Xml.Serialization.CodeIdentifiers classIds) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSchemaImporter.ImportMembersMappingComposite (System.Xml.Schema.XmlSchemaComplexType stype, System.Xml.XmlQualifiedName refer) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSchemaImporter.ImportMembersMapping (System.Xml.XmlQualifiedName name) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.XmlSerializerMessageContractImporterInternal.ImportPartsBySchemaElement (System.Xml.XmlQualifiedName qname, System.Collections.Generic.List`1 parts, System.Web.Services.Description.Message msg, System.Web.Services.Description.MessagePart msgPart) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.MessageContractImporterInternal.resolveMessage (System.Web.Services.Description.Message msg, System.ServiceModel.Description.MessageBodyDescription body, System.Collections.Generic.List`1 parts) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.MessageContractImporterInternal.DoImportContract () [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.MessageContractImporterInternal.ImportContract (System.ServiceModel.Description.WsdlImporter importer, System.ServiceModel.Description.WsdlContractConversionContext context) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.XmlSerializerMessageContractImporter.System.ServiceModel.Description.IWsdlImportExtension.ImportContract (System.ServiceModel.Description.WsdlImporter importer, System.ServiceModel.Description.WsdlContractConversionContext context) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.WsdlImporter.ImportContract (System.Web.Services.Description.PortType wsdlPortType) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.WsdlImporter.ImportAllContracts () [0x00000] in <filename unknown>:0
at MonoDevelop.WebReferences.WCF.WebServiceDiscoveryResultWCF.CreateProxyFile (MonoDevelop.Projects.DotNetProject dotNetProject, FilePath basePath, System.String proxyNamespace, System.String referenceName) [0x00000] in <filename unknown>:0
at MonoDevelop.WebReferences.WebServiceDiscoveryResult.GenerateFiles (MonoDevelop.Projects.DotNetProject project, System.String namspace, System.String referenceName) [0x00000] in <filename unknown>:0
at MonoDevelop.WebReferences.Commands.WebReferenceCommandHandler.NewWebReference () [0x00000] in <filename unknown>:0
Same error with both Windows Communication Foundation (WCF) and .NET 2.0 Web Services.
File a bug report at bugzilla.xamarin.com (use "Class Libraries" / "WCF") and include the WSDL that you're trying to import.
From looking at that stack trace, Mono's WSDL importer doesn't like your import for some reason.