Skip to content

When using .NET9 pre7 build and run, will throw System.Windows.Markup.XamlParseException #9582

@ssccinng

Description

@ssccinng

Description

image

When using the above code, an error will be thrown

System.Windows.Markup.XamlParseException
HResult=0x80131501
Message=“在“System.Windows.StaticResourceExtension”上提供值时引发了异常。”,行号为“12”,行位置为“10”。
Source=PresentationFramework
StackTrace:
在 System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
在 System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
在 System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
在 System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
在 System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
在 WpfBugTest.MainWindow.InitializeComponent() 在 D:\wcsrepo\WpfBugTest\MainWindow.xaml 中: 第 1 行

此异常最初是在此调用堆栈中引发的:
[外部代码]

内部异常 1:
IndexOutOfRangeException: Index was outside the bounds of the array.

Reproduction Steps

https://github.com/ssccinng/WpfBugTest

Run it using the latest preview version

Please note that this error does not occur when selecting net9 for the targetframework, but only when selecting net8
net8.0-windows

Expected behavior

not throw error

Actual behavior

throw error

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    InvestigateRequires further investigation by the WPF team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions