Closed KirillOsenkov closed 5 months ago
This is because Cecil API bleeds into ILRepack public API, so for consistency the transitive closure of Cecil exposed publicly needs to be public:
Processing public types tree Public API: Forcing type ILRepack::Mono.Cecil.AssemblyAttributes to public because of: ILRepacking.ILRepack -> OtherAssemblies -> Generic type argument AssemblyDefinition -> Mono.Cecil.AssemblyDefinition -> Name -> Mono.Cecil.AssemblyNameDefinition -> base type -> Mono.Cecil.AssemblyNameReference -> Attributes -> Mono.Cecil.AssemblyAttributes
I'll see if we can make some ILRepack API internal as to avoid exposing Cecil API.
Versions < 2.0.21 used to produce invalid assemblies where public API mentioned internal types. 2.0.21 and later fixes this by automatically "publicizing" the transitive closure of the main assembly's public API
This was done here: https://github.com/gluck/il-repack/commit/fed76eead2fbea469234285c3fe97ee6ca2b6614
@mattleibow I think we're in a bit of a pickle here. ILRepack liberally smeared Cecil types all over its public API. If we force Cecil types to internal it will be an invalid assembly (not sure how does 2.0.18 even work?)
If we make all parts of ILRepack API internal that mention Cecil, we might break consumers who expect that API.
Can you point me to your usage(s) of the ILRepack API? I'm guessing you're using https://www.nuget.org/packages/ilrepack.lib?
Ideally I think ILRepack shouldn't have exposed Cecil as it's an implementation detail. If suppose in the future we want to switch from Cecil to System.Reflection.Metadata, we should be able to do it without impacting consumers.
I'd be curious if anyone depends on the aspects of ILRepack public API that has Cecil types.
I decided to risk it and made 10 members internal and that resulted in Cecil being properly internalized. If this breaks someone else, my apologies, we'll look into that next.
Published 2.0.30, please try it out: https://www.nuget.org/packages/ILRepack/2.0.30 https://www.nuget.org/packages/ILRepack.Lib/2.0.30
Amazing. I'll try it out ASAP.
See https://github.com/gluck/il-repack/issues/357#issuecomment-2035275096