Closed Perksey closed 7 months ago
Took a quick peek. The vast majority of cases just need [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
on the type parameter and they should be good.
Cases like this, though, will never be trimming-compatible, I don't think:
Unless we can somehow abuse InputPlatformAttribute
to signal to the linker to keep the type... :thinking:
Since we build for TFMs that don't have [DynamicallyAccessedMembers]
, would you prefer to pull in PolySharp, or use #if
s?
Yeah the paths you linked are only used in non-AOT scenarios - users are already expected to use GlfwWindowing.Use and friends to register the platforms today on AOT.
I agree with your assessment as well, it seemed like this was just a case of adding attributes. It would be nice if we didn’t need to use the Activator at all, which in theory could be possible using static abstracts in interfaces but only on newer platforms, so I guess we can deal with it for now.
So in any case we’ll need to add some TFM hackery. We probably shouldn’t pull in PolySharp as we try to avoid pulling in non-.NET Foundation packages in core projects. Recommend an #ifdef or something similar to how I handled RequiresLocationAttribute.
Modified the CoreRTTest project to add a TryGetExtension call with PublishAot=true, PublishTrimmed=true, and TrimMode=full. Fixed with the changes in #2115
Easy issue. May need some linking attributes littered some places. Reported in Discord.