canton7 / RestEase

Easy-to-use typesafe REST API client library for .NET Standard 1.1 and .NET Framework 4.5 and higher, which is simple and customisable. Inspired by Refit
MIT License
1.08k stars 109 forks source link

RestEase.SourceGenerator not using `*.g.cs` in generated source files. #226

Closed brogdogg closed 2 years ago

brogdogg commented 2 years ago

Description A clear and concise description of what the bug is. Use screenshots as necessary.

I am utilizing the source generator to generate my API clients. This unfortunately causes

dotnet test --configuration Release --verbosity normal --collect:"XPlat Code Coverage"

To skip generating coverage for my library containing the interface with errors like:

[coverlet]Unable to instrument module: , pdb without local source files, RestEase_*.cs

Looking at coverlet they ignore all source generated files following Microsoft's recommendation, for example: RestEase_*.g.cs.

I know this is not necessarily a bug in this project, but was wondering if you wouldn't mind adding the g.cs? I think it is being done here. If it is, I could open a PR to add it if you would like?

To Reproduce Can use samples from your main ReadMe to generate. Then run the:

dotnet test --configuration Release --verbosity normal --collect:"XPlat Code Coverage"

Version Info

Additional Info Add any other context about the problem here.

canton7 commented 2 years ago

Sure, I don't see why not. I'm slightly surprised that the source generator machinary doesn't do this by default, but other MS SGs seem to have run into the same problem and are manually appending .g as a workaround.

brogdogg commented 2 years ago

Awesome @canton7, much appreciated on the quick turn around on that. Tried it out today and works beautifully.

And I agree, seems weird the SG engine doesn't automatically handle that for ya.