dotnet / project-system

The .NET Project System for Visual Studio
MIT License
968 stars 387 forks source link

The result in Core is inconsistent with Framework when adding a space for Default namespace #7253

Open Marie-Shi opened 3 years ago

Marie-Shi commented 3 years ago

Visual Studio Version: Version 16.11.0 Preview 1.0 [31319.401.d16.11]

Steps to Reproduce:

  1. Create a Winforms core application.
  2. Right click project to open properties window.
  3. Find Application page, change Default namespace from WinFormsApp5 to WinForms App5(there is a space), then press enter key.

Expected Behavior: For Framework, an error dialog pops up. issue3_fra

Actual Behavior: For Core, it can be changed successfully. Issue3-Core

More info:

  1. This issue can also repro in .NET Core WPF and console app.
  2. This is not a regression issue, it can also repro on 16.7.0 Preview 2.0.
drewnoakes commented 3 years ago

We currently perform no UI validation on input strings. We could add some. In #6907 I proposed adding a RegexPattern as optional metadata to string properties, which the UI could use to validate inputs. That approach could be a viable solution to this problem.

tmeschter commented 3 years ago

I don't think we will fix this for the current property pages but we should consider how we would deal with this for the new property pages.

tmeschter commented 2 years ago

One option is to have a property interceptor that strips out the space (or other unsupported characters).

drewnoakes commented 2 years ago

cc @adamint as you were looking for examples to apply validation to.