Open vsfeedback opened 2 years ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @ajcvickers, @bricelam, @roji See info in area-owners.md if you want to be subscribed.
Does this reproduce for all project or specific project? If it’s reproduce with the specific project, which project do you use(C# , C++ console, Web, UWP or others )? In order for us to investigate this further, could you please provide repro steps, a more detailed description of the faulty behavior and the actions you were taking when the issue appeared to help us better understand this scenario? What is the actual result and which result do you expect to happen?
#### fewane on 10/11/2021, 08:27 AM:If I use the Record type as a parameter in a controller (Api) or as a data model in a Blazor component (Blazor WebAssembly), the attributes are automatically applied.
On the other hand, if I manually call the validation (Validator.TryValidateObject(…)) on the same type Record (Api or Blazor WebAssembly), the attributes are not called (as you can see on the test code).
I need it to apply a cross validation in another module (which receives the type as parameter) with a design pattern (decorator). The module is a library in C# .Net 6 RC1.
#### Feedback Bot on 10/18/2021, 09:32 AM:We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
#### Feedback Bot on 10/26/2021, 00:43 PM:Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.
#### Feedback Bot on 10/26/2021, 10:26 PM:We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
#### Luna Mi [MSFT] on 1/21/2022, 09:30 AM:Thank you for taking the time to log this issue! Did you still reproduce this issue in the latest stable version of Visual Studio installed from https://visualstudio.microsoft.com/downloads ?
If so, could you please provide a sample solution that has this problem so that we can conduct further research?
We look forward to hearing from you!
#### fewane on 1/21/2022, 11:28 AM:System : Windows 11 Pro
Visual Studio 2022 Version 17.0.5
.Net 6 (6.0.1)
Yes, the problem occurs again. However, by applying the appropriate target attribute, it works.
Changing
public record RecordTest([ValidationTest] string Value);
To
public record RecordTest([property : ValidationTest] string Value);
#### Feedback Bot on 1/24/2022, 09:45 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
--- ### Original Solutions (no solutions)Author: | vsfeedback |
---|---|
Assignees: | - |
Labels: | `area-System.ComponentModel.DataAnnotations`, `untriaged` |
Milestone: | - |
@pranavkm @mkArtakMSFT Is validation of record types important to Blazor or MVC? In other words, is it something you might want to put resources on to implement?
@rafikiassumani-msft owns this particular area of MVC, so he'd be the one to make a decision here.
I'm also interested on support Validation on records
Lost a huge deal of time before I find this issue.
Records are a perfect fit for model binding in MVC and azure functions, hence quite important to support validation.
This issue has been moved from a ticket on Developer Community.
Is this an expected behavior or a bug?
System : Windows 11 Pro Visual Studio 2022 Version 17.0.0 Preview 4.1 .Net 6 RC 1 (the lastest version)
Original Comments
null on 10/11/2021, 07:19 AM:
Does this reproduce for all project or specific project? If it’s reproduce with the specific project, which project do you use(C# , C++ console, Web, UWP or others )? In order for us to investigate this further, could you please provide repro steps, a more detailed description of the faulty behavior and the actions you were taking when the issue appeared to help us better understand this scenario? What is the actual result and which result do you expect to happen?
fewane on 10/11/2021, 08:27 AM:
If I use the Record type as a parameter in a controller (Api) or as a data model in a Blazor component (Blazor WebAssembly), the attributes are automatically applied.
On the other hand, if I manually call the validation (Validator.TryValidateObject(…)) on the same type Record (Api or Blazor WebAssembly), the attributes are not called (as you can see on the test code).
I need it to apply a cross validation in another module (which receives the type as parameter) with a design pattern (decorator). The module is a library in C# .Net 6 RC1.
Feedback Bot on 10/18/2021, 09:32 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Feedback Bot on 10/26/2021, 00:43 PM:
Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.
Feedback Bot on 10/26/2021, 10:26 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Luna Mi [MSFT] on 1/21/2022, 09:30 AM:
Thank you for taking the time to log this issue! Did you still reproduce this issue in the latest stable version of Visual Studio installed from https://visualstudio.microsoft.com/downloads ?
If so, could you please provide a sample solution that has this problem so that we can conduct further research?
We look forward to hearing from you!
fewane on 1/21/2022, 11:28 AM:
System : Windows 11 Pro
Visual Studio 2022 Version 17.0.5
.Net 6 (6.0.1)
Yes, the problem occurs again. However, by applying the appropriate target attribute, it works.
Changing
public record RecordTest([ValidationTest] string Value);
To
public record RecordTest([property : ValidationTest] string Value);
Feedback Bot on 1/24/2022, 09:45 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)