-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Port IconEditor; add test #2089
Conversation
Codecov Report
@@ Coverage Diff @@
## release/3.1 #2089 +/- ##
=====================================================
- Coverage 26.51476% 26.51213% -0.00263%
=====================================================
Files 804 806 +2
Lines 268062 268164 +102
Branches 38066 38079 +13
=====================================================
+ Hits 71076 71096 +20
- Misses 191907 191991 +84
+ Partials 5079 5077 -2
|
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.
We need to add a type forwarding to System.Drawing.Design
Anyone started coordinating adding TypeDescriptor annotations to System.Drawing classes? As noted in #1119, #1120, #1121 ported editors for System.Drawing won't work otherwise, you'll have to discuss whether the correct place is to add the missing |
This is getting addresses via type forwarding - https://github.com/dotnet/winforms/blob/release/3.1/src/System.Design/src/System.Design.Forwards.cs |
@RussKie no, type forwarding just affects type resolution not association of the Editor to actual editable classes/properties, if you don't know which type to look for the type forwarding doesn't help. CoreFX removed For example the Editor attribute on the Icon class in Desktop Framework is not present in CoreFX - it just has a TypeConverter but no Editor. This means TypeDescriptor.GetEditor will return null. Like said elsewhere it would be useful to add unit tests checking e.g. Without this the ported editor may work in the VS Designer (if VS has its own TypeDescriptor overrides) but it won't work for e.g. PropertyGrid placed in user applications like in the three linked issues. IMHO if the ported editor is only for usage in VS it should be defined there and not in the WinForms repository, if its in WinForms I'd expect it to be usable in standalone PropertyGrid. |
@weltkante there are really two mechanisms to solve the issue of resolving an editor for a given type
The goal in ultimately to have So, with both of these mechanisms, there are really 2 equivalence classes of scenarios we care about:
All of that said.... |
Yeah thats what I was looking for, thanks for linking the file, wasn't aware that WinForms already had one. The issues I linked above (FontEditor, ColorEditor, ImageEditor) probably need to be added there as well, I'll drop a note in the issues. |
Happy to demystify! I have created an issue #2101 to create tests for these. I am having an issue right now where the following test fails but I would not expect it to based on the intrinsic table above... [Fact]
public void CollectionEditor_ICollection_HasEditor()
{
var editor = TypeDescriptor.GetEditor(typeof(ICollection), typeof(UITypeEditor));
Assert.NotNull(editor);
} Oddly it is failing in our tests project but when I do something like it in a |
^^ Thanks to @ericstj for helping me figure out the issue with the tests. We need a reference to the fascades |
bc1839f
to
b059a2a
Compare
@RussKie With respect to this, I think you should remove that file as it does not do anything. The Facades are generated automatically by the GenFacades target during the build. You should be able to test this yourself by running If this is not the case, then something is very wrong and you should talk to @dreddy-work and @Shyam-Gupta who did the work on generating these facades. |
b059a2a
to
35f1f4a
Compare
src/System.Windows.Forms.Design.Editors/tests/UnitTests/EnsureEditorsTests.cs
Outdated
Show resolved
Hide resolved
35f1f4a
to
c5844f5
Compare
Closes #2020
c5844f5
to
debccb0
Compare
@@ -27,6 +27,8 @@ static UITypeEditor() | |||
[typeof(ICollection)] = "System.ComponentModel.Design.CollectionEditor, " + AssemblyRef.SystemDesign, | |||
[typeof(byte[])] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign, | |||
[typeof(Stream)] = "System.ComponentModel.Design.BinaryEditor, " + AssemblyRef.SystemDesign, | |||
|
|||
// System.Windows.Forms type Editors | |||
[typeof(string[])] = "System.Windows.Forms.Design.StringArrayEditor, " + AssemblyRef.SystemDesign, | |||
|
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.
nit: group line 32 and 35 under the common header instead of repeating that header, and consider a more descriptive header.. editors that are used in ...
I have verified the behaviour without explicit type forwarding and it appears to be working as expected. |
Port Icon Editor for 3.1
Closes #2020
Microsoft Reviewers: Open in CodeFlow