Repository navigation
Description
-
.NET Core Version:
TargetFramework: net5.0-windows
SDKs: 6.0.100-rc.1.21463.6, 5.0.401 -
Have you experienced this same bug with .NET Framework?: Haven't tried
Problem description:
When I try to edit a control from the designer. The designer will remove needed parts of the code from *.Designer.cs which results in run-time errors.
Expected behavior:
Designer doesn't remove necessary code.
Minimal repro:
- Open control in designer
- Edit a property
Designer removed the assignment of two fields resulting in NullReferenceExceptions at run-time.
winforms-designer-repro.mp4
Code after designer changes New after changes
NOTE: I inherited this code and have never used the designer on this control before, so maybe something the designer.cs or resx files are invalid in some way?
dotnet --info
❯ dotnet --info
.NET SDK (reflecting any global.json):
Version:
Commit: e627d556a1Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-rc.1.21463.6\Host (useful for support):
Version: 6.0.0-rc.1.21451.13
Commit: d7619cd4b1.NET SDKs installed:
3.1.409 [C:\Program Files\dotnet\sdk]
5.0.400 [C:\Program Files\dotnet\sdk]
5.0.401 [C:\Program Files\dotnet\sdk]
6.0.100-rc.1.21463.6 [C:\Program Files\dotnet\sdk].NET runtimes installed:
Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Activity
Tanya-Solyanik commentedon Oct 5, 2021
DevExpress package used in the project probably does not have the Code designers.
MisinformedDNA commentedon Oct 5, 2021
But the ones disappearing are a
DataSetand aTableAdapter. Also, DevExpress has a pretty mature library, if there is a bug with their code, I'd love to be able to tell them what is wrong. I spent hours narrowing this down, so any help is much appreciated.MisinformedDNA commentedon Oct 5, 2021
@Tanya-Solyanik I didn't want to edit the designer file for my repro, but I went ahead and did it. DevExpress is now removed as a dependency. I updated main and here's the new change commit. Same issue.
RussKie commentedon Oct 5, 2021
@MisinformedDNA have you contacted DevExpress?
MisinformedDNA commentedon Oct 5, 2021
@RussKie I shared a repro with DevExpress removed. It's clearly not them.
MisinformedDNA commentedon Oct 7, 2021
I've also tested this on VS 2019 and 2022 previews that do not have any DevExpress extensions installed.
dreddy-work commentedon Oct 8, 2021
@KlausLoeffelmann , can you take a look at the sample here and see anything stand out?
MisinformedDNA commentedon Oct 20, 2021
@KlausLoeffelmann Have you had a chance to look?
MisinformedDNA commentedon Nov 4, 2021
@KlausLoeffelmann @dreddy-work Can I get some help? How do I get this resolved?
KlausLoeffelmann commentedon Nov 4, 2021
Hey @MisinformedDNA,
thanks for reporting that. We would need a repo which doesn't use a third party custom control, of which we don't know how compatible it is with the new designer.
Please also note that Designer support for Typed DataSets is limited for .NET WinForms Apps, since the Data Source Provider Service (which are necessary for maintaining Typed DataSets and get the necessary components into a Form/UserControl on demand) is not available for .NET apps.
That said, the most important scenarios we enabled (in WinForms! WPF is a different story, btw) without resorting to the Data Source Provider Service, so, I'd be interested if we can find a purely WinForms based scenario for this, since this would need to be fixed then!
MisinformedDNA commentedon Nov 4, 2021
@KlausLoeffelmann The project does not depend on a 3rd party, that dependency was removed Oct 5 (see above).
The note about designer support for Typed DataSets is more of an FYI, since I'm using WinForms? Is that correct?
4 remaining items
MisinformedDNA commentedon Dec 1, 2021
@KlausLoeffelmann Any update?
RussKie commentedon Dec 2, 2021
@KlausLoeffelmann is currently OOF. With the holiday season is almost upon us our responses may be delayed.
KlausLoeffelmann commentedon Dec 2, 2021
That said, I know my debt, even watching my Mom-visiting-from-Germany backing Holiday cookies. Will take a while though, still... 🎅
merriemcgaw commentedon Feb 25, 2022
@KlausLoeffelmann getting this back on your radar.
KlausLoeffelmann commentedon Feb 25, 2022
Follow up question:
From your demo, I can't really see for component the generated code is swallowed.
Can you provide the sample without any references to third party controls, so I can debug into the repo?
Are you using a .NET Framework control by any chance in the context of a .NET (Core) application?
MisinformedDNA commentedon Feb 27, 2022
You guys keep asking about a sample without third party controls, but the linked code in OP does not use any third party controls.
merriemcgaw commentedon Oct 23, 2024
@Olina-Zhang can your team attempt a repro and close this if we don't see the issue any more?