I run a little powershell script on build that adds the [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] attribute to generated classes in certain folders.
https://gist.github.com/mtone/aded2ff636cb6dd9d428cf5800f344...
Funnily, I have no clue how to setup a build script in Rider, did that in VS (Rider do run it).