This is a troubleshooting question. I hope this is considered a valid question for this forum. If not then please advise where I should move this question to. Also, this question is in addition to a question I asked here: .NET 5 Windows Forms with Dependency Injection - How to pass form properties from one form to another?
I am upgrading a .NET Framework Windows Form Application to .NET 5 using Dependency Injection (DI). The application has a form that uses a data factory
in order to have other form parameters passed into it (see question link above) and it is also restricted by the Active Directory (AD) group a user is in. When the form's constructor calls it's InitializeComponent()
method, all of the text box fields and labels come back with their Enabled
property set to false
, whereas in the .NET Framework version they come back as true
. Why is this happening?
Troubleshooting:
I copied the code from <fileName>.Design.cs
from both versions and ran a compare (using Notepad ++) on them. But, I did not see any change between the two that would lead me to conclude why the form's text boxes and tabs are coming back disabled. There are differences, but those only pertain to cell padding values, which I do not believe is causing the problem.
I checked Microsoft's .NET 5 Migration compatibility site for any potential breaking changes that might apply, but I did not see anything that stood out.
I have tried manually setting a form's TextBox Enable property to true, but this did not work. Plus, I don't think this is a good idea because it might break other functionality by potentially overriding some other behavior that locks a fields Enabled property.
this.textATtest.Enabled = true;
This returns false after the breakpoint in runtime.
All other forms in this .NET 5 solution are functioning and displaying properly. The only real difference that I can see between the current form and other forms in the project is that it implements a data factory
to pass in form parameters and restricts what users can access it base on what AD security group they are in. But, I don't think this is causing the problem because I am able to access the form just fine in the .NET Framework version.
Does anyone know how I can troubleshoot this problem? I have no idea how else the InitializeComponent()
method sets a forms properties other than in the <FileName>.Design.cs
file. Any help is greatly appreciated.