WinForms Designer SDK FAQ, Best Practices, News and Roadmap. #7073
-
.NET 5/6 has an out-of-process WinForms Designer and docs for its SDK were promised for the first quarter of 2022:
@KlausLoeffelmann First quarter of 2022 is over. Are docs for .NET WinForms Designer SDK ready? |
Beta Was this translation helpful? Give feedback.
Replies: 21 comments 15 replies
-
The whole idea of this out-of-process designer for .NET Core (5/6) is terrible because it doesn't work properly in real use cases. I am glad to hear about any updates on it, as well. |
Beta Was this translation helpful? Give feedback.
-
@bairog , @janseris , We're working on those docs, but they're taking a bit longer than expected. We'll be getting them out to everyone as soon as we can, I promise 😄 @janseris - we didn't have any other choice as far as making an out of process designer for .NET 5+ apps. Previously WinForms Designer was running in the same process as VS, devenv.exe, which runs on .NET Framework. We had to pull the designer out into it's own .NET 5(or whatever is targeted) process and create a communication channel back to the .NET Framework process that is VS. |
Beta Was this translation helpful? Give feedback.
-
@merriemcgaw meanwhile I discovered that it might be the VS Professional version instead of Community (I am always working on the latest previe of VS 2022) working well or the problem lies solely in third party control vendors (DevExpress) designer because I have created very complicated layout without using any DevExpress controls in a new WinForms project to test this again and surprisingly everything worked very smoothly. |
Beta Was this translation helpful? Give feedback.
-
@merriemcgaw Hope you will drop us a link as soon as docs (or at least a part of them) will be ready. |
Beta Was this translation helpful? Give feedback.
-
@bairog: Good news is, a really comprehensive demo for the SDK is 99% complete. I am in the process of documenting it, and it covers
We've decided to go public with that sample and a blog post first, so that folks will be able to start migrating, even with the docs not completed. Then, we'll be adding to the docs over time. As soon I will be able to provide further info, I'll make sure to post them here. |
Beta Was this translation helpful? Give feedback.
-
This part raises the most questions... If I have a local control - can I do without nuget? |
Beta Was this translation helpful? Give feedback.
-
What do you mean by local control? |
Beta Was this translation helpful? Give feedback.
-
I presume scenarios here could be:
|
Beta Was this translation helpful? Give feedback.
-
Ah, OK, yes, that makes sense. Well, if your Control Library includes controls that need a dedicated UI via custom Type Editors, then you are required to pack into a NuGet. The reason is, that the Client part needs to be loaded in the context of VS, and the Server part into the context of the DesignToolsServer. If not, so, if the Control needs let's say just custom adorners, action lists or custom CodeDom serializers, then no. You still need to build the Control Designers against the SDK, though, and you should have it in a dedicated project. But as soon as you need a custom UI for a Control Designer of the Library, those three assemblies/four projects, so the Client Part, the Server Part, the code for RPCs from Client to Server and the Packaging become a requirement. |
Beta Was this translation helpful? Give feedback.
-
Yes, this is exactly what I was afraid of :( But let's hope this is the worst thing that awaits us 😆 |
Beta Was this translation helpful? Give feedback.
-
While the work on the blog post is in progress, the complete SDK docs will take a while due to a shift in internal prios. |
Beta Was this translation helpful? Give feedback.
-
@KlausLoeffelmann
exception
|
Beta Was this translation helpful? Give feedback.
-
Yes, we're hoping it will make things a lot easier. And we will be investigating ways to simplify the building of controls as well as converting old controls. It's a process for sure. |
Beta Was this translation helpful? Give feedback.
-
They are still part of both the .NET and the .NET Framework runtime, although those types as a base for derived Editors in a Server-only scenario don't make sense, since they are never deployed: The .NET types cannot run in the context of VS, and the .NET Framework types lack the infrastructure to be deployed in a server-only scenario. What you can do though in a server-only scenario is to invoke the client-types. In this case the communication between Server (the DesignToolsServer) and Client (Visual Studio) is handled automatically in the background, but only for the respective data types. So, for just using the existing editors, you currently need to include their assembly qualified type names with the [Editor("System.Windows.Forms.Design.FileNameEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string? Filename { get; set; } Now, if you want to change the behavior of one of those editors in any way (or create new ones completely from scratch). then, yes, those editors must be running in the context of the Client. As long as you don't change the data types they are handling, you can just modify the editors in an assembly that targets the same TF version as the client, and the rest should work out of the box. But also yes, in that case your overridden types need to be loaded into the context of VS, and so you'd need to have the NuGet package deployment for that in place, even if you - in most cases - would not need to implement or change the underlaying communication between the DesignToolsServer and the client. Except you're handling different types. Can you, just for my own understanding of the use case, provide a description of what part of the editor you want to change and to what end? That would be helpful!
Can you clarify what you mean? What confuses me is that strong statement of yours, while you write at the same time "I understand the reason behind this". For a bit more explanation, and that may be helping also in the understanding of our motivation to do this, because this enormous effort that we're doing with rewriting the Designer is really, really not out of some "arbitrary good idea" someone from our team had. It's a real and urgent necessity: Because we are not only addressing the .NET/.NET Framework type-resolution problem with it, so that VS runs in the context of .NET Framework and cannot resolve types from a WinForms .NET app. Rather, we cannot change but need to address the fact that Visual Studio is only one Framework and one Bitness at a time. (So, 64-Bit and .NET Framework in the case of Visual Studio 2022.) Out of that fact, please be clear about this: We will also take the Framework Designer out of process to address the problem, that we cannot - for example - host certain 32-Bit-only .NET Framework components in the 64-bit-.NET-Framework-process running Visual Studio 2022+. So, the whole effort we're doing here does not have anything to do with abandoning any .NET (Framework) version over another. On the contrary! This is a rewrite to make sure, that no matter what bitness and version Visual Studio runs in, it will always be able to host any completely different bitness/.NET version combination of the WinForms app it's providing the Designer for! The documentation will certainly help to understand this better, but to finalize the documentation in a somewhat sane time frame, it needs more than just me working on that, so, we will be publishing not in one peace, but more and more of it over time. And all this said - please, by any means: Best Klaus |
Beta Was this translation helpful? Give feedback.
-
Oh, and sorry, I missed your last point!
Can you provide a small sample project for this? |
Beta Was this translation helpful? Give feedback.
-
@KlausLoeffelmann thank you for detailed answer. Especially the part about x86/x64 is something that is not quite obvious at first glance
I will try to...
And the short version:
But perhaps this is purely my subjective perception caused by the fact that over the years I had to keep legacy .Net Framework just for the sake of the designer's work...
Unfortunately I can't provide small project, because it's about
Here is commit with my draft port: kirsan31/winforms-datavisualization@17698a2. All places that raise questions are marked with |
Beta Was this translation helpful? Give feedback.
-
Well, I think from what your write, it's best to address 3 major issues, which might also be good to hear about for the rest of the community, so, again, what you write is very valuable!
I can't share this idea.
The sample has both the Client (.NET Framework)/Server (.NET) and the Server-only version in it. So, is the only fact that I might be missing here, that you don't like to support .NET Framework anymore?
One way or the other, we can of course discuss forever the "Ifs" and "Wetheres" - but that doesn't bring us one inch/cm closer to our goals. I'd suggest concentrating on solving immediate problems now, with the person-power which we all have at our disposal. And given the work, we need to do, it is of course limited, so, prioritizing, being agile, and also being able to pivot the direction for taking on the next issue area if necessary, is something, which is good and will happen once in a while. This might be leading to decisions which not everyone always likes. But if that happens, I think the most important part is to explain decisions as much as possible and keep the dialog alive. I think this will get the best results for all of us. |
Beta Was this translation helpful? Give feedback.
-
I also took the liberty to rename this issue, so people could easier assume to find answers to questions here, they are looking for. I think this is more inclusive. |
Beta Was this translation helpful? Give feedback.
-
@bairog, @kirsan31, @janseris, @merriemcgaw: |
Beta Was this translation helpful? Give feedback.
-
Well, unfortunately (and again, yes, I know!) the team has been tasks with other priorities in the meantime in the context of releasing .NET 7, and also, we're still thinking about in what scope we want to additionally address the considerable bigger effort that control libraries authors have, when we need to implement custom modal-dialog based type editors (let alone collection editors). So, I will be back (almost) full-time this week on working on this (@merriemcgaw, @RussKie: FYI). Please also note, that samples are still available here. Please also note the different branches in that repo, reflecting different levels of completion of the examples and documentation. In the meantime, if you have specific question or are blocked in any way, please feel free to reach out to me directly (Klaus Loeffelmann) via email [email protected]. |
Beta Was this translation helpful? Give feedback.
-
@KlausLoeffelmann <ItemGroup>
<Reference Include="System.Windows.Forms.DataVisualization">
<HintPath>..\winforms-datavisualization\src\System.Windows.Forms.DataVisualization\bin\$(Configuration)\$(TargetFramework)\System.Windows.Forms.DataVisualization.dll</HintPath>
</Reference>
</ItemGroup> Also @paul1956 reported about new problem ( you can't drop Chart on the form in any way) in VS 17.4.0 Preview 2.0 :( |
Beta Was this translation helpful? Give feedback.
@bairog , @janseris , We're working on those docs, but they're taking a bit longer than expected. We'll be getting them out to everyone as soon as we can, I promise 😄
@janseris - we didn't have any other choice as far as making an out of process designer for .NET 5+ apps. Previously WinForms Designer was running in the same process as VS, devenv.exe, which runs on .NET Framework. We had to pull the designer out into it's own .NET 5(or whatever is targeted) process and create a communication channel back to the .NET Framework process that is VS.