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

Setting BypassAutoPropertySettersInConstructors in FodyWeavers.xml #15

Open
sebandraos opened this issue Dec 17, 2019 · 3 comments
Open

Comments

@sebandraos
Copy link

Would it be possible to set the value of BypassAutoPropertySettersInConstructors in the FodyWeavers.xml file as well as an assembly level attribute? We have a few project templates that share FodyWeavers.xml files and it would be great to have this option. It may already be the case but I couldn't see any mention in the documentation.
Thanks in advance

@tom-englert
Copy link
Owner

As you can see this is already an assembly level attribute:

/// <summary>
/// Controls whether property setters for auto-properties are bypassed when a value is assigned to an auto-property in a constructor.<para/>
/// When this attribute is set with it's parameter being <c>true</c>, all property setters of auto-properties are replaced with code that assigns the value directly to the backing field.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)]
public sealed class BypassAutoPropertySettersInConstructorsAttribute : Attribute

@sebandraos
Copy link
Author

Hi @tom-englert , I understand that. My question is specifically about using the FodyWeavers.xml as well as the attribute. We don't have any other assembly level attributes as, in SDK-style projects, most "standard" ones have been replaced by properties from the .csproj. Given that some weavers do allow the addition of settings at that level I was wondering if that would be possible here too. Thanks

@tom-englert
Copy link
Owner

If you need such a behavior, you can provide a PR.

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

No branches or pull requests

2 participants