简体   繁体   English

Silverlight for WP7中的FileNotFoundException

[英]FileNotFoundException in Silverlight for WP7

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.Windows.debug.resources,Version = 2.0.5.0,Culture = en-US,PublicKeyToken = 7cec85d7bea7798e'或其中一个依赖项。

I'm pretty sure its something to do with some file not properly installed, seeing how this exception occurs on various occasions. 我很确定它与某些未正确安装的文件有关,看看在各种情况下这种异常是如何发生的。 It might be a file with exception names in it. 它可能是一个包含异常名称的文件。

Does anybody know if I can reinstall it or something like that? 有人知道我是否可以重新安装它或类似的东西?

It occurs in a place where no disassembly is available. 它发生在没有可拆卸的地方。

Callstack Location Callstack位置

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  

Full Exception Details 完全异常详细信息

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)

Here is the MSDN reference. 这是MSDN参考。 It seems that they didn't fix it yet in WP 7.1 (Mango). 似乎他们还没有在WP 7.1(芒果)中修复它。 I'm experiencing the same problem. 我遇到了同样的问题。

http://social.msdn.microsoft.com/forums/en-us/windowsphone7series/thread/2B040008-A240-470D-91AF-E998984FFF12 http://social.msdn.microsoft.com/forums/en-us/windowsphone7series/thread/2B040008-A240-470D-91AF-E998984FFF12

Are you 100% sure that you get this exception in a normal, "app-crashy" way? 您是否100%确定以正常的“app-crashy”方式获得此异常? I stumble upon that one very often, but only if I set up System.IO.FileNotFound or System.IO.IsolatedStorage excepion interceptors in the Debug->Exceptions menu option in VisualStudio. 我偶然发现了一个很经常,但只有当我在调试-建立System.IO.FileNotFound或System.IO.IsolatedStorage excepion拦截>在VisualStudio的例外菜单选项。

That's quite important thing to note, that on WP7 the Exception interceptors catch every single eception thrown that matches the chosen type. 需要注意的是,在WP7上,Exception拦截器会捕获与所选类型匹配的每个单独的eception。 I mean, every one, even if it is properly handled. 我的意思是,每一个,即使它处理得当。 This is why I see them, I use that interceptors very often to debug my own code. 这就是我看到它们的原因,我经常使用那些拦截器来调试我自己的代码。 Maybe you did activate them too and simply forgot about them? 也许你确实激活了它们而只是忘了它们?

There is a simple workaround for this just create your custom CheckBox control by inheriting windows phone silverlight CheckBox and override ToString() method like this: 有一个简单的解决方法,只需通过继承Windows Phone Silverlight CheckBox并覆盖ToString()方法来创建自定义CheckBox控件,如下所示:

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

see more here: Framework Exceptions in Windows Phone 在这里看到更多: Windows Phone中的框架异常

This occurs for me whenever Visual Studio 2010 tries to format an error message during XAML data value conversion (ie processing a IValueConverter specified via the data binding expression). 只要Visual Studio 2010在XAML数据值转换期间尝试格式化错误消息(即处理通过数据绑定表达式指定的IValueConverter),就会发生这种情况。

The workaround I found is to just break in the debugger, double-click one of the stack trace entries about 2 or three levels down, then look at the "Locals" window to see the error message it is trying to format and the parameters of the binding expression. 我找到的解决方法是在调试器中断,双击其中一个堆栈跟踪条目大约2或3个级别,然后查看“Locals”窗口以查看它尝试格式化的错误消息和参数绑定表达式。

You should be able to work out what was wrong from there, eg it could be a typo in the path part of the binding expression (property name wrong / source does not exist) or an unsupported conversion (the value converter was not specified and default conversion not supported). 你应该能够解决那里的错误,例如它可能是绑定表达式的路径部分中的拼写错误(属性名称错误/源不存在)或不支持的转换(未指定值转换器并且默认不支持转换)。

The MSDN link provided by user "invalidusername" here doesn't work anymore (seems to have been removed from the new "Metro" styled Dev Center site) so I couldn't check for any other known workaround or fix. 用户“invalidusername”在此处提供的MSDN链接不再起作用(似乎已从新的“Metro”样式的Dev Center站点中删除),因此我无法检查是否有任何其他已知的解决方法或修复。 This should be logged on MS Connect really. 这应该记录在MS Connect上。 However the Windows Phone 8 SDK is due out shortly (currently rumoured September 12th) so I guess we should wait and see how it goes with VS 2012 and the new SDK (presuming it still supports OS 7.1 phones!). 然而,Windows Phone 8 SDK即将推出(目前传闻9月12日),所以我想我们应该等待,看看VS 2012和新的SDK如何(假设它仍然支持OS 7.1手机!)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM