Wednesday, August 29, 2012

FileNotFoundException in Silverlight for WP7

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.

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

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) 

Answers & Comments...

Answer: 1

Here is the MSDN reference. It seems that they didn't fix it yet in WP 7.1 (Mango). I'm experiencing the same problem.

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

by : invalidusernamehttp://stackoverflow.com/users/266280

Answer: 2

Are you 100% sure that you get this exception in a normal, "app-crashy" way? 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.

That's quite important thing to note, that on WP7 the Exception interceptors catch every single eception thrown that matches the chosen type. 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?

by : quetzalcoatlhttp://stackoverflow.com/users/717732

Answer: 3

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:

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

see more here: Framework Exceptions in Windows Phone

by : Roboblobhttp://stackoverflow.com/users/125718

Answer: 4

This occurs for me whenever Visual Studio 2010 tries to format an error message during XAML data value conversion (i.e. processing a IValueConverter specified via the data binding expression).

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.

You should be able to work out what was wrong from there, e.g. 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. This should be logged on MS Connect really. 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!).

by : Code Chiefhttp://stackoverflow.com/users/1080914




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog