Skip to content

Add #pragma warning disable to generated code headers - #33

Closed
IngbertPalm wants to merge 1 commit into
lofcz:nextfrom
IngbertPalm:next
Closed

Add #pragma warning disable to generated code headers#33
IngbertPalm wants to merge 1 commit into
lofcz:nextfrom
IngbertPalm:next

Conversation

@IngbertPalm

Copy link
Copy Markdown
Contributor

The source code generated by FastCloner.SourceGenerator generates unnecessary CS8602 and CS8604 warnings during compilation.

image

Added lines to the generated source code to avoid warnings.

Copilot AI review requested due to automatic review settings March 9, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the FastCloner source generator output to suppress nullable-related compiler warnings emitted by generated code, reducing noise during consumer compilation.

Changes:

  • Add #pragma warning disable to the generated header in context-based generated files.
  • Add #pragma warning disable to the generated header in per-type clone extension generated files.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/FastCloner.SourceGenerator/ContextCodeGenerator.cs Adds a warning-suppression pragma to the generated context file header.
src/FastCloner.SourceGenerator/CloneCodeGenerator.cs Adds a warning-suppression pragma to the generated clone extension file header.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/FastCloner.SourceGenerator/ContextCodeGenerator.cs
Comment thread src/FastCloner.SourceGenerator/CloneCodeGenerator.cs
@lofcz

lofcz commented Mar 9, 2026

Copy link
Copy Markdown
Owner

I'd rather generate warning free code, can you contribute an example of what currently generates warnings?

@IngbertPalm

Copy link
Copy Markdown
Contributor Author

Here's a small sample that generates the compilation warnings.

CloneTest.zip

Kind regards,

Ingbert

@lofcz

lofcz commented Mar 10, 2026

Copy link
Copy Markdown
Owner

@IngbertPalm thanks for the repro, fixed in #34. I'll add you as co-author to one of the commits.

@lofcz lofcz closed this Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants