Description
Describe the bug
This is a heads-up for you, when running this app with .NET 9, it fails to be launched with an exception: System.Windows.Markup.XamlParseException: ''Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '17' and line position '18'.'
After dev team investigated, it is reproduced as this application uses a DynamicResource
incorrectly. Please see more details from dotnet/wpf#9475
To Reproduce
Steps to reproduce the behavior:
1.Open "C:\ReproAppSource\Text-Grab\Text-Grab.sln" with Visual Studio.
2. Build the solution.
3. Update bin\Debug\net8.0-windows10.0.20348.0\Text-Grab.runtimeconfig to run against with dotnet-sdk-9.0.100-preview.7.24375.12:
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "9.0.0-preview.7.24374.12"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "9.0.0-preview.7.24375.4"
}
- Press F5 to start the app.
Expected behavior
App should be launched successfully.
Actual behavior
App launch failed with exception thrown in Visual Studio:
System.Windows.Markup.XamlParseException: ''Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '17' and line position '18'.'
`
Inner Exception
InvalidOperationException: '#FF1C1C1C' is not a valid value for property 'Color'.
Stack Trace:
at System.Windows.DependencyObject.EvaluateExpression(EntryIndex entryIndex, DependencyProperty dp, Expression expr, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry)
at System.Windows.DependencyObject.EvaluateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, OperationType operationType)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.ResourceReferenceExpression.InvalidateExpressionValue(Object sender, EventArgs e)
at System.Windows.DependencyObject.OnInheritanceContextChanged(EventArgs args)
at System.Windows.DependencyObject.ProvideSelfAsInheritanceContext(DependencyObject doValue, DependencyProperty dp)
at System.Windows.ResourceDictionary.AddInheritanceContextToValues()
at System.Windows.ResourceDictionary.set_Source(Uri value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)