SharpDX/COM error when running under Mono x64

Hi,

I am trying to get MonoGame running with a x64 Mono runtime on Windows. This is a default MonoGame project, nothing special.

It crashes though with the error below. By Googling around it seemed that some of the parameters of CreateSwapChain weren’t correct. Analyzing them using the MonoDevelop Soft Debugger didn’t show anything invalid though, and the same code does works on 32-bit.

Then for the _com_error some people posted about registering the .NET dll using the x64 RegAsm.exe, doing that didn’t help me either though.

So I hope someone has an idea where I should look.

PS. Which version of SharpDX doesn MonoGame use at the moment? (3.3)

First-chance exception at 0x00007FFE79EE8B9C in mono.exe: Microsoft C++ exception: _com_error at memory location 0x000000371BA9E260.
First-chance exception at 0x00007FFE79EE8B9C in mono.exe: Microsoft C++ exception: _com_error at memory location 0x000000371BA9E260.

Unhandled Exception:
SharpDX.SharpDXException: HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall], Message: The application made a call that is invalid. Either the parameters of the call or the state of some object was incorrect.
Enable the D3D debug layer in order to see details via debug messages.

  at SharpDX.Result.CheckError () [0x00000] in <filename unknown>:0 
  at SharpDX.DXGI.Factory.CreateSwapChain (SharpDX.ComObject deviceRef, SharpDX.DXGI.SwapChainDescription& descRef, SharpDX.DXGI.SwapChain swapChainOut) [0x00000] in <filename unknown>:0 
  at SharpDX.DXGI.SwapChain..ctor (SharpDX.DXGI.Factory factory, SharpDX.ComObject device, SwapChainDescription description) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.CreateSizeDependentResources (Boolean useFullscreenParameter) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformInitialize () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Initialize () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor (Microsoft.Xna.Framework.Graphics.GraphicsAdapter adapter, GraphicsProfile graphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.GamePlatform.BeforeInitialize () [0x00000] in <filename unknown>:0 
  at MonoGame.Framework.WinFormsGamePlatform.BeforeInitialize () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Game.DoInitialize () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Game.Run (GameRunBehavior runBehavior) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Game.Run () [0x00000] in <filename unknown>:0 
  at Game3.Program.Main () [0x00000] in <filename unknown>:0

Have you tried using Microsoft .NET? I’m wondering if it is some incompatibility with Mono and how SharpDX does interop. I’m also curious as to why you are using Mono on Windows. It’s not something we see often.

Looking at my post history you might figure why I am using Windows :wink:

And you are right, of course hardly anybody uses Mono on Windows. Makes me wonder though what do Linux and Mac use as C# graphics driver? SharpDX seems to be Windows only? I mean, Linux and Mac can run MonoGame on x64 I assume?

I’m going to read more into this, but if anybody feels like spoiling me; feel free :smile:

Arco

Linux and Mac use OpenGL through the bindings provided by OpenTK.

Ah yes I thought so, thank you. One other small question left: which version of SharpDX does MonoGame 3.3 use?

It is currently using an older version, but will be switching to the newer version now that we have initial Windows 10 UAP support in.

That’s great. Is there already a branch going on for this? And if not, would you know which version of SharpDX is used exactly? I’m asking this because I’m building SharpDX myself now, but I choose a random commit in the 2.5.1 version range to work with.

This might cause future problems though, with MonoGame supporting a different version.

Thank you for your time,
Arco

I don’t know about his case, but as one of those rare Windows users, I wanted to chime in that 64 bit compatibility was big for me. XNA doesn’t provide a 64 bit version as far as I’m aware and of course it’s not going to be supported in the future.