Skip to content

[GenAPI] Fix header handling in GenAPI and CSharpFileBuilder#46534

Merged
carlossanlop merged 3 commits intodotnet:mainfrom
carlossanlop:FixHeaderGenAPI
Feb 5, 2025
Merged

[GenAPI] Fix header handling in GenAPI and CSharpFileBuilder#46534
carlossanlop merged 3 commits intodotnet:mainfrom
carlossanlop:FixHeaderGenAPI

Conversation

@carlossanlop
Copy link
Copy Markdown
Contributor

Should fix the bug reported in dotnet/source-build-assets#1131

#46380 introduced a regression in GenAPI preventing the correct loading of the header file when specified. The modified code was assuming the passed string was the contents of the header, but in reality it was the header file path.

The fix consists in reading the contents of the file path in GenAPIApp and then pass that string to CSharpFileBuilder instead.

I also noticed we didn't have any tests to verify different headers, so I added a couple:

  • One that passes null, which causes CSharpFileBuilder to fallback to the default string.
  • Another one that passes a custom header (the one we normally use for our licensing).
  • The rest of the existing tests will keep using empty string (which is considered a valid header).

cc @MichaelSimons

@carlossanlop carlossanlop self-assigned this Feb 4, 2025
@carlossanlop carlossanlop requested a review from a team as a code owner February 4, 2025 23:42
@ghost ghost added Area-GenAPI untriaged Request triage from a team member labels Feb 4, 2025
@carlossanlop carlossanlop removed the untriaged Request triage from a team member label Feb 4, 2025
@carlossanlop carlossanlop enabled auto-merge (squash) February 4, 2025 23:44
@carlossanlop
Copy link
Copy Markdown
Contributor Author

/ba-g failures are unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants