Multi Select Enum Editor (UITypeEditor) Not Working Properly in .NET Core
Environment
Visual Studio 2026 - version 18.0.2
.NET version
.NET 80, .NET90 and .NET10
Did this work in a previous version of Visual Studio and/or previous .NET release?
No
Issue description
Case 1: Comparsion of Net Framework and UITypeEditor Usage Without Client/Server Implementation
In .NET Framework, the custom EnumEditor (derived from UITypeEditor) works as expected. It displays a dropdown editor with checkboxes and a reset button. In .NET Core, the same editor does not render correctly — the checkboxes and button are missing from the dropdown.
Case 2: UITypeEditor Usage With Client/Server Approach Fails
We attempted to use the EnumEditor on the client side in a .NET Core client/server approach. The editor still fails to render properly and throws an ArgumentException. Upon further analysis, we found that the value parameter in the EditValue method does not contain the expected enum value. Instead, it shows the: "Cannot evaluate expression since the function evaluation requires all threads to run."
Additionally, based on this query - https://github.com/dotnet/winforms/issues/13987
We reviewed the internal issue link you provided, but unfortunately, it's not accessible to us and returns a 404 error. Regarding the blog post you shared (https://devblogs.microsoft.com/dotnet/custom-controls-for-winforms-out-of-process-designer/), we had already received it as a recommendation earlier and have implemented the client-server approach based on the guidance provided there.
However, even after implementing the client-server model, we are still facing issues with enum types not being handled correctly. Could you please provide further guidance or a more specific solution to address this issue?
.NET Core Demo Link CustomControlLibrary.NetCore._WithSample.Nuget.zip
.NET Framework Demo Link
CustomControlLibrary.NetFramework._WithSample.Nuget.zip
Issue Replication Video
.NET Framework
https://github.com/user-attachments/assets/6eaff698-e1e1-4c1f-b496-b01f463d0064
.NET Core
https://github.com/user-attachments/assets/17d7ed0c-68c8-4d27-82a8-124e9695815c
Steps to reproduce
- Open the Designer.
- Click the CustomControl and go to the property window.
- Now, open the dropdown of the "CustomProperty" property.
Note: An exception occurs when we click the dropdown again or click on the property window after opening the dropdown.
Observed Behavior - The UITypeEditor implemented in the client project does not work. Expected Behavior - The UITypeEditor implemented in the client project should work properly.
Diagnostics
The fact that TypeRoutingProvider.cs and CustomEditor.cs are not in the same namespace is causing CustomEditor to be unrecognized. You can add if (!Debugger.IsAttached){ Debugger.Launch();} in CustomEditor.cs to determine if it is being called.
Hi @LeafShi1 ,
Thank you for the suggestion. I understand that the namespace mismatch between TypeRoutingProvider.cs and CustomEditor.cs can cause CustomEditor to be unrecognized, and I will correct that.
However, my main concern is the “Cannot evaluate expression because all threads are not running” issue that occurs when the WinForms Designer invokes the UITypeEditor. Could you please confirm whether resolving the namespace mismatch alone will also address this error?
Hi @LeafShi1 , Thanks for the suggestion. The CustomEditor class is being recognized and invoked correctly. Since I added the namespace properly in the TypeRoutingProvider class.
Hi @LeafShi1 , Thanks for the suggestion. The CustomEditor class is being recognized and invoked correctly. Since I added the namespace properly in the TypeRoutingProvider class.
Does your original question still exist?
Hi @LeafShi1, Yes the issue still exists.
Hi guys, Any update?
Hi Team, Any update?
The root cause of the original error is that the source code "forcibly treats the enum as an int." You can try using ulong for bitwise operations and return an "enum instance."