-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Repro:
- Create WPF Core app in Visual Studio
- Open MainWindow.xaml.cs and add following code to MainWindow constructor
public MainWindow()
{
InitializeComponent();
try
{
string maps = XmlAttributeProperties.GetXmlNamespaceMaps(this);
}
catch (Exception ex)
{
Debug.Fail(ex.ToString());
}
}
- Build and run.
Expected: no assert dialogs
Actual: assert dialog
System.InvalidCastException: Unable to cast object of type 'System.Collections.Hashtable' to type 'System.String'
at System.Windows.Markup.XmlAttributeProperties.GetXmlNamespaceMaps(DependencyObject dependencyObject)
at WpfApp.MainWindow in MainWindow.xaml.cs
Note: looks like incorrect DP declaration:
[https://github.com/dotnet/wpf/blob/ae1790531c3b993b56eba8b1f0dd395a3ed7de75/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XmlAttributeProperties.cs]
XmlNamespaceMapsProperty = DependencyProperty.RegisterAttached("XmlNamespaceMaps", **typeof(Hashtable)** . . .
public static string GetXmlNamespaceMaps(DependencyObject dependencyObject)
{ . . . return **(string)**dependencyObject.GetValue(XmlNamespaceMapsProperty);
szpeplinski, vitidev, dboitnott and piotrbulkowski