-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation Failure on Generated Record Constructor for .NET 6 #5
Labels
bug
Something isn't working
Comments
MooVC
added a commit
that referenced
this issue
Aug 5, 2024
- The fully qualified type information for the subject upon which Fluentify has been placed is now captured and utilized when generating extensions, thereby enabling support for nest classes (#3). - Utilized Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing to improve the quality of the Generator tests. ## Fixed - The generated code files for classes now apply a conditional preprocessor directive to #nullable calls to prevent compilation failure in .NET Standard 2.0 projects. - The generated extensions no longer call ArgumentNullException.ThrowIfNull to prevent compilation failure in .NET Standard 2.0 projects. - The generated extensions no longer use pattern matching to prevent compilation failure in .NET Standard 2.0 projects. - The generated constructor for records now applies a preprocessor directive to the SetRequiredMembers attribute to prevent compilation failure in .NET 6 projects (#5).
MooVC
added a commit
that referenced
this issue
Aug 5, 2024
* ## Changed - The fully qualified type information for the subject upon which Fluentify has been placed is now captured and utilized when generating extensions, thereby enabling support for nest classes. #3 * ## Changed - The fully qualified type information for the subject upon which Fluentify has been placed is now captured and utilized when generating extensions, thereby enabling support for nest classes (#3). - Utilized Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing to improve the quality of the Generator tests. ## Fixed - The generated code files for classes now apply a conditional preprocessor directive to #nullable calls to prevent compilation failure in .NET Standard 2.0 projects. - The generated extensions no longer call ArgumentNullException.ThrowIfNull to prevent compilation failure in .NET Standard 2.0 projects. - The generated extensions no longer use pattern matching to prevent compilation failure in .NET Standard 2.0 projects. - The generated constructor for records now applies a preprocessor directive to the SetRequiredMembers attribute to prevent compilation failure in .NET 6 projects (#5). * ## Fixed - The generated code files no longer include the namespace if the containing namespace is global (#6). * Refactored unit tests to utilize the same snippets for coarse and fine grain API tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The generated constructor for a record type applies the SetsRequiredMembers attribute, however, this was added in .NET 7, resulting in a compilation failure in projects targeting .NET 6.
To Reproduce
The constructor is generated when the record is marked as partial. To reproduce:
Expected behavior
The code should compile.
Environment (please complete the following information):
Additional context
CS0246 The type or namespace name 'SetsRequiredMembers' could not be found (are you missing a using directive or an assembly reference?)
The text was updated successfully, but these errors were encountered: