FileNotFoundException in Silverlight for WP7

本文关键字:WP7 for Silverlight in FileNotFoundException | 更新日期: 2023-09-27 18:10:24

文件或程序集名称'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e',或其依赖项之一,未找到

我很确定这与一些文件没有正确安装有关,看看这个异常是如何在各种场合发生的。它可能是一个包含异常名的文件。

有谁知道我是否可以重新安装它之类的吗?

它发生在不可拆卸的地方。

<<p> Callstack位置/strong>
mscorlib.dll!System.ThrowHelper.throwVersion37CompatException(System.ExceptionType newEType = FileNotFoundException, string newString = "File or assembly name 'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e', or one of its dependencies, was not found.", System.ExceptionType oldEType = IOException, string oldString = "File or assembly name 'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e', or one of its dependencies, was not found.") + 0x19 bytes  

完整异常详细信息

System.IO.FileNotFoundException occurred
  Message=File or assembly name 'System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e', or one of its dependencies, was not found.
  StackTrace:
       at System.ThrowHelper.throwVersion37CompatException(ExceptionType newEType, String newString, ExceptionType oldEType, String oldString)
       at System.Reflection.Assembly.Load(String assemblyString)
       at System.Windows.Resx..ctor()
       at System.Windows.Resx.GetLoader()
       at System.Windows.Resx.GetStringHelper(String name)
       at System.Windows.Resx.GetString(String name)
       at System.Windows.PropertyAccessPathStep.ConnectToPropertyInSource(Boolean isSourceCollectionViewCurrentItem)
       at System.Windows.PropertyAccessPathStep.ConnectToProperty()
       at System.Windows.PropertyAccessPathStep.ReConnect(Object newSource)
       at System.Windows.PropertyPathListener.ReConnect(Object source)
       at System.Windows.Data.BindingExpression.SourceAcquired()
       at System.Windows.Data.BindingExpression.System.Windows.IDataContextChangedListener.OnDataContextChanged(Object sender, DataContextChangedEventArgs e)
       at System.Windows.Data.BindingExpression.DataContextChanged(Object sender, DataContextChangedEventArgs e)
       at System.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs e)
       at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)
       at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)
       at System.Windows.FrameworkElement.OnTreeParentUpdated(DependencyObject newParent, Boolean bIsNewParentAlive)
       at System.Windows.DependencyObject.UpdateTreeParent(IManagedPeer oldParent, IManagedPeer newParent, Boolean bIsNewParentAlive, Boolean keepReferenceToParent)
       at MS.Internal.FrameworkCallbacks.ManagedPeerTreeUpdate(IntPtr oldParentElement, IntPtr parentElement, IntPtr childElement, Byte bIsParentAlive, Byte bKeepReferenceToParent, Byte bCanCreateParent)
       at MS.Internal.XcpImports.Measure_WithDesiredSizeNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.UIElement_Measure_WithDesiredSize(UIElement element, Size availableSize)
       at System.Windows.UIElement.Measure_WithDesiredSize(Size availableSize)
       at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(UIElement child, Size layoutSlotSize)
       at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
       at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
       at MS.Internal.XcpImports.MeasureNative(IntPtr element, Single inWidth, Single inHeight)
       at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
       at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
       at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
       at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at Microsoft.Phone.Controls.PhoneApplicationFrame.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)

FileNotFoundException in Silverlight for WP7

这是MSDN引用。似乎他们还没有在WP 7.1 (Mango)中修复这个问题。我也遇到同样的问题。

http://social.msdn.microsoft.com/forums/en - us/windowsphone7series/thread/2b040008 a240 - 470 d - 91 - af - e998984fff12

您是否100%确定您以正常的"应用程序崩溃"方式获得此异常?我经常碰到这种情况,但如果我在VisualStudio的Debug->Exceptions菜单选项中设置System.IO.FileNotFound或System.IO.IsolatedStorage异常拦截器,则只能

值得注意的是,在WP7上,Exception拦截器捕获与所选类型匹配的抛出的每个异常。我是说,每一个人,即使处理得当。这就是为什么我经常使用拦截器来调试我自己的代码。也许你也激活了它们,只是忘记了它们?

有一个简单的解决方法,只需通过继承windows phone silverlight CheckBox和重写ToString()方法来创建您的自定义CheckBox控件,就像这样:

public class MyCheckBox:CheckBox 
{ 
    public override string ToString() 
    { 
        return string.Empty; 
    } 
}

在这里看到更多:Windows Phone框架异常

每当Visual Studio 2010试图在XAML数据值转换期间格式化错误消息时(即处理通过数据绑定表达式指定的IValueConverter),就会发生这种情况。

我发现的解决方案是在调试器中中断,双击大约2或3层的堆栈跟踪条目之一,然后查看"Locals"窗口,查看它试图格式化的错误消息和绑定表达式的参数。

你应该能够从那里找出错误,例如,它可能是绑定表达式的路径部分的拼写错误(属性名称错误/源不存在)或不支持的转换(未指定值转换器和不支持默认转换)。

由用户"invalidusername"提供的MSDN链接在这里不再工作了(似乎已经从新的"Metro"风格的Dev Center站点中删除),所以我无法检查任何其他已知的解决方案或修复。这应该登录到MS Connect上。然而,Windows Phone 8 SDK即将发布(目前传闻是9月12日),所以我想我们应该等待,看看VS 2012和新SDK(假设它仍然支持OS 7.1手机!)。