Addresses an issue with collection expressions in C# 12 #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have identified an issue with Blazored/FluentValidation following the migration to .NET 8.0 and C# 12. Since we work with Fluxor, all our data is immutable. Moreover, we use the IReadOnlyList<> interface for lists throughout.
With the new C# 12 syntax for list initialization, a "standard" list/array is no longer created; instead, a type named "<>z__ReadOnlyArray" is generated. This new type neither possesses an Item property nor can it be converted into an object array. The code in the
ToFieldIdentifier
method within theEditContextFluentValidationExtensions
class throws an exception as a result.The following example demonstrates the problem (Note: the code must be compiled with C# 12, and we have tested with Visual Studio 17.9.0):
This pull request makes the code compatible again with IReadOnlyList and features from C# 12. We request a swift integration and release of a new Nuget package, as our validation currently does not work.
Thank you for your assistance.