Winforms: The first runtime behavior is not correct after changed TextBox's PasswordChar value from one to another

Created on 13 May 2020  Â·  5Comments  Â·  Source: dotnet/winforms

  • .NET Core Version:
    .Net Core 5.0 from master branch: 5.0.100-preview.5.20262.7

  • Have you experienced this same bug with .NET Framework?:
    No

Minimal repro:

  1. Create a Winforms Core application
  2. Add a TextBox control to form designer, and set its PasswordChar property to value ‘*’,
  3. Run this application and input some string in TextBox
  4. Close runtime, and change its PasswordChar property to value ‘&’,
  5. Run this application and input some string in TextBox
  6. Stop debugging, and run this application again, and input some string in TextBox

Actual behavior:
After step5, the displayed text in TextBox still is ‘*’, not ‘&’. --- it is not right behavior, and checked the code in form1.designer.cs file, the value is correct. Please see following screenshot:
image

After step6, the displayed text in TextBox is '&'. --- it is right behavior

Expected behavior:
TextBox text display in runtime keeps same as the setting of TextBox’s PasswordChar all the time

bug regression

All 5 comments

Probably a bug in VS, I notice the * symbol on the file tab indicating unsaved changes. When you run in step 5 VS should have saved pending changes and recompile, apparently it didn't.

I have noticed some problems similar to this myself where VS doesn't sync documents correctly when you have both Designer and Source open at the same time.

That's a great catch - it looks like the save that usually happens didn't get saved. @Olina-Zhang - is this a repeatable behavior? Or once you build again everything is good? Is it happening with every new app or just this one solution? Finally, are you using the classic designer or the Core designer? If it's Core designer and it happens with lots of projects we'll move this issue over there because we're actively working on that.

@merriemcgaw Yes, this issue repros when app is not saved state. I use Core designer to add control for this issue, and just found above scenario can repro issue. If build application before run it directly, this issue cannot repro. And if doing above scenario and changing TextBox's PasswordChar value consecutively in one solution, it can repro every first time because app is in unsaved state.

@Olina-Zhang A few more clarifications if you would:

  1. What is the menu command you're using to run?
  2. Can you get the same behavior on .NET Framework?

Thanks!

@JeremyKuhne using VS toolbar: application name to run or pressing F5, Ctrl+F5 Keyboards all can repro this issue, and cannot repro it when doing same scenario in .Net framework.

Was this page helpful?
0 / 5 - 0 ratings