2

このプログラムを Windows で実行しようとしています

#region Using Statements
using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Input;

#endregion

namespace asdf
{
public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;        

    public Game1() //Exception raised points to here
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";              
        graphics.IsFullScreen = true;       
    }
    protected override void Initialize()
    {
        base.Initialize();
    }
    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
    }
    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        {
            Exit();
        }       
        base.Update(gameTime);
    }
    protected override void Draw(GameTime gameTime)
    {
        graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
        base.Draw(gameTime);
    }
}
}

次の例外を発生させます

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: /tmp/install/lib/libgdiplus.so
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000cc] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\gdipFunctions.cs:127
  --- End of inner exception stack trace ---
  at System.Drawing.Icon.get_Handle () [0x00020] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\Icon.cs:646
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:get_Handle ()
  at OpenTK.Platform.Windows.WinGLNative.set_Icon (System.Drawing.Icon value) [0x00000] in <filename unknown>:0
  at OpenTK.NativeWindow.set_Icon (System.Drawing.Icon value) [0x00000] in <filename unknown>:0
  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 asdf.Program.Main (System.String[] arrayargs) [0x00000] in <
filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: /tmp/install/lib/libgdiplus.so
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000cc] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\gdipFunctions.cs:127
  --- End of inner exception stack trace ---
  at System.Drawing.Icon.get_Handle () [0x00020] in C:\cygwin\sources\mono\mcs\class\System.Drawing\System.Drawing\Icon.cs:646
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:get_Handle ()
  at OpenTK.Platform.Windows.WinGLNative.set_Icon (System.Drawing.Icon value) [0x00000]in <filename unknown>:0
  at OpenTK.NativeWindow.set_Icon (System.Drawing.Icon value) [0x00000] in <filename unknown>:0
  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 asdf.Program.Main (System.String[] arrayargs) [0x00000] in <filename unknown>:0

Mono で実行する場合。

私が試してみました:

  • Mono の再インストール

  • モノゲームの再インストール

  • Xamarin Studio の再インストール

  • ウィンドウの更新

エラーは変更されていません。

monogame の代わりに SFML.Net を使用すると、このエラーは発生しません。

全体のソリューションはここにあります

4

2 に答える 2

1

修理:

mono 構成ファイルに間違ったマッピングがないことを確認します。つまり、次のような行を削除します。

<dllmap dll="gdiplus" target="whatever" />
<dllmap dll="gdiplus.dll" target="whatever" />

説明:

System.DllNotFoundException例外の詳細を見ると、親GameクラスにSystem.Drawing.GDIPlusを通じて公開される参照が含まれているため、基になるものがスローされている可能性が高いでしょうgdiplus.dllgdiplus.dllはコア .NET Framework ライブラリであるため、既に GAC に含まれている必要があります。Mono のようなクロスプラットフォーム フレームワークでこれをロードできない最も一般的な理由は、無効な DLL マッピングです。

于 2013-11-03T23:29:30.203 に答える