Generic new constraint instead of DynamicallyAccessedMembers #124195
-
|
I was working with I found a lot of public generic methods that uses it and decorate the generic parameter with This got me curious. Is there a reason for not adding Example: public sealed class MyObject
{
public MyObject(int id) { }
}
MyObjecto = null;
_ = LazyInitializer.EnsureInitialized<MyObject>(ref o); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You mean a reason we didn't add We didn't want to break everyone just because of trimming (it would be breaking for everyone, whether they use trimming or not). For trimming analysis, |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for you explanation, so just to clarify the breaking change is the compile time error that would have been a runtime error anyways or is it a binary breaking because adding |
Beta Was this translation helpful? Give feedback.
Yes, compile time error for something that might not actually be reachable at runtime. E.g.