question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update Winforms C#/VB templates designer code in InitializeComponent() for modernized CodeDom Serialization

See original GitHub issue

.NET version

8.0.100-alpha.1.22607.6

Did it work in .NET Framework?

N/A

Did it work in any of the earlier releases of .NET Core or .NET 5+?

N/A

Issue description

WinForms Designer GH https://github.com/microsoft/winforms-designer/pull/4425 for OutOf-Proc Designer had modernized CodeDom serialization, code for InitializeComponent(), is generated taking into account .editorconfig preferences and <ImplicitUsings>enable</ImplicitUsings> project property. However, Winforms C#/VB templates do not respect these settings.

Template Winforms C# designer code: — need to update image After added a button with modernized CodeDom serialized code image

Template Winforms VB designer code: — need to update image After added a button with modernized CodeDom serialized code image

Steps to reproduce

  1. Just create a Winforms .Net C#/VB application
  2. Go to Form designer file, check the code in InitializeComponent()

Issue Analytics

  • State:open
  • Created 9 months ago
  • Reactions:4
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
merriemcgawcommented, Dec 8, 2022

I’m OK changing the templates in .NET 8 to match the new codegen. In fact it looks much cleaner. We’ll do a brag blog to talk about the modern codegen and that should alleviate a lot of the confusion from most people.

1reaction
KlausLoeffelmanncommented, Dec 8, 2022

We should do it via .editorconfig, but there will be things, which will not be picked up or be configured. And that’s fine. There will be differences, and ultimately, we will introduce even breaking changes. (Think of NameOf).

That’s what we knew and wanted when @DustinCampbell started the work on it.

The whole point IS to modernize, and introduce modern styles, approaches and paradigms. Let’s please not be afraid of reasonable breaking changes. There will be no confusion for customers, as long, as we’re documenting and reason our changes. @merriemcgaw FYI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Updated Modern Code Generation for WinForm's ...
When you design a WinForms Form, it gets generated into a method called InitializeComponent. When you reopen that Form, it gets recreated by ......
Read more >
How to modify code written in InitializeComponent method ...
Let's say I wish to change the following line in the InitializeComponent of WinForms From: this.myBtn.ImageAlign = System.Drawing.
Read more >
CodeDOM Serialization | Reporting
The Code Document Object Model (CodeDOM) serialization is a legacy way to store DevExpress report layouts and report style sheets. A report engine...
Read more >
Leveraging .NET Components and IDE Integration: UI AOP ...
An in-depth exploration of the features and the power of .NET Component Model architecture, its integration with the IDE at design-time and ...
Read more >
Visual Studio designer, CodeDom and InitializeComponent()
The problem was that we were able to add new methods to the form, but despite our attempts nothing was added to InitializeComponent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found