Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 MvvmCross安装实例初始化期间InvalidProgrameException_Windows Phone 7_Cross Platform_Xamarin_Mvvmcross_Invalidprogramexception - Fatal编程技术网

Windows phone 7 MvvmCross安装实例初始化期间InvalidProgrameException

Windows phone 7 MvvmCross安装实例初始化期间InvalidProgrameException,windows-phone-7,cross-platform,xamarin,mvvmcross,invalidprogramexception,Windows Phone 7,Cross Platform,Xamarin,Mvvmcross,Invalidprogramexception,我正在使用MvvmCross框架来交付使用Xamarin的跨平台应用程序。 我的Windows Phone应用程序在WP8平台下运行,在WP7平台下由于内部错误而失败。我正在为WP7和WP8平台使用单个VisualStudio项目(WP7模板) var setup = new Setup(RootFrame); setup.Initialize(); 下面是详细的stacktrace: System.InvalidProgramException was unhandled Message

我正在使用MvvmCross框架来交付使用Xamarin的跨平台应用程序。 我的Windows Phone应用程序在WP8平台下运行,在WP7平台下由于内部错误而失败。我正在为WP7和WP8平台使用单个VisualStudio项目(WP7模板)

var setup = new Setup(RootFrame);
setup.Initialize();
下面是详细的stacktrace:

System.InvalidProgramException was unhandled
  Message=InvalidProgramException
  StackTrace:
       at System.RuntimeType.GetConstructors(BindingFlags bindingAttr)
       at Cirrious.CrossCore.IoC.MvxTypeExtensions.<CreatableTypes>b__1(Type t)
       at System.Linq.Enumerable.<WhereIterator>d__0`1.MoveNext()
       at System.Linq.Enumerable.<WhereIterator>d__0`1.MoveNext()
       at Cirrious.CrossCore.Platform.MvxBootstrapRunner.Run(Assembly assembly)
       at Cirrious.MvvmCross.Platform.MvxSetup.PerformBootstrapActions()
       at Cirrious.MvvmCross.Platform.MvxSetup.InitializeSecondary()
       at Cirrious.MvvmCross.Platform.MvxSetup.Initialize()
       at MyApp.WP.App..ctor()
       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
       at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
       at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
       at MS.Internal.TypeProxy.<>c__DisplayClass30.<GetCreateObjectDelegate>b__2a()
       at MS.Internal.TypeProxy.CreateInstance(UInt32 customTypeId)
       at MS.Internal.FrameworkCallbacks.CreateKnownObject(IntPtr nativeRootPeer, UInt32 customTypeId, String initializationString, IntPtr& nativePeer, UInt32 isCreatedByParser)
       at MS.Internal.FrameworkCallbacks.CreateUnknownObject(String assemblyName, String typeName, IntPtr nativeRootPeer, String initializationString, UInt32& customTypeId, UInt32& coreTypeId, UInt32& typeFlags, IntPtr& nativePeer)
System.InvalidProgrameException未处理
消息=InvalidProgrameException
堆栈跟踪:
位于System.RuntimeType.GetConstructors(BindingFlags bindingAttr)
在cirrius.CrossCore.IoC.MvxTypeExtensions.b_uu1(类型t)
在System.Linq.Enumerable.d_u0`1.MoveNext()中
在System.Linq.Enumerable.d_u0`1.MoveNext()中
在cirrius.CrossCore.Platform.MvxBootstrapRunner.Run(程序集)
在cirrius.MvvmCross.Platform.MvxSetup.performbootstrapacations()上
在cirrial.MvvmCross.Platform.MvxSetup.InitializeSecondary()中
在Cirrious.MvvmCross.Platform.MvxSetup.Initialize()中
在MyApp.WP.App..ctor()上
在System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci、BindingFlags invokeAttr、Binder Binder、对象参数、CultureInfo区域性、Boolean isBinderDefault、程序集调用者、Boolean verifyAccess、StackScrawMark和stackMark)
在System.Reflection.RuntimeConstructorInfo.InternalInvoke(对象obj、BindingFlags invokeAttr、绑定器绑定器、对象[]参数、CultureInfo区域性、堆栈爬网标记和堆栈标记)
位于System.Reflection.ConstructorInfo.Invoke(对象[]参数)
在MS.Internal.TypeProxy.c__DisplayClass30.b__2a()中
位于MS.Internal.TypeProxy.CreateInstance(UInt32 customTypeId)
在MS.Internal.FrameworkCallbacks.CreateKnownObject(IntPtr nativeRootPeer、UInt32 customTypeId、字符串初始化字符串、IntPtr&nativePeer、UInt32 isCreatedByParser)
在MS.Internal.FrameworkCallbacks.CreateUnknownObject(字符串汇编名、字符串类型名、IntPtr nativeRootPeer、字符串初始化字符串、UInt32和customTypeId、UInt32和coreTypeId、UInt32和类型标志、IntPtr和nativePeer)
有没有办法诊断和解决这个问题

有没有办法诊断和解决这个问题

cirrial.CrossCore.Platform.MvxBootstrapRunner.Run调用正在查看主程序集并查找要运行的引导类

在该扫描期间发生异常

通过为
invalidProgrameException

否则,您还可以使用修改的
createabletypes
调用在自己的代码中导致异常-即在
设置中
代码覆盖
performbootstrapacations
并尝试调用:

    var things = MyCreatableTypes(this.GetType().Assembly).ToList();
与:

public IEnumerable MyCreatableTypes(程序集)
{
返回组件
.ExceptionsSafegetTypes()例外情况
.Where(t=>!t.IsAbstract)
.其中(t=>{
尝试
{
Trace(“即将调用类型{0}的getconstructor”,t.Name);
返回t.GetConstructors(BindingFlags.Instance | BindingFlags.Public).Any()
}
捕获(无效程序异常e)
{
//您的跟踪或调试代码。。。
返回false;
});
}
这将有助于你诊断出什么是失败的…然后修复将有望跟进



旁白:请注意,MvvmCross的v3.1(及更高版本)将不支持WP7,因为Microsoft只许可较新的PCL库用于跨平台使用-请参阅。v3.0.14是最后一次正式支持WP7的MvvmCross。我不知道WP7,是的,我正在使用最新的MvvmCross版本,所以这就是问题所在。
    public IEnumerable<Type> MyCreatableTypes(Assembly assembly)
    {
        return assembly
            .ExceptionSafeGetTypes()
            .Where(t => !t.IsAbstract)
            .Where(t => {
                try
                {
                    Mvx.Trace("About to call GetConstructors for Type {0}", t.Name);
                    return t.GetConstructors(BindingFlags.Instance | BindingFlags.Public).Any()
                }
                catch (InvalidProgramException e)
                {
                    // your trace or debugging code...
                    return false;
                });
    }