Description
Description
After the original bug [dotnet-sdk-9.0.100-preview.7.24352.8] WPF apps launch failed with exception 'Value cannot be null. (Parameter 'key')' fixed on dotnet-sdk-9.0.100-preview.7.24375.12, there is a new issue. The app still fails to be launched but it throws a new exception: System.Windows.Markup.XamlParseException: ''Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '17' and line position '18'.'
We prepared the repro machine for your investigation. Please get the information from internal bug
Reproduction Steps
Debug Repro steps:
Please get the repro machine from the internal bug
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
Expected Result:
App should be launched successfully.
Actual behavior
Actual Result:
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)
Regression?
Yes
Verify Scenarios:
1). Windows 10 21H2 AMD64 + dotnet-sdk-8.0.300: Pass
2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.7.24375.12: Fail
Known Workarounds
No response
Impact
No response
Configuration
Application Name: Text-Grab
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-preview.7.24352.8
App or source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2173218
Github Link:
https://github.com/TheJoeFin/Text-Grab
Dotnet Info:
.NET SDK:
Version: 9.0.100-preview.7.24375.12
Commit: 9a99a3bf32
Workload version: 9.0.100-manifests.57c130fb
MSBuild version: 17.12.0-preview-24374-02+48e81c6f1
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100-preview.7.24375.12\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 9.0.0-preview.7.24374.12
Architecture: x64
Commit: static
.NET SDKs installed:
9.0.100-preview.7.24375.12 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0-preview.7.24373.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0-preview.7.24374.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 9.0.0-preview.7.24375.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other information
App Repro steps
- Open "C:\ReproApps\Text-Grab\Text-Grab.runtimeconfig.json" file .
- Change the "Text-Grab.runtimeconfig" file to let the app run against with dotnet-sdk-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"
}
- Launch Text-Grab.exe.
Expected Result:
Launch successfully.
Actual Result:
Launch failed.
Open Event Viewer, we can see below detailed stack trace message:
Application: Text-Grab.exe
CoreCLR Version: 9.0.24.37412
.NET Version: 9.0.0-preview.7.24374.12
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException: Set property 'System.Windows.ResourceDictionary.Source' threw an exception.
---> System.InvalidOperationException: '#FF1C1C1C' is not a valid value for property 'Color'.
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)
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Text_Grab.App.InitializeComponent() in C:\Users\v-shisheng\Desktop\Text-Grab\Text-Grab\App.xaml:line 1
at Text_Grab.App.Main()
Findings:
This is also "System.Windows.Markup.XamlParseException" exception, which is similar with bug [dotnet-sdk-9.0.100-preview.7.24352.8] WPF apps launch failed with System.Windows.Markup.XamlParseException, but the stack trace is different. It is thrown at ``System.Windows.DependencyObject.EvaluateExpression(EntryIndex entryIndex, DependencyProperty dp, Expression expr, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry)```
@dotnet-actwx-bot @dotnet/compat