Skip to content

Commit c09a496

Browse files
committed
xmlnamespacemaps breaking change
1 parent b1974af commit c09a496

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

docs/core/compatibility/9.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff
4646
| [ComponentDesigner.Initialize throws ArgumentNullException](windows-forms/9.0/componentdesigner-initialize.md) | Behavioral change | Preview 1 |
4747
| [DataGridViewRowAccessibleObject.Name starting row index](windows-forms/9.0/datagridviewrowaccessibleobject-name-row.md) | Behavioral change | Preview 1 |
4848
| [No exception if DataGridView is null](windows-forms/9.0/datagridviewheadercell-nre.md) | Behavioral change | Preview 1 |
49+
50+
## WPF
51+
52+
| Title | Type of change | Introduced version |
53+
|-----------------------------------------------------------------------------------------|---------------------|--------------------|
54+
| [`GetXmlNamespaceMaps` type change](wpf/9.0/xml-namespace-maps.md) | Behavioral change/Source incompatible | Preview 3 |

docs/core/compatibility/toc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ items:
4040
href: windows-forms/9.0/datagridviewrowaccessibleobject-name-row.md
4141
- name: No exception if DataGridView is null
4242
href: windows-forms/9.0/datagridviewheadercell-nre.md
43+
- name: WPF
44+
items:
45+
- name: "'GetXmlNamespaceMaps' type change"
46+
href: wpf/9.0/xml-namespace-maps.md
4347
- name: .NET 8
4448
items:
4549
- name: Overview
@@ -1870,6 +1874,10 @@ items:
18701874
href: winforms.md
18711875
- name: WPF
18721876
items:
1877+
- name: .NET 9
1878+
items:
1879+
- name: "'GetXmlNamespaceMaps' type change"
1880+
href: wpf/9.0/xml-namespace-maps.md
18731881
- name: .NET 5
18741882
items:
18751883
- name: OutputType set to WinExe
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "Breaking change: 'GetXmlNamespaceMaps' type change"
3+
description: Learn about the breaking change in .NET 9 for WPF where the backing property of 'XmlNamespaceMaps' has been changed from 'String' to 'Hashtable'.
4+
ms.date: 03/15/2024
5+
---
6+
# `GetXmlNamespaceMaps` type change
7+
8+
The backing property of <xref:System.Windows.Markup.XmlAttributeProperties.XmlNamespaceMaps?displayProperty=nameWithType> has been changed from <xref:System.String> to <xref:System.Collections.Hashtable>.
9+
10+
## Version introduced
11+
12+
.NET 9 Preview 3
13+
14+
## Previous behavior
15+
16+
Previously, the backing property of <xref:System.Windows.Markup.XmlAttributeProperties.XmlNamespaceMaps> was <xref:System.String>. However, the value returned by `dependencyObject.GetValue(XmlNamespaceMapsProperty)` is of type <xref:System.Collections.Hashtable> and the <xref:System.Windows.Markup.XmlAttributeProperties.GetXmlNamespaceMaps(System.Windows.DependencyObject)> implementation tried to type cast it to <xref:System.String>, which resulted in an <xref:System.InvalidCastException>.
17+
18+
In addition, the <xref:System.Windows.Markup.XmlAttributeProperties.SetXmlNamespaceMaps(System.Windows.DependencyObject,System.String)> method accepted a <xref:System.String> argument.
19+
20+
## New behavior
21+
22+
Starting in .NET 9, the backing property of <xref:System.Windows.Markup.XmlAttributeProperties.XmlNamespaceMaps> is <xref:System.Collections.Hashtable>, and the <xref:System.InvalidCastException> is no longer thrown by <xref:System.Windows.Markup.XmlAttributeProperties.GetXmlNamespaceMaps(System.Windows.DependencyObject)>.
23+
24+
In addition, the <xref:System.Windows.Markup.XmlAttributeProperties.SetXmlNamespaceMaps(System.Windows.DependencyObject,System.Collections.Hashtable)> method now accepts a <xref:System.Collections.Hashtable> argument.
25+
26+
## Change category
27+
28+
This change is a [*behavioral change*](../../categories.md#behavioral-change) and can also affect [*source compatibility*](../../categories.md#source-compatibility).
29+
30+
## Reason for change
31+
32+
## Recommended action
33+
34+
Pass `Hashtable` instead of a string to the <xref:System.Windows.Markup.XmlAttributeProperties.SetXmlNamespaceMaps%2A> API.
35+
36+
## Affected APIs
37+
38+
- <xref:System.Windows.Markup.XmlAttributeProperties.GetXmlNamespaceMaps(System.Windows.DependencyObject)?displayProperty=fullName>
39+
- <xref:System.Windows.Markup.XmlAttributeProperties.SetXmlNamespaceMaps%2A?displayProperty=fullName>

0 commit comments

Comments
 (0)