Skip to content
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

Extensions fail to generate when Class is placed in the Global Namespace #6

Closed
MooVC opened this issue Aug 4, 2024 · 0 comments · Fixed by #7
Closed

Extensions fail to generate when Class is placed in the Global Namespace #6

MooVC opened this issue Aug 4, 2024 · 0 comments · Fixed by #7
Assignees
Labels
bug Something isn't working

Comments

@MooVC
Copy link
Owner

MooVC commented Aug 4, 2024

Describe the bug
When the class is placed in the global namespace, the follow error is produced:

Generator 'ClassGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The hintName '.ActorExtensions.BornIn.g.cs' contains an invalid character '<' at position 0. (Parameter 'hintName')'.

To Reproduce
Apply Fluentify to a class or record that is not declared within the scope of a namespace.

Expected behavior
The extensions should be generated in the same way as it is when the class belongs to an explicitly defined namespace.

Environment (please complete the following information):

  • Fluentify Version: 1.0.0
  • .NET Version (Your Project): NET 8.0.200

Additional context
Copied from comment

https://www.linkedin.com/feed/update/urn:li:groupPost:40949-7225261492227485696?commentUrn=urn%3Ali%3Acomment%3A%28groupPost%3A40949-7225261492227485696%2C7225710491216572416%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287225710491216572416%2Curn%3Ali%3AgroupPost%3A40949-7225261492227485696%29

@MooVC MooVC added the bug Something isn't working label Aug 4, 2024
@MooVC MooVC self-assigned this Aug 4, 2024
MooVC added a commit that referenced this issue Aug 5, 2024
- The generated code files no longer include the namespace if the containing namespace is global (#6).
@MooVC MooVC linked a pull request Aug 5, 2024 that will close this issue
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
@MooVC MooVC closed this as completed in #7 Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant