Skip to content

Invalid BAML generated #9636

@drolevar

Description

@drolevar

Description

When I build an app containing the following XAML with 9.0.0-preview.7, it's compiled into an unreadable BAML:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="DefaultAccessTextStyle" TargetType="{x:Type AccessText}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
    </Style>

    <Style
        x:Key="{x:Type AccessText}"
        BasedOn="{StaticResource DefaultAccessTextStyle}"
        TargetType="{x:Type AccessText}" />

</ResourceDictionary>

image

Reproduction Steps

Build and run the attached project:

WpfApp1.zip

Expected behavior

Windows is shown:

image

Actual behavior

Exception is thrown:

image

Regression?

This has worked with NET 8.0.

Known Workarounds

No response

Impact

Cannot build with .NET 9.0.0-preview.7.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions