Description
Environment
Microsoft Visual Studio Professional 2022 (64-bit) - Current
Version 17.13.6
.NET version
Both .NET 80 and .NET90
Did this work in a previous version of Visual Studio and/or previous .NET release?
No response
Issue description
I have some queries regarding the usage of UITypeEditor in .NET Core using the out-of-process designer model.
Case 1: Nested UITypeEditor Usage Without Client Implementation
In our scenario, we are displaying a property (let’s say PropertyB) with a UITypeEditor inside a PropertyGrid hosted within a custom form — this form is shown from another UITypeEditor property (PropertyA) that is implemented by the client approach.
Here, the UITypeEditor for PropertyB works fine without the client implementation.
Question:
Can we safely use a UITypeEditor for a property inside another UITypeEditor without requiring the client-server approach?
Case 2: Nested Editor with Client Approach Fails
When using the client-server approach for the UITypeEditor of PropertyB, which exists inside another UITypeEditor, the editor for PropertyB does not work correctly.
This means the nested UITypeEditor for PropertyB fails to function properly when used within the client approach.
Question:
Is there a separate way to implement the client approach for a UITypeEditor for nested property?
Case 3: Unable to Retrieve IDesignerHost in .NET Core
Due to the issue described in Case 2, I have placed the UITypeEditor for PropertyB in .NET Core control library, where the EditValue method is triggered correctly. However, attempting to retrieve the IDesignerHost using:
IDesignerHost designerHost = provider.GetService(typeof(IDesignerHost)) as IDesignerHost;
always returns null.
Note:
- The same logic works as expected in the .NET Framework, where the IDesignerHost is successfully retrieved from the provider.
Question:
Could you please provide any suggestion or solution to get the DesignerHost inside the UITypeEditor?
Demo Sample:
CustomControlLibrary_WithSample&NuGet.zip
Replication video:
ReplicationVideo.mp4
Steps to reproduce
Replication: UITypeEditor with Client Approach Not Working
- Open the Designer.
- Click on the CustomControl and go to the Properties window.
- Open the custom form of the "PropertyA" property.
- Click the Add button.
- Try to edit the "PropertyBWithClient" property inside the custom form's property grid.
Observed Behavior:
The UITypeEditor implemented in the client project does not work.
Replication: UITypeEditor in .NET Core Control Library Unable to Get IDesignerHost
- Open the Designer.
- Click on the CustomControl and go to the Properties window.
- Open the custom form of the "PropertyA" property.
- Click the Add button.
- Try to edit the "PropertyBWithoutClient" property inside the custom form's property grid.
Observed Behavior:
IDesignerHost is null when using the UITypeEditor from a .NET Core control library.
Diagnostics