You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Class define with DictionaryKeyPropertyAttribute still show All objects added to an IDictionary must have a Key attribute or some other type of key associated with them. error while building project.
Reproduction Steps
Define a class with DictionaryKeyPropertyAttribute.
[DictionaryKeyProperty("TargetType")]
public class MyStyle
{
public MyStyle()
{
}
public Type TargetType { get; set; }
}
I'm also wondering why this isn't working. I've checked the source to work out how it obtains the key from DictionaryKeyPropertyAttribute and can't see why it would work for built-in types but not for custom ones (but it's quite hard to follow, so I might have missed it).
Here seems to be where it gets key from the property named by the attribute, (also here, but doesn't seem to use the value for anything) which throws SR.MissingKey which I can't seem to find, but I can't see anything which restricts the types it works with.
But there are twoplaces where the MC3022 exception SR.ParserNoDictionaryKey is thrown.
Description
Class define with
DictionaryKeyPropertyAttribute
still showAll objects added to an IDictionary must have a Key attribute or some other type of key associated with them.
error while building project.Reproduction Steps
Define a class with
DictionaryKeyPropertyAttribute
.Use it in a xaml file.
Expected behavior
Build successful
Actual behavior
Build failed
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
No response
Other information
WpfApp1.zip
The text was updated successfully, but these errors were encountered: