HandyOrg / HandyOrg/HandyControl
PropertyGrid: Nullable types unsupported
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Nullable properties, e.g. DateTime? are not detected as known by the PropertyResolver even though there is for example a DateTimePropertyEditor.
To Reproduce
Simply define any nullable property in the demo model which non-nullable type is known, e.g. DateTime? or similar.
Expected behavior
Should be supported due to the native nature of nullable types.
Environment:
- .net: 5.0
- IDE VS2019 latest
- Version 3.1.0
Fix is easily done by adding the following to the beginning of PropertyResolver::CreateDefaultEditor(Type type):
var underlyingType = Nullable.GetUnderlyingType(type);
if(underlyingType is not null)
{
type = underlyingType;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at PropertyResolver::CreateDefaultEditor(Type type) and review how known property types are matched, using DateTime? in the demo model as the reproduction case. Verify that nullable versions of supported types, including DateTime?, resolve to the existing editor, such as DateTimePropertyEditor, and confirm the demo behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100