Closed RobertvanderHulst closed 1 year ago
I do not understand why for 'Non Microsoft' languages you do not call the CodeDomProvider like you did before, call the Parse() method and then serialize the generated CodeCompileUnit and pass it to the External designer. And when the form was designed, you can do the reverse thing: send the revised CodeCompileUnit back and call GenerateCodeFromCompileUnit() to generate the code. This should not be too hard to implement, I think.
Do you think you could put together a PR?
@elachlan I would if I understood how the designer works. But that may take a while. To start with: where do I find the source for the external designer and the client part that is running inside VS?
It might not be something you can handle if its in the out of process designer. Since that is closed source.
Well, if you want to change something like this, then you will most likely have to change things on both the sender and the receiver side. If one side is closed source, then what can I do? But can you at least tell me where the open source part can be found. Not in this repo, at least I could not find it.
Sorry to give you the run around. Hopefully we can find a solution.
We haven't yet implemented anything with custom languages in the out of process designer, in part because we haven't had any requests for it. We can put this on the backlog and prioritize it with our other projects, but I will be transparent and say that the priority wouldn't be terribly high given lack of other requests. If we have enough requests then of course we could add support for the out of process designer.
I also recieved this error:
Exception occurred while disposing VSDesignSurface
System.InvalidOperationException: The service 'Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService' must be installed for this feature to work. Ensure that this service is available.
For this error message, maybe there is an issue in that the code isn't checking to see if there is a connected design surface?
Maybe for this specific issue, an NotSupportedException
(https://learn.microsoft.com/en-us/dotnet/api/system.notsupportedexception?view=net-7.0) for languages that are not supported?
@elachlan - I think you're right. We're only initializing the designer for languages that are known to VS ahead of time. I don't think this is something the WinForms team is prepared to change with our current priorities.
@merriemcgaw Are you serious? You are creating a replacement for a language agnostic Windows Forms editor, that uses a code model to communicate with the development language (C#, VB or any third party language that feeds the editor), and you replace it with a new editor that only understands C# and VB and you are not prepared to change that? Come on! You must be kidding. This is clearly a wrong design decision that needs to be corrected.
At this point there are no plans to disable the inproc designer, is there a reason that doesn't support your needs? The out of process support for Framework will be a workaround for Framework projects with 32bit references. Until your request, we've not received any customer feedback that we need to support all languages in the out of process designer. It's something that could be put on the backlog for some future date, but it's not on our current roadmap and we would likely need significant business justification to enable it, and it will likely not be for a while as we round out the support for other parts of .NET/.NET Framework in the out of process designer.
@merriemcgaw Isn't the new designer is Roslyn based? Would that make the change easier because of the abstraction? I have no feelings either way at this stage, but it would be quite cool if it supported additional languages with ease.
The inproc designer works for Framework projects, but our language (X#) also supports .Net 5/6/7/Core and to design forms for these versions of .Net our customers would need to use the external designer. And I am not asking for support for "all languages", I am asking that you keep the "old" method alive and let the project system provide a codedom for the Form and Form.Designer, and then serialize the codedom between the client and the designer. That should work with all languages, including C# and VB. Why invent a new system at all?
Environment
VS 2022 17.5.0 Preview 2 X# 2.14
.NET version
.Net Framework 4.7.2 (but same problem for all other versions of .Net Framework)
Did this work in a previous version of Visual Studio and/or previous .NET release?
Did not try this before
Issue description
We have a custom .Net language X#. We support the in process Windows Forms Designer. To do so, our language has is own CodeDomProvider. Whenever VS asks the project system for the codedomprovider we give it an instance of our own provider. We have also registered this provider inside machine.config, so the code generator gets called when necessary (for example to generate the code for WPF projects):
With the new out of process designer the forms do not load.
Steps to reproduce
Diagnostics