actually its solved i was accessing user defined methods before intializing the game so that exception was thrown by code.
now i am calling those methods in load method it working fine!!
質問
this my first time developing games in monogame for windows store i am getting exception at line of construct game
var game = new T();
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'D:\windows\windows games\storegame\SABFROG\frog\bin\Windows8\Debug\AppX\frog.exe', Symbols loaded.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\system32\WinMetadata\Windows.UI.Xaml.winmd', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'D:\windows\windows games\storegame\SABFROG\frog\bin\Windows8\Debug\AppX\MonoGame.Framework.DLL', Symbols loaded.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Collections\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Collections.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\system32\WinMetadata\Windows.Graphics.winmd', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\system32\WinMetadata\Windows.Foundation.winmd', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Extensions\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.Extensions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'frog.exe' (Managed (v4.0.30319)): Loaded 'D:\windows\windows games\storegame\SABFROG\frog\bin\Windows8\Debug\AppX\SharpDX.DLL'
A first chance exception of type 'System.NullReferenceException' occurred in frog.exe
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll but was not handled in user code
Additional information: Exception has been thrown by the target of an invocation.
The program '[6860] frog.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).
解決 2
actually its solved i was accessing user defined methods before intializing the game so that exception was thrown by code.
now i am calling those methods in load method it working fine!!
他のヒント
Not sure if this helps, as I've never used monogame, but System.Reflection.TargetInvocationException can happen when you are trying to instantiate a class that has no default constructor (constructor with no parameteres), as I suspect from the code.
var game = new T();
For example:
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
}
Do you know what class is being passed as type T in your code?