You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In .NET 9 Preview 6, serialization and deserialization of style using XamlWriter and XamlReader throws exception. But in .NET 8 and other framework versions, it works fine. Please find the code below.
In .NET 9 Preview 6, most of the setter tags do not have <Setter.Value> tags in the output file which results in the exception.
public string filePath = "style.xml";
StringWriter stringWriter = new StringWriter();
// for saving
Style style = new Style(typeof(System.Windows.Shapes.Path));
style.Setters.Add(new Setter(System.Windows.Shapes.Path.StretchProperty, Stretch.Fill));
style.Setters.Add(new Setter(System.Windows.Shapes.Path.FillProperty, Brushes.Black));
System.Windows.Markup.XamlWriter.Save(style, stringWriter);
File.WriteAllText(filePath, stringWriter.ToString());
// for loading
string xamlContent = File.ReadAllText(filePath);
// Parse the XAML content back into a Style object
using (StringReader stringReader = new StringReader(xamlContent))
{
using (XmlReader xmlReader = XmlReader.Create(stringReader))
{
Style loadedStyle = (Style)XamlReader.Load(xmlReader);
}
}
Reproduction Steps
Use the above codes to replicate the issue.
Expected behavior
Like other Net Frameworks and Core versions, the XAMLWriter should create the <Setter.Value> tag for the Fill property.
Actual behavior
the XAMLWriter has not created the <Setter.Value> tag for the Fill property.
Regression?
No response
Known Workarounds
No response
Configuration
Net 9 Preview 6
Other information
No response
The text was updated successfully, but these errors were encountered:
Description
In .NET 9 Preview 6, serialization and deserialization of style using XamlWriter and XamlReader throws exception. But in .NET 8 and other framework versions, it works fine. Please find the code below.
In .NET 9 Preview 6, most of the setter tags do not have <Setter.Value> tags in the output file which results in the exception.
Reproduction Steps
Use the above codes to replicate the issue.
Expected behavior
Like other Net Frameworks and Core versions, the XAMLWriter should create the <Setter.Value> tag for the Fill property.
Actual behavior
the XAMLWriter has not created the <Setter.Value> tag for the Fill property.
Regression?
No response
Known Workarounds
No response
Configuration
Net 9 Preview 6
Other information
No response
The text was updated successfully, but these errors were encountered: