-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add DynamicallyAccessedMemberTypes::NonPublicDefaultCtor #1688
Comments
How common is this - most reflection APIs only work with public default .ctors. |
Is there any alternative? This seems to be very cheap to implement in the linker and we could hide it with special code inside enum if necessary but why if we do have the implementation. |
We could make these couple of places intrinsics. |
Out of curiosity - what are the places that need this? The places I know of are in the "runtime magic" category that wouldn't be possible to annotate (like p/invoke for blittable classes, or safehandles). |
This seems to be mostly used for things that know what type to instantiate and don't want to use Activator (e.g. for performance reasons). |
You mean places like Activator has been recently tuned to be very fast so the internal need for special private APIs will be going away. The exact use cases would definitely help to see if there's any alternatives. The |
@marek-safar do you have a use case for this? I'm leaning towards just closing this. |
I think we changed the affected code because of this limitation to use public constructors but there are still cases like which might be worth addressing |
I find this relatively corner case requirement. The DataSet example is valid, but it's relatively weird (the DataSet itself has public parameterless .ctor, so this only applies to derived types, not sure how common it's there). The downside of doing this is that it requires adding a new public annotation (basically public API) and support it everywhere. The number of use cases seems really low for that. |
The default constructors are used via reflection quite often. Right now we have no way to mark any default constructors only. It'd be useful to have it as there are code pattern in SPC which are overmarking types because of this.
The closest pattern today is
@vitek-karas
The text was updated successfully, but these errors were encountered: