Windows store apps System.Reflection.TargetingException';在monogame商店游戏中的mscorlib.dll异常中发生

Windows store apps System.Reflection.TargetingException';在monogame商店游戏中的mscorlib.dll异常中发生,windows-store-apps,xna-4.0,monogame,Windows Store Apps,Xna 4.0,Monogame,这是我第一次为windows应用商店开发monogame游戏,我在构建游戏时遇到了一个例外 var game = new T(); “frog.exe”(托管(v4.0.30319)):加载的“C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0_b77a5c561934e089\mscorlib.dll”跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'frog.exe'(托管(v4.0.3

这是我第一次为windows应用商店开发monogame游戏,我在构建游戏时遇到了一个例外

        var game = new T();
“frog.exe”(托管(v4.0.30319)):加载的“C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0_b77a5c561934e089\mscorlib.dll”跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'frog.exe'(托管(v4.0.30319)):加载的'D:\windows\windows games\storegame\SABFROG\frog\bin\Windows8\Debug\AppX\frog.exe',已加载符号。 “frog.exe”(托管(v4.0.30319)):加载的“C:\Windows\Microsoft.Net\assembly\GAC\U MSIL\System.Runtime\v4.0\U 4.0.0\UU b03f5f7f11d50a3a\System.Runtime.dll”,跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “frog.exe”(托管(v4.0.30319)):加载了“C:\Windows\system32\WinMetadata\Windows.UI.Xaml.winmd”,跳过了加载符号。模块已优化,调试器选项“仅我的代码”已启用。
'frog.exe'(托管(v4.0.30319)):加载的'D:\windows\windows games\storegame\SABFROG\frog\bin\Windows8\Debug\AppX\MonoGame.Framework.DLL',已加载符号。 “frog.exe”(托管(v4.0.30319)):加载的“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0_b77a5c561934e089\System.dll”跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “frog.exe”(托管(v4.0.30319)):加载了“C:\Windows\Microsoft.Net\assembly\GAC\U MSIL\System.Collections\v4.0\U 4.0.0\UU b03f5f7f11d50a3a\System.Collections.dll”,跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “frog.exe”(托管(v4.0.30319)):加载的“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0_b77a5c561934e089\System.Runtime.WindowsRuntime.dll”跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “frog.exe”(托管(v4.0.30319)):加载了“C:\Windows\system32\WinMetadata\Windows.Graphics.winmd”,跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “青蛙.exe”(托管(V4.0.30319)):加载的c:\Windows \Stase3\WINMID\\WINDOWS .FINM.WINMD,跳过加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 “frog.exe”(托管(v4.0.30319)):加载的“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Extensions\v4.0_4.0.0.0_b03f5f7f11d50a3a\System.Runtime.Extensions.dll”跳过了加载符号。模块已优化,并且调试器选项“仅我的代码”已启用。 'frog.exe'(托管(v4.0.30319)):加载'D:\windows\windows games\storegame\SABFROG\frog\bin\Windows8\Debug\AppX\SharpDX.DLL' frog.exe中发生了类型为“System.NullReferenceException”的第一次意外异常 mscorlib.dll中发生类型为“System.Reflection.TargetInvocationException”的第一次意外异常 mscorlib.dll中发生“System.Reflection.TargetInvocationException”类型的异常,但未在用户代码中处理 附加信息:调用目标已引发异常。
程序“[6860]frog.exe:Managed(v4.0.30319)”已退出,代码为-1(0xFFFFFF)。

不确定这是否有帮助,因为我从未使用过monogame,但当您尝试实例化一个没有默认构造函数(没有参数的构造函数)的类时,可能会发生System.Reflection.TargetInvocationException,正如我从代码中怀疑的那样

var game = new T();
例如:

class MyClass { 

    public MyClass(string name)
    {
        //Some code
    }

    //calling new MyClass("Foo") will work
    //calling new MyClass() will cause a TargetInvocationException, because the
    //constructor is  not defined in the class
}

你知道在你的代码中以类型T传递的是什么类吗?

不确定这是否有用,因为我从未使用过monogame,但是当你试图实例化一个没有默认构造函数(没有参数的构造函数)的类时,System.Reflection.TargetInvocationException可能会发生,正如我从代码中怀疑的那样

var game = new T();
例如:

class MyClass { 

    public MyClass(string name)
    {
        //Some code
    }

    //calling new MyClass("Foo") will work
    //calling new MyClass() will cause a TargetInvocationException, because the
    //constructor is  not defined in the class
}

你知道在你的代码中以类型T传递的是什么类吗?

不确定这是否有用,因为我从未使用过monogame,但是当你试图实例化一个没有默认构造函数(没有参数的构造函数)的类时,System.Reflection.TargetInvocationException可能会发生,正如我从代码中怀疑的那样

var game = new T();
例如:

class MyClass { 

    public MyClass(string name)
    {
        //Some code
    }

    //calling new MyClass("Foo") will work
    //calling new MyClass() will cause a TargetInvocationException, because the
    //constructor is  not defined in the class
}

你知道在你的代码中以类型T传递的是什么类吗?

不确定这是否有用,因为我从未使用过monogame,但是当你试图实例化一个没有默认构造函数(没有参数的构造函数)的类时,System.Reflection.TargetInvocationException可能会发生,正如我从代码中怀疑的那样

var game = new T();
例如:

class MyClass { 

    public MyClass(string name)
    {
        //Some code
    }

    //calling new MyClass("Foo") will work
    //calling new MyClass() will cause a TargetInvocationException, because the
    //constructor is  not defined in the class
}

你知道在你的代码中什么类被作为类型T传递吗?

实际上它已经解决了,我在初始化游戏之前访问了用户定义的方法,所以代码抛出了异常


现在我在load方法中调用这些方法,它工作得很好

实际上解决了这个问题,我在初始化游戏之前访问了用户定义的方法,这样代码就会抛出异常


现在我在load方法中调用这些方法,它工作得很好

实际上解决了这个问题,我在初始化游戏之前访问了用户定义的方法,这样代码就会抛出异常


现在我在load方法中调用这些方法,它工作得很好

实际上解决了这个问题,我在初始化游戏之前访问了用户定义的方法,这样代码就会抛出异常

现在我在load方法中调用这些方法,它工作得很好

可能的重复可能的重复可能的重复可能的重复