I'm having a weird WPF issue. I have two IMultiValueConverter
definitions in an assembly that is referenced by my WPF project. Their code is identical, but their names are different. I have cleaned and rebuilt the assemblies multiple times, but for some reason only one of the Value converters works, while the other one gives a 'does not exist in the clr namespace' xaml error.
Note: I know for a fact that the file is in the correct namespace and assembly that the project is referencing, because I reflected the dll directly out of the WPF project's bin folder.
Is there any explanation for this phenomenon?
//// this works
public class IndexConverter : IMultiValueConverter
{
public virtual object Convert(
object[] values, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
var element = values[0] as Object;
var sequence = values[1] as IEnumerable;
return sequence.Cast<Object>().ToList().FindIndex(c => c.Equals(element)).ToString();
}
public virtual object[] ConvertBack(
object value, Type[] targetTypes,
object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
//// this gives me xaml errors
public class IndexConverterCopy : IMultiValueConverter
{
public virtual object Convert(
object[] values, Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
var element = values[0] as Object;
var sequence = values[1] as IEnumerable;
return sequence.Cast<Object>().ToList().FindIndex(c => c.Equals(element)).ToString();
}
public virtual object[] ConvertBack(
object value, Type[] targetTypes,
object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
There is some strange bugs in the new VS2012 which seems like some kind of caching issue.
The only solution is to restart VisualStudio.
So far I have found 3 bugs like this
IndexOutOfRange
exception, needs VS
restartThis issue sounds like its coming from the same area where the xaml and cs somehow become out of sync, so a Restart of VS may be the only fix for your issue aswell (Bring on SP1)