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.Controls.Primitives.ToggleButton.ToString()
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Comments: ** Comment from web user: nojoDOTse **
This is a known problem with ToggleButton (the base class of ToggleSwitchButton).
The error occurs in runtime when ToString() is called since ToggleButton.ToString() uses Resx.GetString (you see Resx.ctor() in the stack trace) which does the following:
internal Resx()
{
Assembly assembly = base.GetType().Assembly;
this.resources = new ResourceManager("System.Windows", assembly);
string assemblyString = "System.Windows.debug.resources, Version=2.0.5.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e";
try
{
Assembly assembly2 = Assembly.Load(assemblyString);
this.debugResources = new ResourceManager("System.Windows.debug", assembly2);
}
catch (FileNotFoundException)
{
}
this.fallbackResources = new ResourceManager("mscorlib", typeof(object).Assembly);
}
As you can see the exception is handled internally but when you catch all exceptions in Visual Studio you will be notified about it anyway.
A few options how to solve this problem:
1. Ignore the annoying pop up
2. Tell Visual Studio to not show when FileNotFoundException has been thrown (would not recommend this)
3. Download the source for this project and change ToString in ToggleSwitchButton to return string.Empty or something (how I do it)
More information about this problem but with CheckBox can be found at: http://nicksnettravels.builttoroam.com/post/2012/01/06/Framework-Exceptions-in-Windows-Phone.aspx