在wp7上运行项目时TargetInvocationException

维塔利(Vitalii Vasylenko)

我有一个大型的wp7专案,在wp7上运作良好。在过去的几个星期中,我使用wp8设备进行调试(项目仍适用于wp7),一切都很好。

现在,我开始在wp7设备上对其进行测试,这使我望而却步

System.Windows.Application.LoadComponent(this, new System.Uri("/MyApp;component/App.xaml", System.UriKind.Relative));

这个例外

System.Reflection.TargetInvocationException occurred
  Message=TargetInvocationException
  StackTrace:
       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.XamlManagedRuntimeRPInvokes.CreateInstance(XamlTypeToken inXamlType, XamlQualifiedObject& newObject)
       at MS.Internal.XcpImports.Application_LoadComponentNative(IntPtr pContext, IntPtr pComponent, UInt32 cUriStringLength, String uriString, UInt32 cXamlStrLength, Byte* pXamlStr, UInt32 cAssemblyStrLength, String assemblyStr)
       at MS.Internal.XcpImports.Application_LoadComponent(IManagedPeerBase componentAsDO, String resourceLocator, UnmanagedMemoryStream stream, UInt32 numBytesToRead, String assemblyString)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at MyApp.App.InitializeComponent()
       at MyApp.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)
  InnerException: System.MissingMethodException
       Message=Could not load type 'System.Func`2' from assembly 'mscorlib, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.

我改变了很多东西,所以我不知道在哪里看。

有什么可能是原因的建议吗?那是System.Func'2什么?

编辑:只是为了再次澄清一下:项目始终针对wp7。当前是:在此处输入图片说明

EDIT2:输出为:

'TaskHost.exe' (Managed): Loaded 'System.Device.dll' 
'TaskHost.exe' (Managed): Loaded 'Cimbalino.Phone.Toolkit.Background.dll'
'TaskHost.exe' (Managed): Loaded 'Cimbalino.Phone.Toolkit.dll'
'TaskHost.exe' (Managed): Loaded 'GalaSoft.MvvmLight.Extras.WP71.dll'
'TaskHost.exe' (Managed): Loaded 'System.Runtime.Serialization.dll'

也许可以帮上忙吗?wp7上的Serialization.dll出现问题吗?

EDIT3:我的系统配置:Windows 8.1 Pro,MSVS Pro 2012 Update 4。

维塔利(Vitalii Vasylenko)

好的,我已经设法解决了这个问题。问题出在Newtonsoft.Json库上,当前版本(6.0.3)声称与wp7兼容,但实际上并非如此。

在此处输入图片说明

解决方案:只需回滚至5.0.8: Install-Package Newtonsoft.Json -Version 5.0.8

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在wp7上运行项目时TargetInvocationException

来自分类Dev

在wp7中的SkyDrive上上传文件时出错

来自分类Dev

防止在全景项目或枢轴项目WP7 C#的最后一项上滚动

来自分类Dev

WP7 ListBox所选项目未更改颜色

来自分类Dev

从wp7中的longlistselector中删除特定项目

来自分类Dev

我可以在wp7中运行.exe文件吗

来自分类Dev

IsolatedStorageFile.GetLastAccessTime在wp7上崩溃

来自分类Dev

将CommandParameter设置为ListBox(WP7)上当前点击的项目

来自分类Dev

我如何使用wp7在列表框中选择多个项目

来自分类Dev

从内部项目文本文件wp7填充数据库

来自分类Dev

如何检测停用后用户何时再次运行WP7 XNA Application?

来自分类Dev

将项目从WP7升级到WP8后,活动磁贴不起作用

来自分类Dev

如何在Windows Phone 8上获取WP7样式的ANID?

来自分类Dev

WP7:访问内置事件

来自分类Dev

倍数消息框-WP7

来自分类Dev

在wp7中禁用ApplicationBarIconButton

来自分类Dev

从WP7项目文件夹中的zip文件中读取字节数组

来自分类Dev

目标WP7和WP8.1(8.0设备将获得WP7应用程序)吗?

来自分类Dev

如何在WP7中在事件触发时用来自绑定列表框的图像填充矩形

来自分类Dev

可以在具有wp7操作系统的手机上的wp8中的C#中运行应用程序编码?

来自分类Dev

Image upload from WP7 to Web Api

来自分类Dev

WP7 Push Notifications returns null channel uri

来自分类Dev

将图像从WP7上传到Web Api

来自分类Dev

科尔多瓦添加平台WP7问题

来自分类Dev

WP7推送通知返回空通道uri

来自分类Dev

WP7应用程式WebRequest发生错误

来自分类Dev

最简单的WP7记录器

来自分类Dev

在wp7中滚动页面的问题

来自分类Dev

WP7动感瓷砖的手动测试

Related 相关文章

热门标签

归档