Currently, C# assemblies are building reference assemblies via ProduceReferenceAssembly (corresponding to the CSC flag -refout).
This causes several issues:
InternalsVisibleTo in many of its assemblies.Currently, the known dangling references are in the PresentationCore and PresentationFramework reference assemblies, the later only when PresentationUI's reference assembly is removed.
To fix these, we want to switch to using the GenAPI tool so that we can tailor the content of the reference assemblies to only contain necessary API surface area.
Our builds directly use ProjectReference for needed assemblies that are in the same repository and will alter these for those that are not available in the same repository (via WpfProjectReference.targets). We likely will have to update this mechanic if internal building assemblies require internals from the reference assemblies.
PresentationCore's reference assemblyReference assemblies contain internal types due to WPF's use of InternalsVisibleTo in many of its assemblies.
If this is the only thing blocking, would it not just be feasible to log an ask on Roslyn to allow this to be configured (that is, to not emit internals to the reference assembly if IVTs are enabled)?
As much as having those internals is non desirable, it is very easy (especially when using new language features) to deviate from what Roslyn considers to be part of the public surface area (and therefore to break downstream consumers who may be dependent on that).
CC. @jaredpar, @jcouv
Also CC. @ericstj
I don't know if Roslyn can turn around a feature request for us in <2 weeks... we may want to use GenAPI for now and see if a future Roslyn feature can be adopted.
We need to use GenAPI anyway because Roslyn is not a magic-bullet for WPF (because of C++/CLI).
I don't know if Roslyn can turn around a feature request for us in <2 weeks...
Probably not at this moment.
@tannergooding, I tried to stop by your office, but missed you. Come find me when you have some time.
I don't know if Roslyn can turn around a feature request for us in <2 weeks... we may want to use GenAPI for now and see if a future Roslyn feature can be adopted.
We need to use GenAPI anyway because Roslyn is not a magic-bullet for WPF (because of C++/CLI).
I agree, we can pivot back to using Roslyn generated C# ref assemblies when the ability for configuration exists, but for now GenAPI seems like the fastest path toward Preview 7.
don't know if Roslyn can turn around a feature request for us in <2 weeks... we may want to use GenAPI for now and see if a future Roslyn feature can be adopted.
Right, and I wasn't meaning to suggest that using GenAPI temporarily for C# code is a bad thing.
I just want to ensure that:
RefOut featureI think it would be generally beneficial to log an issue on https://github.com/dotnet/roslyn/issues tracking the issue here.
@tannergooding Thanks, I filed an issue for some way of excluding internal surface area from generated reference assemblies.
Currently building ref assemblies for all C# projects (that require it). Working branch is https://github.com/dotnet/wpf/tree/dev/roladuca/genapics
Most helpful comment
Right, and I wasn't meaning to suggest that using GenAPI temporarily for C# code is a bad thing.
I just want to ensure that:
RefOutfeatureI think it would be generally beneficial to log an issue on https://github.com/dotnet/roslyn/issues tracking the issue here.