Skip to content

fix(csharp): Fallback init to set #6613

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

Merged
merged 5 commits into from
Mar 31, 2025
Merged

Conversation

Swimburger
Copy link
Member

Description

Fallback from init to set on .NET Framework & .NET Standard 2.0 for public and protected properties.
This ensures the properties can be set on older TFMs without compilation errors.

Testing

  • Unit tests added/updated
  • Manual testing completed

Copy link

github-actions bot commented Mar 31, 2025

@amckinney
Copy link
Member

Discussed offline w/ @Swimburger -

I think we should just always use set - the generated code is otherwise way worse to look at, and it only gives us the added benefit of property immutability for Net5.0+ users. This feature isn't actually crucial - it's common for users to modify the value of a parameter after the property has been set.

We could see an argument for including the switch in the ClientOptions and RequestOptions types, but even then I think it's simplest to just use set everywhere.

@Swimburger Swimburger merged commit 102d2f1 into main Mar 31, 2025
17 of 18 checks passed
@Swimburger Swimburger deleted the niels/csharp/remove-inits branch March 31, 2025 20:13
fern-support pushed a commit that referenced this pull request Apr 1, 2025
* fix(csharp): Fallback init to set
dsinghvi added a commit that referenced this pull request Apr 1, 2025
* fix(cli): misc improvements to the readme migrator

* misc fixes

* fix

* feat(java): Generate snippet.json (#6601)

* feat(java): Generate snippet.json

* generate fixtures

* Revert print options to false

* Add changelog

* chore: update changelog

* chore: update changelog

---------

Co-authored-by: fern-support <[email protected]>

* fix(python): Replace src.fern_python imports with fern_python imports (#6608)

* fix(java): Fix pagination in raw clients (#6609)

* fix(java): Fix pagination in raw clients

* Add changelog entry

* chore: update changelog

* Run fixtures

* Make changelog patch

---------

Co-authored-by: fern-support <[email protected]>

* fix(cli): Correctly build undiscriminated enum & string unions (#6610)

* fix(cli): Correctly build undiscriminated enum & string unions

* Feature flag behind 'respect-forward-compatible-enums' flag

* chore: update changelog

* fix

* update tests

* fix(csharp): Fallback init to set (#6613)

* fix(csharp): Fallback init to set

* fix(cli): Improve parameter parsing for v3 AsyncAPI specs (#6616)

* fix(cli): Improve parameter parsing for v3 AsyncAPI specs

* chore: update changelog

* fix

* chore: update changelog

---------

Co-authored-by: Alberto Gateño <[email protected]>
Co-authored-by: fern-support <[email protected]>
Co-authored-by: Hugh Han <[email protected]>
Co-authored-by: eden wang <[email protected]>
Co-authored-by: Niels Swimberghe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants