You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
As part of investigating coverlet-coverage/coverlet#1084 and the impact it is having on various projects I maintain trying to use Refit 6.0, I noticed that Refit is emitting a Generated class into each project that references Refit, even transitively, rather than only projects which explicitly define a Refit interface.
As a consequence this spreads the coverlet issue to the entire solution through the transitive reference(s) and breaks coverlet code coverage for all projects under test that reference Refit.
Unless there's a specific reason why this emitted code must always be present, it seems to me that it would be better not to emit the Generated class (or PreserveAttribute). As well as helping mitigate the problem in coverlet, it would also reduce the on-disk size of assemblies referencing Refit by not emitting unused types.
Would you accept a PR to adjust the generator in this way?
Describe the solution you'd like
Refit does not emit any generated code into an assembly referencing Refit if no Refit interfaces are present to generate code for.
Describe alternatives you've considered
None.
Describe suggestions on how to achieve the feature
Is your feature request related to a problem? Please describe.
As part of investigating coverlet-coverage/coverlet#1084 and the impact it is having on various projects I maintain trying to use Refit 6.0, I noticed that Refit is emitting a
Generated
class into each project that references Refit, even transitively, rather than only projects which explicitly define a Refit interface.As a consequence this spreads the coverlet issue to the entire solution through the transitive reference(s) and breaks coverlet code coverage for all projects under test that reference Refit.
Unless there's a specific reason why this emitted code must always be present, it seems to me that it would be better not to emit the
Generated
class (orPreserveAttribute
). As well as helping mitigate the problem in coverlet, it would also reduce the on-disk size of assemblies referencing Refit by not emitting unused types.Would you accept a PR to adjust the generator in this way?
Describe the solution you'd like
Refit does not emit any generated code into an assembly referencing Refit if no Refit interfaces are present to generate code for.
Describe alternatives you've considered
None.
Describe suggestions on how to achieve the feature
Have the
GenerateInterfaceStubs()
method exit early if there are no Refit interfaces found.refit/InterfaceStubGenerator.Core/InterfaceStubGenerator.cs
Line 45 in f6621d9
Additional context
Screenshot of ILSpy showing a
Generated
class in three assemblies, where two are empty, despite only one containing a Refit interface.The assemblies were generated from this repro project: https://github.com/martincostello/coverlet-refit-repro
The text was updated successfully, but these errors were encountered: