-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix bug where x:Static argument is treated as member of 'SystemParameters' by mistake #680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs
Outdated
Show resolved
Hide resolved
|
Are you sure you want to fix this in the caller and don't want to put a fix in |
|
I really don't like this naming |
|
@weltkante Ok, I moved it. |
| if (found) | ||
| if (targetType.Assembly == XamlTypeMapper.AssemblyPF && | ||
| targetType.FullName == "System.Windows.SystemParameters" && | ||
| Enum.TryParse(srkField, out SystemResourceKeyID srkId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum.TryParse is not available on .NET 3.0 and 3.5 which support WPF and out variables require C# 7.0. Might be OK, just pointing out this is changing runtime and compilation requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This repository is for .NET Core 3+ only, so you can assume thats available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's SDK code, not runtime currently. And then, as far as I'm concerned, .Net Framework 3.0 and 3.5 are both out of support at present, so this code is impossible to be a part of them. However, you can build your .Net 3.0/3.5 WPF app without this bug with the help of this SDK.
What's more, it's unnecessary to build WPF app with SDK source code referenced. So it doesn't matter to use C# 7.0+. :)
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Thanks @KodamaSakuno for your contribution. |
Fixes #679
The issue is that the original code forgets to check
memberInfo's declaring type. When there's a property which shares a same member name ofSystemParametersorSystemResourceKeyID, it'll be treated as member ofSystemParameters.The following content is a part of compiled baml of issue demo. Generated by dnSpy.
Before:
After: