-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Options source generator shouldn't use random names #90990
Comments
Tagging subscribers to this area: @dotnet/area-extensions-options Issue DetailsGenerated code should be deterministic. Many companies and orgs have requirements around deterministic builds.
cc @jaredpar Originally posted by @eerhardt in #89148 (comment)
|
@jaredpar what is the suggestion here? We need to have a class name that is global internal and not conflict when two independent compilations using the generator and one of them is internal visible to the other one. The source gen supports Lang versions 8+. We already detect if using Lang Version 11+ we use |
Incorporate a hash of more data, like the assembly's name. Or use C#11 and/or don't use InternalsVisibleTo. |
I want to avoid restricting the language version only because of that. I am not sure what do you mean by
This looks like a reasonable idea to try. Thanks! |
I would start with requiring C# 11 and wait to see if users push back. Other generators like the regex generator have set that standard and, to my understanding at least, that has not been a problem thus far. I would not invest in making my generator more complex to support this scenario unless I had data saying that would be valuable. |
@geeknoid @stephentoub @eerhardt would you be ok if we require Language version 11+ for the options source gen? CC @ericstj |
I mean if incorporating assembly name is insufficient and you absolutely need IVT and you're using the options generator in two assemblies connected by IVT and you're using a language version less than 11, bump it to 11. This is why |
This is fixed by #91432 |
runtime/src/libraries/Microsoft.Extensions.Options/gen/Emitter.cs
Lines 40 to 42 in 3ef2c80
Generated code should be deterministic. Many companies and orgs have requirements around deterministic builds.
cc @jaredpar
Originally posted by @eerhardt in #89148 (comment)
The text was updated successfully, but these errors were encountered: